aboutsummaryrefslogtreecommitdiff
path: root/test/ELF/linkerscript/align.s
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-02 19:19:15 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-02 19:19:15 +0000
commitd93e1dfac8711cfed1a9d9cd1876a788b83945cd (patch)
tree5896fa6c02a262a6148b215487e545d937de58b7 /test/ELF/linkerscript/align.s
parent8d43286d630f9224de07809ea253e83ebb9cdee6 (diff)
downloadsrc-d93e1dfac8711cfed1a9d9cd1876a788b83945cd.tar.gz
src-d93e1dfac8711cfed1a9d9cd1876a788b83945cd.zip
Vendor import of lld trunk r290819:vendor/lld/lld-trunk-r290819
Notes
Notes: svn path=/vendor/lld/dist/; revision=311125 svn path=/vendor/lld/lld-trunk-r290819/; revision=311126; tag=vendor/lld/lld-trunk-r290819
Diffstat (limited to 'test/ELF/linkerscript/align.s')
-rw-r--r--test/ELF/linkerscript/align.s83
1 files changed, 83 insertions, 0 deletions
diff --git a/test/ELF/linkerscript/align.s b/test/ELF/linkerscript/align.s
new file mode 100644
index 000000000000..1e50fed3fa83
--- /dev/null
+++ b/test/ELF/linkerscript/align.s
@@ -0,0 +1,83 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+
+## Check that ALIGN command workable using location counter
+# RUN: echo "SECTIONS { \
+# RUN: . = 0x10000; \
+# RUN: .aaa : \
+# RUN: { \
+# RUN: *(.aaa) \
+# RUN: } \
+# RUN: . = ALIGN(4096); \
+# RUN: .bbb : \
+# RUN: { \
+# RUN: *(.bbb) \
+# RUN: } \
+# RUN: . = ALIGN(4096 * 4); \
+# RUN: .ccc : \
+# RUN: { \
+# RUN: *(.ccc) \
+# RUN: } \
+# RUN: }" > %t.script
+# RUN: ld.lld -o %t1 --script %t.script %t
+# RUN: llvm-objdump -section-headers %t1 | FileCheck %s
+
+## Check that the two argument version of ALIGN command works
+# RUN: echo "SECTIONS { \
+# RUN: . = ALIGN(0x1234, 0x10000); \
+# RUN: .aaa : \
+# RUN: { \
+# RUN: *(.aaa) \
+# RUN: } \
+# RUN: . = ALIGN(., 4096); \
+# RUN: .bbb : \
+# RUN: { \
+# RUN: *(.bbb) \
+# RUN: } \
+# RUN: . = ALIGN(., 4096 * 4); \
+# RUN: .ccc : \
+# RUN: { \
+# RUN: *(.ccc) \
+# RUN: } \
+# RUN: }" > %t.script
+# RUN: ld.lld -o %t1 --script %t.script %t
+# RUN: llvm-objdump -section-headers %t1 | FileCheck %s
+
+# CHECK: Sections:
+# CHECK-NEXT: Idx Name Size Address Type
+# CHECK-NEXT: 0 00000000 0000000000000000
+# CHECK-NEXT: 1 .aaa 00000008 0000000000010000 DATA
+# CHECK-NEXT: 2 .bbb 00000008 0000000000011000 DATA
+# CHECK-NEXT: 3 .ccc 00000008 0000000000014000 DATA
+
+## Check output sections ALIGN modificator
+# RUN: echo "SECTIONS { \
+# RUN: . = 0x10000; \
+# RUN: .aaa : \
+# RUN: { \
+# RUN: *(.aaa) \
+# RUN: } \
+# RUN: .bbb : ALIGN(4096) \
+# RUN: { \
+# RUN: *(.bbb) \
+# RUN: } \
+# RUN: .ccc : ALIGN(4096 * 4) \
+# RUN: { \
+# RUN: *(.ccc) \
+# RUN: } \
+# RUN: }" > %t2.script
+# RUN: ld.lld -o %t2 --script %t2.script %t
+# RUN: llvm-objdump -section-headers %t1 | FileCheck %s
+
+.global _start
+_start:
+ nop
+
+.section .aaa, "a"
+.quad 0
+
+.section .bbb, "a"
+.quad 0
+
+.section .ccc, "a"
+.quad 0