summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputFiles.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove DefaultSoName.Rafael Espindola2017-04-241-8/+4
| | | | | | | | 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-7/+2
| | | | | | | | | | 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-3/+0
| | | | llvm-svn: 300297
* Do not initialize this->SoName with this->DefaultSoName.Rui Ueyama2017-04-131-1/+1
| | | | | | | 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-0/+4
| | | | | | | | | | | | | | | | | 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-4/+0
| | | | | | This reverts commit r300007. Reason: breaks all the bots. llvm-svn: 300008
* [lld] Keep full library path in DT_NEEDED.Evgeniy Stepanov2017-04-111-0/+4
| | | | | | | | | | | | | 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-4/+3
| | | | | | | | | | 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
* Include filenames in error messages to report broken files.Rui Ueyama2017-03-301-2/+5
| | | | llvm-svn: 299115
* Change the error message format for undefined symbols.Rui Ueyama2017-03-301-0/+2
| | | | | | | | | | | | | | | | | | | | 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
* Update comment.Rui Ueyama2017-03-211-2/+2
| | | | llvm-svn: 298403
* [ELF] Follow-up to r298345 "[ELF] - Detemplate GdbIndexSection."George Rimar2017-03-211-1/+0
| | | | | | | 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
* [ELF] - Detemplate GdbIndexSection.George Rimar2017-03-211-7/+9
| | | | | | | | | | | Patch moves Sections array to InputFile (root class for input files). That allows to detemplate GdbIndexSection. Differential revision: https://reviews.llvm.org/D30976 llvm-svn: 298345
* Move OffsetInArchive to BitcodeFile.Rafael Espindola2017-03-201-7/+7
| | | | | | It is the only file type that needs it. llvm-svn: 298323
* Compute Config member function return values only once.Rui Ueyama2017-03-171-1/+1
| | | | | | | | | | | 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
* Remove Config->Mips64EL and define Config->isMips64EL() instead.Rui Ueyama2017-03-071-1/+1
| | | | llvm-svn: 297107
* Use uint64_t instead of uintX_t where the larger type just works.Rui Ueyama2017-02-241-3/+1
| | | | llvm-svn: 296162
* Merge InputSectionData and InputSectionBase.Rafael Espindola2017-02-231-2/+2
| | | | | | | Now that InputSectionBase is not a template there is no reason to have the two. llvm-svn: 295924
* Convert InputSectionBase to a class.Rafael Espindola2017-02-231-7/+7
| | | | | | | Removing this template is not a big win by itself, but opens the way for removing more templates. llvm-svn: 295923
* [ELF] - Stop handling local symbols in a special way.George Rimar2017-01-231-4/+0
| | | | | | | | | | | | | | | | | | | | Previously we stored kept locals in a KeptLocalSyms arrays, belonged to files. Patch makes SymbolTableSection to store locals in Symbols member, that already present and was used for globals. SymbolTableSection already had NumLocals counter member, so change itself is trivial. That allows to simplify handling of -r, Body::DynsymIndex is no more used as "symbol table index" for relocatable output. Change was suggested during review of D28773 and opens road for D28612. Differential revision: https://reviews.llvm.org/D29021 llvm-svn: 292789
* Add linker-script-included files to reproduce tar files.Rui Ueyama2017-01-091-0/+8
| | | | | | | | Previously, files added using INCLUDE directive weren't added to reproduce archives. In this patch, I defined a function to open a file and use that from Driver and LinkerScript. llvm-svn: 291413
* Merge elf::toString and coff::toString.Rui Ueyama2017-01-061-4/+7
| | | | | | The two overloaded functions hid each other. This patch merges them. llvm-svn: 291222
* Move typedefs inside a class definition.Rui Ueyama2016-11-251-2/+4
| | | | llvm-svn: 287945
* Define toString() as a generic function to get a string for error message.Rui Ueyama2016-11-231-2/+2
| | | | | | | | | | | | | | | We have different functions to stringize objects to construct error messages. For InputFile, we have getFilename, and for InputSection, we have getName. You had to memorize them. I think this is the case where the function overloading comes in handy. This patch defines toString() functions that are overloaded for all these types, so that you just call it in error(). Differential Revision: https://reviews.llvm.org/D27030 llvm-svn: 287787
* Parse relocations only once.Rafael Espindola2016-11-101-0/+2
| | | | | | | | | | | | | | | | Relocations are the last thing that we wore storing a raw section pointer to and parsing on demand. With this patch we parse it only once and store a pointer to the actual data. The patch also changes where we store it. It is now in InputSectionBase. Not all sections have relocations, but most do and this simplifies the logic. It also means that we now only support one relocation section per section. Given that that constraint is maintained even with -r with gold bfd and lld, I think it is OK. llvm-svn: 286459
* [ELF][MIPS] Convert .MIPS.abiflags section to synthetic input sectionSimon Atanasyan2016-11-091-3/+0
| | | | | | | | | | | | | | Previously, we have both input and output section for .MIPS.abiflags. Now we have only one class for .MIPS.abiflags, which is MipsAbiFlagsSection. This class is a synthetic input section. .MIPS.abiflags sections are handled as regular sections until the control reaches Writer. Writer then aggregates all sections whose type is SHT_MIPS_ABIFLAGS to create a single synthesized input section. The synthesized section is then processed normally as if it came from an input file. llvm-svn: 286398
* [ELF][MIPS] Convert .reginfo and .MIPS.options sections to synthetic input ↵Simon Atanasyan2016-11-091-6/+2
| | | | | | | | | | | | | | | | | | | sections Previously, we have both input and output sections for .reginfo and .MIPS.options. Now for each such sections we have one synthetic input sections: MipsReginfoSection and MipsOptionsSection respectively. Both sections are handled as regular sections until the control reaches Writer. Writer then aggregates all sections whose type is SHT_MIPS_REGINFO or SHT_MIPS_OPTIONS to create a single synthesized input section. In that moment Writer also save GP0 value to the MipsGp0 field of the corresponding ObjectFile. This value required for R_MIPS_GPREL16 and R_MIPS_GPREL32 relocations calculation. Differential revision: https://reviews.llvm.org/D26444 llvm-svn: 286397
* Remove dead arguments. NFC.Rafael Espindola2016-11-081-3/+2
| | | | llvm-svn: 286242
* Simplify now that this is only used for global symbols.Rafael Espindola2016-11-031-1/+1
| | | | llvm-svn: 285966
* Now that the ELFFile constructor does nothing, create it when needed.Rafael Espindola2016-11-031-3/+3
| | | | | | This avoids duplicating the buffer in InputFile. llvm-svn: 285965
* Change how we store the symbol table.Rafael Espindola2016-11-031-1/+2
| | | | | | | | | Instead of remembering a raw Elf_Shdr, store the symbol table proper and the index of the first non local. This moves error handling upfront and simplifies it. llvm-svn: 285933
* Initialize the StringTable early and do it only once.Rafael Espindola2016-11-031-1/+1
| | | | llvm-svn: 285926
* Delete dead code.Rafael Espindola2016-11-031-2/+0
| | | | llvm-svn: 285922
* Pass the section table around instead of recomputing it.Rafael Espindola2016-11-031-3/+4
| | | | llvm-svn: 285904
* [ELF] - Removed unused method declaration. NFC.George Rimar2016-11-031-1/+0
| | | | llvm-svn: 285884
* Pass the sections to getShtGroupSignature.Rafael Espindola2016-11-031-1/+2
| | | | | | This avoids fetching it again from the object. llvm-svn: 285875
* Reduce number of classes by merging DIHelper with ObjectFile.Rui Ueyama2016-11-021-21/+9
| | | | | | | | | | DIHelper is a class having only one member, and ObjectFile has a unique pointer to a DIHelper. So we can directly have ObjectFile have the member. Differential Revision: https://reviews.llvm.org/D26223 llvm-svn: 285850
* Don't fetch the section string table multiple times. NFC.Rafael Espindola2016-11-011-1/+2
| | | | llvm-svn: 285755
* Replace GAlloc with a template function.Rafael Espindola2016-11-011-26/+1
| | | | | | | | | This patch replaces GAlloc<ELFT>::<sometype>.Allocate() with alloc<sometype<ELFT>>(). Patch by Rui! llvm-svn: 285748
* Allow fetching source line, when multiple "AX" sections presentEugene Leviant2016-11-011-1/+1
| | | | | | Differential revision: https://reviews.llvm.org/D26070 llvm-svn: 285680
* Consolidate BumpPtrAllocators.Rui Ueyama2016-10-281-16/+4
| | | | | | | | | | | Previously, we have a lot of BumpPtrAllocators, but all these allocators virtually have the same lifetime because they are not freed until the linker finishes its job. This patch aggregates them into a single allocator. Differential revision: https://reviews.llvm.org/D26042 llvm-svn: 285452
* Define ~DIHelper::DIHelper() in .cpp.Rui Ueyama2016-10-271-1/+3
| | | | llvm-svn: 285347
* Don't create a dummy ELF to process a binary file.Rafael Espindola2016-10-271-2/+4
| | | | | | | Now that it is easy to create input section and symbols, this is simple. llvm-svn: 285322
* Store OSABI in Config.Rafael Espindola2016-10-271-4/+1
| | | | | | This allows us to set a value for it based on -m. llvm-svn: 285294
* Use fewer allocators.Rafael Espindola2016-10-271-3/+15
| | | | | | | | | | | | | | Instead of having 3 section allocators per file, have 3 for all files. This is a substantial performance improvement for some cases. Linking chromium without gc speeds up by 1.065x. This requires using _exit in fatal since we have to avoid destructing an InputSection if fatal is called from the constructor. Thanks to Rui for the suggestion. llvm-svn: 285290
* Reduce the number of allocators.Rafael Espindola2016-10-261-5/+7
| | | | | | | | | | We used to have one allocator per file, which reduces the advantage of using an allocator in the first place. This is a small speed up is most cases. The largest speedup was in 1.014X in chromium no-gc. The largest slowdown was scylla at 1.003X. llvm-svn: 285205
* [ELF] Better error reporting for undefined symbolsEugene Leviant2016-10-261-0/+26
| | | | | | | | | | | This patch make lld show following details for undefined symbol errors: - file (line) - file (function name) - file (section name + offset) Differential revision: https://reviews.llvm.org/D25826 llvm-svn: 285186
* Use a CachedHashString for comdats too.Rafael Espindola2016-10-211-3/+6
| | | | | | | We were already using it in the larger sets/maps. This provides about 1% speedup in linking xul and chromium. llvm-svn: 284862
* Move code from InputFile to ELFCreator to decouple the two files.Rui Ueyama2016-10-201-1/+1
| | | | | | | Now that only one non-member function is exported from ELFCreator.h. All the details are handled internally in ELFCreator.cpp file. llvm-svn: 284786
* [ELF] - Applied clang format. NFC.George Rimar2016-10-201-3/+3
| | | | llvm-svn: 284705
OpenPOWER on IntegriCloud