[PATCH] D129142: [LLD][ELF] Drop duplicates from rpath

Stephan Bergmann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 6 02:08:57 PDT 2022


sberg added a comment.

In D129142#3631781 <https://reviews.llvm.org/D129142#3631781>, @MaskRay wrote:

> This GNU ld behavior is surprising (deviating from how options are usually handled, e.g. `--auxiliary a --auxiliary b`) and not matching it does not actually cause a problem to reasonable users.

But still, both ld.bdf and ld.gold have code to explicitly prune such duplicate -rpath arguments (see the code pointers in the summary).  So even though neither of those two linkers appears to give a rationale for that behavior, it nevertheless appears to be a deliberate decision to behave that way.  I asked for a rationale now at https://sourceware.org/pipermail/binutils/2022-July/121626.html "Deliberate deduplication of -rpath arguments in ld.bfd and ld.gold?"

> The mentioned LibreOffice use is a problem in itself.

(Technically, it's an issue with cURL bundled as part of a LibreOffice build.  Witness

  $ git clone https://github.com/curl/curl.git
  $ cd curl
  $ git fetch --tag
  $ git checkout curl-7_84_0
  $ autoreconf -fi
  $ ./configure --without-ssl 'LDFLAGS=-fuse-ld=lld -Wl,-rpath=\$$ORIGIN'
  $ make
  $ readelf -d lib/.libs/libcurl.so | grep RUNPATH
   0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN:$ORIGIN]

So faced with the options to either dig into cURL's libtool-based build system or find out why lld behavior apparently deviates from GNU Binutils behavior here, I chose the more pleasant latter option :)

> Actually I'd consider this a bug in GNU ld, not respecting duplicate entries.

see above


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129142/new/

https://reviews.llvm.org/D129142



More information about the llvm-commits mailing list