From patchwork Wed Mar 13 10:13:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 87107 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 889EF3857C60 for ; Wed, 13 Mar 2024 10:14:07 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 7729A3858C36 for ; Wed, 13 Mar 2024 10:13:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7729A3858C36 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7729A3858C36 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710324817; cv=none; b=sH4VLwdFfg9e34XOOnajGiA9BUsuCM0c6s8bF1qnhaIBN6NUPOn/BU1KLyqXTVyDDnnzWarH57TBqQFymVuL1cmvfAJvWVL8SR7H3HMo2K7nZIAddtcah1o6cUrctn9OTQBP+tQdVzV10tBi6VG19dJr+15rhuq9jiNaoOEJTsg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710324817; c=relaxed/simple; bh=ixAxyt+xn+Lcg+BH0etV6DetT2d4bNaO/wfjRRSy6cA=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=Blgpr4hoY4i8LyY6dfqgwkk5+nAavR9AGxD3mHfATzyaN9NggTl0yIr5CwFlF5TH3NTneFGKUJMISgXP6YdHF1hCt5gj5wP4tGXPLX9az6EtShwVXnevZtEKnvqjWs0GSi0BHW4YtKKEmgVl+z47GcmAkZltL3+DtAEzMBaBKrg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710324816; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=qB5i7u6TXXY/iUjkptRtGRe0UuMh4jHTwsVfw3lhaFc=; b=BCECo1N0OBle/kJuZdwHQbeUj8BU4QStHmjtfyj5xkq8mthRXdn03mE5fdQlVqRD5SqZlk RrXAVmUBDepuh3e88YdAFULtEhDwZsrQCIsMX6qQ5+AJdWeHz4r+1PZ5aa24AmE0K3uP47 CWtHS3fbZR0ejjlqX/ePEMLp3nsl+eg= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-433-CBEruaTFM-moMHmRr9HNgg-1; Wed, 13 Mar 2024 06:13:34 -0400 X-MC-Unique: CBEruaTFM-moMHmRr9HNgg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7BCF33C0D183 for ; Wed, 13 Mar 2024 10:13:34 +0000 (UTC) Received: from localhost (unknown [10.42.28.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3136E40C6DB7; Wed, 13 Mar 2024 10:13:33 +0000 (UTC) Date: Wed, 13 Mar 2024 10:13:33 +0000 From: Jonathan Wakely To: binutils@sourceware.org Subject: [PATCH] ld: Improve documentation of -rpath-link search paths Message-ID: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org This change tries to clarify that the list of search paths given under the -rpath-link option are only used when looking for additional libraries to satisfy DT_NEEDED dependencies, not for libraries named with -l options. It seems to be a common misunderstanding that this list implies that LD_LIBRARY_PATH can be used instead of naming directories with -L options. --- ld/ld.texi | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ld/ld.texi b/ld/ld.texi index 6f234752278..57a7e2ae2ea 100644 --- a/ld/ld.texi +++ b/ld/ld.texi @@ -2427,7 +2427,8 @@ of the input files. When the linker encounters such a dependency when doing a non-shared, non-relocatable link, it will automatically try to locate the required shared library and include it in the link, if it is not included -explicitly. In such a case, the @option{-rpath-link} option +explicitly. In such a case, several directories are searched as +described below. The @option{-rpath-link} option specifies the first set of directories to search. The @option{-rpath-link} option may specify a sequence of directory names either by specifying a list of names separated by colons, or by @@ -2445,11 +2446,12 @@ supported. This option should be used with caution as it overrides the search path that may have been hard compiled into a shared library. In such a case it -is possible to use unintentionally a different search path than the -runtime linker would do. +is possible to unintentionally use a different search path than the +runtime linker would have used. -The linker uses the following search paths to locate required shared -libraries: +When additional shared libraries are required, the linker uses the +following search paths to locate them. These paths are not used to find +libraries that are included in the link explicitly using @option{-l}. @enumerate @item