[lld] r299289 - Change the error format to report corrupted .eh_frame.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 31 18:42:21 PDT 2017


Author: ruiu
Date: Fri Mar 31 20:42:20 2017
New Revision: 299289

URL: http://llvm.org/viewvc/llvm-project?rev=299289&view=rev
Log:
Change the error format to report corrupted .eh_frame.

Modified:
    lld/trunk/ELF/EhFrame.cpp
    lld/trunk/test/ELF/invalid-cie-length.s
    lld/trunk/test/ELF/invalid-cie-length2.s
    lld/trunk/test/ELF/invalid-cie-length3.s
    lld/trunk/test/ELF/invalid-cie-length4.s

Modified: lld/trunk/ELF/EhFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/EhFrame.cpp?rev=299289&r1=299288&r2=299289&view=diff
==============================================================================
--- lld/trunk/ELF/EhFrame.cpp (original)
+++ lld/trunk/ELF/EhFrame.cpp Fri Mar 31 20:42:20 2017
@@ -44,8 +44,8 @@ public:
 
 private:
   template <class P> void failOn(const P *Loc, const Twine &Msg) {
-    fatal(IS->getLocation<ELFT>((const uint8_t *)Loc - IS->Data.data()) + ": " +
-          Msg);
+    fatal("corrupted .eh_frame: " + Msg + "\n>>> defined in " +
+          IS->getObjMsg<ELFT>((const uint8_t *)Loc - IS->Data.data()));
   }
 
   uint8_t readByte();

Modified: lld/trunk/test/ELF/invalid-cie-length.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid-cie-length.s?rev=299289&r1=299288&r2=299289&view=diff
==============================================================================
--- lld/trunk/test/ELF/invalid-cie-length.s (original)
+++ lld/trunk/test/ELF/invalid-cie-length.s Fri Mar 31 20:42:20 2017
@@ -3,7 +3,8 @@
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
 // RUN: not ld.lld %t -o %t2 2>&1 | FileCheck %s
 
-        .section .eh_frame
-        .byte 0
+.section .eh_frame
+.byte 0
 
-// CHECK: {{.*}}:(.eh_frame+0x0): CIE/FDE too small
+// CHECK:      error: corrupted .eh_frame: CIE/FDE too small
+// CHECK-NEXT: >>> defined in {{.*}}:(.eh_frame+0x0)

Modified: lld/trunk/test/ELF/invalid-cie-length2.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid-cie-length2.s?rev=299289&r1=299288&r2=299289&view=diff
==============================================================================
--- lld/trunk/test/ELF/invalid-cie-length2.s (original)
+++ lld/trunk/test/ELF/invalid-cie-length2.s Fri Mar 31 20:42:20 2017
@@ -3,7 +3,8 @@
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
 // RUN: not ld.lld %t -o %t2 2>&1 | FileCheck %s
 
-        .section .eh_frame
-        .long 42
+.section .eh_frame
+.long 42
 
-// CHECK: {{.*}}:(.eh_frame+0x0): CIE/FDE ends past the end of the section
+// CHECK:      error: corrupted .eh_frame: CIE/FDE ends past the end of the section
+// CHECK-NEXT: >>> defined in {{.*}}:(.eh_frame+0x0)

Modified: lld/trunk/test/ELF/invalid-cie-length3.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid-cie-length3.s?rev=299289&r1=299288&r2=299289&view=diff
==============================================================================
--- lld/trunk/test/ELF/invalid-cie-length3.s (original)
+++ lld/trunk/test/ELF/invalid-cie-length3.s Fri Mar 31 20:42:20 2017
@@ -3,7 +3,9 @@
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
 // RUN: not ld.lld %t -o %t2 2>&1 | FileCheck %s
 
- .section .eh_frame
- .long 0xFFFFFFFC
+.section .eh_frame
+.long 0xFFFFFFFC
+
+// CHECK:      error: corrupted .eh_frame: CIE/FDE ends past the end of the section
+// CHECK-NEXT: >>> defined in {{.*}}:(.eh_frame+0x0)
 
-// CHECK: {{.*}}:(.eh_frame+0x0): CIE/FDE ends past the end of the section

Modified: lld/trunk/test/ELF/invalid-cie-length4.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid-cie-length4.s?rev=299289&r1=299288&r2=299289&view=diff
==============================================================================
--- lld/trunk/test/ELF/invalid-cie-length4.s (original)
+++ lld/trunk/test/ELF/invalid-cie-length4.s Fri Mar 31 20:42:20 2017
@@ -3,8 +3,9 @@
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
 // RUN: not ld.lld %t -o %t2 2>&1 | FileCheck %s
 
- .section .eh_frame
- .long 0xFFFFFFFF
- .byte 0
+.section .eh_frame
+.long 0xFFFFFFFF
+.byte 0
 
-// CHECK: {{.*}}:(.eh_frame+0x0): CIE/FDE too large
+// CHECK:      error: corrupted .eh_frame: CIE/FDE too large
+// CHECK-NEXT: >>> defined in {{.*}}:(.eh_frame+0x0)




More information about the llvm-commits mailing list