Track undefined sym in the symtab. Remove hack for missing relocs against undef.
Preliminary linking tests, seems to show that the linker
and objcopy are happy to use 'em on spec2k, and the
result runs! (Had to be careful to clobber the old .s
and .o files to make it's testing the right copy).
Haven't tried crosstests yet.
BUG=none
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/889613004
diff --git a/src/IceELFObjectWriter.cpp b/src/IceELFObjectWriter.cpp
index 7fcb043..c428c12 100644
--- a/src/IceELFObjectWriter.cpp
+++ b/src/IceELFObjectWriter.cpp
@@ -532,12 +532,23 @@
writeRelocationSections(IsELF64, RelRODataSections);
}
+void ELFObjectWriter::setUndefinedSyms(const ConstantList &UndefSyms) {
+ for (const Constant *S : UndefSyms) {
+ const auto Sym = llvm::cast<ConstantRelocatable>(S);
+ IceString Name = Sym->getName();
+ assert(Sym->getOffset() == 0);
+ assert(Sym->getSuppressMangling());
+ SymTab->noteUndefinedSym(Name, NullSection);
+ StrTab->add(Name);
+ }
+}
+
void ELFObjectWriter::writeRelocationSections(bool IsELF64,
RelSectionList &RelSections) {
for (ELFRelocationSection *RelSec : RelSections) {
Elf64_Off Offset = alignFileOffset(RelSec->getSectionAlign());
RelSec->setFileOffset(Offset);
- RelSec->setSize(RelSec->getSectionDataSize(Ctx, SymTab));
+ RelSec->setSize(RelSec->getSectionDataSize());
if (IsELF64) {
RelSec->writeData<true>(Ctx, Str, SymTab);
} else {