Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions driver/linker-gcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ void ArgsBuilder::addCppStdlibLinkFlags(const llvm::Triple &triple) {
void ArgsBuilder::addObjcStdlibLinkFlags(const llvm::Triple &triple) {
if (linkNoObjc)
return;

args.push_back("-lobjc");
}

Expand Down Expand Up @@ -613,7 +613,8 @@ void ArgsBuilder::build(llvm::StringRef outputPath,
}

// -rpath if linking against shared default libs or ldc-jit
if (linkAgainstSharedDefaultLibs() || opts::enableDynamicCompile) {
if ((linkAgainstSharedDefaultLibs() || opts::enableDynamicCompile)
&& !triple.isOSBinFormatWasm()) { // wasm-ld doesn't recognize -rpath
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really needed? wasm will most likely never support shared druntime/Phobos, nor dynamic-compile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing -link-defaultlib-shared when compiling with -defaultlib= or -betterC still passes -rpath making it fail. + it makes #4848 fail because I no longer strip the -link-defaultlib-shared that comes from -DBUILD_SHARED_LIBS=... in the wasm switches.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course I could add it back but it seems more reasonable to ignore -link-defaultlib-shared, in my opinion at least

llvm::StringRef rpath = ConfigFile::instance.rpath();
if (!rpath.empty())
addLdFlag("-rpath", rpath);
Expand Down Expand Up @@ -745,7 +746,7 @@ void ArgsBuilder::addDefaultPlatformLibs() {
}

if (triple.isOSDarwin()) {

// libobjc is more or less required, so we link against it here.
// This could be prettier, though.
addObjcStdlibLinkFlags(triple);
Expand Down
Loading