public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Stephan Bergmann <sbergman@redhat.com>
To: binutils@sourceware.org
Subject: Deliberate deduplication of -rpath arguments in ld.bfd and ld.gold?
Date: Wed, 6 Jul 2022 11:06:49 +0200	[thread overview]
Message-ID: <38ff8f84-c34c-8a90-6070-4cbe62835940@redhat.com> (raw)

Over in the comments at <https://reviews.llvm.org/D129142> "[LLD][ELF] 
Drop duplicates from rpath" we wonder what the rationale might be that 
both ld.bfd and ld.gold apparently deliberately drop duplicated -rpath 
arguments with identical paths (as in

> $ cat test.c
> void f(void) {}
> $ gcc -c test.c
> $ ld.bfd -rpath=/path -rpath=/path -shared test.o
> $ readelf -d a.out | grep RUNPATH
>  0x000000000000001d (RUNPATH)            Library runpath: [/path]

for example).

For the relevant code in ld.bfd see `/* First see whether OPTARG is 
already in the path.  */` ever since 
<https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=252b5132c753830d5fd56823373aed85f2a0db63> 
"19990502 sourceware import") and for the relevant code in ld.gold see 
`// Eliminate duplicates.` since 
<https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=41f542e70b89b9ea2875c438b0c9a60ac46092dd> 
"Add support for -rpath."


             reply	other threads:[~2022-07-06  9:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-06  9:06 Stephan Bergmann [this message]
2022-07-06 11:32 ` Michael Matz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38ff8f84-c34c-8a90-6070-4cbe62835940@redhat.com \
    --to=sbergman@redhat.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).