[PATCH] ld: Make --dynamic-list* override -Bsymbolic -Bsymbolic-functions

H.J. Lu hjl.tools@gmail.com
Fri May 22 13:12:40 GMT 2020


On Wed, May 20, 2020 at 6:48 PM Fangrui Song via Binutils
<binutils@sourceware.org> wrote:
>
> They aren't used together in reality, so it is safe to change the
> semantics. --dynamic-list is refined -Bsymbolic. -Bsymbolic-functions
> should be considered as a subset of -Bsymbolic, so --dynamic-list
> overridding -Bsymbolic implies that --dynamic-list overridding
> -Bsymbolic-functions.

--dynamic-list=DYNAMIC-LIST-FILE'
     Specify the name of a dynamic list file to the linker.  This is
     typically used when creating shared libraries to specify a list of
     global symbols whose references shouldn't be bound to the
     definition within the shared library, or creating dynamically
     linked executables to specify a list of symbols which should be
     added to the symbol table in the executable.  This option is only
     meaningful on ELF platforms which support shared libraries.

The --dynamic-list* options are intended for shared libraries.  The goal
IS NOT put them in dynamic symbol table since all global symbols are in
dynamic symbol table already in a shared library.  The goal is to make
them PREEMPTIBLE.  So making the --dynamic-list* options override -Bsymbolic
and -Bsymbolic-functions is incorrect since there is NOTHING to override.

To do it properly:

1.  Extend  --dynamic-list* to executables.  Symbol binding is unchanged.
Only add symbols to dynamic symbol table.
2. Make --export-dynamic-symbol an alias of  --dynamic-list* for executables.
and ignore --export-dynamic-symbol for -shared.  It has to be done at the
end of command-line parsing.

> This also helps PR ld/25910, which would make the situation more
> difficult to understand.
>
>         PR ld/26018
>         * lexsup.c: Simplify.
>         * ld.texi: Update documentation.
>         * testsuite/ld-elf/shared.exp: Update tests.
>         * testsuite/ld-elf/dl4e.out: New.



-- 
H.J.


More information about the Binutils mailing list