diff options
| author | Eric Andersen <andersen@codepoet.org> | 2004-05-26 11:38:46 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2004-05-26 11:38:46 +0000 |
| commit | ee70fa5523520f810f77b8a94aa1ffdbd9aff057 (patch) | |
| tree | 03a1804a24860e6d0902c00a4be0da4efa2deaa5 /modutils | |
| parent | 0dfe4e99562878bc575e682926c2e345661d08a1 (diff) | |
| download | busybox-w32-ee70fa5523520f810f77b8a94aa1ffdbd9aff057.tar.gz busybox-w32-ee70fa5523520f810f77b8a94aa1ffdbd9aff057.tar.bz2 busybox-w32-ee70fa5523520f810f77b8a94aa1ffdbd9aff057.zip | |
Patch from Yoshinori Sato:
This patch is uClinux-2.4.x for H8/300 module support.
please apply.
--
Yoshinori Sato
Diffstat (limited to 'modutils')
| -rw-r--r-- | modutils/insmod.c | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c index 63ee9da71..5063be564 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * Mini insmod implementation for busybox | 3 | * Mini insmod implementation for busybox |
| 4 | * | 4 | * |
| 5 | * This version of insmod supports x86, ARM, SH3/4/5, powerpc, m68k, | 5 | * This version of insmod supports x86, ARM, SH3/4/5, powerpc, m68k, |
| 6 | * MIPS, and v850e. | 6 | * MIPS, v850e, and H8/300. |
| 7 | * | 7 | * |
| 8 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> | 8 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
| 9 | * and Ron Alder <alder@lineo.com> | 9 | * and Ron Alder <alder@lineo.com> |
| @@ -18,6 +18,9 @@ | |||
| 18 | * very minor changes required to also work with StrongArm and presumably | 18 | * very minor changes required to also work with StrongArm and presumably |
| 19 | * all ARM based systems. | 19 | * all ARM based systems. |
| 20 | * | 20 | * |
| 21 | * Yoshinori Sato <ysato@users.sourceforge.jp> 19-May-2004. | ||
| 22 | * added Renesas H8/300 support. | ||
| 23 | * | ||
| 21 | * Paul Mundt <lethal@linux-sh.org> 08-Aug-2003. | 24 | * Paul Mundt <lethal@linux-sh.org> 08-Aug-2003. |
| 22 | * Integrated support for sh64 (SH-5), from preliminary modutils | 25 | * Integrated support for sh64 (SH-5), from preliminary modutils |
| 23 | * patches from Benedict Gaster <benedict.gaster@superh.com>. | 26 | * patches from Benedict Gaster <benedict.gaster@superh.com>. |
| @@ -248,6 +251,17 @@ extern int insmod_ng_main( int argc, char **argv); | |||
| 248 | #define ELFCLASSM ELFCLASS32 | 251 | #define ELFCLASSM ELFCLASS32 |
| 249 | #endif | 252 | #endif |
| 250 | 253 | ||
| 254 | #if defined(__H8300H__) || defined(__H8300S__) | ||
| 255 | #define CONFIG_USE_SINGLE | ||
| 256 | |||
| 257 | #define MATCH_MACHINE(x) (x == EM_H8_300) | ||
| 258 | #define SHT_RELM SHT_RELA | ||
| 259 | #define Elf32_RelM Elf32_Rela | ||
| 260 | |||
| 261 | #define ELFCLASSM ELFCLASS32 | ||
| 262 | #define SYMBOL_PREFIX "_" | ||
| 263 | #endif | ||
| 264 | |||
| 251 | #ifndef SHT_RELM | 265 | #ifndef SHT_RELM |
| 252 | #error Sorry, but insmod.c does not yet support this architecture... | 266 | #error Sorry, but insmod.c does not yet support this architecture... |
| 253 | #endif | 267 | #endif |
| @@ -282,7 +296,7 @@ extern int insmod_ng_main( int argc, char **argv); | |||
| 282 | #ifndef MODUTILS_MODULE_H | 296 | #ifndef MODUTILS_MODULE_H |
| 283 | static const int MODUTILS_MODULE_H = 1; | 297 | static const int MODUTILS_MODULE_H = 1; |
| 284 | 298 | ||
| 285 | #ident "$Id: insmod.c,v 1.117 2004/04/14 17:51:22 andersen Exp $" | 299 | #ident "$Id: insmod.c,v 1.118 2004/05/26 11:38:46 andersen Exp $" |
| 286 | 300 | ||
| 287 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 301 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
| 288 | We do not use the kernel headers directly because we do not wish | 302 | We do not use the kernel headers directly because we do not wish |
| @@ -503,7 +517,7 @@ int delete_module(const char *); | |||
| 503 | #ifndef MODUTILS_OBJ_H | 517 | #ifndef MODUTILS_OBJ_H |
| 504 | static const int MODUTILS_OBJ_H = 1; | 518 | static const int MODUTILS_OBJ_H = 1; |
| 505 | 519 | ||
| 506 | #ident "$Id: insmod.c,v 1.117 2004/04/14 17:51:22 andersen Exp $" | 520 | #ident "$Id: insmod.c,v 1.118 2004/05/26 11:38:46 andersen Exp $" |
| 507 | 521 | ||
| 508 | /* The relocatable object is manipulated using elfin types. */ | 522 | /* The relocatable object is manipulated using elfin types. */ |
| 509 | 523 | ||
| @@ -1323,6 +1337,36 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1323 | break; | 1337 | break; |
| 1324 | #endif | 1338 | #endif |
| 1325 | 1339 | ||
| 1340 | #elif defined(__H8300H__) || defined(__H8300S__) | ||
| 1341 | case R_H8_DIR24R8: | ||
| 1342 | loc = (ElfW(Addr) *)((ElfW(Addr))loc - 1); | ||
| 1343 | *loc = (*loc & 0xff000000) | ((*loc & 0xffffff) + v); | ||
| 1344 | break; | ||
| 1345 | case R_H8_DIR24A8: | ||
| 1346 | *loc += v; | ||
| 1347 | break; | ||
| 1348 | case R_H8_DIR32: | ||
| 1349 | case R_H8_DIR32A16: | ||
| 1350 | *loc += v; | ||
| 1351 | break; | ||
| 1352 | case R_H8_PCREL16: | ||
| 1353 | v -= dot + 2; | ||
| 1354 | if ((Elf32_Sword)v > 0x7fff || | ||
| 1355 | (Elf32_Sword)v < -(Elf32_Sword)0x8000) | ||
| 1356 | ret = obj_reloc_overflow; | ||
| 1357 | else | ||
| 1358 | *(unsigned short *)loc = v; | ||
| 1359 | break; | ||
| 1360 | case R_H8_PCREL8: | ||
| 1361 | v -= dot + 1; | ||
| 1362 | if ((Elf32_Sword)v > 0x7f || | ||
| 1363 | (Elf32_Sword)v < -(Elf32_Sword)0x80) | ||
| 1364 | ret = obj_reloc_overflow; | ||
| 1365 | else | ||
| 1366 | *(unsigned char *)loc = v; | ||
| 1367 | break; | ||
| 1368 | #endif | ||
| 1369 | |||
| 1326 | #if defined(CONFIG_USE_PLT_ENTRIES) | 1370 | #if defined(CONFIG_USE_PLT_ENTRIES) |
| 1327 | 1371 | ||
| 1328 | bb_use_plt: | 1372 | bb_use_plt: |
