From patchwork Wed Jan 18 09:48:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Preudhomme X-Patchwork-Id: 716570 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3v3MdB3677z9rxw for ; Wed, 18 Jan 2017 20:49:31 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Jv5zC5BG"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=IdQTM+5XKEqv2YOX17rUMGL2pQWZ4RqoZHqh2TD071fJYhePeS p6wweQ29tXF//NCC8jD4DoTPrwqlTr6ZAjYCHbZxdICcaFrFvMf+2+Ykl/Lo6jxA MybygAS1zYLuk/ldUa6/JdG4U7FCulsxWleX50XXVbFe8GgCdmCVih1ZM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=lIMlp0PAbOS9QB6lHv/z7nth+V8=; b=Jv5zC5BGRjtwoz+R2SEK ae39Lf7j4Xc9fY0+x/NcnGLT57+g+VPdwtMLyZts0pUdFdXIKD2neut464l5C72d 7+178rv7Wd9mb4YZYaMjJLxVFblMR07kl90UcCgrzc8AL7CtC3ftZh9hrlaf44jW KrTYVgdn58dfSFZbQfhAvzI= Received: (qmail 20412 invoked by alias); 18 Jan 2017 09:48:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 19051 invoked by uid 89); 18 Jan 2017 09:48:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, KAM_LOTSOFHASH, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=633, 201512, 18541 X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Jan 2017 09:48:17 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 45214C14; Wed, 18 Jan 2017 01:48:13 -0800 (PST) Received: from [10.2.206.52] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C9BA53F220; Wed, 18 Jan 2017 01:48:12 -0800 (PST) To: Jonathan Yong <10walls@gmail.com>, "gcc-patches@gcc.gnu.org" From: Thomas Preudhomme Subject: [PATCH, GCC/x86 mingw32] Add configure option to force wildcard behavior on Windows Message-ID: Date: Wed, 18 Jan 2017 09:48:11 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 X-IsSubscribed: yes By default, wildcard support on Windows for programs compiled with mingw depends on how the mingw runtime was configured. This means if one wants to build GCC for Windows with a consistent behavior with Wildcard (enabled or disabled) the mingw runtime must be built as well. This patch adds an option to GCC configuration to force the behavior with wildcard when building GCC for Windows host. It does so by setting the _dowildcard variable in the driver to a given value depending on the configure option value (yes or no), thus overriding the variable from mingw runtime. Testing: I've successfully done a build of the arm-none-eabi cross GCC for Windows with Ubuntu system mingw runtime (configured without wildcard support by default) with the three configure options: 1) --enable-wildcard: wildcard can be used successfully and nm of driver-mingw32.o shows that _dowildcard is in .data section 2) --disable-wildcard: wildcard cannot be used and nm of driver-mingw32.o shows that _dowildcard is in .bss section 3) no option: wildcard cannot be used and nm of driver-mingw32.o shows no _dowildcard defined and all sections are empty Is this ok for stage1? Best regards, Thomas diff --git a/gcc/config.host b/gcc/config.host index 6b28f3033ef92f1f0e09cc41f3a90be05c5e1e43..5e2db5327e3094a19cd29c81ceb1a9e2b11797c9 100644 --- a/gcc/config.host +++ b/gcc/config.host @@ -239,6 +239,7 @@ case ${host} in host_xmake_file="${host_xmake_file} i386/x-mingw32" host_exeext=.exe out_host_hook_obj=host-mingw32.o + host_extra_gcc_objs="${host_extra_gcc_objs} driver-mingw32.o" host_lto_plugin_soname=liblto_plugin-0.dll ;; x86_64-*-mingw*) @@ -247,6 +248,7 @@ case ${host} in host_xmake_file="${host_xmake_file} i386/x-mingw32" host_exeext=.exe out_host_hook_obj=host-mingw32.o + host_extra_gcc_objs="${host_extra_gcc_objs} driver-mingw32.o" host_lto_plugin_soname=liblto_plugin-0.dll ;; i[34567]86-*-darwin* | x86_64-*-darwin*) diff --git a/gcc/config.in b/gcc/config.in index 1959dd7a603f121b6f2a3e0f80563d6290299c8a..a6afc623c5d8c2064eb43252235bc2b90e5de0e7 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -2015,6 +2015,12 @@ #endif +/* Value to set mingw's _dowildcard to. */ +#ifndef USED_FOR_TARGET +#undef MINGW_DOWILDCARD +#endif + + /* Define if host mkdir takes a single argument. */ #ifndef USED_FOR_TARGET #undef MKDIR_TAKES_ONE_ARG diff --git a/gcc/config/i386/driver-mingw32.c b/gcc/config/i386/driver-mingw32.c new file mode 100644 index 0000000000000000000000000000000000000000..b70363ad26a7dc8ffccbb273e46d4dd6de1a6f8c --- /dev/null +++ b/gcc/config/i386/driver-mingw32.c @@ -0,0 +1,26 @@ +/* Host OS specific configuration for the gcc driver. + Copyright (C) 2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" + +/* When defined, force the use (if non null) or not (otherwise) of CLI + globbing. */ +#ifdef MINGW_DOWILDCARD +int _dowildcard = MINGW_DOWILDCARD; +#endif diff --git a/gcc/config/i386/x-mingw32 b/gcc/config/i386/x-mingw32 index b5cef97512032a223605fb4db592fab05b1bb521..d0fa05245c4566c56aab6a1a6683a13a4392f864 100644 --- a/gcc/config/i386/x-mingw32 +++ b/gcc/config/i386/x-mingw32 @@ -63,3 +63,6 @@ host-mingw32.o : $(srcdir)/config/i386/host-mingw32.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h hosthooks.h hosthooks-def.h toplev.h $(DIAGNOSTIC_H) $(HOOKS_H) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(srcdir)/config/i386/host-mingw32.c + +driver-mingw32.o : $(srcdir)/config/i386/driver-mingw32.c $(CONFIG_H) + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< diff --git a/gcc/configure b/gcc/configure index 60cb979b558431949a20fc83482b198a091c5efe..db2d114a52d8795265ca4d4348dfc695455e56f5 100755 --- a/gcc/configure +++ b/gcc/configure @@ -919,6 +919,7 @@ enable_rpath with_libiconv_prefix enable_sjlj_exceptions enable_secureplt +enable_mingw_wildcard enable_leading_mingw64_underscores enable_cld enable_frame_pointer @@ -1631,6 +1632,8 @@ Optional Features: --enable-sjlj-exceptions arrange to use setjmp/longjmp exception handling --enable-secureplt enable -msecure-plt by default for PowerPC + --enable-mingw-wildcard Set whether to expand wildcard on command-line. + Default to platform configuration --enable-leading-mingw64-underscores enable leading underscores on 64 bit mingw targets --enable-cld enable -mcld by default for 32bit x86 @@ -11944,6 +11947,21 @@ if test "${enable_secureplt+set}" = set; then : fi +# Check whether --enable-mingw-wildcard was given. +if test "${enable_mingw_wildcard+set}" = set; then : + enableval=$enable_mingw_wildcard; +else + enable_mingw_wildcard=platform +fi + +if test x"$enable_mingw_wildcard" != xplatform ; then : + +cat >>confdefs.h <<_ACEOF +#define MINGW_DOWILDCARD $(test x"$enable_mingw_wildcard" = xno; echo $?) +_ACEOF + +fi + # Check whether --enable-leading-mingw64-underscores was given. if test "${enable_leading_mingw64_underscores+set}" = set; then : enableval=$enable_leading_mingw64_underscores; @@ -18414,7 +18432,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18417 "configure" +#line 18435 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -18520,7 +18538,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18523 "configure" +#line 18541 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index b73a807ed14b5aafa51570a2449d9ac6e3c1f446..dde9c6b6f44053e4b8cfc1e62732318d9e1e3ab6 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1808,6 +1808,16 @@ AC_ARG_ENABLE(secureplt, [enable -msecure-plt by default for PowerPC])], [], []) +AC_ARG_ENABLE(mingw-wildcard, +[AS_HELP_STRING([--enable-mingw-wildcard], + [Set whether to expand wildcard on command-line. + Default to platform configuration])], +[],[enable_mingw_wildcard=platform]) +AS_IF([test x"$enable_mingw_wildcard" != xplatform ], + [AC_DEFINE_UNQUOTED(MINGW_DOWILDCARD, + $(test x"$enable_mingw_wildcard" = xno; echo $?), + [Value to set mingw's _dowildcard to.])]) + AC_ARG_ENABLE(leading-mingw64-underscores, AS_HELP_STRING([--enable-leading-mingw64-underscores], [enable leading underscores on 64 bit mingw targets]),