mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
lld: set sh_link and sh_info for .rela.plt sections
ELF spec says that for SHT_REL and SHT_RELA sh_link should reference the associated string table and sh_info should reference the "section to which the relocation applies." ELF Tool Chain's elfcopy / strip use this (in part) to control whether or not the relocation entry is copied to the output. LLVM PR 37538 https://bugs.llvm.org/show_bug.cgi?id=37538 Approved by: re (kib) Obtained from: llvm r344226 (backported for 6.0)
This commit is contained in:
parent
43f8d28c37
commit
b371a9f082
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=339304
@ -1213,11 +1213,13 @@ void RelocationBaseSection::addReloc(const DynamicReloc &Reloc) {
|
||||
void RelocationBaseSection::finalizeContents() {
|
||||
// If all relocations are R_*_RELATIVE they don't refer to any
|
||||
// dynamic symbol and we don't need a dynamic symbol table. If that
|
||||
// is the case, just use 0 as the link.
|
||||
Link = InX::DynSymTab ? InX::DynSymTab->getParent()->SectionIndex : 0;
|
||||
// is the case, just use the index of the regular symbol table section.
|
||||
getParent()->Link = InX::DynSymTab ?
|
||||
InX::DynSymTab->getParent()->SectionIndex :
|
||||
InX::SymTab->getParent()->SectionIndex;
|
||||
|
||||
// Set required output section properties.
|
||||
getParent()->Link = Link;
|
||||
if (InX::RelaIplt == this || InX::RelaPlt == this)
|
||||
getParent()->Info = InX::GotPlt->getParent()->SectionIndex;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
|
@ -7,4 +7,4 @@
|
||||
|
||||
#define LLD_REPOSITORY_STRING "FreeBSD"
|
||||
// <Upstream revision at import>-<Local identifier in __FreeBSD_version style>
|
||||
#define LLD_REVISION_STRING "335540-1200004"
|
||||
#define LLD_REVISION_STRING "335540-1200005"
|
||||
|
Loading…
Reference in New Issue
Block a user