From 01264bee104274e494b5ebbf96610f0f079288a3 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Tue, 8 Mar 2016 15:03:26 +0100 Subject: [PATCH] Fix strict-aliasing rules compilation error (RH BZ 1315191). --- gdb-bfd-aliasing.patch | 196 +++++++++++++++++++++++++++++++++++++++++ gdb.spec | 9 +- 2 files changed, 204 insertions(+), 1 deletion(-) create mode 100644 gdb-bfd-aliasing.patch diff --git a/gdb-bfd-aliasing.patch b/gdb-bfd-aliasing.patch new file mode 100644 index 0000000..0b06c14 --- /dev/null +++ b/gdb-bfd-aliasing.patch @@ -0,0 +1,196 @@ +http://sourceware.org/ml/binutils/2016-03/msg00119.html +Subject: [patch] aout+coff: Fix strict-aliasing rules error + + +--IJpNTDwzlM2Ie8A6 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline + +Hi, + +https://bugzilla.redhat.com/show_bug.cgi?id=1315191 by Dan Horak +gcc (GCC) 6.0.0 20160308 (experimental) +gcc-6.0.0-0.15.fc24 +gcc-6.0.0-0.15.fc25 +It did compile with: +gcc-6.0.0-0.14.fc24 + +aoutx.h:2504:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + int type_code = aout_symbol (symbol)->type & 0xff; + ^~~ +coffcode.h:1817:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + coffsymbol (section->symbol)->native = native; + ^~~~~~~~~~ + +Full log attached. + +This fix is probably wrong as it drops the type safety. But ({ statements as +expressions }) are probably not allowed in GDB. + + +Jan + +--IJpNTDwzlM2Ie8A6 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline; filename=1 + +bfd/ +2016-03-08 Jan Kratochvil + + Fix strict-aliasing rules compilation error. + * libaout.h (aout_symbol): Remove type safe indirection. + * libcoff-in.h (coffsymbol): Likewise. + * libcoff.h: Regenerate. + +diff --git a/bfd/libaout.h b/bfd/libaout.h +index 8b70a9f..b60c40c 100644 +--- a/bfd/libaout.h ++++ b/bfd/libaout.h +@@ -448,9 +448,7 @@ struct aout_data_struct + #define obj_aout_sym_hashes(bfd) (adata (bfd).sym_hashes) + #define obj_aout_dynamic_info(bfd) (adata (bfd).dynamic_info) + +-/* We take the address of the first element of an asymbol to ensure that the +- macro is only ever applied to an asymbol. */ +-#define aout_symbol(asymbol) ((aout_symbol_type *)(&(asymbol)->the_bfd)) ++#define aout_symbol(asymbol) ((aout_symbol_type *) (asymbol)) + + /* Information we keep for each a.out section. This is currently only + used by the a.out backend linker. */ +diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h +index 80f999d..fa1e9ac 100644 +--- a/bfd/libcoff-in.h ++++ b/bfd/libcoff-in.h +@@ -188,9 +188,7 @@ struct xcoff_tdata + + #define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data) + +-/* We take the address of the first element of an asymbol to ensure that the +- macro is only ever applied to an asymbol. */ +-#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd))) ++#define coffsymbol(asymbol) ((coff_symbol_type *) (asymbol)) + + /* Tdata for sections in XCOFF files. This is used by the linker. */ + +diff --git a/bfd/libcoff.h b/bfd/libcoff.h +index bbed3e0..8ce525b 100644 +--- a/bfd/libcoff.h ++++ b/bfd/libcoff.h +@@ -192,9 +192,7 @@ struct xcoff_tdata + + #define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data) + +-/* We take the address of the first element of an asymbol to ensure that the +- macro is only ever applied to an asymbol. */ +-#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd))) ++#define coffsymbol(asymbol) ((coff_symbol_type *) (asymbol)) + + /* Tdata for sections in XCOFF files. This is used by the linker. */ + + +--IJpNTDwzlM2Ie8A6 +Content-Type: text/plain; charset=iso-2022-jp +Content-Disposition: inline; filename=2 + +libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I. -I./../include -DHAVE_x86_64_elf64_vec -DHAVE_i386_elf32_vec -DHAVE_iamcu_elf32_vec -DHAVE_x86_64_elf32_vec -DHAVE_i386_aout_linux_vec -DHAVE_i386_pei_vec -DHAVE_x86_64_pei_vec -DHAVE_l1om_elf64_vec -DHAVE_k1om_elf64_vec -DHAVE_elf64_le_vec -DHAVE_elf64_be_vec -DHAVE_elf32_le_vec -DHAVE_elf32_be_vec -DHAVE_plugin_vec -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I./../zlib -g -O2 -MT aout32.lo -MD -MP -MF .deps/aout32.Tpo -c aout32.c -o aout32.o +In file included from aout32.c:24:0: +aoutx.h: In function ‘aout_32_write_syms’: +aoutx.h:1871:4: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + H_PUT_16 (abfd, aout_symbol (g)->desc, nsp.e_desc); + ^~~~~~~~ +aoutx.h:1872:4: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + H_PUT_8 (abfd, aout_symbol (g)->other, nsp.e_other); + ^~~~~~~ +aoutx.h:1873:4: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + H_PUT_8 (abfd, aout_symbol (g)->type, nsp.e_type); + ^~~~~~~ +aoutx.h: In function ‘aout_32_get_symbol_info’: +aoutx.h:2504:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + int type_code = aout_symbol (symbol)->type & 0xff; + ^~~ +aoutx.h:2515:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + ret->stab_other = (unsigned) (aout_symbol (symbol)->other & 0xff); + ^~~ +aoutx.h:2516:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + ret->stab_desc = (unsigned) (aout_symbol (symbol)->desc & 0xffff); + ^~~ +aoutx.h: In function ‘aout_32_print_symbol’: +aoutx.h:2537:9: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + (unsigned) (aout_symbol (symbol)->desc & 0xffff), + ^ +aoutx.h:2538:9: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + (unsigned) (aout_symbol (symbol)->other & 0xff), + ^ +aoutx.h:2539:9: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + (unsigned) (aout_symbol (symbol)->type)); + ^ +aoutx.h:2549:4: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + (unsigned) (aout_symbol (symbol)->desc & 0xffff), + ^ +aoutx.h:2550:4: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + (unsigned) (aout_symbol (symbol)->other & 0xff), + ^ +aoutx.h:2551:4: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + (unsigned) (aout_symbol (symbol)->type & 0xff)); + ^ +cc1: all warnings being treated as errors +libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I. -I./../include -DHAVE_x86_64_elf64_vec -DHAVE_i386_elf32_vec -DHAVE_iamcu_elf32_vec -DHAVE_x86_64_elf32_vec -DHAVE_i386_aout_linux_vec -DHAVE_i386_pei_vec -DHAVE_x86_64_pei_vec -DHAVE_l1om_elf64_vec -DHAVE_k1om_elf64_vec -DHAVE_elf64_le_vec -DHAVE_elf64_be_vec -DHAVE_elf32_le_vec -DHAVE_elf32_be_vec -DHAVE_plugin_vec -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I./../zlib -g -O2 -MT pei-i386.lo -MD -MP -MF .deps/pei-i386.Tpo -c pei-i386.c -o pei-i386.o +In file included from coff-i386.c:614:0, + from pei-i386.c:45: +coffcode.h: In function ‘coff_new_section_hook’: +coffcode.h:1817:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + coffsymbol (section->symbol)->native = native; + ^~~~~~~~~~ +cc1: all warnings being treated as errors +libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I. -I./../include -DHAVE_x86_64_elf64_vec -DHAVE_i386_elf32_vec -DHAVE_iamcu_elf32_vec -DHAVE_x86_64_elf32_vec -DHAVE_i386_aout_linux_vec -DHAVE_i386_pei_vec -DHAVE_x86_64_pei_vec -DHAVE_l1om_elf64_vec -DHAVE_k1om_elf64_vec -DHAVE_elf64_le_vec -DHAVE_elf64_be_vec -DHAVE_elf32_le_vec -DHAVE_elf32_be_vec -DHAVE_plugin_vec -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I./../zlib -g -O2 -MT coffgen.lo -MD -MP -MF .deps/coffgen.Tpo -c coffgen.c -o coffgen.o +coffgen.c: In function ‘coff_get_lineno’: +coffgen.c:1510:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + return coffsymbol (symbol)->lineno; + ^~~~~~ +coffgen.c: In function ‘coff_get_symbol_info’: +coffgen.c:2034:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + if (coffsymbol (symbol)->native != NULL + ^~ +coffgen.c:2035:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + && coffsymbol (symbol)->native->fix_value + ^~ +coffgen.c:2036:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + && coffsymbol (symbol)->native->is_sym) + ^~ +coffgen.c:2037:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + ret->value = coffsymbol (symbol)->native->u.syment.n_value - + ^~~ +coffgen.c: In function ‘coff_print_symbol’: +coffgen.c:2059:9: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + coffsymbol (symbol)->native ? "n" : "g", + ^~~~~~~~~~ +coffgen.c:2060:9: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + coffsymbol (symbol)->lineno ? "l" : " "); + ^~~~~~~~~~ +coffgen.c:2064:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + if (coffsymbol (symbol)->native) + ^~ +coffgen.c:2068:4: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + combined_entry_type *combined = coffsymbol (symbol)->native; + ^~~~~~~~~~~~~~~~~~~ +coffgen.c:2070:11: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + struct lineno_cache_entry *l = coffsymbol (symbol)->lineno; + ^~~~~~~~~~~~~~~~~~ +coffgen.c:2191:6: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + coffsymbol (symbol)->native ? "n" : "g", + ^~~~~~~~~~ +coffgen.c:2192:6: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + coffsymbol (symbol)->lineno ? "l" : " ", + ^~~~~~~~~~ +cc1: all warnings being treated as errors +libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I. -I./../include -DHAVE_x86_64_elf64_vec -DHAVE_i386_elf32_vec -DHAVE_iamcu_elf32_vec -DHAVE_x86_64_elf32_vec -DHAVE_i386_aout_linux_vec -DHAVE_i386_pei_vec -DHAVE_x86_64_pei_vec -DHAVE_l1om_elf64_vec -DHAVE_k1om_elf64_vec -DHAVE_elf64_le_vec -DHAVE_elf64_be_vec -DHAVE_elf32_le_vec -DHAVE_elf32_be_vec -DHAVE_plugin_vec -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I./../zlib -g -O2 -MT pei-x86_64.lo -MD -MP -MF .deps/pei-x86_64.Tpo -c pei-x86_64.c -o pei-x86_64.o +In file included from coff-x86_64.c:741:0, + from pei-x86_64.c:763: +coffcode.h: In function ‘coff_new_section_hook’: +coffcode.h:1817:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] + coffsymbol (section->symbol)->native = native; + ^~~~~~~~~~ +cc1: all warnings being treated as errors + +--IJpNTDwzlM2Ie8A6-- + diff --git a/gdb.spec b/gdb.spec index fe04163..a5f7192 100644 --- a/gdb.spec +++ b/gdb.spec @@ -27,7 +27,7 @@ Version: 7.11 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 58%{?dist} +Release: 59%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL Group: Development/Debuggers @@ -554,6 +554,9 @@ Patch1073: gdb-opcodes-clflushopt-test.patch # [testsuite] Fix false selftest.exp FAIL from system readline-6.3+ (Patrick Palka). Patch1075: gdb-testsuite-readline63-sigint.patch +# Fix strict-aliasing rules compilation error (RH BZ 1315191). +Patch1107: gdb-bfd-aliasing.patch + %if 0%{!?rhel:1} || 0%{?rhel} > 6 # RL_STATE_FEDORA_GDB would not be found for: # Patch642: gdb-readline62-ask-more-rh.patch @@ -867,6 +870,7 @@ find -name "*.info*"|xargs rm -f %patch337 -p1 %patch331 -p1 %patch1075 -p1 +%patch1107 -p1 %if 0%{?rhel:1} && 0%{?rhel} <= 7 %patch1044 -p1 @@ -1384,6 +1388,9 @@ then fi %changelog +* Tue Mar 8 2016 Jan Kratochvil - 7.11-59.fc24 +- Fix strict-aliasing rules compilation error (RH BZ 1315191). + * Fri Feb 26 2016 Jan Kratochvil - 7.11-58.fc24 - Rebase VLA (Fortran dynamic arrays) strides (multi-dim. subarrays) from Intel.