1# REQUIRES: x86 2 3# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o 4# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ 5# RUN: %p/Inputs/allow-shlib-undefined.s -o %t1.o 6# RUN: ld.lld -shared %t1.o -o %t.so 7 8# RUN: ld.lld --allow-shlib-undefined %t.o %t.so -o /dev/null 9# RUN: not ld.lld --no-allow-shlib-undefined %t.o %t.so -o /dev/null 2>&1 | FileCheck %s 10# Executable defaults to --no-allow-shlib-undefined 11# RUN: not ld.lld %t.o %t.so -o /dev/null 2>&1 | FileCheck %s 12# RUN: ld.lld %t.o %t.so --noinhibit-exec -o /dev/null 2>&1 | FileCheck %s --check-prefix=WARN 13# RUN: ld.lld %t.o %t.so --warn-unresolved-symbols -o /dev/null 2>&1 | FileCheck %s --check-prefix=WARN 14# -shared defaults to --allow-shlib-undefined 15# RUN: ld.lld -shared %t.o %t.so -o /dev/null 16 17# RUN: echo | llvm-mc -filetype=obj -triple=x86_64-unknown-linux -o %tempty.o 18# RUN: ld.lld -shared %tempty.o -o %tempty.so 19# RUN: ld.lld -shared %t1.o %tempty.so -o %t2.so 20# RUN: ld.lld --no-allow-shlib-undefined %t.o %t2.so -o /dev/null 21 22# DSO with undefines: 23# should link with or without any of these options. 24# RUN: ld.lld -shared %t1.o -o /dev/null 25# RUN: ld.lld -shared --allow-shlib-undefined %t1.o -o /dev/null 26# RUN: ld.lld -shared --no-allow-shlib-undefined %t1.o -o /dev/null 27 28## Check that the error is reported if an unresolved symbol is first seen in a 29## regular object file. 30# RUN: echo 'callq _unresolved@PLT' | \ 31# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %tref.o 32# RUN: not ld.lld --gc-sections %t.o %tref.o %t.so -o /dev/null 2>&1 | FileCheck %s 33 34## Check that the error is reported for each shared library where the symbol 35## is referenced. 36# RUN: cp %t.so %t2.so 37# RUN: not ld.lld %t.o %t.so %t2.so -o /dev/null 2>&1 | \ 38# RUN: FileCheck %s --check-prefixes=CHECK,CHECK2 39 40.globl _start 41_start: 42 callq _shared@PLT 43 44# CHECK: error: undefined reference due to --no-allow-shlib-undefined: _unresolved 45# CHECK-NEXT: >>> referenced by {{.*}}.so 46# CHECK2: error: undefined reference due to --no-allow-shlib-undefined: _unresolved 47# CHECK2-NEXT: >>> referenced by {{.*}}2.so 48# WARN: warning: undefined reference due to --no-allow-shlib-undefined: _unresolved 49# WARN-NEXT: >>> referenced by {{.*}}.so 50