[PATCH] D97736: [Driver] Add a experimental option to link to LLVM libc.

Siva Chandra via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 4 17:14:46 PST 2021


sivachandra added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:680
+    for (StringRef Arg : CmdArgs) {
+      if (Arg == "-lm" || Arg == "-lc") {
+        // TODO: Add -lllvmlibc before -lpthread when LLVM libc has pthread
----------------
sivachandra wrote:
> phosek wrote:
> > This wouldn't handle the case where you use `-nolibc path/to/libc.a` in which case you'd have to manually pass in the `libllvmllibc.a`, but I'm not sure if that's a case we care about.
> Yeah, its hard to cater to all combinations.  In this case though, assuming `libllvmlibc.a` is available in path, one can add `-lllvmlibc` in the right place. 
Another point to note is that `-nolibc` does not prevent `-lm` from getting added for C++ compilations.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97736



More information about the cfe-commits mailing list