summaryrefslogtreecommitdiffstats
path: root/lld/COFF/ModuleDef.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Re-land "COFF: migrate def parser from LLD to LLVM"Reid Kleckner2017-06-021-304/+0
| | | | | | | | | | | | | | | | | | | | | | This reverts commit r304561 and re-lands r303490 & co. The fix was to use "SymbolName" when translating LLD's internal export list to lib/Object's short export struct. The SymbolName reflects the actual symbol name, which may include fastcall and stdcall mangling bits not included in the /EXPORT or .def file EXPORTS name: @@ -434,8 +434,7 @@ std::vector<COFFShortExport> createCOFFShortExportFromConfig() { std::vector<COFFShortExport> Exports; for (Export &E1 : Config->Exports) { COFFShortExport E2; - E2.Name = E1.Name; + // Use SymbolName, which will have any stdcall or fastcall qualifiers. + E2.Name = E1.SymbolName; E2.ExtName = E1.ExtName; E2.Ordinal = E1.Ordinal; E2.Noname = E1.Noname; llvm-svn: 304573
* Revert "COFF: migrate def parser from LLD to LLVM"Reid Kleckner2017-06-021-0/+304
| | | | | | | | | | This reverts commits r303490, r303491, r303493, and r303494. This caused http://crbug.com/728726. Essentially, exporting stdcall functions doesn't appear to work after this change. Reduced test case soon. llvm-svn: 304561
* COFF: migrate def parser from LLD to LLVM [2/2]Martell Malone2017-05-201-304/+0
| | | | | | | | | | | | This is split up into two commits. This commit removes the DEF parser from LLD See the previous commit for the creation in LLVM. Reviewers: ruiu Differential Revision: https://reviews.llvm.org/D32689 llvm-svn: 303491
* COFF: add support for CONSTANT exportsSaleem Abdulrasool2017-04-211-0/+7
| | | | | | | | The CONSTANT export type is marked as obsolete, but link still supports this. Furthermore, WinObjC uses this for certain exports. Add support for this export type. llvm-svn: 301013
* [COFF] Don't let /def override /out filenameReid Kleckner2017-03-211-7/+15
| | | | | | | | | | | | | | | | Summary: This also delays setting the output filename based on the first input argument until after processing /def. Fixes PR32354 Reviewers: ruiu, pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31152 llvm-svn: 298327
* Remove lld/Support/Memory.h.Rui Ueyama2016-12-181-1/+1
| | | | | | | | | | | | I thought for a while about how to remove it, but it looks like we can just copy the file for now. Of course I'm not happy about that, but it's just less than 50 lines of code, and we already have duplicate code in Error.h and some other places. I want to solve them all at once later. Differential Revision: https://reviews.llvm.org/D27819 llvm-svn: 290062
* Fix -Wunused-private-field.Rui Ueyama2016-12-081-1/+0
| | | | llvm-svn: 289112
* COFF: Use a string saver in Memory.h in Driver.Rui Ueyama2016-12-081-6/+5
| | | | llvm-svn: 289104
* Remove unnecessary explicit call of Twine ctor.Rui Ueyama2016-07-151-5/+5
| | | | llvm-svn: 275512
* COFF: Rename noreturn error -> fatal.Rui Ueyama2016-07-141-7/+7
| | | | | | This new name is also consistent with ELF. llvm-svn: 275500
* [LLD] Fix Clang-tidy modernize-use-nullptr warnings; other minor cleanups.Rui Ueyama2015-10-021-1/+1
| | | | | | Patch from Eugene Zelenko! llvm-svn: 249111
* COFF: Improve dllexported name mangling compatibility.Rui Ueyama2015-08-311-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The rules for dllexported symbols are overly complicated due to x86 name decoration, fuzzy symbol resolution, and the fact that one symbol can be resolved by so many different names. The rules are probably intended to be "intuitive", so that users don't have to understand the name mangling schemes, but it seems that it can lead to unintended symbol exports. To make it clear what I'm trying to do with this patch, let me write how the export rules are subtle and complicated. - x86 name decoration: If machine type is i386 and export name is given by a command line option, like /export:foo, the real symbol name the linker has to search for is _foo because all symbols are decorated with "_" prefixes. This doesn't happen on non-x86 machines. This automatic name decoration happens only when the name is not C++ mangled. However, the symbol name exported from DLLs are ones without "_" on all platforms. Moreover, if the option is given via .drectve section, no symbol decoration is done (the reason being that the .drectve section is created by a compiler and the compiler should always know the exact name of the symbol, I guess). - Fuzzy symbol resolution: In addition to x86 name decoration, the linker has to look for cdecl or C++ mangled symbols for a given /export. For example, it searches for not only _foo but also _foo@<number> or ??foo@... for /export:foo. Previous implementation didn't get it right. I'm trying to make it as compatible with MSVC linker as possible with this patch however the rules are. The new code looks a bit messy to me, but I don't think it can be simpler due to the ad-hoc-ness of the rules. llvm-svn: 246424
* Update for llvm api change.Rafael Espindola2015-08-131-3/+3
| | | | llvm-svn: 244856
* Port the error functions from ELF to COFF.Rafael Espindola2015-08-061-76/+45
| | | | | | | | | | | | | | | This has a few advantages * Less C++ code (about 300 lines less). * Less machine code (about 14 KB of text on a linux x86_64 build). * It is more debugger friendly. Just set a breakpoint on the exit function and you get the complete lld stack trace of when the error was found. * It is a more robust API. The errors are handled early and we don't get a std::error_code hot potato being passed around. * In most cases the error function in a better position to print diagnostics (it has more context). llvm-svn: 244215
* COFF: Use short identifiers. NFC.Rui Ueyama2015-07-251-1/+1
| | | | llvm-svn: 243229
* COFF: Don't assume !is64() means i386.Rui Ueyama2015-07-251-1/+1
| | | | | | | | In many places we assumed that is64() means AMD64 and i386 otherwise. This assumption is not sound because Windows also supports ARM. The linker doesn't support ARM yet, but this is a first step. llvm-svn: 243188
* COFF: Fix mangled dllexported names.Rui Ueyama2015-07-151-2/+2
| | | | | | | | | If a symbol is exported as /export:foo, and foo is resolved as a mangled name (_foo@<number> or ?foo@@Y...), that mangled name should be written to the export table. Previously, we wrote the original name to the export table. llvm-svn: 242342
* COFF: Fix dllexported symbol names on x86.Rui Ueyama2015-07-091-3/+8
| | | | | | | | Symbol names are usually mangled by appending "_" prefix on x86. But the mangled name is not used in DLL export table. The export table contains unmangled names. llvm-svn: 241872
* COFF: Fix lexer for the module-definition file.Rui Ueyama2015-06-251-3/+1
| | | | | | Previously it would hang if there's a stray punctuation (e.g. ?). llvm-svn: 240697
* COFF: Support module-definition files.Rui Ueyama2015-06-171-0/+311
Module-definition files (.def files) are yet another way to specify parameters to the linker. You can write a list of dllexported symbols in module-definition files instead of using /export command line option. It also supports a few more directives. The parser code is taken from lib/Driver/WinLinkModuleDef.cpp with the following modifications. - variable names are updated to comply with the LLVM coding style. - Instead of returning parsing results as "directive" objects, it updates Config object directly. llvm-svn: 239929
OpenPOWER on IntegriCloud