From patchwork Tue Jun 7 21:39:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 99333 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]) by ozlabs.org (Postfix) with SMTP id 969B7B6F76 for ; Wed, 8 Jun 2011 07:39:44 +1000 (EST) Received: (qmail 30573 invoked by alias); 7 Jun 2011 21:39:42 -0000 Received: (qmail 30562 invoked by uid 22791); 7 Jun 2011 21:39:42 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-qy0-f182.google.com (HELO mail-qy0-f182.google.com) (209.85.216.182) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 07 Jun 2011 21:39:28 +0000 Received: by qyk27 with SMTP id 27so2841555qyk.20 for ; Tue, 07 Jun 2011 14:39:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.17.148 with SMTP id s20mr4981015qca.149.1307482767485; Tue, 07 Jun 2011 14:39:27 -0700 (PDT) Received: by 10.229.47.78 with HTTP; Tue, 7 Jun 2011 14:39:27 -0700 (PDT) In-Reply-To: References: <20110605195441.GA1225@intel.com> Date: Tue, 7 Jun 2011 14:39:27 -0700 Message-ID: Subject: Re: PATCH [1/n]: Add initial -x32 support From: "H.J. Lu" To: "Joseph S. Myers" Cc: gcc-patches@gcc.gnu.org, Uros Bizjak X-IsSubscribed: yes 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 On Tue, Jun 7, 2011 at 12:17 PM, Joseph S. Myers wrote: > On Tue, 7 Jun 2011, H.J. Lu wrote: > >> That is -mx32 takes the same default as -m64. It is the correct >> behavior for -mx32. > > I think it's only right in the case where -m64 is the default, and the > specs for the case where -m32 is the default need changing to handle -mx32 > properly. > I checked this patch into x32 branch. Thanks. diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32 index 5655c61..38d63d8 100644 --- a/gcc/ChangeLog.x32 +++ b/gcc/ChangeLog.x32 @@ -1,5 +1,16 @@ 2011-06-07 H.J. Lu + * config/i386/gnu-user64.h (SPEC_64): Support x32. + (SPEC_32): Likewise. + (SPEC_X32): New. + (ASM_SPEC): Use SPEC_X32. + (LINK_SPEC): Likewise. + + * config/i386/i386.h (OPT_ARCH64): Support x32. + (OPT_ARCH32): Likewise. + +2011-06-07 H.J. Lu + * doc/invoke.texi: Use @option{} on -mx32, -m64 and -mx32. 2011-06-07 H.J. Lu diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h index b99fb13..bb4b8da 100644 --- a/gcc/config/i386/gnu-user64.h +++ b/gcc/config/i386/gnu-user64.h @@ -58,15 +58,18 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #if TARGET_64BIT_DEFAULT #define SPEC_32 "m32" -#define SPEC_64 "!m32" +#define SPEC_64 "m32|mx32:;" +#define SPEC_X32 "mx32" #else -#define SPEC_32 "!m64" +#define SPEC_32 "m64|mx32:;" #define SPEC_64 "m64" +#define SPEC_X32 "mx32" #endif #undef ASM_SPEC -#define ASM_SPEC "%{" SPEC_32 ":%{!mx32:--32}} %{" \ - SPEC_64 ":%{!mx32:--64}} %{mx32:--x32} \ +#define ASM_SPEC "%{" SPEC_32 ":--32} \ + %{" SPEC_64 ":--64} \ + %{" SPEC_X32 ":--x32} \ %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}" #undef LINK_SPEC @@ -76,9 +79,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see %{!shared: \ %{!static: \ %{rdynamic:-export-dynamic} \ - %{" SPEC_32 ":%{!mx32:-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \ - %{" SPEC_64 ":%{!mx32:-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}} \ - %{mx32:-dynamic-linker " GNU_USER_DYNAMIC_LINKERX32 "}} \ + %{" SPEC_32 ":-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "} \ + %{" SPEC_64 ":-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \ + %{" SPEC_X32 ":-dynamic-linker " GNU_USER_DYNAMIC_LINKERX32 "}} \ %{static:-static}}" /* Similar to standard GNU userspace, but adding -ffast-math support. */ diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index f9270de..ec86e74 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -519,8 +519,8 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); #define OPT_ARCH64 "!m32" #define OPT_ARCH32 "m32" #else -#define OPT_ARCH64 "m64" -#define OPT_ARCH32 "!m64" +#define OPT_ARCH64 "m64|mx32" +#define OPT_ARCH32 "m64|mx32:;" #endif