summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputSection.h
Commit message (Collapse)AuthorAgeFilesLines
...
* De-template elf::getObjMsg. NFC.Rui Ueyama2017-10-271-1/+1
| | | | llvm-svn: 316732
* De-template EhFrameSection. NFC.Rui Ueyama2017-10-271-1/+0
| | | | llvm-svn: 316731
* Remove obsolete comment.Rui Ueyama2017-10-241-1/+1
| | | | llvm-svn: 316520
* [ELF] - Do not collect SHT_REL[A] sections unconditionally when ↵George Rimar2017-10-241-2/+2
| | | | | | | | | | | | | --gc-sections and --emit-relocs used together. This is "Bug 34836 - --gc-sections remove relocations from --emit-relocs", When --emit-relocs is used, LLD currently always drops SHT_REL[A] sections from output if --gc-sections is present. Patch fixes the issue. Differential revision: https://reviews.llvm.org/D38724 llvm-svn: 316418
* LLD: Fix large integer implicitly truncated to unsigned type gcc warningKonstantin Zhuravlyov2017-10-231-1/+1
| | | | | | | | This fixes gcc warning. Change by Brian Sumner llvm-svn: 316365
* Remove a fast lookup table from MergeInputSection.Rui Ueyama2017-10-221-3/+0
| | | | | | | | | | | | | | We used to have a map from section piece offsets to section pieces as a cache for binary search. But I found that the map took quite a large amount of memory and didn't make linking faster. So, in this patch, I removed the map. This patch saves 566 MiB of RAM (2.019 GiB -> 1.453 GiB) when linking clang with debug info, and the link time is 4% faster in that test case. Thanks for Sean Silva for pointing this out. llvm-svn: 316305
* Assume that mergeable input sections are smaller than 4 GiB.Rui Ueyama2017-10-211-19/+14
| | | | | | | | | | | | | | | By assuming that mergeable input sections are smaller than 4 GiB, lld's memory usage when linking clang with debug info drops from 2.788 GiB to 2.019 GiB (measured by valgrind, and that does not include memory space for mmap'ed files). I think that's a reasonable assumption given such a large RAM savings, so this patch. According to valgrind, gold needs 3.54 GiB of RAM to do the same thing. NB: This patch does not introduce a limitation on the size of output sections. You can still create sections larger than 4 GiB. llvm-svn: 316280
* Use more precise type.Rui Ueyama2017-10-111-1/+1
| | | | llvm-svn: 315426
* Remove an unused default argument.Rui Ueyama2017-10-101-1/+1
| | | | llvm-svn: 315386
* Add more comments.Rui Ueyama2017-10-101-0/+9
| | | | llvm-svn: 315267
* Add comment to InputSectionBase::File.Rui Ueyama2017-10-101-12/+18
| | | | | | | This patch also moves declarations so that related declarations next to each other. llvm-svn: 315266
* Remove dead function.Rui Ueyama2017-10-101-4/+0
| | | | llvm-svn: 315265
* Add comment.Rui Ueyama2017-10-081-4/+15
| | | | llvm-svn: 315163
* Remove redundant initialization code.Rui Ueyama2017-10-081-2/+0
| | | | llvm-svn: 315158
* Inline a small function. NFC.Rui Ueyama2017-10-061-1/+0
| | | | llvm-svn: 315096
* [ELF] Decompress debug info sections earlyShoaib Meenai2017-10-041-1/+1
| | | | | | | | | | | | | | | | | | When reporting a symbol conflict, LLD parses the debug info to report source location information. Sections have not been decompressed at this point, so if an object file contains zlib compressed debug info, LLD ends up passing this compressed debug info to the DWARF parser, which causes debug info parsing failures and can trigger assertions in the parser (as the test case demonstrates). Decompress debug sections when constructing the LLDDwarfObj to avoid this issue. This doesn't handle GNU-style compressed debug info sections (.zdebug_*), which at present are simply ignored by LLDDwarfObj; those can be done in a follow-up. Differential Revision: https://reviews.llvm.org/D38491 llvm-svn: 314866
* Move new lld's code to Common subdirectory.Rui Ueyama2017-10-021-1/+1
| | | | | | | | | | 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 llvm-svn: 314719
* Fix a data race found by tsan.Rui Ueyama2017-10-021-3/+3
| | | | | | | | | | | | | | | | | Reads from `Live` and writes to `OutputOff` in the following code race even though they are logically independent because they are bitfields sharing the same word. for (size_t I = 0, E = Sec->Pieces.size(); I != E; ++I) { if (!Sec->Pieces[I].Live) continue; CachedHashStringRef Str = Sec->getData(I); size_t ShardId = getShardId(Str.hash()); if ((ShardId & (Concurrency - 1)) == ThreadId) Sec->Pieces[I].OutputOff = Shards[ShardId].add(Str); } llvm-svn: 314711
* Inline hot functions.Rui Ueyama2017-10-011-3/+3
| | | | llvm-svn: 314637
* Revert rL313697, "Compact EhSectionPiece from 32 bytes to 16 bytes."NAKAMURA Takumi2017-09-201-13/+9
| | | | | | | It broke selfhosting. http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/4896 llvm-svn: 313731
* Compact EhSectionPiece from 32 bytes to 16 bytes.Rui Ueyama2017-09-191-9/+13
| | | | | | | | | | | | | | EhSectionPiece used to have a pointer to a section, but that pointer was mostly redundant because we almost always know what the section is without using that pointer. This patch removes the pointer from the struct. This patch also use uint32_t/int32_t instead of size_t to represent offsets that are hardly be larger than 4 GiB. At the moment, I think it is OK even if we cannot handle .eh_frame sections larger than 4 GiB. Differential Revision: https://reviews.llvm.org/D38012 llvm-svn: 313697
* [ELF] - Introduce std::vector<InputFile *> global arrays.George Rimar2017-09-191-1/+1
| | | | | | | | | | | | This patch removes lot of static Instances arrays from different input file classes and introduces global arrays for access instead. Similar to arrays we have for InputSections/OutputSectionCommands. It allows to iterate over input files in a non-templated code. Differential revision: https://reviews.llvm.org/D35987 llvm-svn: 313619
* Rename EhSectionPiece::ID -> EhSectionPiece::Sec.Rui Ueyama2017-09-181-5/+4
| | | | | | ID sounds like an identifier, but this is actually a pointer to a section. llvm-svn: 313588
* Do not use inheritance for EhSectionPiece.Rui Ueyama2017-09-181-4/+7
| | | | | | | | EhSectionPiece inherited from SectionPiece, but we did not actually use EhSectionPiece objects as SectionPiece ojbects. They were handled as distinct types. So it didn't make much sense to use inheritance. llvm-svn: 313587
* Remove useless accessor.Rui Ueyama2017-09-181-1/+0
| | | | llvm-svn: 313586
* Simplify type. NFC.Rafael Espindola2017-09-061-1/+1
| | | | llvm-svn: 312675
* Remove a lock and use a std::unique_ptr instead.Rui Ueyama2017-08-171-0/+5
| | | | | | | | We had a lock to guard BAlloc from being used concurrently, but that is not very easy to understand. This patch replaces it with a std::unique_ptr. llvm-svn: 311056
* [ELF] - Fix "--symbol-ordering-file doesn't work with linker scripts"George Rimar2017-08-041-0/+3
| | | | | | | | | | | | | | | This is PR33889, Patch adds support of combination of linkerscript and -symbol-ordering-file option. If no sorting commands are present in script inside section declaration and no --sort-section option specified, code uses sorting from ordering file if any exist. Differential revision: https://reviews.llvm.org/D35843 llvm-svn: 310045
* Rename ObjectFile -> ObjFile.Rui Ueyama2017-07-261-6/+6
| | | | | | | Rename it because it was too easy to conflict with llvm::object::ObjectFile which broke buildbots several times. llvm-svn: 309199
* Simplify. NFC.Rui Ueyama2017-06-091-1/+1
| | | | llvm-svn: 305048
* Store a single Parent pointer for InputSectionBase.Rafael Espindola2017-05-311-6/+11
| | | | | | | | | | | | | | | Before InputSectionBase had an OutputSection pointer, but that was not always valid. For example, if it was a merge section one actually had to look at MergeSec->OutSec. This was brittle and caused bugs like the one fixed by r304260. We now have a single Parent pointer that points to an OutputSection for InputSection, but to a SyntheticSection for merge sections and .eh_frame. This makes it impossible to accidentally access an invalid OutSec. llvm-svn: 304338
* Fix a crash.Rafael Espindola2017-05-311-1/+1
| | | | | | | | We would crash if a SHF_LINK_ORDER section pointed to a non InputSection section. Since those sections are not merged in order, SHF_LINK_ORDER is pretty meaningless and we can error on that case. llvm-svn: 304327
* [ELF] - Do not allow -r to eat comdats.George Rimar2017-05-291-0/+2
| | | | | | | | | | | | | 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
* Replace std::call_once with llvm:call_onceKamil Rytarowski2017-05-241-1/+2
| | | | | | | | | | | | | | | | | | | | | Summary: This is required on some platforms, as GNU libstdc++ std::call_once is known to be buggy. This fixes operation of LLD on at least NetBSD and perhaps OpenBSD and Linux PowerPC. The same change has been introduced to LLVM and LLDB. Reviewers: ruiu Reviewed By: ruiu Subscribers: emaste, #lld Tags: #lld Differential Revision: https://reviews.llvm.org/D33508 llvm-svn: 303788
* Alternative way to detemplate GotSection.Rafael Espindola2017-05-181-0/+2
| | | | | | | | | | | | | | | | | | | | GetSection is a template because write calls relocate. relocate has two parts. The non alloc code really has to be a template, as it is looking a raw input file data. The alloc part is only a template because of getSize. This patch folds the value of getSize early, detemplates getRelocTargetVA and splits relocate into a templated non alloc case and a regular function for the alloc case. This has the nice advantage of making sure we collect all the information we need for relocations before getting to InputSection::relocateNonAlloc. Since we know got is alloc, it can just call the function directly and avoid the template. llvm-svn: 303355
* 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
* [ELF] - Detemplate InputSection::getRelocatedSection(). NFC.George Rimar2017-03-211-1/+1
| | | | llvm-svn: 298353
* [ELF] - Detemplate InputSectionBase::uncompress(). NFCGeorge Rimar2017-03-211-1/+1
| | | | llvm-svn: 298351
* [ELF] - Detemplate InputSectionBase::getLinkOrderDep(). NFC.George Rimar2017-03-211-1/+1
| | | | llvm-svn: 298346
* Remove DefinedSynthetic.Rafael Espindola2017-03-081-18/+49
| | | | | | | | | | | | | With this we have a single section hierarchy. It is a bit less code, but the main advantage will be in a future patch being able to handle foo = symbol_in_obj; in a linker script. Currently that fails since we try to find the output section of symbol_in_obj. With this we should be able to just return an InputSection from the expression. llvm-svn: 297313
* Use uint32_t for alignment in more places, NFC.Rafael Espindola2017-03-081-2/+2
| | | | llvm-svn: 297305
* Remove unnecessary template.Rafael Espindola2017-03-081-1/+1
| | | | llvm-svn: 297293
* Remove unnecessary template. NFC.Rafael Espindola2017-03-081-2/+2
| | | | llvm-svn: 297292
* 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 unnecessary template. NFC.Rafael Espindola2017-03-081-1/+1
| | | | llvm-svn: 297287
* Remove redundant member of InputSectionBase. NFC.Rafael Espindola2017-03-081-1/+2
| | | | | | With this InputSectionBase is now 144 bytes. llvm-svn: 297278
* Rename remaining uses of Addralign to Alignment.Rafael Espindola2017-03-071-2/+2
| | | | llvm-svn: 297146
* Make Discarded a InputSectionBase.Rafael Espindola2017-03-061-3/+2
| | | | | | NFC, just a bit simpler. llvm-svn: 297087
* Detemplate EhInputSection. NFC.Rafael Espindola2017-03-061-7/+8
| | | | llvm-svn: 297077
* Detemplate merge (input and synthetic) sections. NFC.Rafael Espindola2017-03-061-14/+11
| | | | llvm-svn: 297061
OpenPOWER on IntegriCloud