public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/gdb] gdb-17.2-rebase-f44: WIP for Fedora FTBS issues, rhbz#2042257
Date: Sun, 28 Jun 2026 00:00:33 GMT	[thread overview]
Message-ID: <178260483344.1.7307929781994274948.rpms-gdb-5368b8a55e8a@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/gdb
Branch : gdb-17.2-rebase-f44
Commit : 5368b8a55e8a2b8837f981be64a41359f01b9884
Author : Keith Seitz <keiths@redhat.com>
Date   : 2022-01-26T12:35:31-08:00
Stats  : +112/-2 in 5 file(s)
URL    : https://src.fedoraproject.org/rpms/gdb/c/5368b8a55e8a2b8837f981be64a41359f01b9884?branch=gdb-17.2-rebase-f44

Log:
WIP for Fedora FTBS issues, rhbz#2042257

---
diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include
index e56cf90..6b1ecc6 100644
--- a/_gdb.spec.Patch.include
+++ b/_gdb.spec.Patch.include
@@ -34,7 +34,7 @@ Patch008: gdb-6.5-sharedlibrary-path.patch
 
 # Improved testsuite results by the testsuite provided by the courtesy of BEA.
 #=fedoratest: For upstream it should be rewritten as a dejagnu test, the test of no "??" was useful.
-Patch09: gdb-6.5-BEA-testsuite.patch
+Patch009: gdb-6.5-BEA-testsuite.patch
 
 # Testcase for deadlocking on last address space byte; for corrupted backtraces.
 #=fedoratest
@@ -351,3 +351,7 @@ Patch084: gdb-rhbz202487-rework-set-debuginfod.patch
 #b9db26b4c44 [PR gdb/27026] CTRL-C is ignored when debug info is downloaded
 Patch085: gdb-rhbz2024875-pr27026.patch
 
+# Fix build problems.
+# (RHBZ 2042257, Keith Seitz, Andrew Burgess)
+Patch086: gdb-rhbz2042257-ftbs-updates.patch
+

diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include
index 9594d35..965fc8c 100644
--- a/_gdb.spec.patch.include
+++ b/_gdb.spec.patch.include
@@ -83,3 +83,4 @@
 %patch083 -p1
 %patch084 -p1
 %patch085 -p1
+%patch086 -p1

diff --git a/_patch_order b/_patch_order
index de20617..b3eb6ce 100644
--- a/_patch_order
+++ b/_patch_order
@@ -83,3 +83,4 @@ gdb-rhbz2024875-set_show-for-managing-debuginfod.patch
 gdb-rhbz2024875-fix-unittest-failure.patch
 gdb-rhbz202487-rework-set-debuginfod.patch
 gdb-rhbz2024875-pr27026.patch
+gdb-rhbz2042257-ftbs-updates.patch

diff --git a/gdb-rhbz2042257-ftbs-updates.patch b/gdb-rhbz2042257-ftbs-updates.patch
new file mode 100644
index 0000000..ef4faae
--- /dev/null
+++ b/gdb-rhbz2042257-ftbs-updates.patch
@@ -0,0 +1,101 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Keith Seitz <keiths@redhat.com>
+Date: Wed, 26 Jan 2022 08:56:18 -0800
+Subject: gdb-rhbz2042257-ftbs-updates.patch
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+;; Fix build problems.
+;; (RHBZ 2042257, Keith Seitz, Andrew Burgess)
+
+1) Reference array of structs instead of first member during memcpy
+
+aarch64-tdep.c defines the following macro:
+
+        do  \
+          { \
+            unsigned int mem_len = LENGTH; \
+            if (mem_len) \
+              { \
+                MEMS =  XNEWVEC (struct aarch64_mem_r, mem_len);  \
+                memcpy(&MEMS->len, &RECORD_BUF[0], \
+                       sizeof(struct aarch64_mem_r) * LENGTH); \
+              } \
+          } \
+          while (0)
+
+This is simlpy allocating a new array and copying it. However, for
+the destination address, it is actually copying into the first member
+of the first element of the array (`&MEMS->len"). This elicits a
+warning with GCC 12:
+
+../../binutils-gdb/gdb/aarch64-tdep.c: In function ‘int aarch64_process_record(gdbarch*, regcache*, CORE_ADDR)’:
+../../binutils-gdb/gdb/aarch64-tdep.c:3711:23: error: writing 16 bytes into a region of size 8 [-Werror=stringop-overflow=]
+ 3711 |                 memcpy(&MEMS->len, &RECORD_BUF[0], \
+      |                       ^
+../../binutils-gdb/gdb/aarch64-tdep.c:4394:3: note: in expansion of macro ‘MEM_ALLOC’
+ 4394 |   MEM_ALLOC (aarch64_insn_r->aarch64_mems, aarch64_insn_r->mem_rec_count,
+      |   ^~~~~~~~~
+../../binutils-gdb/gdb/aarch64-tdep.c:3721:12: note: destination object ‘aarch64_mem_r::len’ of size 8
+ 3721 |   uint64_t len;    /* Record length.  */
+      |            ^~~
+
+The simple fix is to reference the array, `MEMS' as the destination of the copy.
+
+Tested by rebuilding.
+
+2)     Fix build with current GCC: EL_EXPLICIT(location) always non-NULL
+
+    Compiling GDB with current GCC (1b4a63593b) runs into this:
+
+      src/gdb/location.c: In function 'int event_location_empty_p(const event_location*)':
+      src/gdb/location.c:963:38: error: the address of 'event_location::<unnamed union>::explicit_loc' will never be NULL [-Werror=address]
+        963 |       return (EL_EXPLICIT (location) == NULL
+            |                                      ^
+      src/gdb/location.c:57:30: note: 'event_location::<unnamed union>::explicit_loc' declared here
+         57 |     struct explicit_location explicit_loc;
+            |                              ^~~~~~~~~~~~
+
+    GCC is right, EL_EXPLICIT is defined as returning the address of an
+    union field:
+
+          /* An explicit location.  */
+          struct explicit_location explicit_loc;
+      #define EL_EXPLICIT(P) (&((P)->u.explicit_loc))
+
+    and thus must always be non-NULL.
+
+diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
+--- a/gdb/aarch64-tdep.c
++++ b/gdb/aarch64-tdep.c
+@@ -3666,7 +3666,7 @@ When on, AArch64 specific debugging is enabled."),
+ 	    if (mem_len) \
+ 	      { \
+ 		MEMS =  XNEWVEC (struct aarch64_mem_r, mem_len);  \
+-		memcpy(&MEMS->len, &RECORD_BUF[0], \
++		memcpy(MEMS, &RECORD_BUF[0], \
+ 		       sizeof(struct aarch64_mem_r) * LENGTH); \
+ 	      } \
+ 	  } \
+diff --git a/gdb/location.c b/gdb/location.c
+--- a/gdb/location.c
++++ b/gdb/location.c
+@@ -960,12 +960,11 @@ event_location_empty_p (const struct event_location *location)
+       return 0;
+ 
+     case EXPLICIT_LOCATION:
+-      return (EL_EXPLICIT (location) == NULL
+-	      || (EL_EXPLICIT (location)->source_filename == NULL
+-		  && EL_EXPLICIT (location)->function_name == NULL
+-		  && EL_EXPLICIT (location)->label_name == NULL
+-		  && (EL_EXPLICIT (location)->line_offset.sign
+-		      == LINE_OFFSET_UNKNOWN)));
++      return (EL_EXPLICIT (location)->source_filename == NULL
++	      && EL_EXPLICIT (location)->function_name == NULL
++	      && EL_EXPLICIT (location)->label_name == NULL
++	      && (EL_EXPLICIT (location)->line_offset.sign
++		  == LINE_OFFSET_UNKNOWN));
+ 
+     case PROBE_LOCATION:
+       return EL_PROBE (location) == NULL;

diff --git a/gdb.spec b/gdb.spec
index 6b9d718..10cf38e 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -37,7 +37,7 @@ Version: 11.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: 10%{?dist}
+Release: 11%{?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
 # Do not provide URL for snapshots as the file lasts there only for 2 days.
@@ -1144,6 +1144,9 @@ fi
 %endif
 
 %changelog
+* Wed Jan 26 2022 Keith Seitz <keiths@redhat.com> - 11.1-11
+- Fix buld issues. (RHBZ 2042257, Keith Seitz, Andrew Burgess)
+
 * Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org>
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
 

                 reply	other threads:[~2026-06-28  0:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178260483344.1.7307929781994274948.rpms-gdb-5368b8a55e8a@fedoraproject.org \
    --to=keiths@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox