This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Using an external linker [how ?]
First of all thanks to Sherry for the help she offered me.
But I think I need to go a bit deeper because it doesn't solve
my problem (so far).
I want to use ild "sun incremental linker" to link the output
of g++ (on sun). But, it doesn't work ! So I describe how I proceed.
I did something like this:
> setenv PATH .:<path_to_g++_binaries>
> ln -s /<path_to_ild>/ild ld
> g++ -no-gnu-linker -c *.C
> g++ -v -no-gnu-linker -o toto.exe *.o
[... lot of debug information...]
First surprise ild is not invoked, Solaris' ld is invoked instead !
But this executable (main.exe) works fine.
then I tried just to type the line "collect2 ..." that appears in the verbose
information
produced by last line:
> collect2 ......
Then (why ?) ild is invoked this time. But the new executable doesn't work.
> main.exe
Segmentation Fault.
And a look at the crash trace (gdb):
(gdb) bt
#0 0x0 in ?? ()
#1 0x112dc in __do_global_ctors_aux ()
#2 0x1100c in _init ()
So it still seems to be related to the global constructors
So if anyone has any idea, I would be grateful since I tried everything I thought of !
Thanks,
David.
Sherry:
> g++ man pages:
>
> > -fno-gnu-linker
> > Do not output global initializations (such as C++
> > constructors and destructors) in the form used by
> > the GNU linker (on systems where the GNU linker is
> > the standard method of handling them). Use this
> > option when you want to use a non-GNU linker, which
> > also requires using the collect2 program to make
> > sure the system linker includes constructors and
> > destructors. (collect2 is included in the GNU CC
> > distribution.) For systems which must use col
> > lect2, the compiler driver gcc is configured to do
> > this automatically.