summaryrefslogtreecommitdiffstats
path: root/lld/lib/Driver/GnuLdDriver.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove the old ELF linker.Rafael Espindola2016-02-281-782/+0
| | | | | | I think it is clear by now that the new linker is viable. llvm-svn: 262158
* [old ELF] Remove AMDGPU targetTom Stellard2016-01-111-1/+0
| | | | | | | | | | | | Summary: This is no longer needed now that the new ELF implementation supports AMDGPU. Reviewers: ruiu, rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15954 llvm-svn: 257390
* Move parsing of LLVM options to parse() method.Pete Cooper2015-12-161-0/+4
| | | | | | | | | We used to parse the LLVM options in Driver::link. However, that is after parse() where we load files. By moving the LLVM option handling earlier, we can add DEBUG() to code such as MachONormalizedFileToAtoms.cpp and have it enabled correctly by '-mllvm --debug'. llvm-svn: 255819
* Update lld to match llvm r250901. OptTable constructor now takes an ↵Craig Topper2015-10-211-1/+1
| | | | | | ArrayRef. NFC llvm-svn: 250904
* [Mips] Rejects all --hash-style arguments except 'sysv' in case of MIPS targetSimon Atanasyan2015-09-161-1/+7
| | | | | | MIPS ABI supports only --hash-style=sysv variant. llvm-svn: 247796
* [Mips] Support two more MIPS linking emulation options ↵Simon Atanasyan2015-08-281-2/+2
| | | | | | elf32btsmipn32/elf32ltsmipn32 llvm-svn: 246336
* [Mips] Make "emulation" option less dependent on the "-target" option.Simon Atanasyan2015-08-281-11/+7
| | | | | | | Now it is possible to have mips-linux-gnu-ld executable and link MIPS 64-bit little-endian binaries providing -melf64ltsmip command line argument. llvm-svn: 246335
* ELF: Add AMDGPU ReaderWriterTom Stellard2015-08-271-0/+1
| | | | | | | | | This is a basic implementation that allows lld to emit binaries consumable by the HSA runtime. Differential Revision: http://reviews.llvm.org/D11267 llvm-svn: 246155
* Update for llvm api change.Rafael Espindola2015-08-131-1/+1
| | | | llvm-svn: 244856
* [LinkerScript] Process program header in PHDRS commandDenis Protivensky2015-08-121-1/+4
| | | | | | | | | | Add PT_PHDR segment depending on its availability in linker script's PHDRS command, fallback if no linker script is given. Handle FILEHDR, PHDRS and FLAGS attributes of program header. Differential Revision: http://reviews.llvm.org/D11589 llvm-svn: 244743
* [Mips] Support MIPS big-endian 32/64-bits targetsSimon Atanasyan2015-07-131-0/+7
| | | | llvm-svn: 242014
* Update for LLVM API change to return by InputArgList directly (rather than ↵David Blaikie2015-06-221-54/+53
| | | | | | by pointer) from ParseArgs llvm-svn: 240347
* Fix missed formatting in prior commit (mostly 80 cols violation and some ↵David Blaikie2015-06-221-6/+7
| | | | | | whitespace around *) llvm-svn: 240346
* ArrayRef-ify Driver::parse and related functions.David Blaikie2015-06-211-15/+14
| | | | llvm-svn: 240236
* ArrayRef-ify ParseArgsDavid Blaikie2015-06-211-2/+2
| | | | llvm-svn: 240235
* Update for llvm api change.Rafael Espindola2015-06-131-15/+2
| | | | llvm-svn: 239671
* [ELF] Add support for -z origin/now options.Davide Italiano2015-05-261-2/+6
| | | | | | Differential Revision: http://reviews.llvm.org/D9963 llvm-svn: 238169
* ELF: Simplify LinkerScript detection. NFC.Rui Ueyama2015-04-271-19/+3
| | | | llvm-svn: 235895
* [ARM] Update R_ARM_TARGET1 command line option names (remove prefix 'arm-')Leny Kholodov2015-04-221-9/+8
| | | | | | | | | | | 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-201-0/+3
| | | | | | | | | | | 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
* [GNU/ELF] Add support for -x/--discard-all.Davide Italiano2015-04-181-0/+3
| | | | | 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
* Remove the Native file format.Rui Ueyama2015-04-101-4/+0
| | | | | | | | | | | | | 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-101-0/+13
| | | | | | | | 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
* [GNU] Implement --enable-new-dtags/--disable-new-dtagsDavide Italiano2015-04-061-0/+4
| | | | | | | 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
* 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-031-0/+19
| | | | | | | | | | | | | 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
* [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
* LinkerScript: Add -T <scriptfile> optionMeador Inge2015-03-131-1/+2
| | | | | | | | | | | 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
* [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-261-0/+1
| | | | llvm-svn: 230594
* [ELF] Teach GNU Driver about --stats.Davide Italiano2015-02-221-1/+15
| | | | | | | | | | | | | 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
* [ELF] Support --wrap optionShankar Easwaran2015-02-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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
* [ELF] Add LinkingContext to the ELFReader.Shankar Easwaran2015-02-121-5/+2
| | | | | | | | | | | | | | | 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
* GNU: Rename parseZOption because it actually parses only -z max-page-size.Rui Ueyama2015-02-101-3/+3
| | | | llvm-svn: 228753
* GNU: Add --no-export-dynamic command line option.Rui Ueyama2015-02-101-2/+3
| | | | llvm-svn: 228749
* Driver: move non-positional parameters out of switch. NFC.Rui Ueyama2015-02-101-198/+172
| | | | llvm-svn: 228743
* GNU: Use StringRef::empty instead of a boolean flag.Rui Ueyama2015-02-101-8/+2
| | | | | | | This local variable name did not follow the style guide, and it is not actually needed. llvm-svn: 228722
* [ELF] Implement --strip-all/-sDavide Italiano2015-02-081-0/+5
| | | | | | | Differential Revision: D7489 Reviewed by: shankarke llvm-svn: 228533
* [Revert] [ELF] Determine default search directories from ContextShankar Easwaran2015-02-061-1/+13
| | | | | | | It looks like the Driver manages search path for each Target lld would support on the Gnu flavor. llvm-svn: 228440
* [Cleanup] Remove member functions added to support nostdlibShankar Easwaran2015-02-061-9/+7
| | | | | | No change in functionality. llvm-svn: 228379
* [ELF] Fix -nostdlib option.Shankar Easwaran2015-02-061-2/+8
| | | | | | | | | Only search library directories explicitly specified on the command line. Library directories specified in linker scripts (including linker scripts specified on the command line) are ignored. llvm-svn: 228375
* ELF: Support INPUT linker script directiveRui Ueyama2015-02-031-10/+16
| | | | | | | | | | INPUT directive is a variant of GROUP in the sense that that specifies a list of input files. The only difference is whether the entire file list is wrapped with a --start-group/--end-group or not. http://reviews.llvm.org/D7390 llvm-svn: 228060
* Make ELFLinkingContext own LinkerScript buffersRafael Auler2015-02-031-3/+6
| | | | | | | | | | | | | | Currently, no one owns script::Parser buffers, but yet ELFLinkingContext gets updated with StringRef pointers to data inside Parser buffers. Since this buffer is locally owned inside GnuLdDriver::evalLinkerScript(), as soon as this function finishes, all pointers in ELFLinkingContext that comes from linker scripts get invalid. The problem is that we need someone to own linker scripts data structures and, since ELFLinkingContext transports references to linker scripts data, we can simply make it also own all linker scripts data. Differential Revision: http://reviews.llvm.org/D7323 llvm-svn: 227975
* ELF: Improve linker script unit tests.Rui Ueyama2015-02-031-5/+4
| | | | | | | This patch is to enable to write unit tests for linker script with less boilerplate code. llvm-svn: 227902
* [ELF] Implement action for OUTPUT linker script commandDavide Italiano2015-02-021-3/+3
| | | | | | Reviewed by: ruiu, shankarke llvm-svn: 227787
* [ELF] Determine default search directories from Context.Shankar Easwaran2015-02-021-13/+2
| | | | | | | | Target specific LinkingContext's determine the default search directory. No change in functionality. llvm-svn: 227784
* [ELF] Implement semantic action for ENTRY linker script command.Davide Italiano2015-02-011-0/+2
| | | | | | Reviewed by: shankarke, ruiu llvm-svn: 227708
OpenPOWER on IntegriCloud