summaryrefslogtreecommitdiffstats
path: root/lld/lib/Driver
Commit message (Collapse)AuthorAgeFilesLines
...
* [LLD] Add support for the -stack_size option to Darwin ld.Lang Hames2015-05-202-1/+22
| | | | llvm-svn: 237841
* [GNU] Remove -x/-X from the list of options to be implemented.Davide Italiano2015-04-291-2/+0
| | | | llvm-svn: 236149
* ELF: Simplify LinkerScript detection. NFC.Rui Ueyama2015-04-271-19/+3
| | | | llvm-svn: 235895
* Simplify parseMemberFiles to take a single file.Rafael Espindola2015-04-242-13/+12
| | | | llvm-svn: 235751
* Simplify now that there is only one file. NFC.Rafael Espindola2015-04-241-10/+10
| | | | llvm-svn: 235747
* Return ErrorOr<std::unique_ptr<File>>. NFC.Rafael Espindola2015-04-242-7/+8
| | | | llvm-svn: 235744
* Delete unnecessary generality in loadFile.Rafael Espindola2015-04-242-4/+9
| | | | | | | | | | | | | loadFile could load mulitple files just because yaml has a feature for putting multiple documents in one file. Designing a linker around what yaml can do seems like a bad idea to me. This patch changes it to read a single file. There are further improvements to be done to the api and they will follow shortly. llvm-svn: 235724
* [ARM] Update R_ARM_TARGET1 command line option names (remove prefix 'arm-')Leny Kholodov2015-04-222-13/+18
| | | | | | | | | | | Command line options --arm-target1-rel and --arm-target1-abs have been renamed to be compatible with GNU linkers. Two tests have been updated: test/elf/options/target-specific-args.test test/elf/ARM/rel-arm-target1.test Differential Revision: http://reviews.llvm.org/D9037 llvm-svn: 235499
* [GNU/ELF] Add support for -X/--discard-locals.Davide Italiano2015-04-202-0/+8
| | | | | | | | | | | There's (almost) never need to keep .L symbols around for production builds. In fact, the FreeBSD kernel explicitly specify -X beacuse the size impact (and the subsequent performance impact) might be significant, because we keep symbols in memory. I was tempted to make this the default, but I haven't (yet). PR: 23232 llvm-svn: 235357
* Accept --dynamic-linker <file>.Davide Italiano2015-04-191-1/+1
| | | | | | | | | Before we only accepted --dynamic-linker=<file> and -dynamic-linker <file> but older versions of GNU ld (e.g. 2.17.50) accept this other form, so try to be compatible. PR: 23233 llvm-svn: 235282
* [GNU/ELF] Add support for -x/--discard-all.Davide Italiano2015-04-182-0/+8
| | | | | PR: 23232 llvm-svn: 235247
* Define make_dynamic_error_code(const char *).Rui Ueyama2015-04-141-1/+1
| | | | | | | | | | | | The function took either StringRef or Twine. Since string literals are ambiguous when resolving the overloading, many code calls used this function with explicit type conversion. That led awkward code like make_dynamic_error_code(Twine("Error occurred")). This patch adds a function definition for string literals, so that you can directly call the function with literals. llvm-svn: 234841
* Revert r234649 "PECOFF: Use C++11 braced init list to make Version objects."Nico Weber2015-04-111-9/+10
| | | | | | | | | | | | | | This doesn't compile with MSVC 2013: include\lld/ReaderWriter/PECOFFLinkingContext.h(356) : error C2797: 'lld::PECOFFLinkingContext::_imageVersion': list initialization inside member initializer list or non-static data member initializer is not implemented include\lld/ReaderWriter/PECOFFLinkingContext.h(357) : error C2797: 'lld::PECOFFLinkingContext::_imageVersion': list initialization inside member initializer list or non-static data member initializer is not implemented llvm-svn: 234676
* PECOFF: Use C++11 braced init list to make Version objects.Rui Ueyama2015-04-101-10/+9
| | | | llvm-svn: 234649
* Attempt to fix buildbots.Rui Ueyama2015-04-101-1/+0
| | | | | | lldNative was removed in r234641. llvm-svn: 234646
* Remove the Native file format.Rui Ueyama2015-04-105-8/+1
| | | | | | | | | | | | | The Native file format was designed to be the fastest on-memory or on-disk file format for object files. The problem is that no one is working on that. No LLVM tools can produce object files in the Native, thus the feature of supporting the format is useless in the linker. This patch removes the Native file support. We can add it back if we really want it in future. llvm-svn: 234641
* [Mips] Add -pcrel-eh-reloc command line optionSimon Atanasyan2015-04-102-0/+22
| | | | | | | | This MIPS specific option controls R_MIPS_EH relocation handling. If -pcrel-eh-reloc is specified R_MIPS_EH relocation should be handled like R_MIPS_PC32 relocation. llvm-svn: 234635
* Merge MutableFile with SimpleFile.Rui Ueyama2015-04-071-1/+1
| | | | | | | | SimpleFile is the only derived class of MutableFile. This patch reduces the height of class hierarchy by removing MutableFile class. llvm-svn: 234354
* [GNU] Implement --enable-new-dtags/--disable-new-dtagsDavide Italiano2015-04-062-0/+10
| | | | | | | PR: 23036 Differential Revision: http://reviews.llvm.org/D8836 llvm-svn: 234240
* ELF: Merge ELFTargets.h with ELFLinkingContext.h.Rui Ueyama2015-04-041-1/+0
| | | | | | | | These functions are "constructors" of the LinkingContexts. We already have auxiliary classes and functions for ELFLinkingContext in the header. They fall in the same category. llvm-svn: 234082
* s/context/ctx/g on lib/Driver/Driver.cpp.Rui Ueyama2015-04-041-17/+17
| | | | llvm-svn: 234073
* ELF: Define mergeHeaderFlags to ELFLinkingContext.Rui Ueyama2015-04-041-1/+3
| | | | | | | | | | Only MIPS defined the member function, but this feature is not actually MIPS-specific. Also, the dependency to the MIPS-only member function prevented us from merging <Arch>ELF{Object,DSO}Reader classes. This patch moves the feature from MipsLinkingContext to LinkingContext. llvm-svn: 234068
* ELF: Remove partial class definitions of <Arch>LinkingContexts.Rui Ueyama2015-04-031-11/+7
| | | | | | | | | | | | | What we are doing in ELFTarget.h was dubious. In the file, we define partial classes of <Arch>LinkingContexts to declare only static member functions. We have different (complete) class definitions in other files. They would conflict if they exist in the same compilation unit (because the ones defined in ELFTarget.h has only static member functions). I don't think this was valid C++. http://reviews.llvm.org/D8797 llvm-svn: 234039
* [ARM] Implementation of R_ARM_TARGET1 relocationLeny Kholodov2015-04-032-0/+29
| | | | | | | | | | | | | This patch provides implementation of R_ARM_TARGET1 relocation with configuration of its behaviour from a command line. This patch provides two command line options for GnuLd driver: --arm-target1-rel and --arm-target1-abs (similar to ld option names with extra prefix 'arm-'). So user may choose which behaviour of R_ARM_TARGET1 is preferred for his implementation of libc. Differential Revision: http://reviews.llvm.org/D8707 llvm-svn: 234009
* [Gnu] Support an other form of defsym optionShankar Easwaran2015-04-011-3/+14
| | | | llvm-svn: 233782
* Remove Makefiles.Rui Ueyama2015-03-261-38/+0
| | | | | | | | Most developers prefer to not have them, and we agreed to remove them from LLD. http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-March/083368.html llvm-svn: 233313
* Rename align2 -> align.Rui Ueyama2015-03-261-3/+3
| | | | | | I believe "2" stands for log2. Just "align" would be appropriate now. llvm-svn: 233248
* Use arithmetic type to represent alignments (not in log2) everywhere.Rui Ueyama2015-03-261-1/+1
| | | | | | | This is the final step of conversion. Now log2 numbers are removed from everywhere! llvm-svn: 233246
* Use alignment values everywhere instead of log2.Rui Ueyama2015-03-261-1/+1
| | | | | | | | This patch defines implicit conversion between integers and PowerOf2 instances, so uses of the classes is now implicit and look like regular integers. Now we are ready to remove the scaffolding. llvm-svn: 233245
* Define an implicit constructor which takes actual alignment value to PowerOf2.Rui Ueyama2015-03-261-1/+1
| | | | | | | The new constructor's type is the same, but this one takes not a log2 value but an alignment value itself, so the meaning is totally differnet. llvm-svn: 233244
* Make PowerOf2's constructor private.Rui Ueyama2015-03-261-1/+1
| | | | | | | Ban conversion from integers to PowerOf2 even if explicit to make all places we create PowerOf2 instances visible. llvm-svn: 233243
* Remove implicit constructor and operator int from PowerOf2.Rui Ueyama2015-03-261-2/+2
| | | | | | | | | | This patch is to make instantiation and conversion to an integer explicit, so that we can mechanically replace all occurrences of the class with integer in the next step. Now get() returns an alignment value rather than its log2 value. llvm-svn: 233242
* Add a scaffolding to merge alignment representations.Rui Ueyama2015-03-261-1/+1
| | | | | | | | | | | | | | | | | We are using log2 values and values themselves to represent alignments. For example, alignment 8 is sometimes represented as 3 (8 == 2^3). We want to stop using log2 values. Because both types are regular arithmetic types, we cannot get help from a compiler to find places we mix two representations. That makes this merging work surprisingly hard because if I make a mistake, I'll just get wrong results at runtime (Yay types!). In this patch, I introduced a class to represents power-of-two values, which is basically an alias for an integer type. Once the migration is done, the class will be removed. llvm-svn: 233232
* Use llvm::isPowerOf2. NFC.Rui Ueyama2015-03-251-1/+1
| | | | llvm-svn: 233219
* [LinkerScript] Implement semantics for simple sections mappingsRafael Auler2015-03-161-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [ELF] Ability to resolve undefined symbols lazilyDenis Protivensky2015-03-141-2/+3
| | | | | | | | | 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
* LinkerScript: Add -T <scriptfile> optionMeador Inge2015-03-133-2/+12
| | | | | | | | | | | 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 evaluation of the EXTERN commandMeador Inge2015-03-121-0/+5
| | | | | | This patch implements evaluation of the GNU ld EXTERN command. llvm-svn: 232111
* Use range-based for loops to iterate over file nodes.Rui Ueyama2015-03-052-8/+4
| | | | | | | | | | | | I converted them to non-range-based loops in r226883 and r226893 because at that moment File::parse() may have side effects and may update the vector that the reference returned from LinkingContext::nodes(). Now File::parse() is free from side effects. We can use range-based loops again. llvm-svn: 231321
* Add missing includes for make_unique, lld edition.Benjamin Kramer2015-03-021-0/+1
| | | | llvm-svn: 230925
* Revert "PECOFF: Don't parse files in .drectve asynchronously."Rui Ueyama2015-03-011-4/+8
| | | | | | | | This reverts commit r228955. Previously files appear in a .drectve section are parsed synchronously to avoid threading issues. I believe it's now safe to do that asynchronously. llvm-svn: 230905
* PECOFF: Move a call of WinLinkDriver::parse from FileCOFF::doParse to ↵Rui Ueyama2015-02-271-10/+3
| | | | | | | | | | | | | | | FileCOFF::beforeLink In doParse, we shouldn't do anything that has side effects. That function may be called speculatively and possibly in parallel. We called WinLinkDriver::parse from doParse to parse a command line in a .drectve section. The parse function updates a linking context object, so it has many side effects. It was not safe to call that function from doParse. beforeLink is a function for a File object to do something that has side effects. Moving a call of WinLinkDriver::parse to there. llvm-svn: 230791
* PECOFF: allow more than one /alternatename for the same symbol.Rui Ueyama2015-02-261-1/+1
| | | | | | | | | | | Previously we have a string -> string map to keep the weak alias symbol mapping. Naturally we can't define more than one weak alias with that data structure. This patch is to allow multiple aliases for the same symbol by changing the map type to string -> set of string map. llvm-svn: 230702
* [Driver] Use paths explicitly provided by the -L option before default pathsSimon Atanasyan2015-02-261-4/+4
| | | | | | | | | User should be able to override default search paths using the -L option. http://reviews.llvm.org/D7902 llvm-svn: 230679
* Add Example Sub Target.Michael J. Spencer2015-02-262-0/+2
| | | | llvm-svn: 230594
* [ELF] Teach GNU Driver about --stats.Davide Italiano2015-02-222-1/+17
| | | | | | | | | | | | | This is mainly for back-compatibility with GNU ld. Ideally --stats should be a general option in LinkingContext, providing individual stats for every pass in the linking process. In the GNU driver, a better wording could be used, but there's no need to change it for now. Differential Revision: D7657 Reviewed by: ruiu llvm-svn: 230157
* Remove YAML/Native round-trip passes.Rui Ueyama2015-02-202-14/+0
| | | | | | | | | | | | | | | | | | | | The round-trip passes were introduced in r193300. The intention of the change was to make sure that LLD is capable of reading end writing such file formats. But that turned out to be yet another over-designed stuff that had been slowing down everyday development. The passes ran after the core linker and before the writer. If you had an additional piece of information that needs to be passed from front-end to the writer, you had to invent a way to save the data to YAML/Native. These passes forced us to do that even if that data was not needed to be represented neither in an object file nor in an executable/DSO. It doesn't make sense. We don't need these passes. http://reviews.llvm.org/D7480 llvm-svn: 230069
* Driver: Fix an incorrect use of llvm::NoneJustin Bogner2015-02-201-1/+1
| | | | | | This function returns a bool, so llvm::None doesn't make sense here. llvm-svn: 229997
* PECOFF: Don't parse files in .drectve asynchronously.Rui Ueyama2015-02-121-8/+4
| | | | | | | | | Looks like there's a race condition around here that caused LLD to crash on Windows. Currently we are parsing libraries specified by .drectve section asynchronously, and something is wrong in that process. Disable the feature for now to make buildbots happy. llvm-svn: 228955
* [ELF] Support --wrap optionShankar Easwaran2015-02-122-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | Use a wrapper function for symbol. Any undefined reference to symbol will be resolved to "__wrap_symbol". Any undefined reference to "__real_symbol" will be resolved to symbol. This can be used to provide a wrapper for a system function. The wrapper function should be called "__wrap_symbol". If it wishes to call the system function, it should call "__real_symbol". Here is a trivial example: void * __wrap_malloc (size_t c) { printf ("malloc called with %zu\n", c); return __real_malloc (c); } If you link other code with this file using --wrap malloc, then all calls to "malloc" will call the function "__wrap_malloc" instead. The call to "__real_malloc" in "__wrap_malloc" will call the real "malloc" function. llvm-svn: 228906
OpenPOWER on IntegriCloud