]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/ELF/linkerscript/loadaddr.s
Vendor import of lld trunk r290819:
[FreeBSD/FreeBSD.git] / test / ELF / linkerscript / loadaddr.s
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
3 # RUN: echo "SECTIONS { \
4 # RUN:  . = 0x1000; \
5 # RUN:  .aaa : AT(0x2000) { *(.aaa) } \
6 # RUN:  .bbb : { *(.bbb) } \
7 # RUN:  .ccc : AT(0x3000) { *(.ccc) } \
8 # RUN:  .ddd : AT(0x4000) { *(.ddd) } \
9 # RUN:  .text : { *(.text) } \
10 # RUN:  aaa_lma = LOADADDR(.aaa);  \
11 # RUN:  bbb_lma = LOADADDR(.bbb);  \
12 # RUN:  ccc_lma = LOADADDR(.ccc);  \
13 # RUN:  ddd_lma = LOADADDR(.ddd);  \
14 # RUN:  txt_lma = LOADADDR(.text); \
15 # RUN: }" > %t.script
16 # RUN: ld.lld %t --script %t.script -o %t2
17 # RUN: llvm-objdump -t %t2 | FileCheck %s
18 # RUN: echo "SECTIONS { v = LOADADDR(.zzz); }" > %t.script
19 # RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | FileCheck --check-prefix=ERROR %s
20
21 # CHECK:      0000000000002000         *ABS*     00000000 aaa_lma
22 # CHECK-NEXT: 0000000000002008         *ABS*     00000000 bbb_lma
23 # CHECK-NEXT: 0000000000003000         *ABS*     00000000 ccc_lma
24 # CHECK-NEXT: 0000000000004000         *ABS*     00000000 ddd_lma
25 # CHECK-NEXT: 0000000000004008         *ABS*     00000000 txt_lma
26 # ERROR: {{.*}}.script:1: undefined section .zzz
27
28 .global _start
29 _start:
30  nop
31
32 .section .aaa, "a"
33 .quad 0
34
35 .section .bbb, "a"
36 .quad 0
37
38 .section .ccc, "a"
39 .quad 0
40
41 .section .ddd, "a"
42 .quad 0