[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
This commit is contained in:
Rui Ueyama 2014-04-29 02:50:35 +00:00
parent 5bc902e8e1
commit 7f4162bd06
2 changed files with 9 additions and 2 deletions

View File

@ -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);

View File

@ -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