On Thu 25 Jun 2009 11:44, Bernd Schmidt pondered:
> Robin Getz wrote:
> > On Wed 24 Jun 2009 17:32, Mike Frysinger pondered:
> >> On Wed, Jun 24, 2009 at 17:28, Robin Getz wrote:
> >>> On Wed 24 Jun 2009 17:06, Mike Frysinger pondered:
> >>>> yeah, that should be easy to do as well. i'll write a small wrapper
> >>>> function and have each call that.
> >>> Thanks.
> >> now the only problem is that i dont have a module to exercise each
> >> reloc. a quick readelf on my system shows coverage of only three
> >> cases. are there any testcases laying around ?
> >
> > Not that I'm aware of.
> >
> > All I can find is one that include:
> > R_BFIN_BYTE4_DATA
> > R_BFIN_HUIMM16
> > R_BFIN_LUIMM16
>
> That's pretty much it for typical code.
After a quick conversation with Bernd - I think we realized that most of
the existing relocations are in there pre-long-jump understanding...
All modules are required to be built with long-jump, and therefore
should not generate these relocations:
case R_BFIN_PCREL24: call <target>
case R_BFIN_PCREL24_JUMP_L: jump.l <target>
case R_BFIN_PCREL12_JUMP: jump <target>
case R_BFIN_PCREL12_JUMP_S: jump.s <target>
case R_BFIN_PCREL10: if cc jump <target>
If these are in the module, and resolve to something internal - they
should all be relative. If they are not in the module, or are split
into L1/external memory - since things are using long-jump, they should
be using Pn=<target>, jump (Pn);
So, removing the code...
-Robin
Index: kernel/module.c
===================================================================
--- kernel/module.c (revision 6845)
+++ kernel/module.c (working copy)
@@ -243,40 +243,6 @@
#endif
switch (ELF32_R_TYPE(rel[i].r_info)) {
- case R_BFIN_PCREL24:
- case R_BFIN_PCREL24_JUMP_L:
- /* Add the value, subtract its postition */
- location16 =
- (uint16_t *) (sechdrs[sechdrs[relsec].sh_info].
- sh_addr + rel[i].r_offset - 2);
- location32 = (uint32_t *) location16;
- value -= (uint32_t) location32;
- value >>= 1;
- if ((value & 0xFF000000) != 0 &&
- (value & 0xFF000000) != 0xFF000000) {
- printk(KERN_ERR "module %s: relocation
overflow\n",
- mod->name);
- return -ENOEXEC;
- }
- pr_debug("value is %x, before %x-%x after %x-%x\n",
value,
- *location16, *(location16 + 1),
- (*location16 & 0xff00) | (value >> 16 & 0x00ff),
- value & 0xffff);
- *location16 =
- (*location16 & 0xff00) | (value >> 16 & 0x00ff);
- *(location16 + 1) = value & 0xffff;
- break;
- case R_BFIN_PCREL12_JUMP:
- case R_BFIN_PCREL12_JUMP_S:
- value -= (uint32_t) location32;
- value >>= 1;
- *location16 = (value & 0xfff);
- break;
- case R_BFIN_PCREL10:
- value -= (uint32_t) location32;
- value >>= 1;
- *location16 = (value & 0x3ff);
- break;
case R_BFIN_LUIMM16:
pr_debug("before %x after %x\n", *location16,
(value & 0xffff));
@@ -302,6 +268,14 @@
pr_debug("before %x after %x\n", *location32, value);
*location32 = value;
break;
+ case R_BFIN_PCREL24:
+ case R_BFIN_PCREL24_JUMP_L:
+ case R_BFIN_PCREL12_JUMP:
+ case R_BFIN_PCREL12_JUMP_S:
+ case R_BFIN_PCREL10:
+ printk(KERN_ERR "module %s: Unsupported relocation: %u
not built properly,"
+ " includes relocation: %u", mod->name,
ELF32_R_TYPE(rel[i].r_info));
+ return -ENOEXEC;
default:
printk(KERN_ERR "module %s: Unknown relocation: %u\n",
mod->name, ELF32_R_TYPE(rel[i].r_info));
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits