diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2026-03-06 21:18:10 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2026-03-06 21:18:10 +0000 |
| commit | 04afc99ca51f0dea7ceec4ef8557d88530bc32aa (patch) | |
| tree | 832f9341a136213389fa58384b669d3f364f5da4 /musl | |
| parent | bd935cf9759eb8f4e4000cc5b9ff13470673efca (diff) | |
| download | ToolchainFactory-04afc99ca51f0dea7ceec4ef8557d88530bc32aa.tar.gz | |
Add support for static pie, update to latest versions
Diffstat (limited to 'musl')
21 files changed, 925 insertions, 14 deletions
diff --git a/musl/Makefile b/musl/Makefile index c264297..9a0abab 100644 --- a/musl/Makefile +++ b/musl/Makefile @@ -2,7 +2,8 @@ include ../config O ?= $(CURDIR)/out -MCM_VER ?= e149c31c48b4f4a4c9349ddf7bc0027b90245afc +# MCM_VER ?= e149c31c48b4f4a4c9349ddf7bc0027b90245afc +MCM_VER ?= 4be756d35cb0c603ba9255a9fb187c39e082413b MIN_KERNEL_VER ?= 6.10.8 # make sure pc is first, because we need $(pc_TRIPLET) defined early @@ -53,8 +54,8 @@ $(O)/mk/$(1)-gdb.configured: $(O)/mk/gdb.unpacked $(O)/mk/pc-native.done $(O)/mk cd $(O)/build/$(1)/gdb/src && \ env \ PATH=$$(PATH) \ - CC="$(O)/native/$$(pc_TRIPLET)_pc-$(GCC_VER)/bin/gcc -g0 -O2 -static --static" \ - CXX="$(O)/native/$$(pc_TRIPLET)_pc-$(GCC_VER)/bin/g++ -g0 -O2 -static --static" \ + CC="$(O)/native/$$(pc_TRIPLET)_pc-$(GCC_VER)/bin/gcc -g0 -O2 -static --static -std=gnu17" \ + CXX="$(O)/native/$$(pc_TRIPLET)_pc-$(GCC_VER)/bin/g++ -g0 -O2 -static --static -std=gnu++17" \ CC_FOR_TARGET=$$($(1)_TRIPLET)-gcc \ CXX_FOR_TARGET=$$($(1)_TRIPLET)-g++ \ MAKEINFO=true \ @@ -183,7 +184,7 @@ $(O)/mk/gdb.unpacked: $(O)/mk/gdb.downloaded hashes/gdb-$(GDB_VER).tar.xz.sha1 $ $(O)/mk/gmp.configured: $(O)/mk/pc-native.done @mkdir -p $(O)/build/gmp/build - cd $(O)/build/gmp/build && env PATH=$(PATH) CC="gcc -static --static" CXX="g++ -static --static" ../../../musl-cross-make/gmp-$(GMP_VER)/configure --prefix=$(O)/build/gmp --disable-assembly --enable-cxx --disable-shared --with-gnu-ld + cd $(O)/build/gmp/build && env PATH=$(PATH) CC="gcc -static --static -std=gnu17" CXX="g++ -static --static -std=gnu++17" ../../../musl-cross-make/gmp-$(GMP_VER)/configure --prefix=$(O)/build/gmp --disable-assembly --enable-cxx --disable-shared --with-gnu-ld exec touch $@ $(O)/mk/gmp.built: $(O)/mk/gmp.configured @@ -222,7 +223,7 @@ $(O)/mk/mpc.done: $(O)/mk/mpc.built $(O)/mk/isl.configured: $(O)/mk/gmp.done $(O)/mk/pc-native.done @mkdir -p $(O)/build/isl/build - cd $(O)/build/isl/build && env PATH=$(PATH) CC="gcc -static --static" ../../../musl-cross-make/isl-$(ISL_VER)/configure --prefix=$(O)/build/isl --disable-shared --with-gnu-ld --with-gmp-prefix=$(O)/build/gmp + cd $(O)/build/isl/build && env PATH=$(PATH) CC="gcc -static --static -std=gnu17" ../../../musl-cross-make/isl-$(ISL_VER)/configure --prefix=$(O)/build/isl --disable-shared --with-gnu-ld --with-gmp-prefix=$(O)/build/gmp exec touch $@ $(O)/mk/isl.built: $(O)/mk/isl.configured diff --git a/musl/common.mk b/musl/common.mk index a6481a2..2806083 100644 --- a/musl/common.mk +++ b/musl/common.mk @@ -5,10 +5,12 @@ GCC_CONFIG += --disable-libquadmath --disable-decimal-float --disable-multilib GCC_CONFIG += --disable-nls --with-cloog=no --with-ppl=no --disable-libstdcxx-pch GCC_CONFIG += --disable-sjlj-exceptions --enable-gnu-unique-object --enable-linker-build-id GCC_CONFIG += CFLAGS='-g0 -O2' CXXFLAGS='-g0 -O2' +MUSL_CONFIG += CFLAGS=-fPIE BINUTILS_CONFIG += --disable-gprofng ISL_SITE = https://libisl.sourceforge.io/ GNU_SITE = https://ftp.gnu.org/pub/gnu +# MUSL_REPO = https://git.musl-libc.org/cgit/musl -DL_CMD = curl --no-progress-meter -o +DL_CMD = curl --no-progress-meter -L -o # MAKE += LIMITS_H_TEST=true diff --git a/musl/hashes/binutils-2.44.tar.xz.sha1 b/musl/hashes/binutils-2.44.tar.xz.sha1 new file mode 100644 index 0000000..c215742 --- /dev/null +++ b/musl/hashes/binutils-2.44.tar.xz.sha1 @@ -0,0 +1 @@ +c8c9f5ae46ab9e3722c71821982d2c270e267748 binutils-2.44.tar.xz diff --git a/musl/hashes/binutils-2.46.0.tar.xz.sha1 b/musl/hashes/binutils-2.46.0.tar.xz.sha1 new file mode 100644 index 0000000..7a58531 --- /dev/null +++ b/musl/hashes/binutils-2.46.0.tar.xz.sha1 @@ -0,0 +1 @@ +ca9c3b9f829d4243adfec46108417cec7c6985bb binutils-2.46.0.tar.xz diff --git a/musl/hashes/gcc-15.1.0.tar.xz.sha1 b/musl/hashes/gcc-15.1.0.tar.xz.sha1 new file mode 100644 index 0000000..ba02f02 --- /dev/null +++ b/musl/hashes/gcc-15.1.0.tar.xz.sha1 @@ -0,0 +1 @@ +42017f9c1b53a345ea1214c32012609b29dba5a2 gcc-15.1.0.tar.xz diff --git a/musl/hashes/gcc-15.2.0.tar.xz.sha1 b/musl/hashes/gcc-15.2.0.tar.xz.sha1 new file mode 100644 index 0000000..ee0c615 --- /dev/null +++ b/musl/hashes/gcc-15.2.0.tar.xz.sha1 @@ -0,0 +1 @@ +e9265c98ae18a6d952a636749d98c475ba2ca006 gcc-15.2.0.tar.xz diff --git a/musl/hashes/gdb-16.2.tar.xz.sha1 b/musl/hashes/gdb-16.2.tar.xz.sha1 new file mode 100644 index 0000000..bbae4db --- /dev/null +++ b/musl/hashes/gdb-16.2.tar.xz.sha1 @@ -0,0 +1 @@ +ddc8916d192286ff41e58c108e0f6cf55cb0e2f5 gdb-16.2.tar.xz diff --git a/musl/hashes/gdb-16.3.tar.xz.sha1 b/musl/hashes/gdb-16.3.tar.xz.sha1 new file mode 100644 index 0000000..77a18ee --- /dev/null +++ b/musl/hashes/gdb-16.3.tar.xz.sha1 @@ -0,0 +1 @@ +ac4b56773e6abe4a5467a0708a185b4279e8faf4 gdb-16.3.tar.xz diff --git a/musl/hashes/gdb-17.1.tar.xz.sha1 b/musl/hashes/gdb-17.1.tar.xz.sha1 new file mode 100644 index 0000000..08a2720 --- /dev/null +++ b/musl/hashes/gdb-17.1.tar.xz.sha1 @@ -0,0 +1 @@ +c99a59a9f480afb094bc0fbb19ceacdfe3658933 gdb-17.1.tar.xz diff --git a/musl/hashes/linux-6.13.2.tar.xz.sha1 b/musl/hashes/linux-6.13.2.tar.xz.sha1 new file mode 100644 index 0000000..39d5d69 --- /dev/null +++ b/musl/hashes/linux-6.13.2.tar.xz.sha1 @@ -0,0 +1 @@ +262bbf9fea97b9dc498209a6ba6999855385b8cc linux-6.13.2.tar.xz diff --git a/musl/hashes/linux-6.15.8.tar.xz.sha1 b/musl/hashes/linux-6.15.8.tar.xz.sha1 new file mode 100644 index 0000000..7bec90e --- /dev/null +++ b/musl/hashes/linux-6.15.8.tar.xz.sha1 @@ -0,0 +1 @@ +265a1bdfbb6b3dd6c2d2bfe8ab4e40b462db7228 linux-6.15.8.tar.xz diff --git a/musl/hashes/linux-6.19.5.tar.xz.sha1 b/musl/hashes/linux-6.19.5.tar.xz.sha1 new file mode 100644 index 0000000..eee367f --- /dev/null +++ b/musl/hashes/linux-6.19.5.tar.xz.sha1 @@ -0,0 +1 @@ +e41cc704166919a1d49abfc5b997e454b5fc68be linux-6.19.5.tar.xz diff --git a/musl/hashes/mpfr-4.2.2.tar.xz.sha1 b/musl/hashes/mpfr-4.2.2.tar.xz.sha1 new file mode 100644 index 0000000..46cb6ba --- /dev/null +++ b/musl/hashes/mpfr-4.2.2.tar.xz.sha1 @@ -0,0 +1 @@ +a63a264b273a652e27518443640e69567da498ce mpfr-4.2.2.tar.xz diff --git a/musl/patches-mcm/linux-and-patches.diff b/musl/patches-mcm/linux-and-patches.diff index 4c4f7cf..5008e8b 100644 --- a/musl/patches-mcm/linux-and-patches.diff +++ b/musl/patches-mcm/linux-and-patches.diff @@ -1,14 +1,6 @@ diff -rNU3 musl-cross-make.old/Makefile musl-cross-make/Makefile --- musl-cross-make.old/Makefile 2023-01-19 15:34:51.459465734 +0000 +++ musl-cross-make/Makefile 2023-01-19 15:38:18.809465486 +0000 -@@ -65,6 +65,7 @@ - $(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/binutils*)): SITE = $(BINUTILS_SITE) - $(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/gcc*)): SITE = $(GCC_SITE)/$(basename $(basename $(notdir $@))) - $(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/musl*)): SITE = $(MUSL_SITE) -+$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/linux-6*)): SITE = $(LINUX_SITE)/v6.x - $(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/linux-5*)): SITE = $(LINUX_SITE)/v5.x - $(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/linux-4*)): SITE = $(LINUX_SITE)/v4.x - $(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/linux-3*)): SITE = $(LINUX_SITE)/v3.x @@ -137,6 +138,7 @@ mkdir $@.tmp ( cd $@.tmp && $(COWPATCH) -I ../$< ) diff --git a/musl/patches-others/gdb-17.1/0000-termios.diff b/musl/patches-others/gdb-17.1/0000-termios.diff new file mode 100644 index 0000000..b23f4b5 --- /dev/null +++ b/musl/patches-others/gdb-17.1/0000-termios.diff @@ -0,0 +1,18 @@ +diff -rU3 gdb-17.1.old/gdb/ser-unix.c gdb-17.1/gdb/ser-unix.c +--- gdb-17.1.old/gdb/ser-unix.c 2025-12-20 02:53:21.000000000 +0000 ++++ gdb-17.1/gdb/ser-unix.c 2026-03-03 08:17:32.599938159 +0000 +@@ -529,12 +529,12 @@ + /* Clear the current output baud rate and fill a new value. */ + tio.c_cflag &= ~CBAUD; + tio.c_cflag |= BOTHER; +- tio.c_ospeed = rate; ++ tio.__c_ospeed = rate; + + /* Clear the current input baud rate and fill a new value. */ + tio.c_cflag &= ~(CBAUD << IBSHIFT); + tio.c_cflag |= BOTHER << IBSHIFT; +- tio.c_ispeed = rate; ++ tio.__c_ispeed = rate; + + if (ioctl (fd, req_set, &tio) < 0) + perror_with_name (_("Can not set custom baud rate")); diff --git a/musl/patches-others/gdb-17.1/0001-thiago.diff b/musl/patches-others/gdb-17.1/0001-thiago.diff new file mode 100644 index 0000000..c7f3a78 --- /dev/null +++ b/musl/patches-others/gdb-17.1/0001-thiago.diff @@ -0,0 +1,204 @@ +diff --git a/gdb/Makefile.in b/gdb/Makefile.in +index 2aa95be968ac..a412f3b3c592 100644 +--- a/gdb/Makefile.in ++++ b/gdb/Makefile.in +@@ -1306,6 +1306,7 @@ HFILES_NO_SRCDIR = \ + arch/aarch64-insn.h \ + arch/aarch64-mte.h \ + arch/aarch64-mte-linux.h \ ++ arch/aarch64-pauth-linux.h \ + arch/aarch64-scalable-linux.h \ + arch/amd64.h \ + arch/amd64-linux-tdesc.h \ +@@ -1549,6 +1550,7 @@ HFILES_NO_SRCDIR = \ + nat/aarch64-linux.h \ + nat/aarch64-linux-hw-point.h \ + nat/aarch64-mte-linux-ptrace.h \ ++ nat/aarch64-pauth-linux.h \ + nat/aarch64-scalable-linux-ptrace.h \ + nat/aarch64-scalable-linux-sigcontext.h \ + nat/amd64-linux.h \ +diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c +index 028de981588b..f64cc0a97d88 100644 +--- a/gdb/aarch64-linux-nat.c ++++ b/gdb/aarch64-linux-nat.c +@@ -34,6 +34,7 @@ + #include "arch/arm.h" + #include "nat/aarch64-linux.h" + #include "nat/aarch64-linux-hw-point.h" ++#include "nat/aarch64-pauth-linux.h" + #include "nat/aarch64-scalable-linux-ptrace.h" + + #include "elf/external.h" +@@ -1012,7 +1013,7 @@ aarch64_linux_nat_target::read_description () + or the streaming vector length, depending on whether streaming mode is + active or not. */ + features.vq = aarch64_sve_get_vq (tid); +- features.pauth = hwcap & AARCH64_HWCAP_PACA; ++ features.pauth = hwcap & HWCAP_PACA; + features.gcs = features.gcs_linux = hwcap & HWCAP_GCS; + features.mte = hwcap2 & HWCAP2_MTE; + features.tls = aarch64_tls_register_count (tid); +diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c +index b85c25ecae1d..d3d4c9e1de38 100644 +--- a/gdb/aarch64-linux-tdep.c ++++ b/gdb/aarch64-linux-tdep.c +@@ -54,6 +54,7 @@ + #include "arch/aarch64-gcs-linux.h" + #include "arch/aarch64-mte.h" + #include "arch/aarch64-mte-linux.h" ++#include "arch/aarch64-pauth-linux.h" + #include "arch/aarch64-scalable-linux.h" + + #include "arch-utils.h" +diff --git a/gdb/aarch64-linux-tdep.h b/gdb/aarch64-linux-tdep.h +index e926687ff6eb..b99fe91f36bd 100644 +--- a/gdb/aarch64-linux-tdep.h ++++ b/gdb/aarch64-linux-tdep.h +@@ -33,16 +33,10 @@ + alignment. */ + #define AARCH64_LINUX_SIZEOF_FPREGSET (33 * V_REGISTER_SIZE) + +-/* The pauth regset consists of 2 X sized registers. */ +-#define AARCH64_LINUX_SIZEOF_PAUTH (2 * X_REGISTER_SIZE) +- + /* The MTE regset consists of a 64-bit register. */ + #define AARCH64_LINUX_SIZEOF_MTE_REGSET (8) + + extern const struct regset aarch64_linux_gregset; + extern const struct regset aarch64_linux_fpregset; + +-/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */ +-#define AARCH64_HWCAP_PACA (1 << 30) +- + #endif /* GDB_AARCH64_LINUX_TDEP_H */ +diff --git a/gdb/arch/aarch64-pauth-linux.h b/gdb/arch/aarch64-pauth-linux.h +new file mode 100644 +index 000000000000..4174dc3a9ded +--- /dev/null ++++ b/gdb/arch/aarch64-pauth-linux.h +@@ -0,0 +1,29 @@ ++/* Common Linux target-dependent definitions for AArch64 PAuth. ++ ++ Copyright (C) 2019-2026 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see <http://www.gnu.org/licenses/>. */ ++ ++#ifndef GDB_ARCH_AARCH64_PAUTH_LINUX_H ++#define GDB_ARCH_AARCH64_PAUTH_LINUX_H ++ ++/* Feature check for Pointer Authentication Code Extension. */ ++#define AARCH64_HWCAP_PACA (1 << 30) ++ ++/* The pauth regset consists of 2 64-bit registers. */ ++#define AARCH64_LINUX_SIZEOF_PAUTH 16 ++ ++#endif /* GDB_ARCH_AARCH64_PAUTH_LINUX_H */ +diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h +index 0e9715a4268a..7856d95a93b1 100644 +--- a/gdb/arch/aarch64.h ++++ b/gdb/arch/aarch64.h +@@ -178,9 +178,6 @@ enum aarch64_regnum + #define AARCH64_PAUTH_DMASK_HIGH_REGNUM(pauth_reg_base) (pauth_reg_base + 2) + #define AARCH64_PAUTH_CMASK_HIGH_REGNUM(pauth_reg_base) (pauth_reg_base + 3) + +-/* This size is only meant for Linux, not bare metal. QEMU exposes 4 masks. */ +-#define AARCH64_PAUTH_REGS_SIZE (16) +- + #define AARCH64_X_REGS_NUM 31 + #define AARCH64_V_REGS_NUM 32 + #define AARCH64_SVE_Z_REGS_NUM AARCH64_V_REGS_NUM +diff --git a/gdb/nat/aarch64-pauth-linux.h b/gdb/nat/aarch64-pauth-linux.h +new file mode 100644 +index 000000000000..5ce85fb296c4 +--- /dev/null ++++ b/gdb/nat/aarch64-pauth-linux.h +@@ -0,0 +1,26 @@ ++/* Common Linux native definitions for AArch64 PAuth. ++ ++ Copyright (C) 2019-2026 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see <http://www.gnu.org/licenses/>. */ ++ ++#ifndef GDB_NAT_AARCH64_PAUTH_LINUX_H ++#define GDB_NAT_AARCH64_PAUTH_LINUX_H ++ ++/* Feature check for Pointer Authentication Code Extension. */ ++#define HWCAP_PACA (1 << 30) ++ ++#endif /* GDB_NAT_AARCH64_PAUTH_LINUX_H */ +diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc +index b19e605f55d6..07ddfb324466 100644 +--- a/gdbserver/linux-aarch64-low.cc ++++ b/gdbserver/linux-aarch64-low.cc +@@ -22,6 +22,7 @@ + #include "linux-low.h" + #include "nat/aarch64-linux.h" + #include "nat/aarch64-linux-hw-point.h" ++#include "nat/aarch64-pauth-linux.h" + #include "arch/aarch64-insn.h" + #include "linux-aarch32-low.h" + #include "elf/common.h" +@@ -41,6 +42,7 @@ + #include "arch/aarch64.h" + #include "arch/aarch64-gcs-linux.h" + #include "arch/aarch64-mte-linux.h" ++#include "arch/aarch64-pauth-linux.h" + #include "arch/aarch64-scalable-linux.h" + #include "linux-aarch32-tdesc.h" + #include "linux-aarch64-tdesc.h" +@@ -952,7 +954,7 @@ aarch64_adjust_register_sets (const struct aarch64_features &features) + break; + case NT_ARM_PAC_MASK: + if (features.pauth) +- regset->size = AARCH64_PAUTH_REGS_SIZE; ++ regset->size = AARCH64_LINUX_SIZEOF_PAUTH; + break; + case NT_ARM_TAGGED_ADDR_CTRL: + if (features.mte) +@@ -984,9 +986,6 @@ aarch64_adjust_register_sets (const struct aarch64_features &features) + } + } + +-/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */ +-#define AARCH64_HWCAP_PACA (1 << 30) +- + /* Implementation of linux target ops method "low_arch_setup". */ + + void +@@ -1005,7 +1004,7 @@ aarch64_target::low_arch_setup () + + features.vq = aarch64_sve_get_vq (tid); + /* A-profile PAC is 64-bit only. */ +- features.pauth = linux_get_hwcap (pid, 8) & AARCH64_HWCAP_PACA; ++ features.pauth = linux_get_hwcap (pid, 8) & HWCAP_PACA; + /* A-profile MTE is 64-bit only. */ + features.mte = linux_get_hwcap2 (pid, 8) & HWCAP2_MTE; + features.tls = aarch64_tls_register_count (tid); + diff --git a/musl/patches-others/gdb-17.1/0002-thiago.diff b/musl/patches-others/gdb-17.1/0002-thiago.diff new file mode 100644 index 0000000..669d07c --- /dev/null +++ b/musl/patches-others/gdb-17.1/0002-thiago.diff @@ -0,0 +1,146 @@ +diff --git a/gdb/Makefile.in b/gdb/Makefile.in +index a412f3b3c592..3d9bc86a97fd 100644 +--- a/gdb/Makefile.in ++++ b/gdb/Makefile.in +@@ -1301,6 +1301,7 @@ HFILES_NO_SRCDIR = \ + amdgpu-tdep.h \ + annotate.h \ + arch/aarch32.h \ ++ arch/aarch64-fpmr-linux.h \ + arch/aarch64-gcs-linux.h \ + arch/aarch64.h \ + arch/aarch64-insn.h \ +@@ -1546,6 +1547,7 @@ HFILES_NO_SRCDIR = \ + mn10300-tdep.h \ + moxie-tdep.h \ + namespace.h \ ++ nat/aarch64-fpmr-linux.h \ + nat/aarch64-hw-point.h \ + nat/aarch64-linux.h \ + nat/aarch64-linux-hw-point.h \ +diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c +index f64cc0a97d88..81a46ee1f0d0 100644 +--- a/gdb/aarch64-linux-nat.c ++++ b/gdb/aarch64-linux-nat.c +@@ -32,6 +32,7 @@ + #include "aarch32-linux-nat.h" + #include "aarch32-tdep.h" + #include "arch/arm.h" ++#include "nat/aarch64-fpmr-linux.h" + #include "nat/aarch64-linux.h" + #include "nat/aarch64-linux-hw-point.h" + #include "nat/aarch64-pauth-linux.h" +diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c +index d3d4c9e1de38..504e4126f1bc 100644 +--- a/gdb/aarch64-linux-tdep.c ++++ b/gdb/aarch64-linux-tdep.c +@@ -51,6 +51,7 @@ + #include "record-full.h" + #include "linux-record.h" + ++#include "arch/aarch64-fpmr-linux.h" + #include "arch/aarch64-gcs-linux.h" + #include "arch/aarch64-mte.h" + #include "arch/aarch64-mte-linux.h" +@@ -1764,7 +1765,7 @@ aarch64_linux_core_read_description (struct gdbarch *gdbarch, + features.pauth = hwcap & AARCH64_HWCAP_PACA; + features.gcs = features.gcs_linux = hwcap & HWCAP_GCS; + features.mte = hwcap2 & HWCAP2_MTE; +- features.fpmr = hwcap2 & HWCAP2_FPMR; ++ features.fpmr = hwcap2 & AARCH64_HWCAP2_FPMR; + + /* Handle the TLS section. */ + asection *tls = bfd_get_section_by_name (abfd, ".reg-aarch-tls"); +diff --git a/gdb/arch/aarch64-fpmr-linux.h b/gdb/arch/aarch64-fpmr-linux.h +new file mode 100644 +index 000000000000..5495cf8c0018 +--- /dev/null ++++ b/gdb/arch/aarch64-fpmr-linux.h +@@ -0,0 +1,26 @@ ++/* Common Linux target-dependent definitions for AArch64 FPMR. ++ ++ Copyright (C) 2025-2026 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see <http://www.gnu.org/licenses/>. */ ++ ++#ifndef GDB_ARCH_AARCH64_FPMR_LINUX_H ++#define GDB_ARCH_AARCH64_FPMR_LINUX_H ++ ++/* Feature check for Floating Point Mode Register. */ ++#define AARCH64_HWCAP2_FPMR (1ULL << 48) ++ ++#endif /* GDB_ARCH_AARCH64_FPMR_LINUX_H */ +diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h +index 7856d95a93b1..c9a89ac40986 100644 +--- a/gdb/arch/aarch64.h ++++ b/gdb/arch/aarch64.h +@@ -243,9 +243,4 @@ enum aarch64_regnum + /* Size of the SME2 ZT0 register in bytes. */ + #define AARCH64_SME2_ZT0_SIZE 64 + +-/* Feature check for Floating Point Mode Register. */ +-#ifndef HWCAP2_FPMR +-#define HWCAP2_FPMR (1ULL << 48) +-#endif /* HWCAP2_FPMR */ +- + #endif /* GDB_ARCH_AARCH64_H */ +diff --git a/gdb/nat/aarch64-fpmr-linux.h b/gdb/nat/aarch64-fpmr-linux.h +new file mode 100644 +index 000000000000..bb0243a89396 +--- /dev/null ++++ b/gdb/nat/aarch64-fpmr-linux.h +@@ -0,0 +1,28 @@ ++/* Common Linux native definitions for AArch64 FPMR. ++ ++ Copyright (C) 2025-2026 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see <http://www.gnu.org/licenses/>. */ ++ ++#ifndef GDB_NAT_AARCH64_FPMR_LINUX_H ++#define GDB_NAT_AARCH64_FPMR_LINUX_H ++ ++/* Feature check for Floating Point Mode Register. */ ++#ifndef HWCAP2_FPMR ++#define HWCAP2_FPMR (1ULL << 48) ++#endif /* HWCAP2_FPMR */ ++ ++#endif /* GDB_NAT_AARCH64_FPMR_LINUX_H */ +diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc +index 07ddfb324466..a6439943e855 100644 +--- a/gdbserver/linux-aarch64-low.cc ++++ b/gdbserver/linux-aarch64-low.cc +@@ -46,6 +46,7 @@ + #include "arch/aarch64-scalable-linux.h" + #include "linux-aarch32-tdesc.h" + #include "linux-aarch64-tdesc.h" ++#include "nat/aarch64-fpmr-linux.h" + #include "nat/aarch64-mte-linux-ptrace.h" + #include "nat/aarch64-scalable-linux-ptrace.h" + #include "tdesc.h" + diff --git a/musl/patches-others/gdb-17.1/0003-thiago.diff b/musl/patches-others/gdb-17.1/0003-thiago.diff new file mode 100644 index 0000000..3de064b --- /dev/null +++ b/musl/patches-others/gdb-17.1/0003-thiago.diff @@ -0,0 +1,163 @@ +diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c +index 81a46ee1f0d0..d12e2ddcfb28 100644 +--- a/gdb/aarch64-linux-nat.c ++++ b/gdb/aarch64-linux-nat.c +@@ -35,6 +35,7 @@ + #include "nat/aarch64-fpmr-linux.h" + #include "nat/aarch64-linux.h" + #include "nat/aarch64-linux-hw-point.h" ++#include "nat/aarch64-mte-linux-ptrace.h" + #include "nat/aarch64-pauth-linux.h" + #include "nat/aarch64-scalable-linux-ptrace.h" + +@@ -54,9 +55,6 @@ + #include "arch-utils.h" + + #include "arch/aarch64-gcs-linux.h" +-#include "arch/aarch64-mte-linux.h" +- +-#include "nat/aarch64-mte-linux-ptrace.h" + #include "arch/aarch64-scalable-linux.h" + + #include <string.h> +diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c +index 504e4126f1bc..4ca05fba771d 100644 +--- a/gdb/aarch64-linux-tdep.c ++++ b/gdb/aarch64-linux-tdep.c +@@ -1764,7 +1764,7 @@ aarch64_linux_core_read_description (struct gdbarch *gdbarch, + features.vq = aarch64_linux_core_read_vq_from_sections (gdbarch, abfd); + features.pauth = hwcap & AARCH64_HWCAP_PACA; + features.gcs = features.gcs_linux = hwcap & HWCAP_GCS; +- features.mte = hwcap2 & HWCAP2_MTE; ++ features.mte = hwcap2 & AARCH64_HWCAP2_MTE; + features.fpmr = hwcap2 & AARCH64_HWCAP2_FPMR; + + /* Handle the TLS section. */ +@@ -2698,7 +2698,7 @@ aarch64_linux_report_signal_info (struct gdbarch *gdbarch, + + const char *meaning; + +- if (si_code == SEGV_MTEAERR || si_code == SEGV_MTESERR) ++ if (si_code == AARCH64_SEGV_MTEAERR || si_code == AARCH64_SEGV_MTESERR) + meaning = _("Memory tag violation"); + else if (si_code == SEGV_CPERR && si_errno == 0) + meaning = _("Guarded Control Stack error"); +@@ -2710,7 +2710,7 @@ aarch64_linux_report_signal_info (struct gdbarch *gdbarch, + uiout->field_string ("sigcode-meaning", meaning); + + /* For synchronous faults, show additional information. */ +- if (si_code == SEGV_MTESERR) ++ if (si_code == AARCH64_SEGV_MTESERR) + { + uiout->text (_(" while accessing address ")); + uiout->field_core_addr ("fault-addr", gdbarch, fault_addr); +diff --git a/gdb/aarch64-linux-tdep.h b/gdb/aarch64-linux-tdep.h +index b99fe91f36bd..385b03cc1be7 100644 +--- a/gdb/aarch64-linux-tdep.h ++++ b/gdb/aarch64-linux-tdep.h +@@ -33,9 +33,6 @@ + alignment. */ + #define AARCH64_LINUX_SIZEOF_FPREGSET (33 * V_REGISTER_SIZE) + +-/* The MTE regset consists of a 64-bit register. */ +-#define AARCH64_LINUX_SIZEOF_MTE_REGSET (8) +- + extern const struct regset aarch64_linux_gregset; + extern const struct regset aarch64_linux_fpregset; + +diff --git a/gdb/arch/aarch64-mte-linux.h b/gdb/arch/aarch64-mte-linux.h +index 5c7e78c71eaf..bc31ae52b916 100644 +--- a/gdb/arch/aarch64-mte-linux.h ++++ b/gdb/arch/aarch64-mte-linux.h +@@ -20,29 +20,14 @@ + #ifndef GDB_ARCH_AARCH64_MTE_LINUX_H + #define GDB_ARCH_AARCH64_MTE_LINUX_H + +- +-/* Feature check for Memory Tagging Extension. */ +-#ifndef HWCAP2_MTE +-#define HWCAP2_MTE (1 << 18) +-#endif ++#define AARCH64_HWCAP2_MTE (1 << 18) + + /* The MTE regset consists of a single 64-bit register. */ +-#define AARCH64_LINUX_SIZEOF_MTE 8 ++#define AARCH64_LINUX_SIZEOF_MTE_REGSET 8 + + /* Memory tagging definitions. */ +-#ifndef SEGV_MTEAERR +-# define SEGV_MTEAERR 8 +-# define SEGV_MTESERR 9 +-#endif +- +-/* Memory tag types for AArch64. */ +-enum class aarch64_memtag_type +-{ +- /* MTE logical tag contained in pointers. */ +- mte_logical = 0, +- /* MTE allocation tag stored in memory tag granules. */ +- mte_allocation +-}; ++#define AARCH64_SEGV_MTEAERR 8 ++#define AARCH64_SEGV_MTESERR 9 + + /* Given a TAGS vector containing 1 MTE tag per byte, pack the data as + 2 tags per byte and resize the vector. */ +diff --git a/gdb/nat/aarch64-mte-linux-ptrace.c b/gdb/nat/aarch64-mte-linux-ptrace.c +index 903e11841201..c88b1d4fcd23 100644 +--- a/gdb/nat/aarch64-mte-linux-ptrace.c ++++ b/gdb/nat/aarch64-mte-linux-ptrace.c +@@ -23,7 +23,6 @@ + + #include "arch/aarch64.h" + #include "arch/aarch64-mte.h" +-#include "arch/aarch64-mte-linux.h" + #include "nat/aarch64-linux.h" + #include "nat/aarch64-mte-linux-ptrace.h" + +diff --git a/gdb/nat/aarch64-mte-linux-ptrace.h b/gdb/nat/aarch64-mte-linux-ptrace.h +index d31fa9f3c071..653de33108c8 100644 +--- a/gdb/nat/aarch64-mte-linux-ptrace.h ++++ b/gdb/nat/aarch64-mte-linux-ptrace.h +@@ -20,6 +20,11 @@ + #ifndef GDB_NAT_AARCH64_MTE_LINUX_PTRACE_H + #define GDB_NAT_AARCH64_MTE_LINUX_PTRACE_H + ++/* Feature check for Memory Tagging Extension. */ ++#ifndef HWCAP2_MTE ++#define HWCAP2_MTE (1 << 18) ++#endif ++ + /* MTE allocation tag access */ + + #ifndef PTRACE_PEEKMTETAGS +@@ -33,6 +38,15 @@ + /* Maximum number of tags to pass at once to the kernel. */ + #define AARCH64_MTE_TAGS_MAX_SIZE 4096 + ++/* Memory tag types for AArch64. */ ++enum class aarch64_memtag_type ++{ ++ /* MTE logical tag contained in pointers. */ ++ mte_logical = 0, ++ /* MTE allocation tag stored in memory tag granules. */ ++ mte_allocation ++}; ++ + /* Read the allocation tags from memory range [ADDRESS, ADDRESS + LEN) + into TAGS. + +diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc +index a6439943e855..a00ee1556c80 100644 +--- a/gdbserver/linux-aarch64-low.cc ++++ b/gdbserver/linux-aarch64-low.cc +@@ -959,7 +959,7 @@ aarch64_adjust_register_sets (const struct aarch64_features &features) + break; + case NT_ARM_TAGGED_ADDR_CTRL: + if (features.mte) +- regset->size = AARCH64_LINUX_SIZEOF_MTE; ++ regset->size = AARCH64_LINUX_SIZEOF_MTE_REGSET; + break; + case NT_ARM_TLS: + if (features.tls > 0) + diff --git a/musl/patches-others/gdb-17.1/0004-thiago.diff b/musl/patches-others/gdb-17.1/0004-thiago.diff new file mode 100644 index 0000000..c22c883 --- /dev/null +++ b/musl/patches-others/gdb-17.1/0004-thiago.diff @@ -0,0 +1,68 @@ +diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c +index d12e2ddcfb28..4b86ae9ebe16 100644 +--- a/gdb/aarch64-linux-nat.c ++++ b/gdb/aarch64-linux-nat.c +@@ -55,7 +55,6 @@ + #include "arch-utils.h" + + #include "arch/aarch64-gcs-linux.h" +-#include "arch/aarch64-scalable-linux.h" + + #include <string.h> + +diff --git a/gdb/arch/aarch64-scalable-linux.h b/gdb/arch/aarch64-scalable-linux.h +index 813d06562055..e20d094e79d7 100644 +--- a/gdb/arch/aarch64-scalable-linux.h ++++ b/gdb/arch/aarch64-scalable-linux.h +@@ -23,17 +23,6 @@ + + #include "gdbsupport/common-regcache.h" + +-/* Feature check for Scalable Matrix Extension. */ +-#ifndef HWCAP2_SME +-#define HWCAP2_SME (1 << 23) +-#endif +- +-/* Feature check for Scalable Matrix Extension 2. */ +-#ifndef HWCAP2_SME2 +-#define HWCAP2_SME2 (1UL << 37) +-#define HWCAP2_SME2P1 (1UL << 38) +-#endif +- + /* Streaming mode enabled/disabled bit. */ + #define SVCR_SM_BIT (1 << 0) + /* ZA enabled/disabled bit. */ +diff --git a/gdb/nat/aarch64-scalable-linux-ptrace.h b/gdb/nat/aarch64-scalable-linux-ptrace.h +index 453f19dfe8d9..f3424baf7092 100644 +--- a/gdb/nat/aarch64-scalable-linux-ptrace.h ++++ b/gdb/nat/aarch64-scalable-linux-ptrace.h +@@ -34,6 +34,17 @@ + #include <stdarg.h> + #include "aarch64-scalable-linux-sigcontext.h" + ++/* Feature check for Scalable Matrix Extension. */ ++#ifndef HWCAP2_SME ++#define HWCAP2_SME (1 << 23) ++#endif ++ ++/* Feature check for Scalable Matrix Extension 2. */ ++#ifndef HWCAP2_SME2 ++#define HWCAP2_SME2 (1UL << 37) ++#define HWCAP2_SME2P1 (1UL << 38) ++#endif ++ + /* Indicates whether a SVE ptrace header is followed by SVE registers or a + fpsimd structure. */ + #define HAS_SVE_STATE(header) ((header).flags & SVE_PT_REGS_SVE) +diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc +index a00ee1556c80..c44f75167141 100644 +--- a/gdbserver/linux-aarch64-low.cc ++++ b/gdbserver/linux-aarch64-low.cc +@@ -43,7 +43,6 @@ + #include "arch/aarch64-gcs-linux.h" + #include "arch/aarch64-mte-linux.h" + #include "arch/aarch64-pauth-linux.h" +-#include "arch/aarch64-scalable-linux.h" + #include "linux-aarch32-tdesc.h" + #include "linux-aarch64-tdesc.h" + #include "nat/aarch64-fpmr-linux.h" diff --git a/musl/patches-others/gdb-17.1/0005-thiago.diff b/musl/patches-others/gdb-17.1/0005-thiago.diff new file mode 100644 index 0000000..13a7bf9 --- /dev/null +++ b/musl/patches-others/gdb-17.1/0005-thiago.diff @@ -0,0 +1,215 @@ +diff --git a/gdb/Makefile.in b/gdb/Makefile.in +index 3d9bc86a97fd..4a68189b4340 100644 +--- a/gdb/Makefile.in ++++ b/gdb/Makefile.in +@@ -1548,6 +1548,7 @@ HFILES_NO_SRCDIR = \ + moxie-tdep.h \ + namespace.h \ + nat/aarch64-fpmr-linux.h \ ++ nat/aarch64-gcs-linux.h \ + nat/aarch64-hw-point.h \ + nat/aarch64-linux.h \ + nat/aarch64-linux-hw-point.h \ +diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c +index 4b86ae9ebe16..52ace4aab411 100644 +--- a/gdb/aarch64-linux-nat.c ++++ b/gdb/aarch64-linux-nat.c +@@ -33,6 +33,7 @@ + #include "aarch32-tdep.h" + #include "arch/arm.h" + #include "nat/aarch64-fpmr-linux.h" ++#include "nat/aarch64-gcs-linux.h" + #include "nat/aarch64-linux.h" + #include "nat/aarch64-linux-hw-point.h" + #include "nat/aarch64-mte-linux-ptrace.h" +@@ -54,8 +55,6 @@ + #include "gdb_proc_service.h" + #include "arch-utils.h" + +-#include "arch/aarch64-gcs-linux.h" +- + #include <string.h> + + #ifndef TRAP_HWBKPT +diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c +index 4ca05fba771d..d136b0f2145e 100644 +--- a/gdb/aarch64-linux-tdep.c ++++ b/gdb/aarch64-linux-tdep.c +@@ -1736,8 +1736,9 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch, + gcs_regmap, regcache_supply_regset, regcache_collect_regset + }; + +- cb (".reg-aarch-gcs", sizeof (user_gcs), sizeof (user_gcs), +- &aarch64_linux_gcs_regset, "GCS registers", cb_data); ++ cb (".reg-aarch-gcs", AARCH64_LINUX_SIZEOF_GCS_REGSET, ++ AARCH64_LINUX_SIZEOF_GCS_REGSET, &aarch64_linux_gcs_regset, ++ "GCS registers", cb_data); + } + } + +@@ -1763,7 +1764,7 @@ aarch64_linux_core_read_description (struct gdbarch *gdbarch, + length. */ + features.vq = aarch64_linux_core_read_vq_from_sections (gdbarch, abfd); + features.pauth = hwcap & AARCH64_HWCAP_PACA; +- features.gcs = features.gcs_linux = hwcap & HWCAP_GCS; ++ features.gcs = features.gcs_linux = hwcap & AARCH64_HWCAP_GCS; + features.mte = hwcap2 & AARCH64_HWCAP2_MTE; + features.fpmr = hwcap2 & AARCH64_HWCAP2_FPMR; + +@@ -2612,7 +2613,7 @@ aarch64_linux_get_shadow_stack_pointer (gdbarch *gdbarch, regcache *regcache, + if (status != REG_VALID) + error (_("Can't read $gcspr.")); + +- shadow_stack_enabled = features_enabled & PR_SHADOW_STACK_ENABLE; ++ shadow_stack_enabled = features_enabled & AARCH64_PR_SHADOW_STACK_ENABLE; + return gcspr; + } + +@@ -2700,7 +2701,7 @@ aarch64_linux_report_signal_info (struct gdbarch *gdbarch, + + if (si_code == AARCH64_SEGV_MTEAERR || si_code == AARCH64_SEGV_MTESERR) + meaning = _("Memory tag violation"); +- else if (si_code == SEGV_CPERR && si_errno == 0) ++ else if (si_code == AARCH64_SEGV_CPERR && si_errno == 0) + meaning = _("Guarded Control Stack error"); + else + return; +@@ -2733,7 +2734,7 @@ aarch64_linux_report_signal_info (struct gdbarch *gdbarch, + uiout->field_string ("logical-tag", hex_string (ltag)); + } + } +- else if (si_code != SEGV_CPERR) ++ else if (si_code != AARCH64_SEGV_CPERR) + { + uiout->text ("\n"); + uiout->text (_("Fault address unavailable")); +diff --git a/gdb/arch/aarch64-gcs-linux.h b/gdb/arch/aarch64-gcs-linux.h +index b31fc32daa03..4aa0cbd4def8 100644 +--- a/gdb/arch/aarch64-gcs-linux.h ++++ b/gdb/arch/aarch64-gcs-linux.h +@@ -20,25 +20,17 @@ + #ifndef GDB_ARCH_AARCH64_GCS_LINUX_H + #define GDB_ARCH_AARCH64_GCS_LINUX_H + +-#include <stdint.h> +- + /* Feature check for Guarded Control Stack. */ +-#ifndef HWCAP_GCS +-#define HWCAP_GCS (1ULL << 32) +-#endif +- +-/* Make sure we only define these if the kernel header doesn't. */ +-#ifndef GCS_MAGIC ++#define AARCH64_HWCAP_GCS (1ULL << 32) + +-/* GCS state (NT_ARM_GCS). */ ++#define AARCH64_SEGV_CPERR 10 /* Control protection error. */ + +-struct user_gcs +-{ +- uint64_t features_enabled; +- uint64_t features_locked; +- uint64_t gcspr_el0; +-}; ++/* Flag which enables shadow stack in PR_SET_SHADOW_STACK_STATUS prctl. */ ++#define AARCH64_PR_SHADOW_STACK_ENABLE (1UL << 0) ++#define AARCH64_PR_SHADOW_STACK_WRITE (1UL << 1) ++#define AARCH64_PR_SHADOW_STACK_PUSH (1UL << 2) + +-#endif /* GCS_MAGIC */ ++/* The GCS regset consists of 3 64-bit registers. */ ++#define AARCH64_LINUX_SIZEOF_GCS_REGSET (3 * 8) + + #endif /* GDB_ARCH_AARCH64_GCS_LINUX_H */ +diff --git a/gdb/linux-tdep.h b/gdb/linux-tdep.h +index 73d4832069f4..aee52eae0f4a 100644 +--- a/gdb/linux-tdep.h ++++ b/gdb/linux-tdep.h +@@ -27,17 +27,6 @@ + struct inferior; + struct regcache; + +-#ifndef SEGV_CPERR +-#define SEGV_CPERR 10 /* Control protection error. */ +-#endif +- +-/* Flag which enables shadow stack in PR_SET_SHADOW_STACK_STATUS prctl. */ +-#ifndef PR_SHADOW_STACK_ENABLE +-#define PR_SHADOW_STACK_ENABLE (1UL << 0) +-#define PR_SHADOW_STACK_WRITE (1UL << 1) +-#define PR_SHADOW_STACK_PUSH (1UL << 2) +-#endif +- + /* Enum used to define the extra fields of the siginfo type used by an + architecture. */ + enum linux_siginfo_extra_field_values +diff --git a/gdb/nat/aarch64-gcs-linux.h b/gdb/nat/aarch64-gcs-linux.h +new file mode 100644 +index 000000000000..ddf8342a4284 +--- /dev/null ++++ b/gdb/nat/aarch64-gcs-linux.h +@@ -0,0 +1,45 @@ ++/* Common native Linux definitions for AArch64 Guarded Control Stack. ++ ++ Copyright (C) 2025-2026 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see <http://www.gnu.org/licenses/>. */ ++ ++#ifndef GDB_NAT_AARCH64_GCS_LINUX_H ++#define GDB_NAT_AARCH64_GCS_LINUX_H ++ ++#include <stdint.h> ++#include <asm/ptrace.h> ++ ++/* Feature check for Guarded Control Stack. */ ++#ifndef HWCAP_GCS ++#define HWCAP_GCS (1ULL << 32) ++#endif ++ ++/* Make sure we only define these if the kernel header doesn't. */ ++#ifndef GCS_MAGIC ++ ++/* GCS state (NT_ARM_GCS). */ ++ ++struct user_gcs ++{ ++ uint64_t features_enabled; ++ uint64_t features_locked; ++ uint64_t gcspr_el0; ++}; ++ ++#endif /* GCS_MAGIC */ ++ ++#endif /* GDB_NAT_AARCH64_GCS_LINUX_H */ +diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc +index c44f75167141..a2588a6e2a9c 100644 +--- a/gdbserver/linux-aarch64-low.cc ++++ b/gdbserver/linux-aarch64-low.cc +@@ -40,12 +40,12 @@ + + #include "gdb_proc_service.h" + #include "arch/aarch64.h" +-#include "arch/aarch64-gcs-linux.h" + #include "arch/aarch64-mte-linux.h" + #include "arch/aarch64-pauth-linux.h" + #include "linux-aarch32-tdesc.h" + #include "linux-aarch64-tdesc.h" + #include "nat/aarch64-fpmr-linux.h" ++#include "nat/aarch64-gcs-linux.h" + #include "nat/aarch64-mte-linux-ptrace.h" + #include "nat/aarch64-scalable-linux-ptrace.h" + #include "tdesc.h" + diff --git a/musl/patches-others/gdb-17.1/0006-thiago.diff b/musl/patches-others/gdb-17.1/0006-thiago.diff new file mode 100644 index 0000000..3e3e0be --- /dev/null +++ b/musl/patches-others/gdb-17.1/0006-thiago.diff @@ -0,0 +1,91 @@ +diff --git a/gdbsupport/config.in b/gdbsupport/config.in +index 0beacf22c057..2957ee0f0301 100644 +--- a/gdbsupport/config.in ++++ b/gdbsupport/config.in +@@ -271,6 +271,9 @@ + /* Define to 1 if `st_blocks' is a member of `struct stat'. */ + #undef HAVE_STRUCT_STAT_ST_BLOCKS + ++/* Define to 1 if your system has struct user_gcs. */ ++#undef HAVE_STRUCT_USER_GCS ++ + /* Define to 1 if you have the <sys/param.h> header file. */ + #undef HAVE_SYS_PARAM_H + +diff --git a/gdbsupport/configure b/gdbsupport/configure +index 05ad00f48c4f..584a80ef8255 100755 +--- a/gdbsupport/configure ++++ b/gdbsupport/configure +@@ -14307,6 +14307,42 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + ++# Check for `struct user_gcs` ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct user_gcs" >&5 ++$as_echo_n "checking for struct user_gcs... " >&6; } ++if ${gdb_cv_struct_user_gcs+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++#include <sys/ptrace.h> ++ #include <asm/ptrace.h> ++int ++main () ++{ ++struct user_gcs u; ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ gdb_cv_struct_user_gcs=yes ++else ++ gdb_cv_struct_user_gcs=no ++ ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++ ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_struct_user_gcs" >&5 ++$as_echo "$gdb_cv_struct_user_gcs" >&6; } ++if test "$gdb_cv_struct_user_gcs" = yes; then ++ ++$as_echo "#define HAVE_STRUCT_USER_GCS 1" >>confdefs.h ++ ++fi ++ + # Set the 'development' global. + . $srcdir/../bfd/development.sh + +diff --git a/gdbsupport/configure.ac b/gdbsupport/configure.ac +index 5491b8f3f10a..6c06832f0913 100644 +--- a/gdbsupport/configure.ac ++++ b/gdbsupport/configure.ac +@@ -68,6 +68,25 @@ GDB_AC_PTRACE + AM_GDB_COMPILER_TYPE + AM_GDB_WARNINGS + ++# Check for `struct user_gcs` ++AC_CACHE_CHECK( ++ [for struct user_gcs], ++ [gdb_cv_struct_user_gcs], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM( ++ [#include <sys/ptrace.h> ++ #include <asm/ptrace.h>], ++ [struct user_gcs u;] ++ )], ++ [gdb_cv_struct_user_gcs=yes], ++ [gdb_cv_struct_user_gcs=no] ++ )] ++) ++if test "$gdb_cv_struct_user_gcs" = yes; then ++ AC_DEFINE(HAVE_STRUCT_USER_GCS, 1, ++ [Define to 1 if your system has struct user_gcs.]) ++fi ++ + # Set the 'development' global. + . $srcdir/../bfd/development.sh + |
