Re: Relocation problem with MIPS kernel modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 03, 2009 at 12:33:25PM -0700, David Daney wrote:
> Ralf Baechle wrote:
>> On Thu, Jul 30, 2009 at 11:49:23AM -0700, David VomLehn wrote:
>>
>>> To: GCC Help Mailing List <gcc-help@xxxxxxxxxxx>,
>>> 	Linux MIPS Mailing List <linux-mips@xxxxxxxxxxxxxx>
>>> Subject: Relocation problem with MIPS kernel modules
>>> Content-Type: text/plain; charset=us-ascii
>>>
>>> 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
...
>>
>> The GNU tools as an extension over the MIPS ABI allows an arbitrary number of
>> R_MIPS_HI16 relocations to be followed by a R_MIPS_LO16 symbol.  All
>> relocations of this sequence must use the same symbol, of course.  This is
>> a very old extension; I think it predates the Linux/MIPS port.
>>
>
> Actually I think it is the opposite:
>
> RELOCATION RECORDS FOR [.text]:
> OFFSET   TYPE              VALUE
> 00000000 R_MIPS_HI16       .bss+0x00000004
> 00000008 R_MIPS_LO16       .bss+0x00000004
> 00000014 R_MIPS_LO16       .bss+0x00000004
>
> We load the hi16 value into a register and then use multiple lo16  
> offsets for the follow loads and stores to the same location.  On a  
> read-modify-write we only want to load the base address one time.

This particular case is covered by the old MIPS Processor psABI:

	R_MIPS_LO16 entries without an R_MIPS_HI16 entry immediately preceding
	are orphaned and the previously defined R_MIPS_HI16 is used for
	computing the addend.

The code in module.c looks like it implements the extension to which Ralf
refers.

> David Daney

David VomLehn

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux