From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25525 invoked by alias); 2 Apr 2012 14:27:59 -0000 Received: (qmail 25516 invoked by uid 22791); 2 Apr 2012 14:27:58 -0000 X-SWARE-Spam-Status: No, hits=-4.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-qa0-f54.google.com (HELO mail-qa0-f54.google.com) (209.85.216.54) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Apr 2012 14:27:45 +0000 Received: by qao25 with SMTP id 25so1715761qao.20 for ; Mon, 02 Apr 2012 07:27:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.106.83 with SMTP id w19mr3285412qco.97.1333376864481; Mon, 02 Apr 2012 07:27:44 -0700 (PDT) Received: by 10.229.89.137 with HTTP; Mon, 2 Apr 2012 07:27:44 -0700 (PDT) In-Reply-To: References: <455FBC37-ADBD-48E2-8D8E-6EB3C7198A29@codesourcery.com> Date: Mon, 02 Apr 2012 14:27:00 -0000 Message-ID: Subject: Re: [PATCH, i386, Android] -mandroid support for i386 target From: "H.J. Lu" To: Ilya Enkovich Cc: Maxim Kuvyrkov , gcc-patches , pavel.v.chupin@gmail.com, Jing Yu Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-04/txt/msg00043.txt.bz2 On Mon, Apr 2, 2012 at 7:16 AM, Ilya Enkovich wrot= e: >> On 2/04/2012, at 3:23 AM, Ilya Enkovich wrote: >> >>>> As is, it appears this patch did not see much testing, I'm pretty sure= it breaks building shared libraries and PIE executable for Linux. >>> >>> I do not expect any changes in compiler behavior for non Android >>> targets. I bootstrapped and checked patched compiler on linux-x86_64. >>> I also built ptched compiler for Android target using NDK scripts. >> >> OK. >> >>>> >>>> Here and in other instances below you use "GNU_USER_TARGET_" prefix. = =A0I would prefer using a shorter "GNU_USER_" instead unless there is a goo= d reason to add "TARGET" too. >>> >>> The reason is that some macroses are defined in other files and I just >>> redefine them (i.e. GNU_USER_TARGET_CC1_SPEC). This prefix is also >>> used for other targets (i.e. in linux-eabi.h). So I do not see a good >>> reason to change it everywhere or mix it with other prefix >>> "GNU_USER_". >> >> OK. >> >>>> Here you remove "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s". =A0P= resumably, you are moving that to GNU_USER[_TARGET]_ENDFILE_SPEC, but you n= ever define it. >>> >>> You are right. It is in GNU_USER_TARGET_ENDFILE_SPEC which is defined >>> in gcc/config/gnu-user.h. >> >> OK. =A0I missed that GNU_USER_TARGET_ENDFILE_SPEC was already defined. >> >>> >>>> >>>>> >>>>> /* A C statement (sans semicolon) to output to the stdio stream >>>>> =A0 =A0FILE the assembler definition of uninitialized global DECL nam= ed >>>>> 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 >>>> >>>> i386/linux.h is used only for simple x86 32-bit builds; i386/linux64.h= is used for multilib-enabled x86 toolchains. =A0Placing below definitions = in i386/linux.h will not allow adding an Android as an additional multilib = to -m32/-m64 x86 builds. =A0I improve on this situation I suggest: >>>> - rename i386/linux.h to i386/linux32.h (with corresponding change to = config.gcc), >>>> - put below definitions to new i386/linux.h (remember to add license n= otice header to the new file), >>>> - include i386/linux.h from both i386/linux32.h and i386/linux64.h. >>> >>> Android does not support x86_64 target and therefore I do not want >>> -mandroid support for this target. When Android supports x86_64 target >>> this change would be appropriate. >> >> The point is that one can build a toolchain for i686-linux-gnu that will= support both 32-bit and 64-bit multilibs. =A0The 32-bit multilib will be u= sed by default, and compilation for 64-bit user-space can be requested with= -m64 option. =A0Even though Android is not supported for -m64, such a tool= chain can support Android as a additional "-m32 -mandroid" multilib. =A0I.e= ., the toolchain will have three multilibs in total: "-m32" (default), "-m6= 4" and "-m32 -mandroid". =A0I386/linux64.h will be picked up for such a too= lchain, even though by default it would compile for 32-bit target. =A0Does = this clear up things? >> > > I think I see your point. And it seems to make all this work I'll also > have to rename i386/gnu-user.h into i386/gnu-user32.h and create > i386/gnu-user.h with common definitions to be included by > gnu-user[32|64].h. Otherwise I wont be able to use some definitions > (i.e. GNU_USER_TARGET_LINK_SPEC and GNU_USER_TARGET_MATHFILE_SPEC) in > linux64.h. Right? > I think it is a good idea. Thanks. --=20 H.J.