10 #include <linux/module.h>
12 #include <linux/kernel.h>
13 #include <linux/elf.h>
16 #include <linux/string.h>
18 #include <asm/pgtable.h>
19 #include <asm/cacheflush.h>
22 unsigned int symindex,
unsigned int relsec,
struct module *
module)
26 Elf32_Rela *rela = (
void *)sechdrs[relsec].sh_addr;
29 unsigned long int value;
31 unsigned long int old_value;
34 pr_debug(
"Applying add relocation section %u to %u\n",
35 relsec, sechdrs[relsec].sh_info);
37 for (i = 0; i < sechdrs[relsec].
sh_size /
sizeof(*rela); i++) {
39 location = (
void *)sechdrs[sechdrs[relsec].sh_info].sh_addr +
41 sym = (
Elf32_Sym *)sechdrs[symindex].sh_addr +
57 *location = value + old_value;
59 pr_debug(
"R_MICROBLAZE_32 (%08lx->%08lx)\n",
69 old_value = ((location[0] & 0x0000FFFF) << 16) |
70 (location[1] & 0x0000FFFF);
73 location[0] = (location[0] & 0xFFFF0000) |
75 location[1] = (location[1] & 0xFFFF0000) |
78 pr_debug(
"R_MICROBLAZE_64 (%08lx->%08lx)\n",
85 old_value = (location[0] & 0xFFFF) << 16 |
86 (location[1] & 0xFFFF);
89 value -= (
unsigned long int)(location) + 4;
90 location[0] = (location[0] & 0xFFFF0000) |
92 location[1] = (location[1] & 0xFFFF0000) |
94 pr_debug(
"R_MICROBLAZE_64_PCREL (%08lx)\n",
99 pr_debug(
"R_MICROBLAZE_32_PCREL_LO\n");
112 "Unknown relocation: %u\n",