R_PPC_ADDR16_HI relocs in PPC modules ?

Simon Vallet linux-ppc at castalie.org
Wed Jan 3 05:09:44 EST 2007


On Tue, 2 Jan 2007 18:16:01 +0100
Segher Boessenkool <segher at kernel.crashing.org> wrote:

> Well you normally never end up with an add with an @h -- you're
> typically adding it to something that is loaded with "li", i.e.,
> something that's the sign-extended version of the low 16 bits of
> the 32-bit thing you're loading totally.

Mmm... I might need to get a deeper understanding of apply_relocate_add(), 
but if I'm not mistaken, ha also uses high bits

> I'm interested how (and why :-) ) Darwin ends up doing it; could
> you send me the (original) file in question?  Or an otool -tvV
> of it, or part thereof that shows the problem.

Sure. As an example, here is some output of otool -rV and the corresponding 
disassembled text section part

Relocation information (__TEXT,__text) 61126 entries
address  pcrel length extern type    scattered symbolnum/value
00000664 False long   False  LO16    False     1 (__TEXT,__text)
         False long   False  PAIR    False     half = 0x0000
00000660 False long   False  HI16    False     1 (__TEXT,__text)
         False long   False  PAIR    False     half = 0x2738
00000654 False long   False  LO16    False     1 (__TEXT,__text)
         False long   False  PAIR    False     half = 0x0000
00000650 False long   False  HI16    False     1 (__TEXT,__text)
         False long   False  PAIR    False     half = 0x83fc

00000650        lis     r12,hi16(_msw_report_event)
00000654        ori     r12,r12,lo16(_msw_report_event)
00000658        mtspr   ctr,r12
0000065c        bctr
00000660        lis     r12,hi16(_PRINT_ERROR)
00000664        ori     r12,r12,lo16(_PRINT_ERROR)
00000668        mtspr   ctr,r12
0000066c        bctr

As for the two symbols:
000083fc T _msw_report_event
00002738 T _PRINT_ERROR

Just tell me if you need more info.

Simon



More information about the Linuxppc-dev mailing list