linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Relocation problem with MIPS kernel modules
@ 2009-07-30 18:49 David VomLehn
  2009-07-30 19:15 ` David Daney
  2009-08-03  9:20 ` Ralf Baechle
  0 siblings, 2 replies; 13+ messages in thread
From: David VomLehn @ 2009-07-30 18:49 UTC (permalink / raw)
  To: GCC Help Mailing List, Linux MIPS Mailing List

I have a MIPS loadable kernel module that, when I try to insmod it, causes the
kernel to emit the message:

	module xyz: dangerous relocation

This message appears in three different places in arch/mips/kernel/module.c,
but this one is coming from apply_r_mips_lo16_rel(). The module code at
the location at which the error message is generated appears to be pretty
bland:
	lw v0,28564(s1)
with the expected relocation type of R_MIPS_LO16. The relocation before it
is R_MIPS_HI16, as expected, but for a different symbol. Before *that*
is another R_MIPS_HI16 relocation entry for yet a third symbol.

According to the MIPS ABI, for what it's worth, "Each relocation type of
R_MIPS_HI16 must have an associated R_MIPS_LO16 entry immediately following
it in the list of relocations." So, what's actually getting generated by
gcc and linker differs from the closest thing we have to an ABI of record for
MIPS processors.

What the kernel actually does differs from my interpretation of the MIPS ABI
in several particulars, which it has to do to relocate what it is actually
getting, but since I get the "dangerous relocation" error for a module that
appears to me to be valid, it may need to be fixed/enhanced.

So, who the heck knows what gcc and the linker are really generating and can
anyone suggest an algorithm for handling R_MIPS_HI16/R_MIPS_LO16 relocation
entries correctly?
--
David VomLehn

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-08-07 15:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-30 18:49 Relocation problem with MIPS kernel modules David VomLehn
2009-07-30 19:15 ` David Daney
2009-07-30 21:26   ` David VomLehn
2009-08-03  9:20 ` Ralf Baechle
2009-08-03 18:19   ` David VomLehn
2009-08-03 18:44     ` David Daney
2009-08-03 19:14       ` Ralf Baechle
2009-08-07  6:38     ` Marshall B. Rogers
2009-08-03 19:33   ` David Daney
2009-08-03 20:15     ` David VomLehn
2009-08-03 23:55       ` Ralf Baechle
2009-08-04  2:18         ` David VomLehn
2009-08-07 15:29           ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).