From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/3113 Path: news.gmane.org!not-for-mail From: Zvi Gilboa Newsgroups: gmane.linux.lib.musl.general Subject: Re: Request for ideas on arch-specific musl-gcc specfile additions Date: Mon, 15 Apr 2013 01:35:33 -0400 Message-ID: <516B91A5.5090300@eservices.virginia.edu> References: <20130415013154.GA7440@brightrain.aerifal.cx> <516B82A6.2020800@eservices.virginia.edu> <20130415044913.GU20323@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------040906040509060309080507" X-Trace: ger.gmane.org 1366004144 24586 80.91.229.3 (15 Apr 2013 05:35:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Apr 2013 05:35:44 +0000 (UTC) To: Original-X-From: musl-return-3117-gllmg-musl=m.gmane.org@lists.openwall.com Mon Apr 15 07:35:48 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1URc4y-0000dR-Gl for gllmg-musl@plane.gmane.org; Mon, 15 Apr 2013 07:35:48 +0200 Original-Received: (qmail 12014 invoked by uid 550); 15 Apr 2013 05:35:46 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 12006 invoked from network); 15 Apr 2013 05:35:46 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 In-Reply-To: <20130415044913.GU20323@brightrain.aerifal.cx> X-Originating-IP: [172.25.251.153] Xref: news.gmane.org gmane.linux.lib.musl.general:3113 Archived-At: --------------040906040509060309080507 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit On 04/15/2013 12:49 AM, Rich Felker wrote: > On Mon, Apr 15, 2013 at 12:31:34AM -0400, Zvi Gilboa wrote: >> 2) add arch-specific variables in the relevant places and set them >> from outside, possibly by executing musl-gcc.specs.sh from within an >> arch-specific shell script. For instance: >> >> *cpp_options: >> $ARCH_SPECIFIC_CFLAGS -nostdinc -isystem $incdir %(old_cpp_options) > Hmm, I had forgotten it was a shell script and not just a sed script > or something doing the replacements. So we could just put something > like: > > $(case "$ARCH" in > mips*) echo "mips stuff here" ;; > powerpc*) echo "ppc stuff here" ;; > easc) > > Does that work? Might have to add $ARCH to the args to the script, but > otherwise it seems ok. > > Rich I am not sure whether /echo/ will be the cleanest way, especially if customization is needed in multiple places. Here is something that I just tested and seems to work: *[musl-gcc.specs.sh*] ... ... ARCH=$4* *... ... case "$ARCH" in x86_64*) CC1_ARCH_SPECIFIC_CFLAGS="x86_64-something-for-cc1" ;; powerpc*) CC1_ARCH_SPECIFIC_CFLAGS="powerpc-something-for-cc1" ;; esac ... ... *cc1: *$CC1_ARCH_SPECIFIC_CFLAGS* %(cc1_cpu) -nostdinc -isystem $incdir *[Makefile**] *... ... lib/musl-gcc.specs: tools/musl-gcc.specs.sh config.mak sh $< "$(includedir)" "$(libdir)" "$(LDSO_PATHNAME)" *"$(ARCH)"* > $@ --------------040906040509060309080507 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit
On 04/15/2013 12:49 AM, Rich Felker wrote:
On Mon, Apr 15, 2013 at 12:31:34AM -0400, Zvi Gilboa wrote:
2) add arch-specific variables in the relevant places and set them
from outside, possibly by executing musl-gcc.specs.sh from within an
arch-specific shell script.  For instance:

*cpp_options:
$ARCH_SPECIFIC_CFLAGS -nostdinc -isystem $incdir %(old_cpp_options)
Hmm, I had forgotten it was a shell script and not just a sed script
or something doing the replacements. So we could just put something
like:

$(case "$ARCH" in
mips*) echo "mips stuff here" ;;
powerpc*) echo "ppc stuff here" ;;
easc)

Does that work? Might have to add $ARCH to the args to the script, but
otherwise it seems ok.

Rich

I am not sure whether echo will be the cleanest way, especially if customization is needed in multiple places.  Here is something that I just tested and seems to work:

[musl-gcc.specs.sh]
...
...
ARCH=$4
...
...
case "$ARCH" in
        x86_64*)    CC1_ARCH_SPECIFIC_CFLAGS="x86_64-something-for-cc1" ;;
        powerpc*) CC1_ARCH_SPECIFIC_CFLAGS="powerpc-something-for-cc1" ;;
esac
...
...
*cc1:
$CC1_ARCH_SPECIFIC_CFLAGS %(cc1_cpu) -nostdinc -isystem $incdir


[Makefile]
...
...
lib/musl-gcc.specs: tools/musl-gcc.specs.sh config.mak
        sh $< "$(includedir)" "$(libdir)" "$(LDSO_PATHNAME)" "$(ARCH)" > $@

--------------040906040509060309080507--