Home Explore Blog CI



man-pages

7th chunk of `ld.man`
ce767e115140577a1262ddb24c45ca45b4018302f68dc4a60000000100000fb5
 be used as a
           filter on the symbol table of the shared object name.

           If you later link a program against this filter object, then, when you run the program, the dynamic linker will see the DT_FILTER field.  The dynamic linker will resolve symbols according to the  symbol  table  of
           the filter object as usual, but it will actually link to the definitions found in the shared object name.  Thus the filter object can be used to select a subset of the symbols provided by the object name.

           Some  older  linkers  used the -F option throughout a compilation toolchain for specifying object‐file format for both input and output object files.  The GNU linker uses other mechanisms for this purpose: the -b,
           --format, --oformat options, the "TARGET" command in linker scripts, and the "GNUTARGET" environment variable.  The GNU linker will ignore the -F option when not creating an ELF shared object.

       -fini=name
           When creating an ELF executable or shared object, call NAME when the executable or shared object is unloaded, by setting DT_FINI to the address of the function.  By default, the linker uses "_fini" as the function
           to call.

       -g  Ignored.  Provided for compatibility with other tools.

       -G value
       --gpsize=value
           Set the maximum size of objects to be optimized using the GP register to size.  This is only meaningful for object file formats such as MIPS ELF  that  support  putting  large  and  small  objects  into  different
           sections.  This is ignored for other object file formats.

       -h name
       -soname=name
           When  creating  an  ELF  shared  object,  set the internal DT_SONAME field to the specified name.  When an executable is linked with a shared object which has a DT_SONAME field, then when the executable is run the
           dynamic linker will attempt to load the shared object specified by the DT_SONAME field rather than using the file name given to the linker.

       -i  Perform an incremental link (same as option -r).

       -init=name
           When creating an ELF executable or shared object, call NAME when the executable or shared object is loaded, by setting DT_INIT to the address of the function.  By default, the linker uses "_init" as  the  function
           to call.

       -l namespec
       --library=namespec
           Add  the  archive  or object file specified by namespec to the list of files to link.  This option may be used any number of times.  If namespec is of the form :filename, ld will search the library path for a file
           called filename, otherwise it will search the library path for a file called libnamespec.a.

           On systems which support shared libraries, ld may also search for files other than libnamespec.a.  Specifically, on ELF and SunOS systems, ld will search a directory for  a  library  called  libnamespec.so  before
           searching for one called libnamespec.a.  (By convention, a ".so" extension indicates a shared library.)  Note that this behavior does not apply to :filename, which always specifies a file called filename.

           The  linker will search an archive only once, at the location where it is specified on the command line.  If the archive defines a symbol which was undefined in some object which appeared before the archive on the
           command line, the linker will include the appropriate file(s) from the archive.  However, an undefined symbol in an object appearing later on the command line will not cause the linker to search the archive again.

           See the -( option for a way to force the linker to search archives multiple times.

           You may list the same archive multiple times on the command line.

           This type of archive searching is standard for Unix linkers.  However, if you are using ld on AIX, note that it is different from the behaviour of the AIX linker.

       -L searchdir
       --library-path=searchdir

Title: LD (GNU Linker) - Command Line Options (Continued)
Summary
More ld options: `-fini=name` (set DT_FINI address for unload), `-g` (ignored), `-G value`/`--gpsize=value` (max GP register object size), `-h name`/`-soname=name` (set DT_SONAME for shared objects), `-i` (incremental link), `-init=name` (set DT_INIT address for load), `-l namespec`/`--library=namespec` (add archive/object file to link list, searches for libnamespec.a/.so), `-L searchdir`/`--library-path=searchdir`...