96 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t3# 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.script17# RUN: ld.lld %t --script %t.script -o %t218# RUN: llvm-objdump --section-headers %t2 | FileCheck %s19 20# CHECK: Sections:21# CHECK-NEXT: Idx Name Size VMA22# CHECK-NEXT: 0 00000000 000000000000000023# CHECK-NEXT: 1 .hex1 00000008 000000000000100024# CHECK-NEXT: 2 .hex2 00000008 000000000000101025# CHECK-NEXT: 3 .kilo1 00000008 000000000000280026# CHECK-NEXT: 4 .kilo2 00000008 0000000000002c0027# CHECK-NEXT: 5 .mega1 00000008 000000000010000028# CHECK-NEXT: 6 .mega2 00000008 000000000020000029 30## Mailformed number errors.31# RUN: echo "SECTIONS { . = 0x11h; }" > %t2.script32# RUN: not ld.lld %t --script %t2.script -o /dev/null 2>&1 | \33# RUN: FileCheck --check-prefix=ERR1 %s34# ERR1: malformed number: 0x11h35 36# RUN: echo "SECTIONS { . = 0x11k; }" > %t3.script37# RUN: not ld.lld %t --script %t3.script -o /dev/null 2>&1 | \38# RUN: FileCheck --check-prefix=ERR2 %s39# ERR2: malformed number: 0x11k40 41# RUN: echo "SECTIONS { . = 0x11m; }" > %t4.script42# RUN: not ld.lld %t --script %t4.script -o /dev/null 2>&1 | \43# RUN: FileCheck --check-prefix=ERR3 %s44# ERR3: malformed number: 0x11m45 46# RUN: echo "SECTIONS { . = 1zh; }" > %t5.script47# RUN: not ld.lld %t --script %t5.script -o /dev/null 2>&1 | \48# RUN: FileCheck --check-prefix=ERR4 %s49# ERR4: malformed number: 1zh50 51# RUN: echo "SECTIONS { . = 1zk; }" > %t6.script52# RUN: not ld.lld %t --script %t6.script -o /dev/null 2>&1 | \53# RUN: FileCheck --check-prefix=ERR5 %s54# ERR5: malformed number: 1zk55 56# RUN: echo "SECTIONS { . = 1zm; }" > %t7.script57# RUN: not ld.lld %t --script %t7.script -o /dev/null 2>&1 | \58# RUN: FileCheck --check-prefix=ERR6 %s59# ERR6: malformed number: 1zm60 61## Make sure that numbers can be followed by a ":" with and without a space,62## e.g. "0x100 :" or "0x100:"63# RUN: echo "SECTIONS { \64# RUN: .hex1 0x400 : { *(.hex.1) } \65# RUN: .hex2 0x500:{ *(.hex.2) } \66# RUN: }" > %t8.script67# RUN: ld.lld %t --script %t8.script -o %t668# RUN: llvm-objdump --section-headers %t6 | FileCheck --check-prefix=SECADDR %s69# SECADDR: Sections:70# SECADDR-NEXT: Idx Name Size VMA71# SECADDR-NEXT: 0 00000000 000000000000000072# SECADDR-NEXT: 1 .hex1 00000008 000000000000040073# SECADDR-NEXT: 2 .hex2 00000008 000000000000050074 75.globl _start76_start:77nop78 79.section .hex.1, "a"80.quad 081 82.section .kilo.1, "a"83.quad 084 85.section .mega.1, "a"86.quad 087 88.section .hex.2, "a"89.quad 090 91.section .kilo.2, "a"92.quad 093 94.section .mega.2, "a"95.quad 096