diff options
Diffstat (limited to 'llvm/tools/llvm-objcopy')
| -rw-r--r-- | llvm/tools/llvm-objcopy/COFF/Writer.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/tools/llvm-objcopy/COFF/Writer.cpp b/llvm/tools/llvm-objcopy/COFF/Writer.cpp index d7a5224b5ef..213cb11b788 100644 --- a/llvm/tools/llvm-objcopy/COFF/Writer.cpp +++ b/llvm/tools/llvm-objcopy/COFF/Writer.cpp @@ -154,12 +154,11 @@ Error COFFWriter::finalize(bool IsBigObj) { size_t PointerToSymbolTable = FileSize; // StrTabSize <= 4 is the size of an empty string table, only consisting // of the length field. - if (SymTabSize == 0 && StrTabSize <= 4) { - // Don't point to the symbol table if empty. + if (SymTabSize == 0 && StrTabSize <= 4 && Obj.IsPE) { + // For executables, don't point to the symbol table and skip writing + // the length field, if both the symbol and string tables are empty. PointerToSymbolTable = 0; - // For executables, skip the length field of an empty string table. - if (Obj.IsPE) - StrTabSize = 0; + StrTabSize = 0; } size_t NumRawSymbols = SymTabSize / SymbolSize; |

