--- zzzz-none-000/linux-3.10.107/arch/h8300/kernel/module.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/arch/h8300/kernel/module.c 2021-02-04 17:41:59.000000000 +0000 @@ -5,12 +5,6 @@ #include #include -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(fmt...) -#endif - int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, @@ -20,11 +14,12 @@ unsigned int i; Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr; - DEBUGP("Applying relocate section %u to %u\n", relsec, + pr_debug("Applying relocate section %u to %u\n", relsec, sechdrs[relsec].sh_info); for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++) { /* This is where to make the change */ - uint32_t *loc = (uint32_t *)(sechdrs[sechdrs[relsec].sh_info].sh_addr + uint32_t *loc = + (uint32_t *)(sechdrs[sechdrs[relsec].sh_info].sh_addr + rela[i].r_offset); /* This is the symbol it is referring to. Note that all undefined symbols have been resolved. */ @@ -47,29 +42,29 @@ break; case R_H8_PCREL16: v -= (unsigned long)loc + 2; - if ((Elf32_Sword)v > 0x7fff || + if ((Elf32_Sword)v > 0x7fff || (Elf32_Sword)v < -(Elf32_Sword)0x8000) goto overflow; - else + else *(unsigned short *)loc = v; break; case R_H8_PCREL8: v -= (unsigned long)loc + 1; - if ((Elf32_Sword)v > 0x7f || + if ((Elf32_Sword)v > 0x7f || (Elf32_Sword)v < -(Elf32_Sword)0x80) goto overflow; - else + else *(unsigned char *)loc = v; break; default: - printk(KERN_ERR "module %s: Unknown relocation: %u\n", + pr_err("module %s: Unknown relocation: %u\n", me->name, ELF32_R_TYPE(rela[i].r_info)); return -ENOEXEC; } } return 0; overflow: - printk(KERN_ERR "module %s: relocation offset overflow: %08x\n", + pr_err("module %s: relocation offset overflow: %08x\n", me->name, rela[i].r_offset); return -ENOEXEC; }