From patchwork Fri Feb 24 15:17:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 142926 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 BE33EB6FE4 for ; Sat, 25 Feb 2012 02:18:25 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1330701507; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Received-SPF:Received:MIME-Version:Received:Received:In-Reply-To: References:Date:Message-ID:Subject:From:To:Cc:Content-Type: Content-Transfer-Encoding:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=7rV7ehjHJlkju8VtlSqazm17lEI=; b=xz4h8cozMxvIpkn /A6QL3Dn34rtk5QXFhm0XlQ6Stk6Y8K7xqB9KGTdvz+MBT5fOzZfQbFlUY+RwaQx VHRpu/YpbtZPAHe14j9H5kh/pFqQrtPIoZMWlVOKcCpOuBKKqVjdKuVzWBYs2JN6 4ECUdxYM0BxMXxYM0rdcw5FUG6Eg= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received-SPF:Authentication-Results:Received:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type:Content-Transfer-Encoding:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=qqvqvh2BOc42QV+ly2QiH4byLvdRoOKfOoZGjxcT65WIkGP1M2FrvgxaoaWZpG afgIAeO0MxW8lcbojzVGkWKej4oDuulmbMASyXUSaobEeBc2swcAZGrHCI3kg3kO idm9lGpsCa4QQke/dWG1mr4rPjl/aqWff+XGqK3VJGitE=; Received: (qmail 12542 invoked by alias); 24 Feb 2012 15:18:16 -0000 Received: (qmail 12528 invoked by uid 22791); 24 Feb 2012 15:18:14 -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 X-Spam-Check-By: sourceware.org Received: from mail-pw0-f47.google.com (HELO mail-pw0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 24 Feb 2012 15:18:00 +0000 Received: by pbbrp12 with SMTP id rp12so790635pbb.20 for ; Fri, 24 Feb 2012 07:18:00 -0800 (PST) Received-SPF: pass (google.com: domain of enkovich.gnu@gmail.com designates 10.68.219.198 as permitted sender) client-ip=10.68.219.198; Authentication-Results: mr.google.com; spf=pass (google.com: domain of enkovich.gnu@gmail.com designates 10.68.219.198 as permitted sender) smtp.mail=enkovich.gnu@gmail.com; dkim=pass header.i=enkovich.gnu@gmail.com Received: from mr.google.com ([10.68.219.198]) by 10.68.219.198 with SMTP id pq6mr8723288pbc.89.1330096680271 (num_hops = 1); Fri, 24 Feb 2012 07:18:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.219.198 with SMTP id pq6mr7334474pbc.89.1330096680115; Fri, 24 Feb 2012 07:18:00 -0800 (PST) Received: by 10.68.56.234 with HTTP; Fri, 24 Feb 2012 07:17:59 -0800 (PST) In-Reply-To: References: Date: Fri, 24 Feb 2012 19:17:59 +0400 Message-ID: Subject: Re: [PATCH, i386, Android] -mandroid support for i386 target From: Ilya Enkovich To: "H.J. Lu" Cc: gcc-patches , pavel.v.chupin@gmail.com, Jing Yu 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 Wed, Feb 22, 2012 at 6:54 AM, Ilya Enkovich wrote: >> Hello, >> >> This patch adds -mandroid support to i386 target. OK for trunk? >> >> Thanks, >> Ilya >> -- >> >> 2012-02-22  Enkovich Ilya   >> >>        * config/i386/gnu-user.h (LINUX_TARGET_CC1_SPEC): New. > > I don't think you should define LINUX_* in gnu-user.h. > >>        (CC1_SPEC): Use LINUX_OR_ANDROID_CC. >>        (CC1PLUS_SPEC): Likewise. >>        (LINUX_TARGET_LINK_SPEC): New. >>        (LINK_SPEC): Support LINUX_OR_ANDROID_LD. >>        (LIB_SPEC): New. >>        (STARTFILE_SPEC): New. >>        (LINUX_TARGET_ENDFILE_SPEC): New. >>        (ENDFILE_SPEC): Support LINUX_OR_ANDROID_LD. > > There is a feedback at > > http://gcc.gnu.org/ml/gcc-patches/2011-12/msg01283.html > > to my earlier patch to define GNU_USER_TARGET_* in gnu-user.h > and use them in linux.h. > Thanks for the link. I fixed patch according to this feedback. >>        * config/linux-android.h (ANDROID_STARTFILE_SPEC): Use >>        crtbegin_so%O%s for -shared. >>        (ANDROID_ENDFILE_SPEC): Use crtend_so%O%s for -shared. >> >> > > I think you should separate this part similar to > > http://gcc.gnu.org/ml/gcc-patches/2011-12/msg01109.html I removed this part from the patch. > > > -- > H.J. Here is a new patch version. Does it look better? Thanks, Ilya --- 2012-02-24 Enkovich Ilya * gcc/config/i386/gnu-user.h (CC1_SPEC): Rename to ... (GNU_USER_TARGET_CC1_SPEC): ... this. (LINK_SPEC): Rename to ... (GNU_USER_TARGET_LINK_SPEC): ... this. (ENDFILE_SPEC): Delete. (GNU_USER_TARGET_MATHFILE_SPEC): New. * gcc/config/i386/linux.h (CC1_SPEC): New. (LINK_SPEC): New. (LIB_SPEC): New. (STARTFILE_SPEC): New. (ENDFILE_SPEC): New. diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h index 98d0a25..59d7062 100644 --- a/gcc/config/i386/gnu-user.h +++ b/gcc/config/i386/gnu-user.h @@ -77,8 +77,8 @@ along with GCC; see the file COPYING3. If not see #undef CPP_SPEC #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" -#undef CC1_SPEC -#define CC1_SPEC "%(cc1_cpu) %{profile:-p}" +#undef GNU_USER_TARGET_CC1_SPEC +#define GNU_USER_TARGET_CC1_SPEC "%(cc1_cpu) %{profile:-p}" /* Provide a LINK_SPEC appropriate for GNU userspace. Here we provide support for the special GCC options -static and -shared, which allow us to @@ -97,8 +97,8 @@ along with GCC; see the file COPYING3. If not see { "link_emulation", GNU_USER_LINK_EMULATION },\ { "dynamic_linker", GNU_USER_DYNAMIC_LINKER } -#undef LINK_SPEC -#define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \ +#define GNU_USER_TARGET_LINK_SPEC \ + "-m %(link_emulation) %{shared:-shared} \ %{!shared: \ %{!static: \ %{rdynamic:-export-dynamic} \ @@ -106,13 +106,11 @@ along with GCC; see the file COPYING3. If not see %{static:-static}}" /* Similar to standard GNU userspace, but adding -ffast-math support. */ -#undef ENDFILE_SPEC -#define ENDFILE_SPEC \ +#define GNU_USER_TARGET_MATHFILE_SPEC \ "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ %{mpc32:crtprec32.o%s} \ %{mpc64:crtprec64.o%s} \ - %{mpc80:crtprec80.o%s} \ - %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" + %{mpc80:crtprec80.o%s}" /* A C statement (sans semicolon) to output to the stdio stream FILE the assembler definition of uninitialized global DECL named diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h index 73681fe..a832ddc 100644 --- a/gcc/config/i386/linux.h +++ b/gcc/config/i386/linux.h @@ -22,3 +22,30 @@ along with GCC; see the file COPYING3. If not see #define GNU_USER_LINK_EMULATION "elf_i386" #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + +#undef CC1_SPEC +#define CC1_SPEC \ + LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \ + GNU_USER_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC) + +#undef LINK_SPEC +#define LINK_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \ + GNU_USER_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC) + +#undef LIB_SPEC +#define LIB_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \ + GNU_USER_TARGET_LIB_SPEC " " ANDROID_LIB_SPEC) + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, \ + ANDROID_STARTFILE_SPEC) + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_MATHFILE_SPEC " " \ + GNU_USER_TARGET_ENDFILE_SPEC, \ + GNU_USER_TARGET_MATHFILE_SPEC " " \ + ANDROID_ENDFILE_SPEC)