[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / protected-function-access.s
blob60db1656f2385799bbaa6a07429966893cb07c73
1 # REQUIRES: x86
3 ## Don't create a canonical PLT if the symbol is defined as protected in a DSO,
4 ## because thay may break pointer equality.
6 # RUN: echo '.globl foo; .protected foo; .type foo,@function; foo:' | \
7 # RUN: llvm-mc -filetype=obj -triple=x86_64 - -o %t2.o
8 # RUN: ld.lld %t2.o -o %t2.so -shared -soname=so
9 # RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %s -o %t.o
11 # RUN: not ld.lld %t.o %t2.so -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
12 # ERR: error: cannot preempt symbol: foo
14 # RUN: ld.lld --ignore-function-address-equality %t.o %t2.so -o %t
15 # RUN: llvm-readobj --dyn-symbols --relocations %t | FileCheck %s
17 # Check that we have a relocation and an undefined symbol with a non zero address
19 # CHECK: R_X86_64_JUMP_SLOT foo 0x0
21 # CHECK: Name: foo
22 # CHECK-NEXT: Value: 0x20{{.*}}
23 # CHECK-NEXT: Size:
24 # CHECK-NEXT: Binding: Global
25 # CHECK-NEXT: Type: Function
26 # CHECK-NEXT: Other:
27 # CHECK-NEXT: Section: Undefined
29 .global _start
30 _start:
31 .quad foo