[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / linkerscript / linkorder2.s
blob5b2eeea08abb3434ca708898a34ac4051d226a0c
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3 # RUN: echo 'SECTIONS { .rodata : {*(.rodata.*)} .text : {*(.text.*)} }' > %t.script
5 # RUN: echo "_bar" > %t.ord
6 # RUN: echo "_foo" >> %t.ord
7 # RUN: ld.lld --symbol-ordering-file %t.ord -o %t --script %t.script %t.o
8 # RUN: llvm-objdump -s %t | FileCheck %s
10 # CHECK: Contents of section .rodata:
11 # CHECK-NEXT: 02000000 00000000 01000000 00000000
12 # CHECK: Contents of section .text:
13 # CHECK-NEXT: 02000000 00000000 01000000 00000000
15 # RUN: echo "_foo" > %t.ord
16 # RUN: echo "_bar" >> %t.ord
17 # RUN: ld.lld --symbol-ordering-file %t.ord -o %t --script %t.script %t.o
18 # RUN: llvm-objdump -s %t | FileCheck %s --check-prefix=INV
20 # INV: Contents of section .rodata:
21 # INV-NEXT: 01000000 00000000 02000000 00000000
22 # INV: Contents of section .text:
23 # INV-NEXT: 01000000 00000000 02000000 00000000
25 .section .text.foo,"a",@progbits
26 _foo:
27 .quad 1
29 .section .text.bar,"a",@progbits
30 _bar:
31 .quad 2
33 .section .rodata.foo,"ao",@progbits,.text.foo
34 .quad 1
36 .section .rodata.bar,"ao",@progbits,.text.bar
37 .quad 2