ghci segfaults with +RTS -xp
Summary
ghci segfaults with +RTS -xp
Steps to reproduce
Build ghc 8.10.x with
DYNAMIC_GHC_PROGRAMS=NO
GhcLibWays = v
WAY_v_HC_OPTS = -fPIC -fexternal-dynamic-refs
Start ghci with +RTS -xp
Expected behavior
I would expect ghci to start correctly, but it segfaults:
gdb --args inplace/lib/bin/ghc-stage2 -Binplace/lib +RTS -xp -RTS --interactive
GNU gdb (GDB) 9.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-facebook-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
3.8.6 (default, Sep 24 2020, 10:35:22)
[GCC 9.x 20200523 10.x]
Script information not found in binary, assuming oldest version
Reading symbols from inplace/lib/bin/ghc-stage2...
(gdb) run
Starting program: /scratch/fbghc/inplace/lib/bin/ghc-stage2 -Binplace/lib +RTS -xp -RTS --interactive
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/local/fbcode/platform009/lib/libthread_db.so.1".
[New Thread 0x7fffea9e3700 (LWP 3835072)]
[New Thread 0x7fffea1e2700 (LWP 3835074)]
[New Thread 0x7fffe99e1700 (LWP 3835076)]
[New Thread 0x7fffe91e0700 (LWP 3835078)]
GHCi, version 8.10.1: https://www.haskell.org/ghc/ :? for help
[Detaching after vfork from child process 3835080]
[Detaching after vfork from child process 3835088]
[Detaching after vfork from child process 3835094]
[Detaching after vfork from child process 3835102]
[Detaching after vfork from child process 3835114]
[Detaching after vfork from child process 3835120]
[Detaching after vfork from child process 3835126]
[Detaching after vfork from child process 3835132]
[Detaching after vfork from child process 3835138]
[Detaching after vfork from child process 3835144]
Thread 1 "ghc-stage2" received signal SIGSEGV, Segmentation fault.
0x00007fffda197900 in ?? ()
(gdb) bt
#0 0x00007fffda197900 in ?? ()
#1 0x0000000003d548a1 in ocRunInit_ELF (oc=oc@entry=0x4600090) at rts/linker/Elf.c:1917
#2 0x0000000003d3f04f in ocTryLoad (oc=0x4600090) at rts/Linker.c:1689
#3 ocTryLoad (oc=0x4600090) at rts/Linker.c:1629
#4 0x0000000003d3f2f9 in resolveObjs_ () at rts/Linker.c:1719
#5 resolveObjs () at rts/Linker.c:1738
#6 0x0000000003a241a8 in ghcizm8zi10zi1_GHCiziObjLink_resolveObjs1_info () at rts/Linker.c:530
#7 0x0000000000000000 in ?? ()
Environment
- GHC version used: 8.10.1
Optional:
- Operating System: Linux
- System Architecture: x64