Opened 5 months ago

Closed 3 months ago

#8564 closed task (wontfix)

Unhandled ELF relocation types on dynamically loading object files with GHCi

Reported by: pgj Owned by: pgj
Priority: normal Milestone:
Component: GHCi Version: 7.6.3
Keywords: Cc: hvr
Operating System: FreeBSD Architecture: Unknown/Multiple
Type of failure: GHCi crash Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

GHCi cannot handle ELF symbols with relocation types 15 (i386) and 22 (amd64) (such as ThreadRuneLocale, coming from libc on systems later than 9.0) when dynamically loading object files.

This can be reproduced by the issuing the following commands:

# pkg install hs-hs-bibutils
..
$ ghci
Prelude> :m Text.Bibutils
Prelude> bibl_init
Loading package syb-0.4.0 ... linking ... done.
Loading package hs-bibutils-5.0 ... linking ... <interactive>: /usr/local/lib/cabal/ghc-7.6.3/hs-bibutils-5.0/HShs-bibutils-5.0.o: unhandled ELF relocation(Rel) type 15
ghc: unable to load package `hs-bibutils-5.0'
Prelude>

The source file rts/Linker.c, function do_Elf_Rela_relocations() is missing the case branches for types 15 (R_386_TLS_IE) and 22 (R_X86_64_GOTTPOFF). They shall be implemented for FreeBSD.

Change History (5)

comment:1 follow-up: Changed 5 months ago by carter

does the same problem happen in ghci in head? 'cause i think ghci 7.7 / HEAD on those platforms should be using the system dy linker. That said, definitely should be fixed! :)

comment:2 in reply to: ↑ 1 Changed 5 months ago by pgj

Replying to carter:

does the same problem happen in ghci in head?

Yes, I have just tested with the snapshot of today on i386. R_X86_64_GOTTPOFF is implemented for DragonFly BSD only, while R_386_TLS_IE does not seem to be handled everywhere at all.

'cause i think ghci 7.7 / HEAD on those platforms should be using the system dy linker.

I am not entirely familiar with the internals of the GHCi linker, but apparently it directly loads .o files and that is where it relies on the routines of rts/Linker.c.

comment:3 Changed 5 months ago by carter

ok fair enough, I'm not super familiar with those pieces as yet myself, hence wondering outloud.

comment:4 Changed 3 months ago by pgj

Hm, it seems this is not required anymore since setting DYNAMIC_GHC_PROGRAMS=YES as default for FreeBSD too solves it.

comment:5 Changed 3 months ago by pgj

  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.