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

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 23 02:40:03 PDT 2016


On Wed, Mar 23, 2016 at 12:35 AM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
> On 22 March 2016 at 17:21, Simon Atanasyan <simon at atanasyan.com> wrote:
>> On Tue, Mar 22, 2016 at 6:36 PM, Rafael EspĂ­ndola
>> <rafael.espindola at gmail.com> wrote:
>>>> For "true" local symbols which can be referenced from the same module
>>>> only compiler creates two instructions for address loading:
>>>>
>>>> lw   $8, 0($gp) # R_MIPS_GOT16
>>>> addi $8, $8, 0  # R_MIPS_LO16
>>>>
>>>> The first instruction loads high 16 bits of the symbol address while
>>>> the second adds an offset. That allows to reduce number of required
>>>> GOT entries because only one global offset table entry is necessary
>>>> for every 64 KBytes of local data.
>>>>
>>>> Hidden global symbols can be referenced from other object files. And
>>>> compiler might do not know that the symbol is hidden. So the compiler
>>>> creates a single instruction to load the symbol address and expect
>>>> that the corresponding GOT entry holds complete address of the symbol.
>>>
>>> I see. Could you add that as a comment?

Done at r264145.

-- 
Simon Atanasyan


More information about the llvm-commits mailing list