summaryrefslogtreecommitdiff
path: root/lld/include
AgeCommit message (Collapse)Author
2018-06-12[Darwin] Use errorHandler from liblldCommonBrian Gesiak
Summary: Error handling in liblldCore and the Darwin toolchain prints to an output stream. A TODO in the project explained that a diagnostics interface resembling Clang's should be added. For now, the simple diagnostics interface defined in liblldCommon seems like an improvement. It prints colors when they're available, uses locks for thread-safety, and abstracts away the `"error: "` and newline literal strings that litter the Darwin toolchain code. To use the liblldCommon error handler, a link dependency is added to the liblldDriver library. Test Plan: 1. check-lld 2. Invoke `ld64.lld -r` in a terminal that supports color output. Confirm that "ld64.lld: error: -arch not specified and could not be inferred" is output, and that the "error:" is colored red! Reviewers: ruiu, smeenai Reviewed By: ruiu Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D47998
2018-06-07Expand the file comment for the error handlers.Rui Ueyama
Differential Revision: https://reviews.llvm.org/D47790
2018-05-22Code cleanup in preparation for adding LTO for wasm. NFC.Sam Clegg
- 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
2018-05-15Remove \brief commands from doxygen comments.Fangrui Song
Summary: This is similar to D46290 D46320. Reviewers: ruiu, grimar Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D46861
2018-04-28Migrate from std::pointer_to_unary_function as it is removed in C++17Fangrui Song
2018-04-25Remove unused features from StringRefZ and move it to Symbols.h.Rui Ueyama
Differential Revision: https://reviews.llvm.org/D46087
2018-04-25Pack symbols a bit more.Rafael Espindola
Before this patch: Symbol 56 Defined 80 Undefined 56 SharedSymbol 88 LazyArchive 72 LazyObject 56 With this patch Symbol 48 Defined 72 Undefined 48 SharedSymbol 80 LazyArchive 64 LazyObject 48 The result is that peak allocation when linking chromium (according to heaptrack) goes from 578 to 568 MB.
2018-02-28Merge {COFF,ELF}/Strings.cpp to Common/Strings.cpp.Rui Ueyama
This should resolve the issue that lld build fails in some hosts that uses case-insensitive file system. Differential Revision: https://reviews.llvm.org/D43788
2018-02-26Re-land: "[Support] Replace HashString with djbHash."Jonas Devlieghere
This patch removes the HashString function from StringExtraces and replaces its uses with calls to djbHash from DJB.h. This change is *almost* NFC. While the algorithm is identical, the djbHash implementation in StringExtras used 0 as its default seed while the implementation in DJB uses 5381. The latter has been shown to result in less collisions and improved avalanching and is used by the DWARF accelerator tables. Because some test were implicitly relying on the hash order, I've reverted to using zero as a seed for the following two files: lld/include/lld/Core/SymbolTable.h llvm/lib/Support/StringMap.cpp Differential revision: https://reviews.llvm.org/D43615
2018-02-26Revert "[Support] Replace HashString with djbHash."Jonas Devlieghere
It looks like some of our tests depend on the ordering of hashed values. I'm reverting my changes while I try to reproduce and fix this locally. Failing builds: lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/18388 lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/6743 lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/15607
2018-02-26[Support] Replace HashString with djbHash.Jonas Devlieghere
This removes the HashString function from StringExtraces and replaces its uses with calls to djbHash from DJB.h This is *almost* NFC. While the algorithm is identical, the djbHash implementation in StringExtras used 0 as its seed while the implementation in DJB uses 5381. The latter has been shown to result in less collisions and improved avalanching. https://reviews.llvm.org/D43615 (cherry picked from commit 77f7f965bc9499a9ae768a296ca5a1f7347d1d2c)
2018-01-30Pass CPU string to LTO pipeline.Rafael Espindola
Previously an empty CPU string was passed to the LTO engine which resulted in a generic CPU for which certain features like NOPL were disabled. This fixes that. Patch by Pratik Bhatu!
2018-01-17[coff] Print detailed timing information with /TIME.Zachary Turner
The classes used to print and update time information are in common, so other linkers could use this as well if desired. Differential Revision: https://reviews.llvm.org/D41915
2017-12-08Prefer `ArrayRef` over `const std::vector&`Sam Clegg
Differential Revision: https://reviews.llvm.org/D40993
2017-12-07Remove checkToString functions and use toString instead.Rui Ueyama
Differential Revision: https://reviews.llvm.org/D40928
2017-12-06Always evaluate the second argument for CHECK() lazily.Rui Ueyama
This patch is to rename check CHECK and make it a C macro, so that we can evaluate the second argument lazily. Differential Revision: https://reviews.llvm.org/D40915
2017-12-06Add a checkLazy error checking variant.Rafael Espindola
This avoids allocating the error message when there is no error that check requires. It avoids the code duplication of inlining check.
2017-12-05toString function take a const refs where possibleSam Clegg
Differential Revision: https://reviews.llvm.org/D40824
2017-11-28Move Memory.{h,cpp} to Common.Rui Ueyama
Differential Revision: https://reviews.llvm.org/D40571
2017-11-28Factor out more code to Common/Args.cpp.Rui Ueyama
Differential Revision: https://reviews.llvm.org/D40540
2017-11-28Factor out common code to Common/Strings.cpp.Rui Ueyama
Differential Revision: https://reviews.llvm.org/D40530
2017-11-21Make some headers modular by adding missing includes/forward decls.David Blaikie
2017-11-17[WebAssembly] Initial wasm linker implementationSam Clegg
This linker backend is still a work in progress but is enough to link simple programs including linking against library archives. Differential Revision: https://reviews.llvm.org/D34851
2017-11-13Try harder to delete the temporary file.Rafael Espindola
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.
2017-11-07Delete dead code.Rafael Espindola
2017-10-25[lld] unified COFF and ELF error handling on new Common/ErrorHandlerBob Haarman
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
2017-10-23lld::COFF: better behavior when using as a libraryRui Ueyama
Previously, the COFF driver would call exit(0) when called as a library. Now it takes `ExitEarly` option, and if it is false, it doesn't exit. So it is now more library-friendly. Furthermore, link() calls freeArena() before returning, to clean up resources. Based on an Andrew Kelley's patch. Differential Revision: https://reviews.llvm.org/D39202
2017-10-19[COFF] Avoid forward declaring StringSet, fix buildMartin Storsjo
This should fix the build after SVN r316178, which worked fine on GCC 5.4, but failed on clang with errors like these: MinGW.h:26:3: error: too few template arguments for class template 'StringSet' StringSet<> ExcludeSymbols; ^ lld/Common/LLVM.h:28:30: note: template is declared here template<typename T> class StringSet; Don't forward declare and add the using directive in the main lld/Common/LLVM.h header, but just qualify the class name in MinGW.h instead.
2017-10-19[COFF] Move MinGW specific functions/classes to a separate file. NFC.Martin Storsjo
Differential Revision: https://reviews.llvm.org/D39067
2017-10-13[lld] Move Threads to CommonBob Haarman
Summary: This will allow using the functionality from other linkers. It is also a prerequisite for sharing the error logging code. Reviewers: ruiu Reviewed By: ruiu Subscribers: emaste, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D38822
2017-10-02Move new lld's code to Common subdirectory.Rui Ueyama
New lld's files are spread under lib subdirectory, and it isn't easy to find which files are actually maintained. This patch moves maintained files to Common subdirectory. Differential Revision: https://reviews.llvm.org/D37645
2017-09-11LLD: Introduce a GNU LD style driver for COFFMartell Malone
When building COFF programs many targets such as mingw prefer to have a gnu ld frontend. Rather then having a fully fledged standalone driver we wrap a shim around the LINK driver. Extra tests were provided by mstorsjo Reviewers: mstorsjo, ruiu Differential Revision: https://reviews.llvm.org/D33880
2017-08-03Update for llvm change.Rafael Espindola
2017-06-07Move Object format code to lib/BinaryFormat.Zachary Turner
This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843
2017-05-11[Support] Move Parallel algorithms from LLD to LLVM.Zachary Turner
Differential Revision: https://reviews.llvm.org/D33024
2017-05-10Rename variables to conform to LLVM naming conventions.Zachary Turner
2017-05-10Fix -DLLVM_ENABLE_THREADS=OFF build of lld after r302613Hans Wennborg
2017-05-10[Core] Make parallel algorithms match C++ Parallelism TS.Zachary Turner
Differential Revision: https://reviews.llvm.org/D33016
2017-05-05Remove dead file.Rui Ueyama
2017-05-05Fix another incorrectly cased header include.Zachary Turner
2017-05-05Split up Parallel and LLVM'ize naming conventions.Zachary Turner
This is one step in preparation of raising this up to LLVM. This hides all of the Executor stuff in a private implementation file, leaving only the core algorithms and the TaskGroup class exposed. In doing so, fix up all the variable names to conform to LLVM style. Differential Revision: https://reviews.llvm.org/D32890
2017-04-07[Core] Fix parallel_for for LinuxJames Henderson
r299635 exposed a latent bug in the Linux implementation of parallel_for, which resulted in it calling the function outside of the range requested, resulting later in a segmentation fault. This change fixes this issue and adds a unit test.
2017-02-28[ELF] - Allow the Code Model flag when using LTOMartell Malone
Differential Revision: https://reviews.llvm.org/D29445
2017-02-02added missing files for r293965Bob Haarman
2017-01-17COFF: add error() and warn() to Error.{cpp,h}Bob Haarman
Summary: This copies over some functionality we have in ELF/Error.{cpp,h} and makes it available in COFF/Error.{cpp,h} Reviewers: pcc, rafael, ruiu Subscribers: Differential Revision: https://reviews.llvm.org/D28692
2017-01-09Define sys::path::convert_to_slashRui Ueyama
This patch moves convertToUnixPathSeparator from LLD to LLVM. Differential Revision: https://reviews.llvm.org/D28444
2017-01-06Revert r291221.Rafael Espindola
Should bring back the windows bots.
2017-01-06Rename lld::stringize -> lld::toString.Rui Ueyama
2017-01-06Remove lld::convertToUnixPathSeparator.Rui Ueyama
Now TarWriter takes care of path separator conversion, so we don't need to handle that in LLD.
2017-01-06Use TarWriter to create tar archives instead of cpio.Rui Ueyama
This is how we use TarWriter in LLD. Now LLD does not append a file extension, so you need to pass `--reproduce foo.tar` instead of `--reproduce foo`. Differential Revision: https://reviews.llvm.org/D28103