aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-hppa.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-18 18:33:14 +1030
committerAlan Modra <amodra@gmail.com>2019-12-18 18:38:13 +1030
commit2365f8d70c50afbfd6be69a4076ea6e78fb5485d (patch)
treefbb92f4ec54f3a4fb3efdff76ca0a248f6faf121 /bfd/elf32-hppa.c
parent2480b6fa946bb2d2dc993b1c4a83a8e1258a75e8 (diff)
downloadgdb-2365f8d70c50afbfd6be69a4076ea6e78fb5485d.zip
gdb-2365f8d70c50afbfd6be69a4076ea6e78fb5485d.tar.gz
gdb-2365f8d70c50afbfd6be69a4076ea6e78fb5485d.tar.bz2
Yet more signed overflow fixes
* elf-bfd.h (ELF_LOCAL_SYMBOL_HASH): Avoid signed overflow. * elf32-hppa.c (final_link_relocate): Likewise. * elf32-ppc.c (_bfd_elf_ppc_at_tls_transform): Likewise. (_bfd_elf_ppc_at_tprel_transform, is_insn_ds_form): Likewise. (is_insn_dq_form, ppc_elf_relocate_section): Likewise. * elf64-ppc.c (ok_lo_toc_insn, ppc64_elf_edit_toc): Likewise. (ppc64_elf_relocate_section): Likewise. * elfxx-mips.c (mips_elf_perform_relocation): Likewise. * netbsd.h (N_SET_FLAGS): Likewise.
Diffstat (limited to 'bfd/elf32-hppa.c')
-rw-r--r--bfd/elf32-hppa.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 35564dd..25b2cd5 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -3221,7 +3221,7 @@ final_link_relocate (asection *input_section,
struct elf32_hppa_link_hash_entry *hh,
struct bfd_link_info *info)
{
- int insn;
+ unsigned int insn;
unsigned int r_type = ELF32_R_TYPE (rela->r_info);
unsigned int orig_r_type = r_type;
reloc_howto_type *howto = elf_hppa_howto_table + r_type;
@@ -3340,7 +3340,7 @@ final_link_relocate (asection *input_section,
/* GCC sometimes uses a register other than r19 for the
operation, so we must convert any addil instruction
that uses this relocation. */
- if ((insn & 0xfc000000) == ((int) OP_ADDIL << 26))
+ if ((insn & 0xfc000000) == OP_ADDIL << 26)
insn = ADDIL_DP;
else
/* We must have a ldil instruction. It's too hard to find
@@ -3374,8 +3374,8 @@ final_link_relocate (asection *input_section,
instance: "extern int foo" with foo defined as "const int foo". */
if (sym_sec == NULL || (sym_sec->flags & SEC_CODE) != 0)
{
- if ((insn & ((0x3f << 26) | (0x1f << 21)))
- == (((int) OP_ADDIL << 26) | (27 << 21)))
+ if ((insn & ((0x3fu << 26) | (0x1f << 21)))
+ == ((OP_ADDIL << 26) | (27 << 21)))
{
insn &= ~ (0x1f << 21);
}