[GHC] #7040: linker failures with foreign global data (was: ghci segfault on OS X X86_64 with foreign global data)
GHC
cvs-ghc at haskell.org
Sat Jul 7 05:05:09 CEST 2012
#7040: linker failures with foreign global data
------------------------------+---------------------------------------------
Reporter: luite | Owner:
Type: bug | Status: new
Priority: normal | Component: Runtime System
Version: | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: Other | Testcase:
Blockedby: | Blocking:
Related: |
------------------------------+---------------------------------------------
Changes (by nus):
* failure: GHCi crash => Other
* version: 7.4.2 =>
* component: Compiler => Runtime System
* architecture: x86_64 (amd64) => Unknown/Multiple
Comment:
This involves multiple archithectures/OS'es, changing the ticket
properties. See the following example:
{{{
#include <stdio.h>
#include "global.h"
#if defined(__MINGW32__)
# if defined(__MINGW64_VERSION_MAJOR) && defined(__MINGW64__)
# define ARR_SIZE 0x0fffffff /* works when linked by ghc, fails with
ghci */
/* # define ARR_SIZE 0x1fffffff */ /* bad executable when linked by
ghc, fails to link with ghci */
# else
# define ARR_SIZE 0x1 /* this, and anything bigger fails to link with
ghci, works with ghc */
# endif
#elif defined(__APPLE__)
# if defined(__i386__)
# define ARR_SIZE 0x0fffffff /* works */
/* # define ARR_SIZE 0x1fffffff */ /* works when linked by ghc, causes
failure in malloc at ghci run-time */
/* # define ARR_SIZE 0x2fffffff */ /* refused by llvm-gcc as too large
*/
# elif defined(__x86_64__)
# define ARR_SIZE 0xffffffff /* works when linked by ghc, causes
failure in malloc at ghci run-time */
# endif
#elif defined(__linux__)
# if defined(__i386__)
# define ARR_SIZE 0x1fffffff
/* # define ARR_SIZE 0x2fffffff */ /* refused by gcc as too large */
# elif defined(__x86_64__)
/* # define ARR_SIZE 0x1fffffff */ /* works */
/* # define ARR_SIZE 0x2fffffff */ /* works when linked by ghc, causes
failure in malloc at ghci run-time */
/* # define ARR_SIZE 0x3fffffff */ /* SIGKILL'ed when linked by ghc,
causes failure in malloc at ghci run-time */
# endif
#endif
int x[ARR_SIZE];
void printx() {
printf("ARR_SIZE: %x\n", ARR_SIZE);
x[0] = 0;
printf("x: %d\n", x[0]);
x[0] = 1;
printf("x: %d\n", x[0]);
}
}}}
The versions the example was tested on:
{{{
Windows 7 SP1 x64.
x32:
CC: i686-w64-mingw32-gcc-4.6.3-release-win32_rubenvb.7z
GHC: ghc-7.4.1-i386-windows.exe
x64:
CC: x86_64-w64-mingw32-gcc-4.6.3-release-win64_rubenvb.7z
GHC: ghc-7.5.20120617-i386-windows.exe; HEAD("Project
version","7.5.20120705")("Booter version","7.5.20120617")
}}}
{{{
Mac OS X 10.7.3.
x32:
CC: gcc -m32 (i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on
Apple Inc. build 5658) (LLVM build 2336.9.00))
GHC: ghc-7.4.2-i386-apple-darwin.tar.bz2
x64:
CC: gcc (i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple
Inc. build 5658) (LLVM build 2336.9.00))
GHC: ghc-7.4.2-x86_64-apple-darwin.tar.bz2
}}}
{{{
Linux Ubuntu 12.04 LTS x64.
x32:
CC: gcc -m32 (gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3)
GHC: ghc-7.4.2-i386-unknown-linux.tar.bz2
x64:
CC: gcc (gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3)
GHC: ghc-7.4.2-x86_64-unknown-linux.tar.bz2
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7040#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list