See https://fuchsia.googlesource.com/fuchsia/+/48c987febf4077e52985f1ce1edc957b39bc5481/zircon/public/gn/config/BUILD.gn#219 and https://fuchsia.googlesource.com/fuchsia/+/48c987febf4077e52985f1ce1edc957b39bc5481/zircon/public/gn/config/libc-dummy for what happens without it...
On Sat, Feb 16, 2019 at 5:29 PM Eric Christopher <echri...@gmail.com> wrote: > Weird. Ok. > > On Sat, Feb 16, 2019, 5:20 PM Petr Hosek via Phabricator < > revi...@reviews.llvm.org> wrote: > >> phosek created this revision. >> phosek added reviewers: echristo, 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 9 as well as some Clang target toolchains. >> >> >> Repository: >> rC Clang >> >> https://reviews.llvm.org/D58326 >> >> Files: >> clang/lib/Driver/ToolChains/Gnu.cpp >> clang/test/Driver/nodefaultlib.c >> clang/test/Driver/nolibc.c >> >> >> Index: clang/test/Driver/nolibc.c >> =================================================================== >> --- /dev/null >> +++ clang/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: clang/test/Driver/nodefaultlib.c >> =================================================================== >> --- clang/test/Driver/nodefaultlib.c >> +++ clang/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: clang/lib/Driver/ToolChains/Gnu.cpp >> =================================================================== >> --- clang/lib/Driver/ToolChains/Gnu.cpp >> +++ clang/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) >> >> >>
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits