From: "Alex Bennée" <alex.bennee@linaro.org>
To: Andrew Jones <drjones@redhat.com>
Cc: kvm@vger.kernel.org, pbonzini@redhat.com
Subject: Re: [PATCH kvm-unit-tests] configure: fix non-newlib cross-compiling
Date: Mon, 16 Jan 2017 16:19:27 +0000 [thread overview]
Message-ID: <8737gjugds.fsf@linaro.org> (raw)
In-Reply-To: <20170116160026.3ustzgabrr6bie6e@kamzik.brq.redhat.com>
Andrew Jones <drjones@redhat.com> writes:
> On Mon, Jan 16, 2017 at 03:22:00PM +0000, Alex Bennée wrote:
>>
>> Andrew Jones <drjones@redhat.com> writes:
>>
>> > Commit 529046c3 "libcflat: add PRI(dux)32 format types" applies a
>> > detection trick that requires native compiling or cross-compiling
>> > with newlib, an embedded system C standard library. We can avoid
>> > the new dependency with a different trick.
>> >
>> > Cc: Alex Bennée <alex.bennee@linaro.org>
>> > Signed-off-by: Andrew Jones <drjones@redhat.com>
>> > ---
>> > configure | 14 +++++---------
>> > 1 file changed, 5 insertions(+), 9 deletions(-)
>> >
>> > diff --git a/configure b/configure
>> > index 127868ce3090..3045dd129bda 100755
>> > --- a/configure
>> > +++ b/configure
>> > @@ -12,6 +12,7 @@ host=$arch
>> > cross_prefix=
>> > endian=""
>> > pretty_print_stacks=yes
>> > +u32_long=
>> >
>> > usage() {
>> > cat <<-EOF
>> > @@ -110,16 +111,11 @@ if [ -f $testdir/run ]; then
>> > fi
>> >
>> > # check if uint32_t needs a long format modifier
>> > -cat << EOF > lib_test.c
>> > -#include <inttypes.h>
>> > +cat << EOF > lib-test.c
>> > +__UINT32_TYPE__
>> > EOF
>> > -
>> > -$cross_prefix$cc lib_test.c -E | grep "typedef" | grep "long" | grep "uint32_t" &> /dev/null
>> > -exit=$?
>> > -if [ $exit -eq 0 ]; then
>> > - u32_long=true
>> > -fi
>> > -rm -f lib_test.c
>> > +u32_long=$($cross_prefix$cc -E lib-test.c | awk '! /^#/ && $2 == "long" {print "yes"}')
>> > +rm -f lib-test.c
>>
>> Hmm this fails on my system as the -E output is:
>>
>> 15:18 alex@overdrive01/aarch64 [kvm-unit-tests-32bit.git/review/drew-config@github] >arm-none-eabi-gcc -E test.c
>> # 1 "test.c"
>> # 1 "<built-in>"
>> # 1 "<command-line>"
>> # 1 "test.c"
>> long unsigned int
>>
>> Changing the line to:
>>
>> u32_long=$($cross_prefix$cc -E lib-test.c | awk '! /^#/ && $1 == "long" {print "yes"}')
>
> Let's change it to a couple simple greps then
>
> u32_long=$(gcc -E lib-test.c | grep -v '^#' | grep -q long && echo
> yes)
Sounds good to me.
>
>>
>> Fixes the detection for me but I wonder if there are other corner cases
>> to catch?
>
> Hope not, but I wouldn't be surprised. This type of detection is
> pretty fragile...
>
>>
>> The rest of the compile fails later due to un-merged format fixes for
>> pci_setup_msi which I guess is expected.
>
> Hmm, those are in master already. Did you apply this to a latest pull?
Yeah I applied to tip. I think Paolo only took part of the merge but
that's OK I'll re-submit what's left in my series after I've gone
through comments.
>
> Thanks for testing! I'll send a v2.
>
> drew
>
>>
>> >
>> > # check for dependent 32 bit libraries
>> > if [ "$arch" != "arm" ]; then
>>
>>
>> --
>> Alex Bennée
>> --
>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Alex Bennée
prev parent reply other threads:[~2017-01-16 16:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-16 13:21 [PATCH kvm-unit-tests] configure: fix non-newlib cross-compiling Andrew Jones
2017-01-16 15:22 ` Alex Bennée
2017-01-16 16:00 ` Andrew Jones
2017-01-16 16:19 ` Alex Bennée [this message]
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=8737gjugds.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.