forked from OSchip/llvm-project
[LTO] Fix -save-temps in case -o is not specified.
Currently we create a file called .lto.bc. In UNIX, ls(1) by default doesn't show up files starting with a dot, as they're (only by convention) hidden. This makes the output of -save-temps a little bit hard to find. Use "a.out.lto.bc" instead if the output file is not specified. While here, change an existing -save-temps test to exercise this more interesting behaviour. llvm-svn: 265254
This commit is contained in:
parent
d4f5a059e0
commit
887d76c392
|
@ -434,14 +434,18 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) {
|
|||
for (StringRef S : Config->Undefined)
|
||||
Symtab.addUndefinedOpt(S);
|
||||
|
||||
// -save-temps creates a file based on the output file name so we want
|
||||
// to set it right before LTO. This code can't be moved to option parsing
|
||||
// because linker scripts can override the output filename using the
|
||||
// OUTPUT() directive.
|
||||
if (Config->OutputFile.empty())
|
||||
Config->OutputFile = "a.out";
|
||||
|
||||
Symtab.addCombinedLtoObject();
|
||||
|
||||
for (auto *Arg : Args.filtered(OPT_wrap))
|
||||
Symtab.wrap(Arg->getValue());
|
||||
|
||||
if (Config->OutputFile.empty())
|
||||
Config->OutputFile = "a.out";
|
||||
|
||||
// Write the result to the file.
|
||||
Symtab.scanShlibUndefined();
|
||||
if (Config->GcSections)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
; REQUIRES: x86
|
||||
; RUN: rm -f %t %t.lto.bc %t.lto.o
|
||||
; RUN: rm -f a.out a.out.lto.bc a.out.lto.o
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
; RUN: llvm-as %p/Inputs/save-temps.ll -o %t2.o
|
||||
; RUN: ld.lld -shared -m elf_x86_64 %t.o %t2.o -o %t -save-temps
|
||||
; RUN: llvm-nm %t | FileCheck %s
|
||||
; RUN: llvm-nm %t.lto.bc | FileCheck %s
|
||||
; RUN: llvm-nm %t.lto.o | FileCheck %s
|
||||
; RUN: llvm-dis %t.lto.bc
|
||||
; RUN: ld.lld -shared -m elf_x86_64 %t.o %t2.o -save-temps
|
||||
; RUN: llvm-nm a.out | FileCheck %s
|
||||
; RUN: llvm-nm a.out.lto.bc | FileCheck %s
|
||||
; RUN: llvm-nm a.out.lto.o | FileCheck %s
|
||||
; RUN: llvm-dis a.out.lto.bc
|
||||
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
|
|
Loading…
Reference in New Issue