aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-06-04 10:01:34 -0700
committerH.J. Lu <hjl.tools@gmail.com>2018-06-04 10:01:46 -0700
commit95da9854466ada2572b42f5528711a06a2d42db1 (patch)
tree40deaadb0c8cc86a3ced66c823fbb4fba791c146 /bfd
parent62b74cb8b00ca2b42de30ceff4d2f1552b77a10d (diff)
downloadgdb-95da9854466ada2572b42f5528711a06a2d42db1.zip
gdb-95da9854466ada2572b42f5528711a06a2d42db1.tar.gz
gdb-95da9854466ada2572b42f5528711a06a2d42db1.tar.bz2
Use DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION to silence GCC 8.1
GCC 8.1 warns about destination size with -Wstringop-truncation: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643 Use DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION to silence it. bfd/ PR binutils/23146 * bfd-in.h: Include "diagnostics.h". * bfd-in2.h: Regenerated. * elf32-arm.c (elf32_arm_nabi_write_core_note): Use DIAGNOSTIC_PUSH, DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION and DIAGNOSTIC_POP to silence GCC 8.1 warnings with -Wstringop-truncation. * elf32-ppc.c (ppc_elf_write_core_note): Likewse. * elf32-s390.c (elf_s390_write_core_note): Likewse. * elf64-ppc.c (ppc64_elf_write_core_note): Likewse. * elf64-s390.c (elf_s390_write_core_note): Likewse. * elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewse. include/ * diagnostics.h (DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION): Always define for GCC.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog15
-rw-r--r--bfd/bfd-in.h1
-rw-r--r--bfd/bfd-in2.h1
-rw-r--r--bfd/elf32-arm.c9
-rw-r--r--bfd/elf32-ppc.c9
-rw-r--r--bfd/elf32-s390.c9
-rw-r--r--bfd/elf64-ppc.c9
-rw-r--r--bfd/elf64-s390.c9
-rw-r--r--bfd/elfxx-aarch64.c9
9 files changed, 71 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a8f4688..b36cdab 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,18 @@
+2018-06-04 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/23146
+ * bfd-in.h: Include "diagnostics.h".
+ * bfd-in2.h: Regenerated.
+ * elf32-arm.c (elf32_arm_nabi_write_core_note): Use
+ DIAGNOSTIC_PUSH, DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION and
+ DIAGNOSTIC_POP to silence GCC 8.1 warnings with
+ -Wstringop-truncation.
+ * elf32-ppc.c (ppc_elf_write_core_note): Likewse.
+ * elf32-s390.c (elf_s390_write_core_note): Likewse.
+ * elf64-ppc.c (ppc64_elf_write_core_note): Likewse.
+ * elf64-s390.c (elf_s390_write_core_note): Likewse.
+ * elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewse.
+
2018-06-03 Jim Wilson <jimw@sifive.com>
PR ld/23244
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 481587e..1d477c3 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -34,6 +34,7 @@ extern "C" {
#include "ansidecl.h"
#include "symcat.h"
+#include "diagnostics.h"
#include <stdarg.h>
#include <sys/stat.h>
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index ef62f31..65735f0 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -41,6 +41,7 @@ extern "C" {
#include "ansidecl.h"
#include "symcat.h"
+#include "diagnostics.h"
#include <stdarg.h>
#include <sys/stat.h>
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index dbfd838..870111b 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -2174,7 +2174,16 @@ elf32_arm_nabi_write_core_note (bfd *abfd, char *buf, int *bufsiz,
va_start (ap, note_type);
memset (data, 0, sizeof (data));
strncpy (data + 28, va_arg (ap, const char *), 16);
+ DIAGNOSTIC_PUSH;
+ /* GCC 8.1 warns about 80 equals destination size with
+ -Wstringop-truncation:
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643
+ */
+#if GCC_VERSION == 8001
+ DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION;
+#endif
strncpy (data + 44, va_arg (ap, const char *), 80);
+ DIAGNOSTIC_POP;
va_end (ap);
return elfcore_write_note (abfd, buf, bufsiz,
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 3482bac..ea8dbed 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2411,7 +2411,16 @@ ppc_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type, ...)
va_start (ap, note_type);
memset (data, 0, sizeof (data));
strncpy (data + 32, va_arg (ap, const char *), 16);
+ DIAGNOSTIC_PUSH;
+ /* GCC 8.1 warns about 80 equals destination size with
+ -Wstringop-truncation:
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643
+ */
+#if GCC_VERSION == 8001
+ DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION;
+#endif
strncpy (data + 48, va_arg (ap, const char *), 80);
+ DIAGNOSTIC_POP;
va_end (ap);
return elfcore_write_note (abfd, buf, bufsiz,
"CORE", note_type, data, sizeof (data));
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 99ceb76..ebda1da 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -3951,7 +3951,16 @@ elf_s390_write_core_note (bfd *abfd, char *buf, int *bufsiz,
va_end (ap);
strncpy (data + 28, fname, 16);
+ DIAGNOSTIC_PUSH;
+ /* GCC 8.1 warns about 80 equals destination size with
+ -Wstringop-truncation:
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643
+ */
+#if GCC_VERSION == 8001
+ DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION;
+#endif
strncpy (data + 44, psargs, 80);
+ DIAGNOSTIC_POP;
return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type,
&data, sizeof (data));
}
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index f543cb0..16199fb 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -3041,7 +3041,16 @@ ppc64_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type,
va_start (ap, note_type);
memset (data, 0, sizeof (data));
strncpy (data + 40, va_arg (ap, const char *), 16);
+ DIAGNOSTIC_PUSH;
+ /* GCC 8.1 warns about 80 equals destination size with
+ -Wstringop-truncation:
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643
+ */
+#if GCC_VERSION == 8001
+ DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION;
+#endif
strncpy (data + 56, va_arg (ap, const char *), 80);
+ DIAGNOSTIC_POP;
va_end (ap);
return elfcore_write_note (abfd, buf, bufsiz,
"CORE", note_type, data, sizeof (data));
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 612557f..93a3c7c 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -3760,7 +3760,16 @@ elf_s390_write_core_note (bfd *abfd, char *buf, int *bufsiz,
va_end (ap);
strncpy (data + 40, fname, 16);
+ DIAGNOSTIC_PUSH;
+ /* GCC 8.1 warns about 80 equals destination size with
+ -Wstringop-truncation:
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643
+ */
+#if GCC_VERSION == 8001
+ DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION;
+#endif
strncpy (data + 56, psargs, 80);
+ DIAGNOSTIC_POP;
return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type,
&data, sizeof (data));
}
diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c
index af37f82..3ea8dad 100644
--- a/bfd/elfxx-aarch64.c
+++ b/bfd/elfxx-aarch64.c
@@ -640,7 +640,16 @@ _bfd_aarch64_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_ty
va_start (ap, note_type);
memset (data, 0, sizeof (data));
strncpy (data + 40, va_arg (ap, const char *), 16);
+ DIAGNOSTIC_PUSH;
+ /* GCC 8.1 warns about 80 equals destination size with
+ -Wstringop-truncation:
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643
+ */
+#if GCC_VERSION == 8001
+ DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION;
+#endif
strncpy (data + 56, va_arg (ap, const char *), 80);
+ DIAGNOSTIC_POP;
va_end (ap);
return elfcore_write_note (abfd, buf, bufsiz, "CORE",