[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / linkerscript / orphan-end.s
blob5f56d8f487a273afcf5872dedd39b3c7c52cf1fe
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
4 # Test that .orphan_rx is placed after __stack_end. This matches bfd's
5 # behavior when the orphan section is the last one.
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.script
15 # RUN: ld.lld -o %t --script %t.script %t.o
16 # RUN: llvm-readelf -S --symbols %t | FileCheck %s
18 # CHECK-DAG: .text PROGBITS 0000000000000000
19 # CHECK-DAG: .orphan_rx PROGBITS 0000000000001004
21 # CHECK-DAG: 0000000000000000 {{.*}} __start_text
22 # CHECK-DAG: 0000000000000004 {{.*}} __end_text
23 # CHECK-DAG: 0000000000000004 {{.*}} __stack_start
24 # CHECK-DAG: 0000000000001004 {{.*}} __stack_end
26 # Test that .orphan_rx is now placed before __stack_end. This matches bfd's
27 # behavior when the orphan section is not the last one.
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.script
38 # RUN: ld.lld -o %t --script %t.script %t.o
39 # RUN: llvm-readelf -S --symbols %t | FileCheck --check-prefix=MIDDLE %s
41 # MIDDLE-DAG: .text PROGBITS 0000000000000000
42 # MIDDLE-DAG: .orphan_rx PROGBITS 0000000000000004
44 # MIDDLE-DAG: 0000000000000000 {{.*}} __start_text
45 # MIDDLE-DAG: 0000000000000004 {{.*}} __end_text
46 # MIDDLE-DAG: 0000000000000004 {{.*}} __stack_start
47 # MIDDLE-DAG: 0000000000001008 {{.*}} __stack_end
49 .global _start
50 _start:
51 .zero 4
53 .section .orphan_rx,"ax"
54 .zero 4
56 .section .orphan_rw,"aw"
57 .zero 4