[GHC] #11340: linker_unload test fails on ARM

GHC ghc-devs at haskell.org
Sat Jan 2 18:53:55 UTC 2016


#11340: linker_unload test fails on ARM
-------------------------------------+------------------------------
        Reporter:  bgamari           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:  arm
 Type of failure:  Runtime crash     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+------------------------------

Comment (by bgamari):

 Interesting, it appears that the linker built a symbol extra for this
 symbol due to a long jump.

 With this patch,
 {{{#!patch
 diff --git a/rts/Linker.c b/rts/Linker.c
 index cb90c97..0cf3fe5 100644
 --- a/rts/Linker.c
 +++ b/rts/Linker.c
 @@ -2731,6 +2731,7 @@ static int ocAllocateSymbolExtras( ObjectCode* oc,
 int count, int first )

    if (oc->symbol_extras != NULL) {
        memset( oc->symbol_extras, 0, sizeof (SymbolExtra) * count );
 +      IF_DEBUG(linker, debugBelch("Symbol extras at %p\n",
 oc->symbol_extras));
    }

    oc->first_symbol_extra = first;
 @@ -5019,7 +5020,7 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char*
 ehdrC,
        int is_target_thm=0, T=0;
  #endif

 -      IF_DEBUG(linker,debugBelch( "Rel entry %3d is raw(%6p %6p)",
 +      IF_DEBUG(linker,debugBelch( "Rel entry %3d is raw(%6p %6p): ",
                               j, (void*)offset, (void*)info ));
        if (!info) {
           IF_DEBUG(linker,debugBelch( " ZERO" ));
 @@ -5115,6 +5116,9 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char*
 ehdrC,
                 // The -8 below is to compensate for PC bias
                 offset = (StgWord32) &extra->jumpIsland - P - 8;
                 offset &= ~1; // Clear thumb indicator bit
 +               IF_DEBUG(linker, debugBelch("Made symbol extra %p due to
 %s\n",
 +                                           &extra->jumpIsland,
 +                                           overflow ? "overflow" :
 "R_ARM_JUMP24 to Thumb target"));
              } else if (is_target_thm && ELF_R_TYPE(info) == R_ARM_CALL) {
                 StgWord32 cond = (*word & 0xf0000000) >> 28;
                 if (cond == 0xe) {
 @@ -5123,6 +5127,8 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char*
 ehdrC,
                    *word = (*word & ~0x01ffffff)
                          | ((offset >> 2) & 0x00ffffff)  // imm24
                          | ((offset & 0x2) << 23);       // H
 +
 +                  IF_DEBUG(linker, debugBelch("Changed BL to BLX at
 %p\n", word));
                    break;
                 } else {
                    errorBelch("%s: Can't transition from ARM to Thumb when
 cond != 0xe\n",
 }}}
 I see,
 {{{
 Rel entry  49 is raw( 0x21c 0x461c): lookupSymbol: looking up
 foreignExportStablePtr
 lookupSymbol: value of foreignExportStablePtr is 0x3ece80c
 `foreignExportStablePtr' resolves to 0x3ece80c
 Reloc: P = 0xb6ff7224   S = 0x3ece80c   A = 0xebfffffe
 Made symbol extra 0xb4f6cf70 due to overflow
 }}}

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


More information about the ghc-tickets mailing list