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

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 01:04:04 PST 2024


================
@@ -645,7 +676,7 @@ void XCOFFWriter::writeAuxSymbol(
 
 bool XCOFFWriter::writeSymbols() {
   int64_t PaddingSize =
-      (uint64_t)InitFileHdr.SymbolTableOffset - (W.OS.tell() - StartOffset);
+      InitFileHdr.SymbolTableOffset - (W.OS.tell() - StartOffset);
   if (PaddingSize < 0) {
----------------
jh7370 wrote:

Not code you've introduced (but perhaps removing the cast makes it riskier), but I don't see a test case for this bit of code, and I'm a little concerned that this could unexpectedly fail to catch things, given that the above code is relying on implicit conversion between unsigned to signed in the hope that the size range is such that the result will be negative. I'd appreciate a test case in a later PR for it.

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


More information about the llvm-commits mailing list