Re: ld terminated with signal 11



vsouders@xxxxxxxxxxxxxx wrote:

> the simple test code shown below, the linker terminates with a signal
> 11.

Signal 11 on a x86 Linux box is a segfault. Tradtionally, the most
likely reason for that to occur in a GCC run is unstable hardware,
often flaky RAM --- GCC uses pointers all over the place extensively
enough that any memory glitch is almost guaranteed to crash it. The
linker OTOH isn't particularly renowned for serving as hardware tester
in this way --- but that's usually because GCC will have crashed long
before the linker even gets to be run on a job large enough to trigger
this.

> If I remove the iostream include and the cout statement, the
> application compiles and links without errors. Does this mean the
> linker is attempting to link against an incorrect lib version?

Quite possibly. Add -v and perhaps -Wl,-v flags to your link command
and observe what's actually happening. Pay special attention to what
startup code and libraries get used.

And BTW: before you call that test code "simple", do yourself a favour
and look at what the preprocessor makes out of it. Here's a small
experiment using a more current GCC and native tools on Linux:

~> echo "#include <iostream>" > tt.cc
~> gcc -E tt.cc | wc
27753 66420 717061

I don't know about you, but I'm not particularly willing to accept
more than half a megabyte of C++ source as being a "simple test code".
The 'gcc -Q' listing of all method names alone is 125 kB!

--
Hans-Bernhard Broeker (broeker@xxxxxxxxxxxxxxxxxxxxx)
Even if all the snow were burnt, ashes would remain.
.



Relevant Pages

  • Install problem with js
    ... checking for gcc... ... checking whether we are using the GNU C compiler... ... checking whether the gcc linker supports shared libraries... ...
    (alt.os.linux.suse)
  • Re: GCC compiling- help needed
    ... Link all the object files to create an executable. ... The GNU assembler, 'gas', is part of the gcc setup and will convert assembly ... (along with any other compiler flags you need, ... I assume that's a linker script ("put the code starting at address 0x800000, ...
    (comp.arch.embedded)
  • Re: A Portable C Compiler
    ... It is an ASCII LINKER SCRIPT for GNU's "ld"... ... That is not part of gcc and the actual C library is available as a shared object, ... Most of the headers and system headers under linux are full of ... I think you will find that the headers for all C libraries use implementation specific tricks. ...
    (comp.lang.c)
  • symbol resolution on shard library.
    ... While learning about the mechaism of symbol resolution of a linker, ... : multiple definition of `malloc' ... I understand why above gcc excution failed. ...
    (comp.unix.programmer)
  • Re: Test Code for C-like Compilers
    ... available test code for C-like compilers -- samples designed to catch ... glitches, subtle unexpected behavior with control flow, etc. ... [The regression suite for gcc is probably the best you can do for free. ...
    (comp.compilers)