[PATCH] D53796: [libcxx] Use AS_NEEDED command for linker script inputs

Fangrui Song via Phabricator reviews at reviews.llvm.org
Sat Oct 27 18:17:34 PDT 2018


MaskRay added inline comments.


================
Comment at: libcxx/utils/gen_link_script.py:73
     # information.
-    contents = "INPUT(%s %s)" % (linked_libcxx, ' '.join(public_libs))
+    contents = "INPUT(AS_NEEDED(%s %s))" % (linked_libcxx, ' '.join(public_libs))
     print("GENERATING SCRIPT: '%s' as file %s" % (contents, symlink_file))
----------------
I don't understand the intention here.

If the user passes `-lc++` without `--as-needed` before, the user expects to see a `DT_NEEDED` entry for `libc++.so.1`. But with this change. the `DT_NEEDED` entry will not appear.

(In lld, `libc++abi.so.1` resolves undefined symbols in `libc++.so.1` so it will always be needed (`SharedFile::IsNeeded == true`).)


Repository:
  rCXX libc++

https://reviews.llvm.org/D53796





More information about the libcxx-commits mailing list