diff options
Diffstat (limited to 'ELF/DriverUtils.cpp')
-rw-r--r-- | ELF/DriverUtils.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/ELF/DriverUtils.cpp b/ELF/DriverUtils.cpp index 3a20cd76efe27..f4eadeee9e435 100644 --- a/ELF/DriverUtils.cpp +++ b/ELF/DriverUtils.cpp @@ -16,7 +16,6 @@ #include "Driver.h" #include "Error.h" #include "Memory.h" -#include "ScriptParser.h" #include "lld/Config/Version.h" #include "lld/Core/Reproduce.h" #include "llvm/ADT/Optional.h" @@ -54,12 +53,10 @@ ELFOptTable::ELFOptTable() : OptTable(OptInfo) {} // Parse -color-diagnostics={auto,always,never} or -no-color-diagnostics. static bool getColorDiagnostics(opt::InputArgList &Args) { - bool Default = (ErrorOS == &errs() && Process::StandardErrHasColors()); - auto *Arg = Args.getLastArg(OPT_color_diagnostics, OPT_color_diagnostics_eq, OPT_no_color_diagnostics); if (!Arg) - return Default; + return ErrorOS->has_colors(); if (Arg->getOption().getID() == OPT_color_diagnostics) return true; if (Arg->getOption().getID() == OPT_no_color_diagnostics) @@ -67,7 +64,7 @@ static bool getColorDiagnostics(opt::InputArgList &Args) { StringRef S = Arg->getValue(); if (S == "auto") - return Default; + return ErrorOS->has_colors(); if (S == "always") return true; if (S != "never") @@ -120,6 +117,20 @@ opt::InputArgList ELFOptTable::parse(ArrayRef<const char *> Argv) { void elf::printHelp(const char *Argv0) { ELFOptTable Table; Table.PrintHelp(outs(), Argv0, "lld", false); + outs() << "\n"; + + // Scripts generated by Libtool versions up to at least 2.4.6 (the most + // recent version as of March 2017) expect /: supported targets:.* elf/ + // in a message for the -help option. If it doesn't match, the scripts + // assume that the linker doesn't support very basic features such as + // shared libraries. Therefore, we need to print out at least "elf". + // Here, we print out all the targets that we support. + outs() << Argv0 << ": supported targets: " + << "elf32-i386 elf32-iamcu elf32-littlearm elf32-ntradbigmips " + << "elf32-ntradlittlemips elf32-powerpc elf32-tradbigmips " + << "elf32-tradlittlemips elf32-x86-64 " + << "elf64-amdgpu elf64-littleaarch64 elf64-powerpc elf64-tradbigmips " + << "elf64-tradlittlemips elf64-x86-64\n"; } // Reconstructs command line arguments so that so that you can re-run @@ -136,6 +147,13 @@ std::string elf::createResponseFile(const opt::InputArgList &Args) { case OPT_INPUT: OS << quote(rewritePath(Arg->getValue())) << "\n"; break; + case OPT_o: + // If -o path contains directories, "lld @response.txt" will likely + // fail because the archive we are creating doesn't contain empty + // directories for the output path (-o doesn't create directories). + // Strip directories to prevent the issue. + OS << "-o " << quote(sys::path::filename(Arg->getValue())) << "\n"; + break; case OPT_L: case OPT_dynamic_list: case OPT_rpath: |