https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=02f0597c46892c4b69e0af45a95509bf310c759e commit 02f0597c46892c4b69e0af45a95509bf310c759e Author: Tom de Vries <tdevries@suse.de> Date: Tue Jul 12 13:36:57 2022 +0200 [gdb/build] Fix build with gcc 4.8.5 When building gdb with gcc 4.8.5, we run into problems due to unconditionally using: ... gdb_static_assert (std::is_trivially_copyable<packed>::value); ... in gdbsupport/packed.h. Fix this by guarding the usage with HAVE_IS_TRIVIALLY_COPYABLE. Tested by doing a full gdb build with gcc 4.8.5. Diff: --- gdbsupport/packed.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gdbsupport/packed.h b/gdbsupport/packed.h index ebc66c0cb1a..cd331b5477d 100644 --- a/gdbsupport/packed.h +++ b/gdbsupport/packed.h @@ -18,6 +18,8 @@ #ifndef PACKED_H #define PACKED_H +#include "traits.h" + /* Each instantiation and full specialization of the packed template defines a type that behaves like a given scalar type, but that has byte alignment, and, may optionally have a smaller size than the @@ -38,7 +40,9 @@ public: gdb_static_assert (alignof (packed) == 1); /* Make sure packed can be wrapped with std::atomic. */ +#if HAVE_IS_TRIVIALLY_COPYABLE gdb_static_assert (std::is_trivially_copyable<packed>::value); +#endif gdb_static_assert (std::is_copy_constructible<packed>::value); gdb_static_assert (std::is_move_constructible<packed>::value); gdb_static_assert (std::is_copy_assignable<packed>::value);
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=411c7e044fa99089d3030f2c61525c4d415f7b45 commit 411c7e044fa99089d3030f2c61525c4d415f7b45 Author: Tom de Vries <tdevries@suse.de> Date: Sun Aug 7 16:03:00 2022 +0200 [gdb/build] Fix build with gcc 4.8.5 When building with gcc 4.8.5, I run into: ... user-regs.c:85:1: error: could not convert \ ‘{0l, (& builtin_user_regs.gdb_user_regs::first)}’ from \ ‘<brace-enclosed initializer list>’ to ‘gdb_user_regs’ }; ^ ... Fix this by removing the initialization and handling regs.last == nullptr in append_user_reg. Tested on x86_64-linux. Diff: --- gdb/user-regs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gdb/user-regs.c b/gdb/user-regs.c index 4bc4685387f..05bb04ef2ed 100644 --- a/gdb/user-regs.c +++ b/gdb/user-regs.c @@ -74,15 +74,15 @@ append_user_reg (struct gdb_user_regs *regs, const char *name, reg->xread = xread; reg->baton = baton; reg->next = NULL; + if (regs->last == nullptr) + regs->last = ®s->first; (*regs->last) = reg; regs->last = &(*regs->last)->next; } /* An array of the builtin user registers. */ -static struct gdb_user_regs builtin_user_regs = { - NULL, &builtin_user_regs.first -}; +static struct gdb_user_regs builtin_user_regs; void user_reg_add_builtin (const char *name, user_reg_read_ftype *xread,