[GAS][ARM]Use frag's thumb_mode information when available.

Renlin Li renlin.li@arm.com
Tue Jun 2 09:17:00 GMT 2015


Hi all,


In arm_init_frag(), thumb_mode is used to decide generate MAP_ARM or 
MAP_THUMB mapping symbol when aligning code. However, thumb_mode is a 
static variable. arm_init_frag will be called in two different stages, 
reading source file and writing object file.

This is not a problem before. But after my change here: 
https://sourceware.org/ml/binutils/2015-04/msg00381.html. The switch 
statement will always be evaluated. In this case, previous thumb_mode 
(decided while processing source file) will affect the correct map 
symbol inserting later.

For example:

arm_func:
         bx      lr
                      ------------> MAP_THUMB is inserted here while 
finishing subseg.
         .thumb_func  ------------> thumb_mode is 1 while reading source 
file.
         .p2align 4

thumb_func:
         bx      lr

The assembly objectdump looks like this which is not correct:

00000000 <arm_func>:

    0:   e12fff1e        bx      lr
    4:   0000            movs    r0, r0
    6:   e1a0            b.n     34a <thumb_func+0x33a>
    8:   0000            movs    r0, r0
    a:   e1a0            b.n     34e <thumb_func+0x33e>
    c:   0000            movs    r0, r0
    e:   e1a0            b.n     352 <thumb_func+0x342>

00000010 <thumb_func>:

   10:   4770            bx      lr
   12:   46c0            nop                     ; (mov r8, r8)
   14:   46c0            nop                     ; (mov r8, r8)
   16:   46c0            nop                     ; (mov r8, r8)

binutils, gas, ld regression test Okay. Okay to commit?

Regards,
Renlin Li

gas/ChangeLog:

2015-06-02  Renlin Li  <renlin.li@arm.com>
         * config/tc-arm.c (arm_init_frag): Use frag's thumb_mode
         information when available.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: new-1.diff
Type: text/x-patch
Size: 1146 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150602/eac004c1/attachment.bin>


More information about the Binutils mailing list