From: Michael Matz <matz@suse.de>
To: Tom de Vries <tdevries@suse.de>
Cc: Mark Wielaard <mark@klomp.org>, dwz@sourceware.org, jakub@redhat.com
Subject: Re: [PATCH] Add -p native and -e native
Date: Mon, 12 Apr 2021 12:33:49 +0000 (UTC) [thread overview]
Message-ID: <alpine.LSU.2.20.2104121219340.30721@wotan.suse.de> (raw)
In-Reply-To: <47b99234-cfe3-86e3-b359-d3ee480e1399@suse.de>
Hello,
On Fri, 9 Apr 2021, Tom de Vries wrote:
> >> Except for this narrow multilib case, doesn't this actually make it
> >> impossible to do a cross-arch build?
> >
> > For cross the term "native" doesn't make sense, so it would seem valid to
> > simply not support that setting with a cross (not multilib) dwz. I.e. if
> > ./native can't be executed assume cross-ness and don't support -p native.
>
> I've tried yet another variant. Instead of trying to generate an
> executable and execute it, we generate an object and test properties
> using readelf.
>
> This should no longer have the cross-build problem.
>
> WDYT?
I think using readelf should work here. But the patch has problems:
+#if NATIVE_ENDIAN == little
+#define NATIVE_ENDIAN_VAL __ORDER_LITTLE_ENDIAN__
+#elif NATIVE_ENDIAN == big
+#define NATIVE_ENDIAN_VAL __ORDER_LITTLE_ENDIAN__
+#else
+#define NATIVE_ENDIAN not available
+#define NATIVE_ENDIAN_VAL 0
+#endif
The preprocessor works different than you seem to assume. Unknown tokens
are replaced with 0, so what you've written is the same as:
+#if NATIVE_ENDIAN == 0
+#define NATIVE_ENDIAN_VAL __ORDER_LITTLE_ENDIAN__
+#elif NATIVE_ENDIAN == 0
(except if you have defined 'little' and 'big' somewhere, but I can't see
that?) Also __ORDER_LITTLE_ENDIAN__ is defined by GCC since 4.6, you
might want to check defined-ness of it before using it. And you're
setting NATIVE_ENDIAN_VAL to little endian in both if arms.
Ciao,
Michael.
next prev parent reply other threads:[~2021-04-12 12:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-09 9:24 Tom de Vries
2021-04-09 9:42 ` Mark Wielaard
2021-04-09 12:48 ` Tom de Vries
2021-04-09 13:03 ` Michael Matz
2021-04-09 15:58 ` Tom de Vries
2021-04-12 12:33 ` Michael Matz [this message]
2021-04-12 15:11 ` Tom de Vries
2021-04-12 19:53 ` [committed] " Tom de Vries
2021-04-12 20:14 ` [PATCH] " Mark Wielaard
2021-04-13 7:45 ` Tom de Vries
2021-04-13 8:33 ` Tom de Vries
2021-04-13 10:04 ` Mark Wielaard
2021-04-13 11:15 ` Tom de Vries
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=alpine.LSU.2.20.2104121219340.30721@wotan.suse.de \
--to=matz@suse.de \
--cc=dwz@sourceware.org \
--cc=jakub@redhat.com \
--cc=mark@klomp.org \
--cc=tdevries@suse.de \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).