2016-02-26 22:48:31 +08:00
|
|
|
# REQUIRES: x86
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
|
|
|
|
|
|
|
|
## Check that padding value works:
|
2016-08-30 06:01:21 +08:00
|
|
|
# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x1122 }" > %t.script
|
2016-02-26 22:48:31 +08:00
|
|
|
# RUN: ld.lld -o %t.out --script %t.script %t
|
2016-08-05 05:23:30 +08:00
|
|
|
# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES %s
|
2017-04-07 18:36:42 +08:00
|
|
|
# YES: 66000011 22000011 22000011 22000011
|
2016-02-26 22:48:31 +08:00
|
|
|
|
|
|
|
## Confirming that address was correct:
|
2016-08-30 06:01:21 +08:00
|
|
|
# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x99887766 }" > %t.script
|
2016-02-26 22:48:31 +08:00
|
|
|
# RUN: ld.lld -o %t.out --script %t.script %t
|
2016-08-05 05:23:30 +08:00
|
|
|
# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES2 %s
|
2017-04-07 18:36:42 +08:00
|
|
|
# YES2: 66998877 66998877 66998877 66998877
|
2016-02-26 22:48:31 +08:00
|
|
|
|
|
|
|
## Default padding value is 0x00:
|
|
|
|
# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } }" > %t.script
|
|
|
|
# RUN: ld.lld -o %t.out --script %t.script %t
|
2016-08-05 05:23:30 +08:00
|
|
|
# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=NO %s
|
2016-09-20 23:08:24 +08:00
|
|
|
# NO: 66000000 00000000 00000000 00000000
|
2016-02-26 22:48:31 +08:00
|
|
|
|
2016-07-30 06:21:28 +08:00
|
|
|
## Decimal value.
|
2016-08-04 07:25:15 +08:00
|
|
|
# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =777 }" > %t.script
|
2016-07-30 06:21:28 +08:00
|
|
|
# RUN: ld.lld -o %t.out --script %t.script %t
|
2016-08-05 05:23:30 +08:00
|
|
|
# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=DEC %s
|
2017-04-07 18:36:42 +08:00
|
|
|
# DEC: 66000003 09000003 09000003 09000003
|
2016-02-26 22:48:31 +08:00
|
|
|
|
2016-07-30 06:21:28 +08:00
|
|
|
## Invalid hex value:
|
2016-02-26 22:48:31 +08:00
|
|
|
# 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
|
2016-09-06 21:51:57 +08:00
|
|
|
# ERR2: invalid filler expression: 0x99XX
|
2016-02-26 22:48:31 +08:00
|
|
|
|
2016-09-23 21:29:20 +08:00
|
|
|
## Check case with space between '=' and expression:
|
|
|
|
# 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
|
|
|
|
|
2017-01-17 23:32:12 +08:00
|
|
|
## Check case with optional comma following output section command:
|
|
|
|
# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x1122, .a : { *(.a*) } }" > %t.script
|
|
|
|
# RUN: ld.lld -o %t.out --script %t.script %t
|
|
|
|
# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES %s
|
|
|
|
|
2016-02-26 22:48:31 +08:00
|
|
|
.section .mysec.1,"a"
|
|
|
|
.align 16
|
|
|
|
.byte 0x66
|
|
|
|
|
|
|
|
.section .mysec.2,"a"
|
|
|
|
.align 16
|
|
|
|
.byte 0x66
|
|
|
|
|
|
|
|
.globl _start
|
|
|
|
_start:
|
|
|
|
nop
|