From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1356 invoked by alias); 18 Dec 2013 13:03:01 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 1292 invoked by uid 89); 18 Dec 2013 13:03:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mailhost.u-strasbg.fr Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.222.218) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Dec 2013 13:02:59 +0000 Received: from mailhost.u-strasbg.fr (localhost [127.0.0.1]) by antispam (Postfix) with ESMTP id B2BCC220387; Wed, 18 Dec 2013 14:02:56 +0100 (CET) Received: from mailhost.u-strasbg.fr (localhost [127.0.0.1]) by antivirus (Postfix) with ESMTP id A35B72201DA; Wed, 18 Dec 2013 14:02:56 +0100 (CET) Received: from md15.u-strasbg.fr (md15.u-strasbg.fr [130.79.200.204]) by mr8.u-strasbg.fr (Postfix) with ESMTP id 3366122046A; Wed, 18 Dec 2013 14:02:52 +0100 (CET) Received: from ms15.u-strasbg.fr (ms15.u-strasbg.fr [130.79.204.115]) by md15.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id rBID2pt8027283 ; Wed, 18 Dec 2013 14:02:51 +0100 (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (Authenticated sender: mullerp) by ms15.u-strasbg.fr (Postfix) with ESMTPSA id 1D8411FD8A; Wed, 18 Dec 2013 14:02:48 +0100 (CET) From: "Pierre Muller" To: "'Pedro Alves'" , "'asmwarrior'" Cc: "'GDB Development'" , "'Binutils Development'" References: <52B17083.7040404@gmail.com> <52B1738D.4010409@redhat.com> In-Reply-To: <52B1738D.4010409@redhat.com> Subject: [RFC] BFD MinGW/Cygwin build error in bfd/peiXXgen.c Date: Wed, 18 Dec 2013 13:03:00 -0000 Message-ID: <002101cefbf1$7554b9a0$5ffe2ce0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2013-12/txt/msg00049.txt.bz2 Cygwin also fails to compile bfd/peigen.c, itself gebnerated from source bfd/peXXigen.c. The patch below allows to compile both for mingw32 and cygwin hosts. To fix the unknown wcsncasecmp function for mingw32 hosts, I added this code: +#ifdef __MINGW32__ +#define wcsncasecmp wcsnicmp +#endif I think that using the Windows API function wcsnicmp here is OK, but I don't know if the code should be somehow modified to accept wcsncasecmp function if it is added later to mingw hosts... Pierre Muller bfd/ChangeLog entry: 2013-12-18 Pierre Muller peXXigen.c (u16_mbtouc): Avoid unused function warning by exculding if __CYGWIN__ or __MINGW32__ macro is defined. (rsrc_cmp): Fix short Windows OS version. Also use this code for mingw32 systems. [__MINGW32__]: Alias wcsncasecmp function to Windows API wcsnicmp function. diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 5e2a876..05c7d8b 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -2930,7 +2930,7 @@ rsrc_write_directory (rsrc_write_data * data, BFD_ASSERT (nt =3D=3D next_entry); } -#ifdef HAVE_WCHAR_H +#if defined HAVE_WCHAR_H && ! defined __CYGWIN__ && ! defined __MINGW32__ /* Return the length (number of units) of the first character in S, putting its 'ucs4_t' representation in *PUC. */ @@ -2979,9 +2979,16 @@ rsrc_cmp (bfd_boolean is_name, rsrc_entry * a, rsrc_= entry * b) /* We have to perform a case insenstive, unicode string comparison... */ int res; -#ifdef __CYGWIN__ +#if defined __CYGWIN__ || defined __MINGW32__ +#ifdef __MINGW32__ +#define wcsncasecmp wcsnicmp +#endif /* Under Cygwin unicode =3D=3D UTF-16 =3D=3D wchar_t. FIXME: The same is true for MingGW - we should test for that too. */ + bfd_byte * astring =3D a->name_id.name.string; + unsigned int alen =3D a->name_id.name.len; + bfd_byte * bstring =3D b->name_id.name.string; + unsigned int blen =3D b->name_id.name.len; res =3D wcsncasecmp ((const wchar_t *) astring + 2, (const wchar_t *) bs= tring + 2, min (alen, blen)); #elif defined HAVE_WCHAR_H unsigned int i; > -----Message d'origine----- > De : binutils-owner@sourceware.org [mailto:binutils- > owner@sourceware.org] De la part de Pedro Alves > Envoy=C3=A9 : mercredi 18 d=C3=A9cembre 2013 11:06 > =C3=80 : asmwarrior > Cc : GDB Development; Binutils Development > Objet : Re: BFD MinGW build error: implicit declaration of function > 'wcsncasecmp' >=20 > Hi there, >=20 > Adding the binutils folks. (bfd is maintained by binutils.) >=20 > Looks like fallout from the .rsrc merge support. >=20 > On 12/18/2013 09:53 AM, asmwarrior wrote: > > I see the build error when I build GDB(git head) under MSYS+MinGW, > here the is build log > > > > mv -f .deps/pe-i386.Tpo .deps/pe-i386.Plo > > rm -f peigen.c > > sed -e s/XX/pe/g < ../../binutils-gdb/bfd/peXXigen.c > peigen.new > > mv -f peigen.new peigen.c > > /bin/sh ./libtool --tag=3DCC --mode=3Dcompile gcc -DHAVE_CONFIG_H -I.= - > I../../binutils-gdb/bfd -D__USE_MINGW_FSEEK -I. -I../../binutils- > gdb/bfd -I../../binutils-gdb/bfd/../include -DHAVE_i386pe_vec - > DHAVE_i386pei_vec -DHAVE_bfd_elf32_i386_vec - > DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec - > DBINDIR=3D'"/mingw/bin"' -W -Wall -Wstrict-prototypes -Wmissing- > prototypes -Wshadow -Wno-format -Werror -O0 -g -D__USE_MINGW_ACCESS -MT > peigen.lo -MD -MP -MF .deps/peigen.Tpo -c -o peigen.lo peigen.c > > libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../binutils-gdb/bfd - > D__USE_MINGW_FSEEK -I. -I../../binutils-gdb/bfd -I../../binutils- > gdb/bfd/../include -DHAVE_i386pe_vec -DHAVE_i386pei_vec - > DHAVE_bfd_elf32_i386_vec -DHAVE_bfd_elf32_little_generic_vec - > DHAVE_bfd_elf32_big_generic_vec -DBINDIR=3D\"/mingw/bin\" -W -Wall - > Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wno-format -Werror - > O0 -g -D__USE_MINGW_ACCESS -MT peigen.lo -MD -MP -MF .deps/peigen.Tpo - > c peigen.c -o peigen.o > > peigen.c: In function 'rsrc_cmp': > > peigen.c:3006:7: error: implicit declaration of function > 'wcsncasecmp' [-Werror=3Dimplicit-function-declaration] > > res =3D wcsncasecmp (& awc, & bwc, 1); > > ^ > > cc1.exe: all warnings being treated as errors > > make[4]: *** [peigen.lo] Error 1 > > make[4]: Leaving directory `/f/build_gdb/mybuild/bfd' > > make[3]: *** [all-recursive] Error 1 > > make[3]: Leaving directory `/f/build_gdb/mybuild/bfd' > > make[2]: *** [all] Error 2 > > > > I just see this is related to the change of this commit: > > > > Revision: 5879bb8fc592e4aea85bdc2a84381d89850e5770 > > Author: Nick Clifton > > Date: 2013-12-17 23:39:13 > > Message: > > * peXXigen.c: Include wchar.h if available. > > > > Include safe-ctype.h. > > (HighBitSet, SetHighBit, WithoutHighBit): New macros. > > (pe_print_resource_entries): Rename to > > rsrc_print_resource_entries. Handle names that are not RVAs. > > (pe_print_resource_directory): Rename to > > rsrc_print_resource_directory. > > (pe_print_rsrc): Rename to rsrc_print_section. Corrupt > > computation of RVA bias. > > (rsrc_count_entries): New function. > > (rsrc_count_directory): New function. > > (rsrc_parse_entry): New function. > > (rsrc_parse_entries): New function. > > (rsrc_parse_directory): New function. > > (rsrc_write_string): New function. > > (rsrc_compute_rva): New function. > > (rsrc_write_leaf): New function. > > (rsrc_write_entry): New function. > > (rsrc_write_directory): New function. > > (u16_mbtouc): New function. > > (rsrc_cmp): New function. > > (rsrc_print_name): New function. > > (rsrc_resource_name): New function. > > (rsrc_merge_string_entries): New function. > > (rsrc_sort_entries): New function. > > (rsrc_attach_chain): New function. > > (rsrc_merge): New function. > > (rsrc_process_section): New function - merges the contents of a > > .rsrc section. > > (_bfd_XXi_final_link_postscript): Call rsrc_process_section. > > * configure.in (AC_CHECK_HEADERS): Add wchar.h > > * config.in: Regenerate. > > * configure: Regenerate. > > ---- > > Modified: bfd/ChangeLog > > Modified: bfd/config.in > > Modified: bfd/configure > > Modified: bfd/configure.in > > Modified: bfd/peXXigen.c > > > > In my ststem, wchar.h exists, but I see there is no > functionwcsncasecmp() here. > > > > Thanks > > > > Yuanhui Zhang > > >=20 >=20 > -- > Pedro Alves