[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / gc-sections-merge.s
blob08b619f0118536a3bc80d8e0281e63d3185a6c8a
1 // REQUIRES: x86
2 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
3 // RUN: ld.lld %t.o -o %t.so -shared
4 // RUN: ld.lld %t.o -o %t.gc.so -shared --gc-sections
5 // RUN: llvm-readobj -S --section-data %t.so | FileCheck %s
6 // RUN: llvm-readobj -S --section-data %t.gc.so | FileCheck --check-prefix=GC %s
9 // CHECK: Name: .rodata
10 // CHECK-NEXT: Type: SHT_PROGBITS
11 // CHECK-NEXT: Flags [
12 // CHECK-NEXT: SHF_ALLOC
13 // CHECK-NEXT: SHF_MERGE
14 // CHECK-NEXT: SHF_STRINGS
15 // CHECK-NEXT: ]
16 // CHECK-NEXT: Address:
17 // CHECK-NEXT: Offset:
18 // CHECK-NEXT: Size: 8
19 // CHECK-NEXT: Link: 0
20 // CHECK-NEXT: Info: 0
21 // CHECK-NEXT: AddressAlignment: 1
22 // CHECK-NEXT: EntrySize: 1
23 // CHECK-NEXT: SectionData (
24 // CHECK-NEXT: 0000: 666F6F00 62617200 |foo.bar.|
25 // CHECK-NEXT: )
27 // GC: Name: .rodata
28 // GC-NEXT: Type: SHT_PROGBITS
29 // GC-NEXT: Flags [
30 // GC-NEXT: SHF_ALLOC
31 // GC-NEXT: SHF_MERGE
32 // GC-NEXT: SHF_STRINGS
33 // GC-NEXT: ]
34 // GC-NEXT: Address:
35 // GC-NEXT: Offset:
36 // GC-NEXT: Size: 4
37 // GC-NEXT: Link: 0
38 // GC-NEXT: Info: 0
39 // GC-NEXT: AddressAlignment: 1
40 // GC-NEXT: EntrySize: 1
41 // GC-NEXT: SectionData (
42 // GC-NEXT: 0000: 666F6F00 |foo.|
43 // GC-NEXT: )
45 .section .text.f,"ax",@progbits
46 .globl f
48 leaq .L.str(%rip), %rax
49 retq
51 .section .text.g,"ax",@progbits
52 .hidden g
53 .globl g
55 leaq .L.str.1(%rip), %rax
56 retq
58 .section .rodata.str1.1,"aMS",@progbits,1
59 .L.str:
60 .asciz "foo"
61 .L.str.1:
62 .asciz "bar"