llvm-project/lld/test/elf/dynamic-undef.test

30 lines
1.6 KiB
Plaintext

#
# This test creates a executable and tests the options that are used to
# to create an executable and a shared library
#
# This test will fail because there are unresolved symbols from the shared
# library and we are not passing --allow-shlib-undefined
RUN: not lld -flavor gnu -target x86_64-linux %p/Inputs/tls.x86-64 \
RUN: %p/Inputs/shared.so-x86-64 -o %t -e main 2> %t1
RUN: FileCheck -check-prefix=EXEC %s < %t1
# This test will pass because of --allow-shlib-undefined
RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/tls.x86-64 \
RUN: %p/Inputs/shared.so-x86-64 -o %t -e main --allow-shlib-undefined
# Test creation of shared library, this should pass because we are using
# shared option and by default, dynamic library wouldnot create undefined atoms
# from the input shared library
RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/tls.x86-64 \
RUN: %p/Inputs/shared.so-x86-64 -o %t -e main -shared
# Test creation of shared library, this should fail because we are using
# shared option setting the options to use the shared library undefines to
# create undefined atoms from the input shared library
RUN: not lld -flavor gnu -target x86_64-linux %p/Inputs/tls.x86-64 \
RUN: %p/Inputs/shared.so-x86-64 -o %t -e main -shared \
RUN: --use-shlib-undefines --no-allow-shlib-undefined 2> %t2
RUN: FileCheck -check-prefix=SHLIB %s < %t2
EXEC: Undefined symbol: {{[-_A-Za-z0-9.\\/:]+}}shared.so-x86-64: puts
SHLIB: Undefined symbol: {{[-_A-Za-z0-9.\\/:]+}}shared.so-x86-64: puts
EXEC-NOT: Undefined symbol: {{[-_A-Za-z0-9.\\/:]+}}shared.so-x86-64: weakfoo
SHLIB-NOT: Undefined symbol: {{[-_A-Za-z0-9.\\/:]+}}shared.so-x86-64: weakfoo