[LEDE-DEV] [PATCH ubox 1/3] kmodloader: fix endianess check
John Crispin
john at phrozen.org
Wed Aug 30 08:06:47 PDT 2017
On 30/08/17 15:23, Hans Dedecker wrote:
> Use __BYTE_ORDER macro to check system endianess as the macro's
> __LITTLE_ENDIAN, __BIG_ENDIAN are defined irrespective of the
> sytem endianess leading to an endianess check failure on big
> endian systems.
Thanks !
Acked-by: John Crispin <john at phrozen.org> ... feel free to push
>
> Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
> ---
> kmodloader.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kmodloader.c b/kmodloader.c
> index a6aa795..a4d492d 100644
> --- a/kmodloader.c
> +++ b/kmodloader.c
> @@ -216,9 +216,9 @@ static int elf_find_section(char *map, const char *section, unsigned int *offset
> int clazz = map[EI_CLASS];
> int endian = map[EI_DATA];
>
> -#if defined(__LITTLE_ENDIAN)
> +#if __BYTE_ORDER == __LITTLE_ENDIAN
> if (endian != ELFDATA2LSB)
> -#elif defined(__BIG_ENDIAN)
> +#elif __BYTE_ORDER == __BIG_ENDIAN
> if (endian != ELFDATA2MSB)
> #else
> #error "unsupported endian"
More information about the Lede-dev
mailing list