summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/ExecutableWriter.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove the old ELF linker.Rafael Espindola2016-02-281-157/+0
| | | | | | I think it is clear by now that the new linker is viable. llvm-svn: 262158
* [ELF] Move start/end atom method assignment to OutputELFWriter. NFCDenis Protivensky2015-05-211-25/+5
| | | | llvm-svn: 237886
* [ARM] Generation of .ARM.exidx/.ARM.extab sectionsLeny Kholodov2015-05-081-20/+25
| | | | | | | | | | | | This patch provides generation of .ARM.exidx & .ARM.extab sections which are used for unwinding. The patch adds new content type typeARMExidx for atoms from .ARM.exidx section and integration of atoms with such type to the ELF ReaderWriter. exidx.test has been added with checking of contents of .ARM.exidx section and .ARM.extab section. Differential Revision: http://reviews.llvm.org/D9324 llvm-svn: 236873
* [ELF] Mark linker defined symbols as .hidden when needed.Davide Italiano2015-05-011-6/+6
| | | | | | | | | | I noticed that gold mark these as hidden. While at it I rewrote the test for this feature to use yaml rather than an object file as input. Differential Revision: http://reviews.llvm.org/D9418 Reviewed by: ruiu llvm-svn: 236291
* [ELF] Simplify adding default atomsSimon Atanasyan2015-04-071-26/+23
| | | | | | | | | | | | | | | | | | | | | Now 'writer' creates an instance of `RuntimeFile` in the constructor, then populates the file in the virtual function `addDefaultAtoms`, then pass owning of this file to the caller of virtual function `createImplicitFiles`. First, we do not need to keep an instance of `RuntimeFile` so long. It is enough to create the file, right after that populate it and pass the owning. Second, relationship between `createImplicitFiles` and `addDefaultAtoms` is complicated. The `createImplicitFiles` might call `addDefaultAtoms`, overridden version of `addDefaultAtoms` might call base class `addDefaultAtoms`, and overridden version of `createImplicitFiles` might call base class `createImplicitFiles` as well as `addDefaultAtoms`. The patch solves both problems above. It creates and populates runtime files right in the createImplicitFiles(), removes `addDefaultAtoms` at all and does not keep references to runtime files in class fields. llvm-svn: 234347
* Replace the `createImplicitFiles` method return type with `void`Simon Atanasyan2015-04-061-3/+2
| | | | | | | All instances of the `createImplicitFiles` always return `true` and this return value is used nowhere. llvm-svn: 234205
* [ELF] Remove redundant forward class declarationsSimon Atanasyan2015-04-061-3/+0
| | | | | | No functional changes. llvm-svn: 234156
* [ELF] Delete empty TargetLayout class and rename DefaultLayout to TargetLayoutSimon Atanasyan2015-04-031-1/+1
| | | | | | No functional changes. llvm-svn: 234052
* ELF: Make findAbsoluteAtom return AtomLayout* instead of an iterator.Rui Ueyama2015-03-311-23/+20
| | | | | | | | | | | All calls of findAbsoluteAtoms seem a bit awkward because of the type of the function. It semantically returns a pointer to an AtomLayout or nothing, so I made the function return AtomLayout*. In this patch, I also expanded some "auto"s because their actual type were not obvious in their contexts. llvm-svn: 233769
* [ELF] Use override keyword instead of virtualSimon Atanasyan2015-03-301-6/+6
| | | | | | No functional changes. llvm-svn: 233550
* Rename ELFLinkingContext instances "ctx" intead of "context".Rui Ueyama2015-03-271-12/+12
| | | | llvm-svn: 233344
* [LinkerScript] Handle symbols defined in linker scriptsRafael Auler2015-03-161-2/+4
| | | | | | | | | | 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
* Use template aliases.Rui Ueyama2015-03-101-1/+1
| | | | | | We dropped Visual Studio 2012 support, so we can use template aliases. llvm-svn: 231756
* [ELF] Add LinkingContext to the ELFReader.Shankar Easwaran2015-02-121-1/+1
| | | | | | | | | | | | | | | This adds the LinkingContext parameter to the ELFReader. Previously the flags in that were needed in the Context was passed to the ELFReader, this made it very hard to access data structures in the LinkingContext when reading an ELF file. This change makes the ELFReader more flexible so that required parameters can be grabbed directly from the LinkingContext. Future patches make use of the changes. There is no change in functionality though. llvm-svn: 228905
* [ELF] Remove llvm::Twine usageShankar Easwaran2014-11-061-2/+2
| | | | llvm-svn: 221433
* [ELF] Use llvm::TwineShankar Easwaran2014-11-061-6/+2
| | | | llvm-svn: 221428
* Reapply [ELF] Only mark as DT_NEEDED libs that are strictly necessary (r219353)Rafael Auler2014-10-091-0/+5
| | | | | | | | | | | | | | | | | | | | When committed in r219353, this patch originally caused problems because it was not tested in debug build. In such scenarios, Driver.cpp adds two additional passes. These passes serialize all atoms via YAML and reads it back. Since the patch changed ObjectAtom to hold a new reference, the serialization was removing the extra data. This commit implements r219853 in another way, similar to the original MIPS way, by using a StringSet that holds the names of all copied atoms instead of directly holding a reference to the copied atom. In this way, this commit is simpler and eliminate the necessity of changing the DefinedAtom hierarchy to hold a new data. Reviewers: shankarke http://reviews.llvm.org/D5713 llvm-svn: 219449
* [ELF] Fix inclusion of weak symbols in the dynamic symbol tableRafael Auler2014-10-081-0/+9
| | | | | | | | | | | | | | | | | This commit implements in the X86_64 ELF lld backend yet another feature that was only available in the MIPS backend. However, this patch changes generic ELF classes to make it trivial for other ELF backends to use this logic too. When creating a dynamic executable that has dynamic relocations against weak undefined symbols, these symbols must be exported to the dynamic symbol table to seek a possible resolution at run time. A common use case is the __gmon_start__ weak glibc undefined symbol. Reviewer: shankarke http://reviews.llvm.org/D5571 llvm-svn: 219349
* [ELF] Implement --export-dynamic/-ERafael Auler2014-10-081-0/+20
| | | | | | | | | | | | | | | | | When creating a dynamic executable and receiving the -E flag, the linker should export all globally visible symbols in its dynamic symbol table. This commit also moves the logic that exports symbols in the dynamic symbol table from OutputELFWriter to the ExecutableWriter class. It is not correct to leave this at OutputELFWriter because DynamicLibraryWriter, another subclass of OutputELFWriter, already exports all symbols, meaning we can potentially end up with duplicated symbols in the dynamic symbol table when creating shared libs. Reviewers: shankarke http://reviews.llvm.org/D5585 llvm-svn: 219334
* [ELF] Make changes to all the targets supported currentlyShankar Easwaran2014-01-271-21/+18
| | | | | | | | X86_64,X86,PPC,Hexagon,Mips No change in functionality. llvm-svn: 200177
* [ELF] Customize a relocation table output format (rel / rela).Simon Atanasyan2014-01-241-3/+11
| | | | | | | | | | Add new virtual virtual function `isRelaOutputFormat` to the `ELFLinkingContext` class. Call this function everywhere we need to select a relocation table format. Patch reviewed by Shankar Easwaran and Rui Ueyama. llvm-svn: 199973
* Fix "don't" typos missed in previous commitAlp Toker2013-12-011-1/+1
| | | | llvm-svn: 196054
* [lld][InputGraph] Change the Resolver to use inputGraphShankar Easwaran2013-10-071-22/+22
| | | | | | | | | | | | Changes :- a) Functionality in InputGraph to insert Input elements at any position b) Functionality in the Resolver to use nextFile c) Move the functionality of assigning file ordinals to InputGraph d) Changes all inputs to MemoryBuffers e) Remove LinkerInput, InputFiles, ReaderArchive llvm-svn: 192081
* If .bss doesn't exist, set _end/end based on .data.Joerg Sonnenberger2013-09-141-0/+4
| | | | llvm-svn: 190753
* Rename TargetInfo -> LinkingContext.Rui Ueyama2013-08-061-7/+6
| | | | | | | | | Also change some local variable names: "ti" -> "context" and "_targetInfo" -> "_context". Differential Revision: http://llvm-reviews.chandlerc.com/D1301 llvm-svn: 187823
* [ELF] add -u/--undefined option, to define undefined symbolsShankar Easwaran2013-06-191-7/+13
| | | | llvm-svn: 184266
* [ELF] NMAGIC support : Find the BSS section to setup the virtual address of ↵Shankar Easwaran2013-06-121-9/+6
| | | | | | _end. llvm-svn: 183816
* This is my Driver refactoring patch. Nick Kledzik2013-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | The major changes are: 1) LinkerOptions has been merged into TargetInfo 2) LinkerInvocation has been merged into Driver 3) Drivers no longer convert arguments into an intermediate (core) argument list, but instead create a TargetInfo object and call setter methods on it. This is only how in-process linking would work. That is, you can programmatically set up a TargetInfo object which controls the linking. 4) Lots of tweaks to test suite to work with driver changes 5) Add the DarwinDriver 6) I heavily doxygen commented TargetInfo.h Things to do after this patch is committed: a) Consider renaming TargetInfo, given its new roll. b) Consider pulling the list of input files out of TargetInfo. This will enable in-process clients to create one TargetInfo the re-use it with different input file lists. c) Work out a way for Drivers to format the warnings and error done in core linking. llvm-svn: 178776
* [ELF] Interp section is only needed in dynamic executablesShankar Easwaran2013-03-201-4/+14
| | | | llvm-svn: 177483
* [lld] remove trailing whitespaceShankar Easwaran2013-03-141-3/+3
| | | | llvm-svn: 177079
* [ELF] Set values for bss_start and end symbols properly, If there are two ↵Shankar Easwaran2013-03-111-3/+3
| | | | | | load segments with RW permissions, bss_start and end may get set inappropriate llvm-svn: 176795
* [ELF] Create baseclass for all ELF writersShankar Easwaran2013-03-081-295/+24
| | | | llvm-svn: 176724
* [ELF] no functionality change, update dynamicTable functionalityShankar Easwaran2013-03-041-71/+4
| | | | llvm-svn: 176430
* [lld][ELF] rename to add new support in the ELF WriterShankar Easwaran2013-03-031-0/+467
llvm-svn: 176424
OpenPOWER on IntegriCloud