From 3a965f7e68853028849df25d1169624740745b72 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Sat, 1 Apr 2017 01:42:20 +0000 Subject: [PATCH] Change the error format to report corrupted .eh_frame. llvm-svn: 299289 --- lld/ELF/EhFrame.cpp | 4 ++-- lld/test/ELF/invalid-cie-length.s | 7 ++++--- lld/test/ELF/invalid-cie-length2.s | 7 ++++--- lld/test/ELF/invalid-cie-length3.s | 8 +++++--- lld/test/ELF/invalid-cie-length4.s | 9 +++++---- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lld/ELF/EhFrame.cpp b/lld/ELF/EhFrame.cpp index 0828f114df31..90be30a5f0f9 100644 --- a/lld/ELF/EhFrame.cpp +++ b/lld/ELF/EhFrame.cpp @@ -44,8 +44,8 @@ public: private: template void failOn(const P *Loc, const Twine &Msg) { - fatal(IS->getLocation((const uint8_t *)Loc - IS->Data.data()) + ": " + - Msg); + fatal("corrupted .eh_frame: " + Msg + "\n>>> defined in " + + IS->getObjMsg((const uint8_t *)Loc - IS->Data.data())); } uint8_t readByte(); diff --git a/lld/test/ELF/invalid-cie-length.s b/lld/test/ELF/invalid-cie-length.s index e5ba27cf4616..c6da95e609d6 100644 --- a/lld/test/ELF/invalid-cie-length.s +++ b/lld/test/ELF/invalid-cie-length.s @@ -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) diff --git a/lld/test/ELF/invalid-cie-length2.s b/lld/test/ELF/invalid-cie-length2.s index 4aea66952134..9140280ba5a7 100644 --- a/lld/test/ELF/invalid-cie-length2.s +++ b/lld/test/ELF/invalid-cie-length2.s @@ -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) diff --git a/lld/test/ELF/invalid-cie-length3.s b/lld/test/ELF/invalid-cie-length3.s index ebd2690a9d98..fcbfa7f52ba8 100644 --- a/lld/test/ELF/invalid-cie-length3.s +++ b/lld/test/ELF/invalid-cie-length3.s @@ -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 diff --git a/lld/test/ELF/invalid-cie-length4.s b/lld/test/ELF/invalid-cie-length4.s index 8c7cc00dfcaf..04f8eb2cca6b 100644 --- a/lld/test/ELF/invalid-cie-length4.s +++ b/lld/test/ELF/invalid-cie-length4.s @@ -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)