summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/PECOFF
Commit message (Collapse)AuthorAgeFilesLines
...
* [PECOFF] Set the correct PE header field value.Rui Ueyama2014-01-311-3/+4
| | | | | | | The charcateristics field should not have IMAGE_FILE_32BIT_MACHINE bit but have IMAGE_FILE_LARGE_ADDRESS_AWARE bit for PE32+. llvm-svn: 200518
* [PECOFF] Do not emit a section if it's empty.Rui Ueyama2014-01-311-1/+2
| | | | | | | The PE32+ loader does not seem to like an executable with an empty section, so we should not emit a section if it's empty. llvm-svn: 200514
* Replace magic numbers with enums.Rui Ueyama2014-01-311-1/+1
| | | | llvm-svn: 200512
* [PECOFF] Default image base address for PE32+ is 0x140000000, not 0x400000.Rui Ueyama2014-01-311-3/+8
| | | | llvm-svn: 200511
* Update for llvm api change.Rafael Espindola2014-01-301-9/+7
| | | | llvm-svn: 200443
* [PECOFF] Replace magic numbers with sizeof.Rui Ueyama2014-01-281-3/+4
| | | | llvm-svn: 200278
* [PECOFF] Implement some relocations for x86-64.Rui Ueyama2014-01-271-19/+40
| | | | llvm-svn: 200240
* [PECOFF] Implement relocations for x86-64.Rui Ueyama2014-01-271-12/+68
| | | | llvm-svn: 200185
* [PECOFF] Fix PE/COFF optional header size for PE32+.Rui Ueyama2014-01-271-2/+2
| | | | | | | The optional header for PE32+ is a bit larger than PE32 because some of its fields are extended to 8 bytes. llvm-svn: 200184
* [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
* [PECOFF] Emit PE32+ file header.Rui Ueyama2014-01-261-24/+38
| | | | llvm-svn: 200128
* [PECOFF] Use a shorter name for the parameter.Rui Ueyama2014-01-261-23/+23
| | | | llvm-svn: 200107
* [PECOFF] Set PE32+ magic value if 64 bit.Rui Ueyama2014-01-261-2/+2
| | | | llvm-svn: 200106
* [PECOFF] Use a shorter name for the PECOFF writer member.Rui Ueyama2014-01-251-15/+14
| | | | llvm-svn: 200052
* [PECOFF] Accept /machine:x64 option.Rui Ueyama2014-01-241-3/+4
| | | | | | | This is the first patch to support PE32+ format, which is the image format to use 64 bit address space on Windows/x86-64. llvm-svn: 200029
* [PECOFF] Use constant instead of magic number.Rui Ueyama2014-01-241-2/+2
| | | | llvm-svn: 200019
* 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
* Remove leading underscore from parameters.Rui Ueyama2014-01-061-4/+2
| | | | llvm-svn: 198642
* Rename parameters to fix shadow warnings.Rui Ueyama2014-01-061-3/+4
| | | | llvm-svn: 198641
* [PECOFF] Simplify: Replace two-value enum with bool.Rui Ueyama2014-01-062-5/+3
| | | | llvm-svn: 198634
* Use scoped enum.Rui Ueyama2014-01-032-3/+5
| | | | llvm-svn: 198396
* Simplify if ... return repetition.Rui Ueyama2013-12-281-7/+2
| | | | llvm-svn: 198108
* [PECOFF] Warn only when /export options are not compatible.Rui Ueyama2013-12-281-4/+21
| | | | | | | | | | Currently LLD always print a warning message if the same symbol is specified more than once for /export option. It's a bit annoying because specifying the same symbol with compatible options is actually safe and considered as a normal use case. This patch makes LLD to warn only when incompatible export options are given. llvm-svn: 198104
* temporary commitRui Ueyama2013-12-283-19/+18
| | | | llvm-svn: 198103
* [PECOFF] Use std::set to store export symbol descriptors.Rui Ueyama2013-12-281-4/+7
| | | | | | | Each export symbol descriptor has unique name attribute, so std::set is better container than std::vector for it. No functionality change. llvm-svn: 198102
* [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
* Remove duplicate methods.Rui Ueyama2013-12-261-15/+2
| | | | llvm-svn: 198034
* [PECOFF] Fix wrong message.Rui Ueyama2013-12-261-1/+1
| | | | llvm-svn: 198033
* Add a newline to an error message.Rui Ueyama2013-12-251-1/+1
| | | | llvm-svn: 198016
* [PECOFF] Set default subsystem to the DLL header.Rui Ueyama2013-12-251-0/+4
| | | | | | | | Subsystem field in the PE/COFF file header has no meanining for the DLL. It looks like MSVC link.exe sets the default subsystem (Windows GUI) to the field if no /subsystem option is specified. llvm-svn: 198015
* Unbreak buildbot.Rui Ueyama2013-12-251-1/+1
| | | | llvm-svn: 198002
* [PECOFF] Use the first definition of an export if specified multiple times.Rui Ueyama2013-12-251-0/+10
| | | | | | | If the same symbol is specified multiple times as arguments of /export, the first definition should be used. llvm-svn: 197998
* [PECOFF] Fix /export option in the .drectve section.Rui Ueyama2013-12-243-4/+11
| | | | | | | /EXPORT option has slightly different semantics if it appears in the .drectve section. This patch implements it. llvm-svn: 197970
* [PECOFF] Create noname or data symbols as such.Rui Ueyama2013-12-201-2/+8
| | | | | | | | | | | If a symbol in an import library is marked as "data", the linker will not create a jump table entry for the symbol, since jump table makes sense only for a symbol pointing to a function. I don't think NONAME attribute has a meaning when creating an import library. The attribute is emitted for debugging purpose. llvm-svn: 197803
* [PECOFF] Create the import library file.Rui Ueyama2013-12-204-0/+105
| | | | | | | | | | | If the linker is instructed to create a DLL, it will also create an import library (.lib file) to describe the symbols exported by the DLL. This patch is to create the import library file. There is a convenient command "lib.exe" which can create an import library from a module definition file (.def file). The command is used in this patch. llvm-svn: 197801
* [PECOFF] Assign default export ordinals in LinkingContext::verify().Rui Ueyama2013-12-202-16/+17
| | | | | | | | | | | | | | | Default ordinals were assigned in EdataPass, and the assigned values were then discarded in the pass. No code other than EdataPass would not be able to get all of the information about ordinals. That's not ideal since I'm writing code to emit an Import Library file, which also needs ordinals. This is a patch to move the code to assign default ordinals from EdataPass to LinkingContext::verify(), so that assigned ordinals will be available anywhere. No functionality change. llvm-svn: 197797
* Run clang-format on r197727.Rui Ueyama2013-12-205-36/+32
| | | | llvm-svn: 197788
* [lld] Introduce registry and Reference kind tupleNick Kledzik2013-12-196-292/+305
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove dead code.Rui Ueyama2013-12-191-7/+0
| | | | llvm-svn: 197662
* [PECOFF] Truncate long section name.Rui Ueyama2013-12-171-5/+2
| | | | | | | Executable files do not use a string table, so section names longer than 8 characters are not permitted. Long section names should just be truncated. llvm-svn: 197470
* Remove obsolete comment.Rui Ueyama2013-12-161-2/+1
| | | | llvm-svn: 197375
* [PECOFF] Rename ExecutableWriter -> PECOFFWriter.Rui Ueyama2013-12-161-14/+14
| | | | | | Because it's now able to emit not only executable but DLL. llvm-svn: 197374
* [PECOFF] Add a check for duplicate export ordinals.Rui Ueyama2013-12-161-0/+12
| | | | llvm-svn: 197373
* [PECOFF] Support export-only-by-ordinal exports.Rui Ueyama2013-12-162-9/+16
| | | | | | | If NONAME option is given for an export, that symbol will be exported only by its ordinal. LLD will not emit the symbol name to the export table. llvm-svn: 197371
* [PECOFF] Set OrdinalBase field in the export table.Rui Ueyama2013-12-162-22/+36
| | | | | | | | | | OrdinalBase is an addend to the ordinals. We used to always set 1 to the field. Although it produced a valid a DLL export table, it'd be a waste if the first ordinal does not start with 1 -- we had to have NULL fields at the beginning of the export address table. By setting the ordinal base, we can eliminate the NULL fields. llvm-svn: 197367
* [PECOFF] Make it possible to specify export ordinals.Rui Ueyama2013-12-162-35/+75
| | | | | | | | | | | | | | | | You can specify exported function's ordinal by /export:func,@<number> command line option, but LLD ignored the option until now. This patch implements the feature. Ordinal is basically the index into the exported function address table. So, for example, if /export:foo,@42 is specified, the linker writes foo's address to 42th entry in the address table. Windows supports import-by-ordinal; you can not only import a function by name, but by its ordinal. If you want to allow your DLL users to import your functions by their ordinals, you need to make sure that your functions are always exported with the same ordinals. This is the feature for that situation. llvm-svn: 197364
* [PECOFF] Export undecorated symbols from DLL.Rui Ueyama2013-12-143-5/+25
| | | | | | | Symbol names exported from a DLL should be undecorated, not prefixed by an underscore ones. llvm-svn: 197307
* [PECOFF] Simplify EdataPass by sorting atoms from the beginning.Rui Ueyama2013-12-142-21/+11
| | | | llvm-svn: 197306
OpenPOWER on IntegriCloud