1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux-gnu %s -o %t.o 3 4# Without --warn-text-ifunc, lld should run fine: 5# RUN: ld.lld -z notext %t.o -o %t2 6 7# With --warn-text-ifunc, lld should run with warnings: 8# RUN: ld.lld --warn-ifunc-textrel -z notext %t.o -o /dev/null 2>&1 | FileCheck %s 9# CHECK: using ifunc symbols when text relocations are allowed may produce 10# CHECK-SAME: a binary that will segfault, if the object file is linked with 11# CHECK-SAME: old version of glibc (glibc 2.28 and earlier). If this applies to 12# CHECK-SAME: you, consider recompiling the object files without -fPIC and 13# CHECK-SAME: without -Wl,-z,notext option. Use -no-warn-ifunc-textrel to 14# CHECK-SAME: turn off this warning. 15# CHECK: >>> defined in {{.*}} 16# CHECK: >>> referenced by {{.*}}:(.text+0x8) 17 18# Without text relocations, lld should run fine: 19# RUN: ld.lld --fatal-warnings %t.o -o /dev/null 20 21.text 22.globl a_func_impl 23a_func_impl: 24 nop 25 26.globl selector 27.type selector,@function 28selector: 29 movl $a_func_impl, %eax 30 retq 31 32.globl a_func 33.type a_func,@gnu_indirect_function 34.set a_func, selector 35 36.globl _start 37.type _start,@function 38main: 39 callq a_func 40 retq 41