From patchwork Wed Jul 24 15:46:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chung-Ju Wu X-Patchwork-Id: 261438 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id CBF772C009A for ; Thu, 25 Jul 2013 01:46:58 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=j2N2Ag5Yvk2uyViX2 IGq3x33gSsUK6yge/4KkCXOx+XWC57S0sOCQ8pFxtw8qTvFjwo2jxO2OpGaWaVBB bQ5EQMqf6O5cHpoYXIwXIGzDS7exY+l6wlKt7v+X4AIg4Ah8rVxnF+Y/fKLXmphg jAokOfyRecCo3OB4P5E9enY5a8= 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=s9b5IELnK2voPDesDcEOyjp IsdY=; b=MdxKksl2WgaE7fnZ93UnaJIPj5bmbu9dSh0btxQ3CLJeYHmHcES20fW Zf9eK2btcS8ryvUPfrwBOriXmHhHYL+yt4S/KYnnjVMN65dJDbH8gx5b0vGHJ7kZ ZuvotQnli9BfWYrj+foU6+AUwprukqX0SLk7YJIn0JfszcrNbZmY= Received: (qmail 19117 invoked by alias); 24 Jul 2013 15:46:50 -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 19107 invoked by uid 89); 24 Jul 2013 15:46:50 -0000 X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_50, FREEMAIL_FROM, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RDNS_NONE, SPF_PASS, TW_UC autolearn=no version=3.3.1 Received: from Unknown (HELO mail-pa0-f41.google.com) (209.85.220.41) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 24 Jul 2013 15:46:47 +0000 Received: by mail-pa0-f41.google.com with SMTP id bj3so814989pad.0 for ; Wed, 24 Jul 2013 08:46:40 -0700 (PDT) X-Received: by 10.68.175.33 with SMTP id bx1mr14254095pbc.21.1374680800018; Wed, 24 Jul 2013 08:46:40 -0700 (PDT) Received: from Wu-Chung-Jude-MacBook-Air.local (123-194-206-10.dynamic.kbronet.com.tw. [123.194.206.10]) by mx.google.com with ESMTPSA id ib9sm48532050pbc.43.2013.07.24.08.46.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Jul 2013 08:46:39 -0700 (PDT) Message-ID: <51EFF6DA.5070905@gmail.com> Date: Wed, 24 Jul 2013 23:46:34 +0800 From: Chung-Ju Wu User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: "Joseph S. Myers" CC: gcc-patches Subject: Re: [PATCH 1/6] Andes nds32: configure settings for nds32 target. References: In-Reply-To: X-Virus-Found: No Hi, Joseph, Sorry for the late revised patch. We have completed all of it based on your review comments. On 7/10/13 6:56 AM, Joseph S. Myers wrote: > On Mon, 8 Jul 2013, Chung-Ju Wu wrote: > >> + nds32*-*-*) >> + supported_defaults="arch nds32_lib" >> + >> + # process --with-arch >> + # the 'with_arch' will be analyzed and then set its ISA and FLAGS > > I don't think this approach for processing --with-arch and setting > target_cpu_default in a complicated way based on it is a good idea. > > The normal handling of --with-arch is to generate a -march= option via > OPTION_DEFAULT_SPECS. If you do that, then the conversion from -march= > strings to sets of options enabled internally is done within the compiler > proper. > Now we handled --with-arch as you suggested. The OPTION_DEFAULT_SPECS is added in nds32.h and we enable/disable corresponding flags internally for -march= option in nds32.c. The option -march is further described in documentation. >> +nds32*-elf*) >> + # Basic makefile fragment and extra_parts for crt stuff. >> + tmake_file="${tmake_file} nds32/t-nds32" >> + extra_parts="crtbegin1.o crtend1.o" >> + # Append extra c-isr library according to --with-arch=X setting. > > Now, given that you add a -march= option, there's the possibility that > someone might do a build with multilibs for different -march= values. So > the choice here (libgcc configuration) needs to depend on the actual > configuration of the compiler for the multilib being built, probably via > configure tests in libgcc/configure.ac. > After discussing with other engineers, we decided to support c-isr library for all arch configuration so that we can avoid modifying libgcc/configure.ac. Thanks for the review comments. A revised patch is provided and here is a summary: 1. Handle -march option within the compiler proper. Simplify the handling of --with-arch in config.gcc. 2. The c-isr library is supported for all arch configuration. 3. Use tm_defines so that we can have only one t-mlibs used. contrib/ 2013-07-24 Chung-Ju Wu Shiva Chen * config-list.mk (nds32le-elf, nds32be-elf): Add nds32 target. gcc/ 2013-07-24 Chung-Ju Wu Shiva Chen * config.gcc (nds32*-*-*): Add nds32 target. libgcc/ 2013-07-24 Chung-Ju Wu Shiva Chen * config.host (nds32*-elf*): Add nds32 target. Best regards, jasonwucj diff --git contrib/config-list.mk contrib/config-list.mk index 9a141c2..08acc35 100644 --- contrib/config-list.mk +++ contrib/config-list.mk @@ -43,7 +43,9 @@ LIST = aarch64-elf aarch64-linux-gnu \ mipsisa64-elfoabi mipsisa64r2el-elf mipsisa64sr71k-elf mipsisa64sb1-elf \ mipsel-elf mips64-elf mips64vr-elf mips64orion-elf mips-rtems \ mips-wrs-vxworks mipstx39-elf mmix-knuth-mmixware mn10300-elf moxie-elf \ - moxie-uclinux moxie-rtems pdp11-aout picochip-elfOPT-enable-obsolete \ + moxie-uclinux moxie-rtems \ + nds32le-elf nds32be-elf \ + pdp11-aout picochip-elfOPT-enable-obsolete \ powerpc-darwin8 \ powerpc-darwin7 powerpc64-darwin powerpc-freebsd6 powerpc-netbsd \ powerpc-eabispe powerpc-eabisimaltivec powerpc-eabisim ppc-elf \ diff --git gcc/config.gcc gcc/config.gcc index 177677c..e941152 100644 --- gcc/config.gcc +++ gcc/config.gcc @@ -416,6 +416,10 @@ mips*-*-*) extra_headers="loongson.h" extra_options="${extra_options} g.opt mips/mips-tables.opt" ;; +nds32*) + cpu_type=nds32 + extra_headers="nds32_intrinsic.h" + ;; picochip-*-*) cpu_type=picochip ;; @@ -2037,6 +2041,18 @@ mn10300-*-*) use_collect2=no use_gcc_stdint=wrap ;; +nds32le-*-*) + target_cpu_default="0" + tm_defines="${tm_defines}" + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" + tmake_file="nds32/t-mlibs" + ;; +nds32be-*-*) + target_cpu_default="0|MASK_BIG_ENDIAN" + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" + tmake_file="nds32/t-mlibs" + ;; pdp11-*-*) tm_file="${tm_file} newlib-stdint.h" use_gcc_stdint=wrap @@ -3622,6 +3638,39 @@ case "${target}" in esac ;; + nds32*-*-*) + supported_defaults="arch nds32_lib" + + # process --with-arch + case "${with_arch}" in + "" | v2 | v3 | v3m) + # OK + ;; + *) + echo "Cannot accept --with-arch=$with_arch, available values are: v2 v3 v3m" 1>&2 + exit 1 + ;; + esac + + # process --with-nds32-lib + case "${with_nds32_lib}" in + "") + # the default library is newlib + with_nds32_lib=newlib + ;; + newlib) + # OK + ;; + mculib) + # OK + ;; + *) + echo "Cannot accept --with-nds32-lib=$with_nds32_lib, available values are: newlib mculib" 1>&2 + exit 1 + ;; + esac + ;; + powerpc*-*-* | rs6000-*-*) supported_defaults="cpu cpu_32 cpu_64 float tune tune_32 tune_64" diff --git libgcc/config.host libgcc/config.host index 9c47e1b..2bd2c1e 100644 --- libgcc/config.host +++ libgcc/config.host @@ -137,6 +137,9 @@ mips*-*-*) cpu_type=mips tmake_file=mips/t-mips ;; +nds32*-*) + cpu_type=nds32 + ;; powerpc*-*-*) cpu_type=rs6000 ;; @@ -832,6 +835,29 @@ moxie-*-rtems*) # Don't use default. extra_parts= ;; +nds32*-elf*) + # Basic makefile fragment and extra_parts for crt stuff. + # We also append c-isr library implementation. + tmake_file="${tmake_file} nds32/t-nds32 nds32/t-nds32-isr" + extra_parts="crtbegin1.o crtend1.o libnds32_isr.a" + # Append library definition makefile fragment according to --with-nds32-lib=X setting. + case "${with_nds32_lib}" in + "" | newlib) + # Append library definition makefile fragment t-nds32-newlib. + # Append 'soft-fp' software floating point make rule fragment provided by gcc. + tmake_file="${tmake_file} nds32/t-nds32-newlib t-softfp-sfdf t-softfp" + ;; + mculib) + # Append library definition makefile fragment t-nds32-mculib. + # The software floating point library is included in mculib. + tmake_file="${tmake_file} nds32/t-nds32-mculib" + ;; + *) + echo "Cannot accept --with-nds32-lib=$with_nds32_lib, available values are: newlib mculib" 1>&2 + exit 1 + ;; + esac + ;; pdp11-*-*) tmake_file="pdp11/t-pdp11 t-fdpbit" ;;