summaryrefslogtreecommitdiffstats
path: root/lld/lib/Driver/DarwinLdDriver.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix missed formatting in prior commit (mostly 80 cols violation and some ↵David Blaikie2015-06-221-1/+1
| | | | | | whitespace around *) llvm-svn: 240346
* ArrayRef-ify Driver::parse and related functions.David Blaikie2015-06-211-6/+5
| | | | llvm-svn: 240236
* ArrayRef-ify ParseArgsDavid Blaikie2015-06-211-2/+2
| | | | llvm-svn: 240235
* [LLD] Add support for the -stack_size option to Darwin ld.Lang Hames2015-05-201-1/+18
| | | | llvm-svn: 237841
* Simplify parseMemberFiles to take a single file.Rafael Espindola2015-04-241-2/+2
| | | | 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-241-4/+4
| | | | llvm-svn: 235744
* Delete unnecessary generality in loadFile.Rafael Espindola2015-04-241-2/+5
| | | | | | | | | | | | | 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
* Remove the Native file format.Rui Ueyama2015-04-101-1/+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
* 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
* [MachO] Remove dependency on lldDriverGreg Fitzgerald2015-01-231-21/+1
| | | | | | | | | Moved getMemoryBuffer from DarwnLdDriver to MachOLinkingContext. lldMachO shared library target now builds. Differential Review: http://reviews.llvm.org/D7155 llvm-svn: 226963
* Remove InputGraph and use std::vector<Node> instead.Rui Ueyama2015-01-151-16/+11
| | | | | | In total we have removed more than 1000 lines! llvm-svn: 226149
* Remove InputGraph::addInputElement{,Front}.Rui Ueyama2015-01-151-1/+1
| | | | | | | | They were the last member functions of InputGraph (besides members()). Now InputGraph is just a container of a vector. We are ready to replace InputGraph with plain File vector. llvm-svn: 226146
* Remove WrapperNode.Rui Ueyama2015-01-151-2/+1
| | | | | | | WrapperNode was a useless subclass of FileNode. We should just use FileNode instead. llvm-svn: 226145
* Remove InputGraph::size().Rui Ueyama2015-01-151-1/+1
| | | | llvm-svn: 226140
* Re-commit r225674: Convert other drivers to use WrapperNode.Rui Ueyama2015-01-151-31/+80
| | | | | | | | The original commit had an issue with Mac OS dylib files. It didn't handle fat binary dylib files correctly. This patch includes a fix. A test for that case has already been committed in r225764. llvm-svn: 226123
* Revert "Convert other drivers to use WrapperNode" and subsequent commits.Rui Ueyama2015-01-141-78/+31
| | | | | | | r225764 broke a basic functionality on Mac OS. This change reverts r225764, r225766, r225767, r225769, r225814, r225816, r225829, and r225832. llvm-svn: 225859
* Convert other drivers to use WrapperNode.Rui Ueyama2015-01-131-31/+78
| | | | llvm-svn: 225764
* [macho] -rpath supportJean-Daniel Dupas2014-12-181-0/+28
| | | | | | | | | | | | | | | | | | | | | Summary: Work on adding -rpath support to the mach-o linker. This patch is based on the ld64 behavior for the command line option validation. It includes a basic test to check that the LC_RPATH load commands are properly generated when that option is used. It also add LC_RPATH support to the binary reader, but I don't know how to test it though. Reviewers: kledzik Subscribers: llvm-commits Projects: #lld Differential Revision: http://reviews.llvm.org/D6724 llvm-svn: 224544
* Re-commit r223330: Rewrite InputGraph's GroupRui Ueyama2014-12-101-3/+3
| | | | llvm-svn: 223867
* Revert "Rewrite InputGraph's Group"Rui Ueyama2014-12-041-3/+3
| | | | | | | | This reverts commit r223330 because it broke Darwin and ELF linkers in a way that we couldn't have caught with the existing test cases. llvm-svn: 223373
* Rewrite InputGraph's GroupRui Ueyama2014-12-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The aim of this patch is to reduce the excessive abstraction from the InputGraph. We found that even a simple thing, such as sorting input files (Mach-O) or adding a new file to the input file list (PE/COFF), is nearly impossible with the InputGraph abstraction, because it hides too much information behind it. As a result, we invented complex interactions between components (e.g. notifyProgress() mechanism) and tricky code to work around that limitation. There were many occasions that we needed to write awkward code. This patch is a first step to make it cleaner. As a first step, this removes Group class from the InputGraph. The grouping feature is now directly handled by the Resolver. notifyProgress is removed since we no longer need that. I could have cleaned it up even more, but in order to keep the patch minimum, I focused on Group. SimpleFileNode class, a container of File objects, is now limited to have only one File. We shold have done this earlier. We used to allow putting multiple File objects to FileNode. Although SimpleFileNode usually has only one file, the Driver class actually used that capability. I modified the Driver class a bit, so that one FileNode is created for each input File. We should now probably remove SimpleFileNode and directly store File objects to the InputGraph in some way, because a container that can contain only one object is useless. This is a TODO. Mach-O input files are now sorted before they are passe to the Resolver. DarwinInputGraph class is no longer needed, so removed. PECOFF still has hacky code to add a new file to the input file list. This will be cleaned up in another patch. llvm-svn: 223330
* [mach-o] Add support for -order_file optionNick Kledzik2014-11-071-0/+65
| | | | | | | | | | | The darwin linker lets you rearrange functions and data for better locality (less paging). You do this with the -order_file option which supplies a text file containing one symbol per line. Implementing this required a small change to LayoutPass to add a custom sorter hook. llvm-svn: 221545
* remove unneeded { }Nick Kledzik2014-11-061-2/+1
| | | | llvm-svn: 221478
* [mach-o] Add support for -force_load optionNick Kledzik2014-11-061-0/+3
| | | | | | | | The darwin linker has two ways to force all members of an archive to be loaded. The -all_load option applies to all static libraries. The -force_load takes a path to a library and just that library's members are force loaded. llvm-svn: 221477
* [mach-o] Add support for -S optionNick Kledzik2014-11-061-0/+5
| | | | | | | | | | | | The darwin linker does not process dwarf debug info. Instead it produces a "debug map" in the output file which points back to the original .o files for anything that wants debug info (e.g. debugger). The -S option means "don't add a debug map". lld for mach-o currently does not generate the debug map, so there is nothing to do when this option is used. But we need to process the option to get existing projects building. llvm-svn: 221432
* [mach-o] Turn -single_module error into a warningNick Kledzik2014-10-281-2/+2
| | | | | | To be more compatible with existing darwin linker. llvm-svn: 220822
* Subclass InputGraph to get darwin linker library semanticsNick Kledzik2014-10-211-3/+3
| | | | | | | | | | | | | | | | | | | The darwin linker operates differently than the gnu linker with respect to libraries. The darwin linker first links in all object files from the command line, then to resolve any remaining undefines, it repeatedly iterates over libraries on the command line until either all undefines are resolved or no undefines were resolved in the last pass. When Shankar made the InputGraph model, the plan for darwin was for the darwin driver to place all libraries in a group at the end of the InputGraph. Thus making the darwin model a subset of the gnu model. But it turns out that does not work because the driver cannot tell if a file is an object or library until it has been loaded, which happens later. This solution is to subclass InputGraph for darwin and just iterate the graph the way darwin linker needs. llvm-svn: 220330
* Sort include files according to convention.Shankar Easwaran2014-10-181-2/+1
| | | | llvm-svn: 220131
* [mach-o] Add support for upward linkingNick Kledzik2014-10-161-11/+26
| | | | | | | | To deal with cycles in shared library dependencies, the darwin linker supports marking specific link dependencies as "upward". An upward link is when a lower level library links against a higher level library. llvm-svn: 219949
* [mach-o] Add support for -dependency_info command line optionNick Kledzik2014-10-041-0/+12
| | | | | | | | | | | This option is added by Xcode when it runs the linker. It produces a binary file which contains the file the linker used. Xcode uses the info to dynamically update it dependency tracking. To check the content of the binary file, the test case uses a python script to dump the binary file as text which FileCheck can check. llvm-svn: 219039
* Add MachOLinkingContext parameter to MachOFileNode constructor.Nick Kledzik2014-10-011-6/+6
| | | | | | | | | | | No functionality change. This removes a down-cast from LinkingContext to MachOLinkingContext. Also, remove const from LinkingContext::createImplicitFiles() to remove the need for another const cast. Seems reasonable for createImplicitFiles() to need to modify the context (MachOLinkingContext does). llvm-svn: 218796
* [mach-o] Implement -demangle.Nick Kledzik2014-09-301-0/+4
| | | | | | | | | | | | | | The darwin linker has the -demangle option which directs it to demangle C++ (and soon Swift) mangled symbol names. Long term we need some Diagnostics object for formatting errors and warnings. But for now we have the Core linker just writing messages to llvm::errs(). So, to enable demangling, I changed the Resolver to call a LinkingContext method on the symbol name. To make this more interesting, the demangling code is done via __cxa_demangle() which is part of the C++ ABI, which is only supported on some platforms, so I had to conditionalize the code with the config generated HAVE_CXXABI_H. llvm-svn: 218718
* Make anonymous namespace as small as possible.Rui Ueyama2014-09-121-13/+13
| | | | | | | | | LLVM coding style says that "static" is preferred for file-scope functions. Differential Revision: http://reviews.llvm.org/D5323 llvm-svn: 217692
* [mach-o] support "0x" or "0X" as prefix on hex numbers on command lineNick Kledzik2014-09-121-5/+9
| | | | | | This matches the strtoull() behavior in ld64. llvm-svn: 217650
* [mach-o]: support optional "0x" prefix for -image_baseTim Northover2014-09-111-1/+5
| | | | llvm-svn: 217578
* [mach-o]: tighten up diagnostics for -image_base optionTim Northover2014-09-111-0/+4
| | | | | | | | | The provided base must also be a multiple of the system's page size, which is a reasonable enough demand. Also check the other diagnostics more thoroughly. llvm-svn: 217577
* [MSVC]: use StringRef::getAsInteger instead of strtoullTim Northover2014-09-101-5/+3
| | | | | | This keeps non-conformant MSVC implementations happy. llvm-svn: 217491
* [mach-o]: implement -image_base option on Darwin.Tim Northover2014-09-101-0/+15
| | | | | | | As suggested by Nick, this will make __unwind_info implementation more natural, and it'd have to be done at some point anyway. llvm-svn: 217486
* [mach-o] Fix missing { }Nick Kledzik2014-09-091-1/+2
| | | | llvm-svn: 217411
* [mach-o] Fix so no options causes usage message to be printedNick Kledzik2014-09-091-5/+5
| | | | llvm-svn: 217409
* [mach-o] Add support for -pie and -no_pieNick Kledzik2014-09-091-0/+46
| | | | | | | | | There is a bit (MH_PIE) in the flags field of the mach_header which tells the kernel is a program was built position independent (for ASLR). The linker automatically attempts to build programs PIE if they are built for a recent OS version. But the -pie and -no_pie options override that default behavior. llvm-svn: 217408
* [mach-o] Let darwin driver infer arch from .o files if -arch not used.Nick Kledzik2014-09-041-0/+14
| | | | | | | | | | | | | | | | Mach-O has a "fat" (or "universal") variant where the same contents built for different architectures are concatenated into one file with a table-of-contents header at the start. But this leaves a dilemma for the linker - which architecture to use. Normally, the linker command line -arch is used to force which slice of any fat files are used. The clang compiler always passes -arch to the linker when invoking it. But some Makefiles invoke the linker directly and don’t specify the -arch option. For those cases, the linker scans all input files in command line order and finds the first non-fat object file. Whatever architecture it is becomes the architecture for the link. llvm-svn: 217189
OpenPOWER on IntegriCloud