Index: ELF/DriverUtils.cpp =================================================================== --- ELF/DriverUtils.cpp +++ ELF/DriverUtils.cpp @@ -135,6 +135,11 @@ case OPT_INPUT: OS << quote(rewritePath(Arg->getValue())) << "\n"; break; + case OPT_o: + OS << Arg->getSpelling() << " " + << quote(sys::path::filename(Arg->getValue())) + << "\n"; + break; case OPT_L: case OPT_dynamic_list: case OPT_rpath: Index: test/ELF/reproduce.s =================================================================== --- test/ELF/reproduce.s +++ test/ELF/reproduce.s @@ -60,6 +60,14 @@ # CHECK-NEXT: repro2/{{.*}}/file2 # CHECK-NEXT: repro2/{{.*}}/file +## Check that directory path is stripped from -o +# RUN: mkdir -p %t.dir/build3/a/b/c +# RUN: cd %t.dir +# RUN: ld.lld build1/foo.o -o build3/a/b/c/bar -shared --as-needed --reproduce repro3.tar +# RUN: tar xf repro3.tar +# RUN: FileCheck %s --check-prefix=RSP3 < repro3/response.txt +# RSP3: -o bar + .globl _start _start: mov $60, %rax