summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [PECOFF] Implement /SAFESEH option.Rui Ueyama2014-02-211-4/+24
| | | | | | | LLD now prints an error message if /SAFESEH option is specified and one or more input files are not compatible with SEH. llvm-svn: 201900
* Update for llvm api change.Rafael Espindola2014-02-101-4/+4
| | | | llvm-svn: 201109
* Update for llvm api change.Rafael Espindola2014-01-301-9/+7
| | | | llvm-svn: 200443
* [PECOFF] Set a proper architecture type to references.Rui Ueyama2014-01-271-1/+27
| | | | | | | Relocations for x64 object files should have reference type of KindArch::x86_64. llvm-svn: 200183
* Update for llvm api change.Rafael Espindola2014-01-151-3/+3
| | | | llvm-svn: 199327
* Use getError instead of the error_code operator.Rafael Espindola2014-01-081-4/+4
| | | | llvm-svn: 198797
* [PECOFF] Parse .drectve section before reading other file contents.Rui Ueyama2013-12-271-40/+36
| | | | | | | | | | | | | | Currently .drectve section contents are parsed after other sections are parsed. That order may result in wrong results if other sections depend on command line options in the directive section. For example, if a weak symbol is defined using /alternatename option in the directive section, we have to read it first and then read the text section contents. Otherwise the weak symbol won't be defined. This patch changes the order to fix the issue. llvm-svn: 198071
* [PECOFF] Skip empty .drectve sections.Rui Ueyama2013-12-271-5/+7
| | | | | | | There are many object files in the standard library who have empty .drective sections. Parsing the empty string is not wrong but a waste. llvm-svn: 198067
* Run clang-format on r197727.Rui Ueyama2013-12-201-19/+18
| | | | llvm-svn: 197788
* [lld] Introduce registry and Reference kind tupleNick Kledzik2013-12-191-217/+242
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] Rename lld::coff -> lld::pecoff.Rui Ueyama2013-12-131-7/+7
| | | | | | We had lld::coff and lld::pecoff namespaces for no reason. Unify them. llvm-svn: 197201
* Run clang-format for PECOFF reader/writer code. No other changes.Rui Ueyama2013-12-111-8/+9
| | | | llvm-svn: 197039
* [PECOFF] Implement /alternatename weak symbols.Rui Ueyama2013-12-091-4/+16
| | | | llvm-svn: 196754
* Re-submit r195852 with GroupedSectionsPass change.Rui Ueyama2013-12-071-7/+8
| | | | | | | | | | | | | | | | GroupedSectionsPass was a complicated pass. That pass's job was to reorder atoms by section name, so that the atoms with the same section prefix will be emitted consecutively to the executable. The pass added layout edges to atoms, and let the layout pass to actually reorder them. This patch simplifies the design by making GroupedSectionPass to directly reorder atoms, rather than adding layout edges. This resembles ELF's ArrayOrderPass. This patch improves the performance of LLD; it used to take 7.1 seconds to link LLD with LLD on my Macbook Pro, but it now takes 6.1 seconds. llvm-svn: 196628
* [PECOFF] Do not strip .debug section.Rui Ueyama2013-12-031-7/+0
| | | | llvm-svn: 196332
* [PECOFF] Print reason if file parsing failed.Rui Ueyama2013-12-031-1/+2
| | | | llvm-svn: 196185
* Revert "[PECOFF] Fix atom ordinals."Rui Ueyama2013-12-021-8/+7
| | | | | | | This reverts commit r195852 because LLD seems to create broken executables with that patch when compiled with MSVC 2013. llvm-svn: 196078
* [PECOFF] Fix atom ordinals.Rui Ueyama2013-11-271-7/+8
| | | | | | | Atom ordinals are the indeces in a file. Currently the PECOFF reader assigns ordinals for each section, so it's (incorrectly) assigning duplicate ordinals. llvm-svn: 195852
* [PECOFF] Skip sections with LNK_INFO.Rui Ueyama2013-11-251-2/+3
| | | | | | | | According to the PE/COFF spec, a section with IMAGE_SCN_LNK_INFO should only appear in an object file, and not allowed in an executable. So I believe treating it as the same way as IMAGE_SCN_LNK_INFO is the right thing. llvm-svn: 195692
* Do not inline large member functions. No functionality change.Rui Ueyama2013-11-191-720/+768
| | | | llvm-svn: 195169
* [PECOFF] Now that identify_magic() recognizes COFF import library.Rui Ueyama2013-11-191-6/+1
| | | | | | No need to do that in ReaderCOFF.cpp. llvm-svn: 195109
* Don't use getFileOrStdin() at where we don't want to read from stdin.Rui Ueyama2013-11-141-1/+1
| | | | llvm-svn: 194746
* [PECOFF] Make the import library file magic more accurate.Rui Ueyama2013-11-141-1/+2
| | | | llvm-svn: 194668
* [PECOFF] Make ReaderCOFF more robust against planned identity_magic() changes.Rui Ueyama2013-11-131-3/+7
| | | | | | No functionality change. llvm-svn: 194560
* Re-submit r194551: Use empty() instead of size() == 0.Rui Ueyama2013-11-131-1/+1
| | | | llvm-svn: 194556
* Revert "Use empty() instead of size() == 0."Rui Ueyama2013-11-131-1/+1
| | | | | | This reverts commit r194551 because it broke the buildbot. llvm-svn: 194552
* Use empty() instead of size() == 0.Rui Ueyama2013-11-131-1/+1
| | | | llvm-svn: 194551
* [PECOFF] Do not print error if length of .drectve is 0.Rui Ueyama2013-11-131-0/+3
| | | | llvm-svn: 194539
* [PECOFF] Report error if there's unknown flag in .drectveRui Ueyama2013-11-051-5/+6
| | | | | | Errors in .drectve section were silently ignored. This patch fixes the issue. llvm-svn: 194110
* Remove unnecessary namespace qualifier.Rui Ueyama2013-11-051-6/+6
| | | | llvm-svn: 194037
* [PECOFF] Suppress startup message of background processes.Rui Ueyama2013-10-291-0/+1
| | | | llvm-svn: 193646
* 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
* [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
* [PECOFF] Only COMDAT symbols are allowed to be dead-stripped.Rui Ueyama2013-10-181-7/+13
| | | | | | | | | | | | | | | | | | 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
* Run CVTRES.EXE on resource files.Rui Ueyama2013-10-161-4/+110
| | | | llvm-svn: 192830
* Fix typoRui Ueyama2013-10-101-1/+1
| | | | llvm-svn: 192401
* [lld][InputGraph] Change the Resolver to use inputGraphShankar Easwaran2013-10-071-10/+3
| | | | | | | | | | | | 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
* Make Driver::link and LinkingContext::validate return true on success.Rui Ueyama2013-09-241-2/+2
| | | | | | | | | | | | | 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
* 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] Handle weak external symbols.Rui Ueyama2013-09-121-7/+54
| | | | | | Used the fallback mechanism to implement COFF weak external symbols. llvm-svn: 190633
* Run clang-format.Joerg Sonnenberger2013-09-071-63/+64
| | | | llvm-svn: 190254
* Change the parseFile argument from MemoryBuffer pointer to LinkerInputJoerg Sonnenberger2013-09-071-4/+5
| | | | | | reference. Move readFile logic into FileNode::createLinkerInput. llvm-svn: 190253
* [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-061-0/+14
| | | | | | 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] Fix fixme by making PECOFFLinkingContext non-const.Rui Ueyama2013-09-031-10/+8
| | | | llvm-svn: 189865
OpenPOWER on IntegriCloud