[PATCH][GAS][AARCH64]Emit DATA_MAP in order within text section, align code when transformed from MAP_DATA state into MAP_INSN state.
Renlin Li
renlin.li@arm.com
Fri Mar 27 15:28:00 GMT 2015
Hi,
This is a patch doing three related things.
1), Emit MAP_DATA symbol for data in text section in order.
Previously, if a section start with data (MAP_UNDEFINED --> MAP_DATA),
this MAP_DATA symbol is not emitted until an instruction is processed.
Now mapping symbols will be emitted in order within text section.
It reverts the change made here:
https://sourceware.org/ml/binutils/2015-03/msg00331.html
In that change, data mapping symbols are emitted, but not in correct
order in a few cases. mapping_state_2 will be called while finishing
subsegs. A MAP_DATA will be emitted there if there is a postpone one.
The order it not correct, although there is no behavior difference.
for the following snippet:
.text
label1:
.long 1
label2:
the symbols dumped should be in the correct order: label1, $d, label2
Really sorry for the NOISE!
2), Align frag when the state is transformed from MAP_DATA to MAP_INSN,
in this
case, a new frag is created and the start address is 4 bytes aligned.
Previously, this is not considered. Thanks to Nick's explanation for .inst
directive.
for the following code snippet.
.text
.short 0xffff
ret
.short 0xffff
ret
Before the patch, when object dumped, the following code is generated:
0: ffff .short 0xffff
2: d65f03c0 ret
6: 1111 .short 0x1111
8: d65f03c0 ret
After the patch:
0: ffff .short 0xffff
2: 0000 .short 0x0000
4: d65f03c0 ret
8: 1111 .short 0x1111
a: 0000 .short 0x0000
c: d65f03c0 ret
3), Because now mapping symbols are emitted in order in text
section(because of the first change). I made the assumption that, when
the code is transformed from MAP_UNDEFINED --> MAP_INSN, it's alway
aligned(there is no pending MAP_DATA symbol anymore), we don't have to
aligned it again. So frag_align_code is called only during MAP_DATA -->
MAP_INSN state transition.
This fixes the bug mentioned here:
https://sourceware.org/ml/binutils/2015-03/msg00339.html
binutils and aarch64-none-elf regress tests run without new issues.
An arm one should also be prepared.
Okay to commit?
Regards,
Renlin Li
gas/ChangeLog:
2015-03-27 Renlin Li <renlin.li@arm.com>
* config/tc-aarch64.c (mapping_state): Emit MAP_DATA within text
section in order.
(mapping_state_2): Don't emit MAP_DATA here.
(s_aarch64_inst): Align frag during state transition.
(md_assemble): Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: final.diff
Type: text/x-patch
Size: 3673 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150327/03562f67/attachment.bin>
More information about the Binutils
mailing list