[llvm] 2eb7e5f - [yaml2obj] Do not write the string table if there is no string entry.
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 25 19:38:41 PDT 2021
Author: Esme-Yi
Date: 2021-07-26T02:37:49Z
New Revision: 2eb7e5f0eda72b7989f17827a325035075f6bd3d
URL: https://github.com/llvm/llvm-project/commit/2eb7e5f0eda72b7989f17827a325035075f6bd3d
DIFF: https://github.com/llvm/llvm-project/commit/2eb7e5f0eda72b7989f17827a325035075f6bd3d.diff
LOG: [yaml2obj] Do not write the string table if there is no string entry.
Summary: yaml2obj shouldn't create the string table that isn't needed
- doing so wastes time and disk space.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D106420
Added:
Modified:
llvm/lib/ObjectYAML/XCOFFEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ObjectYAML/XCOFFEmitter.cpp b/llvm/lib/ObjectYAML/XCOFFEmitter.cpp
index 2fd73a77cae5..14fea5437a32 100644
--- a/llvm/lib/ObjectYAML/XCOFFEmitter.cpp
+++ b/llvm/lib/ObjectYAML/XCOFFEmitter.cpp
@@ -317,12 +317,11 @@ bool XCOFFWriter::writeXCOFF() {
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;
}
More information about the llvm-commits
mailing list