Skip to content

Commit 9c4e848

Browse files
authored
driver/linker-gcc.cpp: Don't pass -rpath to linker on wasm targets (#4849)
wasm-ld and lld::wasm don't understand the -rpath argument. Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
1 parent 6c52a64 commit 9c4e848

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

driver/linker-gcc.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ void ArgsBuilder::addCppStdlibLinkFlags(const llvm::Triple &triple) {
475475
void ArgsBuilder::addObjcStdlibLinkFlags(const llvm::Triple &triple) {
476476
if (linkNoObjc)
477477
return;
478-
478+
479479
args.push_back("-lobjc");
480480
}
481481

@@ -613,7 +613,8 @@ void ArgsBuilder::build(llvm::StringRef outputPath,
613613
}
614614

615615
// -rpath if linking against shared default libs or ldc-jit
616-
if (linkAgainstSharedDefaultLibs() || opts::enableDynamicCompile) {
616+
if ((linkAgainstSharedDefaultLibs() || opts::enableDynamicCompile)
617+
&& !triple.isOSBinFormatWasm()) { // wasm-ld doesn't recognize -rpath
617618
llvm::StringRef rpath = ConfigFile::instance.rpath();
618619
if (!rpath.empty())
619620
addLdFlag("-rpath", rpath);
@@ -745,7 +746,7 @@ void ArgsBuilder::addDefaultPlatformLibs() {
745746
}
746747

747748
if (triple.isOSDarwin()) {
748-
749+
749750
// libobjc is more or less required, so we link against it here.
750751
// This could be prettier, though.
751752
addObjcStdlibLinkFlags(triple);

0 commit comments

Comments
 (0)