summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-05-01 22:44:42 +0000
committerRui Ueyama <ruiu@google.com>2014-05-01 22:44:42 +0000
commitefa8076c29f8306f3b683d9423e0164e9c9af870 (patch)
tree140bf28f71c719dbda4f0e1eb6b4fe0c01c0502f
parent1f03d08a8c103a3bc5de93e4f5e394c6f5ffbf1d (diff)
downloadbcm5719-llvm-efa8076c29f8306f3b683d9423e0164e9c9af870.tar.gz
bcm5719-llvm-efa8076c29f8306f3b683d9423e0164e9c9af870.zip
[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
-rw-r--r--lld/lib/ReaderWriter/PECOFF/EdataPass.cpp6
-rw-r--r--lld/test/pecoff/Inputs/export.obj.yaml10
-rw-r--r--lld/test/pecoff/export.test1
3 files changed, 15 insertions, 2 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp b/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp
index a0475301c86..8d6424138e7 100644
--- a/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp
@@ -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()) {
diff --git a/lld/test/pecoff/Inputs/export.obj.yaml b/lld/test/pecoff/Inputs/export.obj.yaml
index c1c8fcd300b..cd961862e41 100644
--- a/lld/test/pecoff/Inputs/export.obj.yaml
+++ b/lld/test/pecoff/Inputs/export.obj.yaml
@@ -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
...
diff --git a/lld/test/pecoff/export.test b/lld/test/pecoff/export.test
index 7195d07cbbd..ed3a88a855a 100644
--- a/lld/test/pecoff/export.test
+++ b/lld/test/pecoff/export.test
@@ -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
OpenPOWER on IntegriCloud