r365808 - [Driver] -noprofilelib flag
Petr Hosek via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 11 12:06:39 PDT 2019
Author: phosek
Date: Thu Jul 11 12:06:38 2019
New Revision: 365808
URL: http://llvm.org/viewvc/llvm-project?rev=365808&view=rev
Log:
[Driver] -noprofilelib flag
This flag is analoguous to other flags like -nostdlib or -nolibc
and could be used to disable linking of profile runtime library.
This is useful in certain environments like kernel, where profile
instrumentation is still desirable, but we cannot use the standard
runtime library.
Added:
cfe/trunk/test/Driver/noprofilelib.c
Modified:
cfe/trunk/docs/ClangCommandLineReference.rst
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/ToolChain.cpp
Modified: cfe/trunk/docs/ClangCommandLineReference.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=365808&r1=365807&r2=365808&view=diff
==============================================================================
--- cfe/trunk/docs/ClangCommandLineReference.rst (original)
+++ cfe/trunk/docs/ClangCommandLineReference.rst Thu Jul 11 12:06:38 2019
@@ -346,6 +346,8 @@ Disable builtin #include directories
.. option:: -noprebind
+.. option:: -noprofilelib
+
.. option:: -noseglinkedit
.. option:: -nostartfiles
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=365808&r1=365807&r2=365808&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu Jul 11 12:06:38 2019
@@ -2512,6 +2512,7 @@ def nomultidefs : Flag<["-"], "nomultide
def nopie : Flag<["-"], "nopie">;
def no_pie : Flag<["-"], "no-pie">, Alias<nopie>;
def noprebind : Flag<["-"], "noprebind">;
+def noprofilelib : Flag<["-"], "noprofilelib">;
def noseglinkedit : Flag<["-"], "noseglinkedit">;
def nostartfiles : Flag<["-"], "nostartfiles">;
def nostdinc : Flag<["-"], "nostdinc">, Flags<[CoreOption]>;
Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=365808&r1=365807&r2=365808&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Thu Jul 11 12:06:38 2019
@@ -450,6 +450,9 @@ std::string ToolChain::getArchSpecificLi
}
bool ToolChain::needsProfileRT(const ArgList &Args) {
+ if (Args.hasArg(options::OPT_noprofilelib))
+ return false;
+
if (needsGCovInstrumentation(Args) ||
Args.hasArg(options::OPT_fprofile_generate) ||
Args.hasArg(options::OPT_fprofile_generate_EQ) ||
Added: cfe/trunk/test/Driver/noprofilelib.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/noprofilelib.c?rev=365808&view=auto
==============================================================================
--- cfe/trunk/test/Driver/noprofilelib.c (added)
+++ cfe/trunk/test/Driver/noprofilelib.c Thu Jul 11 12:06:38 2019
@@ -0,0 +1,5 @@
+// RUN: %clang -target i686-pc-linux-gnu -### %s 2>&1 \
+// RUN: -fprofile-generate -noprofilelib | FileCheck %s
+// RUN: %clang -target i686-pc-linux-gnu -### %s 2>&1 \
+// RUN: -fprofile-instr-generate -noprofilelib | FileCheck %s
+// CHECK-NOT: clang_rt.profile
More information about the cfe-commits
mailing list