[PATCH] D58326: [Driver][Gnu] Support -nolibc flag
Petr Hosek via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 16 18:42:28 PST 2019
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL354210: [Driver][Gnu] Support -nolibc flag (authored by phosek, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D58326?vs=187151&id=187152#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58326/new/
https://reviews.llvm.org/D58326
Files:
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
cfe/trunk/test/Driver/nodefaultlib.c
cfe/trunk/test/Driver/nolibc.c
Index: cfe/trunk/test/Driver/nodefaultlib.c
===================================================================
--- cfe/trunk/test/Driver/nodefaultlib.c
+++ cfe/trunk/test/Driver/nodefaultlib.c
@@ -1,4 +1,4 @@
-// RUN: %clang -target i686-pc-linux-gnu -### -nodefaultlibs %s 2>&1 | FileCheck -check-prefix=TEST1 %s
+// RUN: %clang -target i686-pc-linux-gnu -### -rtlib=libgcc -nodefaultlibs %s 2>&1 | FileCheck -check-prefix=TEST1 %s
// TEST1-NOT: start-group
// TEST1-NOT: "-lgcc"
// TEST1-NOT: "-lc"
Index: cfe/trunk/test/Driver/nolibc.c
===================================================================
--- cfe/trunk/test/Driver/nolibc.c
+++ cfe/trunk/test/Driver/nolibc.c
@@ -0,0 +1,5 @@
+// RUN: %clang -target i686-pc-linux-gnu -### -rtlib=libgcc -nolibc %s 2>&1 | FileCheck %s
+// CHECK: crtbegin
+// CHECK: "-lgcc"
+// CHECK-NOT: "-lc"
+// CHECK: crtend
Index: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
@@ -518,7 +518,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");
// Add IAMCU specific libs, if needed.
if (IsIAMCU)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58326.187152.patch
Type: text/x-patch
Size: 1378 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190217/f6f49947/attachment.bin>
More information about the cfe-commits
mailing list