Thumb (PLT) problem

Nick Clifton nickc@redhat.com
Wed Mar 9 12:17:00 GMT 2005


Hi Feri,

> I have to rewrite the files `$UCLIBC_PATH/libc/sysdeps/linux/
> arm/*' to work in thumb mode. 

Poor you. :-)  You couldn't just add an thumb prologue to these 
functions which switches into ARM mode and then continues with the real 
function ?  (Plus a suitable epilogue to switch back, of course).

> bsd-setjmp.S:36: Error: garbage following instruction -- 
> `b __sigsetjmp(PLT)'

The assembler is complaining about the "(PLT)".  It does not understand 
this annotation when working in THUMB mode.

> And what is (PLT) for here?

It tells the assembler to generate an R_ARM_PLT32 reloc for the branch 
instruction instead of an R_ARM_PC24 reloc.  (If you do not know what a 
PLT is, or a reloc for that matter, then you are in for a lot of fun, 
and reading, in order to understand what is going on here).

Of course your next question is probably going to be "how do I code the 
same thing in THUMB mode then ?"  The simple answer is to drop the 
(PLT), by removing the use of the PLTJMP() macro from inside 
bsd-setjmp.S.  Of course you would only want to do this if you are 
operating in THUMB mode, so possibly you may want to extend the PLTJMP 
macro to do nothing if it can detect that you are generating THUMB code.

Cheers
   Nick



More information about the Binutils mailing list