aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSandra Loosemore <sandra@codesourcery.com>2018-11-19 16:53:09 -0500
committerSandra Loosemore <sandra@gcc.gnu.org>2018-11-19 16:53:09 -0500
commit6861fbf6d6ddac2f54ef8e44e438da26ab16e948 (patch)
tree9366b375f67914a6f95585a69727e7664b6c2802 /gcc
parent9047dd02b84c42d610cf84037cb7db8963245228 (diff)
downloadgcc-6861fbf6d6ddac2f54ef8e44e438da26ab16e948.zip
gcc-6861fbf6d6ddac2f54ef8e44e438da26ab16e948.tar.gz
gcc-6861fbf6d6ddac2f54ef8e44e438da26ab16e948.tar.bz2
re PR driver/50250 (Driver documentation on -l does not mention shared libraries)
2018-11-19 Sandra Loosemore <sandra@codesourcery.com> PR driver/50250 gcc/ * doc/invoke.texi (Link Options): Mention shared libraries in documentation for the -l option. Simplify discussion and point to the system linker documentation for details. From-SVN: r266287
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/doc/invoke.texi31
2 files changed, 22 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8bea262..0a1f956 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2018-11-19 Sandra Loosemore <sandra@codesourcery.com>
+
+ PR driver/50250
+ * doc/invoke.texi (Link Options): Mention shared libraries
+ in documentation for the -l option. Simplify discussion and
+ point to the system linker documentation for details.
+
2018-11-19 Peter Bergner <bergner@linux.ibm.com>
PR rtl-optimization/88033
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index f4fc182..d46ebd0 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -12988,28 +12988,27 @@ 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.)
+The @option{-l} option is passed directly to the linker by GCC. Refer
+to your linker documentation for exact details. The general
+description below applies to the GNU linker.
+
+The linker searches a standard list of directories for the library.
+The directories searched include several standard system directories
+plus any that you specify with @option{-L}.
+
+Static libraries are archives of object files, and have file names
+like @file{lib@var{library}.a}. Some targets also support shared
+libraries, which typically have names like @file{lib@var{library}.so}.
+If both static and shared libraries are found, the linker gives
+preference to linking with the shared library unless the
+@option{-static} option is used.
+
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.
-
@item -lobjc
@opindex lobjc
You need this special case of the @option{-l} option in order to