From patchwork Mon Nov 19 21:58:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 1000127 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-490460-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Hbu2Zhvs"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42zN5S5z6dz9s3C for ; Tue, 20 Nov 2018 08:58:51 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=hpXAjPvlkE93GYEgOw3uG2aCHGEE1LBf7x1CHXRknZcb5acn8A IMNvFwavpcUv90+H6VSiXxrWF0v5TT86cs/83XAhGST9l5HRNCM2NX/xQqYIHNgV sFtPpyr4tdRbhsEx60/CuhsKueYBnjbCAqJAdj0Hv5fHqa6LnRTOA++3k= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=XcgIoMGiNWMachwgvk1JVBhgUw0=; b=Hbu2Zhvs4H/hjyGRAKt6 3K3YYEj2lQNw0PpgYI3P4RMUa0AMRGXBYZRqeEU/++l0ATTEB23vLHPIvfzM0dp3 X7PRIT/onXi4g9B3oWsF/5/lrWPB/jpjGRPykgqsiIaIl1LDeoRFIKOryccScCce dtcC8pSvmvegG9oBz/Q1g7I= Received: (qmail 128353 invoked by alias); 19 Nov 2018 21:58:42 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 128339 invoked by uid 89); 19 Nov 2018 21:58:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=surrounds, compliance, fashion, H*r:0800 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Nov 2018 21:58:40 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1gOrZ0-0000re-7B from Sandra_Loosemore@mentor.com for gcc-patches@gcc.gnu.org; Mon, 19 Nov 2018 13:58:38 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Mon, 19 Nov 2018 13:58:35 -0800 To: "gcc-patches@gcc.gnu.org" From: Sandra Loosemore Subject: [doc, committed] mention shared libraries in docs for -l option Message-ID: <1c3a08d8-4d4c-d84d-e675-d10c64f12406@codesourcery.com> Date: Mon, 19 Nov 2018 14:58:33 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 I've checked in this patch for PR 50250, following the suggestion in the issue to point to the linker documentation for definitive info on -l instead of trying to explain everything in great detail. -Sandra Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 266286) +++ gcc/doc/invoke.texi (working copy) @@ -12988,28 +12988,27 @@ Search the library named @var{library} w 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