[PATCH] D54651: [ELF] Allow --noinhibit-exec to produce corrupted executable with relocation overflow

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 20 09:06:59 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL347327: [ELF] Allow --noinhibit-exec to produce corrupted executable with relocation… (authored by MaskRay, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D54651

Files:
  lld/trunk/ELF/Target.h
  lld/trunk/test/ELF/x86-64-reloc-range.s


Index: lld/trunk/test/ELF/x86-64-reloc-range.s
===================================================================
--- lld/trunk/test/ELF/x86-64-reloc-range.s
+++ lld/trunk/test/ELF/x86-64-reloc-range.s
@@ -1,6 +1,8 @@
 // REQUIRES: x86
 // RUN: llvm-mc %s -o %t.o -triple x86_64-pc-linux -filetype=obj
 // RUN: not ld.lld %t.o -o /dev/null -shared 2>&1 | FileCheck %s
+// RUN: ld.lld --noinhibit-exec -shared %t.o -o %t 2>&1 | FileCheck %s
+// RUN: ls %t
 
 // CHECK: {{.*}}:(.text+0x3): relocation R_X86_64_PC32 out of range: 2147483648 is not in [-2147483648, 2147483647]
 // CHECK-NOT: relocation
Index: lld/trunk/ELF/Target.h
===================================================================
--- lld/trunk/ELF/Target.h
+++ lld/trunk/ELF/Target.h
@@ -196,9 +196,9 @@
     Hint = "; consider recompiling with -fdebug-types-section to reduce size "
            "of debug sections";
 
-  error(ErrPlace.Loc + "relocation " + lld::toString(Type) +
-        " out of range: " + V.str() + " is not in [" + Twine(Min).str() + ", " +
-        Twine(Max).str() + "]" + Hint);
+  errorOrWarn(ErrPlace.Loc + "relocation " + lld::toString(Type) +
+              " out of range: " + V.str() + " is not in [" + Twine(Min).str() +
+              ", " + Twine(Max).str() + "]" + Hint);
 }
 
 // Make sure that V can be represented as an N bit signed integer.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54651.174795.patch
Type: text/x-patch
Size: 1349 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181120/7dc924cf/attachment.bin>


More information about the llvm-commits mailing list