forked from OSchip/llvm-project
[ELF][MIPS] Do not emit DT_REL[A]COUNT for MIPS targets
It looks like MIPS dynamic loader does not support RELCOUNT tag. Both gold/bfd linkers does not emit this tag on MIPS. I will investigate the problem further but for now it is better to behave like GNU linkers. llvm-svn: 280630
This commit is contained in:
parent
c228f5c195
commit
65b2461cfd
|
@ -671,9 +671,14 @@ template <class ELFT> void DynamicSection<ELFT>::finalize() {
|
|||
Add({IsRela ? DT_RELAENT : DT_RELENT,
|
||||
uintX_t(IsRela ? sizeof(Elf_Rela) : sizeof(Elf_Rel))});
|
||||
|
||||
size_t NumRelativeRels = Out<ELFT>::RelaDyn->getRelativeRelocCount();
|
||||
if (Config->ZCombreloc && NumRelativeRels)
|
||||
Add({IsRela ? DT_RELACOUNT : DT_RELCOUNT, NumRelativeRels});
|
||||
// MIPS dynamic loader does not support RELCOUNT tag.
|
||||
// The problem is in the tight relation between dynamic
|
||||
// relocations and GOT. So do not emit this tag on MIPS.
|
||||
if (Config->EMachine != EM_MIPS) {
|
||||
size_t NumRelativeRels = Out<ELFT>::RelaDyn->getRelativeRelocCount();
|
||||
if (Config->ZCombreloc && NumRelativeRels)
|
||||
Add({IsRela ? DT_RELACOUNT : DT_RELCOUNT, NumRelativeRels});
|
||||
}
|
||||
}
|
||||
if (Out<ELFT>::RelaPlt && Out<ELFT>::RelaPlt->hasRelocs()) {
|
||||
Add({DT_JMPREL, Out<ELFT>::RelaPlt});
|
||||
|
|
|
@ -52,10 +52,11 @@ v2:
|
|||
# REL-NEXT: }
|
||||
# REL-NEXT: ]
|
||||
|
||||
# REL: DynamicSection [
|
||||
# REL: Tag Type Name/Value
|
||||
# REL: 0x00000012 RELSZ 16 (bytes)
|
||||
# REL: 0x00000013 RELENT 8 (bytes)
|
||||
# REL: DynamicSection [
|
||||
# REL: Tag Type Name/Value
|
||||
# REL: 0x00000012 RELSZ 16 (bytes)
|
||||
# REL: 0x00000013 RELENT 8 (bytes)
|
||||
# REL-NOT: 0x6FFFFFFA RELCOUNT
|
||||
|
||||
# REL: Primary GOT {
|
||||
# REL-NEXT: Canonical gp value:
|
||||
|
|
Loading…
Reference in New Issue