summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter
Commit message (Collapse)AuthorAgeFilesLines
...
* [ELF] Change MaxAlignment to 2.Shankar Easwaran2013-10-098-8/+7
| | | | llvm-svn: 192310
* [Layout] Dont set ordinals to Files by default.Shankar Easwaran2013-10-093-8/+12
| | | | | | | | | | | | | This change removes code in various places which was setting the File Ordinals. This is because the file ordinals are assigned by the way files are resolved. There was no other way than making the getNextFileAndOrdinal be set const and change the _nextOrdinal to mutable. There are so many places in code, that you would need to cleanup to make LinkingContext non-const! llvm-svn: 192280
* [Layout] Assign ordinals in Resolution order.Shankar Easwaran2013-10-092-12/+0
| | | | llvm-svn: 192277
* Update error classes from all lowercase to camel case.Rui Ueyama2013-10-0911-47/+47
| | | | llvm-svn: 192261
* [LinkingContext] make LinkingContext non-constShankar Easwaran2013-10-082-7/+4
| | | | llvm-svn: 192183
* fix typosNick Kledzik2013-10-082-2/+2
| | | | llvm-svn: 192154
* Supoort mach-o encoded in yaml.Nick Kledzik2013-10-084-6/+935
| | | | | | | | | | | | | | | | | | | | | 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
* [lld][InputGraph] Change the Resolver to use inputGraphShankar Easwaran2013-10-0730-389/+149
| | | | | | | | | | | | 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
* [ELF] Fix uninitalized value.Michael J. Spencer2013-10-031-0/+2
| | | | llvm-svn: 191924
* Add a comment to ReaderCOFF::parseFile.Rui Ueyama2013-09-271-0/+4
| | | | llvm-svn: 191583
* [mach-o] switch to use llvm::MachO:: constantsNick Kledzik2013-09-272-25/+26
| | | | | | Stop using some locally defined mach-o constants. llvm-svn: 191581
* [ELF] Handle copy relocations for PC32.Michael J. Spencer2013-09-271-1/+4
| | | | | | | | This will eventually need to be refactored to better handle COPY relocations, as other relocations can also generate them. I'm not yet sure the exact circumstances in which they are needed yet. llvm-svn: 191567
* [ELF] Mark STT_GNU_IFUNC symbols as code.Michael J. Spencer2013-09-271-0/+1
| | | | llvm-svn: 191566
* [ELF] Add COPY relocations.Michael J. Spencer2013-09-264-4/+86
| | | | llvm-svn: 191467
* [Core] Add type and size to SharedLibraryAtom.Michael J. Spencer2013-09-267-2/+58
| | | | llvm-svn: 191466
* [ELF] Fix use after free.Michael J. Spencer2013-09-251-15/+16
| | | | llvm-svn: 191403
* Make Driver::link and LinkingContext::validate return true on success.Rui Ueyama2013-09-245-15/+15
| | | | | | | | | | | | | This patch inverts the return value of these functions, so that they return "true" on success and "false" on failure. The meaning of boolean return value was mixed in LLD; for example, InputGraph::validate() returns true on success. With this patch they'll become consistent. CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1748 llvm-svn: 191341
* [PECOFF] Add /swaprun:{cd,net} options.Rui Ueyama2013-09-241-0/+4
| | | | llvm-svn: 191276
* [PECOFF] Add /allowisolation command line option.Rui Ueyama2013-09-231-0/+2
| | | | llvm-svn: 191227
* [PECOFF] Add /allowbind command line option.Rui Ueyama2013-09-231-0/+2
| | | | llvm-svn: 191224
* [lld][PECOFF] Fix data directory entry RVA of base relocations sectionRon Ofir2013-09-232-6/+9
| | | | | | | | | | | | | | | | | | | Summary: This patch changes WriterPECOFF to actually write down the address instead of ignoring it. Also, it changes the order of adding the BaseReloc chunk as otherwise the address wasn't set yet. I think a better way of doing it would be to change DataDirectoryAtom to create a Reference instead of using a number, and to change IdataPass accordingly, but I'm not sure how to do that. Reviewers: ruiu Reviewed By: ruiu CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1743 llvm-svn: 191220
* [PECOFF] Add /align command line option.Rui Ueyama2013-09-232-1/+10
| | | | llvm-svn: 191218
* Whitespace and extra parentheses.Rui Ueyama2013-09-231-2/+2
| | | | llvm-svn: 191217
* [lld][PECOFF] Calculate SizeOfHeaders field instead of using a hard-coded valueRon Ofir2013-09-231-4/+10
| | | | | | | | | | | | | | Summary: This patch changes WritePECOFF to calculate the value of the SizeOfHeaders PE header field instead of just using 512. Reviewers: rui314, ruiu Reviewed By: ruiu CC: llvm-commits, ruiu Differential Revision: http://llvm-reviews.chandlerc.com/D1708 llvm-svn: 191212
* [lld][ELF] Remove invalid commentShankar Easwaran2013-09-231-3/+1
| | | | llvm-svn: 191207
* [lld][LinkingContext][ELF] Allow different output file types.Shankar Easwaran2013-09-234-9/+19
| | | | | | | | | | This adds an option --output-filetype that can be set to either YAML/Native(case insensitive). The linker would create the outputs associated with the type specified by the user. Changes all the tests to use the new option. llvm-svn: 191183
* [lld][ELF][Hexagon] Cleanup unused dataShankar Easwaran2013-09-192-3551/+595
| | | | | | | | Cleanup structure members that are not being used. Also clang-format it. llvm-svn: 191038
* [lld][ELF] Support non alloc sections in the Writer.Shankar Easwaran2013-09-195-45/+95
| | | | | | | | | 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
* [PECOFF][Driver] Support /version command line optionRui Ueyama2013-09-191-1/+8
| | | | llvm-svn: 190986
* [PECOFF] Fix the order of the Import Table entries.Rui Ueyama2013-09-191-5/+13
| | | | | | Test is coming after submitting http://llvm-reviews.chandlerc.com/D1719. llvm-svn: 190983
* [PECOFF] Fix base relocation block alignmentRui Ueyama2013-09-181-2/+5
| | | | | | | | | | | Base relocation block should be aligned on a 32-bit boundary. While the PECOFF spec mentions only aligning the blocks, and not padding them, link.exe seems to add an extra IMAGE_REL_I386_ABSOLUTE entry (just a zeroed WORD) in order to pad the blocks. Patch by Ron Ofir. llvm-svn: 190951
* [PECOFF] Make helper functions private.Rui Ueyama2013-09-181-21/+21
| | | | llvm-svn: 190949
* [lld][YAML] RefNameResolver : add only if name/refname is not emptyShankar Easwaran2013-09-171-3/+3
| | | | llvm-svn: 190903
* [lld][ELF] Assign sectionChoice properly to ELF atomsShankar Easwaran2013-09-173-36/+54
| | | | | | | | | This sets the sectionChoice property for DefinedAtoms. The output section name is derived by the property of the atom. This also decreases native file size. Adds a test. llvm-svn: 190840
* [PECOFF] Take into account all sections when setting size fields in the PE ↵Rui Ueyama2013-09-161-3/+28
| | | | | | | | | | | | | | | header This patch changes lld to go through all sections while calculating the size for SizeOfCode, SizeOfInitializedData and SizeOfUninitializedData fields in the PE header, instead of using only a small set of hard-coded sections. This only really changes SizeOfInitializedData which didn't include .reloc section before this patch. Patch by Ron Ofir. llvm-svn: 190799
* [PECOFF] Add DISCARDABLE characteristic to .reloc sectionRui Ueyama2013-09-161-1/+2
| | | | | | | | | This patch sets the IMAGE_SCN_MEM_DISCARDABLE characteristic to the base relocations section in order to match MS PECOFF specification. Patch by Ron Ofir. llvm-svn: 190798
* [PECOFF] Use a dummy file as an "input file" for Idata atoms.Rui Ueyama2013-09-152-14/+31
| | | | llvm-svn: 190772
* Output soname.Joerg Sonnenberger2013-09-141-0/+7
| | | | llvm-svn: 190758
* If .bss doesn't exist, set _end/end based on .data.Joerg Sonnenberger2013-09-141-0/+4
| | | | llvm-svn: 190753
* Add _end symbol for dynamic libraries. At least brk/sbrk in libc onJoerg Sonnenberger2013-09-141-4/+29
| | | | | | NetBSD need it. llvm-svn: 190752
* Revert "[PECOFF] Allocate storage for .drective in the reader ..."Rui Ueyama2013-09-131-6/+5
| | | | | | This reverts r189881 because that patch caused dangling StringRefs. llvm-svn: 190725
* [PECOFF] Fix alignment bug.Rui Ueyama2013-09-131-6/+8
| | | | | | | | | | | | | | There was a bug that if a section has an alignment requirement and there are multiple symbols at offset 0 in the section, only the last atom at offset 0 would be aligned properly. That bug would move only the last symbol to an alignment boundary, leaving other symbols unaligned, although they should be at the same location. That caused a mysterious SEGV error of the resultant executable. With this patch, we manage all symbols at the same location properly, rather than keeping the last one. llvm-svn: 190724
* [PECOFF] Fix atom default alignment.Rui Ueyama2013-09-131-3/+3
| | | | | | | | Alignment(1) does not mean that the atom should be aligned on a 1 byte boundary but on a 2^1 boundary. So, atoms without any specific alignment requirements should have Alignment(0). llvm-svn: 190723
* [lld][ELF] Handle multiple weak symbolsShankar Easwaran2013-09-131-7/+6
| | | | | | | | | | | | This handles multiple weak symbols which appear back to back. This fix is needed which otherwise will lead to symbols getting initialized to arbitrary values. There was a constructor/destructor test that really triggered this to be fixed on X86_64. Adds a test. llvm-svn: 190658
* [PECOFF] Handle weak external symbols.Rui Ueyama2013-09-122-9/+59
| | | | | | Used the fallback mechanism to implement COFF weak external symbols. llvm-svn: 190633
* [PECOFF] Add a field for machine type to PECOFFLinkingContext.Rui Ueyama2013-09-122-1/+7
| | | | | | | | | So that we can determine what the target architecture is. Adding this field does not mean that we are going to support non-i386 architectures soon; there are many things to do to support them, and I'm focusing on i386 now. But this is the first step toward multi architecture support. llvm-svn: 190627
* Add a fallback mechanism for undefined atom.Rui Ueyama2013-09-123-7/+25
| | | | | | | | | | | | | | | | | 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
* [lld][ELF] Fix vaddr of the first sectionShankar Easwaran2013-09-124-2/+7
| | | | | | The first section in the output was not aligned to the alignment of the section. llvm-svn: 190610
* [lld][ELF] Fix the readonly section order.Shankar Easwaran2013-09-121-0/+4
| | | | | | | This associates rodata and sections which just have the SHF_ALLOC flag to be set to typeConstant. llvm-svn: 190609
* Do not hard code the leading underscore.Rui Ueyama2013-09-121-11/+15
| | | | | | | | Mangling scheme varies on platform, and prepending an underscore is valid only on 32-bit x86. Added a method to mangle name to PECOFFLinkingContext and use it to avoid hard coding mangled names. llvm-svn: 190585
OpenPOWER on IntegriCloud