From: Hans Dedecker Date: Wed, 30 Aug 2017 13:23:58 +0000 (+0200) Subject: kmodloader: fix endianess check X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9cb63df9b905e735c718d582b1d65cdff383cbd3;p=oweals%2Fubox.git kmodloader: fix endianess check 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. Signed-off-by: Hans Dedecker Acked-by: John Crispin --- 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"