public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/50250] New: Driver documentation on -l does not mention shared libraries
@ 2011-08-31 12:45 rguenth at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: rguenth at gcc dot gnu.org @ 2011-08-31 12:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50250

             Bug #: 50250
           Summary: Driver documentation on -l does not mention shared
                    libraries
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: documentation
          Severity: minor
          Priority: P3
         Component: driver
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rguenth@gcc.gnu.org


Forwarded from http://bugzilla.novell.com/show_bug.cgi?id=674696

The documentation says

-----------
@cindex Libraries
@item -l@var{library}
@itemx -l @var{library}
@opindex l
Search the library named @var{library} when linking.  (The second
alternative with the library as a separate argument is only for
POSIX compliance and is not recommended.)

It makes a difference where in the command you write this option; the
linker searches and processes libraries and object files in the order they
are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
to functions in @samp{z}, those functions may not be loaded.

The linker searches a standard list of directories for the library,
which is actually a file named @file{lib@var{library}.a}.  The linker
then uses this file as if it had been specified precisely by name.

The directories searched include several standard system directories
plus any that you specify with @option{-L}.

Normally the files found this way are library files---archive files
whose members are object files.  The linker handles an archive file by
scanning through it for members which define symbols that have so far
been referenced but not defined.  But if the file that is found is an
ordinary object file, it is linked in the usual fashion.  The only
difference between using an @option{-l} option and specifying a file name
is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
and searches several directories.
--------

note how it specifically mentions -lX searches for libX.a.  But:

gcc t.c -lX

also finds libX.so which it should not, according to the above documentation.

The documentation should be clarified and refer to whatever used target linker
documentation.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-31 12:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-31 12:45 [Bug driver/50250] New: Driver documentation on -l does not mention shared libraries rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).