1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3
4# RUN: not ld.lld %t.o -o does_not_exist/output 2>&1 | \
5# RUN:   FileCheck %s -check-prefixes=NO-DIR-OUTPUT,CHECK
6# RUN: not ld.lld %t.o -o %s/dir_is_a_file 2>&1 | \
7# RUN:   FileCheck %s -check-prefixes=DIR-IS-OUTPUT,CHECK
8
9# RUN: echo "OUTPUT(\"does_not_exist/output\")" > %t.script
10# RUN: not ld.lld %t.o %t.script 2>&1 | \
11# RUN:   FileCheck %s -check-prefixes=NO-DIR-OUTPUT,CHECK
12# RUN: echo "OUTPUT(\"%s/dir_is_a_file\")" > %t.script
13# RUN: not ld.lld %t.o %t.script 2>&1 | \
14# RUN:   FileCheck %s -check-prefixes=DIR-IS-OUTPUT,CHECK
15
16# RUN: not ld.lld %t.o -o %t -Map=does_not_exist/output 2>&1 | \
17# RUN:   FileCheck %s -check-prefixes=NO-DIR-MAP,CHECK
18# RUN: not ld.lld %t.o -o %t -Map=%s/dir_is_a_file 2>&1 | \
19# RUN:   FileCheck %s -check-prefixes=DIR-IS-MAP,CHECK
20
21# NO-DIR-OUTPUT: error: cannot open output file does_not_exist/output:
22# DIR-IS-OUTPUT: error: cannot open output file {{.*}}/dir_is_a_file:
23# NO-DIR-MAP: error: cannot open map file does_not_exist/output:
24# DIR-IS-MAP: error: cannot open map file {{.*}}/dir_is_a_file:
25
26# We should exit before doing the actual link. If an undefined symbol error is
27# discovered we haven't bailed out early as expected.
28# CHECK-NOT: undefined_symbol
29
30# RUN: not ld.lld %t.o -o / 2>&1 | FileCheck %s -check-prefixes=ROOT,CHECK
31# ROOT: error: cannot open output file /
32
33  .globl _start
34_start:
35  call undefined_symbol
36