-
Notifications
You must be signed in to change notification settings - Fork 12k
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
[LLD][COFF] start-lib
/ end-lib
incorrectly discards symbols referenced in the same library
#109707
Comments
@llvm/issue-subscribers-lld-coff Author: None (yuzhy8701)
When linking in a library with `start-lib` and `end-lib`, `lld-link` would discard a symbol unless it is already seen in the prior objects. It discards the symbol even if the symbol is referenced in a latter object from the same library (latter as the command line order).
A simple case to repro (Powershell on Windows):
Note that the only difference between success and fail cases is the object order between |
This change enables thin LTO. This usually gives LTO results similar to full LTO while being faster for big binaries. On linux we implement distributed thin LTO. On macos we use the default multi-threaded thin LTO. Bazel currently doesn't work with LTO on windows due to llvm/llvm-project#109707 and bazelbuild/bazel#23742. Change-Id: Icdb6442f06fc2b841ac409a8cd6e113f0240cac2
This change enables thin LTO. This usually gives LTO results similar to full LTO while being faster for big binaries. On linux we implement distributed thin LTO. On macos we use the default multi-threaded thin LTO. Bazel currently doesn't work with LTO on windows due to llvm/llvm-project#109707 and bazelbuild/bazel#23742. (cherry picked from commit 3529260) Change-Id: I68a1480d5c6835eaf0c7f92f4c9b8ff44a25903a Merged-In: Icdb6442f06fc2b841ac409a8cd6e113f0240cac2
When linking in a library with
start-lib
andend-lib
,lld-link
would discard a symbol unless it is already seen in the prior objects. It discards the symbol even if the symbol is referenced in a latter object from the same library (latter as the command line order).A simple case to repro (Powershell on Windows):
Setup
The following succeeds:
The following fails with error:
lld-link: error: relocation against symbol in discarded section: ?get_localtime@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
Note that the only difference between success and fail cases is the object order between
start-lib
andend-lib
. I'm able to reproduce with the latest llvm version (19.1.0).The text was updated successfully, but these errors were encountered: