https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77275

            Bug ID: 77275
           Summary: Description of -l option refers only to static
                    libraries, not dynamic/shared libraries
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: web
          Assignee: unassigned at gcc dot gnu.org
          Reporter: payerle at umd dot edu
  Target Milestone: ---

Referring to
https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options
and all the other places that occurs.  Issue seems to go back to at least to
gcc 4.4.7

In particular, in the description of the -l option, there is text

<quote>
The linker searches a standard list of directories for the library, which is
actually a file named liblibrary.a
</quote> 

and

<quote>
The only difference between using an -l option and specifying a file name is
that -l surrounds library with ‘lib’ and ‘.a’ and searches several directories.
</quote>

These should be corrected to include shared libraries, which may also be
specified by the -l option.  It would probably be good to add something along
the lines of how the compiler selects if multiple files matching --- my
experience is .so files are preferred to .a, but not sure if all library
directories are searched for .so, then all searched for .a, or if each library
directory in order is searched for .so then .a.  Assuming the latter, something
like
<quote>
The linker searches a standard list of directories, in order, for the first
matching shared library (actually a file named liblibrary.so) or standard
library (actually a file named liblibrary.a) that is found.  If a matching
shared library and static library are found in the same directory, the shared
library is preferred.
</quote>

The second line could be changed to something like
<quote>
The only difference between using an -l option and specifying a file name is
that -l surrounds library with ‘lib’ and either '.so' and ‘.a’  and searches
several directories
</quote>

The text re handling archive files probably also needs to be updating to
mentioned shared object files, but my lack of expertise makes me reluctant to
even attempt to fix that.

Reply via email to