public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/gdb] gdb-17.2-rebase-f44: Fix build compatibility with gcc-7.
@ 2026-06-27 23:58 Jan Kratochvil
0 siblings, 0 replies; only message in thread
From: Jan Kratochvil @ 2026-06-27 23:58 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/gdb
Branch : gdb-17.2-rebase-f44
Commit : 7a79f904cf86d8a62d44c12f98994cd2eba535a1
Author : Jan Kratochvil <jan.kratochvil@redhat.com>
Date : 2017-02-08T18:41:52+01:00
Stats : +269/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/gdb/c/7a79f904cf86d8a62d44c12f98994cd2eba535a1?branch=gdb-17.2-rebase-f44
Log:
Fix build compatibility with gcc-7.
---
diff --git a/gdb-upstream.patch b/gdb-upstream.patch
index 3e40f1c..4a46134 100644
--- a/gdb-upstream.patch
+++ b/gdb-upstream.patch
@@ -457,3 +457,266 @@ index 378eea0..7d9b198 100644
verbose -log "get_compiler_info: $compiler_info"
--IS0zKkzwUGydFO0o--
+
+
+
+commit 1b7e3d2fb7036ce6f9d74e32dc052518f5cd45b6
+Author: Nick Clifton <nickc@redhat.com>
+Date: Fri Feb 3 09:04:21 2017 +0000
+
+ 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.
+
+### a/bfd/ChangeLog
+### b/bfd/ChangeLog
+## -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>
+
+ * 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)
+ NUL-terminated. We use a temporary buffer so that we can still
+ sprintf all eight chars without splatting a terminating NUL
+ 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
+ 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;
+ }
+
+- /* snprintf not strictly necessary now we've verified the value
+- has less than eight ASCII digits, but never mind. */
+- snprintf (s_name_buf, SCNNMLEN + 1, "/%lu", (unsigned long) string_size);
++ /* We do not need to use snprintf here as we have already verfied
++ that string_size is not too big, plus we have an overlarge
++ buffer, just in case. */
++ sprintf (s_name_buf, "/%lu", (unsigned long) string_size);
+ /* Then strncpy takes care of any padding for us. */
+ strncpy (section.s_name, s_name_buf, SCNNMLEN);
+ 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)
+ {
+ int num = 0;
+ bfd_byte *contents;
+- unsigned long insn;
+ FILE *ex9_import_file;
+ int update_ex9_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. */
+ while (!feof (ex9_import_file))
+ {
++ unsigned long insn;
+ char *code;
+ struct elf_nds32_insn_times_entry *ptr;
+ size_t nread;
+@@ -14973,7 +14973,7 @@ nds32_elf_ex9_import_table (struct bfd_link_info *info)
+ break;
+ insn = bfd_getb32 (contents);
+ 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->string = code;
+ ptr->order = num;
+### a/opcodes/ChangeLog
+### b/opcodes/ChangeLog
+## -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>
+
+ 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,
+
+ /* Prepare the index if any. */
+ 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
+ tb[0] = '\0';
+
+@@ -2344,7 +2344,9 @@ print_register_offset_address (char *buf
+ if (print_extend_p)
+ {
+ if (print_amount_p)
+- snprintf (tb, sizeof (tb), ",%s #%d", shift_name, opnd->shifter.amount);
++ snprintf (tb, sizeof (tb), ",%s #%d", shift_name,
++ /* PR 21096: The %100 is to silence a warning about possible truncation. */
++ (opnd->shifter.amount % 100));
+ else
+ snprintf (tb, sizeof (tb), ",%s", shift_name);
+ }
+--- a/opcodes/tic6x-dis.c
++++ b/opcodes/tic6x-dis.c
+@@ -316,7 +316,7 @@ print_insn_tic6x (bfd_vma addr, struct disassemble_info *info)
+ const char *parallel;
+ const char *cond = "";
+ const char *func_unit;
+- char func_unit_buf[7];
++ char func_unit_buf[8];
+ unsigned int func_unit_side = 0;
+ unsigned int func_unit_data_side = 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)
+ func_unit_cross = 1;
+
+- snprintf (func_unit_buf, 7, " .%c%u%s%s", func_unit_char,
+- func_unit_side, (func_unit_cross ? "X" : ""), data_str);
++ snprintf (func_unit_buf, sizeof func_unit_buf, " .%c%u%s%s",
++ func_unit_char, func_unit_side,
++ (func_unit_cross ? "X" : ""), data_str);
+ func_unit = func_unit_buf;
+ }
+
+
+
+
+commit db7b55faa1a11e632ddf57505c9bb64bc783471a
+Author: Nick Clifton <nickc@redhat.com>
+Date: Fri Dec 16 10:59:36 2016 +0000
+
+ Fix compile time warning building arm-dis.c
+
+### a/opcodes/ChangeLog
+### b/opcodes/ChangeLog
+## -1,3 +1,8 @@
++2016-12-16 Nick Clifton <nickc@redhat.com>
++
++ * arm-dis.c (print_insn_thumb32): Fix compile time warning
++ computing value_in_comment.
++
+ 2016-12-14 Maciej W. Rozycki <macro@imgtec.com>
+
+ * mips-dis.c (mips_convert_abiflags_ases): New function.
+--- a/opcodes/arm-dis.c
++++ b/opcodes/arm-dis.c
+@@ -5759,7 +5759,7 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given)
+ if (off || !U)
+ {
+ func (stream, ", #%c%u", U ? '+' : '-', off * 4);
+- value_in_comment = off * 4 * U ? 1 : -1;
++ value_in_comment = (off && U) ? 1 : -1;
+ }
+ func (stream, "]");
+ if (W)
+@@ -5771,7 +5771,7 @@ print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given)
+ if (W)
+ {
+ func (stream, "#%c%u", U ? '+' : '-', off * 4);
+- value_in_comment = off * 4 * U ? 1 : -1;
++ value_in_comment = (off && U) ? 1 : -1;
+ }
+ else
+ {
+
+
+
+commit 97e64e5ab19dbf6a9babd711e8deec5545520954
+Author: Yao Qi <yao.qi@linaro.org>
+Date: Fri Sep 23 17:27:26 2016 +0100
+
+ Replace sprintf with xsnprintf in nat/linux-osdata.c
+
+ I see the following build warning when I build GDB with GCC trunk.
+
+ ../../binutils-gdb/gdb/nat/linux-osdata.c: In function ‘LONGEST linux_xfer_osdata_fds(gdb_byte*, ULONGEST, ULONGEST)’:
+ ../../binutils-gdb/gdb/nat/linux-osdata.c:767:1: error: ‘%s’ directive writing between 0 and 255 bytes into a region of size 11 [-Werror=format-length=]
+ linux_xfer_osdata_fds (gdb_byte *readbuf,
+ ^~~~~~~~~~~~~~~~~~~~~
+ ../../binutils-gdb/gdb/nat/linux-osdata.c:800:51: note: format output between 7 and 262 bytes into a destination of size 17
+ sprintf (procentry, "/proc/%s", dp->d_name);
+ ^
+ ../../binutils-gdb/gdb/nat/linux-osdata.c: In function ‘LONGEST linux_xfer_osdata_threads(gdb_byte*, ULONGEST, ULONGEST)’:
+ ../../binutils-gdb/gdb/nat/linux-osdata.c:555:1: error: ‘%s’ directive writing between 0 and 255 bytes into a region of size 11 [-Werror=format-length=]
+ linux_xfer_osdata_threads (gdb_byte *readbuf,
+ ^~~~~~~~~~~~~~~~~~~~~~~~~
+ ../../binutils-gdb/gdb/nat/linux-osdata.c:588:51: note: format output between 7 and 262 bytes into a destination of size 17
+ sprintf (procentry, "/proc/%s", dp->d_name);
+ ^
+ cc1plus: all warnings being treated as errors
+
+ The warning is a false positive, but we can workaround it by replacing
+ sprintf with xsnprintf. On the other hand, it is always preferred to
+ use xsnprintf.
+
+ gdb:
+
+ 2016-09-23 Yao Qi <yao.qi@linaro.org>
+
+ * nat/linux-osdata.c (linux_xfer_osdata_threads): Replace
+ sprintf with xsnprintf.
+ (linux_xfer_osdata_fds): Likewise.
+
+### a/gdb/ChangeLog
+### b/gdb/ChangeLog
+## -1,3 +1,9 @@
++2016-09-23 Yao Qi <yao.qi@linaro.org>
++
++ * nat/linux-osdata.c (linux_xfer_osdata_threads): Replace
++ sprintf with xsnprintf.
++ (linux_xfer_osdata_fds): Likewise.
++
+ 2016-09-23 Pedro Alves <palves@redhat.com>
+
+ * Makefile.in (SFILES): Add common/new-op.c.
+--- a/gdb/nat/linux-osdata.c
++++ b/gdb/nat/linux-osdata.c
+@@ -585,7 +585,8 @@ linux_xfer_osdata_threads (gdb_byte *readbuf,
+ || NAMELEN (dp) > sizeof ("4294967295") - 1)
+ continue;
+
+- sprintf (procentry, "/proc/%s", dp->d_name);
++ xsnprintf (procentry, sizeof (procentry), "/proc/%s",
++ dp->d_name);
+ if (stat (procentry, &statbuf) == 0
+ && S_ISDIR (statbuf.st_mode))
+ {
+@@ -797,7 +798,8 @@ linux_xfer_osdata_fds (gdb_byte *readbuf,
+ || NAMELEN (dp) > sizeof ("4294967295") - 1)
+ continue;
+
+- sprintf (procentry, "/proc/%s", dp->d_name);
++ xsnprintf (procentry, sizeof (procentry), "/proc/%s",
++ dp->d_name);
+ if (stat (procentry, &statbuf) == 0
+ && S_ISDIR (statbuf.st_mode))
+ {
diff --git a/gdb.spec b/gdb.spec
index 36a3fe9..a95111d 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -26,7 +26,7 @@ Version: 7.12.1
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
-Release: 42%{?dist}
+Release: 43%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL
Group: Development/Debuggers
@@ -1125,6 +1125,8 @@ CFLAGS="$CFLAGS -I$PWD/processor-trace-%{libipt_version}-root%{_includedir}"
LDFLAGS="$LDFLAGS -L$PWD/processor-trace-%{libipt_version}-root%{_libdir}"
%endif
+# FIXME: gcc-7 compatibility.
+CFLAGS="$CFLAGS -Wno-implicit-fallthrough"
export CXXFLAGS="$CFLAGS"
# --htmldir and --pdfdir are not used as they are used from %{gdb_build}.
@@ -1588,6 +1590,9 @@ then
fi
%changelog
+* Wed Feb 8 2017 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.12.1-43.fc26
+- Fix build compatibility with gcc-7.
+
* Wed Feb 8 2017 Stephen Gallagher <sgallagh@redhat.com> - 7.12.1-42.fc26
- Add missing %%license macro
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-27 23:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-27 23:58 [rpms/gdb] gdb-17.2-rebase-f44: Fix build compatibility with gcc-7 Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox