https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71776

--- Comment #8 from malithyapa at gmail dot com ---
I managed to work around this by building gcc with --with-mode=arm

Configured with: ../gcc-4.9.4/configure --enable-languages=c,c++
--with-mode=arm --with-float=hard --build=arm-linux-gnueabihf
--host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --with-arch=armv7-a
--with-tune=cortex-a7 --with-sysroot=/ --libexecdir=/usr/lib --libdir=/usr/lib
--enable-threads=posix

but when i look at the thumb code, the linker should not have any problem there
because the symbol is very much in range of the branch instruction (12 bit
two's complement offset)

000000c4 <__gnu_h2f_internal>:
  c4:   f3c0 2384       ubfx    r3, r0, #10, #5
  c8:   2900            cmp     r1, #0
  ca:   f1a3 021f       sub.w   r2, r3, #31
  ce:   fab2 f282       clz     r2, r2
  d2:   ea4f 1252       mov.w   r2, r2, lsr #5
  d6:   bf08            it      eq
  d8:   2200            moveq   r2, #0
  da:   4611            mov     r1, r2
  dc:   f400 4200       and.w   r2, r0, #32768  ; 0x8000
  e0:   f3c0 0009       ubfx    r0, r0, #0, #10
  e4:   0412            lsls    r2, r2, #16
  e6:   b969            cbnz    r1, 104 <__gnu_h2f_internal+0x40>
  e8:   b92b            cbnz    r3, f6 <__gnu_h2f_internal+0x32>
  ea:   b180            cbz     r0, 10e <__gnu_h2f_internal+0x4a>
  ec:   fab0 f380       clz     r3, r0
  f0:   3b15            subs    r3, #21
  f2:   4098            lsls    r0, r3
  f4:   425b            negs    r3, r3
  f6:   3370            adds    r3, #112        ; 0x70
  f8:   0340            lsls    r0, r0, #13
  fa:   eb00 53c3       add.w   r3, r0, r3, lsl #23
  fe:   ea43 0002       orr.w   r0, r3, r2
 102:   4770            bx      lr
 104:   ea42 3040       orr.w   r0, r2, r0, lsl #13
 108:   f040 40ff       orr.w   r0, r0, #2139095040     ; 0x7f800000
 10c:   4770            bx      lr
 10e:   4610            mov     r0, r2
 110:   4770            bx      lr
 112:   bf00            nop

00000114 <__gnu_f2h_ieee>:
 114:   2101            movs    r1, #1
 116:   e773            b.n     0 <__gnu_f2h_internal>

00000118 <__gnu_h2f_ieee>:
 118:   2101            movs    r1, #1
 11a:   e7fe            b.n     c4 <__gnu_h2f_internal>  ***!!!!!!!!!!!!!!***

The only reason i can think of is if LTO is enabled and it has done something
funny with the organization, but -O0 was specifically mentioned in compilation. 

I don't understand the internals of gcc well enough to debug this, but the more
i look the more it looks like a bug.

Reply via email to