summaryrefslogtreecommitdiffstats
path: root/lld/ELF/MapFile.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge OutputSectionCommand and OutputSection.Rafael Espindola2017-07-271-9/+7
| | | | | | | | | | | | | This is a bit of a hack, but it is *so* convenient. Now that we create synthetic linker scripts when none is provided, we always have to handle paired OutputSection and OutputsectionCommand and keep a mapping from one to the other. This patch simplifies things by merging them and creating what used to be OutputSectionCommands really early. llvm-svn: 309311
* Rename ObjectFile -> ObjFile.Rui Ueyama2017-07-261-1/+1
| | | | | | | Rename it because it was too easy to conflict with llvm::object::ObjectFile which broke buildbots several times. llvm-svn: 309199
* Try to fix the windows build.Rafael Espindola2017-07-261-1/+1
| | | | llvm-svn: 309161
* Detemplate SymbolTable.Rafael Espindola2017-07-261-1/+1
| | | | | | NFC, just makes it easier to access from non templated code. llvm-svn: 309152
* ELF: Exclude dead symbols from -Map output.Peter Collingbourne2017-07-141-1/+1
| | | | | | | | | This was previously erroring out if one of the dead symbols was a TLS symbol and we were able to discard all TLS sections. Differential Revision: https://reviews.llvm.org/D35397 llvm-svn: 307984
* Keep a list of all OutputSectionCommands.Rafael Espindola2017-05-301-9/+6
| | | | | | | | | | Now that we are trying to use the linker script representation as the canonycal one, there are a few loops looking for just OutputSectionCommands. Create a vector with just the OutputSectionCommands once that is stable to simplify the rest of the code. llvm-svn: 304181
* Clear OutSec->Sections.Rafael Espindola2017-05-231-6/+11
| | | | | | | | | | | Once the dummy linker script is created, we want it to be used for everything to avoid having two redundant representations that can get out of sync. We were already clearing OutputSections. With this patch we clear the Sections vector of every OutputSection. llvm-svn: 303703
* Use linker script commands in writeMapFile.Rafael Espindola2017-05-181-6/+11
| | | | | | | | | | This converts the last (chronologically) user of OutputSections to use the linker script commands instead. The idea is to convert all uses after fabricateDefaultCommands, so that we have a single representation. llvm-svn: 303384
* Use a forward declaration. NFC.Rafael Espindola2017-05-181-0/+1
| | | | llvm-svn: 303363
* Rename parallelFor -> parallelForEachN.Rui Ueyama2017-05-101-1/+1
| | | | | | So that it is clear that the function is a wrapper for for_each_n. llvm-svn: 302718
* Fix comments.Rui Ueyama2017-04-301-1/+1
| | | | llvm-svn: 301778
* Replace PrettyPrinter class in MapFile.cpp with a few non-member functions.Rui Ueyama2017-04-281-63/+57
| | | | | | | | Since the output format has been simplified, the class to print out a map file doesn't seem to be needed anymore. We can replace it with a few non-member functions. llvm-svn: 301715
* Change the format of the map file.Rui Ueyama2017-04-281-38/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we printed out input sections and input files in separate columns as shown below. Address Size Align Out In File Symbol 0000000000201000 0000000000000015 4 .text 0000000000201000 000000000000000e 4 .text 0000000000201000 000000000000000e 4 foo.o 0000000000201000 0000000000000000 0 _start 0000000000201005 0000000000000000 0 f(int) 000000000020100e 0000000000000000 0 local 0000000000201010 0000000000000002 4 bar.o 0000000000201010 0000000000000000 0 foo 0000000000201011 0000000000000000 0 bar This format doesn't make much sense because for each input section, there's always exactly one input file. This patch changes the format to this. Address Size Align Out In Symbol 0000000000201000 0000000000000015 4 .text 0000000000201000 000000000000000e 4 foo.o:(.text) 0000000000201000 0000000000000000 0 _start 0000000000201005 0000000000000000 0 f(int) 000000000020100e 0000000000000000 0 local 0000000000201010 0000000000000002 4 bar.o:(.text) 0000000000201010 0000000000000000 0 foo 0000000000201011 0000000000000000 0 bar Differential Revision: https://reviews.llvm.org/D32657 llvm-svn: 301683
* Remove trailing whitespace from the -Map output.Rui Ueyama2017-04-281-4/+4
| | | | | | | If a string is shorter than 7 characters, we used to print out trailing whitespace characters. llvm-svn: 301668
* Remove a redundant local variable.Rui Ueyama2017-04-281-4/+3
| | | | llvm-svn: 301661
* Speed up the -Map option.Rui Ueyama2017-04-281-58/+103
| | | | | | | | | | | | | | | | | | | | | | We found that some part of code for the -Map option takes O(m*n) where m is the number of input sections in some file and n is the number of symbols in the same file. If you do LTO, we usually have only a few object files as inputs for the -Map option feature, so this performance characteristic was worse than I expected. This patch rewrites the -Map option feature to speed it up. I eliminated the O(m*n) bottleneck and also used multi-threading. As a result, clang link time with the -Map option improved from 18.7 seconds to 11.2 seconds. Without -Map, it takes 7.7 seconds, so the -Map option is now about 3x faster than before for this test case (from 11.0 seconds to 3.5 seconds.) The generated output file size was 223 MiB, and the file contains 1.2M lines. Differential Revision: https://reviews.llvm.org/D32631 llvm-svn: 301659
* [ELF] - Detemplate SymbolBody::getVA and SymbolBody::getPltVA. NFC.George Rimar2017-03-171-1/+1
| | | | llvm-svn: 298071
* Remove unnecessary template. NFC.Rafael Espindola2017-03-081-4/+4
| | | | llvm-svn: 297287
* Rename Addralign to Alignment.Rafael Espindola2017-03-071-1/+1
| | | | | | It now matches the name used in InputSectionBase. llvm-svn: 297144
* De-template DefinedRegular.Rui Ueyama2017-02-281-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D30348 llvm-svn: 296508
* Merge OutputSectionBase and OutputSection. NFC.Rafael Espindola2017-02-241-11/+10
| | | | | | | Now that all special sections are SyntheticSections, we only need one OutputSection class. llvm-svn: 296127
* Delete trivial getter.Rafael Espindola2017-02-241-2/+1
| | | | llvm-svn: 296123
* Make InputSection a class. NFC.Rafael Espindola2017-02-231-3/+3
| | | | | | | | | With the current design an InputSection is basically anything that goes directly in a OutputSection. That includes plain input section but also synthetic sections, so this should probably not be a template. llvm-svn: 295993
* Merge InputSectionData and InputSectionBase.Rafael Espindola2017-02-231-1/+1
| | | | | | | 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-5/+5
| | | | | | | Removing this template is not a big win by itself, but opens the way for removing more templates. llvm-svn: 295923
* Print alignment in decimal instead of hexadecimal.Rui Ueyama2017-01-311-1/+1
| | | | | | | | | | | | | Previously, we were printing out something like this for sections/symbols with alignment 16 0000000000201000 0000000000000182 10 .data which I think confusing. I think printing it in decimal is better. Differential Revision: https://reviews.llvm.org/D29258 llvm-svn: 293685
* [ELF] - Fix format specifiers in writeOutSecLine()George Rimar2017-01-161-1/+1
| | | | | | | | | | | | | | | | | I had a error in map-file.s testcase under MSVS2015/win32: map-file.s:30:16: error: expected string not found in input // CHECK-NEXT: 0000000000200158 0000000000000030 8 .eh_frame <stdin>:2:1: note: scanning from here 0000000000200158 10 30 .eh_frame Format string '%0*x' requires an argument of type 'unsigned int', but argument has type 'uint64_t'. Proper format is '%0*llx' then. This fixes testcase failture for me. llvm-svn: 292102
* Use error() instead of fatal() to handle file open error.Rui Ueyama2017-01-161-2/+3
| | | | llvm-svn: 292090
* Simplify string output. NFC.Rui Ueyama2017-01-151-4/+2
| | | | llvm-svn: 292042
* Directly write to a -Map file.Rui Ueyama2017-01-151-16/+7
| | | | | | | | | | | | | | | | | | Previous code had a bug that if the program exits with an assert() or fail() before the control reaches end of writeMapFile(), it leaves a temporary file, because FileRemover's dtor isn't called in that case. I could fix that by removeFileOnSignal() and other functions, but I think we can simply write to the result file directly. I think that is straightforward and easy to understand. Additionally, that allows something like `-Map /dev/null` or a bash hack such as `-Map >(grep symbol-im-looking-for)`. Previously, that kind of things didn't work. Differential Revision: https://reviews.llvm.org/D28714 llvm-svn: 292041
* Split writeMapFile2 to reduce indentation level.Rui Ueyama2017-01-141-32/+40
| | | | llvm-svn: 291984
* Implement -Map.Rafael Espindola2017-01-131-0/+135
The format is not exactly the same as the one in bfd since bfd always follows a linker script and prints it along. llvm-svn: 291958
OpenPOWER on IntegriCloud