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
10
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
17
18# CHECK:      Contents of section __DATA,__data:
19# CHECK-NEXT: {{0*}}[[#ADDR]] ca000000 fe000000 baefbead de000000
20
21#--- foo.s
22.globl _foo
23.data
24.p2align 0
25_foo:
26  .byte 0xca
27
28#--- bar.s
29.globl _bar
30.data
31.p2align 2
32_bar:
33  .byte 0xfe
34
35#--- baz.s
36.globl _baz
37.data
38.p2align 3
39_baz:
40  .byte 0xba
41
42#--- qux.s
43.globl _qux
44.data
45.p2align 0
46_qux:
47  .quad 0xdeadbeef
48
49#--- main.s
50.section __TEXT,__text
51.globl _main
52
53_main:
54  mov $0, %rax
55  ret
56