summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-02-12 22:46:16 +0000
committerRui Ueyama <ruiu@google.com>2015-02-12 22:46:16 +0000
commitacbe51a0e30bc9f6163f0df6e303799e99f65e14 (patch)
treea82ae84eaffcc7e2772b2e5fef4479a7cd7ace41 /lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
parent7548aeeb9f1b6b15b192024d88b135d5101bf739 (diff)
downloadbcm5719-llvm-acbe51a0e30bc9f6163f0df6e303799e99f65e14.tar.gz
bcm5719-llvm-acbe51a0e30bc9f6163f0df6e303799e99f65e14.zip
PECOFF: Fix dummy symbol table in executable.
If the name field of a symbol table entry is all zero, it's interpreted as it's pointing to the beginning of the string table. The first four bytes of the string table is the size field, so dumpbin dumps that number as an ASCIZ string. This patch fills a dummy value to name field. llvm-svn: 228971
Diffstat (limited to 'lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp')
-rw-r--r--lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
index 099c370aecf..c85482032bd 100644
--- a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
@@ -195,6 +195,10 @@ public:
// We also need to reserve 4 bytes for the string table header.
int size = sizeof(llvm::object::coff_symbol16) + 4;
_stringTable.insert(_stringTable.begin(), size, 0);
+ // Set the name of the dummy symbol to the first string table entry.
+ // It's better than letting dumpbin print out a garabage as a symbol name.
+ char *off = _stringTable.data() + 4;
+ *reinterpret_cast<ulittle32_t *>(off) = 4;
}
uint32_t offset = _stringTable.size();
_stringTable.insert(_stringTable.end(), sectionName.begin(),
OpenPOWER on IntegriCloud