diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 4f8906a320817b1a9dc380006e764d1c40d277e7..8357d6b03bb1547b78d10cc2f46a3023cd3d20e1 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -128,6 +128,7 @@ template void OutputSection::finalize() { // the section to which the relocation applies. InputSectionBase *S = First->getRelocatedSection(); Info = S->getOutputSection()->SectionIndex; + Flags |= SHF_INFO_LINK; } static uint64_t updateOffset(uint64_t Off, InputSection *S) { diff --git a/lld/test/ELF/emit-relocs.s b/lld/test/ELF/emit-relocs.s index dfe20589e97bd98a69a0c7cd65951efc7154d55f..81763bc0dfbd8ea77d8ab35f4bf02c16cb701c64 100644 --- a/lld/test/ELF/emit-relocs.s +++ b/lld/test/ELF/emit-relocs.s @@ -1,7 +1,7 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o # RUN: ld.lld --emit-relocs %t1.o -o %t -# RUN: llvm-readobj -t -r %t | FileCheck %s +# RUN: llvm-readobj -t -r -s %t | FileCheck %s ## Check single dash form. # RUN: ld.lld -emit-relocs %t1.o -o %t1 @@ -11,6 +11,13 @@ # RUN: ld.lld -q %t1.o -o %t2 # RUN: llvm-readobj -t -r %t2 | FileCheck %s +# CHECK: Section { +# CHECK: Index: 2 +# CHECK-NEXT: Name: .rela.text +# CHECK-NEXT: Type: SHT_RELA +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_INFO_LINK +# CHECK-NEXT: ] # CHECK: Relocations [ # CHECK-NEXT: Section ({{.*}}) .rela.text { # CHECK-NEXT: 0x201002 R_X86_64_32 .text 0x1