summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter
Commit message (Collapse)AuthorAgeFilesLines
...
* [ELF][X86_64] Sort includesShankar Easwaran2015-03-204-5/+3
| | | | llvm-svn: 232861
* [Mips] Create special PLT entry in case of MIPS R6 ABISimon Atanasyan2015-03-201-1/+32
| | | | llvm-svn: 232806
* [Mips] Add comments to the relocation calculation functionsSimon Atanasyan2015-03-191-1/+6
| | | | | | No functional changes. llvm-svn: 232761
* [Mips] Implement R_MIPS_PCHI16 / R_MIPS_PCLO16 relocations handlingSimon Atanasyan2015-03-193-0/+24
| | | | llvm-svn: 232757
* [Mips] Implement R_MIPS_PC18_S3 relocation handlingSimon Atanasyan2015-03-191-0/+12
| | | | llvm-svn: 232756
* [Mips] Implement R_MIPS_PC19_S2 / R_MIPS_PC26_S2 relocations handlingSimon Atanasyan2015-03-191-0/+24
| | | | llvm-svn: 232755
* [ARM] Implement static (initial exec) TLS modelDenis Protivensky2015-03-195-5/+128
| | | | | | | | This includes handling of R_ARM_TLS_IE32 and R_ARM_TLS_LE32 relocs. Differential Revision: http://reviews.llvm.org/D8353 llvm-svn: 232708
* [Mips] Implement R_MIPS_PC21_S2 relocation handlingSimon Atanasyan2015-03-191-0/+12
| | | | llvm-svn: 232707
* [Mips] Recognize and check compatibility MIPS32R6 / MIPS64R6 ISA'sSimon Atanasyan2015-03-191-0/+4
| | | | llvm-svn: 232706
* [Mips] Replace "hand-made" function by the `llvm::SignExtend32()` routineSimon Atanasyan2015-03-191-12/+7
| | | | | | No functional changes. llvm-svn: 232705
* PECOFF: Do not copy all undefined symbols to a set. NFC.Rui Ueyama2015-03-181-12/+8
| | | | llvm-svn: 232646
* Remove unused parameter.Rui Ueyama2015-03-181-7/+3
| | | | llvm-svn: 232639
* [ELF][ARM] Place gotSymbol in an anonymous namespaceShankar Easwaran2015-03-171-5/+8
| | | | | | Address comments from Espindola. llvm-svn: 232497
* [ARM] Read initial addend for REL32 and PREL31 relocsDenis Protivensky2015-03-171-0/+3
| | | | llvm-svn: 232474
* [ARM] Implement relocations: R_ARM_REL32, R_ARM_THM_JUMP11, R_ARM_PREL31Denis Protivensky2015-03-171-1/+81
| | | | | | | | Test case for every relocation is added. Differential Revision: http://reviews.llvm.org/D7565 llvm-svn: 232464
* [ELF] Use parallel_for_each for writing.Shankar Easwaran2015-03-172-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes improves performance of lld, when self-hosting lld, when compared with the bfd linker. BFD linker on average takes 8 seconds in elapsed time. lld takes 3 seconds elapased time average. Without this change, lld takes ~5 seconds average. The runtime comparisons were done on a release build and measured by running linking thrice. lld self-host without the change ---------------------------------- real 0m3.196s user 0m4.580s sys 0m0.832s lld self-host with lld ----------------------- user 0m3.024s user 0m3.252s sys 0m0.796s time taken to build lld with bfd -------------------------------- real 0m8.419s user 0m7.748s sys 0m0.632s llvm-svn: 232460
* Make it compile with MSVC 2013.Rui Ueyama2015-03-171-5/+6
| | | | | | | MSVC 2013 cannot compile this code because of C1001 "internal error". Stop using initializer list without type name. llvm-svn: 232448
* PECOFF: Make FileCOFF:findAtomAt from O(n) to O(1).Rui Ueyama2015-03-161-19/+18
| | | | | | | | I knew I cut corners when I wrote this. Turned out that it is actually slow when a file being read has many symbols. This patch is to stop doing linear search and instead do map lookup. llvm-svn: 232436
* [ELF] Use pcrel format for eh_frame_ptr field encodingSimon Atanasyan2015-03-161-8/+12
| | | | | | | | | | | | | The `eh_frame_ptr` field in the `.eh_frame_hdr` section contains an address of the `.eh_frame` section. Using an absolute 32-bit format for encoding of this field does not work for 64-bit targets. It is better to use a relative format because it covers both 32-bit and 64-bit cases. Sure this work if a distance between `.eh_frame_hdr` and `.eh_frame` sections is less than 4 Gb but it is a rather correct assumption. http://reviews.llvm.org/D8352 llvm-svn: 232414
* [LinkerScript] Handle symbols defined in linker scriptsRafael Auler2015-03-168-27/+74
| | | | | | | | | | Puts symbols defined in linker script expressions in a runtime file that is added as input to the resolver, making the input object files see symbols defined in linker scripts. http://reviews.llvm.org/D8263 llvm-svn: 232409
* [LinkerScript] Implement semantics for simple sections mappingsRafael Auler2015-03-169-35/+606
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit implements the behaviour of the SECTIONS linker script directive, used to not only define a custom mapping between input and output sections, but also order input sections in the output file. To do this, we modify DefaultLayout with hooks at important places that allow us to re-order input sections according to a custom order. We also add a hook in SegmentChunk to allow us to calculate linker script expressions while assigning virtual addresses to the input sections that live in a segment. Not all SECTIONS constructs are currently supported, but only the ones that do not use special sort orders. It adds two LIT test as practical examples of which sections directives are currently supported. In terms of high-level changes, it creates a new class "script::Sema" that owns all linker script ASTs and the logic for linker script semantics as well. ELFLinkingContext owns a single copy of Sema, which will be used throughout the object file writing process (to layout sections as proposed by the linker script). Other high-level change is that the writer no longer uses a "const" copy of the linking context. This happens because linker script expressions must be calculated *while* calculating final virtual addresses, which is a very late step in object file writing. While calculating these expressions, we need to update the linker script symbol table (inside the semantics object), and, thus, we are "modifying our context" as we prepare to write the file. http://reviews.llvm.org/D8157 llvm-svn: 232402
* [Mips] clang-format the codeSimon Atanasyan2015-03-161-3/+2
| | | | | | No functional changes. llvm-svn: 232364
* [Mips] Do not check the relocation type twiceSimon Atanasyan2015-03-161-10/+6
| | | | | | No functional changes. llvm-svn: 232363
* [Mips] Add `const` qualifier to some member functionsSimon Atanasyan2015-03-161-23/+23
| | | | | | No functional changes. llvm-svn: 232362
* [Mips] Implement R_MIPS_TLS_xxx relocation handling in case of N64 ABISimon Atanasyan2015-03-165-13/+48
| | | | llvm-svn: 232361
* [Mips] Implement R_MIPS_GOT_DISP/PAGE/OFST relocations handlingSimon Atanasyan2015-03-164-27/+99
| | | | llvm-svn: 232360
* [Mips] Group some cases in the switch statementSimon Atanasyan2015-03-161-9/+6
| | | | | | No functional changes. llvm-svn: 232359
* [ELF][ARM] Make gotSymbol a member.Shankar Easwaran2015-03-161-9/+5
| | | | | | | | | | | The gotSymbol need not be a global static variable. Apart from this reason, This variable was creating an issue with self hosting lld, as there seems to be an issue running global initializers, when initializing the guard for this static variable. Program received signal SIGTRAP, Trace/breakpoint trap. llvm-svn: 232341
* Use setVisibility() rather than assigning the value directly.Davide Italiano2015-03-142-4/+5
| | | | | | | We don't want to risk to override wrong st_other bits, and when we need to zero, we can do that explictly. llvm-svn: 232282
* Revert "[ELF] Change few static functions."Shankar Easwaran2015-03-142-3/+3
| | | | | | | | This reverts commit r232253. Fix comments from dblaikie. Since these functions dont access member state, its ok to be static. llvm-svn: 232271
* [ELF] Ability to resolve undefined symbols lazilyDenis Protivensky2015-03-145-47/+125
| | | | | | | | | Handle resolution of symbols coming from linked object files lazily. Add implementation of handling _GLOBAL_OFFSET_TABLE_ and __exidx_start/_end symbols for ARM platform. Differential Revision: http://reviews.llvm.org/D8159 llvm-svn: 232261
* [ELF] Change few static functions.Shankar Easwaran2015-03-142-3/+3
| | | | | | Functions hasOutputSegment/maybeGetSOName doesnot need not be static. llvm-svn: 232253
* [ELF] Rename .got.dyn to .gotShankar Easwaran2015-03-142-2/+2
| | | | | | Gnu doesnot creates only a .got section. llvm-svn: 232252
* [ELF] Fix DenseMapInfo for StringRefShankar Easwaran2015-03-141-1/+1
| | | | llvm-svn: 232251
* [ELF] Remove ambiguityShankar Easwaran2015-03-142-2/+2
| | | | | | Fix ambiguous finalize function. llvm-svn: 232250
* [ELF] Simplify appending chunks to segments.Shankar Easwaran2015-03-141-17/+10
| | | | | | | | The Segment Chunk had two functions one to append a section and one to append a chunk. A section is a subclass of a chunk and clearly this can be merged into one single function. llvm-svn: 232249
* LinkerScript: Add -T <scriptfile> optionMeador Inge2015-03-131-3/+3
| | | | | | | | | | | GNU LD has an option named -T/--script which allows a user to specify a linker script to be used [1]. LLD already accepts linker scripts without this option, but the option is widely used. Therefore it is best to support it in LLD as well. [1] https://sourceware.org/binutils/docs/ld/Options.html#Options llvm-svn: 232183
* LinkerScript: Add parsing of the EXTERN commandMeador Inge2015-03-121-0/+46
| | | | | | | | | This patch implements parsing of the GNU ld EXTERN command [1]. Evaluation will be added at a later point in time. [1] https://sourceware.org/binutils/docs/ld/Miscellaneous-Commands.html#Miscellaneous-Commands llvm-svn: 232110
* Rephrase find loop to use std::find_ifDavid Blaikie2015-03-121-11/+7
| | | | | | Avoids the need for an assert-only variable, among other benefits. llvm-svn: 232088
* [Mips] Make `readAddend` a virtual member function to escape explicitSimon Atanasyan2015-03-123-28/+27
| | | | | | | | template class instantiation No functional changes. llvm-svn: 232081
* Fix configure & make build by adding support for the ExampleSubTarget.Iain Sandoe2015-03-122-0/+17
| | | | llvm-svn: 232030
* Avoid an unused variable warning when assertions are offJustin Bogner2015-03-121-0/+1
| | | | | | Patch by Mike Edwards. Thanks! llvm-svn: 232015
* Fix a comparison function to actually be a SWO so that it conforms toChandler Carruth2015-03-111-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | the spec required by std::sort and friends. Ordering things this way also dramatically simplifies the code as short-circuit ensures we can skip all of the negative tests. I've left one FIXME where we're establishing a fairly arbitrary ordering. Previously, the function compared all types as equal except for the ones it explicitly handled, but it didn't delegate correctly to the atomflags when doing so, and so it would fail to be a SWO. The two possible fixes are to stop comparing the atom flags entirely, or to establish some arbitrary ordering of the types. Since it was pure luck which ordering of unequal types we ended up with previously (the caller was std::sort, not std::stable_sort) I chose to make the ordering explicit and guaranteed. This seems like the best conservative approach as I suspect we would want to switch to stable_sort otherwise in order to have deterministic output. Differential Revision: http://reviews.llvm.org/D8266 llvm-svn: 231968
* LinkerScript: Add parsing of the MEMORY commandMeador Inge2015-03-111-0/+120
| | | | | | | | | | | This patch implements parsing of the GNU ld MEMORY command [1]. The command and the memory block definitions are parsed as specified (including the slightly strange "o" and "l" keywords). Evaluation will be added at a later point in time. [1] https://sourceware.org/binutils/docs-2.25/ld/MEMORY.html llvm-svn: 231928
* Garbage collect an unused class in Atoms.hDavide Italiano2015-03-111-30/+0
| | | | | | | | | | This will be replaced by a more generic class to handle all the default symbols in an executable, e.g. __init_array. Differential Revision: http://reviews.llvm.org/D8234 Reviewed by: shankare llvm-svn: 231906
* Fix the local variable naming I used in r231765 to follow the LLD codingChandler Carruth2015-03-101-4/+4
| | | | | | conventions. Sorry for missing this before I committed the patch! llvm-svn: 231766
* Fix a bug where the code would use subscript a std::vector with the sizeChandler Carruth2015-03-101-6/+7
| | | | | | | | | | | | | | | | | | of the vector. For a vector 'v', '&v[v.size()]' isn't a valid way to compute a pointer one-past-the-end of the vector. Instead, write the loop in terms of iterators and save the beginning iterator. Once we have that we can compute the beginning pointer from the beginning iterator, and compute the distance which we should increment the beginning pointer by subtracting the iterators. What might be simpler would be to convert the function accepting a raw pointer for begin and end to accept iterators or a range or some other construct, but I wanted to keep this to a minimal bug-fix change. This fixes a crash on any debug STL implementation which checks for indexing out of bounds. llvm-svn: 231765
* Use template aliases.Rui Ueyama2015-03-106-50/+50
| | | | | | We dropped Visual Studio 2012 support, so we can use template aliases. llvm-svn: 231756
* Add SimpleAbsoluteAtom which is analogous to other Simple* atoms.Rui Ueyama2015-03-094-38/+5
| | | | llvm-svn: 231718
* Remove COFFReference and use SimpleReference instead.Rui Ueyama2015-03-095-62/+47
| | | | | | | SimpleReference, which is defined in Core, provides the same functionality as COFFReference does, so we don't need a custom class. llvm-svn: 231715
OpenPOWER on IntegriCloud