1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
3
4## Check that padding of executable sections are filled with trap bytes if not
5## otherwise specified in the script.
6# RUN: echo "SECTIONS { .exec : { *(.exec*) } }" > %t.script
7# RUN: ld.lld -o %t.out --script %t.script %t
8# RUN: llvm-objdump -s %t.out | FileCheck %s --check-prefix=EXEC
9# EXEC:      0000 66cccccc cccccccc cccccccc cccccccc
10# EXEC-NEXT: 0010 66
11
12## Check that a fill expression or command overrides the default filler...
13# RUN: echo "SECTIONS { .exec : { *(.exec*) }=0x11223344 }" > %t2.script
14# RUN: ld.lld -o %t2.out --script %t2.script %t
15# RUN: llvm-objdump -s %t2.out | FileCheck %s --check-prefix=OVERRIDE
16# RUN: echo "SECTIONS { .exec : { FILL(0x11223344); *(.exec*) } }" > %t3.script
17# RUN: ld.lld -o %t3.out --script %t3.script %t
18# RUN: llvm-objdump -s %t3.out | FileCheck %s --check-prefix=OVERRIDE
19# OVERRIDE:      Contents of section .exec:
20# OVERRIDE-NEXT:  0000 66112233 44112233 44112233 44112233
21# OVERRIDE-NEXT:  0010 66
22
23## ...even for a value of zero.
24# RUN: echo "SECTIONS { .exec : { *(.exec*) }=0x00000000 }" > %t4.script
25# RUN: ld.lld -o %t4.out --script %t4.script %t
26# RUN: llvm-objdump -s %t4.out | FileCheck %s --check-prefix=ZERO
27# RUN: echo "SECTIONS { .exec : { FILL(0x00000000); *(.exec*) } }" > %t5.script
28# RUN: ld.lld -o %t5.out --script %t5.script %t
29# RUN: llvm-objdump -s %t5.out | FileCheck %s --check-prefix=ZERO
30# ZERO:      Contents of section .exec:
31# ZERO-NEXT:  0000 66000000 00000000 00000000 00000000
32# ZERO-NEXT:  0010 66
33
34.section        .exec.1,"ax"
35.align  16
36.byte   0x66
37
38.section        .exec.2,"ax"
39.align  16
40.byte   0x66
41