Skip to content

Commit 7049520

Browse files
committed
[ToolChain] Fix link order of libraries, to ensure that symbols are properly resolved when statically linking the OpenCilk runtime.
1 parent f867118 commit 7049520

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

clang/lib/Driver/ToolChain.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,13 +1082,18 @@ void ToolChain::AddTapirRuntimeLibArgs(const ArgList &Args,
10821082
!Args.hasArg(options::OPT_static);
10831083
if (OnlyStaticOpenCilk)
10841084
CmdArgs.push_back("-Bstatic");
1085-
CmdArgs.push_back("-lopencilk");
1085+
10861086
// Link the correct Cilk personality fn
10871087
if (getDriver().CCCIsCXX())
10881088
CmdArgs.push_back("-lopencilk-personality-cpp");
10891089
else
10901090
CmdArgs.push_back("-lopencilk-personality-c");
10911091

1092+
// Link the opencilk runtime. We do this after linking the personality
1093+
// function, to ensure that symbols are resolved correctly when using static
1094+
// linking.
1095+
CmdArgs.push_back("-lopencilk");
1096+
10921097
// Add to the executable's runpath the default directory containing OpenCilk
10931098
// runtime, when the runtime is compiled as an integrated component.
10941099
addRuntimeRunPath(*this, Args, CmdArgs);

0 commit comments

Comments
 (0)