Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] core: fix setting of HOSTARCH
Date: Tue, 10 Nov 2015 22:48:36 +0100	[thread overview]
Message-ID: <56426634.3010306@mind.be> (raw)
In-Reply-To: <20151109221737.GD5162@free.fr>

On 09-11-15 23:17, Yann E. MORIN wrote:
> Arnout, All,
> 
> On 2015-11-09 23:01 +0100, Arnout Vandecappelle spake thusly:
>> On 09-11-15 20:00, Yann E. MORIN wrote:
>>> Currently, we set HOSTARCH to the output of `uname -m`. This gives us
>>> the architecture as seen by the running kernel. For example, we would
>>> end up with 'x86_64' for a 64-bit kernel running on an x86_64 processor.
> [--SNIP--]
>>> So, instead of relying on the output of `uname -r`, look for the host
>>> gcc and extract the target it was configured to generate code for.
> [--SNIP--]
>>> +export HOSTARCH := $(shell gcc -v 2>&1 | \
>>> +	sed -e '/^Target: \([^-]*\).*/!d' \
>>> +	    -e 's//\1/' \
>>> +	    -e 's/i.86/x86/' \
>>> +	    -e 's/sun4u/sparc64/' \
>>> +	    -e 's/arm.*/arm/' \
>>> +	    -e 's/sa110/arm/' \
>>> +	    -e 's/ppc64/powerpc64/' \
>>> +	    -e 's/ppc/powerpc/' \
>>> +	    -e 's/macppc/powerpc/' \
>>> +	    -e 's/sh.*/sh/' )
>>
>>  Since what we get here already are gcc tuples, the de-mangling shouldn't be
>> needed, right?
> 
> I am not sure either way. Note that I only constrained the check on how
> to retrieve the value, and expressely did not address the way we played
> with it, so as to follow the path of least surprise.
> 
> However, we still have to de-mangle i.86 into x86 because that what
> we're using everywhere. 

 Right, we'd have to change that.


> Also, we need to demangle arm.* into arm,
> because arm may have some trailing stuff (like armv6) which still means
> it's an arm. 

 Really? For the kernel arch (uname -m) that's true, but also for the gcc tuple?
But armeb is indeed possible.

> Ditto sh I guess. macppc I would guess (y the name of it)
> that we really don't care about. sa110: are we really expecting to run
> on that machine anyway?
> 
> We can further reduce the de-mangling in a later patch, however, it that
> makes sense...

 Of course. However, I'm not sure if it makes sense to copy the mangling for the
uname to the mangling of the gcc tuple...

 Regards,
 Arnout

> 
> Regards,
> Yann E. MORIN.
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

  reply	other threads:[~2015-11-10 21:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09 19:00 [Buildroot] [PATCH] core: fix setting of HOSTARCH Yann E. MORIN
2015-11-09 22:01 ` Arnout Vandecappelle
2015-11-09 22:17   ` Yann E. MORIN
2015-11-10 21:48     ` Arnout Vandecappelle [this message]
2015-11-11 22:53 ` Thomas Petazzoni
2015-11-11 22:58   ` Yann E. MORIN
2015-11-12  7:52     ` Peter Korsgaard
2015-11-12 17:35       ` Yann E. MORIN
2015-11-12  8:11   ` Peter Korsgaard
2015-11-12  8:28     ` Thomas Petazzoni
2015-11-12  8:49       ` Peter Korsgaard
2016-01-19 23:11 ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56426634.3010306@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox