diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index feaff820d861..243f57180df2 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -308,8 +308,6 @@ typename ELFT::uint DynamicReloc::getOffset() const { return Out::Got->getTlsIndexVA(); case Off_Sec: return OffsetInSec + OffsetSec->getVA(); - case Off_Bss: - return cast>(Sym)->OffsetInBss + Out::Bss->getVA(); case Off_Got: return Sym->getGotVA(); case Off_GotPlt: diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index 95b679013a45..7abdd5bc12d7 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -176,7 +176,6 @@ template struct DynamicReloc { enum OffsetKind { Off_Got, // The got entry of Sym. Off_GotPlt, // The got.plt entry of Sym. - Off_Bss, // The bss entry of Sym (copy reloc). Off_Sec, // The final position of the given input section and offset. Off_LTlsIndex, // The local tls index. Off_GTlsIndex, // The global tls index of Sym. diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 7d12a32e7941..626e39ac2bd8 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -738,8 +738,6 @@ void Writer::addCopyRelSymbol(SharedSymbol *SS) { Off = alignTo(Off, Align); Out::Bss->setSize(Off + SS->template getSize()); Out::Bss->updateAlign(Align); - Out::RelaDyn->addReloc( - {Target->CopyRel, DynamicReloc::Off_Bss, SS}); uintX_t Shndx = SS->Sym.st_shndx; uintX_t Value = SS->Sym.st_value; // Look through the DSO's dynamic symbol for aliases and create a dynamic @@ -753,6 +751,8 @@ void Writer::addCopyRelSymbol(SharedSymbol *SS) { S.setUsedInRegularObj(); S.MustBeInDynSym = true; } + Out::RelaDyn->addReloc( + {Target->CopyRel, Out::Bss, SS->OffsetInBss, false, SS, 0}); } template