1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
3
4# RUN: echo "MEMORY { \
5# RUN:   ram (rwx)  : ORIGIN = 0x8000, LENGTH = 256K \
6# RUN: } \
7# RUN: SECTIONS { \
8# RUN:         origin = ORIGIN(ram); \
9# RUN:         length = LENGTH(ram); \
10# RUN:         end    = ORIGIN(ram) + LENGTH(ram); \
11# RUN:       }" > %t.script
12# RUN: ld.lld -o %t1 --script %t.script %t
13# RUN: llvm-nm -p %t1 | FileCheck %s
14
15# CHECK:      0000000000008000 T _start
16# CHECK-NEXT: 0000000000008000 A origin
17# CHECK-NEXT: 0000000000040000 A length
18# CHECK-NEXT: 0000000000048000 A end
19
20# RUN: echo "SECTIONS { \
21# RUN:         no_exist_origin = ORIGIN(ram); \
22# RUN:         no_exist_length = LENGTH(ram); \
23# RUN:       }" > %t2.script
24# RUN: not ld.lld -o /dev/null --script %t2.script %t 2>&1 \
25# RUN:  | FileCheck -check-prefix=ERR %s
26# ERR: {{.*}}.script:1: memory region not defined: ram
27
28
29.global _start
30_start:
31 nop
32