This is the mail archive of the binutils@sourceware.org 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: ARM THUMB_FUNC symbol type ?


On Mon, Jan 26, 2009 at 01:39:55PM +0100, Christophe LYON wrote:
> On 23.01.2009 19:30, Daniel Jacobowitz wrote:
>> On Fri, Jan 23, 2009 at 07:02:55PM +0100, Christophe LYON wrote:
>>> Maybe there should be a fix in readelf/objdump so that it is more 
>>> obvious to the end-user?
>>
>> IMO no - we're marking things in readelf exactly the way the ABI says
>> we ought.
> I couldn't find the related paragraph in the ABI :-(

AAELF section 4.5.2:

All code symbols exported from an object file (symbols with binding
STB_GLOBAL) shall have type STT_FUNC.

AAELF section 4.5.3:

   If the symbol addresses an ARM instruction, its value is the
   address of the instruction (in a relocatable object,
   the offset of the instruction from the start of the section
   containing it).

   If the symbol addresses a Thumb instruction, its value is the
   address of the instruction with bit zero set (in a
   relocatable object, the section offset with bit zero set).

   For the purposes of relocation the value used shall be the address
   of the instruction (st_value & ~1).

> So you mean that the end-user is supposed to look at the LSB of a  
> function address to know if it's Arm or Thumb?

Correct.

>> Not enough information to say - but I agree that it ought to be.
>> Breakpoint on elf32_arm_swap_symbol_in and find out?
>>
> I made some progress: although marked STT_ARM_TFUNC in  
> elf32_arm_swap_symbol_in, it is turned to STT_FUNC in allocate_dynrelocs.

That should only happen if there is a PLT entry or an exported v4t
entry stub.  When that happens the symbol is redirected to point to
that (ARM-mode) code fragment so it is not a Thumb symbol any more.

> This brings me to another question: on several occasions I could see that 
> comment "Calls through the PLT do not require stubs". What type of stubs 
> do you mean here?

The stubs generated in that block are stubs to the target symbol, not
stubs to reach the PLT.  It might require a long branch stub, but that
comment predates long branch support :-) It won't require a
Thumb-to-ARM stub since the PLT will contain a Thumb entry point if
one is needed.

-- 
Daniel Jacobowitz
CodeSourcery


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