Home Explore Blog CI



man-pages

20th chunk of `ld.man`
59dbe221cf7596946f8de5f89e0398ae41d7e9c1aa4c72020000000100000fad
 dynamic library mentioned on the
           command line, regardless of whether the library is actually needed or not.  --as-needed causes a DT_NEEDED tag to only be emitted for a library that at that point in the link satisfies a non‐weak undefined  symbol
           reference  from  a  regular object file or, if the library is not found in the DT_NEEDED lists of other needed libraries, a non‐weak undefined symbol reference from another needed dynamic library.  Object files or
           libraries appearing on the command line after the library in question do not affect whether the library is seen  as  needed.   This  is  similar  to  the  rules  for  extraction  of  object  files  from  archives.
           --no-as-needed restores the default behaviour.

           Note: On Linux based systems the --as-needed option also has an affect on the behaviour of the --rpath and --rpath-link options.  See the description of --rpath-link for more details.

       --add-needed
       --no-add-needed
           These two options have been deprecated because of the similarity of their names to the --as-needed and --no-as-needed options.  They have been replaced by --copy-dt-needed-entries and --no-copy-dt-needed-entries.

       -assert keyword
           This option is ignored for SunOS compatibility.

       -Bdynamic
       -dy
       -call_shared
           Link  against  dynamic  libraries.  This is only meaningful on platforms for which shared libraries are supported.  This option is normally the default on such platforms.  The different variants of this option are
           for compatibility with various systems.  You may use this option multiple times on the command line: it affects library searching for -l options which follow it.

       -Bgroup
           Set the "DF_1_GROUP" flag in the "DT_FLAGS_1" entry in the dynamic section.  This causes the runtime linker to handle lookups  in  this  object  and  its  dependencies  to  be  performed  only  inside  the  group.
           --unresolved-symbols=report-all is implied.  This option is only meaningful on ELF platforms which support shared libraries.

       -Bstatic
       -dn
       -non_shared
       -static
           Do not link against shared libraries.  This is only meaningful on platforms for which shared libraries are supported.  The different variants of this option are for compatibility with various systems.  You may use
           this option multiple times on the command line: it affects library searching for -l options which follow it.  This option also implies --unresolved-symbols=report-all.  This option can be used with -shared.  Doing
           so means that a shared library is being created but that all of the library’s external references must be resolved by pulling in entries from static libraries.

       -Bsymbolic
           When  creating  a  shared  library,  bind  references  to global symbols to the definition within the shared library, if any.  Normally, it is possible for a program linked against a shared library to override the
           definition within the shared library.  This option is only meaningful on ELF platforms which support shared libraries.

       -Bsymbolic-functions
           When creating a shared library, bind references to global function symbols to the definition within the shared library, if any.  This option is only meaningful on ELF platforms which support shared libraries.

       -Bno-symbolic
           This option can cancel previously specified -Bsymbolic and -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

Title: LD (GNU Linker) - Keyword Options (Continued): Dynamic Library Linking, Symbol Binding, and Dynamic Lists
Summary
This section details more linker options, including --add-needed (deprecated), dynamic library linking options (-Bdynamic, -Bstatic), setting the DF_1_GROUP flag with -Bgroup, controlling symbol binding within shared libraries (-Bsymbolic, -Bsymbolic-functions, -Bno-symbolic), and specifying dynamic list files with --dynamic-list to control symbol visibility in shared libraries and executables.