From 95da9854466ada2572b42f5528711a06a2d42db1 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 4 Jun 2018 10:01:34 -0700 Subject: 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. --- bfd/elf64-s390.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'bfd/elf64-s390.c') 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)); } -- cgit v1.1