diff options
author | Matthew Wahab <matthew.wahab@arm.com> | 2015-06-04 11:16:56 +0100 |
---|---|---|
committer | Jiong Wang <jiong.wang@arm.com> | 2015-06-04 11:16:56 +0100 |
commit | 07c58460aa93cf08f63383decf5bc4f2a02de5bf (patch) | |
tree | 378102655ea7bc7845ccc08ffc5b20709cf1e47f | |
parent | 0dfb3bb7057f9e56eea6a2008f7610298181b98c (diff) | |
download | gdb-07c58460aa93cf08f63383decf5bc4f2a02de5bf.zip gdb-07c58460aa93cf08f63383decf5bc4f2a02de5bf.tar.gz gdb-07c58460aa93cf08f63383decf5bc4f2a02de5bf.tar.bz2 |
[AArch64] Backport fix for minimum code section alignment
-rw-r--r-- | gas/ChangeLog | 5 | ||||
-rw-r--r-- | gas/config/tc-aarch64.c | 9 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gas/testsuite/gas/aarch64/codealign.d | 16 | ||||
-rw-r--r-- | gas/testsuite/gas/aarch64/codealign.s | 2 |
5 files changed, 36 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 7632ef8..1195d98 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2015-06-04 Matthew Wahab <matthew.wahab@arm.com> + + * config/tc-aarch64.c (mapping_state): Set minimum alignment for code + sections. + 2015-05-07 Renlin Li <renlin.li@arm.com> * 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 62a1a3f..10b1b74 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 01f74ca..6477054 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-06-04 Matthew Wahab <matthew.wahab@arm.com> + + * gas/aarch64/codealign.d: Add test for code section alignment. + * gas/aarch64/codealign.s: New file. + 2015-05-14 Peter Bergner <bergner@vnet.ibm.com> Applied from master. diff --git a/gas/testsuite/gas/aarch64/codealign.d b/gas/testsuite/gas/aarch64/codealign.d new file mode 100644 index 0000000..8e75c87 --- /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 0000000..b80a6d9 --- /dev/null +++ b/gas/testsuite/gas/aarch64/codealign.s @@ -0,0 +1,2 @@ +.text + nop |