[PATCH] ppc64: Add R_PPC64_TOC16 module reloc

Peter Bergner bergner at vnet.ibm.com
Wed Oct 12 00:55:00 EST 2005


On Tue, 2005-10-11 at 16:45 +0200, Christoph Hellwig wrote:
> On Wed, Oct 12, 2005 at 12:41:26AM +1000, Anton Blanchard wrote:
> > 
> > > Which module needs this relocation?
> > 
> > Why do you ask? Its a valid relocation and it looks like newer gcc
> > versions are starting to use it.
> 
> I remember cases where people tried to add odd relocation for ia64
> because their modules were doign really silly things.  If this is
> one that recent gcc generates it's fine obviously.

This is a valid gcc generated relocation.  The simplified test case
came from rtas_flash.ko.  Olaf also saw another use from scanlog.ko.

Peter


bergner at vervain:~/olaf> cat foo.c 
extern char rtas_data_buf[4096];
extern int rtas_call(unsigned int);

void validate_flash(void)
{
  rtas_call((unsigned int) (unsigned long)rtas_data_buf);
}
bergner at vervain:~/olaf> gcc -m64 -O1 -c foo.c 

bergner at vervain:~/olaf> objdump -dr foo.o 

foo.o:     file format elf64-powerpc

Disassembly of section .text:

0000000000000000 <.validate_flash>:
   0:   7c 08 02 a6     mflr    r0
   4:   f8 01 00 10     std     r0,16(r1)
   8:   f8 21 ff 91     stdu    r1,-112(r1)
   c:   80 62 00 04     lwz     r3,4(r2)
                        e: R_PPC64_TOC16        .toc+0x4
  10:   48 00 00 01     bl      10 <.validate_flash+0x10>
                        10: R_PPC64_REL24       .rtas_call
  14:   60 00 00 00     nop
  18:   38 21 00 70     addi    r1,r1,112
  1c:   e8 01 00 10     ld      r0,16(r1)
  20:   7c 08 03 a6     mtlr    r0
  24:   4e 80 00 20     blr
  28:   00 00 00 00     .long 0x0
  2c:   00 00 00 01     .long 0x1
  30:   80 00 00 00     lwz     r0,0(r0)






More information about the Linuxppc64-dev mailing list