[lld] [LLD][COFF] Prevent to emit relocations for discarded weak wrapped symbols (PR #156214)
Tomohiro Kashiwada via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 5 04:18:57 PDT 2025
================
@@ -0,0 +1,16 @@
+; REQUIRES: x86
+
+; Check that 'weak' attribute will be inherited to the wrapped symbols.
+
+; RUN: llc %s -mtriple x86_64-mingw -o %t.o --filetype=obj
+; RUN: ld.lld -m i386pep -shared -o %t.dll %t.o --entry= --wrap fn
+
+declare extern_weak dso_local void @__real_fn() nounwind
+declare dso_local void @fn() nounwind
+declare dso_local void @__wrap_fn() nounwind
+
+define dllexport void @caller() nounwind {
+ call void @__real_fn()
+ call void @fn()
----------------
kikairoya wrote:
I completely missed that problem. Thank you for catching that.
This part of the change is supposed to prevent pulling unused `__wrap__Znwm` family, but it doesn't work, as @jeremyd2019 said. This is because the unwrapped `_Znwm` family is always `LazyArchiveKind`.
Therefore, I'd drop this part.
https://github.com/llvm/llvm-project/pull/156214
More information about the llvm-commits
mailing list