aboutsummaryrefslogtreecommitdiff
path: root/test/elf/dynamic-undef.test
blob: 7506b21b3ca7008bb2dea52ff3f8908ee09c24ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#
# 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 \
RUN:   --defsym=__tls_get_addr=0
# Building shared libraries should not fail when there is a undefined symbol.
# Test creation of shared library, this should pass because we are using
# shared option and by default, dynamic library wouldn't 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.usenoundefines -e main -shared
RUN: llvm-readobj -symbols %t.usenoundefines | FileCheck %s -check-prefix=SHLIB-NOUNDEF
# 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: lld -flavor gnu -target x86_64-linux %p/Inputs/tls.x86-64 \
RUN:   %p/Inputs/shared.so-x86-64 -o %t.useundefines -e main -shared \
RUN: --use-shlib-undefines --no-allow-shlib-undefined  2> %t2
RUN: llvm-readobj -symbols %t.useundefines | FileCheck -check-prefix=SHLIB-UNDEF-SYMBOLS %s

EXEC: Undefined symbol: {{.+[\\/]}}shared.so-x86-64: puts
SHLIB: Undefined symbol: {{.+[\\/]}}shared.so-x86-64: puts
EXEC-NOT: Undefined symbol: {{.+[\\/]}}shared.so-x86-64: weakfoo
SHLIB-NOT: Undefined symbol: {{.+[\\/]}}shared.so-x86-64: weakfoo
SHLIB-NOUNDEF-NOT: Name: puts
SHLIB-UNDEF-SYMBOLS: Name: puts