From: Matthew Wahab Date: Thu, 4 Jun 2015 10:16:56 +0000 (+0100) Subject: [AArch64] Backport fix for minimum code section alignment X-Git-Tag: binutils-2_25_1~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07c58460aa93cf08f63383decf5bc4f2a02de5bf;p=thirdparty%2Fbinutils-gdb.git [AArch64] Backport fix for minimum code section alignment --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 7632ef836c0..1195d98d01e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2015-06-04 Matthew Wahab + + * config/tc-aarch64.c (mapping_state): Set minimum alignment for code + sections. + 2015-05-07 Renlin Li * config/tc-aarch64.c (s_aarch64_inst): Align frag during state diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index 62a1a3fe2d9..10b1b740fa2 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -1481,7 +1481,14 @@ mapping_state (enum mstate state) /* The mapping symbol has already been emitted. There is nothing else to do. */ return; - else if (TRANSITION (MAP_UNDEFINED, MAP_DATA)) + + if (state == MAP_INSN) + /* AArch64 instructions require 4-byte alignment. When emitting + instructions into any section, record the appropriate section + alignment. */ + record_alignment (now_seg, 2); + + if (TRANSITION (MAP_UNDEFINED, MAP_DATA)) /* This case will be evaluated later in the next else. */ return; else if (TRANSITION (MAP_UNDEFINED, MAP_INSN)) diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 01f74caa5fc..6477054fcf3 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-06-04 Matthew Wahab + + * gas/aarch64/codealign.d: Add test for code section alignment. + * gas/aarch64/codealign.s: New file. + 2015-05-14 Peter Bergner Applied from master. diff --git a/gas/testsuite/gas/aarch64/codealign.d b/gas/testsuite/gas/aarch64/codealign.d new file mode 100644 index 00000000000..8e75c870ad6 --- /dev/null +++ b/gas/testsuite/gas/aarch64/codealign.d @@ -0,0 +1,16 @@ +#objdump: --section-headers +# Minimum code alignment should be set. +# This test is only valid on ELF based ports. +#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix* + +.*: +file format.*aarch64.* + +Sections: +Idx Name Size VMA LMA File off Algn + 0 \.text .* .* .* .* 2\*\*2 + .*CODE.* + 1 \.data .* .* .* .* 2\*\*0 + .*DATA.* + 2 \.bss .* .* .* .* 2\*\*0 +.* + diff --git a/gas/testsuite/gas/aarch64/codealign.s b/gas/testsuite/gas/aarch64/codealign.s new file mode 100644 index 00000000000..b80a6d9e2a0 --- /dev/null +++ b/gas/testsuite/gas/aarch64/codealign.s @@ -0,0 +1,2 @@ +.text + nop