aboutsummaryrefslogtreecommitdiff
path: root/bfd/mach-o-arm.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2019-06-26 17:03:32 +0100
committerNick Clifton <nickc@redhat.com>2019-06-26 17:03:32 +0100
commita68aa5d3020948564ef99d704d27e458ba22ad9d (patch)
treee413d62d4438b6a7605e7771c0028d89eba01e97 /bfd/mach-o-arm.c
parent762c164d754fc456aa4764d2ed19cc4a3ec625fb (diff)
downloadgdb-a68aa5d3020948564ef99d704d27e458ba22ad9d.zip
gdb-a68aa5d3020948564ef99d704d27e458ba22ad9d.tar.gz
gdb-a68aa5d3020948564ef99d704d27e458ba22ad9d.tar.bz2
Ensure that when attempting to process an ARM Mach-O file with unknown relocs, that a suitable error message is displayed.
PR 24703 binutils* bucomm.c (bfd_nonfatal): If no bfd error code has been set then indicate this in the output. (bfd_nonfatal_message): Likewise. bfd * mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add error messages for failures. * mach-o.c (bfd_mach_o_canonicalize_relocs): Set an bfd error code if returning an error value.
Diffstat (limited to 'bfd/mach-o-arm.c')
-rw-r--r--bfd/mach-o-arm.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/bfd/mach-o-arm.c b/bfd/mach-o-arm.c
index 2c14740..2a25d70 100644
--- a/bfd/mach-o-arm.c
+++ b/bfd/mach-o-arm.c
@@ -156,7 +156,10 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd * abfd,
bfd_mach_o_reloc_info reloc;
if (!bfd_mach_o_pre_canonicalize_one_reloc (abfd, raw, &reloc, res, syms))
+ {
+fprintf (stderr, "ARm 1\n");
return FALSE;
+ }
if (reloc.r_scattered)
{
@@ -165,7 +168,11 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd * abfd,
case BFD_MACH_O_ARM_RELOC_PAIR:
/* PR 21813: Check for a corrupt PAIR reloc at the start. */
if (res == res_base)
+ {
+ _bfd_error_handler (_("\
+malformed mach-o ARM reloc pair: reloc is first reloc"));
return FALSE;
+ }
if (reloc.r_length == 2)
{
res->howto = &arm_howto_table[7];
@@ -178,6 +185,8 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd * abfd,
res->address = res[-1].address;
return TRUE;
}
+ _bfd_error_handler (_("\
+malformed mach-o ARM reloc pair: invalid length: %d"), reloc.r_length);
return FALSE;
case BFD_MACH_O_ARM_RELOC_SECTDIFF:
@@ -191,6 +200,8 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd * abfd,
res->howto = &arm_howto_table[8];
return TRUE;
}
+ _bfd_error_handler (_("\
+malformed mach-o ARM sectdiff reloc: invalid length: %d"), reloc.r_length);
return FALSE;
case BFD_MACH_O_ARM_RELOC_LOCAL_SECTDIFF:
@@ -204,6 +215,9 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd * abfd,
res->howto = &arm_howto_table[9];
return TRUE;
}
+ _bfd_error_handler (_("\
+malformed mach-o ARM local sectdiff reloc: invalid length: %d"),
+ reloc.r_length);
return FALSE;
case BFD_MACH_O_ARM_RELOC_HALF_SECTDIFF:
@@ -216,6 +230,9 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd * abfd,
res->howto = &arm_howto_table[14];
return TRUE;
}
+ _bfd_error_handler (_("\
+malformed mach-o ARM half sectdiff reloc: invalid length: %d"),
+ reloc.r_length);
return FALSE;
default:
@@ -245,6 +262,9 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd * abfd,
res->howto = &arm_howto_table[3];
return TRUE;
default:
+ _bfd_error_handler (_("\
+malformed mach-o ARM vanilla reloc: invalid length: %d (pcrel: %d)"),
+ reloc.r_length, reloc.r_pcrel);
return FALSE;
}
break;
@@ -306,6 +326,8 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd * abfd,
}
}
+ _bfd_error_handler (_("\
+malformed mach-o ARM reloc: unknown reloc type: %d"), reloc.r_length);
return FALSE;
}