diff options
Diffstat (limited to 'modutils')
| -rw-r--r-- | modutils/insmod.c | 59 |
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: |
