summaryrefslogtreecommitdiffstats
path: root/lld/lib/Driver
Commit message (Collapse)AuthorAgeFilesLines
...
* Add cmdline options for LC_DATA_IN_CODE load command.Pete Cooper2016-02-092-0/+55
| | | | | | | | | | | | Also added the defaults for whether to generate this load command, which the cmdline options are able to override. There was also a difference to ld64 which is fixed here in that ld64 will generate an empty data in code command if requested. rdar://problem/24472630 llvm-svn: 260191
* Generate LC_FUNCTION_STARTS load command.Pete Cooper2016-02-092-0/+54
| | | | | | | | | | | | | | This load command generates data in the LINKEDIT section which is a list of ULEB128 delta's to all of the functions in the __text section. It is then 0 terminated and pointer aligned to pad. ld64 exposes the -function-starts and no-function-starts cmdline options to override behaviour from the defaults based on file types. rdar://problem/24472630 llvm-svn: 260188
* Add support for the source_version cmdline option.Pete Cooper2016-02-042-0/+14
| | | | | | | | | This is of the form A.B.C.D.E and to match ld64's behaviour, is always output to files, even when the version is 0. rdar://problem/24472630 llvm-svn: 259746
* Default to an unknown OS instead of MacOSX.Pete Cooper2016-02-041-1/+1
| | | | | | | | | | | | Defaulting to unknown matches ld64, but it also makes sure that all of our code can handle not knowing the platform. For example, a later commit will add support for version min load commands with an unknown platform, which is a feature supported by ld64. No test case here. The next commit will have one with the version min code that needed this patch. llvm-svn: 259739
* Add support for -sdk_version cmdline option.Pete Cooper2016-02-032-0/+23
| | | | | | | | | | | | This option is emitted in the min_version load commands. Note, there's currently a difference in behaviour compared to ld64 in that we emit a warning if we generate a min_version load command and didn't give an sdk_version. We need to decide what the correct behaviour is here as its possible we want to emit an error and force clients to provide the option. llvm-svn: 259729
* Add generation of LC_VERSION_MIN load commands.Pete Cooper2016-02-032-0/+54
| | | | | | | | | | | | | If the command line contains something like -macosx_version_min and we don't explicitly disable generation with -no_version_load_command then we generate the LC_VERSION_MIN command in the output file. There's a couple of FIXME's in here. These will be handled soon with more tests but I didn't want to grow this patch any more than it already was. rdar://problem/24472630 llvm-svn: 259718
* ELF: Make link() to take an output stream to which error messages are written.Rui Ueyama2016-02-021-1/+1
| | | | | | http://reviews.llvm.org/D16668 llvm-svn: 259597
* Add command line option to disable ObjC category merging.Pete Cooper2016-02-012-0/+8
| | | | | | | | | | | This adds the no_objc_category_merging cmdline option which will be used in an upcoming commit to disable the category optimizer. It is on by default in ld64 so we match that here. Test case will come soon with the patch to make use of this option. llvm-svn: 259439
* ELF: Rename error -> fatal and redefine error as a non-noreturn function.Rui Ueyama2016-01-281-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In many situations, we don't want to exit at the first error even in the process model. For example, it is better to report all undefined symbols rather than reporting the first one that the linker picked up randomly. In order to handle such errors, we don't need to wrap everything with ErrorOr (thanks for David Blaikie for pointing this out!) Instead, we can set a flag to record the fact that we found an error and keep it going until it reaches a reasonable checkpoint. This idea should be applicable to other places. For example, we can ignore broken relocations and check for errors after visiting all relocs. In this patch, I rename error to fatal, and introduce another version of error which doesn't call exit. That function instead sets HasError to true. Once HasError becomes true, it stays true, so that we know that there was an error if it is true. I think introducing a non-noreturn error reporting function is by itself a good idea, and it looks to me that this also provides a gradual path towards lld-as-a-library (or at least embed-lld-to-your-program) without sacrificing code readability with lots of ErrorOr's. http://reviews.llvm.org/D16641 llvm-svn: 259069
* Add support for export_dynamic cmdline option and behaviour.Pete Cooper2016-01-222-1/+11
| | | | | | | | | | | This option matches the behaviour of ld64, that is it prevents globals from being dead stripped in executables and dylibs. Reviewed by Lang Hames Differential Revision: http://reviews.llvm.org/D16026 llvm-svn: 258554
* Add the GC commandline options and throw errors if they are usedPete Cooper2016-01-152-0/+22
| | | | llvm-svn: 257907
* [old ELF] Remove AMDGPU targetTom Stellard2016-01-112-2/+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
* Set CMake ADDITIONAL_HEADER_DIRS on libraries with headers in /include. NFC.Pete Cooper2016-01-071-0/+4
| | | | | | | | | | | In a UI such as XCode, it can group the headers for a library with that library. This is done in the CMakeLists.txt for the library itself by setting the path(s) as ADDITIONAL_HEADER_DIRS. LLVM already does this for all of its libraries, so just adding this to lld to make things easier. Should be NFC. llvm-svn: 257002
* Set the folder for libraries to 'lld libraries'. NFC.Pete Cooper2016-01-071-1/+1
| | | | | | | | | | | | In a UI such as XCode, LLVM source files are in 'libraries' while clang files are in 'clang libraries'. This change moves the lld source to 'lld libraries' to make code browsing easier. It should be NFC as the build itself is still the same, just the structure in a UI differs. llvm-svn: 257001
* Move parsing of LLVM options to parse() method.Pete Cooper2015-12-164-2/+15
| | | | | | | | | 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
* Rename ld.lld2 to ld.lld since it is the default.Rafael Espindola2015-11-181-1/+1
| | | | llvm-svn: 253437
* Make ELF2 the default.Rafael Espindola2015-11-171-2/+2
| | | | | | With this the only way to get the old elf linker is "-flavor old-elf". llvm-svn: 253318
* Rename gnu2 to gnu.Rafael Espindola2015-11-161-4/+4
| | | | | | This is the second step in making ELF2 the default. llvm-svn: 253270
* Rename the gnu flavour to gnu old.Rafael Espindola2015-11-161-9/+9
| | | | | | This is the first step in making ELF2 the default. llvm-svn: 253188
* Fix Clang-tidy modernize-use-auto warnings, other minor fixes.Eugene Zelenko2015-11-101-3/+3
| | | | | | Differential revision: http://reviews.llvm.org/D14553 llvm-svn: 252661
* [Driver] Ignore -G option in both new and old ELF linkerSimon Atanasyan2015-10-281-0/+3
| | | | | | | This is optimization option that make sense for MIPS targets. We can safely ignore it now. llvm-svn: 251519
* [Driver] Accept both -m <emulation> and -m<emulation>Simon Atanasyan2015-10-281-1/+1
| | | | | | | | | GNU linkers accept both variants and at least for MIPS target gcc passes joined variant of the '-m' option. Differential Revision: http://reviews.llvm.org/D14133 llvm-svn: 251497
* [lld][Darwin] Add support for the -sectcreate option.Lang Hames2015-10-242-2/+21
| | | | llvm-svn: 251183
* Update lld to match llvm r250901. OptTable constructor now takes an ↵Craig Topper2015-10-214-4/+4
| | | | | | ArrayRef. NFC llvm-svn: 250904
* Use ld.lld2 as a argv[0] alias.Rafael Espindola2015-10-021-1/+4
| | | | | | | | The reason for the name is so that we can run ./build/bin/clang -fuse-ld=lld2 test.o -o t llvm-svn: 249122
* [LLD] Fix Clang-tidy modernize-use-nullptr warnings; other minor cleanups.Rui Ueyama2015-10-021-2/+2
| | | | | | Patch from Eugene Zelenko! llvm-svn: 249111
* [lld][MachO] Initial implementation of -flat_namespace and -undefined.Lang Hames2015-09-282-0/+56
| | | | | | | | | This is a basic initial implementation of the -flat_namespace and -undefined options for LLD-darwin. It ignores several subtlties, but the result is close enough that we can now link LLVM (but not clang) on Darwin and pass all regression tests. llvm-svn: 248732
* [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-272-0/+2
| | | | | | | | | 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
* COFF: Remove lld-link2 alias.Rui Ueyama2015-08-071-2/+0
| | | | llvm-svn: 244358
* COFF: Remove the old COFF linker and make link an alias to link2.Rui Ueyama2015-08-065-1782/+2
| | | | | | It's time to remove old COFF linker because the new one is now complete. llvm-svn: 244226
* Port the error functions from ELF to COFF.Rafael Espindola2015-08-061-1/+2
| | | | | | | | | | | | | | | This has a few advantages * Less C++ code (about 300 lines less). * Less machine code (about 14 KB of text on a linux x86_64 build). * It is more debugger friendly. Just set a breakpoint on the exit function and you get the complete lld stack trace of when the error was found. * It is a more robust API. The errors are handled early and we don't get a std::error_code hot potato being passed around. * In most cases the error function in a better position to print diagnostics (it has more context). llvm-svn: 244215
* [ELF2] Add a new ELF linker based on the new PE/COFF linker.Michael J. Spencer2015-07-242-0/+6
| | | | | | Differential Revision: http://reviews.llvm.org/D11188 llvm-svn: 243161
* Revert ELF port. Posting to mailing list.Michael J. Spencer2015-07-141-4/+0
| | | | llvm-svn: 242118
* Initial ELF port.Michael J. Spencer2015-07-131-0/+4
| | | | | | | | This is a direct port of the new PE/COFF linker to ELF. It can take a single object file and generate a valid executable that executes at the first byte in the text section. llvm-svn: 242088
* [Mips] Support MIPS big-endian 32/64-bits targetsSimon Atanasyan2015-07-131-0/+7
| | | | llvm-svn: 242014
* Add missing dependencies for the CMake shared lld build.Benjamin Kramer2015-06-231-0/+1
| | | | llvm-svn: 240445
* Update for LLVM API change to return by InputArgList directly (rather than ↵David Blaikie2015-06-225-131/+129
| | | | | | by pointer) from ParseArgs llvm-svn: 240347
* Fix missed formatting in prior commit (mostly 80 cols violation and some ↵David Blaikie2015-06-225-25/+28
| | | | | | whitespace around *) llvm-svn: 240346
* ArrayRef-ify Driver::parse and related functions.David Blaikie2015-06-215-75/+69
| | | | llvm-svn: 240236
* ArrayRef-ify ParseArgsDavid Blaikie2015-06-215-9/+9
| | | | llvm-svn: 240235
* Simplify Pass::perform to take a SimpleFile& instead of unique_ptr<SimpleFile>&David Blaikie2015-06-191-1/+1
| | | | | | | | None of the implementations replace the SimpleFile with some other file, they just modify the SimpleFile in-place, so a direct reference to the file is sufficient. llvm-svn: 240167
* [lld] Allow LLD passes to return error codes.Lang Hames2015-06-191-1/+6
| | | | llvm-svn: 240147
* Update for llvm api change.Rafael Espindola2015-06-132-30/+4
| | | | llvm-svn: 239671
* COFF: Add a new PE/COFF port.Rui Ueyama2015-05-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an initial patch for a section-based COFF linker. The patch has 2300 lines of code including comments and blank lines. Before diving into details, you want to start from reading README because it should give you an overview of the design. All important things are written in the README file, so I write summary here. - The linker is already able to self-link on Windows. - It's significantly faster than the existing implementation. The existing one takes 5 seconds to link LLD on my machine, while the new one only takes 1.2 seconds, even though the new one is not multi-threaded yet. (And a proof-of-concept multi- threaded version was able to link it in 0.5 seconds.) - It uses much less memory (250MB vs. 2GB virtual memory space to self-host). - IMHO the new code is much simpler and easier to read than the existing PE/COFF port. http://reviews.llvm.org/D10036 llvm-svn: 238458
* [ELF] Add support for -z origin/now options.Davide Italiano2015-05-261-2/+6
| | | | | | Differential Revision: http://reviews.llvm.org/D9963 llvm-svn: 238169
OpenPOWER on IntegriCloud