Delete DefinedAbsolute.
There are 3 symbol types that a .bc can provide during lto: defined,
undefined, common.
Defined and undefined symbols have already been refactored. I was
working on common and noticed that absolute symbols would become an
oddity: They would be the only symbol type present in a .o but not in
a.bc.
Looking a bit more, other than the special section number they were only
used for special rules for computing values. In that way they are
similar to TLS, and we don't have a DefinedTLS.
This patch deletes it. With it we have a reasonable rule of the thumb
for having a symbol kind: It exists if it has special resolution
semantics.
llvm-svn: 256383
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 6f32d3d..2a258a8 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -590,9 +590,9 @@
Symtab.addAbsolute(Name, Sym);
};
AddMarker(IsRela ? "__rela_iplt_start" : "__rel_iplt_start",
- DefinedAbsolute<ELFT>::RelaIpltStart);
+ DefinedRegular<ELFT>::RelaIpltStart);
AddMarker(IsRela ? "__rela_iplt_end" : "__rel_iplt_end",
- DefinedAbsolute<ELFT>::RelaIpltEnd);
+ DefinedRegular<ELFT>::RelaIpltEnd);
}
template <class ELFT> static bool includeInSymtab(const SymbolBody &B) {
@@ -600,8 +600,8 @@
return false;
// Don't include synthetic symbols like __init_array_start in every output.
- if (auto *U = dyn_cast<DefinedAbsolute<ELFT>>(&B))
- if (&U->Sym == &DefinedAbsolute<ELFT>::IgnoreUndef)
+ if (auto *U = dyn_cast<DefinedRegular<ELFT>>(&B))
+ if (&U->Sym == &DefinedRegular<ELFT>::IgnoreUndef)
return false;
return true;
@@ -726,14 +726,14 @@
// So, if this symbol is referenced, we just add the placeholder here
// and update its value later.
if (Symtab.find("_end"))
- Symtab.addAbsolute("_end", DefinedAbsolute<ELFT>::End);
+ Symtab.addAbsolute("_end", DefinedRegular<ELFT>::End);
// If there is an undefined symbol "end", we should initialize it
// with the same value as "_end". In any other case it should stay intact,
// because it is an allowable name for a user symbol.
if (SymbolBody *B = Symtab.find("end"))
if (B->isUndefined())
- Symtab.addAbsolute("end", DefinedAbsolute<ELFT>::End);
+ Symtab.addAbsolute("end", DefinedRegular<ELFT>::End);
// Scan relocations. This must be done after every symbol is declared so that
// we can correctly decide if a dynamic relocation is needed.
@@ -1038,20 +1038,20 @@
// Update "_end" and "end" symbols so that they
// point to the end of the data segment.
- DefinedAbsolute<ELFT>::End.st_value = VA;
+ DefinedRegular<ELFT>::End.st_value = VA;
// Update __rel_iplt_start/__rel_iplt_end to wrap the
// rela.plt section.
if (Out<ELFT>::RelaPlt) {
uintX_t Start = Out<ELFT>::RelaPlt->getVA();
- DefinedAbsolute<ELFT>::RelaIpltStart.st_value = Start;
- DefinedAbsolute<ELFT>::RelaIpltEnd.st_value =
+ DefinedRegular<ELFT>::RelaIpltStart.st_value = Start;
+ DefinedRegular<ELFT>::RelaIpltEnd.st_value =
Start + Out<ELFT>::RelaPlt->getSize();
}
// Update MIPS _gp absolute symbol so that it points to the static data.
if (Config->EMachine == EM_MIPS)
- DefinedAbsolute<ELFT>::MipsGp.st_value = getMipsGpAddr<ELFT>();
+ DefinedRegular<ELFT>::MipsGp.st_value = getMipsGpAddr<ELFT>();
}
// Returns the number of PHDR entries.