forked from OSchip/llvm-project
Remove CopyRelSecOff from SharedSymbol.
This reduces the size of SharedSymbol which in turn reduces the size of Symbol from 88 to 80 bytes. llvm-svn: 313154
This commit is contained in:
parent
b1bb468aa9
commit
f6c74c472d
|
@ -525,8 +525,12 @@ template <class ELFT> static void addCopyRelSymbol(SharedSymbol *SS) {
|
||||||
// See if this symbol is in a read-only segment. If so, preserve the symbol's
|
// See if this symbol is in a read-only segment. If so, preserve the symbol's
|
||||||
// memory protection by reserving space in the .bss.rel.ro section.
|
// memory protection by reserving space in the .bss.rel.ro section.
|
||||||
bool IsReadOnly = isReadOnly<ELFT>(SS);
|
bool IsReadOnly = isReadOnly<ELFT>(SS);
|
||||||
BssSection *Sec = IsReadOnly ? InX::BssRelRo : InX::Bss;
|
BssSection *Sec = make<BssSection>(IsReadOnly ? ".bss.rel.ro" : ".bss");
|
||||||
uint64_t Off = Sec->reserveSpace(SymSize, SS->getAlignment<ELFT>());
|
Sec->reserveSpace(SymSize, SS->getAlignment<ELFT>());
|
||||||
|
if (IsReadOnly)
|
||||||
|
InX::BssRelRo->getParent()->addSection(Sec);
|
||||||
|
else
|
||||||
|
InX::Bss->getParent()->addSection(Sec);
|
||||||
|
|
||||||
// Look through the DSO's dynamic symbol table for aliases and create a
|
// Look through the DSO's dynamic symbol table for aliases and create a
|
||||||
// dynamic symbol for each one. This causes the copy relocation to correctly
|
// dynamic symbol for each one. This causes the copy relocation to correctly
|
||||||
|
@ -534,11 +538,10 @@ template <class ELFT> static void addCopyRelSymbol(SharedSymbol *SS) {
|
||||||
for (SharedSymbol *Sym : getSymbolsAt<ELFT>(SS)) {
|
for (SharedSymbol *Sym : getSymbolsAt<ELFT>(SS)) {
|
||||||
Sym->CopyRelSec = Sec;
|
Sym->CopyRelSec = Sec;
|
||||||
Sym->IsPreemptible = false;
|
Sym->IsPreemptible = false;
|
||||||
Sym->CopyRelSecOff = Off;
|
|
||||||
Sym->symbol()->IsUsedInRegularObj = true;
|
Sym->symbol()->IsUsedInRegularObj = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
In<ELFT>::RelaDyn->addReloc({Target->CopyRel, Sec, Off, false, SS, 0});
|
In<ELFT>::RelaDyn->addReloc({Target->CopyRel, Sec, 0, false, SS, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
static void errorOrWarn(const Twine &Msg) {
|
static void errorOrWarn(const Twine &Msg) {
|
||||||
|
|
|
@ -110,8 +110,7 @@ static uint64_t getSymVA(const SymbolBody &Body, int64_t &Addend) {
|
||||||
case SymbolBody::SharedKind: {
|
case SymbolBody::SharedKind: {
|
||||||
auto &SS = cast<SharedSymbol>(Body);
|
auto &SS = cast<SharedSymbol>(Body);
|
||||||
if (SS.CopyRelSec)
|
if (SS.CopyRelSec)
|
||||||
return SS.CopyRelSec->getParent()->Addr + SS.CopyRelSec->OutSecOff +
|
return SS.CopyRelSec->getParent()->Addr + SS.CopyRelSec->OutSecOff;
|
||||||
SS.CopyRelSecOff;
|
|
||||||
if (SS.NeedsPltAddr)
|
if (SS.NeedsPltAddr)
|
||||||
return Body.getPltVA();
|
return Body.getPltVA();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -243,7 +243,6 @@ public:
|
||||||
|
|
||||||
// CopyRelSec and CopyRelSecOff are significant only when NeedsCopy is true.
|
// CopyRelSec and CopyRelSecOff are significant only when NeedsCopy is true.
|
||||||
InputSection *CopyRelSec;
|
InputSection *CopyRelSec;
|
||||||
uint64_t CopyRelSecOff;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <class ELFT> const typename ELFT::Sym &getSym() const {
|
template <class ELFT> const typename ELFT::Sym &getSym() const {
|
||||||
|
|
Loading…
Reference in New Issue