diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-04-12 00:28:59 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-04-12 00:28:59 +0000 |
commit | b1591d1f8b9444c770771c9482d708dd5e497829 (patch) | |
tree | 4feb93c48d1ba8b6d182498db1b2ad94d61098ac /modutils | |
parent | a3603e845ef93dfc4027659fbe75d60c302f428a (diff) | |
download | busybox-b1591d1f8b9444c770771c9482d708dd5e497829.tar.gz |
Fix handling of endianness.
-Erik
Diffstat (limited to 'modutils')
-rw-r--r-- | modutils/insmod.c | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c index a3680ab1a..cbd423e18 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c @@ -140,7 +140,7 @@ #ifndef MODUTILS_MODULE_H static const int MODUTILS_MODULE_H = 1; -#ident "$Id: insmod.c,v 1.80 2002/04/01 14:25:51 miles Exp $" +#ident "$Id: insmod.c,v 1.81 2002/04/12 00:28:59 andersen Exp $" /* This file contains the structures used by the 2.0 and 2.1 kernels. We do not use the kernel headers directly because we do not wish @@ -357,12 +357,19 @@ int delete_module(const char *); #ifndef MODUTILS_OBJ_H static const int MODUTILS_OBJ_H = 1; -#ident "$Id: insmod.c,v 1.80 2002/04/01 14:25:51 miles Exp $" +#ident "$Id: insmod.c,v 1.81 2002/04/12 00:28:59 andersen Exp $" /* The relocatable object is manipulated using elfin types. */ #include <stdio.h> #include <elf.h> +#include <endian.h> + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define ELFDATAM ELFDATA2LSB +#elif __BYTE_ORDER == __BIG_ENDIAN +#define ELFDATAM ELFDATA2MSB +#endif /* Machine-specific elf macros for i386 et al. */ @@ -382,37 +389,24 @@ static const int MODUTILS_OBJ_H = 1; #define ELFCLASSM ELFCLASS32 -#if (defined(__mc68000__)) -#define ELFDATAM ELFDATA2MSB -#endif - - #if defined(__sh__) #define MATCH_MACHINE(x) (x == EM_SH) #define SHT_RELM SHT_RELA #define Elf32_RelM Elf32_Rela -#define ELFDATAM ELFDATA2LSB #elif defined(__arm__) #define MATCH_MACHINE(x) (x == EM_ARM) #define SHT_RELM SHT_REL #define Elf32_RelM Elf32_Rel -#ifdef __ARMEB__ -#define ELFDATAM ELFDATA2MSB -#endif -#ifdef __ARMEL__ -#define ELFDATAM ELFDATA2LSB -#endif #elif defined(__powerpc__) #define MATCH_MACHINE(x) (x == EM_PPC) #define SHT_RELM SHT_RELA #define Elf32_RelM Elf32_Rela -#define ELFDATAM ELFDATA2MSB #elif defined(__mips__) @@ -428,12 +422,6 @@ static const int MODUTILS_OBJ_H = 1; #define MATCH_MACHINE(x) (x == EM_MIPS || x == EM_MIPS_RS3_LE) #define SHT_RELM SHT_REL #define Elf32_RelM Elf32_Rel -#ifdef __MIPSEB__ -#define ELFDATAM ELFDATA2MSB -#endif -#ifdef __MIPSEL__ -#define ELFDATAM ELFDATA2LSB -#endif #elif defined(__i386__) @@ -448,7 +436,6 @@ static const int MODUTILS_OBJ_H = 1; #define SHT_RELM SHT_REL #define Elf32_RelM Elf32_Rel -#define ELFDATAM ELFDATA2LSB #elif defined(__mc68000__) @@ -465,7 +452,6 @@ static const int MODUTILS_OBJ_H = 1; #define MATCH_MACHINE(x) ((x) == EM_V850 || (x) == EM_CYGNUS_V850) #define SHT_RELM SHT_RELA #define Elf32_RelM Elf32_Rela -#define ELFDATAM ELFDATA2LSB #define SYMBOL_PREFIX "_" |