[PATCH] c/69540 - update documentation on -l

Sandra Loosemore sandra@codesourcery.com
Tue Feb 2 20:19:00 GMT 2016

On 01/30/2016 10:33 AM, Arkadiusz Drabczyk wrote:
> * doc/invoke.texi: update documentation WRT .so libraries in -l
> ---
>   gcc/ChangeLog       | 4 ++++
>   gcc/doc/invoke.texi | 8 +++++---
>   2 files changed, 9 insertions(+), 3 deletions(-)
> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index 1d60690..0a6acdb 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -1,3 +1,7 @@
> +2016-01-30  Arkadiusz Drabczyk  <arkadiusz@drabczyk.org>
> +
> +	* doc/invoke.texi: update documentation WRT .so libraries in -l
> +
>   2016-01-29  Martin Jambor  <mjambor@suse.cz>
>   	* hsa-gen.c (get_memory_order_name): Mask with MEMMODEL_BASE_MASK.
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index ba0b4b2..8b1b329 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -10440,9 +10440,11 @@ 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.
> +difference between using an @option{-l} option and specifying a file
> +name is that @option{-l} surrounds @var{library} with @samp{lib} and
> +@samp{.so} on systems with shared libraries support or with @samp{.a} if
> +@var{library} with @samp{.so} is not found and on all other systems and
> +searches several directories.
>   @item -lobjc
>   @opindex lobjc

I see that the documentation of -l does need to be updated to mention 
.so files, but I think your patch doesn't go far enough.  It's already 
confusing because that sentence says "The only difference is...", and 
then mentions *two* things it does differently, and you're adding even 
more things.

Instead, I suggest dropping this confusing sentence entirely and putting 
the new information a couple paragraphs higher up:

> 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.

How about just changing that to read

...a file named @file{lib@var{library}.so}; or, if shared libraries are 
not supported, are disabled via @option{-static}, or no @samp{.so} file 
is found, @file{lib@var{library}.a}.



More information about the Gcc-patches mailing list