45 lines · plain
1# REQUIRES: x862 3# RUN: split-file %s %ts4# RUN: llvm-mc -filetype=obj -triple=x86_64 %ts/s -o %t.o5# RUN: ld.lld -pie -o %t -T %ts/t %t.o6# RUN: llvm-readelf -l %t | FileCheck %s7 8## Check that an orphan section '.dynamic' is added to the same segment as9## its closest-rank section '.data', even though its sort rank is lower.10## Adding '.dynamic' to the first segment would make the segment writable.11# CHECK: Program Headers:12# CHECK-NEXT: Type {{.*}} Flg Align13# CHECK-NEXT: LOAD {{.*}} R E 0x14# CHECK-NEXT: LOAD {{.*}} RW 0x15# CHECK-NEXT: LOAD {{.*}} R 0x16 17# CHECK: Segment Sections...18# CHECK-NEXT: 00 .text {{$}}19# CHECK-NEXT: 01 .data .dynamic {{$}}20## Check that read-only non-PROGBITS orphan sections are placed after the21## closest-rank section '.rodata' despite their sort ranks are lower.22# CHECK-NEXT: 02 .rodata .dynsym .gnu.hash .hash .dynstr {{$}}23 24#--- s25 .text26 nop27 28 .data29 .quad 030 31 .rodata32 .quad 033 34#--- t35PHDRS {36 exec PT_LOAD;37 rw PT_LOAD;38 ro PT_LOAD;39}40SECTIONS {41 .text : { *(.text) } : exec42 .data : { *(.data) } : rw43 .rodata : { *(.rodata) } : ro44}45