forked from OSchip/llvm-project
[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:
parent
5bc902e8e1
commit
7f4162bd06
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue