summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/docs/ClangCommandLineReference.rst2
-rw-r--r--clang/include/clang/Driver/Options.td1
-rw-r--r--clang/lib/Driver/ToolChain.cpp3
-rw-r--r--clang/test/Driver/noprofilelib.c5
4 files changed, 11 insertions, 0 deletions
diff --git a/clang/docs/ClangCommandLineReference.rst b/clang/docs/ClangCommandLineReference.rst
index b7f94e98d49..4c1fe07be3a 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -346,6 +346,8 @@ Disable builtin #include directories
.. option:: -noprebind
+.. option:: -noprofilelib
+
.. option:: -noseglinkedit
.. option:: -nostartfiles
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 011abdd0095..08af5ad20af 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -2512,6 +2512,7 @@ def nomultidefs : Flag<["-"], "nomultidefs">;
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]>;
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 6d6e4c4dd24..b1fddb0af55 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -450,6 +450,9 @@ std::string ToolChain::getArchSpecificLibPath() const {
}
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) ||
diff --git a/clang/test/Driver/noprofilelib.c b/clang/test/Driver/noprofilelib.c
new file mode 100644
index 00000000000..2a6970cc2cf
--- /dev/null
+++ b/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
OpenPOWER on IntegriCloud