🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Knut Ole Hovda Mon, 18 Dec 1995 11:17
Problem with static linking on aix with gcc2.6.3
#860
Author: Knut Ole Hovda
Date: Mon, 18 Dec 1995 11:17
71 lines
3358 bytes
Hello,

I have an application written in C++, which also links in a library 
written in Fortran. It uses no X11 libraries, it simply reads a file,
processes the data, and writes an ASCII file.

The application is running fine on my machine (RS6000 model 250 running 
aix3.2.5), but crashes when our customers run it:

  "child killed: Illegal instruction (core dumped)"

This happens on the same version of the operating system, and for two 
different customers. None of them probably have gcc installed, though.

So far we have assumed that this indicates that the application isn't 
properly statically linked. On aix, this can be checked with the dump -H 
command, which gives

                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER              
0      /system/madeira_3c/pubdom/aix/lib:/usr/lib:/lib                                        
1                                    libc.a              shr.o               
2                                    libxlf90.a          xlfsys.o            
3                                    libxlf90.a          io.o                

Using the option -static to gcc however, gives a much larger executable, 
and dump -H now gives

                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER              
0      
/system/madeira_3c/pubdom/aix/lib/gcc-lib/powerpc-ibm-aix3.2.5/2.6.3:/sy
stem/madeira_3c/pubdom/ 
1      /                             unix                                    

which should indicate it now is statically linked. But our customers 
still have the same problem: The executable crashes, even though it runs 
fine here!

So my question is how one can achieve static linking on aix when using 
gcc. Or can there be another explanation to the problem?

>From the makefile:

C+ = g++
../$(SYS)/c-orion-1 : $(OBJECTS) $(LIB1) $(LIB2) $(LIB1)
        $(C+) $(LDFLAGS) $(OBJECTS) $(LIB1) $(LIB2) $(LIB1) 
$(POST_LDFLAGS)

CFLAGS = -D$(SYS) -DINSERT_UNDERSCORE
LDFLAGS  = -static -o ../$(SYS)/c-orion-1 
POST_LDFLAGS  = /usr/lpp/xlf/lib/lowsys.exp -lxlf90 -lm 
#
LIB1 = ${SCPSSHOME}/helaux-1.2/aix/object/helaux-1.2.a

The IBM Fortran manual suggests:

LDFLAGS  = -bnso -bI:/usr/lib/syscalls.exp -o ../$(SYS)/c-orion-1 

With this, it links fine, but the executable crashes with a segmentation 
fault!

Any hints are appreciated. Please respond directly to kho@scandpower.no,
as I usually don't have access to news.

--
Knut Hovda                                      E-mail: kho@scandpower.no
Consultant, Software Development                Phone: +47 63 81 49 20
Division for Nuclear and Petroleum Engineering  Fax: +47 63 81 88 22
Scandpower A/S, International Consultants       Address: P.O. Box 3
--                                              N-2007 Kjeller, NORWAY
Re: Problem with static linking on aix with gcc2.6.3
#862
Author: Andrew Gierth
Date: Tue, 19 Dec 1995 04:10
52 lines
2967 bytes
[I am also mailing this response to the poster]

In <4b3ijh$lqp@nntp.nta.no>, knuthov@hydra.unik.no (Knut Ole Hovda) writes:
>Hello,
>
>I have an application written in C++, which also links in a library 
>written in Fortran. It uses no X11 libraries, it simply reads a file,
>processes the data, and writes an ASCII file.
>
>The application is running fine on my machine (RS6000 model 250 running 
>aix3.2.5), but crashes when our customers run it:
>
>  "child killed: Illegal instruction (core dumped)"
>
>This happens on the same version of the operating system, and for two 
>different customers. None of them probably have gcc installed, though.
>
>So far we have assumed that this indicates that the application isn't 
>properly statically linked. On aix, this can be checked with the dump -H 
>command, which gives
[snip]
>which should indicate it now is statically linked. But our customers 
>still have the same problem: The executable crashes, even though it runs 
>fine here!
>
>So my question is how one can achieve static linking on aix when using 
>gcc. Or can there be another explanation to the problem?

I think this is more likely to be a difference in CPU type. You don't
mention what box your customer is running, but I bet it's based on the
POWER or POWER2 CPU, whereas your 250 is a PowerPC 601.

If you built and installed GCC on your 250, then it will have detected
the CPU type and arranged to emit code generated and optimized for the
PPC601. I know from personal experience that this allows instructions
to appear in the executable which are not legal on the POWER chipset.

It is possible to install GCC such that it generates 'common mode' code
which will run on either platform; this is what the IBM compilers do
by default. Look at README.RS6000 in your GCC sources, and remember
that you will also need to rebuild libgcc.a in common mode as well.

>--
>Knut Hovda                                      E-mail: kho@scandpower.no
>Consultant, Software Development                Phone: +47 63 81 49 20
>Division for Nuclear and Petroleum Engineering  Fax: +47 63 81 88 22
>Scandpower A/S, International Consultants       Address: P.O. Box 3
>--                                              N-2007 Kjeller, NORWAY

-- Andrew  (andrewg@microlise.co.uk)

[.sig still under construction]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads