summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF/linkerscript/sections-padding.s
diff options
context:
space:
mode:
Diffstat (limited to 'lld/test/ELF/linkerscript/sections-padding.s')
-rw-r--r--lld/test/ELF/linkerscript/sections-padding.s44
1 files changed, 44 insertions, 0 deletions
diff --git a/lld/test/ELF/linkerscript/sections-padding.s b/lld/test/ELF/linkerscript/sections-padding.s
new file mode 100644
index 00000000000..eb7c8d62e16
--- /dev/null
+++ b/lld/test/ELF/linkerscript/sections-padding.s
@@ -0,0 +1,44 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+
+## Check that padding value works:
+# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x1122 }" > %t.script
+# RUN: ld.lld -o %t.out --script %t.script %t
+# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES %s
+# YES: 0120 66001122 00001122 00001122 00001122
+
+## Confirming that address was correct:
+# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x99887766 }" > %t.script
+# RUN: ld.lld -o %t.out --script %t.script %t
+# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES2 %s
+# YES2: 0120 66887766 99887766 99887766 99887766
+
+## Default padding value is 0x00:
+# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } }" > %t.script
+# RUN: ld.lld -o %t.out --script %t.script %t
+# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=NO %s
+# NO: 0120 66000000 00000000 00000000 00000000
+
+## Decimal value.
+# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =777 }" > %t.script
+# RUN: ld.lld -o %t.out --script %t.script %t
+# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=DEC %s
+# DEC: 0120 66000309 00000309 00000309 00000309
+
+## Invalid hex value:
+# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x99XX }" > %t.script
+# RUN: not ld.lld -o %t.out --script %t.script %t 2>&1 \
+# RUN: | FileCheck --check-prefix=ERR2 %s
+# ERR2: invalid filler expression: =0x99XX
+
+.section .mysec.1,"a"
+.align 16
+.byte 0x66
+
+.section .mysec.2,"a"
+.align 16
+.byte 0x66
+
+.globl _start
+_start:
+ nop
OpenPOWER on IntegriCloud