summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use unsigned long long instead of uint64_t to appease botsPete Cooper2016-02-041-1/+1
| | | | llvm-svn: 259748
* Add support for the source_version cmdline option.Pete Cooper2016-02-041-0/+29
| | | | | | | | | 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-18/+24
| | | | | | | | | | | | 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 export_dynamic cmdline option and behaviour.Pete Cooper2016-01-221-2/+4
| | | | | | | | | | | 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 an ObjCPass to the MachO linker.Pete Cooper2016-01-191-0/+10
| | | | | | | | | This pass currently emits an objc image info section if one is required. This section contains the aggregated version and flags for all of the input files. llvm-svn: 258197
* Set the objc constraint on the context based on the parsed files.Pete Cooper2016-01-191-0/+35
| | | | | | | | | | | | Like arch, os, etc, when we know we are going to use a file, we check that the file has compatible objc constraints to the context, throw appropriate errors where that is not the case, and hopefully set the objc constraints on the context for use later. Added 2 tests to ensure that we don't have incompatibilities between host and simulator code as both will get x86 based architectures. llvm-svn: 258173
* Cache the objc image info constraints in file.Pete Cooper2016-01-191-5/+4
| | | | | | | | | | Image info flags describe the objc constraint which is GC/retain/release/etc. These need to be parsed and stored in the file so that we can do error checking. That will come in a later commit. llvm-svn: 258160
* Add checking of differing swift versions in input files.Pete Cooper2016-01-161-0/+11
| | | | | | | Swift versions are part of the objc image info section, and must match for all files linked which actually have an image info section llvm-svn: 257964
* Check for mismatched arch and OS when linking MachO files.Pete Cooper2016-01-141-0/+24
| | | | | | | | | | | | This patch makes use of the handleLoadedFile hook added in r257814. That method is used to check the arch and the OS of the files we are linking against the arch and OS on the context. The first test to use this ensures that we do not try to combine i386 Mac OS code with i386 simulator code. llvm-svn: 257837
* Add handleLoadedFile hook to the context.Pete Cooper2016-01-141-0/+4
| | | | | | | | | | | | | | This is called from the resolver on each file we decide we actually want to use. Future commits will make use of this to extract useful information from the files and do error checking against the context. For example, ensure that files are the same arch as each other. Reviewed by Lang Hames. Differential Revision: http://reviews.llvm.org/D16093 llvm-svn: 257814
* [lld][Darwin] Add support for the -sectcreate option.Lang Hames2015-10-241-0/+15
| | | | llvm-svn: 251183
* [LLD] Fix Clang-tidy modernize-use-nullptr warnings; other minor cleanups.Rui Ueyama2015-10-021-16/+1
| | | | | | Patch from Eugene Zelenko! llvm-svn: 249111
* [lld][MachO] Fix a think-o to get the twolevel/dynamic_lookup test passing.Lang Hames2015-09-281-6/+4
| | | | llvm-svn: 248736
* [lld][MachO] Initial implementation of -flat_namespace and -undefined.Lang Hames2015-09-281-1/+13
| | | | | | | | | 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
* [LLD][MachO] Fix a FIXME: Subtract base address from atom address when buildingLang Hames2015-09-211-0/+3
| | | | | | export trie. llvm-svn: 248217
* [lld] Add MachO thread-local storage support.Lang Hames2015-06-231-0/+13
| | | | | | | | This allows LLD to correctly link MachO objects that use thread-local storage. Differential Revision: http://reviews.llvm.org/D10578 llvm-svn: 240454
* [lld] Make the MachO -stack_size default '0', add a test case.Lang Hames2015-05-221-1/+1
| | | | | | Addresses some review comments for r237841. llvm-svn: 237979
* [LLD] Add support for the -stack_size option to Darwin ld.Lang Hames2015-05-201-3/+3
| | | | llvm-svn: 237841
* [LLD] Add a mutex to prevent concurrent modification of the dylib maps inLang Hames2015-05-131-0/+1
| | | | | | MachOLinkingContext. llvm-svn: 237217
* Use MemoryBufferRef instead of MemoryBuffer&. NFC.Rafael Espindola2015-04-271-3/+2
| | | | | | This just reduces the noise from another patch. llvm-svn: 235933
* Simplify now that there is only one file. NFC.Rafael Espindola2015-04-241-6/+4
| | | | llvm-svn: 235747
* Return ErrorOr<std::unique_ptr<File>>. NFC.Rafael Espindola2015-04-241-3/+4
| | | | llvm-svn: 235744
* Delete unnecessary generality in loadFile.Rafael Espindola2015-04-241-2/+4
| | | | | | | | | | | | | 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
* Replace the `createImplicitFiles` method return type with `void`Simon Atanasyan2015-04-061-2/+2
| | | | | | | All instances of the `createImplicitFiles` always return `true` and this return value is used nowhere. llvm-svn: 234205
* Rename align2 -> align.Rui Ueyama2015-03-261-4/+4
| | | | | | 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-2/+2
| | | | | | | This is the final step of conversion. Now log2 numbers are removed from everywhere! llvm-svn: 233246
* Remove implicit constructor and operator int from PowerOf2.Rui Ueyama2015-03-261-4/+1
| | | | | | | | | | 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-2/+2
| | | | | | | | | | | | | | | | | 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
* [ELF] Ability to resolve undefined symbols lazilyDenis Protivensky2015-03-141-1/+1
| | | | | | | | | 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
* [MachO] Use setter for globalsAreDeadStripRoots. NFC intended.Davide Italiano2015-03-091-2/+2
| | | | llvm-svn: 231629
* Add missing includes for make_unique, lld edition.Benjamin Kramer2015-03-021-0/+1
| | | | llvm-svn: 230925
* Remove YAML/Native round-trip passes.Rui Ueyama2015-02-201-1/+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
* [ELF] Demangle: don't expose raw info when getter is available.Davide Italiano2015-02-181-1/+1
| | | | | | | Differential Revision: D7693 Reviewed by: shankarke llvm-svn: 229635
* MachO: Move LayoutPass to MachO directory.Rui Ueyama2015-02-051-8/+2
| | | | | | | | | | | | | | | | | | | | | | The real user of the LayoutPass is now only Mach-O, so move that pass out of the common directory to Mach-O directory. "Core" architecture were using the LayoutPass. I modified that to use a simple OrderPass. I think no one actually have authority what feature should be in Core and what's not, but I believe the LayoutPass is not very suitable for Core. Before more code starts depending on the complex pass, it's better to remove that from Core. I could have simplified that pass because Mach-O is the only user of the LayoutPass. For example, the second parameter of the LayoutPass constructor can be converted from optional to mandatory. I didn't do that in this patch to keep it simple. I'll do in a followup patch. http://reviews.llvm.org/D7311 llvm-svn: 228341
* [MachO] Remove dependency on lldDriverGreg Fitzgerald2015-01-231-2/+20
| | | | | | | | | Moved getMemoryBuffer from DarwnLdDriver to MachOLinkingContext. lldMachO shared library target now builds. Differential Review: http://reviews.llvm.org/D7155 llvm-svn: 226963
* Fix five of the shared library build targetsGreg Fitzgerald2015-01-211-2/+2
| | | | | | | | | | | | | | | | | | Before this patch there was a cyclic dependency between lldCore and lldReaderWriter. Only lldConfig could be built as a shared library. * Moved Reader and Writer base classes into lldCore. * The following shared libraries can now be built: lldCore lldYAML lldNative lldPasses lldReaderWriter Differential Revision: http://reviews.llvm.org/D7105 From: Greg Fitzgerald <garious@gmail.com> llvm-svn: 226732
* Simplify.Rui Ueyama2015-01-151-7/+5
| | | | llvm-svn: 226153
* Remove InputGraph and use std::vector<Node> instead.Rui Ueyama2015-01-151-2/+1
| | | | | | In total we have removed more than 1000 lines! llvm-svn: 226149
* Rename InputElement Node.Rui Ueyama2015-01-151-6/+6
| | | | | | | | | InputElement was named that because it's an element of an InputGraph. It's losing the origin because the InputGraph is now being removed. InputElement's subclass is FileNode, that naming inconsistency needed to be fixed. llvm-svn: 226147
* Remove InputGraph::size().Rui Ueyama2015-01-151-1/+1
| | | | llvm-svn: 226140
* Re-commit r225766, r225767, r225769, r225814, r225816, r225829, and r225832.Rui Ueyama2015-01-151-3/+1
| | | | | | | These changes depended on r225674 and had been rolled back in r225859. Because r225674 has been re-submitted, it's safe to re-submit them. llvm-svn: 226132
* Re-commit r225674: Convert other drivers to use WrapperNode.Rui Ueyama2015-01-151-12/+12
| | | | | | | | 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
* [cleanup] Re-sort #include lines using llvm/utils/sort_includes.pyChandler Carruth2015-01-141-1/+1
| | | | | | | | This is just a mechanical cleanup, no functionality changed. This just fixes very minor inconsistencies with how #include lines were spaced and sorted in LLD. llvm-svn: 225978
* Revert "Convert other drivers to use WrapperNode" and subsequent commits.Rui Ueyama2015-01-141-11/+15
| | | | | | | r225764 broke a basic functionality on Mac OS. This change reverts r225764, r225766, r225767, r225769, r225814, r225816, r225829, and r225832. llvm-svn: 225859
* Replace vector<unique_ptr<File> with unique_ptr<File>.Rui Ueyama2015-01-131-3/+1
| | | | | | | Because each InputElement has exactly one File, we no longer have to use a vector to store pointers to Files. llvm-svn: 225814
* Convert other drivers to use WrapperNode.Rui Ueyama2015-01-131-12/+10
| | | | llvm-svn: 225764
* [macho] -rpath supportJean-Daniel Dupas2014-12-181-0/+4
| | | | | | | | | | | | | | | | | | | | | 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-0/+32
| | | | llvm-svn: 223867
* Revert "Rewrite InputGraph's Group"Rui Ueyama2014-12-041-32/+0
| | | | | | | | 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-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud