22 #include <linux/elf.h>
25 #include <linux/string.h>
26 #include <linux/kernel.h>
32 #define DEBUGP(fmt, ...)
38 p[1] = (val >> 8) & 0xff;
44 p[2] = (val >> 16) & 0xff;
50 reloc_put16(p+2, val >> 16);
58 unsigned int symindex,
62 unsigned int i, sym_diff_seen = 0;
63 Elf32_Rela *rel = (
void *)sechdrs[relsec].sh_addr;
69 DEBUGP(
"Applying relocate section %u to %u\n",
70 relsec, sechdrs[relsec].sh_info);
72 for (i = 0; i < sechdrs[relsec].
sh_size /
sizeof(*rel); i++) {
74 location = (
void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
79 sym = (
Elf32_Sym *)sechdrs[symindex].sh_addr
91 relocation -= sym_diff_val;
105 reloc_put32(location, relocation);
108 reloc_put24(location, relocation);
111 reloc_put16(location, relocation);
114 *location = relocation;
121 value = relocation - (
uint32_t) location;
122 reloc_put32(location, value);
125 value = relocation - (
uint32_t) location;
126 reloc_put16(location, value);
129 *location = relocation - (
uint32_t) location;
151 printk(
KERN_ERR "module %s: Nothing follows SYM_DIFF relocation: %u\n",