Commit 3343d000 authored by Fangrui Song's avatar Fangrui Song
Browse files

[ELF][test] Demonstrate --no-allow-shlib-undefined behavior with a hidden...

[ELF][test] Demonstrate --no-allow-shlib-undefined behavior with a hidden relocatable object file definition

1981b1b6 improved the check.
parent 460e8439
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -37,6 +37,17 @@
# RUN: not ld.lld %t.o %t.so %t2.so -o /dev/null 2>&1 | \
# RUN:   FileCheck %s --check-prefixes=CHECK,CHECK2

## Test some cases where relocatable object files provide a hidden definition.
# RUN: echo '.globl _unresolved; _unresolved:' | llvm-mc -filetype=obj -triple=x86_64 -o %tdef.o
# RUN: echo '.globl _unresolved; .hidden _unresolved; _unresolved:' | llvm-mc -filetype=obj -triple=x86_64 -o %tdef-hidden.o
# RUN: ld.lld %t.o %t.so %tdef-hidden.o -o /dev/null 2>&1 | count 0

## The section containing the definition is discarded, and we report an error.
# RUN: not ld.lld --gc-sections %t.o %t.so %tdef-hidden.o -o /dev/null 2>&1 | FileCheck %s
## The definition %tdef.so is ignored.
# RUN: ld.lld -shared -soname=tdef.so %tdef.o -o %tdef.so
# RUN: not ld.lld --gc-sections %t.o %t.so %tdef.so %tdef-hidden.o -o /dev/null 2>&1 | FileCheck %s

.globl _start
_start:
  callq _shared@PLT