]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
RISC-V: process rs_align_code also when relaxing
authorJan Beulich <jbeulich@suse.com>
Fri, 23 Aug 2024 07:22:30 +0000 (09:22 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 23 Aug 2024 07:22:30 +0000 (09:22 +0200)
commitb994624fa57b3314098656e110781d4d0f77b4e4
treebec48e835b25fec6b01e4de1b39f49e3ec65b242
parent57db1af8bae52592d173a3be22dd8943ad120dd7
RISC-V: process rs_align_code also when relaxing

riscv_handle_align() runs after all input was processed. Whether
relaxation is enabled for any particular piece of code is not recorded
anywhere. (This issue was even "worked around" in a gas testcase, which
is adjusted accordingly.) Furthermore, as demonstrated by an ld
testcase, tail padding in an object file's executable sections depended
on whether relaxation was enabled at the end of assembly: NOPs were
emitted only when relaxation was off; zeroes were emitted with
relaxation enabled. (It could probably be either way, but it should be
independent of relaxation state at the end of assembly. Except of course
write.c, in a comment ahead of #define-ing SUB_SEGMENT_ALIGN(),
explicitly says "proper nop-filling".)

While re-indenting, drop the "odd_padding" variable. It's used exactly
once, and having the actual expression right in the if() is imo helping
readers to understand what the intentions are.

While touching the ld testcase, also tighten the expectations for the
addresses of the two symbols: The last two digits have to have fixed
values.
gas/config/tc-riscv.c
gas/testsuite/gas/riscv/mapping.s
ld/testsuite/ld-riscv-elf/relax-max-align-gp.d