From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47159 invoked by alias); 20 Sep 2017 17:45:36 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 47090 invoked by uid 89); 20 Sep 2017 17:45:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 Sep 2017 17:45:31 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DEE656146C; Wed, 20 Sep 2017 17:45:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DEE656146C Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 418036062E; Wed, 20 Sep 2017 17:45:29 +0000 (UTC) Subject: Re: [RFC] Replicate src dir in build dir To: Yao Qi References: <1505832159-23038-1-git-send-email-yao.qi@linaro.org> <0aca31f3-4604-5630-baba-0584bb9d5c65@redhat.com> <86y3p99uy3.fsf@gmail.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <06499c43-88b6-06cd-b3d8-4964bbd3b58e@redhat.com> Date: Wed, 20 Sep 2017 17:45:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <86y3p99uy3.fsf@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-09/txt/msg00512.txt.bz2 On 09/20/2017 05:49 PM, Yao Qi wrote: > Pedro Alves writes: > >> We've had to touch these lists several times recently to add some object to >> a bunch of triplets. It'd be nice to move the common CPU-specific files to >> variables shared by the different OS triplets, so that we'd have simple places >> to edit them. Similar to srv_i386_linux_regobj etc. in >> gdbserver/configure.srv. > > This is about common CPU-specific files shared by different triplets. > This makes think a little bit further, how do we handle common > OS-specific files shared by different triplets? We can match triplet > CPU part and OS part respectively, and append the right objects to > gdb_target_obs, like this, > > i386_tobjs="i386-tdep.o i386.o i387-tdep.o" > amd64_tobjs="amd64-tdep.o arch/amd64.o" > gdb_target_obs="" > > # Fill in gdb_target_obs according to CPU. > > case "${targ}" in > aarch64*-*-*) > gdb_target_obs="aarch64-tdep.o aarch64-insn.o ${gdb_target_obs}";; > arm*-*-*) > gdb_target_obs="arm.o arm-get-next-pcs.o arm-tdep.o ${gdb_target_obs}";; > i[34567]86-*-*) > gdb_target_obs="${i386_tobjs} ${gdb_target_obs}";; > if test "x$enable_64_bit_bfd" = "xyes"; then > gdb_target_obs="${amd64_tobjs} ${gdb_target_obs}" > fi > sparc-*-*) > gdb_target_obs="sparc-tdep.o ravenscar-thread.o sparc-ravenscar-thread.o ${gdb_target_obs}";; > > sparc64-*-*) > gdb_target_obs="sparc-tdep.o sparc64-tdep.o ravenscar-thread.o sparc-ravenscar-thread.o ${gdb_target_obs}";; > > x86_64-*-*) > gdb_target_obs="${i386_tobjs} ${amd64_tobjs} ${gdb_target_obs}";; > esac > > # Fill in gdb_target_obs according to OS. > > case "${targ}" in > *-*-freebsd*) > gdb_target_obs="fbsd-tdep.o solib-svr4.o ${gdb_target_obs}";; > *-*-netbsd*) > gdb_target_obs="nbsd-tdep.o solib-svr4.o ${gdb_target_obs}";; > *-*-openbsd*) > gdb_target_obs="obsd-tdep.o solib-svr4.o ${gdb_target_obs}";; > esac > > # Fill in the rest according to the triplet. > ... > > What do you think? Yes, that works for me too. Meeting in the middle, using separate variables for arch and OS objects would allow getting rid of the need for spelling out gdb_target_obs twice per line, like: case "${targ}" in aarch64*-*-*) cpu_obs="aarch64-tdep.o aarch64-insn.o";; arm*-*-*) cpu_obs="arm.o arm-get-next-pcs.o arm-tdep.o";; esac case "${targ}" in *-*-freebsd*) os_obs="fbsd-tdep.o solib-svr4.o";; *-*-netbsd*) os_obs="nbsd-tdep.o solib-svr4.o";; *-*-openbsd*) os_obs="obsd-tdep.o solib-svr4.o";; esac gdb_target_obs="${cpu_obs} ${os_obs}" Thanks, Pedro Alves