From f923d71406e436bf82e130bf6e4dc95f1828e09e Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Wed, 24 Feb 2021 14:25:14 -0700 Subject: [PATCH] Fix aarch64 build problem (RHBZ 1932645, Kevin Buettner). --- _gdb.spec.Patch.include | 4 ++ _gdb.spec.patch.include | 1 + _patch_order | 1 + ...z1932645-aarch64-ptrace-header-order.patch | 69 +++++++++++++++++++ gdb-vla-intel-fortran-vla-strings.patch | 24 +++++-- gdb.spec | 5 +- 6 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 gdb-rhbz1932645-aarch64-ptrace-header-order.patch diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include index f4a4002..a9fb5aa 100644 --- a/_gdb.spec.Patch.include +++ b/_gdb.spec.Patch.include @@ -406,3 +406,7 @@ Patch099: gdb-rhbz1912985-libstdc++-assert.patch # Backport fix for rawhide build error (RH BZ 1930528). Patch100: gdb-rhbz1930528-fix-gnulib-build-error.patch +# [aarch64] Backport fix for aarch64-linux-hw-point.c build problem +# (RH BZ 1932645). +Patch101: gdb-rhbz1932645-aarch64-ptrace-header-order.patch + diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include index fd3cf02..202a5cc 100644 --- a/_gdb.spec.patch.include +++ b/_gdb.spec.patch.include @@ -98,3 +98,4 @@ %patch098 -p1 %patch099 -p1 %patch100 -p1 +%patch101 -p1 diff --git a/_patch_order b/_patch_order index 4e243cf..fa31778 100644 --- a/_patch_order +++ b/_patch_order @@ -98,3 +98,4 @@ gdb-rhbz1553104-s390x-arch12-test.patch gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch gdb-rhbz1912985-libstdc++-assert.patch gdb-rhbz1930528-fix-gnulib-build-error.patch +gdb-rhbz1932645-aarch64-ptrace-header-order.patch diff --git a/gdb-rhbz1932645-aarch64-ptrace-header-order.patch b/gdb-rhbz1932645-aarch64-ptrace-header-order.patch new file mode 100644 index 0000000..4f961a6 --- /dev/null +++ b/gdb-rhbz1932645-aarch64-ptrace-header-order.patch @@ -0,0 +1,69 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Wed, 24 Feb 2021 13:19:08 -0700 +Subject: gdb-rhbz1932645-aarch64-ptrace-header-order.patch + +;; [aarch64] Backport fix for aarch64-linux-hw-point.c build problem +;; (RH BZ 1932645). + +Fix aarch64-linux-hw-point.c build problem + +Due to a recent glibc header file change, the file +nat/aarch64-linux-hw-point.c no longer builds on Fedora rawhide. + +An enum for PTRACE_SYSEMU is now provided by . In the +past, PTRACE_SYSEMU was defined only in . This is +what it looks like... + +In : + + #define PTRACE_SYSEMU 31 + +In : + +enum __ptrace_request +{ + ... + PTRACE_SYSEMU = 31, + #define PT_SYSEMU PTRACE_SYSEMU + + ... +} + +When and are both included in a source +file, we run into the following build problem when the former is +included before the latter: + +In file included from nat/aarch64-linux-hw-point.c:26: +/usr/include/sys/ptrace.h:86:3: error: expected identifier before numeric constant + 86 | PTRACE_SYSEMU = 31, + | ^~~~~~~~~~~~~ + +(There are more errors after this one too.) + +The file builds without error when is included after +. I found that this is already done in +nat/aarch64-sve-linux-ptrace.h (which is included by +nat/aarch64-linux-ptrace.c). + +I've tested this change on Fedora rawhide and Fedora 33, both +running on an aarch64 machine. + +gdb/ChangeLog: + + * nat/aarch64-linux-hw-point.c: Include after + . + +diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c +--- a/gdb/nat/aarch64-linux-hw-point.c ++++ b/gdb/nat/aarch64-linux-hw-point.c +@@ -23,8 +23,8 @@ + #include "aarch64-linux-hw-point.h" + + #include +-#include + #include ++#include + #include + + /* Number of hardware breakpoints/watchpoints the target supports. diff --git a/gdb-vla-intel-fortran-vla-strings.patch b/gdb-vla-intel-fortran-vla-strings.patch index 0682b02..1e48ee8 100644 --- a/gdb-vla-intel-fortran-vla-strings.patch +++ b/gdb-vla-intel-fortran-vla-strings.patch @@ -45,14 +45,18 @@ diff --git a/gdb/NEWS b/gdb/NEWS diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c -@@ -572,6 +572,24 @@ c_value_print (struct value *val, struct ui_file *stream, +@@ -572,6 +572,28 @@ c_value_print (struct value *val, struct ui_file *stream, else { /* normal case */ + if (type->code () == TYPE_CODE_PTR + && 1 == is_dynamic_type (type)) + { -+ CORE_ADDR addr = value_as_address (val); ++ CORE_ADDR addr; ++ if (NULL != TYPE_DATA_LOCATION (TYPE_TARGET_TYPE (type))) ++ addr = value_address (val); ++ else ++ addr = value_as_address (val); + + /* We resolve the target-type only when the + pointer is associated. */ @@ -1005,7 +1009,7 @@ diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran diff --git a/gdb/typeprint.c b/gdb/typeprint.c --- a/gdb/typeprint.c +++ b/gdb/typeprint.c -@@ -565,6 +565,21 @@ whatis_exp (const char *exp, int show) +@@ -565,6 +565,25 @@ whatis_exp (const char *exp, int show) printf_filtered (" */\n"); } @@ -1016,7 +1020,11 @@ diff --git a/gdb/typeprint.c b/gdb/typeprint.c + if (type->code () == TYPE_CODE_PTR + && is_dynamic_type (type) == 1) + { -+ CORE_ADDR addr = value_as_address (val); ++ CORE_ADDR addr; ++ if (NULL != TYPE_DATA_LOCATION (TYPE_TARGET_TYPE(type))) ++ addr = value_address (val); ++ else ++ addr = value_as_address (val); + + if (addr != 0 + && type_not_associated (type) == 0) @@ -1030,15 +1038,19 @@ diff --git a/gdb/typeprint.c b/gdb/typeprint.c diff --git a/gdb/valops.c b/gdb/valops.c --- a/gdb/valops.c +++ b/gdb/valops.c -@@ -1553,6 +1553,15 @@ value_ind (struct value *arg1) +@@ -1553,6 +1553,19 @@ value_ind (struct value *arg1) if (base_type->code () == TYPE_CODE_PTR) { struct type *enc_type; ++ CORE_ADDR addr; + + if (type_not_associated (base_type)) + error (_("Attempt to take contents of a not associated pointer.")); + -+ CORE_ADDR addr = value_as_address (arg1); ++ if (NULL != TYPE_DATA_LOCATION (TYPE_TARGET_TYPE (base_type))) ++ addr = value_address (arg1); ++ else ++ addr = value_as_address (arg1); + + if (addr != 0) + TYPE_TARGET_TYPE (base_type) = diff --git a/gdb.spec b/gdb.spec index 82386e2..5ba6149 100644 --- a/gdb.spec +++ b/gdb.spec @@ -37,7 +37,7 @@ Version: 10.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: 8%{?dist} +Release: 9%{?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. @@ -1195,6 +1195,9 @@ fi %endif %changelog +* Wed Feb 24 2021 Kevin Buettner - 10.1-9 +- Fix aarch64 build problem (RHBZ 1932645, Kevin Buettner). + * Fri Feb 19 2021 Jan Kratochvil - 10.1-8 - Fix gdb-vla-intel-fortran-vla-strings.patch for compatiblity with GraalVM.