[GHC] #10402: powerpc: unhandled ELF relocation(RelA) type 252

GHC ghc-devs at haskell.org
Mon Jun 15 22:58:15 UTC 2015


#10402: powerpc: unhandled ELF relocation(RelA) type 252
-----------------------------------+-----------------------------------
        Reporter:  cjwatson        |                   Owner:  simonmar
            Type:  bug             |                  Status:  patch
        Priority:  normal          |               Milestone:  7.10.2
       Component:  Runtime System  |                 Version:  7.8.4
      Resolution:                  |                Keywords:
Operating System:  Linux           |            Architecture:  powerpc
 Type of failure:  Runtime crash   |               Test Case:
      Blocked By:                  |                Blocking:
 Related Tickets:                  |  Differential Revisions:
-----------------------------------+-----------------------------------

Comment (by slyfox):

 I think the source of new relocations is GHC itself:
     a93ab43ab5f40cadbedea2f6342b93c245e91434
 It started generating proper PIC files for all (including .c) code
 recently.

 {{{
 [sf] /tmp:powerpc64-unknown-linux-gnu-gcc -c -m32 -O2 a.c && objdump -d -r
 a.o

 a.o:     file format elf32-powerpc


 Disassembly of section .text:

 00000000 <g>:
    0:   94 21 ff f0     stwu    r1,-16(r1)
    4:   38 21 00 10     addi    r1,r1,16
    8:   48 00 00 00     b       8 <g+0x8>
                         8: R_PPC_REL24  f
 [sf] /tmp:powerpc64-unknown-linux-gnu-gcc -fPIC -c -m32 -O2 a.c && objdump
 -d -r a.o

 a.o:     file format elf32-powerpc


 Disassembly of section .text:

 00000000 <g>:
    0:   94 21 ff e0     stwu    r1,-32(r1)
    4:   7c 08 02 a6     mflr    r0
    8:   42 9f 00 05     bcl     20,4*cr7+so,c <g+0xc>
    c:   93 c1 00 18     stw     r30,24(r1)
   10:   90 01 00 24     stw     r0,36(r1)
   14:   7f c8 02 a6     mflr    r30
   18:   3f de 00 00     addis   r30,r30,0
                         1a: R_PPC_REL16_HA      .got2+0x800e
   1c:   3b de 00 00     addi    r30,r30,0
                         1e: R_PPC_REL16_LO      .got2+0x8012
   20:   48 00 00 01     bl      20 <g+0x20>
                         20: R_PPC_PLTREL24      f+0x8000
   24:   80 01 00 24     lwz     r0,36(r1)
   28:   83 c1 00 18     lwz     r30,24(r1)
   2c:   38 21 00 20     addi    r1,r1,32
   30:   7c 08 03 a6     mtlr    r0
   34:   4e 80 00 20     blr
 }}}

 What bothers me is why ghci tries o load .a/.o file manually at all.
 It should use system linker. by creating/dlopen()ing temp .so object.

 Does debian disable dynamic GHC by default as
     DYNAMIC_GHC_PROGRAMS = NO
 ?

 From the above I suspect '''R_PPC_PLTREL24''' might require +0x8000 offset
 and should be PLT relative. I'll try to look at it tomorrow.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10402#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list