summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/YAML
Commit message (Collapse)AuthorAgeFilesLines
...
* [yaml] use BumpPtrAllocator for string copiesNick Kledzik2014-01-111-22/+12
| | | | llvm-svn: 198987
* [mach-o] enable mach-o and native yaml to be intermixedNick Kledzik2014-01-111-17/+38
| | | | | | | | | | | | | | | | | | 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
* Restore vertical alignment lost by clang-formatNick Kledzik2013-12-201-170/+167
| | | | llvm-svn: 197834
* Run clang-format on r197727.Rui Ueyama2013-12-201-35/+26
| | | | llvm-svn: 197788
* [lld] Introduce registry and Reference kind tupleNick Kledzik2013-12-191-117/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [PECOFF] Refactor IdataPass.Rui Ueyama2013-12-111-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is to basically move the functionality to construct Data Directory from IdataPass to WriterPECOFF. Data Directory is a part of the PE/COFF header and contains the addresses of the import tables. We used to represent the link from Data Directory to the import tables as relocation references. The idea behind it is that, because relocation references are processed by the Writer, we wouldn't have to do anything special to fill the addresses of the import tables. I thought that the addresses would be set "automatically". But it turned out that that design made the pass and the writer rather complicated. In order to make relocation references between Data Directory to the import tables, these data structures needed to be represented as Atom. However, because Data Directory is not a section content but a part of the PE/COFF header, it did not fit well as an Atom. So we ended up having complicated code both in IdataPass and the writer. This patch simplifies it. One side effect of this patch is that we now have ".idata.a", ".idata.d" and "idata.t" sections for the import address table, the import directory table, and the import lookup table. The writer looks for the sections by name to find the start addresses of the sections. We probably should have a better way to find a specific atom from the core linking result, but currently using the section name seems to be the easiest way to do that. The Windows loader do not care about the import table's section layout. llvm-svn: 197016
* Add explictly exported atoms and export R_*_COPY'ed atoms.Michael J. Spencer2013-11-081-2/+14
| | | | llvm-svn: 194278
* Remove unnecessary namespace qualifier.Rui Ueyama2013-11-051-18/+18
| | | | llvm-svn: 194037
* [ELF] Fix RO/RW note sections.Shankar Easwaran2013-10-261-2/+2
| | | | llvm-svn: 193482
* [PECOFF] Add dataDirectoryEntry as a recognized ContentTypeShankar Easwaran2013-10-261-0/+2
| | | | llvm-svn: 193477
* [Layout] Assign ordinals in Resolution order.Shankar Easwaran2013-10-091-8/+0
| | | | llvm-svn: 192277
* Update error classes from all lowercase to camel case.Rui Ueyama2013-10-091-2/+2
| | | | llvm-svn: 192261
* [lld][InputGraph] Change the Resolver to use inputGraphShankar Easwaran2013-10-071-2/+2
| | | | | | | | | | | | Changes :- a) Functionality in InputGraph to insert Input elements at any position b) Functionality in the Resolver to use nextFile c) Move the functionality of assigning file ordinals to InputGraph d) Changes all inputs to MemoryBuffers e) Remove LinkerInput, InputFiles, ReaderArchive llvm-svn: 192081
* [Core] Add type and size to SharedLibraryAtom.Michael J. Spencer2013-09-261-2/+21
| | | | llvm-svn: 191466
* [lld][ELF] Support non alloc sections in the Writer.Shankar Easwaran2013-09-191-0/+1
| | | | | | | | | This also makes it support debugging executables built with lld. Initial patch done by Bigcheese. This is only a revised patch to have the functionality in the Writer. llvm-svn: 191032
* [lld][YAML] RefNameResolver : add only if name/refname is not emptyShankar Easwaran2013-09-171-3/+3
| | | | llvm-svn: 190903
* Add a fallback mechanism for undefined atom.Rui Ueyama2013-09-121-4/+13
| | | | | | | | | | | | | | | | | In COFF, an undefined symbol can have up to one alternative name. If a symbol is resolved by its regular name, then it's linked normally. If a symbol is not found in any input files, all references to the regular name are resolved using the alternative name. If the alternative name is not found, it's a link error. This mechanism is called "weak externals". To support this mechanism, I added a new member function fallback() to undefined atom. If an undefined atom has the second name, fallback() returns a new undefined atom that should be used instead of the original one to resolve undefines. If it does not have the second name, the function returns nullptr. Differential Revision: http://llvm-reviews.chandlerc.com/D1550 llvm-svn: 190625
* Run clang-format.Rui Ueyama2013-09-111-602/+488
| | | | llvm-svn: 190554
* Change the parseFile argument from MemoryBuffer pointer to LinkerInputJoerg Sonnenberger2013-09-071-2/+2
| | | | | | reference. Move readFile logic into FileNode::createLinkerInput. llvm-svn: 190253
* [lld][ELF] Differentiate between Note sections(RW/RO)Shankar Easwaran2013-09-041-1/+2
| | | | | | | | | | It looks like there is a possibility of seeing RO/RW note sections and we would need to create an appropriate RO/RW segment associated with them. Adds a test too. llvm-svn: 189907
* [lld][ELF] Emit note sectionsShankar Easwaran2013-09-041-0/+1
| | | | | | | | Emit note sections if the input contains a note section. Also emit a note segment. llvm-svn: 189896
* [lld][ELF] Rename typeTLV content type for ELFShankar Easwaran2013-08-231-0/+4
| | | | | | | | | | | typeTLV content type is used by Darwin to represent thread local storage. A new contentType has to be made to represent ELF thread local storage data. These have been set to - typeThreadZeroFill (represents TBSS storage) - typeThreadData (represents TDATA storage) llvm-svn: 189137
* [lld] handle typeZeroFill atoms in ELF/Native/YAMLShankar Easwaran2013-08-231-1/+5
| | | | | | | | | | | | | BSS atoms dont take any file space in the Input file. They are associated with a contentType(typeZeroFill). Similiar zero fill types also exist which have the same meaning in terms of occupying file space in the Input. These atoms have to be handled seperately when writing to the lld's intermediate file or the lld test infrastructure. Also adds a test. llvm-svn: 189136
* Fix spelling error. s/Libary/Library/g.Rui Ueyama2013-08-091-1/+1
| | | | llvm-svn: 188049
* Rename TargetInfo -> LinkingContext.Rui Ueyama2013-08-061-23/+21
| | | | | | | | | Also change some local variable names: "ti" -> "context" and "_targetInfo" -> "_context". Differential Revision: http://llvm-reviews.chandlerc.com/D1301 llvm-svn: 187823
* [ARM] Remove isThumb() as it's not used and it's not in the right place.Rui Ueyama2013-06-131-1/+0
| | | | | | | | | | | | | | Architecture specific code should reside in architecture specific directory not in Atom. Looks like there are no efforts being made at this moment to support ARM, so let's remove it for now. Reviewers: Bigcheese CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D959 llvm-svn: 183877
* [lld][ELF] (no testable functionality change) resize the number of entries ↵Shankar Easwaran2013-04-291-3/+4
| | | | | | in the string table for static linking llvm-svn: 180692
* Revert "Correctly pass ownership of MemoryBuffers."Michael J. Spencer2013-04-051-1/+1
| | | | llvm-svn: 178918
* Correctly pass ownership of MemoryBuffers.Michael J. Spencer2013-04-051-1/+1
| | | | llvm-svn: 178914
* Fix uninitialized variables. Found by ubsan.Michael J. Spencer2013-04-051-1/+1
| | | | llvm-svn: 178913
* This is my Driver refactoring patch. Nick Kledzik2013-04-041-6/+34
| | | | | | | | | | | | | | | | | | | | | | | The major changes are: 1) LinkerOptions has been merged into TargetInfo 2) LinkerInvocation has been merged into Driver 3) Drivers no longer convert arguments into an intermediate (core) argument list, but instead create a TargetInfo object and call setter methods on it. This is only how in-process linking would work. That is, you can programmatically set up a TargetInfo object which controls the linking. 4) Lots of tweaks to test suite to work with driver changes 5) Add the DarwinDriver 6) I heavily doxygen commented TargetInfo.h Things to do after this patch is committed: a) Consider renaming TargetInfo, given its new roll. b) Consider pulling the list of input files out of TargetInfo. This will enable in-process clients to create one TargetInfo the re-use it with different input file lists. c) Work out a way for Drivers to format the warnings and error done in core linking. llvm-svn: 178776
* Devirtualize Reference::kind.Michael J. Spencer2013-03-201-7/+7
| | | | | | Improves performance. llvm-svn: 177556
* Devirtualize File::kind.Michael J. Spencer2013-03-201-2/+2
| | | | | | This is the standard way of implementing LLVM RTTI. llvm-svn: 177555
* [lld] remove trailing whitespaceShankar Easwaran2013-03-141-145/+145
| | | | llvm-svn: 177079
* [ELF][Hexagon]add typeZeroFillFastShankar Easwaran2013-02-241-0/+1
| | | | llvm-svn: 175983
* add changes for typeDataFastShankar Easwaran2013-02-221-8/+5
| | | | llvm-svn: 175901
* [ELF] Add support for reading dynamic libraries.Michael J. Spencer2013-02-111-6/+8
| | | | llvm-svn: 174916
* Use proper delete.Michael J. Spencer2013-01-261-4/+4
| | | | llvm-svn: 173570
* add elf targethandlerShankar Easwaran2013-01-251-45/+47
| | | | llvm-svn: 173430
* Add SectionPosition and OrderPassNick Kledzik2013-01-231-5/+28
| | | | llvm-svn: 173300
* Add PassManager.Michael J. Spencer2013-01-231-9/+0
| | | | | | It owns and manages passes. llvm-svn: 173287
* Move everything over to TargetInfo.Michael J. Spencer2013-01-231-54/+27
| | | | | | | | I really would have liked to split this patch up, but it would greatly complicate the lld-core and lld drivers having to deal with both {Reader,Writer}Option and TargetInfo. llvm-svn: 173217
* Add new merge-by-content Merge attribute for use by anonymousNick Kledzik2013-01-151-0/+1
| | | | | | constants and string literals which the linker should coalesce. llvm-svn: 172495
* [YAML] Fix undefined behavior.Michael J. Spencer2013-01-131-3/+5
| | | | llvm-svn: 172338
* Factor File::addAtom out to MutableFile::addAtom.Michael J. Spencer2013-01-121-9/+2
| | | | | | This removes a bunch of llvm_unreachables and makes a File's mutability part of the type system. llvm-svn: 172297
* Better tie together ContentType and Permissions. Nick Kledzik2013-01-091-8/+13
| | | | | | | | | | Since most content types (e.g. typeCode) have a preferred Permission, add a function to do that mapping. Then hook up to YAML Reader and Writer such that the 'permissions:' key does not need to be specified unless overriding what the content type prefers. llvm-svn: 171929
* add extra namespace for gcc-4.7 compatibilityNick Kledzik2013-01-081-41/+50
| | | | llvm-svn: 171918
* Rename YAML key 'fixups:' to 'references:'Nick Kledzik2013-01-081-1/+1
| | | | llvm-svn: 171898
* [YAML] Fix -Wcovered-switch-defaultMichael J. Spencer2013-01-061-1/+0
| | | | llvm-svn: 171645
* Removes files for separate ReaderYAML.cpp and WriterYAML.cpp Nick Kledzik2013-01-056-2287/+1358
| | | | | | | | and adds a new file ReaderWriterYAML.cpp that uses YAML I/O. Lots of tweaks to test suite for slightly different YAML encoding. llvm-svn: 171592
OpenPOWER on IntegriCloud