[PATCH] D64547: [Driver] -noprofilelib flag
Filipe Cabecinhas via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 12 03:53:20 PDT 2019
Why does -nodefaultlibs work for your use case?
Thank you,
Filipe
On Thu, 11 Jul 2019 at 08:11, Petr Hosek via Phabricator <
reviews at reviews.llvm.org> wrote:
> 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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190712/5aa85a6c/attachment.html>
More information about the llvm-commits
mailing list