58 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o3 4# Test that .orphan_rx is placed after __stack_end. This matches bfd's5# behavior when the orphan section is the last one.6 7# RUN: echo "SECTIONS { \8# RUN: __start_text = .; \9# RUN: .text : { *(.text*) } \10# RUN: __end_text = .; \11# RUN: __stack_start = .; \12# RUN: . = . + 0x1000; \13# RUN: __stack_end = .; \14# RUN: }" > %t.script15# RUN: ld.lld -o %t --script %t.script %t.o16# RUN: llvm-readelf -S --symbols %t | FileCheck %s17 18# CHECK-DAG: .text PROGBITS 000000000000000019# CHECK-DAG: .orphan_rx PROGBITS 000000000000100420 21# CHECK-DAG: 0000000000000000 {{.*}} __start_text22# CHECK-DAG: 0000000000000004 {{.*}} __end_text23# CHECK-DAG: 0000000000000004 {{.*}} __stack_start24# CHECK-DAG: 0000000000001004 {{.*}} __stack_end25 26# Test that .orphan_rx is now placed before __stack_end. This matches bfd's27# behavior when the orphan section is not the last one.28 29# RUN: echo "SECTIONS { \30# RUN: __start_text = .; \31# RUN: .text : { *(.text*) } \32# RUN: __end_text = .; \33# RUN: __stack_start = .; \34# RUN: . = . + 0x1000; \35# RUN: __stack_end = .; \36# RUN: .orphan_rw : { *(.orphan_rw*) } \37# RUN: }" > %t.script38# RUN: ld.lld -o %t --script %t.script %t.o39# RUN: llvm-readelf -S --symbols %t | FileCheck --check-prefix=MIDDLE %s40 41# MIDDLE-DAG: .text PROGBITS 000000000000000042# MIDDLE-DAG: .orphan_rx PROGBITS 000000000000000443 44# MIDDLE-DAG: 0000000000000000 {{.*}} __start_text45# MIDDLE-DAG: 0000000000000004 {{.*}} __end_text46# MIDDLE-DAG: 0000000000000004 {{.*}} __stack_start47# MIDDLE-DAG: 0000000000001008 {{.*}} __stack_end48 49 .global _start50_start:51 .zero 452 53 .section .orphan_rx,"ax"54 .zero 455 56 .section .orphan_rw,"aw"57 .zero 458