Skip to content

[lld][WebAssembly] -r: force -Bstatic #108264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions lld/test/wasm/libsearch.s
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@
// RUN: wasm-ld -pie --experimental-pic --emit-relocs --no-gc-sections -o %t3 %t.o -L%t.dir -Bstatic -call_shared -lls
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=DYNAMIC %s

/// -r implies -Bstatic and has precedence over -Bdynamic.
// RUN: ld.lld -r -Bdynamic %t.o -L%t.dir -lls -o %t3.ro
// RUN: llvm-readelf -s -h %t3.ro | FileCheck --check-prefix=RELOCATABLE %s
// RELOCATABLE: Type: REL
// RELOCATABLE: [[#]] _static
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops, I didn't mean to send this for review until I'd finished porting this test fragment.


.globl _start, _bar
_start:
.functype _start () -> ()
Expand Down
3 changes: 2 additions & 1 deletion lld/wasm/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ void LinkerDriver::createFiles(opt::InputArgList &args) {
config->isStatic = true;
break;
case OPT_Bdynamic:
config->isStatic = false;
if (!config->relocatable)
config->isStatic = false;
break;
case OPT_whole_archive:
inWholeArchive = true;
Expand Down
Loading