2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
3 # RUN: echo "SECTIONS { \
5 # RUN: .hex1 : { *(.hex.1) } \
7 # RUN: .hex2 : { *(.hex.2) } \
9 # RUN: .kilo1 : { *(.kilo.1) } \
11 # RUN: .kilo2 : { *(.kilo.2) } \
13 # RUN: .mega1 : { *(.mega.1) } \
15 # RUN: .mega2 : { *(.mega.2) } \
17 # RUN: ld.lld %t --script %t.script -o %t2
18 # RUN: llvm-objdump --section-headers %t2 | FileCheck %s
21 # CHECK-NEXT: Idx Name Size VMA
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
30 ## Mailformed number errors.
31 # RUN: echo "SECTIONS { . = 0x11h; }" > %t2.script
32 # RUN: not ld.lld %t --script %t2.script -o /dev/null 2>&1 | \
33 # RUN: FileCheck --check-prefix=ERR1 %s
34 # ERR1: malformed number: 0x11h
36 # RUN: echo "SECTIONS { . = 0x11k; }" > %t3.script
37 # RUN: not ld.lld %t --script %t3.script -o /dev/null 2>&1 | \
38 # RUN: FileCheck --check-prefix=ERR2 %s
39 # ERR2: malformed number: 0x11k
41 # RUN: echo "SECTIONS { . = 0x11m; }" > %t4.script
42 # RUN: not ld.lld %t --script %t4.script -o /dev/null 2>&1 | \
43 # RUN: FileCheck --check-prefix=ERR3 %s
44 # ERR3: malformed number: 0x11m
46 # RUN: echo "SECTIONS { . = 1zh; }" > %t5.script
47 # RUN: not ld.lld %t --script %t5.script -o /dev/null 2>&1 | \
48 # RUN: FileCheck --check-prefix=ERR4 %s
49 # ERR4: malformed number: 1zh
51 # RUN: echo "SECTIONS { . = 1zk; }" > %t6.script
52 # RUN: not ld.lld %t --script %t6.script -o /dev/null 2>&1 | \
53 # RUN: FileCheck --check-prefix=ERR5 %s
54 # ERR5: malformed number: 1zk
56 # RUN: echo "SECTIONS { . = 1zm; }" > %t7.script
57 # RUN: not ld.lld %t --script %t7.script -o /dev/null 2>&1 | \
58 # RUN: FileCheck --check-prefix=ERR6 %s
59 # ERR6: malformed number: 1zm
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.script
67 # RUN: ld.lld %t --script %t8.script -o %t6
68 # RUN: llvm-objdump --section-headers %t6 | FileCheck --check-prefix=SECADDR %s
70 # SECADDR-NEXT: Idx Name Size VMA
71 # SECADDR-NEXT: 0 00000000 0000000000000000
72 # SECADDR-NEXT: 1 .hex1 00000008 0000000000000400
73 # SECADDR-NEXT: 2 .hex2 00000008 0000000000000500