summary refs log tree commit diff
path: root/pkgs/development/tools/misc/gdb
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2022-03-21 12:33:01 -0500
committerGitHub <noreply@github.com>2022-03-21 12:33:01 -0500
commit47363ef04f20560adabc13dddf1bea28afe33dd8 (patch)
tree76dc4199ddd5c7d63de389cda3001a713e321ba6 /pkgs/development/tools/misc/gdb
parent17a43eefb8c67195e8839da3ddaee448eec2369f (diff)
downloadnixpkgs-47363ef04f20560adabc13dddf1bea28afe33dd8.tar
nixpkgs-47363ef04f20560adabc13dddf1bea28afe33dd8.tar.gz
nixpkgs-47363ef04f20560adabc13dddf1bea28afe33dd8.tar.bz2
nixpkgs-47363ef04f20560adabc13dddf1bea28afe33dd8.tar.lz
nixpkgs-47363ef04f20560adabc13dddf1bea28afe33dd8.tar.xz
nixpkgs-47363ef04f20560adabc13dddf1bea28afe33dd8.tar.zst
nixpkgs-47363ef04f20560adabc13dddf1bea28afe33dd8.zip
gdb: fix w/musl (#164766)
* gdb: fix on musl, sys/termios.h -> termios.h

* gdb: grab upstream patch to fix w/musl

Fixes instances of PAGESIZE/PAGE_SIZE that conflict
with header-provided definitions.

I was concerned about stability (IIRC version in these can change?)
but already risking that with the gcc-12 patch, so this is probably
okay.

Stale/unstable URL's are especially important to avoid on less
commonly used combinations such as w/musl, but also don't
want to bloat the tree :).

Risk is low, as this will be included in next update.
Diffstat (limited to 'pkgs/development/tools/misc/gdb')
-rw-r--r--pkgs/development/tools/misc/gdb/default.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkgs/development/tools/misc/gdb/default.nix b/pkgs/development/tools/misc/gdb/default.nix
index 5bb5bc0652f..f21808b1bf7 100644
--- a/pkgs/development/tools/misc/gdb/default.nix
+++ b/pkgs/development/tools/misc/gdb/default.nix
@@ -37,6 +37,8 @@ stdenv.mkDerivation rec {
   postPatch = if stdenv.isDarwin then ''
     substituteInPlace gdb/darwin-nat.c \
       --replace '#include "bfd/mach-o.h"' '#include "mach-o.h"'
+  '' else if stdenv.hostPlatform.isMusl then ''
+    substituteInPlace sim/ppc/emul_unix.c --replace sys/termios.h termios.h
   '' else null;
 
   patches = [
@@ -50,7 +52,11 @@ stdenv.mkDerivation rec {
     })
   ] ++ lib.optionals stdenv.isDarwin [
     ./darwin-target-match.patch
-  ];
+  ] ++ lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
+    name = "musl-fix-pagesize-page_size.patch";
+    url = "https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=fd0975b96b16d96010dce439af9620d3dfb65426";
+    hash = "sha256-M3U7uIIFJnYu0g8/sMLJPhm02q7cGOi6pLjgsUUjeKI=";
+  });
 
   nativeBuildInputs = [ pkg-config texinfo perl setupDebugInfoDirs ];