linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>,
	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:21:14 -0700	[thread overview]
Message-ID: <5388E83A.5000500@zytor.com> (raw)
In-Reply-To: <CALCETrVvR3SaYX7jvoX_q7m=HSzt1xvrDurrOpm2XT5SG3JVqw@mail.gmail.com>

On 05/30/2014 01:09 PM, Andy Lutomirski wrote:
>>
>> 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)
> 
> This will do awful things if x is a floating-point type, and, for
> integers, the cast is probably unnecessary.  But it should be okay.
> 

I mostly wanted to preserve the signedness.  Yes, if we care about
floating-point it gets trickier.

At some point hopefully there will be a native C feature to handle this
crap.

>>> extern void bad_le(uint64_t);
> 
> If this ever goes in a common header, then we should do the
> __attribute__((error)) thing.  I wonder if it would ever make sense to
> have __LINUX_HOSTPROG__ and make some of the basic headers work.  Hmm.
> 
>>> #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?
> 
> My only real real objection is that _LE sounds like converting *to*
> little-endian to me.  Admittedly, that's the same thing on any
> remotely sane architecture, but still.

GET_LE() then?

	-hpa



  reply	other threads:[~2014-05-30 20:21 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
2014-05-30 20:09                   ` Andy Lutomirski
2014-05-30 20:21                     ` H. Peter Anvin [this message]
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=5388E83A.5000500@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 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 NNTP newsgroup(s).