public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Thumb (PLT) problem
@ 2005-03-09 11:23 Kovacs.Ferenc.5
  2005-03-09 12:17 ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Kovacs.Ferenc.5 @ 2005-03-09 11:23 UTC (permalink / raw)
  To: binutils

Hello,

I have to rewrite the files `$UCLIBC_PATH/libc/sysdeps/linux/
arm/*' to work in thumb mode. I'm using buildroot with 
binutils 2.15, GCC 3.4.3, uclibc 0.9.27, 
linux-libc-headers-2.4.27. When assembling files which have 
function calls with (PLT) i get the following error message:

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

The bsd-setjmp.S looks like this:

# 1 "bsd-setjmp.S"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "bsd-setjmp.S"
# 26 "bsd-setjmp.S"
# 1 "/usr/include/bits/setjmp.h" 1 3 4
# 27 "bsd-setjmp.S" 2

.thumb
.globl setjmp;
.type setjmp,%function
.code 16;
.align 2;

setjmp:
 mov r1, #1
 b __sigsetjmp (PLT)
.size setjmp,.-setjmp;

Do you know what does this error message exactly mean? 
And what is (PLT) for here?? Sorry for my newbie-style-question, 
but i'm new to ARM assembly...

Feri

PS: If you know any useful docs on this topic please send me
a pointer. Thanks.




-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Thumb (PLT) problem
  2005-03-09 11:23 Thumb (PLT) problem Kovacs.Ferenc.5
@ 2005-03-09 12:17 ` Nick Clifton
  2005-03-09 13:39   ` Paul Brook
  2005-03-11 19:27   ` [OT] " Carlos O'Donell
  0 siblings, 2 replies; 4+ messages in thread
From: Nick Clifton @ 2005-03-09 12:17 UTC (permalink / raw)
  To: Kovacs.Ferenc.5; +Cc: binutils

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Thumb (PLT) problem
  2005-03-09 12:17 ` Nick Clifton
@ 2005-03-09 13:39   ` Paul Brook
  2005-03-11 19:27   ` [OT] " Carlos O'Donell
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Brook @ 2005-03-09 13:39 UTC (permalink / raw)
  To: binutils; +Cc: Nick Clifton, Kovacs.Ferenc.5

On Wednesday 09 March 2005 12:29, Nick Clifton wrote:
> > 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).

It's also worth noting that recent versions of the GNU linker treat both these 
relocations the same, so the (plt) annotation is technically obsolete.

Paul

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [OT] Re: Thumb (PLT) problem
  2005-03-09 12:17 ` Nick Clifton
  2005-03-09 13:39   ` Paul Brook
@ 2005-03-11 19:27   ` Carlos O'Donell
  1 sibling, 0 replies; 4+ messages in thread
From: Carlos O'Donell @ 2005-03-11 19:27 UTC (permalink / raw)
  To: binutils; +Cc: Kovacs.Ferenc.5

On Wed, Mar 09, 2005 at 12:29:02PM +0000, Nick Clifton wrote:
> 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).

For newbies who want to learn about PLT's and relocs in the comfort of
their own home:

"Linkers and Loaders" by John R. Levine.
256 pages. ISBN 1-55860-496-0

An excellent introduction to the required topics, with good chapter
questions, and references. Recommended shelf material, even if you just
pass it out to all the interns.

c.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-03-11 19:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-09 11:23 Thumb (PLT) problem Kovacs.Ferenc.5
2005-03-09 12:17 ` Nick Clifton
2005-03-09 13:39   ` Paul Brook
2005-03-11 19:27   ` [OT] " Carlos O'Donell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).