summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [lld][MachO] Recognize __thread_bss sections as zero-fill and set all theLang Hames2015-12-111-1/+1
| | | | | | | | | appropriate bits. This fixes the remaining clang regression test failures when linking clang with lld on Darwin. llvm-svn: 255390
* [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-0/+1
| | | | llvm-svn: 237841
* Use arithmetic type to represent alignments (not in log2) everywhere.Rui Ueyama2015-03-261-15/+1
| | | | | | | This is the final step of conversion. Now log2 numbers are removed from everywhere! llvm-svn: 233246
* Define an implicit constructor which takes actual alignment value to PowerOf2.Rui Ueyama2015-03-261-2/+2
| | | | | | | 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-2/+2
| | | | | | | 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/+15
| | | | | | | | | | 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
* [mach-o] propagate dylib version numbersNick Kledzik2014-11-191-4/+30
| | | | | | | | | | | | | | 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] Add support for arm64 (AAarch64)Nick Kledzik2014-09-091-0/+26
| | | | | | | | | | 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/+7
| | | | | | | | | | | 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 LC_DATA_IN_CODENick Kledzik2014-07-241-0/+27
| | | | | | | | | | | | | | 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/+0
| | | | | | | It still needs to be tied into BinaryReader, but this allows reasonably sensible creation of SharedLibrary atoms on MachO. llvm-svn: 212093
* [mach-o] improve errors when mixing architecturesNick Kledzik2014-06-301-1/+9
| | | | llvm-svn: 212072
* MachO: support atomization of dylibs.Tim Northover2014-06-301-0/+2
| | | | | | | For .dylib files, we refrain from actually creating any atoms until they're requested via the "exports" method. llvm-svn: 212027
* Refer to error_code with an std prefix.Rafael Espindola2014-06-121-4/+2
| | | | llvm-svn: 210820
* 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-4/+2
| | | | | | This will reduce the noise in a followup patch. llvm-svn: 210800
* replace llvm::error_code with std::error_code.Rafael Espindola2014-06-121-1/+1
| | | | llvm-svn: 210781
* Use error_code() instead of error_code::succes()Rafael Espindola2014-05-311-1/+1
| | | | | | | 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] Fix so that mach-o semantic errors return an error rather than assertNick Kledzik2014-05-221-1/+3
| | | | llvm-svn: 209469
* [mach-o] Add support for zero-fill sections.Nick Kledzik2014-05-151-2/+12
| | | | llvm-svn: 208928
* [mach-o] Add support and test cases for parsing tentative definitionsNick Kledzik2014-05-151-2/+12
| | | | llvm-svn: 208919
* Update to match changes made in r205955David Majnemer2014-04-101-0/+1
| | | | llvm-svn: 205956
* s/llvm::dyn_cast/dyn_cast/Rui Ueyama2014-04-021-1/+0
| | | | llvm-svn: 205404
* Fix trailing whitespace.Shankar Easwaran2014-01-271-80/+80
| | | | llvm-svn: 200182
* [mach-o] enable mach-o and native yaml to be intermixedNick Kledzik2014-01-111-17/+50
| | | | | | | | | | | | | | | | | | The main goal of this patch is to allow "mach-o encoded as yaml" and "native encoded as yaml" documents to be intermixed. They are distinguished via yaml tags at the start of the document. This will enable all mach-o test cases to be written using yaml instead of checking in object files. The Registry was extend to allow yaml tag handlers to be registered. The mach-o Reader adds a yaml tag handler for the tag "!mach-o". Additionally, this patch fixes some buffer ownership issues. When parsing mach-o binaries, the mach-o atoms can have pointers back into the memory mapped .o file. But with yaml encoded mach-o, name and content are ephemeral, so a copyRefs parameter was added to cause the mach-o atoms to make their own copy. llvm-svn: 198986
* Use the mach-o MH_* name for file types in yamlNick Kledzik2014-01-081-4/+4
| | | | llvm-svn: 198725
* [MachO] Add some missing NListTypes.Joey Gouly2014-01-041-0/+2
| | | | llvm-svn: 198468
* [MachO] Begin to add some MachO specific File/Atoms, and add the start ofJoey Gouly2014-01-031-1/+23
| | | | | | normalizedToAtoms. llvm-svn: 198459
* Fix a gcc-4.8 warning, about extraneous semicolons.Joey Gouly2013-12-281-6/+6
| | | | llvm-svn: 198091
* Run clang-format on r197727.Rui Ueyama2013-12-201-1/+1
| | | | llvm-svn: 197788
* [lld] Introduce registry and Reference kind tupleNick Kledzik2013-12-191-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main changes are in: include/lld/Core/Reference.h include/lld/ReaderWriter/Reader.h Everything else is details to support the main change. 1) Registration based Readers Previously, lld had a tangled interdependency with all the Readers. It would have been impossible to make a streamlined linker (say for a JIT) which just supported one file format and one architecture (no yaml, no archives, etc). The old model also required a LinkingContext to read an object file, which would have made .o inspection tools awkward. The new model is that there is a global Registry object. You programmatically register the Readers you want with the registry object. Whenever you need to read/parse a file, you ask the registry to do it, and the registry tries each registered reader. For ease of use with the existing lld code base, there is one Registry object inside the LinkingContext object. 2) Changing kind value to be a tuple Beside Readers, the registry also keeps track of the mapping for Reference Kind values to and from strings. Along with that, this patch also fixes an ambiguity with the previous Reference::Kind values. The problem was that we wanted to reuse existing relocation type values as Reference::Kind values. But then how can the YAML write know how to convert a value to a string? The fix is to change the 32-bit Reference::Kind into a tuple with an 8-bit namespace (e.g. ELF, COFFF, etc), an 8-bit architecture (e.g. x86_64, PowerPC, etc), and a 16-bit value. This tuple system allows conversion to and from strings with no ambiguities. llvm-svn: 197727
* [mach-o] binary reader and writer Nick Kledzik2013-11-061-37/+3
| | | | | | | | | | 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
* Remove unnecessary namespace qualifier.Rui Ueyama2013-11-051-2/+2
| | | | llvm-svn: 194037
* Bug 17569: add namespaces to work with gcc-4.7Nick Kledzik2013-10-141-7/+17
| | | | llvm-svn: 192627
* Update error classes from all lowercase to camel case.Rui Ueyama2013-10-091-1/+1
| | | | llvm-svn: 192261
* fix typosNick Kledzik2013-10-081-1/+1
| | | | llvm-svn: 192154
* Supoort mach-o encoded in yaml.Nick Kledzik2013-10-081-0/+650
This is the first step in how I plan to get mach-o object files support into lld. We need to be able to test the mach-o Reader and Write on systems without a mach-o tools. Therefore, we want to support a textual way (YAML) to represent mach-o files. MachONormalizedFile.h defines an in-memory abstraction of the content of mach-o files. The in-memory data structures are always native endianess and always use 64-bit sizes. That internal data structure can then be converted to or from three different formats: 1) yaml (text) encoded mach-o, 2) binary mach-o files, 3) lld Atoms. This patch defines the internal model and uses YAML I/O to implement the conversion to and from the model to yaml. The next patch will implement the conversion from normalized to binary mach-o. This patch includes unit tests to validate the yaml conversion APIs. llvm-svn: 192147
OpenPOWER on IntegriCloud