From 36d176c6d80a1be1aa1634471f72677c8c9dc1b3 Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Wed, 13 Sep 2017 17:14:39 +0200 Subject: [PATCH] gdb-git: Add local patches to fix build under Clang Work-in-progress. --- gdb-git/distinfo | 13 +++++++++++ gdb-git/patches/patch-gdb_amd64-linux-tdep.c | 13 +++++++++++ gdb-git/patches/patch-gdb_arm-tdep.c | 22 +++++++++++++++++++ .../patches/patch-gdb_common_common-utils.c | 16 ++++++++++++++ .../patches/patch-gdb_common_common-utils.h | 14 ++++++++++++ gdb-git/patches/patch-gdb_cris-tdep.c | 22 +++++++++++++++++++ gdb-git/patches/patch-gdb_dwarf2read.c | 22 +++++++++++++++++++ gdb-git/patches/patch-gdb_utils.h | 17 ++++++++++++++ .../patches/patch-opcodes_arc-nps400-tbl.h | 22 +++++++++++++++++++ gdb-git/patches/patch-opcodes_riscv-dis.c | 13 +++++++++++ gdb-git/patches/patch-readline_misc.c | 13 +++++++++++ gdb-git/patches/patch-readline_rltty.c | 15 +++++++++++++ gdb-git/patches/patch-readline_terminal.c | 14 ++++++++++++ gdb-git/patches/patch-readline_util.c | 13 +++++++++++ 14 files changed, 229 insertions(+) create mode 100644 gdb-git/patches/patch-gdb_amd64-linux-tdep.c create mode 100644 gdb-git/patches/patch-gdb_arm-tdep.c create mode 100644 gdb-git/patches/patch-gdb_common_common-utils.c create mode 100644 gdb-git/patches/patch-gdb_common_common-utils.h create mode 100644 gdb-git/patches/patch-gdb_cris-tdep.c create mode 100644 gdb-git/patches/patch-gdb_dwarf2read.c create mode 100644 gdb-git/patches/patch-gdb_utils.h create mode 100644 gdb-git/patches/patch-opcodes_arc-nps400-tbl.h create mode 100644 gdb-git/patches/patch-opcodes_riscv-dis.c create mode 100644 gdb-git/patches/patch-readline_misc.c create mode 100644 gdb-git/patches/patch-readline_rltty.c create mode 100644 gdb-git/patches/patch-readline_terminal.c create mode 100644 gdb-git/patches/patch-readline_util.c diff --git a/gdb-git/distinfo b/gdb-git/distinfo index 9559db4e07..090a1cec70 100644 --- a/gdb-git/distinfo +++ b/gdb-git/distinfo @@ -3,3 +3,16 @@ $NetBSD: distinfo,v 1.10 2015/03/15 14:22:19 bsiegert Exp $ SHA1 (gdb-7.9.tar.gz) = 8f89aa6847dc87de2f720779a87ba360bdbc7efd RMD160 (gdb-7.9.tar.gz) = 939dda771a073e82e7d72fd584246f3d1d8e9bdc Size (gdb-7.9.tar.gz) = 33225783 bytes +SHA1 (patch-gdb_amd64-linux-tdep.c) = 289591103c1c855faa9ad9a05b137693461d8b73 +SHA1 (patch-gdb_arm-tdep.c) = 80b1b0cbc92a48933d2693578d8fe151555edc3b +SHA1 (patch-gdb_common_common-utils.c) = 52b07c9e85dc7a5b88616a569ea6f45af5d47b07 +SHA1 (patch-gdb_common_common-utils.h) = bac642bb6cb8eab24a124a910033fda0b0d94117 +SHA1 (patch-gdb_cris-tdep.c) = c36f9087d8b475c09c12065159aeaa9c89e0c46f +SHA1 (patch-gdb_dwarf2read.c) = 3a03c815afaf114ffb6e5bd3c448ee31652f4e08 +SHA1 (patch-gdb_utils.h) = 93c471220b00a2bd43f7a2fab685e02c9ed0e122 +SHA1 (patch-opcodes_arc-nps400-tbl.h) = b67ca002dad0ea3d9c66537dd698ea8aee7280a4 +SHA1 (patch-opcodes_riscv-dis.c) = 950e1bc58c6c092c6e3c8f7eef1b6f9723afd6dd +SHA1 (patch-readline_misc.c) = 395af9b11895da9abd0b9fcd4dbeb9156324e9b0 +SHA1 (patch-readline_rltty.c) = 38b3ae6e1cda6a02a43bfb0ba8d105abc977f54d +SHA1 (patch-readline_terminal.c) = 1d4568977342abe74af84225702d024b9bda8065 +SHA1 (patch-readline_util.c) = ca054b5adca7669f29048cedd667279f28dfd07d diff --git a/gdb-git/patches/patch-gdb_amd64-linux-tdep.c b/gdb-git/patches/patch-gdb_amd64-linux-tdep.c new file mode 100644 index 0000000000..32603fa825 --- /dev/null +++ b/gdb-git/patches/patch-gdb_amd64-linux-tdep.c @@ -0,0 +1,13 @@ +$NetBSD$ + +--- gdb/amd64-linux-tdep.c.orig 2017-09-11 11:24:04.000000000 +0000 ++++ gdb/amd64-linux-tdep.c +@@ -363,7 +363,7 @@ amd64_all_but_ip_registers_record (struc + static enum gdb_syscall + amd64_canonicalize_syscall (enum amd64_syscall syscall_number) + { +- switch (syscall_number) { ++ switch ((uint64_t)syscall_number) { + case amd64_sys_read: + case amd64_x32_sys_read: + return gdb_sys_read; diff --git a/gdb-git/patches/patch-gdb_arm-tdep.c b/gdb-git/patches/patch-gdb_arm-tdep.c new file mode 100644 index 0000000000..6ced8ad989 --- /dev/null +++ b/gdb-git/patches/patch-gdb_arm-tdep.c @@ -0,0 +1,22 @@ +$NetBSD$ + +--- gdb/arm-tdep.c.orig 2017-09-11 11:24:04.000000000 +0000 ++++ gdb/arm-tdep.c +@@ -10057,7 +10057,7 @@ arm_record_extension_space (insn_decode_ + && !INSN_RECORDED(arm_insn_r)) + { + /* Handle MLA(S) and MUL(S). */ +- if (0 <= insn_op1 && 3 >= insn_op1) ++ if (3 >= insn_op1) + { + record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15); + record_buf[1] = ARM_PS_REGNUM; +@@ -11766,7 +11766,7 @@ thumb_record_ld_st_reg_offset (insn_deco + record_buf[0] = reg_src1; + thumb_insn_r->reg_rec_count = 1; + } +- else if (opB >= 0 && opB <= 2) ++ else if (opB <= 2) + { + /* STR(2), STRB(2), STRH(2) . */ + reg_src1 = bits (thumb_insn_r->arm_insn, 3, 5); diff --git a/gdb-git/patches/patch-gdb_common_common-utils.c b/gdb-git/patches/patch-gdb_common_common-utils.c new file mode 100644 index 0000000000..65c54db37c --- /dev/null +++ b/gdb-git/patches/patch-gdb_common_common-utils.c @@ -0,0 +1,16 @@ +$NetBSD$ + +--- gdb/common/common-utils.c.orig 2017-09-11 23:07:52.000000000 +0000 ++++ gdb/common/common-utils.c +@@ -126,8 +126,10 @@ char * + xstrvprintf (const char *format, va_list ap) + { + char *ret = NULL; ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wformat-nonliteral" + int status = vasprintf (&ret, format, ap); +- ++#pragma GCC diagnostic pop + /* NULL is returned when there was a memory allocation problem, or + any other error (for instance, a bad format string). A negative + status (the printed length) with a non-NULL buffer should never diff --git a/gdb-git/patches/patch-gdb_common_common-utils.h b/gdb-git/patches/patch-gdb_common_common-utils.h new file mode 100644 index 0000000000..1e9e614a1a --- /dev/null +++ b/gdb-git/patches/patch-gdb_common_common-utils.h @@ -0,0 +1,14 @@ +$NetBSD$ + +--- gdb/common/common-utils.h.orig 2017-09-11 23:07:52.000000000 +0000 ++++ gdb/common/common-utils.h +@@ -52,8 +52,7 @@ void xfree (void *); + /* Like asprintf and vasprintf, but return the string, throw an error + if no memory. */ + char *xstrprintf (const char *format, ...) ATTRIBUTE_PRINTF (1, 2); +-char *xstrvprintf (const char *format, va_list ap) +- ATTRIBUTE_PRINTF (1, 0); ++char *xstrvprintf (const char *format, va_list ap); + + /* Like snprintf, but throw an error if the output buffer is too small. */ + int xsnprintf (char *str, size_t size, const char *format, ...) diff --git a/gdb-git/patches/patch-gdb_cris-tdep.c b/gdb-git/patches/patch-gdb_cris-tdep.c new file mode 100644 index 0000000000..e4b8bd0895 --- /dev/null +++ b/gdb-git/patches/patch-gdb_cris-tdep.c @@ -0,0 +1,22 @@ +$NetBSD$ + +--- gdb/cris-tdep.c.orig 2017-09-11 11:24:04.000000000 +0000 ++++ gdb/cris-tdep.c +@@ -1434,7 +1434,7 @@ cris_spec_reg_applicable (struct gdbarch + /* Indeterminate/obsolete. */ + return 0; + case cris_ver_v0_3: +- return (version >= 0 && version <= 3); ++ return (version <= 3); + case cris_ver_v3p: + return (version >= 3); + case cris_ver_v8: +@@ -1442,7 +1442,7 @@ cris_spec_reg_applicable (struct gdbarch + case cris_ver_v8p: + return (version >= 8); + case cris_ver_v0_10: +- return (version >= 0 && version <= 10); ++ return (version <= 10); + case cris_ver_v3_10: + return (version >= 3 && version <= 10); + case cris_ver_v8_10: diff --git a/gdb-git/patches/patch-gdb_dwarf2read.c b/gdb-git/patches/patch-gdb_dwarf2read.c new file mode 100644 index 0000000000..d05a548f48 --- /dev/null +++ b/gdb-git/patches/patch-gdb_dwarf2read.c @@ -0,0 +1,22 @@ +$NetBSD$ + +--- gdb/dwarf2read.c.orig 2017-09-11 11:24:04.000000000 +0000 ++++ gdb/dwarf2read.c +@@ -22098,7 +22098,7 @@ dwarf_decode_macro_bytes (bfd *abfd, + + /* Note that we rely on the fact that the corresponding GNU and + DWARF constants are the same. */ +- switch (macinfo_type) ++ switch ((uint64_t)macinfo_type) + { + /* A zero macinfo type indicates the end of the macro + information. */ +@@ -22415,7 +22415,7 @@ dwarf_decode_macros (struct dwarf2_cu *c + + /* Note that we rely on the fact that the corresponding GNU and + DWARF constants are the same. */ +- switch (macinfo_type) ++ switch ((uint64_t)macinfo_type) + { + /* A zero macinfo type indicates the end of the macro + information. */ diff --git a/gdb-git/patches/patch-gdb_utils.h b/gdb-git/patches/patch-gdb_utils.h new file mode 100644 index 0000000000..420cef8b40 --- /dev/null +++ b/gdb-git/patches/patch-gdb_utils.h @@ -0,0 +1,17 @@ +$NetBSD$ + +--- gdb/utils.h.orig 2017-09-11 11:24:05.000000000 +0000 ++++ gdb/utils.h +@@ -349,10 +349,9 @@ extern void printf_filtered (const char + + extern void printfi_filtered (int, const char *, ...) ATTRIBUTE_PRINTF (2, 3); + +-extern void vprintf_unfiltered (const char *, va_list) ATTRIBUTE_PRINTF (1, 0); ++extern void vprintf_unfiltered (const char *, va_list); + +-extern void vfprintf_unfiltered (struct ui_file *, const char *, va_list) +- ATTRIBUTE_PRINTF (2, 0); ++extern void vfprintf_unfiltered (struct ui_file *, const char *, va_list); + + extern void fprintf_unfiltered (struct ui_file *, const char *, ...) + ATTRIBUTE_PRINTF (2, 3); diff --git a/gdb-git/patches/patch-opcodes_arc-nps400-tbl.h b/gdb-git/patches/patch-opcodes_arc-nps400-tbl.h new file mode 100644 index 0000000000..c3aa86f9d0 --- /dev/null +++ b/gdb-git/patches/patch-opcodes_arc-nps400-tbl.h @@ -0,0 +1,22 @@ +$NetBSD$ + +--- opcodes/arc-nps400-tbl.h.orig 2017-09-11 11:24:05.000000000 +0000 ++++ opcodes/arc-nps400-tbl.h +@@ -980,13 +980,13 @@ ASRI_LIKE (0x4, C_NPS_GIC) + /* Atomic Operations. */ + + /* exc<.di><.f> a,a,[xa:b] */ +-{ "exc", 0x48060c21, 0xf80fbfff, ARC_OPCODE_ARC700, NONE, NPS400, { NPS_R_DST_3B, NPS_R_SRC1_3B, BRAKET, NPS_XA, COLON, NPS_R_SRC2_3B, BRAKETdup }, { C_DI14, C_NPS_F }}, ++{ "exc", 0x48060c21, 0xf80fbfff, ARC_OPCODE_ARC700, (insn_class_t)NONE, NPS400, { NPS_R_DST_3B, NPS_R_SRC1_3B, BRAKET, NPS_XA, COLON, NPS_R_SRC2_3B, BRAKETdup }, { C_DI14, C_NPS_F }}, + + /* exc<.di><.f> a,a,[sd:b] */ +-{ "exc", 0x48060c61, 0xf80fbfff, ARC_OPCODE_ARC700, NONE, NPS400, { NPS_R_DST_3B, NPS_R_SRC1_3B, BRAKET, NPS_SD, COLON, NPS_R_SRC2_3B, BRAKETdup }, { C_DI14, C_NPS_F }}, ++{ "exc", 0x48060c61, 0xf80fbfff, ARC_OPCODE_ARC700, (insn_class_t)NONE, NPS400, { NPS_R_DST_3B, NPS_R_SRC1_3B, BRAKET, NPS_SD, COLON, NPS_R_SRC2_3B, BRAKETdup }, { C_DI14, C_NPS_F }}, + + /* exc<.di><.f> a,a,[xd:b] */ +-{ "exc", 0x48060c81, 0xf80fbfff, ARC_OPCODE_ARC700, NONE, NPS400, { NPS_R_DST_3B, NPS_R_SRC1_3B, BRAKET, NPS_XD, COLON, NPS_R_SRC2_3B, BRAKETdup }, { C_DI14, C_NPS_F }}, ++{ "exc", 0x48060c81, 0xf80fbfff, ARC_OPCODE_ARC700, (insn_class_t)NONE, NPS400, { NPS_R_DST_3B, NPS_R_SRC1_3B, BRAKET, NPS_XD, COLON, NPS_R_SRC2_3B, BRAKETdup }, { C_DI14, C_NPS_F }}, + + /* exc<.di><.f> a,a,[b] */ +-{ "exc", 0x48060c01, 0xf80fbfff, ARC_OPCODE_ARC700, NONE, NPS400, { NPS_R_DST_3B, NPS_R_SRC1_3B, BRAKET, NPS_R_SRC2_3B, BRAKETdup }, { C_DI14, C_NPS_F }}, ++{ "exc", 0x48060c01, 0xf80fbfff, ARC_OPCODE_ARC700, (insn_class_t)NONE, NPS400, { NPS_R_DST_3B, NPS_R_SRC1_3B, BRAKET, NPS_R_SRC2_3B, BRAKETdup }, { C_DI14, C_NPS_F }}, diff --git a/gdb-git/patches/patch-opcodes_riscv-dis.c b/gdb-git/patches/patch-opcodes_riscv-dis.c new file mode 100644 index 0000000000..b15475460f --- /dev/null +++ b/gdb-git/patches/patch-opcodes_riscv-dis.c @@ -0,0 +1,13 @@ +$NetBSD$ + +--- opcodes/riscv-dis.c.orig 2017-09-11 11:24:05.000000000 +0000 ++++ opcodes/riscv-dis.c +@@ -428,7 +428,7 @@ riscv_disassemble_insn (bfd_vma memaddr, + if (no_aliases && (op->pinfo & INSN_ALIAS)) + continue; + /* Is this instruction restricted to a certain value of XLEN? */ +- if (isdigit (op->subset[0]) && atoi (op->subset) != xlen) ++ if (isdigit ((unsigned char)op->subset[0]) && atoi (op->subset) != xlen) + continue; + + /* It's a match. */ diff --git a/gdb-git/patches/patch-readline_misc.c b/gdb-git/patches/patch-readline_misc.c new file mode 100644 index 0000000000..e1ac17c4df --- /dev/null +++ b/gdb-git/patches/patch-readline_misc.c @@ -0,0 +1,13 @@ +$NetBSD$ + +--- readline/misc.c.orig 2017-09-11 11:24:05.000000000 +0000 ++++ readline/misc.c +@@ -453,7 +453,7 @@ _rl_revert_all_lines () + entry = (hpos == history_length) ? previous_history () : current_history (); + while (entry) + { +- if (ul = (UNDO_LIST *)entry->data) ++ if ((ul = (UNDO_LIST *)entry->data)) + { + if (ul == saved_undo_list) + saved_undo_list = 0; diff --git a/gdb-git/patches/patch-readline_rltty.c b/gdb-git/patches/patch-readline_rltty.c new file mode 100644 index 0000000000..46735a2ead --- /dev/null +++ b/gdb-git/patches/patch-readline_rltty.c @@ -0,0 +1,15 @@ +$NetBSD$ + +--- readline/rltty.c.orig 2017-09-11 11:24:05.000000000 +0000 ++++ readline/rltty.c +@@ -31,6 +31,10 @@ + #include + #include + ++//#if defined (HAVE_SYS_IOCTL_H) ++# include ++//#endif /* HAVE_UNISTD_H * ++ + #if defined (HAVE_UNISTD_H) + # include + #endif /* HAVE_UNISTD_H */ diff --git a/gdb-git/patches/patch-readline_terminal.c b/gdb-git/patches/patch-readline_terminal.c new file mode 100644 index 0000000000..e8dfdb6c57 --- /dev/null +++ b/gdb-git/patches/patch-readline_terminal.c @@ -0,0 +1,14 @@ +$NetBSD$ + +--- readline/terminal.c.orig 2017-09-11 11:24:05.000000000 +0000 ++++ readline/terminal.c +@@ -28,6 +28,9 @@ + #include + #include "posixstat.h" + #include ++// #ifdef HAVE_SYS_IOCTL_H ++#include ++// #endif + #if defined (HAVE_SYS_FILE_H) + # include + #endif /* HAVE_SYS_FILE_H */ diff --git a/gdb-git/patches/patch-readline_util.c b/gdb-git/patches/patch-readline_util.c new file mode 100644 index 0000000000..b70421f373 --- /dev/null +++ b/gdb-git/patches/patch-readline_util.c @@ -0,0 +1,13 @@ +$NetBSD$ + +--- readline/util.c.orig 2017-09-11 11:24:05.000000000 +0000 ++++ readline/util.c +@@ -517,7 +517,7 @@ _rl_tropen () + : "."), + getpid()); + #else +- sprintf (fnbuf, "/var/tmp/rltrace.%ld", getpid()); ++ sprintf (fnbuf, "/var/tmp/rltrace.%ld", (long)getpid()); + #endif + unlink(fnbuf); + _rl_tracefp = fopen (fnbuf, "w+");