summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2004-09-02 23:03:25 +0000
committerEric Andersen2004-09-02 23:03:25 +0000
commit45a0513a64f10b4d437e5b261f6b53f8e75e064b (patch)
treeb5a8bdcf732f90833c700d128fa4ed3133d84ffc
parent192c35f6eb2bb85e28c697a45c7d80a43ec6e743 (diff)
downloadbusybox-45a0513a64f10b4d437e5b261f6b53f8e75e064b.zip
busybox-45a0513a64f10b4d437e5b261f6b53f8e75e064b.tar.gz
Based on patches from Mike Frysinger, add insmod support for
sparc and ia64 (itanium). Also, reorganize the insmod architecture support code to be alphasorted and less messy. Update the readme to list current insmod arch support.
-rw-r--r--README17
-rw-r--r--modutils/insmod.c156
2 files changed, 91 insertions, 82 deletions
diff --git a/README b/README
index aa58cd1..72a560c 100644
--- a/README
+++ b/README
@@ -33,23 +33,24 @@ Supported architectures:
BusyBox in general will build on any architecture supported by gcc. It has
a few specialized features added for __sparc__ and __alpha__. insmod
- functionality is currently limited to x86, ARM, SH3/4, powerpc, m68k,
- MIPS, cris, and v850e.
+ functionality is currently limited to ARM, CRIS, H8/300, x86, ia64,
+ x86_64, m68k, MIPS, PowerPC, S390, SH3/4/5, Sparc, v850e, and x86_64
+ for 2.4.x kernels. For 2.6.x kernels
Supported C Libraries:
- glibc-2.0.x, glibc-2.1.x, glibc-2.2.x, glibc-2.3.x, uClibc. People
- are looking at newlib and diet-libc, but consider them unsupported,
- untested, or worse. Linux-libc5 is no longer supported -- you
- should probably use uClibc instead if you want a small C library.
+ uClibc and glibc are supported. People have been looking at newlib and
+ diet-libc, but they are currently considered unsupported, untested, or
+ worse. Linux-libc5 is no longer supported -- you should probably use uClibc
+ instead if you want a small C library.
Supported kernels:
Full functionality requires Linux 2.2.x or better. A large fraction of the
code should run on just about anything. While the current code is fairly
Linux specific, it should be fairly easy to port the majority of the code
- to, say, FreeBSD or Solaris, or Mac OS X, or even Windows (if you are into
- that sort of thing).
+ to support, say, FreeBSD or Solaris, or Mac OS X, or even Windows (if you
+ are into that sort of thing).
----------------
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 55a3e49..d88dd1b 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -2,8 +2,8 @@
/*
* Mini insmod implementation for busybox
*
- * This version of insmod supports x86, x86_64, ARM, SH3/4/5, powerpc, m68k,
- * MIPS, v850e, and H8/300.
+ * This version of insmod supports ARM, CRIS, H8/300, x86, ia64, x86_64,
+ * m68k, MIPS, PowerPC, S390, SH3/4/5, Sparc, v850e, and x86_64.
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
* and Ron Alder <alder@lineo.com>
@@ -109,67 +109,82 @@ extern int insmod_ng_main( int argc, char **argv);
#endif
+/* ARM support */
#if defined(__arm__)
-#define CONFIG_USE_PLT_ENTRIES
-#define CONFIG_PLT_ENTRY_SIZE 8
-#define CONFIG_USE_GOT_ENTRIES
-#define CONFIG_GOT_ENTRY_SIZE 8
-#define CONFIG_USE_SINGLE
-
#define MATCH_MACHINE(x) (x == EM_ARM)
#define SHT_RELM SHT_REL
#define Elf32_RelM Elf32_Rel
#define ELFCLASSM ELFCLASS32
-#endif
-
-#if defined(__s390__)
#define CONFIG_USE_PLT_ENTRIES
#define CONFIG_PLT_ENTRY_SIZE 8
#define CONFIG_USE_GOT_ENTRIES
#define CONFIG_GOT_ENTRY_SIZE 8
#define CONFIG_USE_SINGLE
+#endif
-#define MATCH_MACHINE(x) (x == EM_S390)
+/* CRIS */
+#if defined(__cris__)
+#define MATCH_MACHINE(x) (x == EM_CRIS)
#define SHT_RELM SHT_RELA
#define Elf32_RelM Elf32_Rela
#define ELFCLASSM ELFCLASS32
+#ifndef EM_CRIS
+#define EM_CRIS 76
+#define R_CRIS_NONE 0
+#define R_CRIS_32 3
+#endif
#endif
-#if defined(__i386__)
-#define CONFIG_USE_GOT_ENTRIES
-#define CONFIG_GOT_ENTRY_SIZE 4
+/* H8/300 */
+#if defined(__H8300H__) || defined(__H8300S__)
+#define MATCH_MACHINE(x) (x == EM_H8_300)
+#define SHT_RELM SHT_RELA
+#define Elf32_RelM Elf32_Rela
+#define ELFCLASSM ELFCLASS32
#define CONFIG_USE_SINGLE
+#define SYMBOL_PREFIX "_"
+#endif
+/* x86 */
+#if defined(__i386__)
#ifndef EM_486
#define MATCH_MACHINE(x) (x == EM_386)
#else
#define MATCH_MACHINE(x) (x == EM_386 || x == EM_486)
#endif
-
#define SHT_RELM SHT_REL
#define Elf32_RelM Elf32_Rel
#define ELFCLASSM ELFCLASS32
+#define CONFIG_USE_GOT_ENTRIES
+#define CONFIG_GOT_ENTRY_SIZE 4
+#define CONFIG_USE_SINGLE
#endif
-#if defined(__x86_64__)
-#define MATCH_MACHINE(x) (x == EM_X86_64)
-#define SHT_RELM SHT_REL
-#define Elf64_RelM Elf64_Rel
-#define ELFCLASSM ELFCLASS64
+/* IA64, aka Itanium */
+#if defined(__ia64__)
+#define MATCH_MACHINE(x) (x == EM_IA_64)
+#define SHT_RELM SHT_RELA
+#define Elf64_RelM Elf64_Rela
+#define ELFCLASSM ELFCLASS64
#endif
+/* m68k */
#if defined(__mc68000__)
-#define CONFIG_USE_GOT_ENTRIES
-#define CONFIG_GOT_ENTRY_SIZE 4
-#define CONFIG_USE_SINGLE
-
#define MATCH_MACHINE(x) (x == EM_68K)
#define SHT_RELM SHT_RELA
#define Elf32_RelM Elf32_Rela
#define ELFCLASSM ELFCLASS32
+#define CONFIG_USE_GOT_ENTRIES
+#define CONFIG_GOT_ENTRY_SIZE 4
+#define CONFIG_USE_SINGLE
#endif
+/* MIPS */
#if defined(__mips__)
+#define MATCH_MACHINE(x) (x == EM_MIPS || x == EM_MIPS_RS3_LE)
+#define SHT_RELM SHT_REL
+#define Elf32_RelM Elf32_Rel
+#define ELFCLASSM ELFCLASS32
/* Account for ELF spec changes. */
#ifndef EM_MIPS_RS3_LE
#ifdef EM_MIPS_RS4_BE
@@ -178,92 +193,85 @@ extern int insmod_ng_main( int argc, char **argv);
#define EM_MIPS_RS3_LE 10
#endif
#endif /* !EM_MIPS_RS3_LE */
-
-#define MATCH_MACHINE(x) (x == EM_MIPS || x == EM_MIPS_RS3_LE)
-#define SHT_RELM SHT_REL
-#define Elf32_RelM Elf32_Rel
-#define ELFCLASSM ELFCLASS32
#define ARCHDATAM "__dbe_table"
#endif
+/* PowerPC */
#if defined(__powerpc__)
+#define MATCH_MACHINE(x) (x == EM_PPC)
+#define SHT_RELM SHT_RELA
+#define Elf32_RelM Elf32_Rela
+#define ELFCLASSM ELFCLASS32
#define CONFIG_USE_PLT_ENTRIES
#define CONFIG_PLT_ENTRY_SIZE 16
#define CONFIG_USE_PLT_LIST
#define CONFIG_LIST_ARCHTYPE ElfW(Addr)
#define CONFIG_USE_LIST
+#define ARCHDATAM "__ftr_fixup"
+#endif
-#define MATCH_MACHINE(x) (x == EM_PPC)
+/* S390 */
+#if defined(__s390__)
+#define MATCH_MACHINE(x) (x == EM_S390)
#define SHT_RELM SHT_RELA
#define Elf32_RelM Elf32_Rela
#define ELFCLASSM ELFCLASS32
-#define ARCHDATAM "__ftr_fixup"
-#endif
-
-#if defined(__sh__)
+#define CONFIG_USE_PLT_ENTRIES
+#define CONFIG_PLT_ENTRY_SIZE 8
#define CONFIG_USE_GOT_ENTRIES
-#define CONFIG_GOT_ENTRY_SIZE 4
+#define CONFIG_GOT_ENTRY_SIZE 8
#define CONFIG_USE_SINGLE
+#endif
+/* SuperH */
+#if defined(__sh__)
#define MATCH_MACHINE(x) (x == EM_SH)
#define SHT_RELM SHT_RELA
#define Elf32_RelM Elf32_Rela
#define ELFCLASSM ELFCLASS32
-
+#define CONFIG_USE_GOT_ENTRIES
+#define CONFIG_GOT_ENTRY_SIZE 4
+#define CONFIG_USE_SINGLE
/* the SH changes have only been tested in =little endian= mode */
/* I'm not sure about big endian, so let's warn: */
-
#if defined(__sh__) && defined(__BIG_ENDIAN__)
#error insmod.c may require changes for use on big endian SH
#endif
-
-/* it may or may not work on the SH1/SH2... So let's error on those
- also */
-#if ((!(defined(__SH3__) || defined(__SH4__) || defined(__SH5__)))) && \
- (defined(__sh__))
+/* it may or may not work on the SH1/SH2... Error on those also */
+#if ((!(defined(__SH3__) || defined(__SH4__) || defined(__SH5__)))) && (defined(__sh__))
#error insmod.c may require changes for SH1 or SH2 use
#endif
#endif
+/* Sparc */
+#if defined(__sparc__)
+#define MATCH_MACHINE(x) (x == EM_SPARC)
+#define SHT_RELM SHT_RELA
+#define Elf32_RelM Elf32_Rela
+#define ELFCLASSM ELFCLASS32
+#endif
+
+/* v850e */
#if defined (__v850e__)
+#define MATCH_MACHINE(x) ((x) == EM_V850 || (x) == EM_CYGNUS_V850)
+#define SHT_RELM SHT_RELA
+#define Elf32_RelM Elf32_Rela
+#define ELFCLASSM ELFCLASS32
#define CONFIG_USE_PLT_ENTRIES
#define CONFIG_PLT_ENTRY_SIZE 8
#define CONFIG_USE_SINGLE
-
#ifndef EM_CYGNUS_V850 /* grumble */
#define EM_CYGNUS_V850 0x9080
#endif
-
-#define MATCH_MACHINE(x) ((x) == EM_V850 || (x) == EM_CYGNUS_V850)
-#define SHT_RELM SHT_RELA
-#define Elf32_RelM Elf32_Rela
-#define ELFCLASSM ELFCLASS32
-
#define SYMBOL_PREFIX "_"
#endif
-#if defined(__cris__)
-#ifndef EM_CRIS
-#define EM_CRIS 76
-#define R_CRIS_NONE 0
-#define R_CRIS_32 3
-#endif
-
-#define MATCH_MACHINE(x) (x == EM_CRIS)
-#define SHT_RELM SHT_RELA
-#define Elf32_RelM Elf32_Rela
-#define ELFCLASSM ELFCLASS32
-#endif
-
-#if defined(__H8300H__) || defined(__H8300S__)
-#define CONFIG_USE_SINGLE
-
-#define MATCH_MACHINE(x) (x == EM_H8_300)
-#define SHT_RELM SHT_RELA
-#define Elf32_RelM Elf32_Rela
-
-#define ELFCLASSM ELFCLASS32
-#define SYMBOL_PREFIX "_"
+/* X86_64 */
+#if defined(__x86_64__)
+#define MATCH_MACHINE(x) (x == EM_X86_64)
+#define SHT_RELM SHT_REL
+#define Elf64_RelM Elf64_Rel
+#define ELFCLASSM ELFCLASS64
#endif
#ifndef SHT_RELM
@@ -300,7 +308,7 @@ extern int insmod_ng_main( int argc, char **argv);
#ifndef MODUTILS_MODULE_H
static const int MODUTILS_MODULE_H = 1;
-#ident "$Id: insmod.c,v 1.124 2004/08/28 00:43:06 andersen Exp $"
+#ident "$Id: insmod.c,v 1.125 2004/09/02 23:03:25 andersen Exp $"
/*======================================================================*/
/* For sizeof() which are related to the module platform and not to the
@@ -458,7 +466,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
static const int MODUTILS_OBJ_H = 1;
-#ident "$Id: insmod.c,v 1.124 2004/08/28 00:43:06 andersen Exp $"
+#ident "$Id: insmod.c,v 1.125 2004/09/02 23:03:25 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */