summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [PECOFF] Fix bug that atom size was sometimes wrong.Rui Ueyama2013-08-291-1/+1
| | | | | | | | Because of a bug, the last atom of each section contained a garbage at the end of its data. In most cases the garbage is harmless but it could have cause SEGV. llvm-svn: 189572
* [PECOFF] Do not create undefined atom for common symbol.Rui Ueyama2013-08-281-1/+2
| | | | | | | | We were creating undefined atoms for common symbols by mistake. That did not lead to a link failure, for undefined atoms would be resolved by common symbols in the same file, but that's a waste of resource. llvm-svn: 189534
* [PECOFF] Do not scan the symbol table twice but instead cache aux symbols.Rui Ueyama2013-08-281-14/+19
| | | | | | | | | We scanned the symbol table twice; first to gather all regular symbols, and second to process aux symbols. That's a bit inefficient and complicated. We can instead cache aux symbols in the first pass, to eliminate the need of the second pass. llvm-svn: 189525
* [PECOFF] Treat the common symbol as mergeable symbol.Rui Ueyama2013-08-131-6/+18
| | | | | | | This is a temporary measure because the semantics of the common symbol is actually more compilcated than the simple mergeable symbol. llvm-svn: 188235
* [PECOFF] Fully cover the switch for COMDAT attributes and add a comment.Rui Ueyama2013-08-091-2/+13
| | | | llvm-svn: 188046
* Fix comment typo.Rui Ueyama2013-08-091-1/+1
| | | | llvm-svn: 188045
* [PECOFF] Support COMDAT section that contains mergeable atoms.Rui Ueyama2013-08-081-7/+90
| | | | | | | | | | | | | | | The COMDAT section is a section with a special attribute to tell the linker whether the symbols in the section are allowed to be merged or not. This patch add a function to interpret the COMDAT data and set "merge" attribute to the atoms accordingly. LLD supports multiple policies to merge atoms; atoms can be merged by name or by content. COFF supports them, and in addition to that, it supports choose-the-largest-atom policy, which LLD currently does not support. I simply mapped it to merge-by-name attribute for now, but we eventually have to support that policy in the core linker. llvm-svn: 188025
* Rename TargetInfo -> LinkingContext.Rui Ueyama2013-08-061-20/+19
| | | | | | | | | Also change some local variable names: "ti" -> "context" and "_targetInfo" -> "_context". Differential Revision: http://llvm-reviews.chandlerc.com/D1301 llvm-svn: 187823
* [PECOFF] Move more code from Atoms.h to ReaderCOFF.cpp.Rui Ueyama2013-08-021-9/+52
| | | | llvm-svn: 187688
* [PECOFF] Remove COFFDefinedFileAtom::originalOffset().Rui Ueyama2013-08-021-14/+25
| | | | | | | | | | | | | | | | | The aim of this patch is to reduce the dependency from COFFDefinedAtom to COFF structs defined in llvm/Object/COFF.h. Currently many attributes of the atom are computed in the atom. That provide a simple interface but does not work well in some cases. There are some cases that the same type atom is created from different parts of a COFF file. One example is the BSS atom, which can be created from the defined symbol in the .bss section or from the undefined symbol. Computing attributes from different sources in the atom complicates the code. We should compute it outside the atom. In the next patch, I'll move more code from Atoms.h to ReaderCOFF.cpp. llvm-svn: 187681
* [PECOFF] Handle .drectve section.Rui Ueyama2013-08-021-2/+130
| | | | | | | | | | | | | | | | | | | | | | | Summary: The .drectve section contains linker command line options, and the linker is expected to interpret them as if they were given via the command line. In this patch, the command line parser in the driver is called from the object file reader to parse the string. I think this patch is important, because this is the first step towards mutable TargetInfo. We had a discussion about that on llvm-commits mailing list before. I haven't removed "const" from the function signature yet. Instead, I just use cast to remove "const". This is a temporary aid for an experiment. If we don't see any issue with this mutable TargetInfo appraoch, I'll change the function signature, and rename the class LinkerContext from TargetInfo. Reviewers: kledzik CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1246 llvm-svn: 187677
* [PECOFF] Return an error_code instead of calling report_fatal_error().Rui Ueyama2013-08-021-8/+14
| | | | | | | | For an invalid input we should not call report_fatal_error(), because when LLD is used as a library, we don't want to kill the whole app because of a malformed input. llvm-svn: 187673
* Use report_fatal_error() instead of llvm_unreachable() to show broken input ↵Rui Ueyama2013-08-021-1/+1
| | | | | | file error. llvm-svn: 187670
* [PECOFF] Remove an assertion that's too heavy.Rui Ueyama2013-08-021-6/+0
| | | | llvm-svn: 187665
* [PECOFF] A symbol with symbol with section number 0 and non-zero value ↵Rui Ueyama2013-08-021-0/+14
| | | | | | represents a BSS atom. llvm-svn: 187645
* [PECOFF] Simplify COFFBSSAtom.Rui Ueyama2013-08-021-2/+1
| | | | | | | A instance of the class always represents a BSS atom, so we don't need to look at the symbol or the section to retrieve its attributes. llvm-svn: 187643
* [PECOFF] Emit BSS section.Rui Ueyama2013-07-301-3/+22
| | | | llvm-svn: 187460
* [PECOFF] Split COFFDefinedAtom to add COFFBSSAtom class.Rui Ueyama2013-07-301-13/+16
| | | | | | | | The BSS atom is similar to the regular defined atom, but it's different in the sense that it does not have contents. Until now we assumed all the defined atoms have its contents. That did not fit well to the BSS atom. llvm-svn: 187453
* [PECOFF] Simplicy FileCOFF ctor. No functionality change.Rui Ueyama2013-07-281-73/+87
| | | | | | | | | Member functions to read the symbol table had too many parameters to propagate all the temporary information from one to another. By storing the information to data members, we can simplify the function signatures and improve the readability. llvm-svn: 187321
* Removed unnecessary parameter.Rui Ueyama2013-07-281-2/+1
| | | | llvm-svn: 187317
* [PECOFF] Skip a section if there's no atom in the section.Rui Ueyama2013-07-271-0/+7
| | | | | | | Some sections, such as with IMAGE_SCN_LNK_REMOVE attribute, is skipped in the first pass. Such sections need to be skipped in the latter passes. llvm-svn: 187281
* Make local variables to start with a lowercase character for consistency ↵Rui Ueyama2013-07-261-54/+54
| | | | | | with the LLD coding style. llvm-svn: 187215
* [PECOFF] Simplicy object allocation code. No functionality change.Rui Ueyama2013-07-261-15/+13
| | | | llvm-svn: 187214
* [PECOFF] Ignore sections with IMAGE_SCN_LNK_REMOVE attribute.Rui Ueyama2013-07-261-0/+5
| | | | llvm-svn: 187211
* [PECOFF] Create an atom for a symbol whose storage type is ↵Rui Ueyama2013-07-261-2/+4
| | | | | | IMAGE_SYM_CLASS_LABEL. llvm-svn: 187177
* Rename ReaderCOFF members to follow the LLD coding style.Rui Ueyama2013-07-221-31/+31
| | | | llvm-svn: 186843
* Add "explicit" to ctors where appropriate.Rui Ueyama2013-07-031-1/+2
| | | | llvm-svn: 185517
* Move a function into assert() so that GCC won't complain that theRui Ueyama2013-06-291-6/+5
| | | | | | function is not used in release build. llvm-svn: 185248
* [PECOFF][Writer] Skip ".debug$S" section in the input object file.Rui Ueyama2013-06-281-0/+7
| | | | llvm-svn: 185129
* [PECOFF] Moves a utility function to Atoms.cpp to remove duplicate code.Rui Ueyama2013-06-221-20/+1
| | | | llvm-svn: 184653
* [PECOFF] Removed unnecessary namespace qualifier.Rui Ueyama2013-06-221-7/+7
| | | | llvm-svn: 184649
* [PECOFF] Add a pass to ensure the correct ordering of grouped sections.Rui Ueyama2013-06-191-19/+12
| | | | | | | | | | Reviewers: shankarke CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D998 llvm-svn: 184327
* [PECOFF] Extract atom definitions as Atoms.h so that we can use them in ↵Rui Ueyama2013-06-171-222/+5
| | | | | | | | | | | | | | | other files. Extract atom definitions as Atoms.h so that we can use them in other files. Also applied clang-format to Atoms.h. Reviewers: shankarke CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D995 llvm-svn: 184124
* [PECOFF] Implement the reader for the import library.Rui Ueyama2013-06-171-1/+3
| | | | | | | | | | | | | This is the first patch toward full DLL support. With this patch, lld can read .lib file for a DLL. Reviewers: Bigcheese CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D987 llvm-svn: 184101
* [PECOFF] Connect defined atoms with layout before/after edges.Rui Ueyama2013-06-171-0/+39
| | | | | | | | | | Reviewers: shankarke CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D989 llvm-svn: 184085
* [PECOFF] Support .lib archive file.Rui Ueyama2013-06-151-3/+18
| | | | | | | | Archive file in Windows has file extension of ".lib" but the file format is in fact the same as Unix. It's an ar archive holding multiple .obj files. The existing archive reader can read .lib files. llvm-svn: 184036
* [PECOFF] Handle scope of absolute atom correctly.Rui Ueyama2013-06-151-5/+7
| | | | llvm-svn: 184035
* [lld][PECOFF] Read relocation entries.Rui Ueyama2013-06-141-69/+226
| | | | | | | | | | | | | | | | | | | Summary: COFFReference class is defined to represent relocation information for COFFDefinedAtom, as ELFReference for ELFDefinedAtom. ReaderCOFF can now read relocation entries and create COFFReferences accordingly. I need to make WriterPECOFF to handle the relocation references created by the reader, but this patch is already big, so I think it's probably better to get it reviewed now. Reviewers: Bigcheese CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D976 llvm-svn: 183964
* [PECOFF] Make readSymbolTable a const function.Rui Ueyama2013-06-131-10/+11
| | | | llvm-svn: 183887
* [ARM] Remove isThumb() as it's not used and it's not in the right place.Rui Ueyama2013-06-131-4/+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
* [PECOFF] Refactoring: Split FileCOFF c'tor. No functionality change.Rui Ueyama2013-06-101-102/+123
| | | | | | | | | | | | | | | Split FileCOFF's constructor into mainly two private methods. One method is responsible to iterate over symbol tables, and other method is to atomize defined atoms. This is for readability and no changes in functionality. Reviewers: Bigcheese CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D940 llvm-svn: 183708
* [lld][PECOFF] Add WinLinkDriver and PECOFFTargetInfo.Rui Ueyama2013-05-281-8/+15
| | | | | | | | | | | | | | Add WinLinkDriver and connect it to the existing COFF reader. Remaining parts are still stubs, so while it can now read a COFF file, it still cannot link or output PE/COFF files yet. Reviewers: Bigcheese CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D865 llvm-svn: 182784
* [PECOFF] Skip section names in the symbol table because they are not atoms.Rui Ueyama2013-05-261-0/+5
| | | | llvm-svn: 182721
* Revert "Correctly pass ownership of MemoryBuffers."Michael J. Spencer2013-04-051-2/+2
| | | | llvm-svn: 178918
* Correctly pass ownership of MemoryBuffers.Michael J. Spencer2013-04-051-2/+2
| | | | llvm-svn: 178914
* This is my Driver refactoring patch. Nick Kledzik2013-04-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | 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 File::kind.Michael J. Spencer2013-03-201-1/+1
| | | | | | This is the standard way of implementing LLVM RTTI. llvm-svn: 177555
* [lld] remove trailing whitespaceShankar Easwaran2013-03-141-1/+1
| | | | llvm-svn: 177079
* add elf targethandlerShankar Easwaran2013-01-251-6/+10
| | | | llvm-svn: 173430
* Add SectionPosition and OrderPassNick Kledzik2013-01-231-0/+4
| | | | llvm-svn: 173300
OpenPOWER on IntegriCloud