Andreas Klebinger pushed to branch wip/andreask/linker_fix at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • rts/linker/LoadArchive.c
    ... ... @@ -510,6 +510,17 @@ HsInt loadArchive_ (pathchar *path)
    510 510
     
    
    511 511
             DEBUG_LOG("Found member file `%s'\n", fileName);
    
    512 512
             bool is_symbol_table = strcmp("", fileName) == 0;
    
    513
    +#if defined(OBJFORMAT_MACHO)
    
    514
    +        if (!is_symbol_table) {
    
    515
    +            /* Darwin ranlib symbol tables are named __.SYMDEF* */
    
    516
    +            if (strncmp(fileName, "__.SYMDEF", sizeof("__.SYMDEF")) == 0 ||
    
    517
    +                strncmp(fileName, "__.SYMDEF SORTED", sizeof("__.SYMDEF SORTED")) == 0 ||
    
    518
    +                strncmp(fileName, "__.SYMDEF_64", sizeof("__.SYMDEF_64")) == 0 ||
    
    519
    +                strncmp(fileName, "__.SYMDEF_64 SORTED", sizeof("__.SYMDEF_64 SORTED")) == 0) {
    
    520
    +                is_symbol_table = true;
    
    521
    +            }
    
    522
    +        }
    
    523
    +#endif
    
    513 524
     
    
    514 525
     /////////////////////////////////////////////////
    
    515 526
     // We found the member file. Load it into memory.
    
    ... ... @@ -596,6 +607,7 @@ HsInt loadArchive_ (pathchar *path)
    596 607
     #endif
    
    597 608
                 if (isThin) {
    
    598 609
                     if (!readThinArchiveMember(memberSize, path, fileName, image)) {
    
    610
    +                    errorBelch("Failed to read thin member %" PATH_FMT"\n", path);
    
    599 611
                         goto fail;
    
    600 612
                     }
    
    601 613
                 }
    
    ... ... @@ -630,6 +642,7 @@ HsInt loadArchive_ (pathchar *path)
    630 642
                     IF_DEBUG(linker, ocDebugBelch(oc, "Faild to verify ... skipping."));
    
    631 643
                     errorBelch("Faild to verify ... skipping.");
    
    632 644
                     freeObjectCode( oc );
    
    645
    +                //TODO: Unmap or free image
    
    633 646
                     continue;
    
    634 647
                 }
    
    635 648
     
    
    ... ... @@ -752,4 +765,3 @@ bool isArchive (pathchar *path)
    752 765
         }
    
    753 766
         return strncmp(ARCHIVE_HEADER, buffer, sizeof(ARCHIVE_HEADER)-1) == 0;
    
    754 767
     }
    755
    -