[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
This commit is contained in:
Nico Weber 2021-07-27 07:50:27 -04:00
parent 47632352c8
commit 452095fe2f
3 changed files with 2 additions and 18 deletions

View File

@ -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);

View File

@ -184,9 +184,6 @@ public:
/// 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.

View File

@ -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