diff options
Diffstat (limited to 'bfd/mach-o-arm.c')
-rw-r--r-- | bfd/mach-o-arm.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/bfd/mach-o-arm.c b/bfd/mach-o-arm.c index e731522..9eb614c 100644 --- a/bfd/mach-o-arm.c +++ b/bfd/mach-o-arm.c @@ -30,7 +30,7 @@ #define bfd_mach_o_mkobject bfd_mach_o_arm_mkobject #define bfd_mach_o_canonicalize_one_reloc bfd_mach_o_arm_canonicalize_one_reloc -#define bfd_mach_o_swap_reloc_out NULL +#define bfd_mach_o_swap_reloc_out NULL #define bfd_mach_o_bfd_reloc_type_lookup bfd_mach_o_arm_bfd_reloc_type_lookup #define bfd_mach_o_bfd_reloc_name_lookup bfd_mach_o_arm_bfd_reloc_name_lookup @@ -147,10 +147,12 @@ static reloc_howto_type arm_howto_table[]= }; static bfd_boolean -bfd_mach_o_arm_canonicalize_one_reloc (bfd *abfd, - struct mach_o_reloc_info_external *raw, - arelent *res, asymbol **syms) - { +bfd_mach_o_arm_canonicalize_one_reloc (bfd * abfd, + struct mach_o_reloc_info_external * raw, + arelent * res, + asymbol ** syms, + arelent * res_base) +{ bfd_mach_o_reloc_info reloc; if (!bfd_mach_o_pre_canonicalize_one_reloc (abfd, raw, &reloc, res, syms)) @@ -161,6 +163,9 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd *abfd, switch (reloc.r_type) { case BFD_MACH_O_ARM_RELOC_PAIR: + /* PR 21813: Check for a corrupt PAIR reloc at the start. */ + if (res == res_base) + return FALSE; if (reloc.r_length == 2) { res->howto = &arm_howto_table[7]; @@ -174,6 +179,7 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd *abfd, return TRUE; } return FALSE; + case BFD_MACH_O_ARM_RELOC_SECTDIFF: if (reloc.r_length == 2) { @@ -186,6 +192,7 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd *abfd, return TRUE; } return FALSE; + case BFD_MACH_O_ARM_RELOC_LOCAL_SECTDIFF: if (reloc.r_length == 2) { @@ -198,6 +205,7 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd *abfd, return TRUE; } return FALSE; + case BFD_MACH_O_ARM_RELOC_HALF_SECTDIFF: switch (reloc.r_length) { @@ -209,8 +217,9 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd *abfd, return TRUE; } return FALSE; + default: - return FALSE; + break; } } else @@ -239,24 +248,23 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd *abfd, return FALSE; } break; + case BFD_MACH_O_ARM_RELOC_BR24: if (reloc.r_length == 2 && reloc.r_pcrel == 1) { res->howto = &arm_howto_table[11]; return TRUE; } - else - return FALSE; break; + case BFD_MACH_O_THUMB_RELOC_BR22: if (reloc.r_length == 2 && reloc.r_pcrel == 1) { res->howto = &arm_howto_table[16]; return TRUE; } - else - return FALSE; break; + case BFD_MACH_O_ARM_RELOC_HALF: if (reloc.r_pcrel == 0) switch (reloc.r_length) @@ -268,7 +276,8 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd *abfd, res->howto = &arm_howto_table[14]; return TRUE; } - return FALSE; + break; + case BFD_MACH_O_ARM_RELOC_PAIR: if (res[-1].howto == &arm_howto_table[12] && reloc.r_length == 0) @@ -290,11 +299,14 @@ bfd_mach_o_arm_canonicalize_one_reloc (bfd *abfd, res->address = res[-1].address; return TRUE; } - return FALSE; + break; + default: - return FALSE; + break; } } + + return FALSE; } static reloc_howto_type * |