Fix compile time warning messages when compiling binutils with gcc 7.0.1.
PR 21096 bfd * coffcode.h (coff_write_object_contents): Enlarge size of s_name_buf in order to avoid compile time warning about possible integer truncation. * elf32-nds32.c (nds32_elf_ex9_import_table): Mask off lower 32-bits of insn value before printing into buffer. opcodes * aarch64-opc.c (print_register_list): Ensure that the register list index will fir into the tb buffer. (print_register_offset_address): Likewise. * tic6x-dis.c (print_insn_tic6x): Increase size of func_unit_buf.
This commit is contained in:
parent
65c40c956f
commit
1b7e3d2fb7
6 changed files with 34 additions and 11 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2017-02-03 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
PR 21096
|
||||||
|
* coffcode.h (coff_write_object_contents): Enlarge size of
|
||||||
|
s_name_buf in order to avoid compile time warning about possible
|
||||||
|
integer truncation.
|
||||||
|
* elf32-nds32.c (nds32_elf_ex9_import_table): Mask off lower
|
||||||
|
32-bits of insn value before printing into buffer.
|
||||||
|
|
||||||
2017-02-02 Maciej W. Rozycki <macro@imgtec.com>
|
2017-02-02 Maciej W. Rozycki <macro@imgtec.com>
|
||||||
|
|
||||||
* elfxx-mips.c (mips_elf_hash_sort_data): Add
|
* elfxx-mips.c (mips_elf_hash_sort_data): Add
|
||||||
|
|
|
@ -3755,7 +3755,9 @@ coff_write_object_contents (bfd * abfd)
|
||||||
NUL-terminated. We use a temporary buffer so that we can still
|
NUL-terminated. We use a temporary buffer so that we can still
|
||||||
sprintf all eight chars without splatting a terminating NUL
|
sprintf all eight chars without splatting a terminating NUL
|
||||||
over the first byte of the following member (s_paddr). */
|
over the first byte of the following member (s_paddr). */
|
||||||
char s_name_buf[SCNNMLEN + 1];
|
/* PR 21096: The +20 is to stop a bogus warning from gcc7 about
|
||||||
|
a possible buffer overflow. */
|
||||||
|
char s_name_buf[SCNNMLEN + 1 + 20];
|
||||||
|
|
||||||
/* An inherent limitation of the /nnnnnnn notation used to indicate
|
/* An inherent limitation of the /nnnnnnn notation used to indicate
|
||||||
the offset of the long name in the string table is that we
|
the offset of the long name in the string table is that we
|
||||||
|
@ -3770,9 +3772,10 @@ coff_write_object_contents (bfd * abfd)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* snprintf not strictly necessary now we've verified the value
|
/* We do not need to use snprintf here as we have already verfied
|
||||||
has less than eight ASCII digits, but never mind. */
|
that string_size is not too big, plus we have an overlarge
|
||||||
snprintf (s_name_buf, SCNNMLEN + 1, "/%lu", (unsigned long) string_size);
|
buffer, just in case. */
|
||||||
|
sprintf (s_name_buf, "/%lu", (unsigned long) string_size);
|
||||||
/* Then strncpy takes care of any padding for us. */
|
/* Then strncpy takes care of any padding for us. */
|
||||||
strncpy (section.s_name, s_name_buf, SCNNMLEN);
|
strncpy (section.s_name, s_name_buf, SCNNMLEN);
|
||||||
string_size += len + 1;
|
string_size += len + 1;
|
||||||
|
|
|
@ -14949,7 +14949,6 @@ nds32_elf_ex9_import_table (struct bfd_link_info *info)
|
||||||
{
|
{
|
||||||
int num = 0;
|
int num = 0;
|
||||||
bfd_byte *contents;
|
bfd_byte *contents;
|
||||||
unsigned long insn;
|
|
||||||
FILE *ex9_import_file;
|
FILE *ex9_import_file;
|
||||||
int update_ex9_table;
|
int update_ex9_table;
|
||||||
struct elf_nds32_link_hash_table *table;
|
struct elf_nds32_link_hash_table *table;
|
||||||
|
@ -14963,6 +14962,7 @@ nds32_elf_ex9_import_table (struct bfd_link_info *info)
|
||||||
/* Read instructions from the input file and build the list. */
|
/* Read instructions from the input file and build the list. */
|
||||||
while (!feof (ex9_import_file))
|
while (!feof (ex9_import_file))
|
||||||
{
|
{
|
||||||
|
unsigned long insn;
|
||||||
char *code;
|
char *code;
|
||||||
struct elf_nds32_insn_times_entry *ptr;
|
struct elf_nds32_insn_times_entry *ptr;
|
||||||
size_t nread;
|
size_t nread;
|
||||||
|
@ -14973,7 +14973,7 @@ nds32_elf_ex9_import_table (struct bfd_link_info *info)
|
||||||
break;
|
break;
|
||||||
insn = bfd_getb32 (contents);
|
insn = bfd_getb32 (contents);
|
||||||
code = bfd_malloc (sizeof (char) * 9);
|
code = bfd_malloc (sizeof (char) * 9);
|
||||||
snprintf (code, 9, "%08lx", insn);
|
snprintf (code, 9, "%08lx", (insn & 0xffffffff));
|
||||||
ptr = bfd_malloc (sizeof (struct elf_nds32_insn_times_entry));
|
ptr = bfd_malloc (sizeof (struct elf_nds32_insn_times_entry));
|
||||||
ptr->string = code;
|
ptr->string = code;
|
||||||
ptr->order = num;
|
ptr->order = num;
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
2017-02-03 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
PR 21096
|
||||||
|
* aarch64-opc.c (print_register_list): Ensure that the register
|
||||||
|
list index will fir into the tb buffer.
|
||||||
|
(print_register_offset_address): Likewise.
|
||||||
|
* tic6x-dis.c (print_insn_tic6x): Increase size of func_unit_buf.
|
||||||
|
|
||||||
2017-01-27 Alexis Deruell <alexis.deruelle@gmail.com>
|
2017-01-27 Alexis Deruell <alexis.deruelle@gmail.com>
|
||||||
|
|
||||||
PR 21056
|
PR 21056
|
||||||
|
|
|
@ -2865,7 +2865,8 @@ print_register_list (char *buf, size_t size, const aarch64_opnd_info *opnd,
|
||||||
|
|
||||||
/* Prepare the index if any. */
|
/* Prepare the index if any. */
|
||||||
if (opnd->reglist.has_index)
|
if (opnd->reglist.has_index)
|
||||||
snprintf (tb, 8, "[%" PRIi64 "]", opnd->reglist.index);
|
/* PR 21096: The %100 is to silence a warning about possible truncation. */
|
||||||
|
snprintf (tb, 8, "[%" PRIi64 "]", (opnd->reglist.index % 100));
|
||||||
else
|
else
|
||||||
tb[0] = '\0';
|
tb[0] = '\0';
|
||||||
|
|
||||||
|
@ -2965,7 +2966,8 @@ print_register_offset_address (char *buf, size_t size,
|
||||||
{
|
{
|
||||||
if (print_amount_p)
|
if (print_amount_p)
|
||||||
snprintf (tb, sizeof (tb), ", %s #%" PRIi64, shift_name,
|
snprintf (tb, sizeof (tb), ", %s #%" PRIi64, shift_name,
|
||||||
opnd->shifter.amount);
|
/* PR 21096: The %100 is to silence a warning about possible truncation. */
|
||||||
|
(opnd->shifter.amount % 100));
|
||||||
else
|
else
|
||||||
snprintf (tb, sizeof (tb), ", %s", shift_name);
|
snprintf (tb, sizeof (tb), ", %s", shift_name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,7 +316,7 @@ print_insn_tic6x (bfd_vma addr, struct disassemble_info *info)
|
||||||
const char *parallel;
|
const char *parallel;
|
||||||
const char *cond = "";
|
const char *cond = "";
|
||||||
const char *func_unit;
|
const char *func_unit;
|
||||||
char func_unit_buf[7];
|
char func_unit_buf[8];
|
||||||
unsigned int func_unit_side = 0;
|
unsigned int func_unit_side = 0;
|
||||||
unsigned int func_unit_data_side = 0;
|
unsigned int func_unit_data_side = 0;
|
||||||
unsigned int func_unit_cross = 0;
|
unsigned int func_unit_cross = 0;
|
||||||
|
@ -703,8 +703,9 @@ print_insn_tic6x (bfd_vma addr, struct disassemble_info *info)
|
||||||
if (opc->flags & TIC6X_FLAG_INSN16_BSIDE && func_unit_side == 1)
|
if (opc->flags & TIC6X_FLAG_INSN16_BSIDE && func_unit_side == 1)
|
||||||
func_unit_cross = 1;
|
func_unit_cross = 1;
|
||||||
|
|
||||||
snprintf (func_unit_buf, 7, " .%c%u%s%s", func_unit_char,
|
snprintf (func_unit_buf, sizeof func_unit_buf, " .%c%u%s%s",
|
||||||
func_unit_side, (func_unit_cross ? "X" : ""), data_str);
|
func_unit_char, func_unit_side,
|
||||||
|
(func_unit_cross ? "X" : ""), data_str);
|
||||||
func_unit = func_unit_buf;
|
func_unit = func_unit_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue