[PATCH] ELF: Don't check DT_NEEDED for linker script defined symbols

H.J. Lu hjl.tools@gmail.com
Sun Nov 26 15:15:00 GMT 2017


On Sat, Nov 25, 2017 at 4:12 PM, Hans-Peter Nilsson <hp@bitrange.com> wrote:
> On Thu, 23 Nov 2017, H.J. Lu wrote:
>
>> Linker shouldn't use any shared objects, including those from DT_NEEDED,
>> to resolve references of symbols which will be defined by linker script.
>
> Here you say "linker script", later you say "built-in linker
> script".  ITYM the former everywhere; at least that's what makes
> sense to me.

It should be default linker scripts used by linker.   They can be either
builtin or read from disk.

>> +      const char *symbols[] =
>> +     {
>> +       "__${ETEXT_NAME}",
>> +       "_${ETEXT_NAME}",
>> +       "${ETEXT_NAME}",
>> +       "${USER_LABEL_PREFIX}" "__bss_start",
>> +       "${USER_LABEL_PREFIX}" "_edata",
>> +       "${USER_LABEL_PREFIX}" "edata",
>> +       "${USER_LABEL_PREFIX}" "_end",
>> +       "${USER_LABEL_PREFIX}" "end",
>> +       NULL
>> +     };
>
> This isn't derived from command-line-specified linker scripts in
> effect, this is a static, somewhat arbitrary list.
>

This list comes from default linker script used by linker.  It isn't
used for command-line-specified linker scripts since linker hasn't
parsed linker script yet.  Linker knows what symbols will be defined
only when the default linker script is used.

Here is the updated patch to cover default linker script on disk.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ELF-Don-t-check-DT_NEEDED-for-symbols-defined-by-lin.patch
Type: text/x-patch
Size: 9473 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20171126/1fa1626c/attachment.bin>


More information about the Binutils mailing list