[lld] r263228 - Simplify now that local symbols can use getVA.

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 20:52:45 PST 2016


On Fri, Mar 11, 2016 at 5:24 PM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
> On 11 March 2016 at 08:54, Simon Atanasyan <simon at atanasyan.com> wrote:
>> On Fri, Mar 11, 2016 at 4:04 PM, Rafael Espindola via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>>> It is really odd that Mips differentiates symbols that are born local
>>> and those that become local because of hidden visibility. I don't know
>>> enough mips to known if this is a bug or not.
>>
>> Do you mean the fact that "true" local symbols got one kind of GOT
>> entries with "page" address while symbols with hidden visibility got
>> another kind of GOT entries with full address?
>>
>> If so it is not a bug, just an ABI requirement.
>
> Sigh. Why is the ABI defined like that? If the symbol is hidden the
> compiler knows it will be local in the DSO and should be able to use
> the same code sequence as for local symbols.

When compiler makes PIC object file with a reference to public symbol
'foo' it does not know where this object file be linked to: executable
or DSO. So compiler generates instructions and relocations to get full
symbol address from GOT. Later linker knows about type of output file.
If it is DSO the symbol can be preempted and the linker creates an
entry in the "global" part of GOT. If it is an executable and the
symbol defined in this object file or any other we do not need to ask
dynamic linker for symbol address and creates an entry in the "local"
part of GOT.

-- 
Simon Atanasyan


More information about the llvm-commits mailing list