[lld] r207809 - [PECOFF] Drop stdcall's atsign suffix only.
Rui Ueyama
ruiu at google.com
Thu May 1 15:44:42 PDT 2014
Author: ruiu
Date: Thu May 1 17:44:42 2014
New Revision: 207809
URL: http://llvm.org/viewvc/llvm-project?rev=207809&view=rev
Log:
[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.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp
lld/trunk/test/pecoff/Inputs/export.obj.yaml
lld/trunk/test/pecoff/export.test
Modified: lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp?rev=207809&r1=207808&r2=207809&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp Thu May 1 17:44:42 2014
@@ -46,7 +46,9 @@ static void assignOrdinals(PECOFFLinking
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(PECOFFLinki
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()) {
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=207809&r1=207808&r2=207809&view=diff
==============================================================================
--- lld/trunk/test/pecoff/Inputs/export.obj.yaml (original)
+++ lld/trunk/test/pecoff/Inputs/export.obj.yaml Thu May 1 17:44:42 2014
@@ -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 at 256
symbols:
- Name: .text
Value: 0
@@ -36,6 +40,12 @@ symbols:
Value: 16
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: exportfn3 at 256
+ Value: 16
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
...
Modified: lld/trunk/test/pecoff/export.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/export.test?rev=207809&r1=207808&r2=207809&view=diff
==============================================================================
--- lld/trunk/test/pecoff/export.test (original)
+++ lld/trunk/test/pecoff/export.test Thu May 1 17:44:42 2014
@@ -39,3 +39,4 @@ CHECK4: DLL name: export.test.tmp4.
CHECK4: Ordinal RVA Name
CHECK4-NEXT: 5 0x2008 exportfn1
CHECK4-NEXT: 6 0x2010 exportfn2
+CHECK4-NEXT: 7 0x2010 exportfn3 at 256
More information about the llvm-commits
mailing list