[PATCH] D58325: [Driver][Fuchsia] Support -nolibc flag

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 16 16:38:44 PST 2019


phosek created this revision.
phosek added reviewers: jakehehrlich, juliehockett, mcgrathr.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This can be used to disable libc linking. This flag is supported by
GCC since version 8.x as well as some Clang target toolchains.


Repository:
  rC Clang

https://reviews.llvm.org/D58325

Files:
  clang/lib/Driver/ToolChains/Fuchsia.cpp


Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -148,7 +148,8 @@
     if (Args.hasArg(options::OPT_fsplit_stack))
       CmdArgs.push_back("--wrap=pthread_create");
 
-    CmdArgs.push_back("-lc");
+    if (!Args.hasArg(options::OPT_nolibc))
+      CmdArgs.push_back("-lc");
   }
 
   C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58325.187148.patch
Type: text/x-patch
Size: 519 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190217/429d7bb1/attachment.bin>


More information about the cfe-commits mailing list