This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: arm/thumb: GOT and indirections


> Hi,
> 
> I work with GCC 3.0.4 and I found the same pb as you. Indeed, I have the
> following source and asm code : (compiled with -fpic and -mthumb options
> - and others but without importance here -)
> ...
>     sDisplayPuts(1,s);
> - 0x50f4 <vMain+40>:  ldr r3, [pc, #36] (0x511c <vMain+80>)
> - 0x50f6 <vMain+42>:  add r3, r10
> - 0x50f8 <vMain+44>:  ldr r3, [r3, #0]
> - 0x50fa <vMain+46>:  ldr r3, [r3, #0]                <----------- PB
> here
> - 0x50fc <vMain+48>:  mov r0, #1
> - 0x50fe <vMain+50>:  mov r1, r3  (add r1, r3, #0)
> - 0x5100 <vMain+52>:  bl 0x5048 <sDisplayPuts>
> ...
> 
> At 0x50fa (the second ldr r3 [r3,#0]), I think that this instruction
> must be suppressed...
> When I modify the source code and create a global const char*, I think
> it works because with the debugger, I saw the address of this constant
> in the r3 register.
> 
> Do you know if a correction exists (a patch for exemple before the 3.1.x
> release).

There are several quite serious bugs in the -mthumb -fpic code of 
gcc-3.0.x, since this combination is not really supported yet (not least 
is that switch tables are completely broken).  I've fixed several in the 
gcc-3.1 sources, but they are still largely untested.  I don't really have 
an OS to try them on.

R.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]