RFC: [PATCH] ELF: Don't require section header on ELF objects

Kaylee Blake klkblake@gmail.com
Mon Mar 9 14:02:25 GMT 2020


On 10/3/20 12:24 am, H.J. Lu wrote:
> On Mon, Mar 9, 2020 at 6:46 AM Kaylee Blake <klkblake@gmail.com> wrote:
>>
>> On 9/3/20 11:59 pm, Florian Weimer wrote:
>>> * Kaylee Blake:
>>>
>>>>> I think that's conceptually the wrong thing to do for ELF, sorry.  If
>>>>> there is no section header, the object should be unlinkable.  The
>>>>> linker should not use the dynamic segment to locate the symbol
>>>>> information, only the dynamic section (in case the link ABI and
>>>>> run-time ABI are different).
>>>>
>>>> I'm confused by your comment about link and run-time ABIs differing;
>>>> surely if the ABI at runtime differs from the ABI at link time, you are
>>>> just going to crash at runtime?
>>>
>>> No, the typical application are fewer symbols in the DSO at link time
>>> than at load time, for example for linking against an older version of
>>> glibc than is installed on the system.
>>
>> How is that being done? On my machine, the symbols in glibc found
>> through the section header are identical to the ones found through the
>> dynamic array, except that some of the latter are missing symbol
>> versions, which I think is due to this patch not looking them up? (I'm
>> not actually sure if this patch does that or not).
>>
> 
> Symbol versioning is a real problem.  We need to reconstruct all dynamic
> symbol info from PT_DYNAMIC segment.   I am running into a wrong
> output problem on i386.  I am leaning toward Florian's suggestion to
> only add --remove-section-header and -z nosectionheader without
> reconstructing dynamic symbol info from PT_DYNAMIC segment.

Ah, it's not as simple as just grabbing addresses / sizes from the
DT_VER* entries? Admittedly I don't actually know much about how symbol
versioning operates.


-- 
Kaylee Blake <klkblake@gmail.com>
C is the worst language, except for all the others.



More information about the Binutils mailing list