1# REQUIRES: x86
2
3## Don't create a canonical PLT if the symbol is defined as protected in a DSO,
4## because thay may break pointer equality.
5
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
10
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
13
14# RUN: ld.lld --ignore-function-address-equality %t.o %t2.so -o %t
15# RUN: llvm-readobj --dyn-symbols --relocations %t | FileCheck %s
16
17# Check that we have a relocation and an undefined symbol with a non zero address
18
19# CHECK: R_X86_64_JUMP_SLOT foo 0x0
20
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
28
29.global _start
30_start:
31  .quad foo
32
33