[PATCH] D13579: ELF2: Implement --as-needed.
Rafael Ávila de Espíndola via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 9 14:18:20 PDT 2015
rafael added inline comments.
================
Comment at: ELF/Writer.cpp:245
@@ -242,1 +244,3 @@
+ if (auto *S = dyn_cast<SharedSymbol<ELFT>>(Body))
+ S->File->IsUsed = true;
}
----------------
I don't think this correctly handles weak symbols.
It should not set the bit if the symbol is only used to satisfy a weak undefined. For that it looks like you need to fetch the original SymbolBody, not the replacement.
================
Comment at: test/elf2/as-needed.s:8
@@ +7,3 @@
+
+// RUN: ld.lld2 %t.o %t2.so %t3.so -o %t2
+// RUN: llvm-readobj -dynamic-table %t2 | FileCheck %s
----------------
Please also add a test for the weak undefined case.
http://reviews.llvm.org/D13579
More information about the llvm-commits
mailing list