#5495: simple program fails with -shared on mac
-------------------------------+--------------------------------------------
    Reporter:  mwotton         |        Owner:                    
        Type:  bug             |       Status:  new               
    Priority:  normal          |    Milestone:  7.4.1             
   Component:  Compiler        |      Version:  7.2.1             
    Keywords:                  |     Testcase:                    
   Blockedby:                  |   Difficulty:                    
          Os:  MacOS X         |     Blocking:                    
Architecture:  x86_64 (amd64)  |      Failure:  Compile-time crash
-------------------------------+--------------------------------------------
Changes (by igloo):

  * owner:  igloo =>
  * priority:  high => normal


Comment:

 Ah, I hadn't noticed it was ld segfaulting. Here's a cut-down case:
 {{{
 $ cat h2.s
 .text
 .globl _Main_main_info
 _Main_main_info:
         leaq _ghczmprim_GHCziUnit_Z0T_closure(%rip),%rax
         jmp _base_GHCziBase_return_info
 $ gcc -m64 -fno-stack-protector -c h2.s -o h2.o
 $ gcc -m64 -fno-stack-protector -dynamiclib -o h h2.o -undefined
 dynamic_lookup
 collect2: ld terminated with signal 11 [Segmentation fault: 11]
 $ gcc --version
 i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build
 5658) (LLVM build 2335.15.00)
 Copyright (C) 2007 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
 PURPOSE.
 }}}

 Interestingly, in 32bit mode we get an error when assembling:
 {{{
 $ gcc -m32 -fno-stack-protector -c h2.s -o h2.o
 h2.s:4:`_ghczmprim_GHCziUnit_Z0T_closure(%rip)' is not a valid base/index
 expression
 }}}
 when compiling with an i386 compiler we instead generate:
 {{{
     movl $_ghczmprim_GHCziUnit_Z0T_closure+1,-12(%ebp)
 }}}

 Does anyone know if this is our bug or Apple's?

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5495#comment:3>
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