diff options
author | Brock Wyma <brock.wyma@intel.com> | 2018-02-11 21:26:46 +0000 |
---|---|---|
committer | Brock Wyma <brock.wyma@intel.com> | 2018-02-11 21:26:46 +0000 |
commit | 19e17b3970a65b66c719567ade70a541166b1bca (patch) | |
tree | 27817d0bb0e75b2aa4cd888d2eb2f8edd887c706 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | |
parent | 9ead7bb3d401e55ae83e093c7df75019aca70fa5 (diff) | |
download | llvm-19e17b3970a65b66c719567ade70a541166b1bca.zip llvm-19e17b3970a65b66c719567ade70a541166b1bca.tar.gz llvm-19e17b3970a65b66c719567ade70a541166b1bca.tar.bz2 |
[CodeView] Allow variable names to be as long as the codeview format supports
Instead of reserving 0xF00 bytes for the fixed length portion of the CodeView
symbol name, calculate the actual length of the fixed length portion.
Differential Revision: https://reviews.llvm.org/D42125
llvm-svn: 324850
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index f1749fb..9e714e4 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -501,12 +501,12 @@ void CodeViewDebug::endModule() { clear(); } -static void emitNullTerminatedSymbolName(MCStreamer &OS, StringRef S) { +static void emitNullTerminatedSymbolName(MCStreamer &OS, StringRef S, + unsigned MaxFixedRecordLength = 0xF00) { // The maximum CV record length is 0xFF00. Most of the strings we emit appear // after a fixed length portion of the record. The fixed length portion should // always be less than 0xF00 (3840) bytes, so truncate the string so that the // overall record size is less than the maximum allowed. - unsigned MaxFixedRecordLength = 0xF00; SmallString<32> NullTerminatedString( S.take_front(MaxRecordLength - MaxFixedRecordLength - 1)); NullTerminatedString.push_back('\0'); @@ -2448,6 +2448,7 @@ void CodeViewDebug::emitDebugInfoForGlobal(const DIGlobalVariable *DIGV, // FIXME: Thread local data, etc MCSymbol *DataBegin = MMI->getContext().createTempSymbol(), *DataEnd = MMI->getContext().createTempSymbol(); + const unsigned FixedLengthOfThisRecord = 12; OS.AddComment("Record length"); OS.emitAbsoluteSymbolDiff(DataEnd, DataBegin, 2); OS.EmitLabel(DataBegin); @@ -2475,6 +2476,6 @@ void CodeViewDebug::emitDebugInfoForGlobal(const DIGlobalVariable *DIGV, OS.AddComment("Segment"); OS.EmitCOFFSectionIndex(GVSym); OS.AddComment("Name"); - emitNullTerminatedSymbolName(OS, DIGV->getName()); + emitNullTerminatedSymbolName(OS, DIGV->getName(), FixedLengthOfThisRecord); OS.EmitLabel(DataEnd); } |