[llvm] [yaml2obj][XOFF] Update yaml2obj for XCOFF to create valid XCOFF files in more cases. (PR #77620)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 13:03:34 PST 2024


================
@@ -486,10 +543,10 @@ bool XCOFFWriter::writeSectionData() {
     XCOFFYAML::Section YamlSec = Obj.Sections[I];
     if (YamlSec.SectionData.binary_size()) {
       // Fill the padding size with zeros.
-      int64_t PaddingSize =
-          InitSections[I].FileOffsetToData - (W.OS.tell() - StartOffset);
+      int64_t PaddingSize = (uint64_t)InitSections[I].FileOffsetToData -
+                            (W.OS.tell() - StartOffset);
       if (PaddingSize < 0) {
-        ErrHandler("redundant data was written before section data");
+        ErrHandler("unexpected data was written before section data");
----------------
stephenpeckham wrote:

This error (and the 2 similar ones) should be asserts. There's no need to change the wording of the message.

https://github.com/llvm/llvm-project/pull/77620


More information about the llvm-commits mailing list