[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / linkerscript / symbol-memoryexpr.s
blobad01466e20d8c8c39116a99e70fb597838f36a64
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
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
15 # CHECK: 0000000000008000 T _start
16 # CHECK-NEXT: 0000000000008000 A origin
17 # CHECK-NEXT: 0000000000040000 A length
18 # CHECK-NEXT: 0000000000048000 A end
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
29 .global _start
30 _start:
31 nop