@@ -37,6 +37,8 @@ stdenv.mkDerivation rec {
3737 postPatch = if stdenv.isDarwin then ''
3838 substituteInPlace gdb/darwin-nat.c \
3939 --replace '#include "bfd/mach-o.h"' '#include "mach-o.h"'
40+ '' else if stdenv.hostPlatform.isMusl then ''
41+ substituteInPlace sim/ppc/emul_unix.c --replace sys/termios.h termios.h
4042 '' else null;
4143
4244 patches = [
@@ -50,7 +52,11 @@ stdenv.mkDerivation rec {
5052 })
5153 ] ++ lib.optionals stdenv.isDarwin [
5254 ./darwin-target-match.patch
53− ];
55+ ] ++ lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
56+ name = "musl-fix-pagesize-page_size.patch";
57+ url = "https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=fd0975b96b16d96010dce439af9620d3dfb65426";
58+ hash = "sha256-M3U7uIIFJnYu0g8/sMLJPhm02q7cGOi6pLjgsUUjeKI=";
59+ });
5460
5561 nativeBuildInputs = [ pkg-config texinfo perl setupDebugInfoDirs ];
5662