[MITgcm-support] problem of 'relocation truncated to fit'

Constantinos Evangelinos ce107 at ocean.mit.edu
Wed Apr 7 12:58:39 EDT 2010


On Wednesday 07 April 2010 06:14:49 ouc.edu.cn wrote:
> Hi,
>   (1)According to Dr. Constantinos Evangelinos's first suggestion, I have
> added a -fPIC to all my compiler flag settings (I didn't use NetCDF
> library). The problem was kind of solved since 'mitgcmuv' was generated.
> However, the running process always stops during the initialization
> process, i.e. ,in (PID.TID 0000.0001)                

You seem to stop without any warning. What do your STDERR.* files say?

> Here is the compiler 'Linux_amd64_pgf77' I use after adding  -fPIC to all
> my compiler flag settings: #!/bin/bash
> #
> #  $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_pgf77,v 1.1
> 2005/01/12 22:04:59 ce107 Exp $ #  $Name: checkpoint61z $
> #
> # Build options for Suse SLES-8.1 Opteron
> # tested on (Linux ln0127en 2.4.21-143-numa #1 SMP Fri Oct 31 00:17:52 UTC
> 2003 x86_64 unknown) system 20041512 #
> INCLUDES="-I/public/soft/ompi133-pgi702/include"
> LIBS="-L/public/soft/ompi133-pgi702/lib -lmpi -lmpi_f77"
> INCLUDEDIRS="../../../../../../../public/soft/ompi133-pgi702/include"
> FC=pgf77
> DEFINES='-DWORDLENGTH=4'
> CPP='cpp  -traditional -P'
> NOOPTFLAGS='-O0 -fPIC'
> MAKEDEPEND=/public/home/hycom/Mitgcm/MITgcm_c61z/tools/cyrus-imapd-
makedepe
> nd/makedepend if test "x$IEEE" = x ; then
>     #  No need for IEEE-754
>     FFLAGS='-byteswapio -r8 -Mnodclchk -Mextend -Ktrap=fp -fPIC'

This -Ktrap=fp could be the culprit as it will trap on any some floating point 
exceptions that in practice prove to be benign:

  -Ktrap=fp is equivalent to -Ktrap=divz,inv,ovf.  These options
       correspond to the processor's exception mask bits.  Normally, the
       processor's exception mask bits are on, meaning floating-point
       exceptions are masked; the processor recovers from the exception and
       continues.  If a mask bit is off (unmasked) and the corresponding
       exception occurs, execution terminates with floating point exception
       (Linux FPE signal).

Usually division by zero, invalid and overflow are fatal floating point 
exceptions. In practice, at least in the case of the ECCO 1x1 setup we have 
division by zero in some overlap areas that is then overwritten and does not 
affect the solution negatively. The real fix would of course be to fix these 
cases.

> (2) After that, I tried another way as suggested by Dr. Constantinos
> Evangelinos. i.e.add a -mcmodel=medium to all my compiler flag settings.
> and Linux_amd64_pgf77 now reads: 
[snip]
> However, an error appeared during the 'make' process.i.e.
> sigreg.o: In function `killhandler':
> sigreg.c:(.text+0x3): relocation truncated to fit: R_X86_64_PC32 against
> symbol `ip' defined in COMMON section in sigreg.o sigreg.o: In function
> `sigreg_':
> sigreg.c:(.text+0x1c): relocation truncated to fit: R_X86_64_PC32 against
> symbol `ip' defined in COMMON section in sigreg.o make: *** [mitgcmuv]
> Error 2

I am not sure why you have a problem here as it appears that even sigreg.c 
would have been built with -mcmodel=medium. Keep in mind however that when 
using -mcmodel=medium all libraries you link in have to be either built with -
mcmodel=medium or with -fPIC and that includes netcdf.

> So what is the problem with this ? Is it because there is something wrong
> with this compiler file ? I'd appreciate it if you can give some advice to
> me. Cheers,

Try removing the -Ktrap flag and if it does not work then I need to try and 
replicate your setup here (I would need your code directory etc.).

Constantinos
-- 
Dr. Constantinos Evangelinos
Department of Earth, Atmospheric and Planetary Sciences
Massachusetts Institute of Technology




More information about the MITgcm-support mailing list