This is the mail archive of the 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]

Help with global partitions

This is a first time post to the list, so I'm not sure this is where it
But here goes:

Our application is a Nuclear Power Station Training Simulator.
The main simulator task is written in C and controls
simulator models written in FORTRAN.  The user interface is also 
written in C.
The computer environment is a SGI Challenge R4400 processor
running IRIX 6.5.4,  N32 ABI,  MIPS3.
Data sharing is performed using SGI shared memory segments

The following statement is an example of how the shared memory
segments are defined and logical address assigned in C
This C routine is used to attach the globals to the correct
logical location for the FORTRAN models.

        .globl  global_snp_
global_snp_      = 0x8300000

Using gcc this does not work.   It does not assign the logical
address of global_snp to 8300000.  During debugging of this
problem I created a small FORTRAN pgm and a C definition source
as follows:

C routine:-> Filename bshareG.s

        .globl  global_snp_
global_snp_      = 0x8300000

FORTRAN routine:-> Filename bshare.f
      program bshare
      integer *4 shmat 
      integer*4 shmid /3/
      integer*4 shmflg
      integer*4 ibob
      integer*4 ikey /334/

      CHARACTER*1 G_snp
      real*4 R_snp(49152)
      CHARACTER*1 G_sys 
      REAL*4    xrecao(4)
      EQUIVALENCE (xrecao,G_snp(9720))
      ibob = %loc(G_snp)
      iret = shmat (shmid, ibob, shmflg)
      iret = shmdt (ibob)
1000  format(1x,'bshare ',z8,2x,f10.6,2x,f10.6) 
1001  format(1x,'ibob   ',z8)
3000  format(i5)

I compile C routine using:

gcc -o bshareG.o bshareG.s

Then compile and link using

g77 -o bshare bshare.f bshareG.o -lftn
Note:  The -lftn is required to find the shmat function.

The program will die with a Segmentation fault.
It runs correctly if the SGI cc and f77 are used.
The simulator application also runs correctly under the SGI
compilers.  Under gcc the simulator application does
not abort but the commons are not attached correctly.

Is there a way we are not aware of to use global shared memory under gcc?
We appreciate any help that may be offered with this problem.

Mark L. Gutierrez
Simulator Computer Specialist

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