summaryrefslogtreecommitdiffstats
path: root/lld/COFF/DLL.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* COFF: Allow mangled symbols as arguments for /export.Rui Ueyama2015-06-281-2/+4
| | | | | | | | | | | | | | | | | | | | Usually dllexported symbols are defined with 'extern "C"', so identifying them is easy. We can just do hash table lookup to look up exported symbols. However, C++ non-member functions are also allowed to be exported, and they can be specified with unmangled name. So, if /export:foo is given, we need to look up not only "foo" but also its all mangled names. In MSVC mangling scheme, that means that we need to look up any symbol which starts with "?foo@@Y". In this patch, we scan the entire symbol table to search for a mangled symbol. The symbol table is a DenseMap, and that doesn't support table lookup by string prefix. This is of course very inefficient. But that should be probably OK because the user should always add 'extern "C"' to dllexported symbols. llvm-svn: 240919
* COFF: Add base relocation for delay-import table.Rui Ueyama2015-06-261-0/+4
| | | | | | | | Because the address table of the delay-import table contains absolute address, it needs to be added to the base relocation table. llvm-svn: 240844
* COFF: Fix delay-import tables.Rui Ueyama2015-06-261-20/+40
| | | | | | | | | | | | There were a few issues with the previous delay-import tables. - "Attribute" field should have been 1 instead of 0. (I don't know the meaning of this field, though.) - LEA and CALL operands had wrong addresses. - Address tables are in .didat (which is read-only). They should have been in .data. llvm-svn: 240837
* Fix typo.Rui Ueyama2015-06-221-1/+1
| | | | llvm-svn: 240298
* COFF: Support delay-load import tables.Rui Ueyama2015-06-211-10/+163
| | | | | | | | | | | | | | | | DLLs are usually resolved at process startup, but you can delay-load them by passing /delayload option to the linker. If a /delayload is specified, the linker has to create data which is similar to regular import table. One notable difference is that the pointers in a delay-load import table are originally pointing to thunks that resolves themselves. Each thunk loads a DLL, resolve its name, and then overwrites the pointer with the result so that subsequent function calls directly call a desired function. The linker has to emit thunks. llvm-svn: 240250
* COFF: Support creating DLLs.Rui Ueyama2015-06-171-7/+116
| | | | | | | | | | | | DLL files are in the same format as executables but they have export tables. The format of the export table is described in PE/COFF spec section 5.3. A new class, EdataContents, takes care of creating chunks for export tables. What we need to do is to parse command line flags for dllexports, and then instantiate the class to create chunks. For the writer, export table chunks are opaque data -- it just add chunks to .edata section. llvm-svn: 239869
* COFF: Use named constants instead of sizeof().Rui Ueyama2015-06-071-2/+2
| | | | llvm-svn: 239267
* COFF: Make local variables local.Rui Ueyama2015-06-071-2/+2
| | | | llvm-svn: 239244
* COFF: Move Windows-specific code from Chunk.{cpp,h} to DLL.{cpp,h}.Rui Ueyama2015-06-071-0/+205
llvm-svn: 239239
OpenPOWER on IntegriCloud