1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
3
4## Check that padding value works:
5# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x1122 }" > %t.script
6# RUN: ld.lld -o %t.out --script %t.script %t
7# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES %s
8# YES: 66001122 00001122 00001122 00001122
9
10## Confirming that address was correct:
11# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x99887766 }" > %t.script
12# RUN: ld.lld -o %t.out --script %t.script %t
13# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES2 %s
14# YES2: 66887766 99887766 99887766 99887766
15
16## Default padding value is 0x00:
17# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } }" > %t.script
18# RUN: ld.lld -o %t.out --script %t.script %t
19# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=NO %s
20# NO: 66000000 00000000 00000000 00000000
21
22## Decimal value.
23# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =777 }" > %t.script
24# RUN: ld.lld -o %t.out --script %t.script %t
25# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=DEC %s
26# DEC: 66000309 00000309 00000309 00000309
27
28## Invalid hex value:
29# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x99XX }" > %t.script
30# RUN: not ld.lld -o %t.out --script %t.script %t 2>&1 \
31# RUN:   | FileCheck --check-prefix=ERR2 %s
32# ERR2: invalid filler expression: 0x99XX
33
34## Check case with space between '=' and expression:
35# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } = 0x1122 }" > %t.script
36# RUN: ld.lld -o %t.out --script %t.script %t
37# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES %s
38
39.section        .mysec.1,"a"
40.align  16
41.byte   0x66
42
43.section        .mysec.2,"a"
44.align  16
45.byte   0x66
46
47.globl _start
48_start:
49 nop
50