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

Commits:

2 changed files:

Changes:

  • configure.ac
    ... ... @@ -351,15 +351,23 @@ fi
    351 351
     
    
    352 352
     dnl ** Building a cross compiler?
    
    353 353
     dnl --------------------------------------------------------------
    
    354
    -CrossCompiling=NO
    
    355
    -# If 'host' and 'target' differ, then this means we are building a cross-compiler.
    
    356
    -if test "$target" != "$host" ; then
    
    357
    -    CrossCompiling=YES
    
    358
    -    cross_compiling=yes   # This tells configure that it can accept just 'target',
    
    359
    -                          # otherwise you get
    
    360
    -                          #   configure: error: cannot run C compiled programs.
    
    361
    -                          #   If you meant to cross compile, use `--host'.
    
    354
    +dnl We allow the user to override this since the target/host check
    
    355
    +dnl can get this wrong in some particular cases. See #26236.
    
    356
    +if test -z "$CrossCompiling" ; then
    
    357
    +    CrossCompiling=NO
    
    358
    +    # If 'host' and 'target' differ, then this means we are building a cross-compiler.
    
    359
    +    if test "$target" != "$host" ; then
    
    360
    +        CrossCompiling=YES
    
    361
    +    fi
    
    362
    +fi
    
    363
    +if test "$CrossCompiling" = "YES"; then
    
    364
    +    # This tells configure that it can accept just 'target',
    
    365
    +    # otherwise you get
    
    366
    +    #   configure: error: cannot run C compiled programs.
    
    367
    +    #   If you meant to cross compile, use `--host'.
    
    368
    +    cross_compiling=yes
    
    362 369
     fi
    
    370
    +
    
    363 371
     if test "$BuildPlatform" != "$HostPlatform" ; then
    
    364 372
        AC_MSG_ERROR([
    
    365 373
     You've selected:
    

  • rts/linker/LoadArchive.c
    ... ... @@ -140,6 +140,16 @@ static enum ObjectFileFormat identifyObjectFile_(char* buf, size_t sz)
    140 140
         if (sz > 4 && ((uint32_t*)buf)[0] == 0xfeedfacf) {
    
    141 141
             return MachO64;
    
    142 142
         }
    
    143
    +    // BigObj COFF files ...
    
    144
    +    if (sz > 8 && ((uint64_t*)buf)[0] == 0x86640002ffff0000) {
    
    145
    +        return COFFAmd64;
    
    146
    +    }
    
    147
    +    if (sz > 8 && ((uint64_t*)buf)[0] == 0x014c0002ffff0000) {
    
    148
    +        return COFFI386;
    
    149
    +    }
    
    150
    +    if (sz > 8 && ((uint64_t*)buf)[0] == 0xaa640002ffff0000) {
    
    151
    +        return COFFAArch64;
    
    152
    +    }
    
    143 153
         return NotObject;
    
    144 154
     }
    
    145 155