Index: ELF/SyntheticSections.cpp =================================================================== --- ELF/SyntheticSections.cpp +++ ELF/SyntheticSections.cpp @@ -1224,6 +1224,15 @@ // Set required output section properties. getParent()->Link = Link; + + // In non relocatable files relocations use virtual addresses, not section + // offsets. Given that, there doesn't seem to be any strong reason to set + // sh_info for relocation sections. We do it for .rela.plt only because gnu + // readelf produces a warning if we don't. + if (this == InX::RelaPlt) { + Info = InX::GotPlt->getParent()->SectionIndex; + getParent()->Info = Info; + } } template Index: test/ELF/dynamic-reloc.s =================================================================== --- test/ELF/dynamic-reloc.s +++ test/ELF/dynamic-reloc.s @@ -18,7 +18,7 @@ // CHECK-NEXT: Offset: // CHECK-NEXT: Size: [[RELASIZE:.*]] // CHECK-NEXT: Link: 1 -// CHECK-NEXT: Info: 0 +// CHECK-NEXT: Info: [[RELALINK:.*]] // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 @@ -30,6 +30,9 @@ // CHECK-NEXT: ] // CHECK-NEXT: Address: 0x201000 +// CHECK: Index: [[RELALINK]] +// CHECK-NEXT: Name: .got.plt + // CHECK: Relocations [ // CHECK-NEXT: Section ({{.*}}) .rela.plt { // CHECK-NEXT: Relocation {