diff options
| author | Rui Ueyama <ruiu@google.com> | 2015-06-28 22:16:41 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2015-06-28 22:16:41 +0000 |
| commit | f5313b34984b058d9de6f714c4911b6b523120e0 (patch) | |
| tree | ef57bd3734068cee66898bca018df15487960d83 /lld/COFF/DLL.cpp | |
| parent | 091b1a65858d6f206df7ddc9e4502c3546531ed4 (diff) | |
| download | bcm5719-llvm-f5313b34984b058d9de6f714c4911b6b523120e0.tar.gz bcm5719-llvm-f5313b34984b058d9de6f714c4911b6b523120e0.zip | |
COFF: Allow mangled symbols as arguments for /export.
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
Diffstat (limited to 'lld/COFF/DLL.cpp')
| -rw-r--r-- | lld/COFF/DLL.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lld/COFF/DLL.cpp b/lld/COFF/DLL.cpp index d44dd4b4a0b..5dda97288dc 100644 --- a/lld/COFF/DLL.cpp +++ b/lld/COFF/DLL.cpp @@ -419,8 +419,10 @@ public: size_t getSize() const override { return Size * 4; } void writeTo(uint8_t *Buf) override { - for (Export &E : Config->Exports) - write32le(Buf + FileOff + E.Ordinal * 4, E.Sym->getRVA()); + for (Export &E : Config->Exports) { + auto *D = cast<Defined>(E.Sym->Body); + write32le(Buf + FileOff + E.Ordinal * 4, D->getRVA()); + } } private: |

