summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/StringTableBuilder.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Adds support for writing the .bss section for XCOFF object files.Sean Fertile2019-08-201-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Adds Wrapper classes for MCSymbol and MCSection into the XCOFF target object writer. Also adds a class to represent the top-level sections, which we materialize in the ObjectWriter. executePostLayoutBinding will map all csects into the appropriate container depending on its storage mapping class, and map all symbols into their containing csect. Once all symbols have been processed we - Assign addresses and symbol table indices. - Calaculte section sizes. - Build the section header table. - Assign the sections raw-pointer value for non-virtual sections. Since the .bss section is virtual, writing the header table is enough to add support. Writing of a sections raw data, or of any relocations is not included in this patch. Testing is done by dumping the section header table, but it needs to be extended to include dumping the symbol table once readobj support for dumping auxiallary entries lands. Differential Revision: https://reviews.llvm.org/D65159 llvm-svn: 369454
* [llvm-objcopy] - Fix a st_name of the first symbol table entry.George Rimar2019-03-221-0/+7
| | | | | | | | | | | | | | | | | | | | Spec says about the first symbol table entry that index 0 both designates the first entry in the table and serves as the undefined symbol index. It should have zero value. Hence the first symbol table entry has no name. And so has to have a st_name == 0. (http://refspecs.linuxbase.org/elf/gabi4+/ch4.symtab.html) Currently, we do not emit zero value for the first symbol table entry. That happens because we add empty strings to the string builder, which for each such case adds a zero byte: (https://github.com/llvm-mirror/llvm/blob/master/lib/MC/StringTableBuilder.cpp#L185) After the string optimization performed it might return non zero indexes for the empty string requested. The patch fixes this issue for the case above and other sections with no names. Differential revision: https://reviews.llvm.org/D59496 llvm-svn: 356739
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [DWARFv5] Emit .debug_line_str (in a non-DWO file).Paul Robinson2018-02-061-0/+2
| | | | | | | | This should enable the linker to do string-pooling of path names. Differential Revision: https://reviews.llvm.org/D42707 llvm-svn: 324393
* Simplify multikey_qsort function.Rui Ueyama2017-10-031-24/+20
| | | | | | | This function implements the three-way radix quicksort algorithm. This patch simplifies the implementation by using MutableArrayRef. llvm-svn: 314858
* Rewrite a function so that it doesn't use pointers to pointers. NFC.Rui Ueyama2017-10-031-12/+13
| | | | | | | | Previous code was a bit puzzling because of its use of pointers. In this patch, we pass a vector and its offsets, instead of pointers to vector elements. llvm-svn: 314756
* Move Object format code to lib/BinaryFormat.Zachary Turner2017-06-071-1/+1
| | | | | | | | | | | | 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 llvm-svn: 304864
* Sort the remaining #include lines in include/... and lib/....Chandler Carruth2017-06-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). llvm-svn: 304787
* [MC] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).Eugene Zelenko2017-04-261-1/+1
| | | | llvm-svn: 301485
* StringTableBuilder: Don't assert when writing an empty raw string table.Peter Collingbourne2017-04-061-1/+1
| | | | llvm-svn: 299602
* [MC] Fix some Clang-tidy modernize and Include What You Use warnings; other ↵Eugene Zelenko2017-02-111-5/+11
| | | | | | minor fixes (NFC). llvm-svn: 294813
* [ADT] Move CachedHashString to its own header in ADT, and rename to ↵Justin Lebar2016-10-171-25/+4
| | | | | | | | | | | | | | | | 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 alignTo computation inside the if.Rafael Espindola2016-10-141-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | This is an improvement when compiling with llvm. llvm doesn't inline the call to insert, so the align is always executed and shows up in the profile. With gcc the call to insert is inlined and the align computation moved and done only if needed. With this patch we explicitly only compute it if it is needed. In the two tests with debug info, the speedup was scylla master 3.008959365 patch 2.932080942 1.02621974786x faster firefox master 6.709823604 patch 6.592387227 1.01781393795x faster In all others the difference was in the noise. llvm-svn: 284249
* Allow the caller to pass in the hash.Rafael Espindola2016-10-051-2/+2
| | | | | | | If the caller already has the hash we don't have to compute it. This will be used in lld. llvm-svn: 283359
* Don't pass null to memcpy. Should fix the asan bots.Rafael Espindola2016-10-051-1/+2
| | | | llvm-svn: 283336
* Misc improvements to StringTableBuilder.Rafael Espindola2016-10-041-77/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds write methods to StringTableBuilder so that it is easier to change the underlying implementation. Using the write methods, avoid creating a temporary buffer when using mmaped output. It also uses a more compact key in the DenseMap. Overall this produces a slightly faster lld: firefox master 6.853419709 patch 6.841968912 1.00167361138x faster chromium master 4.297280174 patch 4.298712163 1.00033323147x slower chromium fast master 1.802335952 patch 1.806872459 1.00251701521x slower the gold plugin master 0.3247149 patch 0.321971644 1.00852017888x faster clang master 0.551279945 patch 0.543733194 1.01387951128x faster llvm-as master 0.032743458 patch 0.032143478 1.01866568391x faster the gold plugin fsds master 0.350814247 patch 0.348571741 1.00643341309x faster clang fsds master 0.6281672 patch 0.621130222 1.01132931187x faster llvm-as fsds master 0.030168899 patch 0.029797155 1.01247582194x faster scylla master 3.104222518 patch 3.059590248 1.01458766252x faster llvm-svn: 283266
* Remove duplicated typedef. NFC.Rafael Espindola2016-10-041-5/+4
| | | | llvm-svn: 283216
* Revert "Use getSize instead of data().size(). NFC."Rafael Espindola2016-10-031-5/+0
| | | | | | | | This reverts commit r283125. lld needs to be updated. llvm-svn: 283127
* Use getSize instead of data().size(). NFC.Rafael Espindola2016-10-031-0/+5
| | | | | | | Also assert isFinalized in getSize(). This just reduces the noise from another patch. llvm-svn: 283125
* Make StringTableBuilder to cache hash values.Rui Ueyama2016-05-061-4/+4
| | | | | | | | | | | | | | This change seems to speed up LLD a bit if it has a lot of mergeable sections. The number is below. It's not too bad for a small patch. Time to link Clang (debug build): w/o patch 6.3696 seconds w/patch 6.2746 seconds (-1.5%) Differential Revision: http://reviews.llvm.org/D19933 llvm-svn: 268698
* Add support for merging strings with alignment larger than one char.Rafael Espindola2016-02-191-8/+16
| | | | | | This will be used in a lld patch. llvm-svn: 261326
* Reland "[CodeView] Use assembler directives for line tables"Reid Kleckner2016-01-291-8/+47
| | | | | | | | This reverts commit r259126 and relands r259117. This time with updated library dependencies. llvm-svn: 259130
* Revert "[CodeView] Use assembler directives for line tables"Reid Kleckner2016-01-291-47/+8
| | | | | | | | | This reverts commit r259117. The LineInfo constructor is defined in the codeview library and we have to link against it now. Doing that isn't trivial, so reverting for now. llvm-svn: 259126
* [CodeView] Use assembler directives for line tablesReid Kleckner2016-01-281-8/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a new family of .cv_* directives to LLVM's variant of GAS syntax: - .cv_file: Similar to DWARF .file directives - .cv_loc: Similar to the DWARF .loc directive, but starts with a function id. CodeView line tables are emitted by function instead of by compilation unit, so we needed an extra field to communicate this. Rather than overloading the .loc direction further, we decided it was better to have our own directive. - .cv_stringtable: Emits the codeview string table at the current position. Currently this just contains the filenames as null-terminated strings. - .cv_filechecksums: Emits the file checksum table for all files used with .cv_file so far. There is currently no support for emitting actual checksums, just filenames. This moves the line table emission code down into the assembler. This is in preparation for implementing the inlined call site line table format. The inline line table format encoding algorithm requires knowing the absolute code offsets, so it must run after the assembler has laid out the code. David Majnemer collaborated on this patch. llvm-svn: 259117
* Rename qsort -> multikey_qsort. NFC.Rui Ueyama2015-10-271-4/+4
| | | | | | `qsort` as a file-scope local function name was confusing. llvm-svn: 251414
* Optimize StringTableBuilder.Rui Ueyama2015-10-261-14/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is a patch to improve StringTableBuilder's performance. That class' finalize function is very hot particularly in LLD because the function does tail-merge strings in string tables or SHF_MERGE sections. Generic std::sort-style sorter is not efficient for sorting strings. The function implemented in this patch seems to be more efficient. Here's a benchmark of LLD to link Clang with or without this patch. The numbers are medians of 50 runs. -O0 real 0m0.455s real 0m0.430s (5.5% faster) -O3 real 0m0.487s real 0m0.452s (7.2% faster) Since that is a benchmark of the whole linker, the speedup of StringTableBuilder itself is much more than that. http://reviews.llvm.org/D14053 llvm-svn: 251337
* Add a RAW mode to StringTableBuilder.Rafael Espindola2015-10-231-5/+16
| | | | | | | | | | | | In this mode it just tries to tail merge the strings without imposing any other format constrains. It will not, for example, add a null byte between them. Also add support for keeping a tentative size and offset if we decide to not optimize after all. This will be used shortly in lld for merging SHF_STRINGS sections. llvm-svn: 251153
* Fix the variable names to match the LLVM style.Rafael Espindola2015-10-231-27/+27
| | | | llvm-svn: 251143
* Avoid storing a second copy of each string in StringTableBuilder.Rafael Espindola2015-10-221-9/+20
| | | | | | This was only use in the extremely uncommon case of @@@ symbols on ELF. llvm-svn: 251039
* Fix broken build under MSVC.Zachary Turner2015-10-221-0/+2
| | | | llvm-svn: 251030
* Avoid hash lookups when finalizing StringTableBuilder. NFC.Rafael Espindola2015-10-221-10/+11
| | | | llvm-svn: 251024
* Use array_pod_sort. NFC.Rafael Espindola2015-10-221-4/+7
| | | | llvm-svn: 251023
* MachObjectWriter: optimize the string table for common sufficesHans Wennborg2014-10-061-3/+17
| | | | | | | | This is a follow-up to r207670 (ELF) and r218636 (COFF). Differential Revision: http://reviews.llvm.org/D5622 llvm-svn: 219126
* WinCOFFObjectWriter: optimize the string table for common sufficesHans Wennborg2014-09-291-4/+27
| | | | | | | | This is a follow-up from r207670 which did the same for ELF. Differential Revision: http://reviews.llvm.org/D5530 llvm-svn: 218636
* Revert r218380. This was breaking Apple internal build bots.Akira Hatanaka2014-09-241-6/+14
| | | | llvm-svn: 218409
* Replace a hand-written suffix compare with std::lexicographical_compare.Benjamin Kramer2014-09-241-14/+6
| | | | | | No functionality change. llvm-svn: 218380
* Invert the MC -> Object dependency.Rafael Espindola2014-07-031-0/+51
Now that we have a lib/MC/MCAnalysis, the dependency was there just because of two helper classes. Move the two over to MC. This will allow IRObjectFile to parse inline assembly. llvm-svn: 212248
OpenPOWER on IntegriCloud