68 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o3# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/unresolved-symbols.s -o %t2.o4# RUN: ld.lld -shared %t2.o -o %t.so5 6## Check that %t2.o contains undefined symbol undef.7# RUN: not ld.lld %t1.o %t2.o -o /dev/null 2>&1 | \8# RUN: FileCheck -check-prefix=UNDCHECK %s9# UNDCHECK: error: undefined symbol: undef10# UNDCHECK: >>> referenced by {{.*}}2.o:(.text+0x1)11 12## Error out if unknown option value was set.13# RUN: not ld.lld %t1.o %t2.o -o /dev/null --unresolved-symbols=xxx 2>&1 | \14# RUN: FileCheck -check-prefix=ERR1 %s15# ERR1: unknown --unresolved-symbols value: xxx16## Check alias.17# RUN: not ld.lld %t1.o %t2.o -o /dev/null --unresolved-symbols xxx 2>&1 | \18# RUN: FileCheck -check-prefix=ERR1 %s19 20## Ignore all should not produce error for symbols from object except21## case when --no-undefined specified.22# RUN: ld.lld %t2.o -o %t1_1 --unresolved-symbols=ignore-all23# RUN: llvm-readobj %t1_1 > /dev/null 2>&124# RUN: not ld.lld %t2.o -o /dev/null --unresolved-symbols=ignore-all --no-undefined 2>&1 | \25# RUN: FileCheck -check-prefix=ERRUND %s26# ERRUND: error: undefined symbol: undef27# ERRUND: >>> referenced by {{.*}}:(.text+0x1)28 29## Also ignore all should not produce error for symbols from DSOs.30# RUN: ld.lld %t1.o %t.so -o %t1_3 --allow-shlib-undefined --unresolved-symbols=ignore-all31# RUN: llvm-readobj %t1_3 > /dev/null 2>&132 33## Ignoring undefines in objects should not produce error for symbol from object.34# RUN: ld.lld %t1.o %t2.o -o %t2 --unresolved-symbols=ignore-in-object-files35# RUN: llvm-readobj %t2 > /dev/null 2>&136## --unresolved-symbols overrides a previous --allow-shlib-undefined.37# RUN: not ld.lld %t1.o %t.so -o /dev/null --allow-shlib-undefined --unresolved-symbols=ignore-in-object-files 2>&1 | FileCheck %s --check-prefix=SHLIB38 39# SHLIB: error: undefined reference: undef40 41## Ignoring undefines in shared should produce error for symbol from object.42# RUN: not ld.lld %t2.o -o /dev/null --unresolved-symbols=ignore-in-shared-libs 2>&1 | \43# RUN: FileCheck -check-prefix=ERRUND %s44## And should not produce errors for symbols from DSO.45# RUN: ld.lld %t1.o %t.so -o %t3_1 --allow-shlib-undefined --unresolved-symbols=ignore-in-shared-libs46# RUN: llvm-readobj %t3_1 > /dev/null 2>&147 48## Ignoring undefines in shared libs should not produce error for symbol from object49## if we are linking DSO.50# RUN: ld.lld -shared %t1.o -o %t4 --unresolved-symbols=ignore-in-shared-libs51# RUN: llvm-readobj %t4 > /dev/null 2>&152 53## Do not report undefines if linking relocatable.54# RUN: ld.lld -r %t1.o %t2.o -o %t5 --unresolved-symbols=report-all55# RUN: llvm-readobj %t5 > /dev/null 2>&156 57## report-all is the default when linking an executable. Check that we report58## unresolved undefines from both DSO and regular object files.59# RUN: not ld.lld -shared %t1.o %t.so -o /dev/null --unresolved-symbols=report-all 2>&1 | FileCheck %s --check-prefix=SHLIB60# RUN: ld.lld -shared %t1.o %t.so -o %t6_161# RUN: llvm-readobj %t6_1 > /dev/null 2>&162# RUN: not ld.lld %t2.o -o /dev/null --unresolved-symbols=report-all 2>&1 | \63# RUN: FileCheck -check-prefix=ERRUND %s64# RUN: not ld.lld %t2.o -o /dev/null 2>&1 | FileCheck -check-prefix=ERRUND %s65 66.globl _start67_start:68