relocation truncated to fit

relocation truncated to fit

I am compiling f90 code with intel 12.1.5 on x86_64 x86_64 x86_64 GNU/Linux and am getting "relocation truncated to fit" errors in the link step, a few of which are copied below. I am using mpif90 with options -O3 -r8 -heap-arrays -mcmodel=medium -shared-intel. I am linking netcdf v4.2.

As I understand it, this means I am using more than the 2GB limit of statically declared memory. If I execute "size *.o", then sum all numbers in the bss column, I get 94,447,960. I think this means almost 100MB, way  under 2 GB. Much of my memory is dynamically allocated from the heap. I doubt netcdf is statically allocated very much, but will try to confirm this. Can anyone help? Thanks,

--Ben (foster@ucar.edu)

mpif90 -r8 -heap-arrays -mcmodel=medium -shared-intel -I. -I/glade/u/home/foster/tiegcm_ctmt/tiegcm_trunk/src -I -O3  -DLINUX  -DMPI  -c -o wrhist.o /glade/u/home/foster/tiegcm_ctmt/tiegcm_trunk/src/wrhist.F
mpif90 -o /glade/p/work/foster/tiegcm_ctmt/tiegcm_ctmt_dres-ys/tiegcm_trunk addfld.o addiag.o advance.o advec.o allocdata.o apex.o apex_subs.o aurora.o chapman.o chemrates.o cism_adhoc.o cism_coupling.o cism_intercomm.o colath.o comp.o comp_n2d.o comp_n4s.o comp_no.o comp_o2o.o cons.o cpktkm.o ctmt.o diags.o dispose.o divrg.o dt.o duv.o dynamics.o dynamo.o efield.o elden.o fft9.o fields.o filter.o getfile.o gpi.o gswm.o hdif.o heelis.o highlatpoten.o hist.o imf.o init.o inp_read.o input.o ionvel.o lamdas.o lbc.o lsqdsq.o magfield.o magpres_g.o minor.o mk_polelat.o mkhvols.o mpi.o mud.o mudcom.o mudmod.o muh2cr.o nchist.o newton.o numfiles.o oplus.o output.o params.o qinite.o qjion.o qjnno.o qjoule.o qrj.o rdsource.o saber_tidi.o settei.o smooth.o soldata.o sphpac.o swdot.o tgcm.o timing.o trsolv.o util.o vtsetup.o wei01gcm.o wei05sc.o wrhist.o -lcurl -L -lnetcdf
/ncar/opt/intel/12.1.0.233/composer_xe_2011_sp1.11.339/compiler/lib/intel64/libifcore.a(for_diags_intel.o): In function `for__io_return':
for_diags_intel.c:(.text+0xa6c): relocation truncated to fit: R_X86_64_PC32 against symbol `message_catalog' defined in COMMON section in /ncar/opt/intel/12.1.0.233/composer_xe_2011_sp1.11.339/compiler/lib/intel64/libifcore.a(for_diags_intel.o)
for_diags_intel.c:(.text+0xbdb): relocation truncated to fit: R_X86_64_PC32 against symbol `message_catalog' defined in COMMON section in /ncar/opt/intel/12.1.0.233/composer_xe_2011_sp1.11.339/compiler/lib/intel64/libifcore.a(for_diags_intel.o)
for_diags_intel.c:(.text+0xbeb): relocation truncated to fit: R_X86_64_PC32 against symbol `message_catalog' defined in COMMON section in /ncar/opt/intel/12.1.0.233/composer_xe_2011_sp1.11.339/compiler/lib/intel64/libifcore.a(for_diags_intel.o)
for_diags_intel.c:(.text+0xc46): relocation truncated to fit: R_X86_64_PC32 against symbol `message_catalog' defined in COMMON section in /ncar/opt/intel/12.1.0.233/composer_xe_2011_sp1.11.339/compiler/lib/intel64/libifcore.a(for_diags_intel.o)
/ncar/opt/intel/12.1.0.233/composer_xe_2011_sp1.11.339/compiler/lib/intel64/libifcore.a(for_diags_intel.o): In function `for__issue_diagnostic':
for_diags_intel.c:(.text+0xd66): relocation truncated to fit: R_X86_64_PC32 against symbol `message_catalog' defined in COMMON section in /ncar/opt/intel/12.1.0.233/composer_xe_2011_sp1.11.339/compiler/lib/intel64/libifcore.a(for_diags_intel.o)
for_diags_intel.c:(.text+0xdcb): relocation truncated to fit: R_X86_64_PC32 against symbol `message_catalog' defined in COMMON section in /ncar/opt/intel/12.1.0.233/composer_xe_2011_sp1.11.339/compiler/lib/intel64/libifcore.a(for_diags_intel.o)
for_diags_intel.c:(.text+0x12b9): relocation truncated to fit: R_X86_64_PC32 against symbol `message_catalog' defined in COMMON section in /ncar/opt/intel/12.1.0.233/composer_xe_2011_sp1.11.339/compiler/lib/intel64/libifcore.a(for_diags_intel.o)
for_diags_intel.c:(.text+0x12e0): relocation truncated to fit: R_X86_64_PC32 against symbol `message_catalog' defined in COMMON section in /ncar/opt/intel/12.1.0.233/composer_xe_2011_sp1.11.339/compiler/lib/intel64/libifcore.a(for_diags_intel.o)
for_diags_intel.c:(.text+0x140e): relocation truncated to fit: R_X86_64_PC32 against symbol `message_catalog' defined in COMMON section in /ncar/opt/intel/12.1.0.233/composer_xe_2011_sp1.11.339/compiler/lib/intel64/libifcore.a(for_diags_intel.o)
for_diags_intel.c:(.text+0x1435): relocation truncated to fit: R_X86_64_PC32 against symbol `message_catalog' defined in COMMON section in /ncar/opt/intel/12.1.0.233/composer_xe_2011_sp1.11.339/compiler/lib/intel64/libifcore.a(for_diags_intel.o)
for_diags_intel.c:(.text+0x1537): additional relocation overflows omitted from the output
gmake[1]: *** [/glade/p/work/foster/tiegcm_ctmt/tiegcm_ctmt_dres-ys/tiegcm_trunk] Error 1
gmake[1]: Leaving directory `/glade/p/work/foster/tiegcm_ctmt/tiegcm_ctmt_dres-ys'
gmake: *** [Depends] Error 2

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

This is just a guessed solution, but it is easy and harmless enough to try:

To the linking command (the second command listed above), add the flag -mcmodel=medium.

Thanks mecej4, it worked when I cut-and-pasted both -mcmodel and -shared-intel into the link command. But I don't understand how to do this from my Makefile. I tried adding -Wl,-mcmodel=medium,-shared-intel to FFLAGS, but it did not pass them to the linker, and I got the same relocations errors as before. Can you help? Thanks,

--Ben

Usually in a makefile FFLAGS is used only for compiling, and LDFLAGS or some such variable is used for setting linker flags. However, other styles of makefiles are also common. What matters is that the correct flags be used for compiling as well as for linking.

You may use the -n flag of the make command to make a dry run in which you check that -mcmodel=medium is included in the linking command.

Not having seen your makefile, I am able to say only that much.

Ok, I've got it working now. Thanks a lot for your help!

Leave a Comment

Please sign in to add a comment. Not a member? Join today