Skip to content

aarch64: Avoid unaligned jump tables

Martin Storsjö requested to merge mstorsjo/dav1d:arm-align-jumptable into master

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 a6228f47 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.

Merge request reports