[PATCH] D14281: [ELF2] Sort dynamic symbols according to the MIPS requirements.
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 5 09:56:19 PST 2015
On Thu, Nov 5, 2015 at 7:55 PM, Rafael EspĂndola
<rafael.espindola at gmail.com> wrote:
> On 3 November 2015 at 08:34, Igor Kudrin <ikudrin.dev at gmail.com> wrote:
>>
>> The MIPS ABI has its requirements to sort entries in the .dyn.sym section.
>> Symbols, which are not in the GOT, have to precede symbols added in the GOT.
>> These latter must have the same order as the corresponding GOT entries.
>
> BTW, does anyone know why that restriction exists and why it is still relevant?
That would be very funny if nobody knows.
In short, because MIPS ABI is still unchanged and dynamic linkers expect
to get synchronized GOT and .dyn.sym section.
More wordy, here is a quote from MIPS ABI:
[[
The GOT itself is located by the DT_PLTGOT dynamic tag. It is logically
two tables. The first (with DT_MIPS_LOCAL_GOTNO entries) consists of
local GOT addresses, i.e. non-preemptible (protected) addresses defined
within the executable/DSO. They are initialized to their quickstart values,
and must be relocated if and only if the DSO is loaded at a different address
than that given by its DT_MIPS_BASE_ADDRESS dynamic tag.
The second part of the GOT is the global GOT addresses, i.e. those which
are undefined or preemptible. Each entry in this part has an associated
symbol entry in the .dynsym section. Those symbols start at the symbol
table index given by the DT_MIPS_GOTSYM dynamic tag, and are in the
same order as the global GOT entries. If a symbol is defined in the DSO
(but preemptible), the GOT entry will normally be initialized to a quickstart
value.
]]
BTW funny fact - DT_PLTGOT points to .got while DT_MIPS_PLTGOT points
to .got.plt. DT_MIPS_PLTGOT is used for non-PIC code only.
--
Simon Atanasyan
More information about the llvm-commits
mailing list