Skip to content
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

The -Bstatic / -Bdynamic switches should be compatible with GNU ld #21350

Closed
llvmbot opened this issue Sep 17, 2014 · 3 comments
Closed

The -Bstatic / -Bdynamic switches should be compatible with GNU ld #21350

llvmbot opened this issue Sep 17, 2014 · 3 comments
Labels
bugzilla Issues migrated from bugzilla lld

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Sep 17, 2014

Bugzilla Link 20976
Resolution FIXED
Resolved on Oct 12, 2015 17:28
Version unspecified
OS Linux
Blocks #23588
Reporter LLVM Bugzilla Contributor
CC @emaste

Extended Description

There is a discrepancy in how the -Bstatic switch (disable linking against shared libs) is treated by lld and GNU ld.

According to the GNU ld docs, the switch affects library searching for -l options which follow it. This means -Bstatic can be used multiple times in the command line to disable dynamic linking for particular -l options. For example:

ld -Bstatic -lslib1 -lslib2 -Bdynamic -ldlib1 -Bstatic -lslib3...

Even though the GNU linker won't search for so-files for slib1, slib2 and slib3, so-file for dlib1 will still be considered as it is preceded by -Bdynamic.

Lld behaves differently.
-Bdynamic is not recognized at all, whereas -Bstatic applies static linkage on the output file level. The output file is considered static and it's no longer possible to link against any shared lib. Lld looks for static archives only if -Bstatic is met in the command line.

@emaste
Copy link
Member

emaste commented Sep 29, 2015

@llvmbot
Copy link
Collaborator Author

llvmbot commented Oct 13, 2015

Fixed in ELF2.

@emaste
Copy link
Member

emaste commented Nov 26, 2021

mentioned in issue #23588

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla lld
Projects
None yet
Development

No branches or pull requests

2 participants