From 66158e79e56e411f6b94c54b5e89e8528c87f342 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 9 Jul 2024 22:49:44 -0700 Subject: gdb: Upgrade to 15.1 release Improved python support and needs c++17 std in compiler to build Detailed Release Notee [1] [1] https://sourceware.org/pipermail/gdb-announce/2024/000140.html (From OE-Core rev: 0041bc06f8b34c2344b018a292451dcd00c6586b) Signed-off-by: Khem Raj Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- meta/conf/distro/include/tcmode-default.inc | 2 +- .../gdb/gdb-cross-canadian_14.2.bb | 3 -- .../gdb/gdb-cross-canadian_15.1.bb | 3 ++ meta/recipes-devtools/gdb/gdb-cross_14.2.bb | 2 - meta/recipes-devtools/gdb/gdb-cross_15.1.bb | 2 + meta/recipes-devtools/gdb/gdb.inc | 6 +-- ...s-linux-nat-Define-_ABIO32-if-not-defined.patch | 6 +-- ...Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch | 8 ++-- ...e-libreadline.a-when-using-disable-static.patch | 10 ++--- .../gdb/gdb/0004-use-asm-sgidefs.h.patch | 6 +-- .../gdb/gdb/0005-Change-order-of-CFLAGS.patch | 21 +++++----- .../gdb/0006-Fix-invalid-sigprocmask-call.patch | 46 +++++++++++++++++++++ ...nof-using-_Alignof-when-using-C11-or-newe.patch | 48 ++++++++++++++++++++++ .../gdb/0007-Fix-invalid-sigprocmask-call.patch | 46 --------------------- ...nof-using-_Alignof-when-using-C11-or-newe.patch | 48 ---------------------- meta/recipes-devtools/gdb/gdb_14.2.bb | 39 ------------------ meta/recipes-devtools/gdb/gdb_15.1.bb | 39 ++++++++++++++++++ 17 files changed, 167 insertions(+), 168 deletions(-) delete mode 100644 meta/recipes-devtools/gdb/gdb-cross-canadian_14.2.bb create mode 100644 meta/recipes-devtools/gdb/gdb-cross-canadian_15.1.bb delete mode 100644 meta/recipes-devtools/gdb/gdb-cross_14.2.bb create mode 100644 meta/recipes-devtools/gdb/gdb-cross_15.1.bb create mode 100644 meta/recipes-devtools/gdb/gdb/0006-Fix-invalid-sigprocmask-call.patch create mode 100644 meta/recipes-devtools/gdb/gdb/0007-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch delete mode 100644 meta/recipes-devtools/gdb/gdb/0007-Fix-invalid-sigprocmask-call.patch delete mode 100644 meta/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch delete mode 100644 meta/recipes-devtools/gdb/gdb_14.2.bb create mode 100644 meta/recipes-devtools/gdb/gdb_15.1.bb diff --git a/meta/conf/distro/include/tcmode-default.inc b/meta/conf/distro/include/tcmode-default.inc index 4fb6e47b7f..c77ce9aa52 100644 --- a/meta/conf/distro/include/tcmode-default.inc +++ b/meta/conf/distro/include/tcmode-default.inc @@ -19,7 +19,7 @@ PREFERRED_PROVIDER_virtual/gettext ??= "gettext" GCCVERSION ?= "14.%" SDKGCCVERSION ?= "${GCCVERSION}" BINUVERSION ?= "2.42%" -GDBVERSION ?= "14.%" +GDBVERSION ?= "15.%" GLIBCVERSION ?= "2.39%" LINUXLIBCVERSION ?= "6.9%" QEMUVERSION ?= "9.0%" diff --git a/meta/recipes-devtools/gdb/gdb-cross-canadian_14.2.bb b/meta/recipes-devtools/gdb/gdb-cross-canadian_14.2.bb deleted file mode 100644 index 4ab2b7156d..0000000000 --- a/meta/recipes-devtools/gdb/gdb-cross-canadian_14.2.bb +++ /dev/null @@ -1,3 +0,0 @@ -require gdb-common.inc -require gdb-cross-canadian.inc -require gdb.inc diff --git a/meta/recipes-devtools/gdb/gdb-cross-canadian_15.1.bb b/meta/recipes-devtools/gdb/gdb-cross-canadian_15.1.bb new file mode 100644 index 0000000000..4ab2b7156d --- /dev/null +++ b/meta/recipes-devtools/gdb/gdb-cross-canadian_15.1.bb @@ -0,0 +1,3 @@ +require gdb-common.inc +require gdb-cross-canadian.inc +require gdb.inc diff --git a/meta/recipes-devtools/gdb/gdb-cross_14.2.bb b/meta/recipes-devtools/gdb/gdb-cross_14.2.bb deleted file mode 100644 index 3b654a2f0d..0000000000 --- a/meta/recipes-devtools/gdb/gdb-cross_14.2.bb +++ /dev/null @@ -1,2 +0,0 @@ -require gdb-cross.inc -require gdb.inc diff --git a/meta/recipes-devtools/gdb/gdb-cross_15.1.bb b/meta/recipes-devtools/gdb/gdb-cross_15.1.bb new file mode 100644 index 0000000000..3b654a2f0d --- /dev/null +++ b/meta/recipes-devtools/gdb/gdb-cross_15.1.bb @@ -0,0 +1,2 @@ +require gdb-cross.inc +require gdb.inc diff --git a/meta/recipes-devtools/gdb/gdb.inc b/meta/recipes-devtools/gdb/gdb.inc index c2fbcb2ac6..6fdf11d394 100644 --- a/meta/recipes-devtools/gdb/gdb.inc +++ b/meta/recipes-devtools/gdb/gdb.inc @@ -10,7 +10,7 @@ SRC_URI = "${GNU_MIRROR}/gdb/gdb-${PV}.tar.xz \ file://0003-Dont-disable-libreadline.a-when-using-disable-static.patch \ file://0004-use-asm-sgidefs.h.patch \ file://0005-Change-order-of-CFLAGS.patch \ - file://0007-Fix-invalid-sigprocmask-call.patch \ - file://0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \ + file://0006-Fix-invalid-sigprocmask-call.patch \ + file://0007-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \ " -SRC_URI[sha256sum] = "2d4dd8061d8ded12b6c63f55e45344881e8226105f4d2a9b234040efa5ce7772" +SRC_URI[sha256sum] = "38254eacd4572134bca9c5a5aa4d4ca564cbbd30c369d881f733fb6b903354f2" diff --git a/meta/recipes-devtools/gdb/gdb/0001-mips-linux-nat-Define-_ABIO32-if-not-defined.patch b/meta/recipes-devtools/gdb/gdb/0001-mips-linux-nat-Define-_ABIO32-if-not-defined.patch index 86f6e2642d..5e313a08b2 100644 --- a/meta/recipes-devtools/gdb/gdb/0001-mips-linux-nat-Define-_ABIO32-if-not-defined.patch +++ b/meta/recipes-devtools/gdb/gdb/0001-mips-linux-nat-Define-_ABIO32-if-not-defined.patch @@ -1,4 +1,4 @@ -From ff77aebf533758f0b6f7d22b272d32e08ed06e45 Mon Sep 17 00:00:00 2001 +From 31c6c42479e750aff3130e76bae2646c418cb548 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 23 Mar 2016 06:30:09 +0000 Subject: [PATCH] mips-linux-nat: Define _ABIO32 if not defined @@ -16,10 +16,10 @@ Signed-off-by: Khem Raj 1 file changed, 4 insertions(+) diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c -index 8a7cc95f2a4..bfd1c72cba6 100644 +index 3d072ea935c..ca38caeacc2 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c -@@ -41,6 +41,10 @@ +@@ -40,6 +40,10 @@ #ifndef PTRACE_GET_THREAD_AREA #define PTRACE_GET_THREAD_AREA 25 #endif diff --git a/meta/recipes-devtools/gdb/gdb/0002-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch b/meta/recipes-devtools/gdb/gdb/0002-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch index 897cfd0df9..56602b4116 100644 --- a/meta/recipes-devtools/gdb/gdb/0002-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch +++ b/meta/recipes-devtools/gdb/gdb/0002-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch @@ -1,4 +1,4 @@ -From 78748dc55b1ceafe9a64beb9628f1d51b215482f Mon Sep 17 00:00:00 2001 +From 8f350f9b7b3934bd492cad35e1b6e44d142313a4 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 30 Apr 2016 18:32:14 -0700 Subject: [PATCH] ppc/ptrace: Define pt_regs uapi_pt_regs on !GLIBC systems @@ -12,7 +12,7 @@ Signed-off-by: Khem Raj 2 files changed, 12 insertions(+) diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h -index c84f9146bbd..8c8580c95e1 100644 +index b51e2278f4b..f1bc07df0e9 100644 --- a/gdb/nat/ppc-linux.h +++ b/gdb/nat/ppc-linux.h @@ -18,7 +18,13 @@ @@ -30,10 +30,10 @@ index c84f9146bbd..8c8580c95e1 100644 /* This sometimes isn't defined. */ diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc -index 86fbc8f5d96..8a1a39bc750 100644 +index bd3ac143660..1c8c0b3a98e 100644 --- a/gdbserver/linux-ppc-low.cc +++ b/gdbserver/linux-ppc-low.cc -@@ -23,7 +23,13 @@ +@@ -22,7 +22,13 @@ #include "elf/common.h" #include #include diff --git a/meta/recipes-devtools/gdb/gdb/0003-Dont-disable-libreadline.a-when-using-disable-static.patch b/meta/recipes-devtools/gdb/gdb/0003-Dont-disable-libreadline.a-when-using-disable-static.patch index e41be8209e..0f7f387866 100644 --- a/meta/recipes-devtools/gdb/gdb/0003-Dont-disable-libreadline.a-when-using-disable-static.patch +++ b/meta/recipes-devtools/gdb/gdb/0003-Dont-disable-libreadline.a-when-using-disable-static.patch @@ -1,4 +1,4 @@ -From 683650564cd231bbf09c7cbc35543b77ca0b10d0 Mon Sep 17 00:00:00 2001 +From c4102e4fd74804b053c437352ef92c64c8b1fdbf Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 30 Apr 2016 15:25:03 -0700 Subject: [PATCH] Dont disable libreadline.a when using --disable-static @@ -19,10 +19,10 @@ Signed-off-by: Khem Raj 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile.def b/Makefile.def -index 870150183b9..eb3788da0d2 100644 +index 4896c5c692c..17e3256be7d 100644 --- a/Makefile.def +++ b/Makefile.def -@@ -119,7 +119,8 @@ host_modules= { module= libiconv; +@@ -134,7 +134,8 @@ host_modules= { module= libiconv; missing= install-html; missing= install-info; }; host_modules= { module= m4; }; @@ -33,10 +33,10 @@ index 870150183b9..eb3788da0d2 100644 host_modules= { module= sim; }; host_modules= { module= texinfo; no_install= true; }; diff --git a/Makefile.in b/Makefile.in -index c97130a2338..a83f98e4778 100644 +index f12c251f9c8..17ea24e8012 100644 --- a/Makefile.in +++ b/Makefile.in -@@ -31691,7 +31691,7 @@ configure-readline: +@@ -31593,7 +31593,7 @@ configure-readline: $$s/$$module_srcdir/configure \ --srcdir=$${topdir}/$$module_srcdir \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ diff --git a/meta/recipes-devtools/gdb/gdb/0004-use-asm-sgidefs.h.patch b/meta/recipes-devtools/gdb/gdb/0004-use-asm-sgidefs.h.patch index 413610d71f..6dee5037da 100644 --- a/meta/recipes-devtools/gdb/gdb/0004-use-asm-sgidefs.h.patch +++ b/meta/recipes-devtools/gdb/gdb/0004-use-asm-sgidefs.h.patch @@ -1,4 +1,4 @@ -From 04eba78ea6bd167b7eeef3af668c8f49888dc688 Mon Sep 17 00:00:00 2001 +From 91e294b399c8e3de2cbdd495309f31b6a218516d Mon Sep 17 00:00:00 2001 From: Andre McCurdy Date: Sat, 30 Apr 2016 15:29:06 -0700 Subject: [PATCH] use @@ -19,10 +19,10 @@ Signed-off-by: Khem Raj 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c -index bfd1c72cba6..13dc9cdb703 100644 +index ca38caeacc2..2f044ca508a 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c -@@ -31,7 +31,7 @@ +@@ -30,7 +30,7 @@ #include "gdb_proc_service.h" #include "gregset.h" diff --git a/meta/recipes-devtools/gdb/gdb/0005-Change-order-of-CFLAGS.patch b/meta/recipes-devtools/gdb/gdb/0005-Change-order-of-CFLAGS.patch index 7631e75048..6d5d3a7e4f 100644 --- a/meta/recipes-devtools/gdb/gdb/0005-Change-order-of-CFLAGS.patch +++ b/meta/recipes-devtools/gdb/gdb/0005-Change-order-of-CFLAGS.patch @@ -1,4 +1,4 @@ -From e7041e9346aa0c3aee0b76315559e3ab2ef8977e Mon Sep 17 00:00:00 2001 +From c151a90c6df7a8b31fe0a6c4d6d28aaff55ac25f Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 30 Apr 2016 15:35:39 -0700 Subject: [PATCH] Change order of CFLAGS @@ -9,19 +9,18 @@ Upstream-Status: Inappropriate Signed-off-by: Khem Raj --- - gdbserver/Makefile.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + gdbserver/Makefile.in | 1 + + 1 file changed, 1 insertion(+) diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in -index b597515d428..9e615e2842d 100644 +index 6148ccf9121..3ad15573923 100644 --- a/gdbserver/Makefile.in +++ b/gdbserver/Makefile.in -@@ -156,7 +156,7 @@ WIN32APILIBS = @WIN32APILIBS@ - INTERNAL_CFLAGS_BASE = ${GLOBAL_CFLAGS} \ - ${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${CPPFLAGS} $(PTHREAD_CFLAGS) - INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS) --INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER -+INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) ${COMPILER_CFLAGS} -DGDBSERVER +@@ -174,6 +174,7 @@ INTERNAL_CFLAGS = \ + $(PTHREAD_CFLAGS) \ + $(WARN_CFLAGS) \ + $(WERROR_CFLAGS) \ ++ ${COMPILER_CFLAGS} \ + -DGDBSERVER # LDFLAGS is specifically reserved for setting from the command line - # when running make. diff --git a/meta/recipes-devtools/gdb/gdb/0006-Fix-invalid-sigprocmask-call.patch b/meta/recipes-devtools/gdb/gdb/0006-Fix-invalid-sigprocmask-call.patch new file mode 100644 index 0000000000..a256b8fc68 --- /dev/null +++ b/meta/recipes-devtools/gdb/gdb/0006-Fix-invalid-sigprocmask-call.patch @@ -0,0 +1,46 @@ +From f63dddf6b986642eeeefa27176d59780e1681ddd Mon Sep 17 00:00:00 2001 +From: Yousong Zhou +Date: Fri, 24 Mar 2017 10:36:03 +0800 +Subject: [PATCH] Fix invalid sigprocmask call +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The POSIX document says + + The pthread_sigmask() and sigprocmask() functions shall fail if: + + [EINVAL] + The value of the how argument is not equal to one of the defined values. + +and this is how musl-libc is currently doing. Fix the call to be safe +and correct + + [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html + +gdb/ChangeLog: +2017-03-24 Yousong Zhou + + * common/signals-state-save-restore.c (save_original_signals_state): + Fix invalid sigprocmask call. + +Upstream-Status: Pending [not author, cherry-picked from LEDE https://bugs.lede-project.org/index.php?do=details&task_id=637&openedfrom=-1%2Bweek] +Signed-off-by: André Draszik +Signed-off-by: Khem Raj +--- + gdbsupport/signals-state-save-restore.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdbsupport/signals-state-save-restore.cc b/gdbsupport/signals-state-save-restore.cc +index 60724f95c87..8b493271aa6 100644 +--- a/gdbsupport/signals-state-save-restore.cc ++++ b/gdbsupport/signals-state-save-restore.cc +@@ -37,7 +37,7 @@ save_original_signals_state (bool quiet) + int i; + int res; + +- res = gdb_sigmask (0, NULL, &original_signal_mask); ++ res = gdb_sigmask (SIG_BLOCK, NULL, &original_signal_mask); + if (res == -1) + perror_with_name (("sigprocmask")); + diff --git a/meta/recipes-devtools/gdb/gdb/0007-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch b/meta/recipes-devtools/gdb/gdb/0007-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch new file mode 100644 index 0000000000..dcc01e414c --- /dev/null +++ b/meta/recipes-devtools/gdb/gdb/0007-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch @@ -0,0 +1,48 @@ +From f1b4a90ea61771840fcf4889f616b156b5157843 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sun, 15 Jan 2023 00:16:25 -0800 +Subject: [PATCH] Define alignof using _Alignof when using C11 or newer + +WG14 N2350 made very clear that it is an UB having type definitions +within "offsetof" [1]. This patch enhances the implementation of macro +alignof to use builtin "_Alignof" to avoid undefined behavior on +when using std=c11 or newer + +clang 16+ has started to flag this [2] + +Fixes build when using -std >= gnu11 and using clang16+ + +Older compilers gcc < 4.9 or clang < 8 has buggy _Alignof even though it +may support C11, exclude those compilers too + +[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm +[2] https://reviews.llvm.org/D133574 + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + libiberty/sha1.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/libiberty/sha1.c b/libiberty/sha1.c +index 49e8e0b6c2b..72de5cc8ad6 100644 +--- a/libiberty/sha1.c ++++ b/libiberty/sha1.c +@@ -234,7 +234,17 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx) + if (len >= 64) + { + #if !_STRING_ARCH_unaligned ++/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 ++ . ++ clang versions < 8.0.0 have the same bug. */ ++#if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ ++ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ ++ && !defined __clang__) \ ++ || (defined __clang__ && __clang_major__ < 8)) + # define alignof(type) offsetof (struct { char c; type x; }, x) ++#else ++# define alignof(type) _Alignof(type) ++#endif + # define UNALIGNED_P(p) (((size_t) p) % alignof (sha1_uint32) != 0) + if (UNALIGNED_P (buffer)) + while (len > 64) diff --git a/meta/recipes-devtools/gdb/gdb/0007-Fix-invalid-sigprocmask-call.patch b/meta/recipes-devtools/gdb/gdb/0007-Fix-invalid-sigprocmask-call.patch deleted file mode 100644 index 26e3ad9098..0000000000 --- a/meta/recipes-devtools/gdb/gdb/0007-Fix-invalid-sigprocmask-call.patch +++ /dev/null @@ -1,46 +0,0 @@ -From ebeb6125acf6b4e4a8a4eaa59e2830b9ca02d683 Mon Sep 17 00:00:00 2001 -From: Yousong Zhou -Date: Fri, 24 Mar 2017 10:36:03 +0800 -Subject: [PATCH] Fix invalid sigprocmask call -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The POSIX document says - - The pthread_sigmask() and sigprocmask() functions shall fail if: - - [EINVAL] - The value of the how argument is not equal to one of the defined values. - -and this is how musl-libc is currently doing. Fix the call to be safe -and correct - - [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html - -gdb/ChangeLog: -2017-03-24 Yousong Zhou - - * common/signals-state-save-restore.c (save_original_signals_state): - Fix invalid sigprocmask call. - -Upstream-Status: Pending [not author, cherry-picked from LEDE https://bugs.lede-project.org/index.php?do=details&task_id=637&openedfrom=-1%2Bweek] -Signed-off-by: André Draszik -Signed-off-by: Khem Raj ---- - gdbsupport/signals-state-save-restore.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gdbsupport/signals-state-save-restore.cc b/gdbsupport/signals-state-save-restore.cc -index 3ec7a259c9c..0702eca7725 100644 ---- a/gdbsupport/signals-state-save-restore.cc -+++ b/gdbsupport/signals-state-save-restore.cc -@@ -38,7 +38,7 @@ save_original_signals_state (bool quiet) - int i; - int res; - -- res = gdb_sigmask (0, NULL, &original_signal_mask); -+ res = gdb_sigmask (SIG_BLOCK, NULL, &original_signal_mask); - if (res == -1) - perror_with_name (("sigprocmask")); - diff --git a/meta/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch b/meta/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch deleted file mode 100644 index 819f1c9f17..0000000000 --- a/meta/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch +++ /dev/null @@ -1,48 +0,0 @@ -From cb7c8df338184d2d2f31ee1fd238653e3162da44 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sun, 15 Jan 2023 00:16:25 -0800 -Subject: [PATCH] Define alignof using _Alignof when using C11 or newer - -WG14 N2350 made very clear that it is an UB having type definitions -within "offsetof" [1]. This patch enhances the implementation of macro -alignof to use builtin "_Alignof" to avoid undefined behavior on -when using std=c11 or newer - -clang 16+ has started to flag this [2] - -Fixes build when using -std >= gnu11 and using clang16+ - -Older compilers gcc < 4.9 or clang < 8 has buggy _Alignof even though it -may support C11, exclude those compilers too - -[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm -[2] https://reviews.llvm.org/D133574 - -Upstream-Status: Pending -Signed-off-by: Khem Raj ---- - libiberty/sha1.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/libiberty/sha1.c b/libiberty/sha1.c -index 6c71e3ebb41..a2caf947d31 100644 ---- a/libiberty/sha1.c -+++ b/libiberty/sha1.c -@@ -229,7 +229,17 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx) - if (len >= 64) - { - #if !_STRING_ARCH_unaligned -+/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 -+ . -+ clang versions < 8.0.0 have the same bug. */ -+#if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ -+ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ -+ && !defined __clang__) \ -+ || (defined __clang__ && __clang_major__ < 8)) - # define alignof(type) offsetof (struct { char c; type x; }, x) -+#else -+# define alignof(type) _Alignof(type) -+#endif - # define UNALIGNED_P(p) (((size_t) p) % alignof (sha1_uint32) != 0) - if (UNALIGNED_P (buffer)) - while (len > 64) diff --git a/meta/recipes-devtools/gdb/gdb_14.2.bb b/meta/recipes-devtools/gdb/gdb_14.2.bb deleted file mode 100644 index 9c6db4ca2c..0000000000 --- a/meta/recipes-devtools/gdb/gdb_14.2.bb +++ /dev/null @@ -1,39 +0,0 @@ -require gdb-common.inc - -inherit gettext pkgconfig - -#LDFLAGS:append = " -s" -#export CFLAGS:append=" -L${STAGING_LIBDIR}" - -# cross-canadian must not see this -PACKAGES =+ "gdbserver" -FILES:gdbserver = "${bindir}/gdbserver" - -require gdb.inc - -inherit python3-dir - -EXTRA_OEMAKE:append:libc-musl = "\ - gt_cv_func_gnugettext1_libc=yes \ - gt_cv_func_gnugettext2_libc=yes \ - gl_cv_func_working_strerror=yes \ - gl_cv_func_strerror_0_works=yes \ - gl_cv_func_gettimeofday_clobber=no \ - " - -do_configure:prepend() { - if [ "${@bb.utils.filter('PACKAGECONFIG', 'python', d)}" ]; then - cat > ${WORKDIR}/python << EOF -#!/bin/sh -case "\$2" in - --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}/" ;; - --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}${PYTHON_ABI}" ;; - --exec-prefix) echo "${exec_prefix}" ;; - *) exit 1 ;; -esac -exit 0 -EOF - chmod +x ${WORKDIR}/python - fi -} - diff --git a/meta/recipes-devtools/gdb/gdb_15.1.bb b/meta/recipes-devtools/gdb/gdb_15.1.bb new file mode 100644 index 0000000000..9c6db4ca2c --- /dev/null +++ b/meta/recipes-devtools/gdb/gdb_15.1.bb @@ -0,0 +1,39 @@ +require gdb-common.inc + +inherit gettext pkgconfig + +#LDFLAGS:append = " -s" +#export CFLAGS:append=" -L${STAGING_LIBDIR}" + +# cross-canadian must not see this +PACKAGES =+ "gdbserver" +FILES:gdbserver = "${bindir}/gdbserver" + +require gdb.inc + +inherit python3-dir + +EXTRA_OEMAKE:append:libc-musl = "\ + gt_cv_func_gnugettext1_libc=yes \ + gt_cv_func_gnugettext2_libc=yes \ + gl_cv_func_working_strerror=yes \ + gl_cv_func_strerror_0_works=yes \ + gl_cv_func_gettimeofday_clobber=no \ + " + +do_configure:prepend() { + if [ "${@bb.utils.filter('PACKAGECONFIG', 'python', d)}" ]; then + cat > ${WORKDIR}/python << EOF +#!/bin/sh +case "\$2" in + --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}/" ;; + --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}${PYTHON_ABI}" ;; + --exec-prefix) echo "${exec_prefix}" ;; + *) exit 1 ;; +esac +exit 0 +EOF + chmod +x ${WORKDIR}/python + fi +} + -- cgit v1.2.3-54-g00ecf