gdb: FTBFS on hurd-i386 (for review)
Source: gdb
Version: 7.4.1-1.1
Severity: important
Tags: patch
Usertags: hurd
User: debian-hurd@lists.debian.org
Hello,
gdb does not build from source any longer since gdb-multiarch packages
was enabled in 7.4.1-1. The build problems are due to two reasons:
First the reserved keyword MACH is defined in include/objcode/h8300.h
causing problems since gcc defines it for GNU/Hurd.
Secondly, there is a PATH_MAX issue in gdb/nto-tdep.c. alloca is used
for the patch in function nto_init_solib_absolute_prefix(), as is
already used in the previous function, nto_find_and_open_solib(), in the
same source file. The patches are inlined below:
avoid_MACH_defined_by_gcc.patch:
--- a/include/opcode/h8300.h 2010-04-15 12:26:09.000000000 +0200
+++ b/include/opcode/h8300.h 2012-09-26 13:13:57.000000000 +0200
@@ -25,6 +25,11 @@
If the nibble has value 15 or less than the representation is
complete.
Otherwise, we record what it contains with several flags. */
+/* Avoid problems under GNU/Hurd */
+#ifdef MACH
+#undef MACH
+#endif
+
typedef int op_type;
enum h8_flags
solve_PATH_MAX_issue.patch:
--- a/gdb/nto-tdep.c 2012-01-06 05:43:21.000000000 +0100
+++ b/gdb/nto-tdep.c 2012-09-26 13:58:00.000000000 +0200
@@ -147,9 +147,9 @@
void
nto_init_solib_absolute_prefix (void)
{
- char buf[PATH_MAX * 2], arch_path[PATH_MAX];
- char *nto_root, *endian;
+ char *buf, *arch_path, *nto_root, *endian;
const char *arch;
+#define FMT "set solib-absolute-prefix %s"
nto_root = nto_target ();
if (strcmp (gdbarch_bfd_arch_info (target_gdbarch)->arch_name,
"i386") == 0)
@@ -172,9 +172,11 @@
== BFD_ENDIAN_BIG ? "be" : "le";
}
+ arch_path = alloca (strlen(nto_root) + 1 + strlen(arch) +
strlen(endian) + 1);
sprintf (arch_path, "%s/%s%s", nto_root, arch, endian);
- sprintf (buf, "set solib-absolute-prefix %s", arch_path);
+ buf = alloca (strlen(FMT) + strlen(arch_path) + 1);
+ sprintf (buf, FMT, arch_path);
execute_command (buf, 0);
}
Reply to: