From: Nick Clifton Date: Tue, 9 Feb 2016 16:34:24 +0000 (+0000) Subject: Fix compile time warnings building the binutils with a gcc6 compiler. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=609332f15cc2ad651d0ebd573010595a4593e89a;p=binutils-gdb.git Fix compile time warnings building the binutils with a gcc6 compiler. include * opcode/metag.h (metag_scondtab): Mark as possibly unused. * opcode/nds32.h (nds32_r45map): Likewise. (nds32_r54map): Likewise. * opcode/visium.h (gen_reg_table): Likewise. (fp_reg_table, cc_table, opcode_table): Likewise. bfd * oasys.c (oasys_archive_p): Fix indentation. * elf32-nds32.c (nds32_elf_relax_section): Use an unsigned constant for left shifting. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3c2e8cbdba6..34898732e9d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,9 @@ 2016-02-09 Nick Clifton + * oasys.c (oasys_archive_p): Fix indentation. + * elf32-nds32.c (nds32_elf_relax_section): Use an unsigned + constant for left shifting. + * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Add a more helpful warning message to explain why certain AArch64 relocs might overflow. diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index ffad0dbd8e4..5fffbf28d5e 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -12344,8 +12344,8 @@ nds32_elf_relax_section (bfd *abfd, asection *sec, Elf_Internal_Rela *tmp_rel; /* Pad to alignment boundary. Only handle current section alignment. */ - sec_size_align = (sec->size + (~((-1) << sec->alignment_power))) - & ((-1) << sec->alignment_power); + sec_size_align = (sec->size + (~((-1U) << sec->alignment_power))) + & ((-1U) << sec->alignment_power); if ((sec_size_align - sec->size) & 0x2) { insn16 = NDS32_NOP16; diff --git a/bfd/oasys.c b/bfd/oasys.c index 791ad2ab1b0..f7791d231fa 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -272,37 +272,35 @@ oasys_archive_p (bfd *abfd) filepos = header.mod_tbl_offset; for (i = 0; i < header.mod_count; i++) { + oasys_extmodule_table_type_b_type record_ext; + if (bfd_seek (abfd, filepos, SEEK_SET) != 0) return NULL; /* There are two ways of specifying the archive header. */ - { - oasys_extmodule_table_type_b_type record_ext; - - amt = sizeof (record_ext); - if (bfd_bread ((void *) &record_ext, amt, abfd) != amt) - return NULL; - - record.mod_size = H_GET_32 (abfd, record_ext.mod_size); - record.file_offset = H_GET_32 (abfd, record_ext.file_offset); - - record.dep_count = H_GET_32 (abfd, record_ext.dep_count); - record.depee_count = H_GET_32 (abfd, record_ext.depee_count); - record.sect_count = H_GET_32 (abfd, record_ext.sect_count); - record.module_name_size = H_GET_32 (abfd, - record_ext.mod_name_length); - - amt = record.module_name_size; - module[i].name = bfd_alloc (abfd, amt + 1); - if (!module[i].name) - return NULL; - if (bfd_bread ((void *) module[i].name, amt, abfd) != amt) - return NULL; - module[i].name[record.module_name_size] = 0; - filepos += (sizeof (record_ext) - + record.dep_count * 4 - + record.module_name_size + 1); - } + amt = sizeof (record_ext); + if (bfd_bread ((void *) &record_ext, amt, abfd) != amt) + return NULL; + + record.mod_size = H_GET_32 (abfd, record_ext.mod_size); + record.file_offset = H_GET_32 (abfd, record_ext.file_offset); + + record.dep_count = H_GET_32 (abfd, record_ext.dep_count); + record.depee_count = H_GET_32 (abfd, record_ext.depee_count); + record.sect_count = H_GET_32 (abfd, record_ext.sect_count); + record.module_name_size = H_GET_32 (abfd, + record_ext.mod_name_length); + + amt = record.module_name_size; + module[i].name = bfd_alloc (abfd, amt + 1); + if (!module[i].name) + return NULL; + if (bfd_bread ((void *) module[i].name, amt, abfd) != amt) + return NULL; + module[i].name[record.module_name_size] = 0; + filepos += (sizeof (record_ext) + + record.dep_count * 4 + + record.module_name_size + 1); module[i].size = record.mod_size; module[i].pos = record.file_offset; diff --git a/include/ChangeLog b/include/ChangeLog index a87610db3eb..69521cfd109 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,11 @@ +2016-02-09 Nick Clifton + + * opcode/metag.h (metag_scondtab): Mark as possibly unused. + * opcode/nds32.h (nds32_r45map): Likewise. + (nds32_r54map): Likewise. + * opcode/visium.h (gen_reg_table): Likewise. + (fp_reg_table, cc_table, opcode_table): Likewise. + 2016-02-09 Alan Modra PR 16583 diff --git a/include/opcode/metag.h b/include/opcode/metag.h index 19259343a95..5bce87e18d2 100644 --- a/include/opcode/metag.h +++ b/include/opcode/metag.h @@ -683,7 +683,7 @@ typedef struct enum scond_code code; } split_condition; -static const split_condition metag_scondtab[] = +static const split_condition metag_scondtab[] ATTRIBUTE_UNUSED = { { "LEQ", SCOND_LEQ }, { "LEZ", SCOND_LEQ }, diff --git a/include/opcode/nds32.h b/include/opcode/nds32.h index f8ed985ee99..5f29c04ace3 100644 --- a/include/opcode/nds32.h +++ b/include/opcode/nds32.h @@ -36,13 +36,13 @@ #define REG_SP 31 /* Macros for extracting fields or making an instruction. */ -static const int nds32_r45map[] = +static const int nds32_r45map[] ATTRIBUTE_UNUSED = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19 }; -static const int nds32_r54map[] = +static const int nds32_r54map[] ATTRIBUTE_UNUSED = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, -1, -1, -1, diff --git a/include/opcode/visium.h b/include/opcode/visium.h index 613806229a2..3970479799a 100644 --- a/include/opcode/visium.h +++ b/include/opcode/visium.h @@ -104,7 +104,7 @@ struct reg_entry unsigned char code; }; -static const struct reg_entry gen_reg_table[] = +static const struct reg_entry gen_reg_table[] ATTRIBUTE_UNUSED = { {"fp", 0x16}, {"r0", 0x0}, @@ -142,7 +142,7 @@ static const struct reg_entry gen_reg_table[] = {"sp", 0x17}, }; -static const struct reg_entry fp_reg_table[] = +static const struct reg_entry fp_reg_table[] ATTRIBUTE_UNUSED = { {"f0", 0x0}, {"f1", 0x1}, @@ -166,7 +166,7 @@ static const struct cc_entry { char *name; int code; -} cc_table [] = +} cc_table [] ATTRIBUTE_UNUSED = { {"cc", 6}, {"cs", 2}, @@ -229,7 +229,7 @@ static const struct opcode_entry unsigned code; char flags; } -opcode_table[] = +opcode_table[] ATTRIBUTE_UNUSED = { { "adc.b", mode_dab, class3|(1<<21)|(1), def }, { "adc.l", mode_dab, class3|(1<<21)|(4), def }, @@ -335,3 +335,4 @@ opcode_table[] = { "xor.l", mode_dab, class3|(8<<21)|(4), def }, { "xor.w", mode_dab, class3|(8<<21)|(2), def }, }; +