This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Binary crashes on another SGI system


Hi all,

I'd like to hope that the following is a known problem...

This happens on SGI workstations with Irix 6.5 and 6.2 and
gcc 2.95.2.

I compile this little program:

    #include <iostream.h>
    int main()
    {
       cout << "This works\n";
    }

by  g++ -c -g -mips4 -mabi=n32 -fexceptions -ansi
and link it with libraries required by the original
application. When run, it crashes before any statement
is executed, with the following stack of calls:

    Core from signal SIGSEGV: Segmentation violation
    (dbx) where
    >  0 ios::init(streambuf*)(0x0, 0x1003c098,
         0x1003c098, 0x2, 0x2, 0x0, 0xfbe0090, 0x0)
         ["/comp88/mtibuild/v7312m/workarea/v7.3.1.2m/
         libC/iostreams/stream.cxx":35, 0xae324f0]
       1 ostream_withassign::operator=(streambuf*)
         (0x10035fa0, 0x1003c098, 0x1003c098, 0x2, 0x2,
         0x0, 0xfbe0090, 0x0)  ["/comp88/mtibuild/
         v7312m/workarea/v7.3.1.2m/libC/iostreams/
         stream.cxx":290, 0xae339b8]
       2 Iostream_init::Iostream_init(void)(0x1, 0x1003c098,
         0x1003c098, 0x2, 0x2, 0x0, 0xfbe0090, 0x0)
         ["/comp88/mtibuild/v7312m/workarea/v7.3.1.2m/
         libC/iostreams/cstreams.cxx":63, 0xae25b20]
       3 ::_main(0x0, 0x1003c098, 0x1003c098, 0x2, 0x2,
         0x0, 0xfbe0090, 0x0)  ["/comp88/mtibuild/
         v7312m/workarea/v7.3.1.2m/libC/lang_support/
         c++init.cxx":77, 0xae1f944]
       4 <Unknown>() [< unknown >, 0xae61b28]

This only happens when libC.so.2 is included in the executable.
This library is requested by libGLU.so  that the real
application needs to use.

I thought that may be it's a conflict between gcc and SGI
libraries (as gcc docs warn about possible conflicts with
vendor libraries) and deceived the linker by placing
a soft link named libC.so.2 pointing to a harmless library
(I took libm.so) so that it is found earlier than the real
libC.so.2.

Then the executable works. But when I run it on another SGI
workstation, it crashes at the same stage as above. The same
happens when the program is created on the second computer
and runs on the first.

Here is the complete list of linker options:

/usr/bin/ld -mips4 -call_shared -no_unresolved -init __do_global_ctors
-fini __do_global_dtors -_SYSTYPE_SVR4 -woff 131 -n32 -o t
/usr/lib32/mips4/crt1.o
/usr/local/lib/gcc-lib/mips-sgi-irix6.5/2.95.2/crtbegin.o
-L$(SZF_OBJ_HOME)/sgi_mips4/libx
-L/usr/local/lib/gcc-lib/mips-sgi-irix6.5/2.95.2 -L/usr/bin
-L/usr/local/lib -v -wall t.o -lstdc++ -lgcc -lpthread -lm -lc -lGLw
-lGL -lGLU -lMrm -lXext -lXm -lXt -B static -lXpm -B dynamic -lX11
-ljpeg -dont_warn_unused -lgcc -warn_unused -L/usr/lib32/mips4
-L/usr/lib32 -dont_warn_unused -lc -warn_unused -dont_warn_unused -lgcc
-warn_unused /usr/local/lib/gcc-lib/mips-sgi-irix6.5/2.95.2/crtend.o
/usr/lib32/mips4/crtn.o

and the list of used libraries printed by elfdump -Dl
(after the trick with libC.so.2):

 Flags   Name            Version
 -----   libpthread.so   sgi1.0
 -----   libm.so         sgi1.0
 -----   libc.so.1       sgi1.0
 -----   libGL.so        sgi1.0
 -----   libGLU.so       sgi1.0
 -----   libMrm.so.1     Based on OSF/Motif 1.2.4#sgi1.0
 -----   libXext.so      sgi1.0
 -----   libXm.so.1      SGI LOOK -- Based on OSF/Motif 1.2.4#sgi1.0
 -----   libXt.so        sgi1.0
 -----   libX11.so.1     sgi1.0

The first SGI computer has Irix 6.5 and the second Irix 6.2.
The two libGLU libraries have only different timestamps,
while size and checksum are identical.

Evidently libm.so is not responsible for the crash,
as linking with libm.so without libGLU.so is perfectly
portable.  Also, I checked that there is no other library
than libC.so.2 that is linked by request of libGLU.so.
(In other words, portable and non-portable executables
differ only by presence of libGLU.so, according to
elfdump -Dl.)


Could anyone suggest how to make it work, or at least
how to approach the solution?

Thank you very much,

Maria


--
Maria Babikova
Developer, Procision Analysis Inc. (http://www.procision.com)
mbabikova@procision.com
(905) 279-35-25 ext 28




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]