diff --git a/clang/lib/Driver/ToolChains/Darwin.h b/clang/lib/Driver/ToolChains/Darwin.h --- a/clang/lib/Driver/ToolChains/Darwin.h +++ b/clang/lib/Driver/ToolChains/Darwin.h @@ -184,9 +184,6 @@ /// 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/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp --- a/clang/lib/Driver/ToolChains/Darwin.cpp +++ b/clang/lib/Driver/ToolChains/Darwin.cpp @@ -1113,10 +1113,7 @@ // 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 @@ return; AddLinkRuntimeLib(Args, CmdArgs, "profile", - RuntimeLinkOptions(RLO_AlwaysLink | RLO_FirstLink)); + RuntimeLinkOptions(RLO_AlwaysLink)); bool ForGCOV = needsGCovInstrumentation(Args); diff --git a/clang/test/Driver/darwin-ld.c b/clang/test/Driver/darwin-ld.c --- 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