diff --git a/llvm/lib/ObjectYAML/XCOFFEmitter.cpp b/llvm/lib/ObjectYAML/XCOFFEmitter.cpp --- a/llvm/lib/ObjectYAML/XCOFFEmitter.cpp +++ b/llvm/lib/ObjectYAML/XCOFFEmitter.cpp @@ -317,12 +317,11 @@ if (!writeRelocations()) return false; } - if (!Obj.Symbols.empty()) { - if (!writeSymbols()) - return false; - // Write the string table. + if (!Obj.Symbols.empty() && !writeSymbols()) + return false; + // Write the string table. + if (Strings.getSize() > 4) Strings.write(W.OS); - } return true; }