diff options
Diffstat (limited to 'lld/lib/Driver/DarwinLdDriver.cpp')
| -rw-r--r-- | lld/lib/Driver/DarwinLdDriver.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/lld/lib/Driver/DarwinLdDriver.cpp b/lld/lib/Driver/DarwinLdDriver.cpp index 8566ababc655..062e945bbd83 100644 --- a/lld/lib/Driver/DarwinLdDriver.cpp +++ b/lld/lib/Driver/DarwinLdDriver.cpp @@ -232,7 +232,7 @@ static std::error_code parseOrderFile(StringRef orderFilePath, sym = prefixAndSym.first; if (!sym.empty()) { ctx.appendOrderedSymbol(sym, prefix); - //llvm::errs() << sym << ", prefix=" << prefix << "\n"; + // llvm::errs() << sym << ", prefix=" << prefix << "\n"; } } return std::error_code(); @@ -788,7 +788,7 @@ bool parse(llvm::ArrayRef<const char *> args, MachOLinkingContext &ctx) { break; case llvm::MachO::MH_EXECUTE: // dynamic executables default to generating a version load command, - // while static exectuables only generate it if required. + // while static executables only generate it if required. if (isStaticExecutable) { if (flagOn) ctx.setGenerateVersionLoadCommand(true); @@ -836,7 +836,7 @@ bool parse(llvm::ArrayRef<const char *> args, MachOLinkingContext &ctx) { break; case llvm::MachO::MH_EXECUTE: // dynamic executables default to generating a version load command, - // while static exectuables only generate it if required. + // while static executables only generate it if required. if (isStaticExecutable) { if (flagOn) ctx.setGenerateFunctionStartsLoadCommand(true); @@ -885,7 +885,7 @@ bool parse(llvm::ArrayRef<const char *> args, MachOLinkingContext &ctx) { break; case llvm::MachO::MH_EXECUTE: // dynamic executables default to generating a version load command, - // while static exectuables only generate it if required. + // while static executables only generate it if required. if (isStaticExecutable) { if (flagOn) ctx.setGenerateDataInCodeLoadCommand(true); @@ -926,7 +926,7 @@ bool parse(llvm::ArrayRef<const char *> args, MachOLinkingContext &ctx) { ctx.setSdkVersion(sdkVersion); } else if (ctx.generateVersionLoadCommand()) { // If we don't have an sdk version, but were going to emit a load command - // with min_version, then we need to give an warning as we have no sdk + // with min_version, then we need to give a warning as we have no sdk // version to put in that command. // FIXME: We need to decide whether to make this an error. warn("-sdk_version is required when emitting min version load command. " @@ -1144,14 +1144,16 @@ static void createFiles(MachOLinkingContext &ctx, bool Implicit) { /// This is where the link is actually performed. bool link(llvm::ArrayRef<const char *> args, bool CanExitEarly, - raw_ostream &Error) { + raw_ostream &StdoutOS, raw_ostream &StderrOS) { + lld::stdoutOS = &StdoutOS; + lld::stderrOS = &StderrOS; + errorHandler().logName = args::getFilenameWithoutExe(args[0]); errorHandler().errorLimitExceededMsg = "too many errors emitted, stopping now (use " "'-error-limit 0' to see all errors)"; - errorHandler().errorOS = &Error; errorHandler().exitEarly = CanExitEarly; - enableColors(Error.has_colors()); + StderrOS.enable_colors(StderrOS.has_colors()); MachOLinkingContext ctx; if (!parse(args, ctx)) @@ -1196,10 +1198,9 @@ bool link(llvm::ArrayRef<const char *> args, bool CanExitEarly, if (auto ec = pm.runOnFile(*merged)) { // FIXME: This should be passed to logAllUnhandledErrors but it needs // to be passed a Twine instead of a string. - *errorHandler().errorOS << "Failed to run passes on file '" - << ctx.outputPath() << "': "; - logAllUnhandledErrors(std::move(ec), *errorHandler().errorOS, - std::string()); + lld::errs() << "Failed to run passes on file '" << ctx.outputPath() + << "': "; + logAllUnhandledErrors(std::move(ec), lld::errs(), std::string()); return false; } @@ -1210,10 +1211,8 @@ bool link(llvm::ArrayRef<const char *> args, bool CanExitEarly, if (auto ec = ctx.writeFile(*merged)) { // FIXME: This should be passed to logAllUnhandledErrors but it needs // to be passed a Twine instead of a string. - *errorHandler().errorOS << "Failed to write file '" << ctx.outputPath() - << "': "; - logAllUnhandledErrors(std::move(ec), *errorHandler().errorOS, - std::string()); + lld::errs() << "Failed to write file '" << ctx.outputPath() << "': "; + logAllUnhandledErrors(std::move(ec), lld::errs(), std::string()); return false; } |
