summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/PECOFF
Commit message (Collapse)AuthorAgeFilesLines
...
* [PECOFF] Parse /merge command line option.Rui Ueyama2013-10-261-0/+53
| | | | | | | | /merge:<from>=<to> option makes the linker to combine "from" section to "to" section. This patch is to parse the option. The actual feature will be implemented in a subsequent patch. llvm-svn: 193454
* Fix spelling.Rui Ueyama2013-10-251-3/+3
| | | | llvm-svn: 193440
* [PECOFF] Handle edge case where no section alignment is specified.Rui Ueyama2013-10-251-1/+11
| | | | llvm-svn: 193385
* Revert "r193300 - [PassManager] add ReaderWriter{Native, YAML} to the Driver"Rui Ueyama2013-10-242-7/+7
| | | | | | | The patch have completely broken COFF port and disabled many tests. This also reverts r193302 (comment fix). llvm-svn: 193362
* [PassManager] add ReaderWriter{Native,YAML} to the Driver.Shankar Easwaran2013-10-242-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Disable tests to be run with REQUIRES: disable. Note disable is not added to the config by the test runner Mkaefiles, so essentially disables the test. Code changes would be required to fix these tests :- test/darwin/hello-world.objtxt test/elf/check.test test/elf/phdr.test test/elf/ppc.test test/elf/undef-from-main-dso.test test/elf/X86_64/note-sections-ro_plus_rw.test test/pecoff/alignment.test test/pecoff/base-reloc.test test/pecoff/bss-section.test test/pecoff/drectve.test test/pecoff/dynamic.test test/pecoff/dynamicbase.test test/pecoff/entry.test test/pecoff/hello.test test/pecoff/imagebase.test test/pecoff/importlib.test test/pecoff/lib.test test/pecoff/multi.test test/pecoff/reloc.test test/pecoff/weak-external.test llvm-svn: 193300
* Remove unused variable.Rui Ueyama2013-10-231-3/+0
| | | | llvm-svn: 193266
* [PECOFF] Resource file extension is .res, not .rc.Rui Ueyama2013-10-221-4/+4
| | | | | | | | This patch won't change LLD's behavior because it's a temporary file and LLD does not use the file extension to determine file type. But using the correct file extension is a good thing. llvm-svn: 193211
* Revert "Initialize some members where they are declared."Rui Ueyama2013-10-212-13/+17
| | | | | | | Because MSVC11 doesn't like this new C++11 feature. The last commit broke the buildbot. llvm-svn: 193127
* Initialize some members where they are declared. No functionality change.Rui Ueyama2013-10-212-17/+13
| | | | llvm-svn: 193122
* [PECOFF] Only COMDAT symbols are allowed to be dead-stripped.Rui Ueyama2013-10-182-10/+23
| | | | | | | | | | | | | | | | | | We should dead-strip atoms only if they are created for COMDAT symbols. If we remove non-COMDAT atoms from a binary, it will no longer be guaranteed that the binary will work correctly. In COFF, you can manipulate the order of section contents in the resulting binary by section name. For example, if you have four sections .data$unique_prefix_{a,b,c,d}, it's guaranteed that the contents of A, B, C, and D will be consecutive in the resulting .data section in that order. Thus, you can access B's and C's contents by incrementing a pointer pointing to A until it reached to D. That's why we cannot dead-strip B or C even if no one is directly referencing to them. Some object files in the standard library actually use that technique. llvm-svn: 193017
* Fill the atom gap with INT 3 instead of NOP.Rui Ueyama2013-10-181-2/+2
| | | | | | | | INT 3 (machine code 0xCC) will raise an interrupt when executed. That is better for filling the gap than NOP because we want to stop the execution immediately when the control reached to non-code address. llvm-svn: 192945
* Fill gap in .text with NOP.Rui Ueyama2013-10-171-0/+14
| | | | llvm-svn: 192930
* Run CVTRES.EXE on resource files.Rui Ueyama2013-10-162-5/+113
| | | | llvm-svn: 192830
* Fix typoRui Ueyama2013-10-101-1/+1
| | | | llvm-svn: 192401
* Update error classes from all lowercase to camel case.Rui Ueyama2013-10-092-4/+4
| | | | llvm-svn: 192261
* [lld][InputGraph] Change the Resolver to use inputGraphShankar Easwaran2013-10-074-24/+15
| | | | | | | | | | | | 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
* Add a comment to ReaderCOFF::parseFile.Rui Ueyama2013-09-271-0/+4
| | | | llvm-svn: 191583
* [Core] Add type and size to SharedLibraryAtom.Michael J. Spencer2013-09-261-0/+2
| | | | llvm-svn: 191466
* Make Driver::link and LinkingContext::validate return true on success.Rui Ueyama2013-09-242-8/+8
| | | | | | | | | | | | | 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
* [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
* [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
* 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
* [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
* 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
* Run clang-format.Joerg Sonnenberger2013-09-071-63/+64
| | | | llvm-svn: 190254
* Change the parseFile argument from MemoryBuffer pointer to LinkerInputJoerg Sonnenberger2013-09-072-6/+7
| | | | | | reference. Move readFile logic into FileNode::createLinkerInput. llvm-svn: 190253
* [PECOFF] Don't add RVAs to base relocations table.Rui Ueyama2013-09-061-5/+10
| | | | | | Patch by Ron Ofir. llvm-svn: 190210
* [PECOFF] Fix section alignment bug in ReaderCOFF.Rui Ueyama2013-09-061-2/+4
| | | | | | Patch by Ron Ofir. llvm-svn: 190198
* [PECOFF] Align section contents as specified by the object file's section ↵Rui Ueyama2013-09-063-1/+24
| | | | | | header. llvm-svn: 190120
* [PECOFF] Ignore options starting with -?Rui Ueyama2013-09-041-1/+1
| | | | | | | | | | | The compiler is allowed to add a linker option starting with -?<name> to .drectve section. If the linker can interpret -<name>, it's processed as if there's no question mark there. If not, such option is silently ignored. This is a COFF's feature to allow the compiler to emit new linker options while keeping compatibility with older linkers. llvm-svn: 189897
* [PECOFF] Allocate storage for .drective in the reader to avoid multiple ↵Rui Ueyama2013-09-031-5/+6
| | | | | | calls of allocateString() llvm-svn: 189881
* [PECOFF] Verify parameter in validateImpl() not in the driver.Rui Ueyama2013-09-031-0/+7
| | | | llvm-svn: 189877
* [PECOFF] Fix fixme by making PECOFFLinkingContext non-const.Rui Ueyama2013-09-031-10/+8
| | | | llvm-svn: 189865
* [lld][LinkingContext] Atoms created from command line options should be ↵Shankar Easwaran2013-08-312-22/+21
| | | | | | | | | | | | available in YAML This adds an API to the LinkingContext for flavors to add Internal files containing atoms that need to appear in the YAML output as well, when -emit-yaml switch is used. Flavors can add more internal files for other options that are needed. llvm-svn: 189718
* [PECOFF] Fix bug that section grouping may lay out atoms in a wrong order.Rui Ueyama2013-08-291-1/+31
| | | | | | | | | We added layout edges to the head atoms in grouped sections. That was wrong, because the head atom needs to be followed by the other atoms in the *same* section, not by the other section contents. With this patch, layout edges are added from tail atom, which is the last atom in a section, to head atom. llvm-svn: 189573
OpenPOWER on IntegriCloud