summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Driver.cpp
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2016-04-03 02:16:56 +0000
committerDavide Italiano <davide@freebsd.org>2016-04-03 02:16:56 +0000
commit887d76c392998d3948d3157aa902c565b0e389f8 (patch)
tree6750cda40b19355d262e97cad051f0f01108c1c1 /lld/ELF/Driver.cpp
parentd4f5a059e06c9dba9c5fb63c60cb044b673f5c17 (diff)
downloadbcm5719-llvm-887d76c392998d3948d3157aa902c565b0e389f8.tar.gz
bcm5719-llvm-887d76c392998d3948d3157aa902c565b0e389f8.zip
[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
Diffstat (limited to 'lld/ELF/Driver.cpp')
-rw-r--r--lld/ELF/Driver.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 0a5123c2daf..e828700a97e 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -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)
OpenPOWER on IntegriCloud