forked from OSchip/llvm-project
[PECOFF] Drop stdcall's atsign suffix only.
You can omit @number suffix when specifying /export option, but you can do that only for stdcall functions. llvm-svn: 207809
This commit is contained in:
parent
1f03d08a8c
commit
efa8076c29
|
@ -46,7 +46,9 @@ static void assignOrdinals(PECOFFLinkingContext &ctx) {
|
|||
ctx.getDllExports().swap(exports);
|
||||
}
|
||||
|
||||
static StringRef removeAtSignSuffix(StringRef sym) {
|
||||
static StringRef removeStdcallSuffix(StringRef sym) {
|
||||
if (!sym.startswith("_"))
|
||||
return sym;
|
||||
StringRef trimmed = sym.rtrim("0123456789");
|
||||
if (sym.size() != trimmed.size() && trimmed.endswith("@"))
|
||||
return trimmed.drop_back();
|
||||
|
@ -63,7 +65,7 @@ static bool getExportedAtoms(PECOFFLinkingContext &ctx, MutableFile *file,
|
|||
std::vector<TableEntry> &ret) {
|
||||
std::map<StringRef, const DefinedAtom *> definedAtoms;
|
||||
for (const DefinedAtom *atom : file->defined())
|
||||
definedAtoms[removeAtSignSuffix(atom->name())] = atom;
|
||||
definedAtoms[removeStdcallSuffix(atom->name())] = atom;
|
||||
|
||||
std::set<PECOFFLinkingContext::ExportDesc> exports;
|
||||
for (PECOFFLinkingContext::ExportDesc desc : ctx.getDllExports()) {
|
||||
|
|
|
@ -7,6 +7,10 @@ sections:
|
|||
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
|
||||
Alignment: 4
|
||||
SectionData: B800000000506800000000680000000050E80000000050E800000000
|
||||
- Name: .drectve
|
||||
Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
|
||||
Alignment: 2147483648
|
||||
SectionData: 2f6578706f72743a6578706f7274666e334032353600 # /export:exportfn3@256
|
||||
symbols:
|
||||
- Name: .text
|
||||
Value: 0
|
||||
|
@ -38,4 +42,10 @@ symbols:
|
|||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
||||
- Name: exportfn3@256
|
||||
Value: 16
|
||||
SectionNumber: 1
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
||||
...
|
||||
|
|
|
@ -39,3 +39,4 @@ CHECK4: DLL name: export.test.tmp4.dll
|
|||
CHECK4: Ordinal RVA Name
|
||||
CHECK4-NEXT: 5 0x2008 exportfn1
|
||||
CHECK4-NEXT: 6 0x2010 exportfn2
|
||||
CHECK4-NEXT: 7 0x2010 exportfn3@256
|
||||
|
|
Loading…
Reference in New Issue