diff options
author | Andy Lutomirski <luto@amacapital.net> | 2014-05-30 19:48:49 +0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-05-31 03:58:43 +0400 |
commit | add4eed0a2abea3951206f504330ee5daf8c178a (patch) | |
tree | 887492cf9d0f28135e9c353a5ceafe6d3e633247 /arch/x86/vdso/vdso2c.c | |
parent | 011561837dad082a92c0537db2d134e66419c6ad (diff) | |
download | linux-add4eed0a2abea3951206f504330ee5daf8c178a.tar.xz |
x86/vdso, build: Fix cross-compilation from big-endian architectures
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>
Link: http://lkml.kernel.org/r/2cf258df123cb24bad63c274c8563c050547d99d.1401464755.git.luto@amacapital.net
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/vdso/vdso2c.c')
-rw-r--r-- | arch/x86/vdso/vdso2c.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/x86/vdso/vdso2c.c b/arch/x86/vdso/vdso2c.c index fe8bfbf62612..de19ced6c87d 100644 --- a/arch/x86/vdso/vdso2c.c +++ b/arch/x86/vdso/vdso2c.c @@ -51,6 +51,21 @@ static void fail(const char *format, ...) va_end(ap); } +/* + * Evil macros to do a little-endian read. + */ +#define __GET_TYPE(x, type, bits, ifnot) \ + __builtin_choose_expr( \ + __builtin_types_compatible_p(typeof(x), type), \ + le##bits##toh((x)), ifnot) + +extern void bad_get(uint64_t); + +#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 NSYMS (sizeof(required_syms) / sizeof(required_syms[0])) #define BITS 64 |