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: GOLD handling of weak symbols (including x86 vs. ARM)


Richard Sandiford <richard.sandiford@linaro.org> writes:

>> So I think we have two alternatives: 1) use the PLT entry for a
>> function call and use a dynamic reloc when not making a function call;
>> 2) always use a dynamic reloc.
>
> But this means putting a dynamic reloc in the text section and...
>
>> If I understand the ARM case, you are asking about the :lower16:foo and
>> :upper16:foo operands, not the bl.  You want those operands to get
>> dynamic relocs.  Why is that not happening?  Perhaps we simply need to
>> add R_ARM_THM_MOVW_ABS_NC and R_ARM_THM_MOVT_ABS to the switch in
>> reloc_is_non_pic in arm.cc.
>
> ...unfortunately, in the case of Thumb, you're not allowed to have dynamic
> R_ARM_THM_MOV*_ABS* reloctions.  They have to be resolved statically.

Then I don't understand how this could possibly work if the weak
undefined symbol is defined by a shared library.  I'm sorry if I'm not
grasping your question.

Are you saying that a weak undefined symbol should be seen as zero if it
is not defined in the object being linked, even if it is defined by a
shared library at run time?  I don't see how that could be right.

Or are you saying that this particular assembly sequence should
implicitly test the value in the object being linked, even though the
symbol does not have hidden visibility and is not in some other way
forced to be local?  I think I would question whether the assembly
sequence is valid.  It's not clear to me that that is a meaningful
operation in ELF.

If these operations were being used to load the address of the function
into a register in order to call it later, then as far as I can see the
only possible correct result would be the address of the PLT entry.
Otherwise it would be impossible for a weak undefined symbol to be
defined by a shared object loaded at runtime.

Ian


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