Ticket #781 (new bug)

Opened 2 years ago

Last modified 10 months ago

GHCi on x86_64, cannot link to static data in shared libs

Reported by: guest Assigned to:
Priority: normal Milestone: _|_
Component: Compiler Version: 6.5
Severity: normal Keywords: getEnvironment
Cc: Difficulty: Unknown
Test Case: getEnvironment01 Architecture: x86_64 (amd64)
Operating System: Linux

Description

System.Posix.getEnvironment fails on Linux 2.6.16-1.2108_FC4smp with a segfault. (x86_64)

[aleator@thoth HopenCV]$ ghci
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.5.20060527, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base-1.0 ... linking ... done.
Prelude> :m +System.Posix.Env
Prelude System.Posix.Env> getEnv "USER"
Loading package unix-1.0 ... linking ... done.
Just "aleator"
Prelude System.Posix.Env> getEnvironment
Segmentation fault

Change History

05/31/06 07:50:41 changed by simonmar

  • os changed from Unknown to Linux.
  • architecture changed from Unknown to x86_64 (amd64).
  • summary changed from getEnvironment segfaults (6.5.20060527 - snapshot) to GHCi on x86_64, cannot link to static data in shared libs.

I've fixed part of the problem (getEnvironment was broken), but this still won't work with GHCi on x86_64 due to another problem: for annoying reasons the dynamic linker doesn't support linking to static data in shared libraries, which the 'environ' variable in C is. So I'm leaving the bug open with a revised heading.

10/20/06 14:53:32 changed by igloo

  • testcase set to getEnvironment01.
  • milestone set to 6.6.1.

11/17/06 06:54:22 changed by simonmar

  • milestone changed from 6.6.1 to 6.8.

If we get shared libraries working, this one will be fixed.

11/12/07 06:23:43 changed by simonmar

  • milestone changed from 6.8 branch to _|_.

We've committed Wolfgang's patch to Linker.c that understands the PIC relocations on x86_64. This means that it is possible to compile the Haskell code using -fPIC to workaround this problem. Shared libraries will also make this less of an issue, as it will then only be a problem for modules rather than packages that are loaded into GHCi.