[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / defsym-reserved-syms.s
bloba9c2c054e7b56bf93947df33be867f56e27942c0
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3 # RUN: ld.lld -o %t %t.o --defsym=foo2=etext
4 # RUN: llvm-readobj --symbols -S %t | FileCheck %s
6 ## Check 'foo2' value is equal to value of 'etext'.
7 # CHECK: Symbol {
8 # CHECK: Name: foo2
9 # CHECK-NEXT: Value: 0x[[VAL:.*]]
10 # CHECK: Symbol {
11 # CHECK: Name: etext
12 # CHECK-NEXT: Value: 0x[[VAL]]
14 ## Check 'foo2' value set correctly when using
15 ## reserved symbol 'etext' in expression.
16 # RUN: ld.lld -o %t %t.o --defsym=foo2=etext+2
17 # RUN: llvm-readobj --symbols -S %t | FileCheck %s --check-prefix=EXPR
18 # EXPR: Symbol {
19 # EXPR: Name: foo2
20 # EXPR-NEXT: Value: 0x201127
21 # EXPR: Symbol {
22 # EXPR: Name: etext
23 # EXPR-NEXT: Value: 0x201125
25 .globl foo1
26 foo1 = 0x123
28 .global _start
29 _start:
30 movl $foo2, %edx