From: Vedant Kumar Date: Fri, 13 Apr 2018 23:43:59 +0000 (+0000) Subject: [Driver] Export profiling symbols for -exported_symbols_list X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bfca04847134d5c7395681e28546729aab333314;p=clang [Driver] Export profiling symbols for -exported_symbols_list When profiling is enabled and -exported_symbols_list is specified for the Darwin linker, export the requisite set of profiling symbols. rdar://39427167 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330077 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains/Darwin.cpp b/lib/Driver/ToolChains/Darwin.cpp index 70db1dda20..2c1234c83a 100644 --- a/lib/Driver/ToolChains/Darwin.cpp +++ b/lib/Driver/ToolChains/Darwin.cpp @@ -988,6 +988,8 @@ StringRef Darwin::getOSLibraryNameSuffix() const { /// Check if the link command contains a symbol export directive. static bool hasExportSymbolDirective(const ArgList &Args) { for (Arg *A : Args) { + if (A->getOption().matches(options::OPT_exported__symbols__list)) + return true; if (!A->getOption().matches(options::OPT_Wl_COMMA) && !A->getOption().matches(options::OPT_Xlinker)) continue; diff --git a/test/Driver/darwin-ld.c b/test/Driver/darwin-ld.c index 9275d0ff08..9dd2e2b6ca 100644 --- a/test/Driver/darwin-ld.c +++ b/test/Driver/darwin-ld.c @@ -356,6 +356,8 @@ // RUN: FileCheck -check-prefix=LINK_PROFILE_FIRST %s < %t.log // LINK_PROFILE_FIRST: {{ld(.exe)?"}} "{{[^"]+}}libclang_rt.profile_{{[a-z]+}}.a" +// RUN: %clang -target x86_64-apple-darwin12 -fprofile-instr-generate -exported_symbols_list /dev/null -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=PROFILE_EXPORT %s < %t.log // RUN: %clang -target x86_64-apple-darwin12 -fprofile-instr-generate -Wl,-exported_symbols_list,/dev/null -### %t.o 2> %t.log // RUN: FileCheck -check-prefix=PROFILE_EXPORT %s < %t.log // RUN: %clang -target x86_64-apple-darwin12 -fprofile-instr-generate -Wl,-exported_symbol,foo -### %t.o 2> %t.log