aarch64: Avoid unaligned jump tables

Manually add a padding 0 entry to make the odd number of .hword
entries align with the instruction size.

This fixes assembling with GAS, with the --gdwarf2 option, where
it previously produced the error message "unaligned opcodes detected
in executable segment".

The message is slightly misleading, as the error is printed even
if there actually are no opcodes that are misaligned, as the jump
table is the last thing within the .text section. The issue can
be reproduced with an input as small as this, assembled with
"as --gdwarf2 -c test.s".

        .text
        nop
        .hword 0

See a6228f47f0 for earlier cases of
the same error - although in those cases, we actually did have more
code and labels following the unaligned jump tables.

This error is present with binutils 2.39 and earlier; in
binutils 2.40, this input no longer is considered an error, fixed
in https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=6f6f5b0adc9efd103c434fd316e8c880a259775d.
This commit is contained in:
Martin Storsjö 2024-04-19 00:07:44 +03:00
parent a9feab9bc1
commit cb8151c969
1 changed files with 1 additions and 0 deletions

View File

@ -1397,6 +1397,7 @@ L(\type\()_8tap_h_\isa\()_tbl):
.hword (L(\type\()_8tap_h_\isa\()_tbl) - 40b)
.ifc \type, put
.hword (L(\type\()_8tap_h_\isa\()_tbl) - 20b)
.hword 0
.endif
endfunc
.endm