gdb-git: Add local patches to fix build under Clang

Work-in-progress.
This commit is contained in:
Kamil Rytarowski 2017-09-13 17:14:39 +02:00
parent 92270dcfcb
commit 36d176c6d8
14 changed files with 229 additions and 0 deletions

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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, ...)

View File

@ -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:

View File

@ -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. */

View File

@ -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);

View File

@ -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 }},

View File

@ -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. */

View File

@ -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;

View File

@ -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 <errno.h>
#include <stdio.h>
+//#if defined (HAVE_SYS_IOCTL_H)
+# include <sys/ioctl.h>
+//#endif /* HAVE_UNISTD_H *
+
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */

View File

@ -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 <sys/types.h>
#include "posixstat.h"
#include <fcntl.h>
+// #ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+// #endif
#if defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
#endif /* HAVE_SYS_FILE_H */

View File

@ -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+");