summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/PECOFF
Commit message (Collapse)AuthorAgeFilesLines
...
* [PECOFF] Add a generic section writer.Rui Ueyama2013-11-271-135/+142
| | | | | | | | | | | | | | | | Instead of having multiple SectionChunks for each section (.text, .data, .rdata and .bss), we could have one chunk writer that can emit any sections. This patch does that -- removing all section-sepcific chunk writers and replace them with one "generic" writer. This change should simplify the code because it eliminates similar-but- slightly-different classes. It also fixes an issue in the previous design. Before this patch, we could emit only limited set of sections (i.e. .text, .data, .rdata and .bss). With this patch, we can emit any sections. llvm-svn: 195797
* Revert "WriterPECOFF"Rui Ueyama2013-11-271-142/+135
| | | | | | This reverts accidental commit r195794. llvm-svn: 195795
* WriterPECOFFRui Ueyama2013-11-271-135/+142
| | | | llvm-svn: 195794
* [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
* [PECOFF] String pointed by StringRef is not always NUL-terminated.Rui Ueyama2013-11-251-1/+2
| | | | | | | In order not to overrun a StringRef and copy the trailing garbage, we need to set the maximum length to be copied by strncpy. llvm-svn: 195688
* [PECOFF] Move definitions to IdataPass.cpp.Rui Ueyama2013-11-253-219/+278
| | | | llvm-svn: 195618
* [PECOFF] Set ordinals to linker internal atoms.Rui Ueyama2013-11-254-21/+36
| | | | | | | | | This patch won't change the output because the layout of linker internal atoms is forced by layout-{before,after} references. Ordinals of the linker internal atoms are not currently used. (That's why it's working even if there are atoms having the same ordinals.) llvm-svn: 195610
* [PECOFF] Change sectionChoice attribute.Rui Ueyama2013-11-253-5/+6
| | | | | | | | | | | | | Change the attribute from sectionBasedOnContent to sectionCustomRequired because its the right attribute for atoms read from COFF files to have. COFF atoms should basically be emitted to the section having the same name as input. Permissions/attributes should not affect that. There's no functionality change because the writer doesn't yet use the section name. The writer will be modified in a following patch, so that atoms are written to its customSectionName()'s section. llvm-svn: 195595
* Fix MSVC buildbot.Rui Ueyama2013-11-251-6/+4
| | | | llvm-svn: 195593
* [PECOFF] Infer subsystem from the entry point function.Rui Ueyama2013-11-252-0/+58
| | | | | | | | If /subsystem option is not specified, the linker needs to infer it from the entry point function. If "main" or "wmain" is defined, it's a console application. If "WinMain" or "wWinMain" is defined, it's a GUI application. llvm-svn: 195592
* Rename allocateString -> allocate.Rui Ueyama2013-11-211-1/+1
| | | | llvm-svn: 195284
* Do not inline large member functions. No functionality change.Rui Ueyama2013-11-191-720/+768
| | | | llvm-svn: 195169
* Do not inline large member functions.Rui Ueyama2013-11-191-494/+553
| | | | | | | This should improve code readability as the class definitions are now more readable than before. llvm-svn: 195159
* [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
* Remove meaningless "explicit" keywords.Rui Ueyama2013-11-191-2/+2
| | | | llvm-svn: 195108
* [PECOFF] Use INT3 instead of NOP.Rui Ueyama2013-11-151-1/+1
| | | | | | | | | | This patch does not change the meaning of the program, but if something's wrong in the linker or the compiler and the control reaches to the gap of imported function table, it will stop immediately because of the presence of INT3. If NOP, it'd fall through to the next call instruction, which is usually a completely foreign function call. llvm-svn: 194860
* [PECOFF] Remove unnecessary static member.Rui Ueyama2013-11-151-17/+10
| | | | llvm-svn: 194851
* [PECOFF] Give a better name to the linker generated file.Rui Ueyama2013-11-151-1/+1
| | | | llvm-svn: 194847
* Fix Windows buildbot on which size_t is not unsinged long.Rui Ueyama2013-11-151-1/+1
| | | | llvm-svn: 194793
* [PECOFF] Minimum size of DOS stub is 64 byte.Rui Ueyama2013-11-151-2/+6
| | | | llvm-svn: 194791
* [PECOFF] Avoid using statically initialized std::vector.Rui Ueyama2013-11-152-13/+7
| | | | | | Also slightly reduces PECOFFLinkingContext's memory footprint (~128B). llvm-svn: 194787
* Fix include guards.Rui Ueyama2013-11-153-6/+6
| | | | llvm-svn: 194776
* Move DOS stub data to PECOFFLinkingContext for /stub option.Rui Ueyama2013-11-142-18/+15
| | | | llvm-svn: 194754
* 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] Add missing dependency.Michael J. Spencer2013-11-141-0/+1
| | | | | | This dependency needs to be cleaned up at some point. .directve handling needs the link.exe option parser. llvm-svn: 194642
* [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
* Remove empty namespace.Rui Ueyama2013-11-091-2/+0
| | | | llvm-svn: 194322
* rename local variable to avoid shadowing warningNick Kledzik2013-11-061-4/+4
| | | | llvm-svn: 194166
* [PECOFF] Rename getSectionAlignment -> getSectionDefaultAlignment.Rui Ueyama2013-11-062-3/+3
| | | | | | | | These fields are for /align option. Section alignment can be set per-section basis with /section option too. In order to avoid name conflicts, rename the existing identifiers to become more specific. No functionality change. llvm-svn: 194160
* Undef a local macro after use.Rui Ueyama2013-11-061-8/+7
| | | | llvm-svn: 194128
* [PECOFF] Do not wrap the linker internal file with an archive file.Rui Ueyama2013-11-061-61/+2
| | | | | | | | | | | | | | | | | | We wrapped the linker internal file with a virtual archive file, so that the linker internal file was linked only when it's actually used. This was to avoid __ImageBase being included to the resulting executable. __ImageBase used to occupy four bytes when emitted to executable. And then it turned out that the implementation of __ImageBase was wrong -- it shouldn't have been a regular atom but an absolute atom. Absolute atoms point to some memory location, but they don't occupy disk space themselves. So it wouldn't increase executable size (except the symbol table.) That means that it's OK to link the linker internal file unconditionally. So this patch does that, removing the wrapper archive file. Doing this simplifies the code. llvm-svn: 194127
* [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-053-10/+10
| | | | llvm-svn: 194037
* [PECOFF] Remove unnecessary assertion.Rui Ueyama2013-11-011-14/+0
| | | | | | | | Bugs that would be caught by this assertion would also be caught by RoundTripYAMLPass test. We've enabled the pass for PECOFF, so we can remove this. llvm-svn: 193886
* Remove duplicate calls of pm.add() for RoundTrip tests.Rui Ueyama2013-11-011-4/+0
| | | | llvm-svn: 193885
* Remove redundant std::move().Rui Ueyama2013-11-014-7/+7
| | | | llvm-svn: 193883
* [PECOFF] Enable RoundTrip{YAML,Native}Pass.Rui Ueyama2013-11-011-3/+9
| | | | llvm-svn: 193881
* [PECOFF] Change data directory atom structure.Rui Ueyama2013-11-013-44/+48
| | | | | | | | | | | | The data directory in the PE/COFF header consisted of list of data directory atoms. This patch changes it -- now there's only one data directory entry that contains former data directories. That's easier to handle in the writer as well as to write to/read from YAML/Native files. The main purpose of this refactoring is to enable RoundTrip tests for PE/COFF. There's no functionality change. llvm-svn: 193854
* Revert "[PECOFF] Add atoms to the PassManager file"Rui Ueyama2013-10-312-11/+17
| | | | | | | | | | | | | | | This reverts commit r193479. The atoms are already added to the file, so re-adding them caused the YAML writer to write the same atoms twice. That made the YAML reader to fail with "duplicate atom name" error. This is not the only error we've got for RoundTripYAMLPass for PECOFF, so we cannot enable the test yet. More fixes will come. Differential Revision: http://llvm-reviews.chandlerc.com/D2069 llvm-svn: 193762
* [PECOFF] Suppress startup message of background processes.Rui Ueyama2013-10-291-0/+1
| | | | llvm-svn: 193646
* [PassManager] add ReaderWriter{Native,YAML} to the Driver.Shankar Easwaran2013-10-293-8/+8
| | | | | | | | | | | | | Enable this for the following flavors a) core b) gnu c) darwin Its disabled for the flavor PECOFF. Convenient markers are added with FIXME comments in the Driver that would be removed and code removed from each flavor. llvm-svn: 193585
* [PECOFF] Fix __ImageBase symbol.Rui Ueyama2013-10-291-36/+12
| | | | | | | | | __ImageBase is an absolute symbol whose address is the same as the image base address. What we did before this patch was to create __ImageBase symbol as a symbol whose *contents* (not location) is the image base address, which is clearly wrong. llvm-svn: 193565
* [PECOFF] Set section name for BSS atoms.Rui Ueyama2013-10-281-1/+1
| | | | | | | This change has no effect now, but will be needed to emit BSS atoms to .bss section. llvm-svn: 193556
* [PECOFF] Add atoms to the PassManager fileShankar Easwaran2013-10-261-1/+13
| | | | llvm-svn: 193479
* [PECOFF] Add COFF relocations to encode/decode to/from YAML filesShankar Easwaran2013-10-261-1/+23
| | | | llvm-svn: 193478
OpenPOWER on IntegriCloud