MC: Give a (lame) hard error if a .org directive would create an unreasonably
authorDaniel Dunbar <daniel@zuster.org>
Thu, 9 Sep 2010 16:23:33 +0000 (16:23 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 9 Sep 2010 16:23:33 +0000 (16:23 +0000)
large object file (> 1GB).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113494 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCAssembler.cpp

index f0e1d7fbc21c5ebc0a2a455c7a31d5dc1edb758f..8db1536d2d505f0b8d48a9c9b5ca36e53ac6f382 100644 (file)
@@ -447,7 +447,7 @@ uint64_t MCAssembler::ComputeFragmentSize(MCAsmLayout &Layout,
 
     // FIXME: We need a way to communicate this error.
     int64_t Offset = TargetLocation - FragmentOffset;
 
     // FIXME: We need a way to communicate this error.
     int64_t Offset = TargetLocation - FragmentOffset;
-    if (Offset < 0)
+    if (Offset < 0 || Offset >= 0x40000000)
       report_fatal_error("invalid .org offset '" + Twine(TargetLocation) +
                          "' (at offset '" + Twine(FragmentOffset) + "'");
 
       report_fatal_error("invalid .org offset '" + Twine(TargetLocation) +
                          "' (at offset '" + Twine(FragmentOffset) + "'");