1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t 3# RUN: echo "SECTIONS { \ 4# RUN: . = 1000h; \ 5# RUN: .hex1 : { *(.hex.1) } \ 6# RUN: . = 1010H; \ 7# RUN: .hex2 : { *(.hex.2) } \ 8# RUN: . = 10k; \ 9# RUN: .kilo1 : { *(.kilo.1) } \ 10# RUN: . = 11K; \ 11# RUN: .kilo2 : { *(.kilo.2) } \ 12# RUN: . = 1m; \ 13# RUN: .mega1 : { *(.mega.1) } \ 14# RUN: . = 2M; \ 15# RUN: .mega2 : { *(.mega.2) } \ 16# RUN: }" > %t.script 17# RUN: ld.lld %t --script %t.script -o %t2 18# RUN: llvm-objdump -section-headers %t2 | FileCheck %s 19 20# CHECK: Sections: 21# CHECK-NEXT: Idx Name Size Address 22# CHECK-NEXT: 0 00000000 0000000000000000 23# CHECK-NEXT: 1 .hex1 00000008 0000000000001000 24# CHECK-NEXT: 2 .hex2 00000008 0000000000001010 25# CHECK-NEXT: 3 .kilo1 00000008 0000000000002800 26# CHECK-NEXT: 4 .kilo2 00000008 0000000000002c00 27# CHECK-NEXT: 5 .mega1 00000008 0000000000100000 28# CHECK-NEXT: 6 .mega2 00000008 0000000000200000 29 30## Mailformed number errors. 31# RUN: echo "SECTIONS { . = 0x11h; }" > %t2.script 32# RUN: not ld.lld %t --script %t2.script -o %t3 2>&1 | \ 33# RUN: FileCheck --check-prefix=ERR1 %s 34# ERR1: malformed number: 0x11h 35 36# RUN: echo "SECTIONS { . = 0x11k; }" > %t3.script 37# RUN: not ld.lld %t --script %t3.script -o %t4 2>&1 | \ 38# RUN: FileCheck --check-prefix=ERR2 %s 39# ERR2: malformed number: 0x11k 40 41# RUN: echo "SECTIONS { . = 0x11m; }" > %t4.script 42# RUN: not ld.lld %t --script %t4.script -o %t5 2>&1 | \ 43# RUN: FileCheck --check-prefix=ERR3 %s 44# ERR3: malformed number: 0x11m 45 46## Make sure that numbers can be followed by a ":" with and without a space, 47## e.g. "0x100 :" or "0x100:" 48# RUN: echo "SECTIONS { \ 49# RUN: .hex1 0x400 : { *(.hex.1) } \ 50# RUN: .hex2 0x500:{ *(.hex.2) } \ 51# RUN: }" > %t5.script 52# RUN: ld.lld %t --script %t5.script -o %t6 53# RUN: llvm-objdump -section-headers %t6 | FileCheck -check-prefix=SECADDR %s 54# SECADDR: Sections: 55# SECADDR-NEXT: Idx Name Size Address 56# SECADDR-NEXT: 0 00000000 0000000000000000 57# SECADDR-NEXT: 1 .hex1 00000008 0000000000000400 58# SECADDR-NEXT: 2 .hex2 00000008 0000000000000500 59 60.globl _start 61_start: 62nop 63 64.section .hex.1, "a" 65.quad 0 66 67.section .kilo.1, "a" 68.quad 0 69 70.section .mega.1, "a" 71.quad 0 72 73.section .hex.2, "a" 74.quad 0 75 76.section .kilo.2, "a" 77.quad 0 78 79.section .mega.2, "a" 80.quad 0 81