[PATCH] D64547: [Driver] -noprofilelib flag
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 11 00:11:11 PDT 2019
phosek created this revision.
phosek added reviewers: smeenai, davidxl.
Herald added projects: LLVM, Sanitizers.
Herald added subscribers: Sanitizers, llvm-commits.
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.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D64547
Files:
clang/docs/ClangCommandLineReference.rst
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChain.cpp
clang/test/Driver/noprofilelib.c
Index: clang/test/Driver/noprofilelib.c
===================================================================
--- /dev/null
+++ clang/test/Driver/noprofilelib.c
@@ -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
Index: clang/lib/Driver/ToolChain.cpp
===================================================================
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -450,6 +450,9 @@
}
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) ||
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -2512,6 +2512,7 @@
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]>;
Index: clang/docs/ClangCommandLineReference.rst
===================================================================
--- clang/docs/ClangCommandLineReference.rst
+++ clang/docs/ClangCommandLineReference.rst
@@ -346,6 +346,8 @@
.. option:: -noprebind
+.. option:: -noprofilelib
+
.. option:: -noseglinkedit
.. option:: -nostartfiles
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64547.209131.patch
Type: text/x-patch
Size: 1824 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190711/da547ee6/attachment.bin>
More information about the llvm-commits
mailing list