This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: Linking arm thumb code


Hi Adrian,

> Adrian write:
>
> ld: Warning: type of symbol `__uClibc_main' changed from 2 to 13 in
> __uClibc_main.o

: Phil wrote:
:
: Type 2 is plain old STT_FUNC; type 13 is STT_TFUNC.  I'm not sure
: why this warning is turning up, but I don't think it's directly
: related to the problem you're having.

Actually I think it may very well be important...

>        .weak   __init_stdio
>        .thumb_set __init_stdio,__uClibc_empty_func
>	...
>        .section        .rodata
>        .align  2
> .LC0:
>        .word   __init_stdio
 
: I think ".thumb_set" is supposed to mark the symbol as being of
: Thumb type.

It is.

: That should mean that the low bit gets set, causing BX to do the right thing.

Right.


> But of course this could also be the loader or elf2flt. Hmmm. I'm not
> familiar enough with objdump and elf, so you'd have to assist me here.

Hmm, you have a PIC scheme here yes ?  So the loader is responsible
for handling relocs that contain run time addresses ?  In which this
may well be the problem.  For a relocation like this:

> RELOCATION RECORDS FOR [.rodata]:
> OFFSET   TYPE              VALUE 
> 00000000 R_ARM_ABS32       __init_stdio

If the symbol being relocated (__init_stdio) is a thumb function
symbol (type 13) then the bottom bit must be set when the relocation
is computed.  Have a look at the code that starts like this:

  #if 1 /* THUMBEXTENSION */
        /* FIXME:
	   Is this the best way to fix up thumb addresses? krk@cygnus.com
	   Probably not, but it works, and if it works it don't need fixing!  nickc@cygnus.com */
        /* Only perform this fix during the final link, not a relocatable link.  nickc@cygnus.com  */

in coff_arm_relocate_section in bfd/coff-arm.c for an example of
this.

Cheers
        Nick



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