diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2014-05-30 17:03:22 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-05-31 03:35:27 -0700 |
commit | c191920f737a09a7252088f018f6747f0d2f484d (patch) | |
tree | c1890e936c9d6d6e6b04d9f74a49c3ec25c70deb /arch/x86/vdso/vdso2c.c | |
parent | add4eed0a2abea3951206f504330ee5daf8c178a (diff) | |
download | blackbird-op-linux-c191920f737a09a7252088f018f6747f0d2f484d.tar.gz blackbird-op-linux-c191920f737a09a7252088f018f6747f0d2f484d.zip |
x86/vdso, build: Make LE access macros clearer, host-safe
Make it a little clearer what the littleendian access macros in
vdso2c.[ch] actually do. This way they can probably also be moved to
a central location (e.g. tools/include) for the benefit of other host
tools.
We should avoid implementation namespace symbols when writing code
that is compiling for the compiler host, so avoid names starting with
double underscore or underscore-capital.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Link: http://lkml.kernel.org/r/2cf258df123cb24bad63c274c8563c050547d99d.1401464755.git.luto@amacapital.net
Diffstat (limited to 'arch/x86/vdso/vdso2c.c')
-rw-r--r-- | arch/x86/vdso/vdso2c.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/x86/vdso/vdso2c.c b/arch/x86/vdso/vdso2c.c index de19ced6c87d..deabaf5bfb89 100644 --- a/arch/x86/vdso/vdso2c.c +++ b/arch/x86/vdso/vdso2c.c @@ -54,17 +54,17 @@ static void fail(const char *format, ...) /* * Evil macros to do a little-endian read. */ -#define __GET_TYPE(x, type, bits, ifnot) \ +#define GLE(x, bits, ifnot) \ __builtin_choose_expr( \ - __builtin_types_compatible_p(typeof(x), type), \ - le##bits##toh((x)), ifnot) + (sizeof(x) == bits/8), \ + (__typeof__(x))le##bits##toh(x), ifnot) -extern void bad_get(uint64_t); +extern void bad_get_le(uint64_t); +#define LAST_LE(x) \ + __builtin_choose_expr(sizeof(x) == 1, (x), bad_get_le(x)) -#define GET(x) \ - __GET_TYPE((x), __u32, 32, __GET_TYPE((x), __u64, 64, \ - __GET_TYPE((x), __s32, 32, __GET_TYPE((x), __s64, 64, \ - __GET_TYPE((x), __u16, 16, bad_get(x)))))) +#define GET_LE(x) \ + GLE(x, 64, GLE(x, 32, GLE(x, 16, LAST_LE(x)))) #define NSYMS (sizeof(required_syms) / sizeof(required_syms[0])) |