1#!/bin/sh 2# REQUIRES: x86 3# UNSUPPORTED: system-windows 4 5# RUN: llvm-mc -filetype=obj -triple=x86_64 /dev/null -o %t0.o 6# RUN: not ld.lld -o /dev/null -lidontexist --error-handling-script=%s %t0.o 2>&1 |\ 7# RUN: FileCheck --check-prefix=CHECK-LIB %s 8# RUN: not ld.lld -o /dev/null -lidontexist --error-handling-script=%s.nope %t0.o 2>&1 |\ 9# RUN: FileCheck --check-prefix=CHECK-SCRIPT-DOES-NOT-EXIST -DFILE=%s.nope %s 10 11# RUN: echo 'bar: movl a(%rip), %eax' | llvm-mc -filetype=obj -triple=x86_64 - -o %t1.o 12# RUN: not ld.lld -o /dev/null --error-handling-script=%s %t1.o 2>&1 |\ 13# RUN: FileCheck --check-prefix=CHECK-SYM-C %s 14 15# RUN: echo 'bar: movl _Z1av(%rip), %eax' | llvm-mc -filetype=obj -triple=x86_64 - -o %t2.o 16# RUN: not ld.lld -o /dev/null --demangle --error-handling-script=%s %t2.o 2>&1 |\ 17# RUN: FileCheck --check-prefix=CHECK-SYM-CXX-DEMANGLE %s 18# RUN: not ld.lld -o /dev/null --no-demangle --error-handling-script=%s %t2.o 2>&1 |\ 19# RUN: FileCheck --check-prefix=CHECK-SYM-CXX-NO-DEMANGLE %s 20 21# RUN: { echo 'a_: ret'; echo 'bar: movl a(%rip), %eax' ; } | llvm-mc -filetype=obj -triple=x86_64 - -o %t3.o 22# RUN: not ld.lld -o /dev/null --error-handling-script=%s %t3.o 2>&1 |\ 23# RUN: FileCheck --check-prefix=CHECK-SYM-C-CORRECTION -DOBJ=%t3.o %s 24 25# CHECK-LIB: script: info: called with missing-lib idontexist 26# CHECK-LIB-NEXT: ld.lld: error: unable to find library -lidontexist 27 28# CHECK-SCRIPT-DOES-NOT-EXIST: ld.lld: error: unable to find library -lidontexist 29# CHECK-SCRIPT-DOES-NOT-EXIST-NEXT: ld.lld: error: error handling script '[[FILE]]' failed to execute 30 31# CHECK-SYM-C: script: info: called with undefined-symbol a 32# CHECK-SYM-C-NEXT: ld.lld: error: undefined symbol: a 33 34# CHECK-SYM-CXX-DEMANGLE: script: info: called with undefined-symbol _Z1av 35# CHECK-SYM-CXX-DEMANGLE-NEXT: ld.lld: error: undefined symbol: a() 36 37# CHECK-SYM-CXX-NO-DEMANGLE: script: info: called with undefined-symbol _Z1av 38# CHECK-SYM-CXX-NO-DEMANGLE-NEXT: ld.lld: error: undefined symbol: _Z1av 39 40# CHECK-SYM-C-CORRECTION: script: info: called with undefined-symbol a 41# CHECK-SYM-C-CORRECTION-NEXT: ld.lld: error: undefined symbol: a 42# CHECK-SYM-C-CORRECTION-NEXT: >>> referenced by [[OBJ]]: 43# CHECK-SYM-C-CORRECTION-NEXT: >>> did you mean: a_ 44 45 46echo "script: info: called with $*" 47