#4013: build fails on OS X: Invalid Mach-O file:Address out of bounds while
relocating object file
-------------------------+--------------------------------------------------
    Reporter:  igloo     |        Owner:                     
        Type:  bug       |       Status:  new                
    Priority:  highest   |    Milestone:  6.14.1             
   Component:  Compiler  |      Version:  6.13               
    Keywords:            |   Difficulty:                     
          Os:  MacOS X   |     Testcase:                     
Architecture:  x86       |      Failure:  Building GHC failed
-------------------------+--------------------------------------------------

Comment(by PHO):

 I have examined the problem a bit:

 Linker.c:4265:
 {{{
 #ifdef powerpc_HOST_ARCH
                     else if(scat->r_type == PPC_RELOC_SECTDIFF
                         || scat->r_type == PPC_RELOC_LO16_SECTDIFF
                         || scat->r_type == PPC_RELOC_HI16_SECTDIFF
                         || scat->r_type == PPC_RELOC_HA16_SECTDIFF
                         || scat->r_type == PPC_RELOC_LOCAL_SECTDIFF)
 #else
                     else if(scat->r_type == GENERIC_RELOC_SECTDIFF
                         || scat->r_type == GENERIC_RELOC_LOCAL_SECTDIFF)
 #endif
                     {
                         struct scattered_relocation_info *pair =
                                 (struct scattered_relocation_info*)
 &relocs[i+1];

                         if(!pair->r_scattered || pair->r_type !=
 GENERIC_RELOC_PAIR)
                             barf("Invalid Mach-O file: "
                                  "RELOC_*_SECTDIFF not followed by
 RELOC_PAIR");

                         word = (unsigned long)
                                (relocateAddress(oc, nSections, sections,
 scat->r_value)
                               - relocateAddress(oc, nSections, sections,
 pair->r_value));
                         i++;
                     }
 }}}
 The relocation problem occured at the following line:
 {{{
                               - relocateAddress(oc, nSections, sections,
 pair->r_value));
 }}}
 Investigating further with gdb:
 {{{
 (gdb) p *scat
 $11 = {
   r_scattered = 1,
   r_pcrel = 0,
   r_length = 2,
   r_type = 8, // PPC_RELOC_SECTDIFF
   r_address = 2237192, // 0x00222308
   r_value = 3585652
 }

 (gdb) p *pair
 $13 = {
   r_scattered = 1,
   r_pcrel = 0,
   r_length = 2,
   r_type = 1,
   r_address = 0,
   r_value = -60264 // wtf?
 }

 (gdb) p (unsigned long)pair->r_value
 $43 = 4294907032 // 0xffff1498: Way too large.
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4013#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to