Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / merge-reloc.s
bloba343d5679b58e2eb021302e6528bee8e8f11dbb3
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3 # RUN: ld.lld %t.o -r -o %t-rel
4 # RUN: llvm-readobj -S --section-data %t-rel | FileCheck %s
6 # When linker generates a relocatable object it does string merging in the same
7 # way as for regular link. It should keep SHF_MERGE flag and set proper sh_entsize
8 # value so that final link can perform the final merging optimization.
10 # CHECK: Section {
11 # CHECK: Index:
12 # CHECK: Name: .rodata.1 (
13 # CHECK-NEXT: Type: SHT_PROGBITS
14 # CHECK-NEXT: Flags [
15 # CHECK-NEXT: SHF_ALLOC
16 # CHECK-NEXT: SHF_MERGE
17 # CHECK-NEXT: ]
18 # CHECK-NEXT: Address:
19 # CHECK-NEXT: Offset:
20 # CHECK-NEXT: Size: 4
21 # CHECK-NEXT: Link: 0
22 # CHECK-NEXT: Info: 0
23 # CHECK-NEXT: AddressAlignment: 4
24 # CHECK-NEXT: EntrySize: 4
25 # CHECK-NEXT: SectionData (
26 # CHECK-NEXT: 0000: 42000000
27 # CHECK-NEXT: )
28 # CHECK-NEXT: }
29 # CHECK: Section {
30 # CHECK: Index:
31 # CHECK: Name: .rodata.2 (
32 # CHECK-NEXT: Type: SHT_PROGBITS
33 # CHECK-NEXT: Flags [
34 # CHECK-NEXT: SHF_ALLOC
35 # CHECK-NEXT: SHF_MERGE
36 # CHECK-NEXT: ]
37 # CHECK-NEXT: Address:
38 # CHECK-NEXT: Offset:
39 # CHECK-NEXT: Size: 8
40 # CHECK-NEXT: Link: 0
41 # CHECK-NEXT: Info: 0
42 # CHECK-NEXT: AddressAlignment: 8
43 # CHECK-NEXT: EntrySize: 8
44 # CHECK-NEXT: SectionData (
45 # CHECK-NEXT: 0000: 42000000 42000000
46 # CHECK-NEXT: )
47 # CHECK-NEXT: }
48 # CHECK: Section {
49 # CHECK: Index:
50 # CHECK: Name: .data
51 # CHECK-NEXT: Type: SHT_PROGBITS
52 # CHECK-NEXT: Flags [
53 # CHECK-NEXT: SHF_ALLOC
54 # CHECK-NEXT: SHF_WRITE
55 # CHECK-NEXT: ]
56 # CHECK-NEXT: Address:
57 # CHECK-NEXT: Offset:
58 # CHECK-NEXT: Size: 16
59 # CHECK-NEXT: Link: 0
60 # CHECK-NEXT: Info: 0
61 # CHECK-NEXT: AddressAlignment: 1
62 # CHECK-NEXT: EntrySize: 0
63 # CHECK-NEXT: SectionData (
64 # CHECK-NEXT: 0000: 42000000 42000000 42000000 42000000
65 # CHECK-NEXT: )
66 # CHECK-NEXT: }
68 .section .rodata.1,"aM",@progbits,4
69 .align 4
70 .global foo
71 foo:
72 .long 0x42
73 .long 0x42
74 .long 0x42
76 .section .rodata.2,"aM",@progbits,8
77 .align 8
78 .global bar
79 bar:
80 .long 0x42
81 .long 0x42
82 .long 0x42
83 .long 0x42
85 .data
86 .global gar
87 zed:
88 .long 0x42
89 .long 0x42
90 .long 0x42
91 .long 0x42