Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / section-merge.s
blob4dc657a19b5c2b9311f48319657cfca1c7cbbecf
1 # REQUIRES: x86
2 # RUN: rm -rf %t; split-file %s %t
3 ## Verify that we preserve alignment when merging sections.
4 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin -o %t/foo.o
5 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin -o %t/bar.o
6 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin -o %t/baz.o
7 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin -o %t/qux.o
8 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/main.o
9 # RUN: %lld -o %t/output %t/foo.o %t/bar.o %t/baz.o %t/qux.o %t/main.o
11 # RUN: llvm-objdump --syms --section=__data --full-contents %t/output | FileCheck %s
12 # CHECK: SYMBOL TABLE:
13 # CHECK-DAG: [[#%x, ADDR:]] g O __DATA,__data _foo
14 # CHECK-DAG: {{0*}}[[#ADDR+0x4]] g O __DATA,__data _bar
15 # CHECK-DAG: {{0*}}[[#ADDR+0x8]] g O __DATA,__data _baz
16 # CHECK-DAG: {{0*}}[[#ADDR+0x9]] g O __DATA,__data _qux
18 # CHECK: Contents of section __DATA,__data:
19 # CHECK-NEXT: {{0*}}[[#ADDR]] ca000000 fe000000 baefbead de000000
21 #--- foo.s
22 .globl _foo
23 .data
24 .p2align 0
25 _foo:
26 .byte 0xca
28 #--- bar.s
29 .globl _bar
30 .data
31 .p2align 2
32 _bar:
33 .byte 0xfe
35 #--- baz.s
36 .globl _baz
37 .data
38 .p2align 3
39 _baz:
40 .byte 0xba
42 #--- qux.s
43 .globl _qux
44 .data
45 .p2align 0
46 _qux:
47 .quad 0xdeadbeef
49 #--- main.s
50 .section __TEXT,__text
51 .globl _main
53 _main:
54 mov $0, %rax
55 ret