summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputSection.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't gc non-alloca non-string pieces.Rafael Espindola2016-10-191-1/+2
| | | | | | | We were already doing it for strings. This matches the behavior of bfd and gold. llvm-svn: 284598
* Add a faster binary search.Rafael Espindola2016-10-191-1/+14
| | | | | | | | | | | Even with the hash table cache, binary search was still pretty hot. This can be made even faster with prefetching. Idea from http://cglab.ca/~morin/misc/arraylayout-v2/ I will suggest moving this to llvm. llvm-svn: 284594
* Use reserve instead of grow.Rafael Espindola2016-10-181-1/+1
| | | | | | | The table was still being resized as grow doesn't account for the fact that the table needs to remain 3/4 full. llvm-svn: 284487
* [ADT] Move CachedHashString to its own header in ADT, and rename to ↵Justin Lebar2016-10-171-1/+1
| | | | | | | | | | | | | | | | CachedHashStringRef. Summary: Reclaiming the name 'CachedHashString' will let us add a type with that name that owns its value. Reviewers: timshen Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25644 llvm-svn: 284434
* Move a utility function to Strings.cpp.Rui Ueyama2016-10-131-2/+2
| | | | | | So that we can use the function from anywhere. llvm-svn: 284092
* Fix variable name. NFC.Rui Ueyama2016-10-121-2/+2
| | | | llvm-svn: 284079
* Support GNU-style ZLIB-compressed input sections.Rui Ueyama2016-10-121-20/+60
| | | | | | | | | | | | | | | | | | Previously, we supported only SHF_COMPRESSED sections because it's new and it's the ELF standard. But there are object files compressed in the GNU style out there, so we had to support it. Sections compressed in the GNU style start with ".zdebug_" and contain different headers than the ELF standard's one. In this patch, getRawCompressedData is responsible to handle it. A tricky thing about GNU-style compressed sections is that we have to rename them when creating output sections. ".zdebug_" prefix implies the section is compressed. We need to rename ".zdebug_" ".debug" because our output sections are not compressed. We do that in this patch. llvm-svn: 284068
* [ELF][ARM] Initial implentation of ARM exceptions supportPeter Smith2016-10-101-0/+9
| | | | | | | | | | | | | | | | | | | The .ARM.exidx sections contain a table. Each entry has two fields: - PREL31 offset to the function the table entry describes - Action to take, either cantunwind, inline unwind, or PREL31 offset to .ARM.extab section The table entries must be sorted in order of the virtual addresses the first entry of the table describes. Traditionally this is implemented by the SHF_LINK_ORDER dependency. Instead of implementing this directly we sort the table entries post relocation. The .ARM.exidx OutputSection is described by the PT_ARM_EXIDX program header Differential revision: https://reviews.llvm.org/D25127 llvm-svn: 283730
* Improve comments.Rui Ueyama2016-10-071-3/+6
| | | | | | | Also use uint64_t instead of uintX_t so that you don't have to think about two different cases to verify that the code is correct. llvm-svn: 283585
* Add () for clarity. NFC.Rafael Espindola2016-10-071-1/+1
| | | | llvm-svn: 283556
* [ELF] - Check that section alignment is a power of 2.George Rimar2016-10-071-3/+7
| | | | | | | | | | | | I found that this check still may be useful in some cases. At fact since we use uint32_t alignment, then maximum value that is valid for us is 0x80000000. But some broken files, for example file from testcase may have greater value. Because of that offset calculation overflow and crash happens. Differential revision: https://reviews.llvm.org/D25324 llvm-svn: 283544
* Store the hash in SectionPiece.Rafael Espindola2016-10-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This spreads out computing the hash and using it in a hash table. The speedups are: firefox master 6.811232891 patch 6.559280249 1.03841162939x faster chromium master 4.369323666 patch 4.33171853 1.00868134338x faster chromium fast master 1.856679971 patch 1.850617741 1.00327578725x faster the gold plugin master 0.32917962 patch 0.325711944 1.01064645023x faster clang master 0.558015452 patch 0.550284165 1.01404962652x faster llvm-as master 0.032563515 patch 0.032152077 1.01279662275x faster the gold plugin fsds master 0.356221362 patch 0.352772162 1.00977741549x faster clang fsds master 0.635096494 patch 0.627249229 1.01251060127x faster llvm-as fsds master 0.030183188 patch 0.029889544 1.00982430511x faster scylla master 3.071448906 patch 2.938484138 1.04524944215x faster This seems to be because we don't stall as much. When linking firefox stalled-cycles-frontend goes from 57.56% to 55.55%. With -O2 the difference is even more significant since we avoid recomputing the hash. For firefox we go from 9.990295265 to 9.149627521 seconds (1.09x faster). llvm-svn: 283367
* Compact SectionPiece.Rafael Espindola2016-10-051-1/+5
| | | | | | | | | It is pretty easy to get the data from the InputSection, so we don't have to store it. This opens the way for storing the hash instead. llvm-svn: 283357
* Simplify setting the Live bit in SectionPiece. NFC.Rafael Espindola2016-10-051-11/+5
| | | | llvm-svn: 283340
* [ELF] - Do not hang if broken object has option descriptor in .MIPS.options ↵George Rimar2016-10-041-0/+2
| | | | | | | | | | | with size of zero. Previously lld would hang in infinite loop in this case, patch fixes the issue. Object was found during AFL run. Differential revision: https://reviews.llvm.org/D25229 llvm-svn: 283208
* [ELF][MIPS] Do not accept non-zero GP0 value for relocatable object onlySimon Atanasyan2016-10-041-2/+2
| | | | | | | | | Follow-up to r282716. Reject input files with non-zero GP0 value only in case of relocatable object generation. In other case we can handle arbitrary GP0 value so it does not have a sense to make the restriction so wide. llvm-svn: 283194
* [ELF] - Do not crash on invalid section alignment.George Rimar2016-10-031-0/+2
| | | | | | | | | | | | | | Case was revealed by id_000010,sig_08,src_000000,op_havoc,rep_4 from PR30540. Out implementation uses uint32 for storing section alignment value, what seems reasonable, though if value exceeds 32 bits bounds we have truncation and final value of 0. Patch fixes the issue. Differential revision: https://reviews.llvm.org/D25082 llvm-svn: 283097
* [ELF] - Inlined template argument variable. NFC.George Rimar2016-09-301-3/+2
| | | | llvm-svn: 282851
* Fix another --gc-sections crash.Rafael Espindola2016-09-301-0/+3
| | | | | | | The missing case was when a merge section was only referenced from non-alloca sections. llvm-svn: 282847
* Fix --gc-sections crash.Rafael Espindola2016-09-301-1/+3
| | | | | | | | | | We would crash when a non-alloca section pointed to a gced part of a merge section. That can happen when a C/c++ constant in put in a merge section and debug info is present. llvm-svn: 282845
* [ELF][MIPS] Set GP0 value to zero in case of relocatable object generationSimon Atanasyan2016-09-291-0/+4
| | | | | | | | | | LLD does not update relocations addends when generate a relocatable object. That is why we should not write a non-zero GP0 value into the .reginfo and .MIPS.options sections. And we should not accept input object files with non-zero GP0 value because we cannot handle them properly. llvm-svn: 282716
* Don't GC non-alloc mergeable section piecesEugene Leviant2016-09-291-3/+10
| | | | | | Differential revision: https://reviews.llvm.org/D25033 llvm-svn: 282708
* [ELF] Resolve weak undefined TLS symbols when no phdr is available.Davide Italiano2016-09-231-0/+8
| | | | | | | | | | | | If we pass --gc-sections to lld and .tbss is not referenced, the section is reclaimed and lld doesn't create a TLS program header. R_TLS tries to access the program header -> lld crashes. Mimic what bfd/gold do in this case and resolve a weak undefined TLS symbol to the base of the TLS block, i.e. give it a value of zero. Differential Revision: https://reviews.llvm.org/D24832 llvm-svn: 282279
* Turn a no-op assignment into an assertion.Rui Ueyama2016-09-141-1/+1
| | | | | | r279456 guarantees that this condition is always satisfied. llvm-svn: 281426
* Store an ArrayRef for Data in InputSectionData.Rafael Espindola2016-09-121-26/+24
| | | | llvm-svn: 281210
* Revert "Revert "Compact InputSectionData from 64 to 48 bytes. NFC.""Rafael Espindola2016-09-121-3/+6
| | | | | | | | This reverts commit r281096. The previous link errors should be fixed by r281208. llvm-svn: 281209
* Revert "Compact InputSectionData from 64 to 48 bytes. NFC."Rafael Espindola2016-09-091-6/+3
| | | | | | | | | This reverts commit r281084. The link was failing on some bots. No idea why. I will try to reproduce it on Monday. llvm-svn: 281096
* Compact InputSectionData from 64 to 48 bytes. NFC.Rafael Espindola2016-09-091-3/+6
| | | | llvm-svn: 281084
* Compute section names only once.Rafael Espindola2016-09-081-21/+24
| | | | | | | | This simplifies error handling as there is now only one place in the code that needs to consider the possibility that the name is corrupted. Before we would do it in every access. llvm-svn: 280937
* Pack InputSectionData from 72 to 64 bytes. NFC.Rafael Espindola2016-09-081-7/+7
| | | | llvm-svn: 280925
* Delete dead field. NFC.Rafael Espindola2016-09-071-1/+1
| | | | llvm-svn: 280856
* Eliminate LayoutInputSection classEugene Leviant2016-09-011-10/+5
| | | | | | | | | | Previously we used LayoutInputSection class to correctly assign symbols defined in linker script. This patch removes it and uses pointer to preceding input section in SymbolAssignment class instead. Differential revision: https://reviews.llvm.org/D23661 llvm-svn: 280348
* Fix the implementation of R_386_GOTPC and R_386_GOTOFF.Rafael Espindola2016-08-311-0/+5
| | | | | | | | They were both pointing to the start of the got, not the end. Fixes pr28924. llvm-svn: 280310
* Use getSize to find the size of a section. NFC.Rafael Espindola2016-08-311-7/+3
| | | | llvm-svn: 280305
* Delete unnecessary template.Rafael Espindola2016-08-311-7/+6
| | | | llvm-svn: 280237
* [ELF] - Fix for PR28976 - Corrupted section contents when using linker scriptsGeorge Rimar2016-08-191-1/+1
| | | | | | | | | | | | This is fix for PR28976. Problem was that in scanRelocs, we computed relocation offset too early for case when linkerscript was used. Patch fixes the issue delaying the calculation. Differential revision: https://reviews.llvm.org/D23655 llvm-svn: 279264
* [ELF][MIPS] Support .MIPS.abiflags sectionSimon Atanasyan2016-08-121-4/+28
| | | | | | | This section supersedes .reginfo and .MIPS.options sections. But for now we have to support all three sections for ABI transition period. llvm-svn: 278482
* [ELF] Symbol assignment within output section descriptionEugene Leviant2016-08-111-1/+2
| | | | llvm-svn: 278322
* Include filenames and section names to error messages.Rui Ueyama2016-08-031-14/+23
| | | | llvm-svn: 277566
* [ELF] - Fix: do not ignore relocations addends when using lld -rGeorge Rimar2016-08-021-1/+3
| | | | | | | | | Previously addends were ignored. This is PR28779. Patch fixes the issue. Differential revision: https://reviews.llvm.org/D23011 llvm-svn: 277432
* Remove DefinedCommon::Section.Rui Ueyama2016-08-021-1/+0
| | | | | | | Since CommonInputSection is a singleton class, we don't need to store pointers to all DefinedCommon symbols. llvm-svn: 277410
* Remove dependency to SymbolTable from CommonInputSection.Rui Ueyama2016-07-291-18/+13
| | | | llvm-svn: 277103
* Make CommonInputSection singleton class.Rui Ueyama2016-07-281-9/+1
| | | | | | | | | All other singleton instances are accessible globally. CommonInputSection shouldn't be an exception. Differential Revision: https://reviews.llvm.org/D22935 llvm-svn: 277034
* [ELF] Allows setting section for common symbols in linker scriptEugene Leviant2016-07-281-0/+44
| | | | llvm-svn: 277023
* Fix PR28575.Rafael Espindola2016-07-211-1/+40
| | | | | | | | | | Not all relocations from a .eh_frame that point to an executable section should be ignored. In particular, the relocation finding the personality function should not. This is a reduction from trying to bootstrap a static lld on linux. llvm-svn: 276329
* Delete SplitInputSection.Rafael Espindola2016-07-211-16/+5
| | | | | | This opens the way for having a different Piece type for EhInputSection. llvm-svn: 276275
* Delete EhInputSection::getOffset.Rafael Espindola2016-07-201-16/+4
| | | | | | | | | | | | | We no longer need it for relocations in .eh_frame. The only relocations that point to .eh_frame are the ones trying to find the output .eh_frame. This actually fixes a bug in the symbol value code. It was not handling -1 as an indicator for a piece not being included in the output. llvm-svn: 276175
* Create thunks before regular relocation scan.Rafael Espindola2016-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We will need to do something like this to support range extension thunks since that process is iterative. Doing this also has the advantage that when doing the regular relocation scan the offset in the output section is known and we can just store that. This reduces the number of times we have to run getOffset and I think will allow a more specialized .eh_frame representation. By itself this is already a performance win. firefox master 7.295045737 patch 7.209466989 0.98826892235 chromium master 4.531254468 patch 4.509221804 0.995137623774 chromium fast master 1.836928973 patch 1.823805241 0.992855612714 the gold plugin master 0.379768791 patch 0.380043405 1.00072310839 clang master 0.642698284 patch 0.642215663 0.999249070657 llvm-as master 0.036665467 patch 0.036456225 0.994293213284 the gold plugin fsds master 0.40395817 patch 0.404384555 1.0010555177 clang fsds master 0.722045545 patch 0.720946135 0.998477367518 llvm-as fsds master 0.03292646 patch 0.032759965 0.994943428477 scylla master 3.427376378 patch 3.368316181 0.98276810292 llvm-svn: 276146
* [ELF] Create output sections in LinkerScript classEugene Leviant2016-07-201-10/+0
| | | | llvm-svn: 276121
* [ELF] - Make few members of Writer to be global and export them for reuseGeorge Rimar2016-07-121-0/+11
| | | | | | | | | | | Creating sections on linkerscript side requires some methods that can be reused if are exported from writer. Patch implements that change. Differential revision: http://reviews.llvm.org/D20104 llvm-svn: 275162
OpenPOWER on IntegriCloud