[lld] Handle _GLOBAL_OFFSET_TABLE symbol

Hi,

What is a recommended way of handling (define, assign value)
_GLOBAL_OFFSET_TABLE symbol? It looks like Hexagon and X86_64 targets
use different API to achieve the same result.

tia,

Simon

Its a DefinedAtom whose value is set by the Target Handlers.

The Hexagon target adds new atom using the addAbsoluteAtom() functions
and then assigns a virtual address in the finalizeSymbolValues()
routine. The X86_64 target uses addAtom() function to add an object of
the GLOBAL_OFFSET_TABLEAtom class to do the same thing. What is the
reason of this difference? Is the GLOBAL_OFFSET_TABLEAtom just a
useful wrapper which eliminates the necessity to assign an address to
the atom explicitly in the finalizeSymbolValues() routine?

The Hexagon target adds new atom using the addAbsoluteAtom() functions
and then assigns a virtual address in the finalizeSymbolValues()
routine. The X86_64 target uses addAtom() function to add an object of
the GLOBAL_OFFSET_TABLEAtom class to do the same thing. What is the
reason of this difference?

This should be fixed and both should use the addAbsoluteAtom function.

Is the GLOBAL_OFFSET_TABLEAtom just a
useful wrapper which eliminates the necessity to assign an address to
the atom explicitly in the finalizeSymbolValues() routine?

Its being used as a wrapper currently, as this is an AbsoluteAtom and not a DefinedAtom. This should also be fixed.

The problem is this is being treated as a DefinedAtom, which should be an Absolute atom in my opinion.

Shankar Easwaran

-- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation