From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32372 invoked by alias); 7 Apr 2004 21:10:26 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 32347 invoked from network); 7 Apr 2004 21:10:19 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 7 Apr 2004 21:10:19 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i37LAJWD009882 for ; Wed, 7 Apr 2004 17:10:19 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i37LAJj28736; Wed, 7 Apr 2004 17:10:19 -0400 Received: from localhost.localdomain (vpn50-1.rdu.redhat.com [172.16.50.1]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id i37LA8nM010449; Wed, 7 Apr 2004 17:10:08 -0400 Received: from saguaro (saguaro.lan [192.168.64.2]) by localhost.localdomain (8.12.10/8.12.10) with SMTP id i37LA2OR001610; Wed, 7 Apr 2004 14:10:03 -0700 Date: Wed, 07 Apr 2004 21:10:00 -0000 From: Kevin Buettner To: Manoj Iyer Cc: gdb-patches@sources.redhat.com Subject: Re: [PATCH] GDB64 ppc64 compile error patch Message-Id: <20040407141002.00713138@saguaro> In-Reply-To: References: Organization: Red Hat Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2004-04/txt/msg00180.txt.bz2 On Wed, 7 Apr 2004 14:37:30 -0500 (CDT) Manoj Iyer wrote: > > This patch fixes compile error when gdb is built as a 64bit binary on a > PPC64 platform. ELF_NGREG ELF_NFPREG and ELF_NVRREG are members of an > enum, but they are also defined in a headerfile, so compiler issues error. > > gcc -c -m64 -mminimal-toc -I. -I. -I./config > -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H > -I./../include/opcode -I./../readline/.. -I../bfd -I./../bfd > -I./../include -I../intl -I./../intl -DMI_OUT=1 -Wimplicit -Wreturn-type > -Wcomment -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith > -Wuninitialized -Wformat-nonliteral -Wunused-label -Wunused-function > ppc-linux-tdep.c > cc1: warning: -Wuninitialized is not supported without -O > ppc-linux-tdep.c:956: error: parse error before numeric constant > make[1]: *** [ppc-linux-tdep.o] Error 1 > make[1]: Leaving directory `/root/manjo/April07/xxx/new/src/gdb' > make: *** [all-gdb] Error 2 > > This is because ELF_NGREG ELF_NFPREG and ELF_NVRREG are defined in header > files > > /usr/include/sys/procfs.h:#define ELF_NFPREG 33 /* includes > fpscr */ > /usr/include/sys/procfs.h:typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; > /usr/include/asm-ppc/elf.h:#define ELF_NFPREG 33 /* includes fpscr > */ > /usr/include/asm-ppc/elf.h:typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; > /usr/include/asm-ppc64/elf.h:#define ELF_NFPREG 33 /* includes fpscr > */ > /usr/include/asm-ppc64/elf.h:typedef elf_fpreg_t > elf_fpregset_t[ELF_NFPREG]; > > and the enum > > enum { > ELF_NGREG = 48, > ELF_NFPREG = 33, > ELF_NVRREG = 33 > }; > > causes the compiler to interpret ELF_NFPREG = 33, as 33 = 33, etc. > > The patch attached fixes this error. Thanks for the patch. Before I apply it (or make other changes to avoid the problem), I'd like to have a better understanding of precisely what is going wrong. A cursory inspection of the sources doesn't give any clue about how any of the header files that you mention above are being included in ppc-linux-tdep.c. If we could figure out how the offending system header is being included and prevent its inclusion, we could avoid redefining the enum constants as macros. IMO, that would be a preferable course of action since we don't want system headers tainting any *-tdep.c code anyway. Kevin