[PATCH] D56647: [WIP] [ELF] Implement --copy-dt-needed-entries

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 3 19:29:33 PST 2019

MaskRay added a comment.

I read your https://blog.netbsd.org/tnf/entry/the_first_report_on_lld :) The chapter "Handling of indirect shared library dependencies" summarizes the transitive DT_NEEDED problem well.

But do we have a convincing list of applications that really need this option to link? According my understanding, lld doesn't try to be fully ld.bfd compatible. It only implements reasonable ld.bfd features that are still used a lot. lld is enabled on FreeBSD and is capable to link nearly all applications (with ~10 exceptions; but nothing uses --copy-dt-needed-entries) (https://bugs.llvm.org/show_bug.cgi?id=23214#c59)

gold doesn't support `--copy-dt-needed-entries` https://sourceware.org/git/?p=binutils-gdb.git;a=blob;hb=b09e83c1f814a6f218519abeb94aaf45869ba03c;f=gold/object.cc#l3236 It doesn't support `--rpath-link` either.

In the article,

> However, GNU gold, LLD and newer versions of GNU ld use different logic and permit only symbols provided by the direct dependencies.

I just checked that ld.bfd doesn't enable this option by default. It looks like a historical remnant then :)

  rLLD LLVM Linker



More information about the cfe-commits mailing list