]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/ELF/linkerscript/numbers.s
Vendor import of lld trunk r290819:
[FreeBSD/FreeBSD.git] / test / ELF / linkerscript / numbers.s
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 { \
32 # RUN:  . = 0x11h; \
33 # RUN: }" > %t2.script
34 # RUN: not ld.lld %t --script %t2.script -o %t3 2>&1 | \
35 # RUN:  FileCheck --check-prefix=ERR1 %s
36 # ERR1: malformed number: 0x11h
37
38 # RUN: echo "SECTIONS { \
39 # RUN:  . = 0x11k; \
40 # RUN: }" > %t3.script
41 # RUN: not ld.lld %t --script %t3.script -o %t4 2>&1 | \
42 # RUN:  FileCheck --check-prefix=ERR2 %s
43 # ERR2: malformed number: 0x11k
44
45 # RUN: echo "SECTIONS { \
46 # RUN:  . = 0x11m; \
47 # RUN: }" > %t4.script
48 # RUN: not ld.lld %t --script %t4.script -o %t5 2>&1 | \
49 # RUN:  FileCheck --check-prefix=ERR3 %s
50 # ERR3: malformed number: 0x11m
51
52 .globl _start
53 _start:
54 nop
55
56 .section .hex.1, "a"
57 .quad 0
58
59 .section .kilo.1, "a"
60 .quad 0
61
62 .section .mega.1, "a"
63 .quad 0
64
65 .section .hex.2, "a"
66 .quad 0
67
68 .section .kilo.2, "a"
69 .quad 0
70
71 .section .mega.2, "a"
72 .quad 0