summaryrefslogtreecommitdiffstats
path: root/lld/Common/ErrorHandler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Support] ThreadPoolExecutor fixes for Windows/MinGWAndrew Ng2020-01-101-3/+4
| | | | | | | | | | | | | | | | | | | | | Changed ThreadPoolExecutor to no longer use detached threads and instead to join threads on destruction. This is to prevent intermittent crashing on Windows when doing a normal full exit, e.g. via exit(). Changed ThreadPoolExecutor to be a ManagedStatic so that it can be stopped on llvm_shutdown(). Without this, it would only be stopped in the destructor when doing a full exit. This is required to avoid intermittent crashing on Windows due to a race condition between the ThreadPoolExecutor starting up threads and the process doing a fast exit, e.g. via _exit(). The Windows crashes appear to only occur with the MSVC static runtimes and are more frequent with the debug static runtime. These changes also prevent intermittent deadlocks on exit with the MinGW runtime. Differential Revision: https://reviews.llvm.org/D70447
* LLD: Don't use the stderrOS stream in link before it's reassigned.James Y Knight2019-11-211-2/+0
| | | | | | | | | | | | | | | | Remove the lld::enableColors function, as it just obscures which stream it's affecting, and replace with explicit calls to the stream's enable_colors. Also, assign the stderrOS and stdoutOS globals first in link function, just to ensure nothing might use them. (Either change individually fixes the issue of using the old stream, but both together seems best.) Follow-up to b11386f9be9b2dc7276a758d64f66833da10bdea. Differential Revision: https://reviews.llvm.org/D70492
* Make it possible to redirect not only errs() but also outs()Rui Ueyama2019-11-181-15/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change is for those who use lld as a library. Context: https://reviews.llvm.org/D70287 This patch adds a new parmeter to lld::*::link() so that we can pass an raw_ostream object representing stdout. Previously, lld::*::link() took only an stderr object. Justification for making stdoutOS and stderrOS mandatory: I wanted to make link() functions to take stdout and stderr in that order. However, if we change the function signature from bool link(ArrayRef<const char *> args, bool canExitEarly, raw_ostream &stderrOS = llvm::errs()); to bool link(ArrayRef<const char *> args, bool canExitEarly, raw_ostream &stdoutOS = llvm::outs(), raw_ostream &stderrOS = llvm::errs()); , then the meaning of existing code that passes stderrOS silently changes (stderrOS would be interpreted as stdoutOS). So, I chose to make existing code not to compile, so that developers can fix their code. Differential Revision: https://reviews.llvm.org/D70292
* [ELF] For VS-style diagnostics, prefer printing full paths in the header.Igor Kudrin2019-08-091-2/+9
| | | | | | | | | | | | The filename part in the message header is used by Visual Studio to fill Error List so that a user can click on an item and jump to the mentioned location. If we use only the name of a source file and not the full path, Visual Studio might be unable to find the right file or, even worse, show a wrong one. Differential Revision: https://reviews.llvm.org/D65875 llvm-svn: 368409
* [ELF] Fix splitting messages for duplicate symbols.Igor Kudrin2019-08-071-2/+2
| | | | | | | | | D65213 (rL367536) does not work for the case when a source file path includes subdirectories. Differential Revision: https://reviews.llvm.org/D65810 llvm-svn: 368153
* Simplify error message output. NFC.Rui Ueyama2019-08-071-16/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D65855 llvm-svn: 368144
* Re-submit r367649: Improve raw_ostream so that you can "write" colors using ↵Rui Ueyama2019-08-071-60/+46
| | | | | | | | | operator<< The original patch broke buildbots, perhaps because it changed the default setting whether colors are enabled or not. llvm-svn: 368131
* Revert r367649: Improve raw_ostream so that you can "write" colors using ↵Rui Ueyama2019-08-021-42/+59
| | | | | | | | operator<< This reverts commit r367649 in an attempt to unbreak Windows bots. llvm-svn: 367658
* Add an assert() to catch possible regexp errors.Rui Ueyama2019-08-021-5/+6
| | | | llvm-svn: 367651
* Add a comment for --vs-diagnostics.Rui Ueyama2019-08-021-0/+21
| | | | llvm-svn: 367650
* Improve raw_ostream so that you can "write" colors using operator<<Rui Ueyama2019-08-021-59/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. raw_ostream supports ANSI colors so that you can write messages to the termina with colors. Previously, in order to change and reset color, you had to call `changeColor` and `resetColor` functions, respectively. So, if you print out "error: " in red, for example, you had to do something like this: OS.changeColor(raw_ostream::RED); OS << "error: "; OS.resetColor(); With this patch, you can write the same code as follows: OS << raw_ostream::RED << "error: " << raw_ostream::RESET; 2. Add a boolean flag to raw_ostream so that you can disable colored output. If you disable colors, changeColor, operator<<(Color), resetColor and other color-related functions have no effect. Most LLVM tools automatically prints out messages using colors, and you can disable it by passing a flag such as `--disable-colors`. This new flag makes it easy to write code that works that way. Differential Revision: https://reviews.llvm.org/D65564 llvm-svn: 367649
* [ELF] With --vs-diagnostics, print a separate message for each location of a ↵Igor Kudrin2019-08-011-3/+24
| | | | | | | | | | | | | duplicate symbol. We extract and print the source location in the message header so that Visual Studio is able to parse it and jump there. As duplicate symbols are defined in several locations, it is more convenient to have separate error messages, which allows a user to easily access all the locations. Differential Revision: https://reviews.llvm.org/D65213 llvm-svn: 367536
* [ELF] Fix finding locations in messages for undefined hidden symbols.Igor Kudrin2019-08-011-3/+1
| | | | | | | | | | | | Previously, when `--vs-diagnostics` was used, the linker printed something like hidden(undef.s): error: undefined hidden symbol: foo >>> referenced by undef.s:15 Differential Revision: https://reviews.llvm.org/D65499 llvm-svn: 367515
* [LLD] Do not print additional newlines after reaching error limitAlexander Richardson2019-07-241-1/+2
| | | | | | | | | | | | | | | | | | | | Summary: This could previously happen if errors that are emitted after reaching the error limit. In that case, the flag inside the newline() function will be set to true which causes the next call to print a newline even though the actual message will be discarded. Reviewers: ruiu, grimar, MaskRay, espindola Reviewed By: ruiu Subscribers: emaste, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65198 llvm-svn: 366944
* [lld] Add Visual Studio compatible diagnosticsChris Jackson2019-07-171-5/+40
| | | | | | | | | | | | Summary: Add a --vs-diagnostics flag that alters the format of diagnostic output to enable source hyperlinks in Visual Studio. Differential Revision: https://reviews.llvm.org/D58484 Reviewed by: ruiu llvm-svn: 366333
* [Coding style change][lld] Rename variables for non-ELF portsRui Ueyama2019-07-111-55/+55
| | | | | | | | | | | This patch does the same thing as r365595 to other subdirectories, which completes the naming style change for the entire lld directory. With this, the naming style conversion is complete for lld. Differential Revision: https://reviews.llvm.org/D64473 llvm-svn: 365730
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [Common] Discard the temp file while keeping the memory mapping open, on errorsMartin Storsjo2018-08-241-2/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D51095 llvm-svn: 340635
* [LTO] Errors in LLVM backend should manifest as lld errorsSam Clegg2018-07-021-1/+12
| | | | | | Differential Revision: https://reviews.llvm.org/D48812 llvm-svn: 336143
* Code cleanup in preparation for adding LTO for wasm. NFC.Sam Clegg2018-05-221-1/+15
| | | | | | | | | | | | | | - Move some common code into Common/rrorHandler.cpp and Common/Strings.h. - Don't use `fatal` when incompatible bitcode files are encountered. - Rename NameRef variable to just Name See D47162 Differential Revision: https://reviews.llvm.org/D47206 llvm-svn: 333021
* Use ErrorOS for log messages as well as errorSam Clegg2017-12-111-2/+1
| | | | | | | | | | | | | | | | log are also diagnostics so it seems like they should to the same place as errors and debug messages. Without this change when I enable --verbose those messages go to stdout, but when I enable "-mllvm -debug" those messages go to stderr (because dbgs() goes to stderr by default). So I end up having to do this a lot: lld <args> > output_message 2>&1 Differential Revision: https://reviews.llvm.org/D41033 llvm-svn: 320427
* Try harder to delete the temporary file.Rafael Espindola2017-11-131-0/+3
| | | | | | | | | | | | | | | | | It is really hard to cover restarts in a debugger, SIGKILL or power failures. I will try to handle them in a followup patch, but it will not support all the systems lld has to run on. RemoveFileOnSignal takes care of crashes. So what is left is making sure all regular exits delete the file. This patch does that by moving the buffer to error handling. That is a bit of a hack, but seemed better than to generalize it to take a callback on construction. I will implement this on COFF on the next patch. llvm-svn: 318060
* Delete dead code.Rafael Espindola2017-11-071-1/+0
| | | | llvm-svn: 317633
* Instead of enclosing an entire file, add lld:: specifier for public functions.Rui Ueyama2017-10-271-7/+2
| | | | llvm-svn: 316776
* [lld] unified COFF and ELF error handling on new Common/ErrorHandlerBob Haarman2017-10-251-0/+122
Summary: The COFF linker and the ELF linker have long had similar but separate Error.h and Error.cpp files to implement error handling. This change introduces new error handling code in Common/ErrorHandler.h, changes the COFF and ELF linkers to use it, and removes the old, separate implementations. Reviewers: ruiu Reviewed By: ruiu Subscribers: smeenai, jyknight, emaste, sdardis, nemanjai, nhaehnle, mgorny, javed.absar, kbarton, fedor.sergeev, llvm-commits Differential Revision: https://reviews.llvm.org/D39259 llvm-svn: 316624
OpenPOWER on IntegriCloud