[llvm] 'Soft Stop' solution on offset overflow issue: By Produceing a truncated but valid DWP file, discarding any DWO files that would not fit within the 32 bit/4GB limits of the format. (PR #71902)

Jinjie Huang via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 18:41:40 PST 2023


================
@@ -232,9 +238,12 @@ static Error addAllTypesFromDWP(
     static_assert(sizeof(OldOffset) == sizeof(TypesOffset));
     TypesOffset += C.getLength();
     if (OldOffset > TypesOffset) {
-      if (Error Err = sectionOverflowErrorOrWarning(
-              OldOffset, TypesOffset, "Types", ContinueOnCuIndexOverflow))
+      if (Error Err = sectionOverflowErrorOrWarning(OldOffset, TypesOffset,
+                                                    "Types", OverflowOptValue,
+                                                    AnySectionOverflow))
         return Err;
+      if (AnySectionOverflow)
----------------
Labman-001 wrote:

The consideration here is to allow for an early return within the loop, so we can avoid further computations on the offset and Out.emitBytes. Also, it seems that we need to revert the offset back to its not overflowed value.

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


More information about the llvm-commits mailing list