Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / merge-string.s
blob549195d5cf805886530c9709857c6d11aba421e6
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3 // RUN: ld.lld -O 2 %t.o -o %t.so -shared
4 // RUN: llvm-readobj -S --section-data --symbols %t.so | FileCheck %s
5 // RUN: ld.lld -O 1 %t.o -o %t.so -shared
6 // RUN: llvm-readobj -S --section-data --symbols %t.so | FileCheck --check-prefix=NOTAIL %s
7 // RUN: ld.lld -O 0 %t.o -o %t.so -shared
8 // RUN: llvm-readobj -S --section-data --symbols %t.so | FileCheck --check-prefix=NOMERGE %s
10 .section .rodata1,"aMS",@progbits,1
11 .asciz "abc"
12 foo:
13 .ascii "a"
14 bar:
15 .asciz "bc"
16 .asciz "bc"
18 .section .rodata2,"aMS",@progbits,2
19 .p2align 1
20 zed:
21 .short 20
22 .short 0
24 // CHECK: Name: .rodata1
25 // CHECK-NEXT: Type: SHT_PROGBITS
26 // CHECK-NEXT: Flags [
27 // CHECK-NEXT: SHF_ALLOC
28 // CHECK-NEXT: SHF_MERGE
29 // CHECK-NEXT: SHF_STRINGS
30 // CHECK-NEXT: ]
31 // CHECK-NEXT: Address: 0x20D
32 // CHECK-NEXT: Offset: 0x20D
33 // CHECK-NEXT: Size: 4
34 // CHECK-NEXT: Link: 0
35 // CHECK-NEXT: Info: 0
36 // CHECK-NEXT: AddressAlignment: 1
37 // CHECK-NEXT: EntrySize: 1
38 // CHECK-NEXT: SectionData (
39 // CHECK-NEXT: 0000: 61626300 |abc.|
40 // CHECK-NEXT: )
42 // NOTAIL: Name: .rodata1
43 // NOTAIL-NEXT: Type: SHT_PROGBITS
44 // NOTAIL-NEXT: Flags [
45 // NOTAIL-NEXT: SHF_ALLOC
46 // NOTAIL-NEXT: SHF_MERGE
47 // NOTAIL-NEXT: SHF_STRINGS
48 // NOTAIL-NEXT: ]
49 // NOTAIL-NEXT: Address: 0x20D
50 // NOTAIL-NEXT: Offset: 0x20D
51 // NOTAIL-NEXT: Size: 7
52 // NOTAIL-NEXT: Link: 0
53 // NOTAIL-NEXT: Info: 0
54 // NOTAIL-NEXT: AddressAlignment: 1
55 // NOTAIL-NEXT: EntrySize: 1
56 // NOTAIL-NEXT: SectionData (
57 // NOTAIL-NEXT: 0000: 61626300 626300 |abc.bc.|
58 // NOTAIL-NEXT: )
60 // NOMERGE: Name: .rodata1
61 // NOMERGE-NEXT: Type: SHT_PROGBITS
62 // NOMERGE-NEXT: Flags [
63 // NOMERGE-NEXT: SHF_ALLOC
64 // NOMERGE-NEXT: SHF_MERGE
65 // NOMERGE-NEXT: SHF_STRINGS
66 // NOMERGE-NEXT: ]
67 // NOMERGE-NEXT: Address: 0x20D
68 // NOMERGE-NEXT: Offset: 0x20D
69 // NOMERGE-NEXT: Size: 11
70 // NOMERGE-NEXT: Link: 0
71 // NOMERGE-NEXT: Info: 0
72 // NOMERGE-NEXT: AddressAlignment: 1
73 // NOMERGE-NEXT: EntrySize: 1
74 // NOMERGE-NEXT: SectionData (
75 // NOMERGE-NEXT: 0000: 61626300 61626300 626300 |abc.abc.bc.|
76 // NOMERGE-NEXT: )
78 // CHECK: Name: .rodata2
79 // CHECK-NEXT: Type: SHT_PROGBITS
80 // CHECK-NEXT: Flags [
81 // CHECK-NEXT: SHF_ALLOC
82 // CHECK-NEXT: SHF_MERGE
83 // CHECK-NEXT: SHF_STRINGS
84 // CHECK-NEXT: ]
85 // CHECK-NEXT: Address: 0x212
86 // CHECK-NEXT: Offset: 0x212
87 // CHECK-NEXT: Size: 4
88 // CHECK-NEXT: Link: 0
89 // CHECK-NEXT: Info: 0
90 // CHECK-NEXT: AddressAlignment: 2
91 // CHECK-NEXT: EntrySize: 2
92 // CHECK-NEXT: SectionData (
93 // CHECK-NEXT: 0000: 14000000 |....|
94 // CHECK-NEXT: )
97 // CHECK: Name: foo
98 // CHECK-NEXT: Value: 0x20D
100 // CHECK: Name: bar
101 // CHECK-NEXT: Value: 0x20E
103 // CHECK: Name: zed
104 // CHECK-NEXT: Value: 0x212
105 // CHECK-NEXT: Size: 0