[clang] 452095f - [clang/darwin] Pass libclang_rt.profile last on linker command
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 27 04:51:20 PDT 2021
Author: Nico Weber
Date: 2021-07-27T07:51:06-04:00
New Revision: 452095fe2f58528c174ca780265f227439e3e07e
URL: https://github.com/llvm/llvm-project/commit/452095fe2f58528c174ca780265f227439e3e07e
DIFF: https://github.com/llvm/llvm-project/commit/452095fe2f58528c174ca780265f227439e3e07e.diff
LOG: [clang/darwin] Pass libclang_rt.profile last on linker command
This reverts the functional change of https://reviews.llvm.org/D35385 because
it sounds like this is no longer necessary
(https://bugs.llvm.org/show_bug.cgi?id=51135#c11) and makes clang's behavior
more uniform across platforms.
Differential Revision: https://reviews.llvm.org/D106733
Added:
Modified:
clang/lib/Driver/ToolChains/Darwin.cpp
clang/lib/Driver/ToolChains/Darwin.h
clang/test/Driver/darwin-ld.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 4de5e81d2c0c0..261f522f6c493 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -1113,10 +1113,7 @@ void MachO::AddLinkRuntimeLib(const ArgList &Args, ArgStringList &CmdArgs,
// we explicitly force linking with this library).
if ((Opts & RLO_AlwaysLink) || getVFS().exists(P)) {
const char *LibArg = Args.MakeArgString(P);
- if (Opts & RLO_FirstLink)
- CmdArgs.insert(CmdArgs.begin(), LibArg);
- else
- CmdArgs.push_back(LibArg);
+ CmdArgs.push_back(LibArg);
}
// Adding the rpaths might negatively interact when other rpaths are involved,
@@ -1225,7 +1222,7 @@ void Darwin::addProfileRTLibs(const ArgList &Args,
return;
AddLinkRuntimeLib(Args, CmdArgs, "profile",
- RuntimeLinkOptions(RLO_AlwaysLink | RLO_FirstLink));
+ RuntimeLinkOptions(RLO_AlwaysLink));
bool ForGCOV = needsGCovInstrumentation(Args);
diff --git a/clang/lib/Driver/ToolChains/Darwin.h b/clang/lib/Driver/ToolChains/Darwin.h
index 812e51344f470..4de122c8d513e 100644
--- a/clang/lib/Driver/ToolChains/Darwin.h
+++ b/clang/lib/Driver/ToolChains/Darwin.h
@@ -184,9 +184,6 @@ class LLVM_LIBRARY_VISIBILITY MachO : public ToolChain {
/// Emit rpaths for @executable_path as well as the resource directory.
RLO_AddRPath = 1 << 2,
-
- /// Link the library in before any others.
- RLO_FirstLink = 1 << 3,
};
/// Add a runtime library to the list of items to link.
diff --git a/clang/test/Driver/darwin-ld.c b/clang/test/Driver/darwin-ld.c
index 7441cc186df92..f6472f49c92e9 100644
--- a/clang/test/Driver/darwin-ld.c
+++ b/clang/test/Driver/darwin-ld.c
@@ -316,16 +316,6 @@
// LINK_VERSION_DIGITS: invalid version number in '-mlinker-version=133.3.0.1.a'
// LINK_VERSION_DIGITS: invalid version number in '-mlinker-version=133.3.0.1a'
-// RUN: %clang -target x86_64-apple-ios6.0 -miphoneos-version-min=6.0 -fprofile-instr-generate -### %t.o 2> %t.log
-// RUN: FileCheck -check-prefix=LINK_PROFILE_FIRST %s < %t.log
-// RUN: %clang -target x86_64-apple-darwin12 -fprofile-instr-generate -### %t.o 2> %t.log
-// RUN: FileCheck -check-prefix=LINK_PROFILE_FIRST %s < %t.log
-// RUN: %clang -target i386-apple-darwin9 -fprofile-instr-generate -### %t.o 2> %t.log
-// RUN: FileCheck -check-prefix=LINK_PROFILE_FIRST %s < %t.log
-// RUN: %clang -target arm64-apple-ios5.0 -miphoneos-version-min=5.0 -fprofile-instr-generate -### %t.o 2> %t.log
-// 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 -### %t.o 2> %t.log
// RUN: FileCheck -check-prefix=PROFILE_SECTALIGN %s < %t.log
// RUN: %clang -target arm64-apple-ios12 -fprofile-instr-generate -### %t.o 2> %t.log
More information about the cfe-commits
mailing list