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-objdump -t %t1 | FileCheck %s
14
15# CHECK:      SYMBOL TABLE:
16# CHECK-NEXT: 0000000000000000 *UND* 00000000
17# CHECK-NEXT: 0000000000008000 .text 00000000 _start
18# CHECK-NEXT: 0000000000008000 *ABS* 00000000 origin
19# CHECK-NEXT: 0000000000040000 *ABS* 00000000 length
20# CHECK-NEXT: 0000000000048000 *ABS* 00000000 end
21
22# RUN: echo "SECTIONS { \
23# RUN:         no_exist_origin = ORIGIN(ram); \
24# RUN:         no_exist_length = LENGTH(ram); \
25# RUN:       }" > %t2.script
26# RUN: not ld.lld -o %t2 --script %t2.script %t 2>&1 \
27# RUN:  | FileCheck -check-prefix=ERR %s
28# ERR: {{.*}}.script:1: memory region not defined: ram
29
30
31.global _start
32_start:
33 nop
34