Message ID | 1396605566-7328-1-git-send-email-will.newton@linaro.org |
---|---|
State | Accepted |
Headers | show |
On 4 April 2014 10:59, Will Newton <will.newton@linaro.org> wrote: > If there is a a trailing align statement in a code section we may > output data padding with a data mapping followed by a code alignment > with a code mapping. The literal pool may then be output with a code > mapping symbol which will cause it to be endian swapped in a big-endian > configuration. When outputting a literal pool make sure that a data > mapping symbol is output in all cases. > > gas/ChangeLog: > > 2014-04-04 Will Newton <will.newton@linaro.org> > > * config/tc-arm.c (s_ltorg): Call make_mapping_symbol > directly instead of mapping_state. > > gas/testsuite/ChangeLog: > > 2014-04-04 Will Newton <will.newton@linaro.org> > > * gas/arm/mapmisc.d: Check literal pool mapping with > a trailing .align statement. > * gas/arm/mapmisc.s: Likewise. > --- > gas/config/tc-arm.c | 5 +++-- > gas/testsuite/gas/arm/mapmisc.d | 10 ++++++++++ > gas/testsuite/gas/arm/mapmisc.s | 6 ++++++ > 3 files changed, 19 insertions(+), 2 deletions(-) Ping? > diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c > index 69299c7..88136f4 100644 > --- a/gas/config/tc-arm.c > +++ b/gas/config/tc-arm.c > @@ -3328,8 +3328,6 @@ s_ltorg (int ignored ATTRIBUTE_UNUSED) > || pool->next_free_entry == 0) > return; > > - mapping_state (MAP_DATA); > - > /* Align pool as you have word accesses. > Only make a frag if we have to. */ > if (!need_pass_2) > @@ -3337,6 +3335,9 @@ s_ltorg (int ignored ATTRIBUTE_UNUSED) > > record_alignment (now_seg, 2); > > + seg_info (now_seg)->tc_segment_info_data.mapstate = MAP_DATA; > + make_mapping_symbol (MAP_DATA, (valueT) frag_now_fix (), frag_now); > + > sprintf (sym_name, "$$lit_\002%x", pool->id); > > symbol_locate (pool->symbol, sym_name, now_seg, > diff --git a/gas/testsuite/gas/arm/mapmisc.d b/gas/testsuite/gas/arm/mapmisc.d > index f5b7039..0e1d046 100644 > --- a/gas/testsuite/gas/arm/mapmisc.d > +++ b/gas/testsuite/gas/arm/mapmisc.d > @@ -47,6 +47,10 @@ SYMBOL TABLE: > 0+a0 l .text 00000000 \$d > 0+a4 l .text 00000000 \$a > 0+a8 l .text 00000000 \$a > +0+b0 l .text 00000000 string > +0+b0 l .text 00000000 \$d > +0+b4 l .text 00000000 \$d > +0+b3 l .text 00000000 \$d > 0+00 l d .ARM.attributes 00000000 .ARM.attributes > > > @@ -95,3 +99,9 @@ Disassembly of section .text: > a0: 7778797a .word 0x7778797a > a4: e1a00000 nop ; \(mov r0, r0\) > a8: e1a00000 nop ; \(mov r0, r0\) > + ac: e51f0000 ldr r0, \[pc, #-0\] ; b4 <string\+0x4> > +000000b0 <string>: > + b0: 6261 .short 0x6261 > + b2: 63 .byte 0x63 > + b3: 00 .byte 0x00 > + b4: 000000b0 .word 0x000000b0 > diff --git a/gas/testsuite/gas/arm/mapmisc.s b/gas/testsuite/gas/arm/mapmisc.s > index 1625515..c203e74 100644 > --- a/gas/testsuite/gas/arm/mapmisc.s > +++ b/gas/testsuite/gas/arm/mapmisc.s > @@ -38,3 +38,9 @@ foo: > nop > .fill 0, 0, 0 > nop > +# This test should always be at the end. Check that a trailing align does > +# not cause the literal pool to be emitted with a code mapping symbol. > + ldr r0,=string > +string: > + .ascii "abc" > + .align 2 > -- > 1.8.1.4 >
Hi Will, >> gas/ChangeLog: >> >> 2014-04-04 Will Newton <will.newton@linaro.org> >> >> * config/tc-arm.c (s_ltorg): Call make_mapping_symbol >> directly instead of mapping_state. >> >> gas/testsuite/ChangeLog: >> >> 2014-04-04 Will Newton <will.newton@linaro.org> >> >> * gas/arm/mapmisc.d: Check literal pool mapping with >> a trailing .align statement. >> * gas/arm/mapmisc.s: Likewise. Approved - please apply. Cheers Nick
On non-ELF ARM targets, eg. arm-pe, arm-coff, arm-aout: /src/binutils-gdb/gas/config/tc-arm.c: In function ‘s_ltorg’: /src/binutils-gdb/gas/config/tc-arm.c:3338:21: error: ‘segment_info_type’ has no member named ‘tc_segment_info_data’ /src/binutils-gdb/gas/config/tc-arm.c:3338:55: error: ‘MAP_DATA’ undeclared (first use in this function) /src/binutils-gdb/gas/config/tc-arm.c:3338:55: note: each undeclared identifier is reported only once for each function it appears in /src/binutils-gdb/gas/config/tc-arm.c:3339:3: error: implicit declaration of function ‘make_mapping_symbol’ [-Werror=implicit-function-declaration] cc1: all warnings being treated as errors
Hi Will, On 24/04/14 06:33, Alan Modra wrote: > On non-ELF ARM targets, eg. arm-pe, arm-coff, arm-aout: > > /src/binutils-gdb/gas/config/tc-arm.c: In function ‘s_ltorg’: > /src/binutils-gdb/gas/config/tc-arm.c:3338:21: error: ‘segment_info_type’ has no member named ‘tc_segment_info_data’ > /src/binutils-gdb/gas/config/tc-arm.c:3338:55: error: ‘MAP_DATA’ undeclared (first use in this function) I have checked in the obvious fix for this. Cheers Nick gas/ChangeLog 2014-04-24 Nick Clifton <nickc@redhat.com> * config/tc-arm.c (s_ltorg): Only create a mapping symbol for ELF based targets.
On 24 April 2014 11:42, Nicholas Clifton <nickc@redhat.com> wrote: > Hi Will, > > > On 24/04/14 06:33, Alan Modra wrote: >> >> On non-ELF ARM targets, eg. arm-pe, arm-coff, arm-aout: >> >> /src/binutils-gdb/gas/config/tc-arm.c: In function ‘s_ltorg’: >> /src/binutils-gdb/gas/config/tc-arm.c:3338:21: error: ‘segment_info_type’ >> has no member named ‘tc_segment_info_data’ >> /src/binutils-gdb/gas/config/tc-arm.c:3338:55: error: ‘MAP_DATA’ >> undeclared (first use in this function) > > > > I have checked in the obvious fix for this. Thanks, you beat me to it. Sorry for breaking the build!
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 69299c7..88136f4 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -3328,8 +3328,6 @@ s_ltorg (int ignored ATTRIBUTE_UNUSED) || pool->next_free_entry == 0) return; - mapping_state (MAP_DATA); - /* Align pool as you have word accesses. Only make a frag if we have to. */ if (!need_pass_2) @@ -3337,6 +3335,9 @@ s_ltorg (int ignored ATTRIBUTE_UNUSED) record_alignment (now_seg, 2); + seg_info (now_seg)->tc_segment_info_data.mapstate = MAP_DATA; + make_mapping_symbol (MAP_DATA, (valueT) frag_now_fix (), frag_now); + sprintf (sym_name, "$$lit_\002%x", pool->id); symbol_locate (pool->symbol, sym_name, now_seg, diff --git a/gas/testsuite/gas/arm/mapmisc.d b/gas/testsuite/gas/arm/mapmisc.d index f5b7039..0e1d046 100644 --- a/gas/testsuite/gas/arm/mapmisc.d +++ b/gas/testsuite/gas/arm/mapmisc.d @@ -47,6 +47,10 @@ SYMBOL TABLE: 0+a0 l .text 00000000 \$d 0+a4 l .text 00000000 \$a 0+a8 l .text 00000000 \$a +0+b0 l .text 00000000 string +0+b0 l .text 00000000 \$d +0+b4 l .text 00000000 \$d +0+b3 l .text 00000000 \$d 0+00 l d .ARM.attributes 00000000 .ARM.attributes @@ -95,3 +99,9 @@ Disassembly of section .text: a0: 7778797a .word 0x7778797a a4: e1a00000 nop ; \(mov r0, r0\) a8: e1a00000 nop ; \(mov r0, r0\) + ac: e51f0000 ldr r0, \[pc, #-0\] ; b4 <string\+0x4> +000000b0 <string>: + b0: 6261 .short 0x6261 + b2: 63 .byte 0x63 + b3: 00 .byte 0x00 + b4: 000000b0 .word 0x000000b0 diff --git a/gas/testsuite/gas/arm/mapmisc.s b/gas/testsuite/gas/arm/mapmisc.s index 1625515..c203e74 100644 --- a/gas/testsuite/gas/arm/mapmisc.s +++ b/gas/testsuite/gas/arm/mapmisc.s @@ -38,3 +38,9 @@ foo: nop .fill 0, 0, 0 nop +# This test should always be at the end. Check that a trailing align does +# not cause the literal pool to be emitted with a code mapping symbol. + ldr r0,=string +string: + .ascii "abc" + .align 2