• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisión1b7e3d2fb7036ce6f9d74e32dc052518f5cd45b6 (tree)
Tiempo2017-02-03 18:04:21
AutorNick Clifton <nickc@redh...>
CommiterNick Clifton

Log Message

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.

Cambiar Resumen

Diferencia incremental

--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
1+2017-02-03 Nick Clifton <nickc@redhat.com>
2+
3+ PR 21096
4+ * coffcode.h (coff_write_object_contents): Enlarge size of
5+ s_name_buf in order to avoid compile time warning about possible
6+ integer truncation.
7+ * elf32-nds32.c (nds32_elf_ex9_import_table): Mask off lower
8+ 32-bits of insn value before printing into buffer.
9+
110 2017-02-02 Maciej W. Rozycki <macro@imgtec.com>
211
312 * elfxx-mips.c (mips_elf_hash_sort_data): Add
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -3755,7 +3755,9 @@ coff_write_object_contents (bfd * abfd)
37553755 NUL-terminated. We use a temporary buffer so that we can still
37563756 sprintf all eight chars without splatting a terminating NUL
37573757 over the first byte of the following member (s_paddr). */
3758- char s_name_buf[SCNNMLEN + 1];
3758+ /* PR 21096: The +20 is to stop a bogus warning from gcc7 about
3759+ a possible buffer overflow. */
3760+ char s_name_buf[SCNNMLEN + 1 + 20];
37593761
37603762 /* An inherent limitation of the /nnnnnnn notation used to indicate
37613763 the offset of the long name in the string table is that we
@@ -3770,9 +3772,10 @@ coff_write_object_contents (bfd * abfd)
37703772 return FALSE;
37713773 }
37723774
3773- /* snprintf not strictly necessary now we've verified the value
3774- has less than eight ASCII digits, but never mind. */
3775- snprintf (s_name_buf, SCNNMLEN + 1, "/%lu", (unsigned long) string_size);
3775+ /* We do not need to use snprintf here as we have already verfied
3776+ that string_size is not too big, plus we have an overlarge
3777+ buffer, just in case. */
3778+ sprintf (s_name_buf, "/%lu", (unsigned long) string_size);
37763779 /* Then strncpy takes care of any padding for us. */
37773780 strncpy (section.s_name, s_name_buf, SCNNMLEN);
37783781 string_size += len + 1;
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -14949,7 +14949,6 @@ nds32_elf_ex9_import_table (struct bfd_link_info *info)
1494914949 {
1495014950 int num = 0;
1495114951 bfd_byte *contents;
14952- unsigned long insn;
1495314952 FILE *ex9_import_file;
1495414953 int update_ex9_table;
1495514954 struct elf_nds32_link_hash_table *table;
@@ -14963,6 +14962,7 @@ nds32_elf_ex9_import_table (struct bfd_link_info *info)
1496314962 /* Read instructions from the input file and build the list. */
1496414963 while (!feof (ex9_import_file))
1496514964 {
14965+ unsigned long insn;
1496614966 char *code;
1496714967 struct elf_nds32_insn_times_entry *ptr;
1496814968 size_t nread;
@@ -14973,7 +14973,7 @@ nds32_elf_ex9_import_table (struct bfd_link_info *info)
1497314973 break;
1497414974 insn = bfd_getb32 (contents);
1497514975 code = bfd_malloc (sizeof (char) * 9);
14976- snprintf (code, 9, "%08lx", insn);
14976+ snprintf (code, 9, "%08lx", (insn & 0xffffffff));
1497714977 ptr = bfd_malloc (sizeof (struct elf_nds32_insn_times_entry));
1497814978 ptr->string = code;
1497914979 ptr->order = num;
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,11 @@
1+2017-02-03 Nick Clifton <nickc@redhat.com>
2+
3+ PR 21096
4+ * aarch64-opc.c (print_register_list): Ensure that the register
5+ list index will fir into the tb buffer.
6+ (print_register_offset_address): Likewise.
7+ * tic6x-dis.c (print_insn_tic6x): Increase size of func_unit_buf.
8+
19 2017-01-27 Alexis Deruell <alexis.deruelle@gmail.com>
210
311 PR 21056
--- a/opcodes/aarch64-opc.c
+++ b/opcodes/aarch64-opc.c
@@ -2865,7 +2865,8 @@ print_register_list (char *buf, size_t size, const aarch64_opnd_info *opnd,
28652865
28662866 /* Prepare the index if any. */
28672867 if (opnd->reglist.has_index)
2868- snprintf (tb, 8, "[%" PRIi64 "]", opnd->reglist.index);
2868+ /* PR 21096: The %100 is to silence a warning about possible truncation. */
2869+ snprintf (tb, 8, "[%" PRIi64 "]", (opnd->reglist.index % 100));
28692870 else
28702871 tb[0] = '\0';
28712872
@@ -2965,7 +2966,8 @@ print_register_offset_address (char *buf, size_t size,
29652966 {
29662967 if (print_amount_p)
29672968 snprintf (tb, sizeof (tb), ", %s #%" PRIi64, shift_name,
2968- opnd->shifter.amount);
2969+ /* PR 21096: The %100 is to silence a warning about possible truncation. */
2970+ (opnd->shifter.amount % 100));
29692971 else
29702972 snprintf (tb, sizeof (tb), ", %s", shift_name);
29712973 }
--- a/opcodes/tic6x-dis.c
+++ b/opcodes/tic6x-dis.c
@@ -316,7 +316,7 @@ print_insn_tic6x (bfd_vma addr, struct disassemble_info *info)
316316 const char *parallel;
317317 const char *cond = "";
318318 const char *func_unit;
319- char func_unit_buf[7];
319+ char func_unit_buf[8];
320320 unsigned int func_unit_side = 0;
321321 unsigned int func_unit_data_side = 0;
322322 unsigned int func_unit_cross = 0;
@@ -703,8 +703,9 @@ print_insn_tic6x (bfd_vma addr, struct disassemble_info *info)
703703 if (opc->flags & TIC6X_FLAG_INSN16_BSIDE && func_unit_side == 1)
704704 func_unit_cross = 1;
705705
706- snprintf (func_unit_buf, 7, " .%c%u%s%s", func_unit_char,
707- func_unit_side, (func_unit_cross ? "X" : ""), data_str);
706+ snprintf (func_unit_buf, sizeof func_unit_buf, " .%c%u%s%s",
707+ func_unit_char, func_unit_side,
708+ (func_unit_cross ? "X" : ""), data_str);
708709 func_unit = func_unit_buf;
709710 }
710711