[lld] r207491 - [PECOFF] /export accepts non-decorated symbols.
Rui Ueyama
ruiu at google.com
Mon Apr 28 19:50:35 PDT 2014
Author: ruiu
Date: Mon Apr 28 21:50:35 2014
New Revision: 207491
URL: http://llvm.org/viewvc/llvm-project?rev=207491&view=rev
Log:
[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.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp
lld/trunk/test/pecoff/Inputs/export.obj.yaml
Modified: lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp?rev=207491&r1=207490&r2=207491&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp Mon Apr 28 21:50:35 2014
@@ -46,11 +46,18 @@ static void assignOrdinals(PECOFFLinking
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);
Modified: lld/trunk/test/pecoff/Inputs/export.obj.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/Inputs/export.obj.yaml?rev=207491&r1=207490&r2=207491&view=diff
==============================================================================
--- lld/trunk/test/pecoff/Inputs/export.obj.yaml (original)
+++ lld/trunk/test/pecoff/Inputs/export.obj.yaml Mon Apr 28 21:50:35 2014
@@ -32,7 +32,7 @@ symbols:
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- - Name: _exportfn2
+ - Name: "_exportfn2 at 8"
Value: 16
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
More information about the llvm-commits
mailing list