aboutsummaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-06-06 06:30:32 +0000
committerMike Frysinger <vapier@gentoo.org>2006-06-06 06:30:32 +0000
commit280dae74b052c6b75c48de5a0d883cb7a07a2e3a (patch)
tree8904ca7777cda5fa6450d130c939050a907fce5a /modutils
parent2a13175440420169e575c433de6c35e1399290e9 (diff)
downloadbusybox-w32-280dae74b052c6b75c48de5a0d883cb7a07a2e3a.tar.gz
busybox-w32-280dae74b052c6b75c48de5a0d883cb7a07a2e3a.tar.bz2
busybox-w32-280dae74b052c6b75c48de5a0d883cb7a07a2e3a.zip
import support for microblaze relocations from uClinux-dist
Diffstat (limited to 'modutils')
-rw-r--r--modutils/insmod.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c
index f6943291e..7ed4cdb30 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -988,6 +988,65 @@ arch_apply_relocation(struct obj_file *f,
988 *loc += v - got; 988 *loc += v - got;
989 break; 989 break;
990 990
991#elif defined (__microblaze__)
992 case R_MICROBLAZE_NONE:
993 case R_MICROBLAZE_64_NONE:
994 case R_MICROBLAZE_32_SYM_OP_SYM:
995 case R_MICROBLAZE_32_PCREL:
996 break;
997
998 case R_MICROBLAZE_64_PCREL: {
999 /* dot is the address of the current instruction.
1000 * v is the target symbol address.
1001 * So we need to extract the offset in the code,
1002 * adding v, then subtrating the current address
1003 * of this instruction.
1004 * Ex: "IMM 0xFFFE bralid 0x0000" = "bralid 0xFFFE0000"
1005 */
1006
1007 /* Get split offset stored in code */
1008 unsigned int temp = (loc[0] & 0xFFFF) << 16 |
1009 (loc[1] & 0xFFFF);
1010
1011 /* Adjust relative offset. -4 adjustment required
1012 * because dot points to the IMM insn, but branch
1013 * is computed relative to the branch instruction itself.
1014 */
1015 temp += v - dot - 4;
1016
1017 /* Store back into code */
1018 loc[0] = (loc[0] & 0xFFFF0000) | temp >> 16;
1019 loc[1] = (loc[1] & 0xFFFF0000) | (temp & 0xFFFF);
1020
1021 break;
1022 }
1023
1024 case R_MICROBLAZE_32:
1025 *loc += v;
1026 break;
1027
1028 case R_MICROBLAZE_64: {
1029 /* Get split pointer stored in code */
1030 unsigned int temp1 = (loc[0] & 0xFFFF) << 16 |
1031 (loc[1] & 0xFFFF);
1032
1033 /* Add reloc offset */
1034 temp1+=v;
1035
1036 /* Store back into code */
1037 loc[0] = (loc[0] & 0xFFFF0000) | temp1 >> 16;
1038 loc[1] = (loc[1] & 0xFFFF0000) | (temp1 & 0xFFFF);
1039
1040 break;
1041 }
1042
1043 case R_MICROBLAZE_32_PCREL_LO:
1044 case R_MICROBLAZE_32_LO:
1045 case R_MICROBLAZE_SRO32:
1046 case R_MICROBLAZE_SRW32:
1047 ret = obj_reloc_unhandled;
1048 break;
1049
991#elif defined(__mc68000__) 1050#elif defined(__mc68000__)
992 1051
993 case R_68K_NONE: 1052 case R_68K_NONE: