Skip to content

Commit 3343d00

Browse files
committed
[ELF][test] Demonstrate --no-allow-shlib-undefined behavior with a hidden relocatable object file definition
1981b1b improved the check.
1 parent 460e843 commit 3343d00

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lld/test/ELF/allow-shlib-undefined.s

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@
3737
# RUN: not ld.lld %t.o %t.so %t2.so -o /dev/null 2>&1 | \
3838
# RUN: FileCheck %s --check-prefixes=CHECK,CHECK2
3939

40+
## Test some cases where relocatable object files provide a hidden definition.
41+
# RUN: echo '.globl _unresolved; _unresolved:' | llvm-mc -filetype=obj -triple=x86_64 -o %tdef.o
42+
# RUN: echo '.globl _unresolved; .hidden _unresolved; _unresolved:' | llvm-mc -filetype=obj -triple=x86_64 -o %tdef-hidden.o
43+
# RUN: ld.lld %t.o %t.so %tdef-hidden.o -o /dev/null 2>&1 | count 0
44+
45+
## The section containing the definition is discarded, and we report an error.
46+
# RUN: not ld.lld --gc-sections %t.o %t.so %tdef-hidden.o -o /dev/null 2>&1 | FileCheck %s
47+
## The definition %tdef.so is ignored.
48+
# RUN: ld.lld -shared -soname=tdef.so %tdef.o -o %tdef.so
49+
# RUN: not ld.lld --gc-sections %t.o %t.so %tdef.so %tdef-hidden.o -o /dev/null 2>&1 | FileCheck %s
50+
4051
.globl _start
4152
_start:
4253
callq _shared@PLT

0 commit comments

Comments
 (0)