pkgsi686Linux.gdb: fix formatting for 32-bit systems

A few rare targets don't have clean format strings on 32-bit systems:
https://github.com/NixOS/nixpkgs/pull/171216#issuecomment-1133541978

/build/gdb-12.1/_build/sim/../../sim/cris/sim-if.c:575:28:
error: format '%lx' expects argument of type 'long unsigned int',
but argument 4 has type 'bfd_size_type' {aka 'long long unsigned int'} [-Werror=format=]

We pull in patch pending upstream inclusion.

+72
+68
pkgs/development/tools/misc/gdb/32-bit-BFD_VMA-format.patch
···
··· 1 + Fix iWerror=format build for 32-bit systems. 2 + https://sourceware.org/pipermail/gdb-patches/2022-May/189288.html 3 + --- a/sim/cris/sim-if.c 4 + +++ b/sim/cris/sim-if.c 5 + @@ -257,7 +257,8 @@ cris_load_elf_file (SIM_DESC sd, struct bfd *abfd, sim_write_fn do_write) 6 + 7 + if (verbose) 8 + sim_io_printf (sd, 9 + - "Loading segment at 0x%" BFD_VMA_FMT "x, size 0x%lx\n", 10 + + "Loading segment at 0x%" BFD_VMA_FMT "x, " 11 + + "size 0x%" BFD_VMA_FMT "x\n", 12 + lma, phdr[i].p_filesz); 13 + 14 + if (bfd_seek (abfd, phdr[i].p_offset, SEEK_SET) != 0 15 + @@ -265,7 +266,7 @@ cris_load_elf_file (SIM_DESC sd, struct bfd *abfd, sim_write_fn do_write) 16 + { 17 + sim_io_eprintf (sd, 18 + "%s: could not read segment at 0x%" BFD_VMA_FMT "x, " 19 + - "size 0x%lx\n", 20 + + "size 0x%" BFD_VMA_FMT "x\n", 21 + STATE_MY_NAME (sd), lma, phdr[i].p_filesz); 22 + free (buf); 23 + return FALSE; 24 + @@ -275,7 +276,7 @@ cris_load_elf_file (SIM_DESC sd, struct bfd *abfd, sim_write_fn do_write) 25 + { 26 + sim_io_eprintf (sd, 27 + "%s: could not load segment at 0x%" BFD_VMA_FMT "x, " 28 + - "size 0x%lx\n", 29 + + "size 0x%" BFD_VMA_FMT "x\n", 30 + STATE_MY_NAME (sd), lma, phdr[i].p_filesz); 31 + free (buf); 32 + return FALSE; 33 + @@ -572,7 +573,8 @@ cris_handle_interpreter (SIM_DESC sd, struct bfd *abfd) 34 + memory area, so we go via a temporary area. Luckily, the 35 + interpreter is supposed to be small, less than 0x40000 36 + bytes. */ 37 + - sim_do_commandf (sd, "memory region 0x%" BFD_VMA_FMT "x,0x%lx", 38 + + sim_do_commandf (sd, "memory region 0x%" BFD_VMA_FMT "x," 39 + + "0x%" BFD_VMA_FMT "x", 40 + interp_load_addr, interpsiz); 41 + 42 + /* Now that memory for the interpreter is defined, load it. */ 43 + --- a/sim/m32c/syscalls.c 44 + +++ b/sim/m32c/syscalls.c 45 + @@ -299,8 +299,8 @@ m32c_syscall (int id) 46 + 47 + rv = gettimeofday (&tv, 0); 48 + if (trace) 49 + - printf ("gettimeofday: %ld sec %ld usec to 0x%x\n", tv.tv_sec, 50 + - tv.tv_usec, tvaddr); 51 + + printf ("gettimeofday: %lld sec %lld usec to 0x%x\n", 52 + + (long long)tv.tv_sec, (long long)tv.tv_usec, tvaddr); 53 + mem_put_si (tvaddr, tv.tv_sec); 54 + mem_put_si (tvaddr + 4, tv.tv_usec); 55 + put_reg (r0, rv); 56 + --- a/sim/rx/syscalls.c 57 + +++ b/sim/rx/syscalls.c 58 + @@ -270,8 +270,8 @@ rx_syscall (int id) 59 + 60 + rv = gettimeofday (&tv, 0); 61 + if (trace) 62 + - printf ("gettimeofday: %ld sec %ld usec to 0x%x\n", tv.tv_sec, 63 + - tv.tv_usec, tvaddr); 64 + + printf ("gettimeofday: %lld sec %lld usec to 0x%x\n", 65 + + (long long)tv.tv_sec, (long long)tv.tv_usec, tvaddr); 66 + mem_put_si (tvaddr, tv.tv_sec); 67 + mem_put_si (tvaddr + 4, tv.tv_usec); 68 + put_reg (1, rv);
+4
pkgs/development/tools/misc/gdb/default.nix
··· 49 ./debug-info-from-env.patch 50 ] ++ lib.optionals stdenv.isDarwin [ 51 ./darwin-target-match.patch 52 ]; 53 54 nativeBuildInputs = [ pkg-config texinfo perl setupDebugInfoDirs ];
··· 49 ./debug-info-from-env.patch 50 ] ++ lib.optionals stdenv.isDarwin [ 51 ./darwin-target-match.patch 52 + # Does not nave to be conditional. We apply it conditionally 53 + # to speed up inclusion to nearby nixos release. 54 + ] ++ lib.optionals stdenv.is32bit [ 55 + ./32-bit-BFD_VMA-format.patch 56 ]; 57 58 nativeBuildInputs = [ pkg-config texinfo perl setupDebugInfoDirs ];