32 lines · plain
1# REQUIRES: x862## Test that orphan section placement can handle a relocatable link where3## the relocation section is seen before the relocated section.4 5# RUN: rm -rf %t && split-file %s %t && cd %t6 7# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o8## In a.ro, .rela.text precedes its relocated section.9# RUN: ld.lld -r a.o -T 1.lds -o a.ro10# RUN: llvm-readelf -S a.ro | FileCheck %s11# CHECK: .rela.text RELA12# CHECK-NEXT: .text PROGBITS13 14# RUN: llvm-objcopy --rename-section .text=.com.text --rename-section .rela.text=.rela.com.text a.ro a1.o15 16## Regression test for #156354 , where we added an orphan RELA section before its relocated section.17# RUN: ld.lld -r a1.o -o a1.ro18# RUN: llvm-readelf -S a1.ro | FileCheck %s --check-prefix=CHECK119# CHECK1: .com.text PROGBITS20# CHECK1-NEXT: .rela.com.text RELA21 22#--- a.s23.globl foo24foo:25 call foo26 27#--- 1.lds28SECTIONS {29 .rela.text 0 : { *(.rela.text) }30 .text 0 : { *(.text) }31}32