summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [mach-o] propagate dylib version numbersNick Kledzik2014-11-191-6/+6
| | | | | | | | | | | | | | Mach-o does not use a simple SO_NEEDED to track dependent dylibs. Instead, the linker copies four things from each dylib to each client: the runtime path (aka "install name"), the build time, current version (dylib build number), and compatibility version The build time is no longer used (it cause every rebuild of a dylib to be different). The compatibility version is usually just 1.0 and never changes, or the dylib becomes incompatible. This patch copies that information into the NormalizedMachO format and propagates it to clients. llvm-svn: 222300
* [mach-o] zero-fill sections have no file offsetNick Kledzik2014-11-181-9/+17
| | | | | | | In mach-o, sections of type S_ZEROFILL are special cased and to always have their section.offset field be zero. llvm-svn: 222202
* [mach-o] Fix lazy binding offsetsNick Kledzik2014-11-111-2/+11
| | | | | | | | | | The way lazy binding works in mach-o is that the linker generates a helper function and has the stub (PLT) initially jump to it. The helper function pushes an extra parameter then jumps into dyld. The extra parameter is an offset into the lazy binding info where dyld will find the information about which symbol to bind and way lazy binding pointer to update. llvm-svn: 221654
* [mach-o] generate LC_DATA_IN_CODE in final linked imagesNick Kledzik2014-10-281-0/+18
| | | | | | | | | lld was regenerating LC_DATA_IN_CODE in .o output files, but not into final linked images. Update test case to verify data-in-code info makes it into final linked images. llvm-svn: 220827
* [mach-o] Support data-only dylibsNick Kledzik2014-10-241-0/+3
| | | | | | | | In final linked shared images, the __TEXT segment contains both code and the mach-o header/load-commands. In the case of a data-only dylib, there is no code, so we need to force the addition of the __TEXT segment. llvm-svn: 220597
* Sort include files according to convention.Shankar Easwaran2014-10-181-1/+1
| | | | llvm-svn: 220131
* [mach-o] Add support for upward linkingNick Kledzik2014-10-161-1/+1
| | | | | | | | 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 arm64 (AAarch64)Nick Kledzik2014-09-091-11/+19
| | | | | | | | | | Most of the changes are in the new file ArchHandler_arm64.cpp. But a few things had to be fixed to support 16KB pages (instead of 4KB) which iOS arm64 requires. In addition the StubInfo struct had to be expanded because arm64 uses two instruction (ADRP/LDR) to load a global which requires two relocations. The other mach-o arches just needed one relocation. llvm-svn: 217469
* [mach-o] Add support for using export triesNick Kledzik2014-09-031-4/+236
| | | | | | | | | | | On Darwin at runtime, dyld will prefer to use the export trie of a dylib instead of the traditional symbol table (which is large and requires a binary search). This change enables the linker to generate an export trie and to prefer it if found in a dylib being linked against. This also simples the yaml for dylibs because the yaml form of the trie can be reduced to just a sequence of names. llvm-svn: 217066
* [mach-o] Add support for -sectalign optionNick Kledzik2014-07-301-1/+7
| | | | | | | | | | | | The -sectalign option is used to increase the alignment required for a section. It required some reworking of how the __TEXT segment is laid out because that segment also contains the mach_header and load commands. And the size of load commands depend on the number of segments, sections, and dependent dylibs used. Using this option will simplify some future test cases because the final address of code can be pinned down, making tests of its content easier. llvm-svn: 214268
* [mach-o] Add support for LC_DATA_IN_CODENick Kledzik2014-07-241-5/+46
| | | | | | | | | | | | | | Sometimes compilers emit data into code sections (e.g. constant pools or jump tables). These runs of data can throw off disassemblers. The solution in mach-o is that ranges of data-in-code are encoded into a table pointed to by the LC_DATA_IN_CODE load command. The way the data-in-code information is encoded into lld's Atom model is that that start and end of each data run is marked with a Reference whose offset is the start/end of the data run. For arm, the switch back to code also marks whether it is thumb or arm code. llvm-svn: 213901
* [mach-o] add representation for LC_ID_DYLIB to MachONormalizedFileTim Northover2014-07-011-1/+24
| | | | | | | It still needs to be tied into BinaryReader, but this allows reasonably sensible creation of SharedLibrary atoms on MachO. llvm-svn: 212093
* MachO: calculate segment offsets in final MachO files properly.Tim Northover2014-06-301-6/+16
| | | | | | | | | Because of how we were calculating fileOffset and fileSize for segments, most ended up at a single offset in a finalised MachO file. This meant the data often didn't even get written in the final object, let alone where it would be useful. llvm-svn: 212030
* Left two files out of the previous commitArtyom Skrobov2014-06-141-2/+2
| | | | llvm-svn: 210975
* Update for llvm api change.Rafael Espindola2014-06-131-3/+4
| | | | llvm-svn: 210919
* include system_error directly.Rafael Espindola2014-06-121-1/+1
| | | | llvm-svn: 210801
* Run llvm/utils/sort_includes.py in a few files.Rafael Espindola2014-06-121-3/+0
| | | | | | This will reduce the noise in a followup patch. llvm-svn: 210800
* Don't import error_code into the lld namespace.Rafael Espindola2014-06-121-22/+15
| | | | llvm-svn: 210785
* Don't use make_error_code from the llvm namespace.Rafael Espindola2014-06-121-3/+3
| | | | llvm-svn: 210741
* Use std::error_code instead of llvm::error_code.Rafael Espindola2014-06-111-3/+3
| | | | | | This is an update for a llvm api change. llvm-svn: 210689
* Use error_code() instead of error_code::succes()Rafael Espindola2014-05-311-3/+3
| | | | | | | There is no std::error_code::success, so this removes much of the noise in transitioning to std::error_code. llvm-svn: 209948
* [mach-o] Add support and test cases for parsing tentative definitionsNick Kledzik2014-05-151-0/+2
| | | | llvm-svn: 208919
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-131-1/+1
| | | | | | | | This results in some simplifications to the code where an OwningPtr had to be used with the previous api and then ownership moved to a unique_ptr for the rest of lld. llvm-svn: 203809
* Fix trailing whitespace.Shankar Easwaran2014-01-271-71/+71
| | | | llvm-svn: 200182
* Fix indentation in the MachO writer.Joey Gouly2013-12-231-3/+3
| | | | llvm-svn: 197925
* Fix a variety of typos in function names and commentsAlp Toker2013-12-011-1/+1
| | | | | | No change in functionality. llvm-svn: 196053
* [mach-o] Use LEB128 stuff from llvm/Support. No functionality change.Nick Kledzik2013-11-091-67/+29
| | | | llvm-svn: 194305
* [mach-o] reduce duplicate source code by using a templated method. No ↵Nick Kledzik2013-11-091-113/+43
| | | | | | functionality change. llvm-svn: 194299
* [mach-o] binary reader and writer Nick Kledzik2013-11-061-0/+1079
This patch adds support for converting normalized mach-o to and from binary mach-o. It also changes WriterMachO (which previously directly wrote a mach-o binary given a set of Atoms) to instead do it in two steps. The first step uses normalizedFromAtoms() to convert Atoms to normalized mach-o, and the second step uses writeBinary() which to generate the mach-o binary file. llvm-svn: 194167
OpenPOWER on IntegriCloud