summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputFiles.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Use LoadedObjectInfoHelper to simplify/delegate the implementation of 'clone'David Blaikie2017-07-051-4/+1
| | | | llvm-svn: 307167
* Tweak to match change in LLVM API, in r306699Paul Robinson2017-06-291-3/+3
| | | | llvm-svn: 306700
* Implement the --exclude-libs option.Rui Ueyama2017-06-211-1/+2
| | | | | | | | | The --exclude-libs option is not a popular option, but at least some programs in Android depend on it, so it's worth to support it. Differential Revision: https://reviews.llvm.org/D34422 llvm-svn: 305920
* [ELF] Initial migration of AVR targetLeslie Zhai2017-06-151-0/+2
| | | | | | | | | | Reviewers: ruiu, rafael, grimar, atanasyan, psmith, dylanmckay Reviewed By: ruiu, rafael, grimar, dylanmckay Differential Revision: https://reviews.llvm.org/D32991 llvm-svn: 305444
* Allow the GNU gold-style nonstandard SHT_GROUP section.Rui Ueyama2017-06-121-9/+26
| | | | | | | | | | | | | | | | | | | | | The ELF standard defines that the SHT_GROUP section as follows: - its sh_link has the symbol index, and - the symbol name is used to uniquify section groups. Object files created by GNU gold does not seem to comply with the standard. They have this additional rule: - if the symbol has no name and a STT_SECTION symbol, a section name is used instead of a symbol name. If we don't do anything for this, the linker fails with a mysterious error message if input files are generated by gas. It is unfortunate but I think we need to support it. Differential Revision: https://reviews.llvm.org/D34064 llvm-svn: 305218
* Simplify. NFC.Rui Ueyama2017-06-091-13/+15
| | | | llvm-svn: 305047
* [ELF] - Do not allow -r to eat comdats.George Rimar2017-05-291-6/+16
| | | | | | | | | | | | | This is PR33052, "Bug 33052 - -r eats comdats ". To fix it I stop removing group section from out when -r is given and fixing SHT_GROUP content when writing it just like we do some other fixup, e.g. for Rel[a]. (it needs fix for section indices that are in group). Differential revision: https://reviews.llvm.org/D33485 llvm-svn: 304140
* Simplify. NFC.Rui Ueyama2017-05-261-4/+6
| | | | llvm-svn: 303959
* Revert "Simplify a variable type by using StringRef instead of ↵Rafael Espindola2017-05-251-9/+12
| | | | | | | | | | | CachedHashStringRef." This reverts commit r303787. It caused a slowdown in fast links. That is, links with no debug info or optimizations. llvm-svn: 303925
* Simplify a variable type by using StringRef instead of CachedHashStringRef.Rui Ueyama2017-05-241-12/+9
| | | | | | | | | | A variable `ComdatGroup` is not supposed to contain a large number of items. Even when linking clang, it ends up having only 300K strings. It doesn't make sense to use CachedHashStringRef for this hash table. This patch has neutral or slightly positive impact on performance while reducing code complexity. llvm-svn: 303787
* Reduce template usage. NFC.Rafael Espindola2017-05-111-3/+3
| | | | llvm-svn: 302832
* Remember OffsetInArchive in LazyObjectFile.Rafael Espindola2017-05-051-1/+1
| | | | | | | LazyObjectFile might turn out to be a BitcodeFile, so we need OffsetInArchive. llvm-svn: 302242
* Remember archive name when creating LazyObjectFile.Rafael Espindola2017-05-051-1/+1
| | | | | | | | It is needed for creating an unique identifier for ThinLTO. This fixes pr32931. llvm-svn: 302235
* Reduce code duplication. NFC.Rafael Espindola2017-05-041-0/+7
| | | | llvm-svn: 302155
* Accept archive files with no symbol table instad of warning on them.Rui Ueyama2017-05-031-9/+5
| | | | | | | | | | | | | It seems virtually everyone who tries to do LTO build with Clang and LLD was hit by a mistake to forget using llvm-ar command to create archive files. I wasn't an exception. Since this is an annoying common issue, it is probably better to handle that gracefully rather than reporting an error and tell the user to redo build with different configuration. Differential Revision: https://reviews.llvm.org/D32721 llvm-svn: 302083
* Fix typo.Rui Ueyama2017-05-021-1/+1
| | | | llvm-svn: 301975
* Update commetns.Rui Ueyama2017-05-021-3/+5
| | | | llvm-svn: 301896
* Add comments about how we handle mergeable sections with relocations.Rui Ueyama2017-05-011-6/+18
| | | | | | Also factored out code. llvm-svn: 301833
* [ELF] When a rel points to a SHF_MERGE section, don't merge the sec.Davide Italiano2017-04-291-3/+7
| | | | | | | Fixes PR32785. Thanks to Piotr Padlewski for the report and Rafael for the fix. llvm-svn: 301729
* Eliminate .debug_gnu_pub{names,types} if -gdb-index is given.Rui Ueyama2017-04-281-0/+9
| | | | | | | | | This patch is to ignore .debug_gnu_pub{names,types} sections if the -gdb-index option was given. Differential Revision: https://reviews.llvm.org/D32662 llvm-svn: 301710
* Use toString(Inputfile*) to format a file object.Rui Ueyama2017-04-281-2/+2
| | | | llvm-svn: 301674
* Simplify BinaryFile::parse and add comments.Rui Ueyama2017-04-271-19/+18
| | | | llvm-svn: 301514
* Remove needless type conversions.Rui Ueyama2017-04-271-4/+4
| | | | llvm-svn: 301513
* Remove unnecessary instantiation of StringRef.Rui Ueyama2017-04-261-1/+1
| | | | | | | SoName's type has changed from StringRef to std::string, so this code does not make sense anymore. llvm-svn: 301490
* Removes createELFFile which takes a template class as a template parameter.Rui Ueyama2017-04-261-56/+53
| | | | | | | | | This patch is to reduce amount of template uses. The new code is less exciting and boring than before, but I think it is easier to read. Differential Revision: https://reviews.llvm.org/D32467 llvm-svn: 301488
* Remove DefaultSoName.Rafael Espindola2017-04-241-16/+26
| | | | | | | | We can just use the existing SoName member variable. It now initially contains what was in DefaultSoName and is modified if the .so has an actual soname. llvm-svn: 301259
* Object, LTO: Add target triple to irsymtab and LTO API.Peter Collingbourne2017-04-141-27/+28
| | | | | | | | | | Start using it in LLD to avoid needing to read bitcode again just to get the target triple, and in llvm-lto2 to avoid printing symbol table information that is inappropriate for the target. Differential Revision: https://reviews.llvm.org/D32038 llvm-svn: 300300
* ELF: Remove some dead code.Peter Collingbourne2017-04-141-5/+0
| | | | llvm-svn: 300297
* Do not initialize this->SoName with this->DefaultSoName.Rui Ueyama2017-04-131-7/+9
| | | | | | | This patch uses DefaultSoName in getSoName instead of in parseSoName. I think this is more readable. This patch also add comments. llvm-svn: 300147
* [lld] Keep full library path in DT_NEEDED.Evgeniy Stepanov2017-04-121-1/+1
| | | | | | | | | | | | | | | | | Fixes PR32572. When (a) a library has no soname and (b) library is given on the command line with path (and not through -L/-l flags) DT_NEEDED entry for such library keeps the path as given. This behavior is consistent with gold and bfd, and is used in compiler-rt test suite. This is a second attempt after r300007 got reverted. This time relro-omagic test is changed in a way to avoid hardcoding the path to the test directory in the objdump'd binary. llvm-svn: 300011
* Revert "[lld] Keep full library path in DT_NEEDED."Evgeniy Stepanov2017-04-121-1/+1
| | | | | | This reverts commit r300007. Reason: breaks all the bots. llvm-svn: 300008
* [lld] Keep full library path in DT_NEEDED.Evgeniy Stepanov2017-04-111-1/+1
| | | | | | | | | | | | | Fixes PR32572. When (a) a library has no soname and (b) library is given on the command line with path (and not through -L/-l flags) DT_NEEDED entry for such library keeps the path as given. This behavior is consistent with gold and bfd, and is used in compiler-rt test suite. llvm-svn: 300007
* Remove InputFiles::LogName.Rui Ueyama2017-04-031-37/+43
| | | | | | | | | | LogName member was added to construct input file names for logging only once. This patch does this in a different way. Now toString caches its results. Differential Revision: https://reviews.llvm.org/D31546 llvm-svn: 299375
* Re-apply r299168 and r299169 now that the libdeps are fixed.Peter Collingbourne2017-03-311-5/+3
| | | | llvm-svn: 299184
* Revert r299168 and r299169 due to library dependency issues.Peter Collingbourne2017-03-311-3/+5
| | | | | | http://bb.pgr.jp/builders/i686-mingw32-RA-on-linux/builds/25073/steps/build_llvmclang/logs/stdio llvm-svn: 299171
* LTO: Reduce memory consumption by creating an in-memory symbol table for ↵Peter Collingbourne2017-03-311-5/+3
| | | | | | | | | | | | | | | | | | | | | | | InputFiles. NFCI. Introduce symbol table data structures that can be potentially written to disk, have the LTO library build those data structures using temporarily constructed modules and redirect the LTO library implementation to go through those data structures. This allows us to remove the LLVMContext and Modules owned by InputFile. With this change I measured a peak memory consumption decrease from 5.4GB to 2.8GB in a no-op incremental ThinLTO link of Chromium on Linux. The impact on memory consumption is larger in COFF linkers where we are currently forced to materialize all metadata in order to read linker options. Peak memory consumption linking a large piece of Chromium for Windows with full LTO and debug info decreases from >64GB (OOM) to 15GB. Part of PR27551. Differential Revision: https://reviews.llvm.org/D31364 llvm-svn: 299168
* Include filenames in error messages to report broken files.Rui Ueyama2017-03-301-45/+62
| | | | llvm-svn: 299115
* Change the error message format for undefined symbols.Rui Ueyama2017-03-301-5/+15
| | | | | | | | | | | | | | | | | | | | Previously, undefined symbol errors are one line like this and wasn't easy to read. /ssd/clang/bin/ld.lld: error: /ssd/llvm-project/lld/ELF/Writer.cpp:207: undefined symbol 'lld::elf::EhFrameSection<llvm::object::ELFType<(llvm::support::endianness)0, true> >::addSection(lld::elf::InputSectionBase*)' This patch make it more structured like this. bin/ld.lld: error: undefined symbol: lld::elf::EhFrameSection<llvm::object::ELFType<(llvm::support::endianness)0, true> >>> Referenced by Writer.cpp:207 (/ssd/llvm-project/lld/ELF/Writer.cpp:207) >>> Writer.cpp.o in archive lib/liblldELF.a Discussion thread: http://lists.llvm.org/pipermail/llvm-dev/2017-March/111459.html Differential Revision: https://reviews.llvm.org/D31481 llvm-svn: 299097
* LTO: Replace InputFile::Symbol::getFlags() with predicate accessors. NFC.Peter Collingbourne2017-03-281-5/+4
| | | | | | | This makes the predicates independent of the flag representation and makes the code a little easier to read. llvm-svn: 298951
* [ELF] - Fix one more access to Sections member.George Rimar2017-03-211-1/+1
| | | | | | That finally should linux BB after r298345. llvm-svn: 298349
* [ELF] Follow-up to r298345 "[ELF] - Detemplate GdbIndexSection."George Rimar2017-03-211-15/+17
| | | | | | | Fix for linux build bot: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/8144/steps/build/logs/stdio llvm-svn: 298348
* Move OffsetInArchive to BitcodeFile.Rafael Espindola2017-03-201-4/+4
| | | | | | It is the only file type that needs it. llvm-svn: 298323
* Compute Config member function return values only once.Rui Ueyama2017-03-171-2/+2
| | | | | | | | | | | We had a few Config member functions that returns configuration values. For example, we had is64() which returns true if the target is 64-bit. The return values of these functions are constant and never change. This patch is to compute them only once to make it clear that they'll never change. llvm-svn: 298168
* Define Config::isLE and Config::wordsize.Rui Ueyama2017-03-171-2/+1
| | | | | | | isLE() return true if the target is little-endian. wordsize() returns 8 for 64-bit and 4 for 32-bit. llvm-svn: 298167
* recommend using llvm-ar when finding undefined references and empty archivesBob Haarman2017-03-171-1/+5
| | | | | | | | | | | | | | | | | | | | | | Summary: When we perform LTO builds with a version of ar that does not understand LLVM bitcode objects, we end up with undefined references, because our archive files do not list the bitcode symbols in their indices. The error messages do not make it clear what the real problem is. This change adds a note that points out the likely problem and solution. It is similar in spirit to r282633, but aims to avoid false positives by only triggering when we see both undefined references and archives without symbols in their indices. Fixes PR32281. Reviewers: davide, ruiu, tejohnson Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31011 llvm-svn: 298124
* Rename one of the getOffset methods.Rafael Espindola2017-03-081-1/+1
| | | | | | | It is sufficiently different in that it returns an offset in the input file, not the output section. llvm-svn: 297290
* Remove redundant member of InputSectionBase. NFC.Rafael Espindola2017-03-081-1/+1
| | | | | | With this InputSectionBase is now 144 bytes. llvm-svn: 297278
* Detemplate EhInputSection. NFC.Rafael Espindola2017-03-061-1/+1
| | | | llvm-svn: 297077
* Detemplate merge (input and synthetic) sections. NFC.Rafael Espindola2017-03-061-2/+2
| | | | llvm-svn: 297061
* Use make<> instead of new (BAlloc). NFC.Rui Ueyama2017-02-281-4/+3
| | | | | | We converted them before, but there were a few remaining occurrences. llvm-svn: 296510
OpenPOWER on IntegriCloud