From: "H. Peter Anvin" <hpa@zytor.com>
To: Andy Lutomirski <luto@amacapital.net>,
Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Josh Boyer <jwboyer@fedoraproject.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"linux-tip-commits@vger.kernel.org"
<linux-tip-commits@vger.kernel.org>,
"linux-next@vger.kernel.org" <linux-next@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] x86,vdso: Fix cross-compilation from big-endian architectures
Date: Fri, 30 May 2014 13:02:55 -0700 [thread overview]
Message-ID: <5388E3EF.6030700@zytor.com> (raw)
In-Reply-To: <2cf258df123cb24bad63c274c8563c050547d99d.1401464755.git.luto@amacapital.net>
On 05/30/2014 08:48 AM, Andy Lutomirski wrote:
> This adds a macro GET(x) to convert x from big-endian to
> little-endian. Hopefully I put it everywhere it needs to go and got
> all the cases needed for everyone's linux/elf.h.
>
> Signed-off-by: Andy Lutomirski <luto@amacapital.net>
> ---
> arch/x86/vdso/vdso2c.c | 15 ++++++++++++
> arch/x86/vdso/vdso2c.h | 63 ++++++++++++++++++++++++++++----------------------
> 2 files changed, 50 insertions(+), 28 deletions(-)
A couple of observations:
1. We shouldn't use double-underscore in host C code.
2. It would be nice if we can take these sort of things (host-build
helper macros) and move them to some common file in the Linux kernel
eventually, so it would be a good thing to make the naming a little
less general.
3. Even though it isn't necessary, making it work on 8-bit values so
one doesn't have to worry about the type would seem like a good
thing.
I came up with the following, it seems like a reasonable simplification:
> #define _LE(x, bits, ifnot) \
> __builtin_choose_expr( \
> (sizeof(x) == bits/8), \
> (__typeof__(x))le##bits##toh(x), ifnot)
>
> extern void bad_le(uint64_t);
> #define _LAST_LE(x) \
> __builtin_choose_expr(sizeof(x) == 1, (x), bad_le(x))
>
> #define LE(x) \
> _LE(x, 64, _LE(x, 32, _LE(x, 16, _LAST_LE(x))))
What do you think?
-hpa
next prev parent reply other threads:[~2014-05-30 20:03 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-05 19:19 [PATCH v5 0/7] Clean up and unify the vDSO Andy Lutomirski
2014-05-05 19:19 ` [PATCH v5 1/7] x86,mm: Ensure correct alignment of the fixmap Andy Lutomirski
2014-05-05 22:24 ` [tip:x86/vdso] x86, mm: " tip-bot for Andy Lutomirski
2014-05-05 19:19 ` [PATCH v5 2/7] x86: Clean up 32-bit vs 64-bit vdso params Andy Lutomirski
2014-05-05 22:24 ` [tip:x86/vdso] x86, vdso: " tip-bot for Andy Lutomirski
2014-05-05 19:19 ` [PATCH v5 3/7] x86: Move syscall and sysenter setup into kernel/cpu/common.c Andy Lutomirski
2014-05-05 22:24 ` [tip:x86/vdso] x86, vdso: " tip-bot for Andy Lutomirski
2014-05-05 19:19 ` [PATCH v5 4/7] x86: Reimplement vdso.so preparation in build-time C Andy Lutomirski
2014-05-05 22:25 ` [tip:x86/vdso] x86, vdso: " tip-bot for Andy Lutomirski
2014-05-29 19:17 ` Paul Gortmaker
2014-05-29 19:32 ` Andy Lutomirski
2014-05-29 19:43 ` H. Peter Anvin
2014-05-29 19:46 ` Andy Lutomirski
2014-05-29 21:57 ` [PATCH 0/2] x86,vdso: vdso build fixes and improvements Andy Lutomirski
2014-05-29 21:57 ` [PATCH 1/2] x86,vdso: When vdso2c fails, unlink the output Andy Lutomirski
2014-05-29 21:57 ` [PATCH 2/2] x86,vdso: Fix cross-compilation from big-endian architectures Andy Lutomirski
2014-05-29 22:41 ` [PATCH 0/2] x86,vdso: vdso build fixes and improvements Paul Gortmaker
2014-05-29 22:49 ` Andy Lutomirski
2014-05-30 5:42 ` Stephen Rothwell
2014-05-30 15:40 ` Andy Lutomirski
2014-05-30 15:48 ` [PATCH v2 " Andy Lutomirski
2014-05-30 15:48 ` [PATCH v2 1/2] x86,vdso: When vdso2c fails, unlink the output Andy Lutomirski
2014-05-31 3:09 ` [tip:x86/vdso] x86/vdso, build: " tip-bot for Andy Lutomirski
2014-05-30 15:48 ` [PATCH v2 2/2] x86,vdso: Fix cross-compilation from big-endian architectures Andy Lutomirski
2014-05-30 20:02 ` H. Peter Anvin [this message]
2014-05-30 20:09 ` Andy Lutomirski
2014-05-30 20:21 ` H. Peter Anvin
2014-05-30 20:34 ` Andy Lutomirski
2014-05-31 0:14 ` H. Peter Anvin
2014-05-31 3:09 ` [tip:x86/vdso] x86/vdso, build: " tip-bot for Andy Lutomirski
2014-05-31 3:10 ` [tip:x86/vdso] x86/vdso, build: Make LE access macros clearer, host-safe tip-bot for H. Peter Anvin
2014-05-31 10:40 ` tip-bot for H. Peter Anvin
2014-05-29 19:43 ` [tip:x86/vdso] x86, vdso: Reimplement vdso.so preparation in build-time C Josh Boyer
2014-05-05 19:19 ` [PATCH v5 5/7] x86: Move the 32-bit vdso special pages after the text Andy Lutomirski
2014-05-05 22:25 ` [tip:x86/vdso] x86, vdso: " tip-bot for Andy Lutomirski
2014-05-05 19:19 ` [PATCH v5 6/7] x86: Move the vvar and hpet mappings next to the 64-bit vDSO Andy Lutomirski
2014-05-05 22:25 ` [tip:x86/vdso] x86, vdso: " tip-bot for Andy Lutomirski
2014-05-05 19:19 ` [PATCH v5 7/7] x86: Remove vestiges of VDSO_PRELINK and some outdated comments Andy Lutomirski
2014-05-05 22:25 ` [tip:x86/vdso] x86, vdso: " tip-bot for Andy Lutomirski
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=5388E3EF.6030700@zytor.com \
--to=hpa@zytor.com \
--cc=jwboyer@fedoraproject.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=paul.gortmaker@windriver.com \
--cc=tglx@linutronix.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 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.