diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 22 | ||||
-rw-r--r-- | bfd/bout.c | 4 | ||||
-rw-r--r-- | bfd/coff-rs6000.c | 28 | ||||
-rw-r--r-- | bfd/elf32-arm.c | 32 | ||||
-rw-r--r-- | bfd/elf32-frv.c | 2 | ||||
-rw-r--r-- | bfd/elf32-i860.c | 4 | ||||
-rw-r--r-- | bfd/elf32-msp430.c | 3 | ||||
-rw-r--r-- | bfd/elf32-score.c | 4 | ||||
-rw-r--r-- | bfd/elf32-score7.c | 4 | ||||
-rw-r--r-- | bfd/elf32-visium.c | 26 | ||||
-rw-r--r-- | bfd/elfxx-mips.c | 12 | ||||
-rw-r--r-- | bfd/mach-o.c | 2 | ||||
-rw-r--r-- | bfd/ppcboot.c | 2 |
13 files changed, 54 insertions, 91 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bdae109..c067211 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,27 @@ 2015-09-23 Nick Clifton <nickc@redhat.com> + * bout.c (b_out_slurp_reloc_table): Cast constant to unsigned in + order to avoid problems with left shifting negative values. + (abs32code): Likewise. + * mach-o.c (FILE_ALIGN): Likewise. + * coff-rs6000.c (xcoff_debug_sections): Delete unused static + array. + * elf32-visium.c (visium_reloc_map): Likewise. + * elf32-arm.c (elf32_arm_final_link_relocate): Remove useless + calls to abs function. + * elf32-frv.c (_frvfdpic_relax_tls_entries): Likewise. + * elf32-score.c (score_elf_final_link_relocate): Likewise. + * elf32-score7.c (score_elf_final_link_relocate): Likewise. + * elf32-i860.c (i860_howto_pc26_reloc): Use multiplication instead + of shifting to create a negative mask. + * elf32-msp430.c (elf_backend_special_sections): Define. + * elfxx-mips.c (got_ofst_reloc_p): Delete unused function. + (got_hi16_reloc_p): Delete unused function. + * ppcboot.c (ppcboot_bfd_print_private_bfd_data): Fix test of + partition name. + +2015-09-23 Nick Clifton <nickc@redhat.com> + PR binutils/15835 * elf-bfd.h (struct elf_section_list): New structure. (struct elf_obj_tdata): Replace symtab_shndx_hdr with @@ -783,7 +783,7 @@ b_out_slurp_reloc_table (bfd *abfd, sec_ptr asect, asymbol **symbols) /* Sign-extend symnum from 24 bits to whatever host uses. */ s = symnum; if (s & (1 << 23)) - s |= (~0) << 24; + s |= (~0U) << 24; cache_ptr->sym_ptr_ptr = (asymbol **)NULL; switch (s) @@ -1069,7 +1069,7 @@ abs32code (bfd *abfd, jump we were going to. */ gap = value - (dot - shrink); - if (-1 << 23 < (long)gap && (long)gap < 1 << 23) + if ((long)(-1UL << 23) < (long)gap && (long)gap < 1L << 23) { /* Change the reloc type from 32bitcode possible 24, to 24bit possible 32. */ diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 95430c3..b7098a1 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -402,34 +402,6 @@ _bfd_xcoff_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, { return FALSE; } - -static const struct dwarf_debug_section xcoff_debug_sections[] = -{ - { ".dwabrev", NULL }, - { ".dwarnge", NULL }, - { NULL, NULL }, /* .debug_frame */ - { ".dwinfo", NULL }, - { ".dwline", NULL }, - { NULL, NULL }, /* .debug_loc */ - { NULL, NULL }, /* .debug_macinfo */ - { NULL, NULL }, /* .debug_macro */ - { ".dwpbnms", NULL }, - { ".dwpbtyp", NULL }, - { ".dwrnges", NULL }, - { NULL, NULL }, /* .debug_static_func */ - { NULL, NULL }, /* .debug_static_vars */ - { ".dwstr", NULL }, - { NULL, NULL }, /* .debug_types */ - /* GNU DWARF 1 extensions */ - { NULL, NULL }, /* .debug_sfnames */ - { NULL, NULL }, /* .debug_srcinfo */ - /* SGI/MIPS DWARF 2 extensions */ - { NULL, NULL }, /* .debug_funcnames */ - { NULL, NULL }, /* .debug_typenames */ - { NULL, NULL }, /* .debug_varnames */ - { NULL, NULL }, /* .debug_weaknames */ - { NULL, NULL }, -}; void _bfd_xcoff_swap_sym_in (bfd *abfd, void * ext1, void * in1) diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index bd41fd0..aa01a59 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -8816,7 +8816,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, + input_section->output_offset + rel->r_offset); - value = abs (relocation); + value = relocation; if (value >= 0x1000) return bfd_reloc_overflow; @@ -8851,7 +8851,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, + input_section->output_offset + rel->r_offset); - value = abs (relocation); + value = relocation; /* We do not check for overflow of this reloc. Although strictly speaking this is incorrect, it appears to be necessary in order @@ -8888,7 +8888,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, + input_section->output_offset + rel->r_offset); - value = abs (relocation); + value = relocation; if (value >= 0x1000) return bfd_reloc_overflow; @@ -10125,8 +10125,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, /* Calculate the value of the relevant G_n, in encoded constant-with-rotation format. */ - g_n = calculate_group_reloc_mask (abs (signed_value), group, - &residual); + g_n = calculate_group_reloc_mask (signed_value < 0 ? - signed_value : signed_value, + group, &residual); /* Check for overflow if required. */ if ((r_type == R_ARM_ALU_PC_G0 @@ -10139,7 +10139,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, (*_bfd_error_handler) (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"), input_bfd, input_section, - (long) rel->r_offset, abs (signed_value), howto->name); + (long) rel->r_offset, signed_value < 0 ? - signed_value : signed_value, + howto->name); return bfd_reloc_overflow; } @@ -10219,15 +10220,16 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, /* Calculate the value of the relevant G_{n-1} to obtain the residual at that stage. */ - calculate_group_reloc_mask (abs (signed_value), group - 1, &residual); + calculate_group_reloc_mask (signed_value < 0 ? - signed_value : signed_value, + group - 1, &residual); /* Check for overflow. */ if (residual >= 0x1000) { (*_bfd_error_handler) (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"), - input_bfd, input_section, - (long) rel->r_offset, abs (signed_value), howto->name); + input_bfd, input_section, + (long) rel->r_offset, labs (signed_value), howto->name); return bfd_reloc_overflow; } @@ -10303,15 +10305,16 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, /* Calculate the value of the relevant G_{n-1} to obtain the residual at that stage. */ - calculate_group_reloc_mask (abs (signed_value), group - 1, &residual); + calculate_group_reloc_mask (signed_value < 0 ? - signed_value : signed_value, + group - 1, &residual); /* Check for overflow. */ if (residual >= 0x100) { (*_bfd_error_handler) (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"), - input_bfd, input_section, - (long) rel->r_offset, abs (signed_value), howto->name); + input_bfd, input_section, + (long) rel->r_offset, labs (signed_value), howto->name); return bfd_reloc_overflow; } @@ -10387,7 +10390,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, /* Calculate the value of the relevant G_{n-1} to obtain the residual at that stage. */ - calculate_group_reloc_mask (abs (signed_value), group - 1, &residual); + calculate_group_reloc_mask (signed_value < 0 ? - signed_value : signed_value, + group - 1, &residual); /* Check for overflow. (The absolute value to go in the place must be divisible by four and, after having been divided by four, must @@ -10397,7 +10401,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, (*_bfd_error_handler) (_("%B(%A+0x%lx): Overflow whilst splitting 0x%lx for group relocation %s"), input_bfd, input_section, - (long) rel->r_offset, abs (signed_value), howto->name); + (long) rel->r_offset, labs (signed_value), howto->name); return bfd_reloc_overflow; } diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index 1dd2e8c..cd37856 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -4640,7 +4640,7 @@ _frvfdpic_relax_tls_entries (struct frvfdpic_relocs_info *entry, + 32768) < (bfd_vma)65536)) || (entry->symndx != -1 && (elf_hash_table (dinfo->info)->tls_sec->size - + abs (entry->addend) < 32768 + FRVFDPIC_TLS_BIAS)))) + + entry->addend < 32768 + FRVFDPIC_TLS_BIAS)))) { if (! changed) { diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c index 8577f58..f3c7210 100644 --- a/bfd/elf32-i860.c +++ b/bfd/elf32-i860.c @@ -74,7 +74,7 @@ i860_howto_pc26_reloc (bfd *abfd ATTRIBUTE_UNUSED, /* Check for target out of range. */ if ((bfd_signed_vma)relocation > (0x3ffffff << 2) - || (bfd_signed_vma)relocation < (-0x4000000 << 2)) + || (bfd_signed_vma)relocation < (-0x4000000 * 4)) return bfd_reloc_outofrange; addr = (bfd_byte *) data + reloc_entry->address; @@ -137,7 +137,7 @@ i860_howto_pc16_reloc (bfd *abfd, /* Check for target out of range. */ if ((bfd_signed_vma)relocation > (0x7fff << 2) - || (bfd_signed_vma)relocation < (-0x8000 << 2)) + || (bfd_signed_vma)relocation < (-0x8000 * 4)) return bfd_reloc_outofrange; addr = (bfd_byte *) data + reloc_entry->address; diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c index 8e87b67..e77565e 100644 --- a/bfd/elf32-msp430.c +++ b/bfd/elf32-msp430.c @@ -2629,4 +2629,7 @@ static const struct bfd_elf_special_section msp430_ti_elf_special_sections[] = { NULL, 0, 0, 0, 0 } }; +#undef elf_backend_special_sections +#define elf_backend_special_sections msp430_ti_elf_special_sections + #include "elf32-target.h" diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c index ce9c377..1d558c0 100644 --- a/bfd/elf32-score.c +++ b/bfd/elf32-score.c @@ -2165,7 +2165,7 @@ score_elf_final_link_relocate (reloc_howto_type *howto, if ((offset & 0x1000000) != 0) offset |= 0xfe000000; value += offset; - abs_value = abs (value - rel_addr); + abs_value = value - rel_addr; if ((abs_value & 0xfe000000) != 0) return bfd_reloc_overflow; addend = (addend & ~howto->src_mask) @@ -2241,7 +2241,7 @@ score_elf_final_link_relocate (reloc_howto_type *howto, if ((offset & 0x800) != 0) /* Offset is negative. */ offset |= 0xfffff000; value += offset; - abs_value = abs (value - rel_addr); + abs_value = value - rel_addr; if ((abs_value & 0xfffff000) != 0) return bfd_reloc_overflow; addend = (addend & ~howto->src_mask) | (value & howto->src_mask); diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c index b0e75bb..5adf9f4 100644 --- a/bfd/elf32-score7.c +++ b/bfd/elf32-score7.c @@ -2065,7 +2065,7 @@ score_elf_final_link_relocate (reloc_howto_type *howto, if ((offset & 0x1000000) != 0) offset |= 0xfe000000; value += offset; - abs_value = abs (value - rel_addr); + abs_value = value - rel_addr; if ((abs_value & 0xfe000000) != 0) return bfd_reloc_overflow; addend = (addend & ~howto->src_mask) @@ -2095,7 +2095,7 @@ score_elf_final_link_relocate (reloc_howto_type *howto, if ((offset & 0x800) != 0) /* Offset is negative. */ offset |= 0xfffff000; value += offset; - abs_value = abs (value - rel_addr); + abs_value = value - rel_addr; if ((abs_value & 0xfffff000) != 0) return bfd_reloc_overflow; addend = (addend & ~howto->src_mask) | (value & howto->src_mask); diff --git a/bfd/elf32-visium.c b/bfd/elf32-visium.c index 637d72b..52267c3 100644 --- a/bfd/elf32-visium.c +++ b/bfd/elf32-visium.c @@ -276,32 +276,6 @@ static reloc_howto_type visium_elf_vtentry_howto = 0, /* dst_mask */ FALSE); /* pcrel_offset */ -/* Map BFD reloc types to VISIUM ELF reloc types. */ -struct visium_reloc_map -{ - bfd_reloc_code_real_type bfd_reloc_val; - unsigned int visium_reloc_val; -}; - -static const struct visium_reloc_map visium_reloc_map[] = { - {BFD_RELOC_NONE, R_VISIUM_NONE}, - {BFD_RELOC_8, R_VISIUM_8}, - {BFD_RELOC_16, R_VISIUM_16}, - {BFD_RELOC_32, R_VISIUM_32}, - {BFD_RELOC_8_PCREL, R_VISIUM_8_PCREL}, - {BFD_RELOC_16_PCREL, R_VISIUM_16_PCREL}, - {BFD_RELOC_32_PCREL, R_VISIUM_32_PCREL}, - {BFD_RELOC_VISIUM_REL16, R_VISIUM_PC16}, - {BFD_RELOC_VISIUM_HI16, R_VISIUM_HI16}, - {BFD_RELOC_VISIUM_LO16, R_VISIUM_LO16}, - {BFD_RELOC_VISIUM_IM16, R_VISIUM_IM16}, - {BFD_RELOC_VISIUM_HI16_PCREL, R_VISIUM_HI16_PCREL}, - {BFD_RELOC_VISIUM_LO16_PCREL, R_VISIUM_LO16_PCREL}, - {BFD_RELOC_VISIUM_IM16_PCREL, R_VISIUM_IM16_PCREL}, - {BFD_RELOC_VTABLE_INHERIT, R_VISIUM_GNU_VTINHERIT}, - {BFD_RELOC_VTABLE_ENTRY, R_VISIUM_GNU_VTENTRY}, -}; - /* Return the parity bit for INSN shifted to its final position. */ static bfd_vma diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 4689b21..12d7a03 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -2157,18 +2157,6 @@ got_page_reloc_p (unsigned int r_type) } static inline bfd_boolean -got_ofst_reloc_p (unsigned int r_type) -{ - return r_type == R_MIPS_GOT_OFST || r_type == R_MICROMIPS_GOT_OFST; -} - -static inline bfd_boolean -got_hi16_reloc_p (unsigned int r_type) -{ - return r_type == R_MIPS_GOT_HI16 || r_type == R_MICROMIPS_GOT_HI16; -} - -static inline bfd_boolean got_lo16_reloc_p (unsigned int r_type) { return r_type == R_MIPS_GOT_LO16 || r_type == R_MICROMIPS_GOT_LO16; diff --git a/bfd/mach-o.c b/bfd/mach-o.c index e6cbe23..5b122c5 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -35,7 +35,7 @@ #define bfd_mach_o_mkobject bfd_mach_o_gen_mkobject #define FILE_ALIGN(off, algn) \ - (((off) + ((file_ptr) 1 << (algn)) - 1) & ((file_ptr) -1 << (algn))) + (((off) + ((file_ptr) 1 << (algn)) - 1) & ((file_ptr) -1U << (algn))) static bfd_boolean bfd_mach_o_read_dyld_content (bfd *abfd, bfd_mach_o_dyld_info_command *cmd); diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c index 12fad62..c3fb4fe 100644 --- a/bfd/ppcboot.c +++ b/bfd/ppcboot.c @@ -402,7 +402,7 @@ ppcboot_bfd_print_private_bfd_data (bfd *abfd, void * farg) if (tdata->header.os_id) fprintf (f, "OS_ID = 0x%.2x\n", tdata->header.os_id); - if (tdata->header.partition_name) + if (tdata->header.partition_name[0]) fprintf (f, _("Partition name = \"%s\"\n"), tdata->header.partition_name); for (i = 0; i < 4; i++) |