forked from OSchip/llvm-project
Use 0 as sh_link when we don't have a dynamic symbol table.
It doesn't make sense to link from an alloc section to a non alloc one as we were doing. This matches the behavior of both gold and bfd. llvm-svn: 315584
This commit is contained in:
parent
8d4ba5fd23
commit
49419bb303
|
@ -1284,8 +1284,10 @@ template <class ELFT> unsigned RelocationSection<ELFT>::getRelocOffset() {
|
|||
}
|
||||
|
||||
template <class ELFT> void RelocationSection<ELFT>::finalizeContents() {
|
||||
this->Link = InX::DynSymTab ? InX::DynSymTab->getParent()->SectionIndex
|
||||
: InX::SymTab->getParent()->SectionIndex;
|
||||
// If all relocations are *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.
|
||||
this->Link = InX::DynSymTab ? InX::DynSymTab->getParent()->SectionIndex : 0;
|
||||
|
||||
// Set required output section properties.
|
||||
getParent()->Link = this->Link;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// CHECK-NEXT: Address: [[RELA:.*]]
|
||||
// CHECK-NEXT: Offset: 0x158
|
||||
// CHECK-NEXT: Size: 48
|
||||
// CHECK-NEXT: Link: 6
|
||||
// CHECK-NEXT: Link: 0
|
||||
// CHECK-NEXT: Info: 0
|
||||
// CHECK-NEXT: AddressAlignment: 8
|
||||
// CHECK-NEXT: EntrySize: 24
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// CHECK-NEXT: Address: [[RELA:.*]]
|
||||
// CHECK-NEXT: Offset: 0xD4
|
||||
// CHECK-NEXT: Size: 16
|
||||
// CHECK-NEXT: Link: 6
|
||||
// CHECK-NEXT: Link: 0
|
||||
// CHECK-NEXT: Info: 0
|
||||
// CHECK-NEXT: AddressAlignment: 4
|
||||
// CHECK-NEXT: EntrySize: 8
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// CHECK-NEXT: Address: [[RELA:.*]]
|
||||
// CHECK-NEXT: Offset: 0x158
|
||||
// CHECK-NEXT: Size: 48
|
||||
// CHECK-NEXT: Link: 6
|
||||
// CHECK-NEXT: Link: 0
|
||||
// CHECK-NEXT: Info: 0
|
||||
// CHECK-NEXT: AddressAlignment: 8
|
||||
// CHECK-NEXT: EntrySize: 24
|
||||
|
|
Loading…
Reference in New Issue