diff options
| author | Rui Ueyama <ruiu@google.com> | 2014-04-29 02:50:35 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2014-04-29 02:50:35 +0000 |
| commit | 7f4162bd068f43df0412dfba4f4ae4c777200312 (patch) | |
| tree | 182f24ee482a69420522cc06a6799f24d89b68cb | |
| parent | 5bc902e8e1d43da2993af124aa633eebb698c69b (diff) | |
| download | bcm5719-llvm-7f4162bd068f43df0412dfba4f4ae4c777200312.tar.gz bcm5719-llvm-7f4162bd068f43df0412dfba4f4ae4c777200312.zip | |
[PECOFF] /export accepts non-decorated symbols.
You usually have to specify the exact name of a symbol to export it,
but for stdcall functions you can omit the @numbers suffix.
llvm-svn: 207491
| -rw-r--r-- | lld/lib/ReaderWriter/PECOFF/EdataPass.cpp | 9 | ||||
| -rw-r--r-- | lld/test/pecoff/Inputs/export.obj.yaml | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp b/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp index 8decc2cd816..37b2255846e 100644 --- a/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp +++ b/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp @@ -46,11 +46,18 @@ static void assignOrdinals(PECOFFLinkingContext &ctx) { ctx.getDllExports().swap(exports); } +static StringRef removeAtSignSuffix(StringRef sym) { + StringRef trimmed = sym.rtrim("0123456789"); + if (sym.size() != trimmed.size() && trimmed.endswith("@")) + return trimmed.drop_back(); + return sym; +} + static bool getExportedAtoms(const PECOFFLinkingContext &ctx, MutableFile *file, std::vector<TableEntry> &ret) { std::map<StringRef, const DefinedAtom *> definedAtoms; for (const DefinedAtom *atom : file->defined()) - definedAtoms[atom->name()] = atom; + definedAtoms[removeAtSignSuffix(atom->name())] = atom; for (const PECOFFLinkingContext::ExportDesc &desc : ctx.getDllExports()) { auto it = definedAtoms.find(desc.name); diff --git a/lld/test/pecoff/Inputs/export.obj.yaml b/lld/test/pecoff/Inputs/export.obj.yaml index 107d40f4889..c1c8fcd300b 100644 --- a/lld/test/pecoff/Inputs/export.obj.yaml +++ b/lld/test/pecoff/Inputs/export.obj.yaml @@ -32,7 +32,7 @@ symbols: SimpleType: IMAGE_SYM_TYPE_NULL ComplexType: IMAGE_SYM_DTYPE_NULL StorageClass: IMAGE_SYM_CLASS_EXTERNAL - - Name: _exportfn2 + - Name: "_exportfn2@8" Value: 16 SectionNumber: 1 SimpleType: IMAGE_SYM_TYPE_NULL |

