linking problem

Ian Lance Taylor
Thu Oct 7 18:50:00 GMT 1999

   Date: Thu, 7 Oct 1999 19:36:54 -0500 (EST)
   From: Lynn Winebarger <>

      Hi.  I'm having a couple of problems I thought someone might know the
   answer(s) to.  The first is that ld dies of a segmentation fault when I
   run it as a user other than root (seems to work all right as root).  I'm
   running Mandrake Linux 6.0.

I think we'll need more information about that one, like at least a
backtrace showing where the segfault is occurring.  It's hard to
imagine why ld would care whether it was run by root or not.

      The other is slightly more complex.  I'm converting parts of the code
   in objdump and the disassemblers (namely the i386 disassembler) to return
   values for Petite Chez Scheme (a freely redistributable - but not free -
   Scheme interpreter derived from Chez Scheme).  Anyway, I'm supposed to
   link my code (that uses some simple scheme functions, like scheme value
   constructors) to the Petite Chez Scheme executable to get a library, which
   is then accessed by the interpreter. The problem is that the bfd/iberty
   libraries require stuff from libc.  If I try to statically link them all
   together (the converted disassembler/objdump functions, libbfd, libiberty,
   the scheme executable, and libc) I get conflicts between the scheme
   executable and libc (the order of linking seems to affect this - I know
   there's a reason for this, but I can't recall it and the documentation of
   ld doesn't say a lot about the effects of file order), such as the
   definition of __init, and environ.  If I try linking the object files as
   shared objects (with the other stuff - the scheme interpreter doesn't seem
   to deal with resolving undefined references), then there are conflicts
   between the scheme executable and the object files (I think) for sections
   like the global offset table.
      Has anyone got any ideas on a way to resolve this, short of making my
   own "libc" that provides what libbfd and libiberty need?

This question no doubt has a simple answer, but I don't understand
what you mean when you that you link your object code to an
executable.  How can you link to an executable?  It doesn't seem
surprising that there are multiply defined symbols in that case.


More information about the Binutils mailing list