[BusyBox-cvs] busybox/modutils insmod.c,1.117,1.118

Erik Andersen,,, andersen at busybox.net
Wed May 26 11:38:48 UTC 2004


Update of /var/cvs/busybox/modutils
In directory nail:/tmp/cvs-serv31587

Modified Files:
	insmod.c 
Log Message:
Patch from Yoshinori Sato:

This patch is uClinux-2.4.x for H8/300 module support.
please apply.

--
Yoshinori Sato



Index: insmod.c
===================================================================
RCS file: /var/cvs/busybox/modutils/insmod.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- a/insmod.c	14 Apr 2004 17:51:22 -0000	1.117
+++ b/insmod.c	26 May 2004 11:38:46 -0000	1.118
@@ -3,7 +3,7 @@
  * Mini insmod implementation for busybox
  *
  * This version of insmod supports x86, ARM, SH3/4/5, powerpc, m68k,
- * MIPS, and v850e.
+ * MIPS, v850e, and H8/300.
  *
  * Copyright (C) 1999-2004 by Erik Andersen <andersen at codepoet.org>
  * and Ron Alder <alder at lineo.com>
@@ -18,6 +18,9 @@
  * very minor changes required to also work with StrongArm and presumably
  * all ARM based systems.
  *
+ * Yoshinori Sato <ysato at users.sourceforge.jp> 19-May-2004.
+ *   added Renesas H8/300 support.
+ *
  * Paul Mundt <lethal at linux-sh.org> 08-Aug-2003.
  *   Integrated support for sh64 (SH-5), from preliminary modutils
  *   patches from Benedict Gaster <benedict.gaster at superh.com>.
@@ -248,6 +251,17 @@
 #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	"_"
+#endif
+
 #ifndef SHT_RELM
 #error Sorry, but insmod.c does not yet support this architecture...
 #endif
@@ -1323,6 +1337,36 @@
 			break;
 #endif
 
+#elif defined(__H8300H__) || defined(__H8300S__)
+	        case R_H8_DIR24R8:
+			loc = (ElfW(Addr) *)((ElfW(Addr))loc - 1);
+			*loc = (*loc & 0xff000000) | ((*loc & 0xffffff) + v);
+			break;
+	        case R_H8_DIR24A8:
+			*loc += v;
+			break;
+ 	        case R_H8_DIR32:
+	        case R_H8_DIR32A16:
+			*loc += v;
+			break;
+	        case R_H8_PCREL16:
+			v -= dot + 2;
+			if ((Elf32_Sword)v > 0x7fff || 
+			    (Elf32_Sword)v < -(Elf32_Sword)0x8000)
+				ret = obj_reloc_overflow;
+			else 
+				*(unsigned short *)loc = v;
+			break;
+	        case R_H8_PCREL8:
+			v -= dot + 1;
+			if ((Elf32_Sword)v > 0x7f || 
+			    (Elf32_Sword)v < -(Elf32_Sword)0x80)
+				ret = obj_reloc_overflow;
+			else 
+				*(unsigned char *)loc = v;
+			break;
+#endif
+
 #if defined(CONFIG_USE_PLT_ENTRIES)
 
 bb_use_plt:




More information about the busybox-cvs mailing list