missing ELF relocations

Simon Marlow simonmar at microsoft.com
Mon Aug 1 09:30:49 EDT 2005


On 31 July 2005 22:41, Ganesh Sittampalam wrote:

> I have an object file that I'd like to load with GHCi. It seems this
> object file has some relocations that Linker.c doesn't support - I get
> this message:
> 
> final link ... ghc-6.4: HSperl.o: unhandled ELF relocation(Rel) type
> 10 
> 
> Looking in elf.h, type 10 is R_386_GOTPC, which appears repeatedly as
> 
> 00017f76 R_386_GOTPC       _GLOBAL_OFFSET_TABLE_
> 
> The file also has relocations like this, which also seem to be cases
> not handled in Linker.c
> 
> 00017fa9 R_386_GOTOFF      .LC11
> 00018096 R_386_PLT32       Perl_croak
> 000180cc R_386_GOT32       XS_DynaLoader_dl_load_file
> 
> Google suggests that someone else has already run into this problem
> while trying to use an object compiled with gcc stack protection. In
> my case, the object file I'm trying to link with is DynaLoader.o,
> contained in DynaLoader.a that comes with any Perl distribution.

I'm guessing that DynLoader.o was compiled with -fPIC, which causes it
to use the GOT and PLT to address external symbols.  The easiest way to
load this into GHCi is to turn it into a shared library with something
like 'gcc -shared foo.o -o libfoo.so' and then say 'ghci libfoo.so'.

Cheers,
	Simon



More information about the Glasgow-haskell-bugs mailing list