Re: [PATCH v2 2/2] x86,vdso: Fix cross-compilation from big-endian architectures
On 05/30/2014 01:34 PM, Andy Lutomirski wrote: >> >> GET_LE() then? > > Sounds good. > > Are you planning on writing the patch? > > I think my v2 is good -- the only diff I could find in my image.c > files and Stephen's was in the alt_xyz output, and I think I fixed > that in v2. > Build testing one now. -hpa -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/2] x86,vdso: Fix cross-compilation from big-endian architectures
On Fri, May 30, 2014 at 1:21 PM, H. Peter Anvin wrote: > 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? Sounds good. Are you planning on writing the patch? I think my v2 is good -- the only diff I could find in my image.c files and Stephen's was in the alt_xyz output, and I think I fixed that in v2. --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/2] x86,vdso: Fix cross-compilation from big-endian architectures
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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/2] x86,vdso: Fix cross-compilation from big-endian architectures
On Fri, May 30, 2014 at 1:02 PM, H. Peter Anvin wrote: > 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 >> --- >> 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) 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. >> >> 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. --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/2] x86,vdso: Fix cross-compilation from big-endian architectures
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 > --- > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 2/2] x86,vdso: 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 --- arch/x86/vdso/vdso2c.c | 15 arch/x86/vdso/vdso2c.h | 63 -- 2 files changed, 50 insertions(+), 28 deletions(-) diff --git a/arch/x86/vdso/vdso2c.c b/arch/x86/vdso/vdso2c.c index fe8bfbf..de19ced 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 diff --git a/arch/x86/vdso/vdso2c.h b/arch/x86/vdso/vdso2c.h index 26a7c1f..f0475da 100644 --- a/arch/x86/vdso/vdso2c.h +++ b/arch/x86/vdso/vdso2c.h @@ -18,25 +18,27 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) const char *secstrings; uint64_t syms[NSYMS] = {}; - Elf_Phdr *pt = (Elf_Phdr *)(addr + hdr->e_phoff); + Elf_Phdr *pt = (Elf_Phdr *)(addr + GET(hdr->e_phoff)); /* Walk the segment table. */ - for (i = 0; i < hdr->e_phnum; i++) { - if (pt[i].p_type == PT_LOAD) { + for (i = 0; i < GET(hdr->e_phnum); i++) { + if (GET(pt[i].p_type) == PT_LOAD) { if (found_load) fail("multiple PT_LOAD segs\n"); - if (pt[i].p_offset != 0 || pt[i].p_vaddr != 0) + if (GET(pt[i].p_offset) != 0 || + GET(pt[i].p_vaddr) != 0) fail("PT_LOAD in wrong place\n"); - if (pt[i].p_memsz != pt[i].p_filesz) + if (GET(pt[i].p_memsz) != GET(pt[i].p_filesz)) fail("cannot handle memsz != filesz\n"); - load_size = pt[i].p_memsz; + load_size = GET(pt[i].p_memsz); found_load = 1; - } else if (pt[i].p_type == PT_DYNAMIC) { - dyn = addr + pt[i].p_offset; - dyn_end = addr + pt[i].p_offset + pt[i].p_memsz; + } else if (GET(pt[i].p_type) == PT_DYNAMIC) { + dyn = addr + GET(pt[i].p_offset); + dyn_end = addr + GET(pt[i].p_offset) + + GET(pt[i].p_memsz); } } if (!found_load) @@ -44,43 +46,48 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) data_size = (load_size + 4095) / 4096 * 4096; /* Walk the dynamic table */ - for (i = 0; dyn + i < dyn_end && dyn[i].d_tag != DT_NULL; i++) { - if (dyn[i].d_tag == DT_REL || dyn[i].d_tag == DT_RELSZ || - dyn[i].d_tag == DT_RELENT || dyn[i].d_tag == DT_TEXTREL) + for (i = 0; dyn + i < dyn_end && GET(dyn[i].d_tag) != DT_NULL; i++) { + typeof(dyn[i].d_tag) tag = GET(dyn[i].d_tag); + if (tag == DT_REL || tag == DT_RELSZ || + tag == DT_RELENT || tag == DT_TEXTREL) fail("vdso image contains dynamic relocations\n"); } /* Walk the section table */ - secstrings_hdr = addr + hdr->e_shoff + hdr->e_shentsize*hdr->e_shstrndx; - secstrings = addr + secstrings_hdr->sh_offset; - for (i = 0; i < hdr->e_shnum; i++) { - Elf_Shdr *sh = addr + hdr->e_shoff + hdr->e_shentsize * i; - if (sh->sh_type == SHT_SYMTAB) + secstrings_hdr = addr + GET(hdr->e_shoff) + + GET(hdr->e_shentsize)*GET(hdr->e_shstrndx); + secstrings = addr + GET(secstrings_hdr->sh_offset); + for (i = 0; i < GET(hdr->e_shnum); i++) { + Elf_Shdr *sh = addr + GET(hdr->e_shoff) + + GET(hdr->e_shentsize) * i; + if (GET(sh->sh_type) == SHT_SYMTAB) symtab_hdr = sh; - if (!strcmp(secstrings + sh->sh_name, ".altinstructions")) + if (!strcmp(secstrings + GET(sh->sh_name), ".altinstructions")) alt_sec = sh; } if (!symtab_hdr) fail("no symbol table\n"); -
[PATCH v2 2/2] x86,vdso: 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 l...@amacapital.net --- arch/x86/vdso/vdso2c.c | 15 arch/x86/vdso/vdso2c.h | 63 -- 2 files changed, 50 insertions(+), 28 deletions(-) diff --git a/arch/x86/vdso/vdso2c.c b/arch/x86/vdso/vdso2c.c index fe8bfbf..de19ced 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 diff --git a/arch/x86/vdso/vdso2c.h b/arch/x86/vdso/vdso2c.h index 26a7c1f..f0475da 100644 --- a/arch/x86/vdso/vdso2c.h +++ b/arch/x86/vdso/vdso2c.h @@ -18,25 +18,27 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) const char *secstrings; uint64_t syms[NSYMS] = {}; - Elf_Phdr *pt = (Elf_Phdr *)(addr + hdr-e_phoff); + Elf_Phdr *pt = (Elf_Phdr *)(addr + GET(hdr-e_phoff)); /* Walk the segment table. */ - for (i = 0; i hdr-e_phnum; i++) { - if (pt[i].p_type == PT_LOAD) { + for (i = 0; i GET(hdr-e_phnum); i++) { + if (GET(pt[i].p_type) == PT_LOAD) { if (found_load) fail(multiple PT_LOAD segs\n); - if (pt[i].p_offset != 0 || pt[i].p_vaddr != 0) + if (GET(pt[i].p_offset) != 0 || + GET(pt[i].p_vaddr) != 0) fail(PT_LOAD in wrong place\n); - if (pt[i].p_memsz != pt[i].p_filesz) + if (GET(pt[i].p_memsz) != GET(pt[i].p_filesz)) fail(cannot handle memsz != filesz\n); - load_size = pt[i].p_memsz; + load_size = GET(pt[i].p_memsz); found_load = 1; - } else if (pt[i].p_type == PT_DYNAMIC) { - dyn = addr + pt[i].p_offset; - dyn_end = addr + pt[i].p_offset + pt[i].p_memsz; + } else if (GET(pt[i].p_type) == PT_DYNAMIC) { + dyn = addr + GET(pt[i].p_offset); + dyn_end = addr + GET(pt[i].p_offset) + + GET(pt[i].p_memsz); } } if (!found_load) @@ -44,43 +46,48 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) data_size = (load_size + 4095) / 4096 * 4096; /* Walk the dynamic table */ - for (i = 0; dyn + i dyn_end dyn[i].d_tag != DT_NULL; i++) { - if (dyn[i].d_tag == DT_REL || dyn[i].d_tag == DT_RELSZ || - dyn[i].d_tag == DT_RELENT || dyn[i].d_tag == DT_TEXTREL) + for (i = 0; dyn + i dyn_end GET(dyn[i].d_tag) != DT_NULL; i++) { + typeof(dyn[i].d_tag) tag = GET(dyn[i].d_tag); + if (tag == DT_REL || tag == DT_RELSZ || + tag == DT_RELENT || tag == DT_TEXTREL) fail(vdso image contains dynamic relocations\n); } /* Walk the section table */ - secstrings_hdr = addr + hdr-e_shoff + hdr-e_shentsize*hdr-e_shstrndx; - secstrings = addr + secstrings_hdr-sh_offset; - for (i = 0; i hdr-e_shnum; i++) { - Elf_Shdr *sh = addr + hdr-e_shoff + hdr-e_shentsize * i; - if (sh-sh_type == SHT_SYMTAB) + secstrings_hdr = addr + GET(hdr-e_shoff) + + GET(hdr-e_shentsize)*GET(hdr-e_shstrndx); + secstrings = addr + GET(secstrings_hdr-sh_offset); + for (i = 0; i GET(hdr-e_shnum); i++) { + Elf_Shdr *sh = addr + GET(hdr-e_shoff) + + GET(hdr-e_shentsize) * i; + if (GET(sh-sh_type) == SHT_SYMTAB) symtab_hdr = sh; - if (!strcmp(secstrings + sh-sh_name, .altinstructions)) + if (!strcmp(secstrings + GET(sh-sh_name), .altinstructions)) alt_sec = sh; } if (!symtab_hdr) fail(no symbol table\n); - strtab_hdr = addr + hdr-e_shoff +
Re: [PATCH v2 2/2] x86,vdso: Fix cross-compilation from big-endian architectures
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 l...@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 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/2] x86,vdso: Fix cross-compilation from big-endian architectures
On Fri, May 30, 2014 at 1:02 PM, H. Peter Anvin h...@zytor.com wrote: 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 l...@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) 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. 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. --Andy -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/2] x86,vdso: Fix cross-compilation from big-endian architectures
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 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/2] x86,vdso: Fix cross-compilation from big-endian architectures
On Fri, May 30, 2014 at 1:21 PM, H. Peter Anvin h...@zytor.com wrote: 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? Sounds good. Are you planning on writing the patch? I think my v2 is good -- the only diff I could find in my image.c files and Stephen's was in the alt_xyz output, and I think I fixed that in v2. --Andy -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/2] x86,vdso: Fix cross-compilation from big-endian architectures
On 05/30/2014 01:34 PM, Andy Lutomirski wrote: GET_LE() then? Sounds good. Are you planning on writing the patch? I think my v2 is good -- the only diff I could find in my image.c files and Stephen's was in the alt_xyz output, and I think I fixed that in v2. Build testing one now. -hpa -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/