Relocation truncated to fit: R_X86_64_PC32

Hi,

I am compiling Fortran OpenMP code with -mcmodel=medium included on all compile and link lines But I still get ‘Relocation truncated to fit: R_X86_64_PC32’ errors:

ftn -m64 -fastsse -mp=nonuma -mcmodel=medium -o sph_tree_rk sph.o accrete_P.o addump.o angmom.o boundry.o cartdis.o cartmas.o cartpres.o cartvel.o chanref.o chekopt.o condense.o constan.o coriol.o cyldis.o cylmas.o cylpres.o cylvel.o dcooli_P_indiv.o densityi_P.o derivi_P.o endrun.o energ.o eospg.o error.o evol.o externf.o extract.o file.o forcei_P.o getneigh.o getcv.o get1overmu.o getkappa.o gforsa_P.o gforsn_P.o gforspt_P.o ghostp1.o ghostp2.o ghostp3.o ghostp11.o ghostp100.o gptall.o hcalc.o hdot_P.o header.o homexp.o indexx.o indexx2.o indexx3.o inform.o inopts.o insulate_TREE_P.o integs.o ktable.o labrun.o lunit_double.o mainop.o mesop.o modif.o mtree_P.o newrun.o options.o phoenix.o phoenix2.o place.o preset.o prout.o ran1.o rdump.o reduce.o revtree_P.o save.o scaling.o secmes.o setpart.o smoothd_P.o sphdis.o sphmas.o sphpres.o sphvel.o step_P_rk_dcool.o toten.o treef_P.o unifdis.o unit.o wdump.o wrinsph.o zzsun_f77_double1.o zzsun_f77_double2.o
/usr/lib64/libpthread.a(pthread_create.o): In function __nptl_setxid': /usr/src/packages/BUILD/glibc-2.9/nptl/allocatestack.c:945: relocation truncated to fit: R_X86_64_PC32 against symbol __xidcmd’ defined in COMMON section in /usr/lib64/libpthread.a(init.o)
/usr/lib64/libpthread.a(pthread_create.o): In function allocate_stack': /usr/src/packages/BUILD/glibc-2.9/nptl/allocatestack.c:429: relocation truncated to fit: R_X86_64_PC32 against symbol __static_tls_align_m1’ defined in COMMON section in /usr/lib64/libpthread.a(init.o)
/usr/src/packages/BUILD/glibc-2.9/nptl/allocatestack.c:435: relocation truncated to fit: R_X86_64_PC32 against symbol __static_tls_size' defined in COMMON section in /usr/lib64/libpthread.a(init.o) /usr/src/packages/BUILD/glibc-2.9/nptl/allocatestack.c:516: relocation truncated to fit: R_X86_64_PC32 against symbol __libc_multiple_threads_ptr’ defined in COMMON section in /usr/lib64/libpthread.a(pthread_create.o)
/usr/src/packages/BUILD/glibc-2.9/nptl/allocatestack.c:516: relocation truncated to fit: R_X86_64_PC32 against symbol __pthread_multiple_threads' defined in COMMON section in /usr/lib64/libpthread.a(vars.o) /usr/src/packages/BUILD/glibc-2.9/nptl/allocatestack.c:679: relocation truncated to fit: R_X86_64_PC32 against symbol __static_tls_size’ defined in COMMON section in /usr/lib64/libpthread.a(init.o)
/usr/src/packages/BUILD/glibc-2.9/nptl/allocatestack.c:332: relocation truncated to fit: R_X86_64_PC32 against symbol __static_tls_size' defined in COMMON section in /usr/lib64/libpthread.a(init.o) /usr/src/packages/BUILD/glibc-2.9/nptl/allocatestack.c:338: relocation truncated to fit: R_X86_64_PC32 against symbol __static_tls_align_m1’ defined in COMMON section in /usr/lib64/libpthread.a(init.o)
/usr/src/packages/BUILD/glibc-2.9/nptl/allocatestack.c:377: relocation truncated to fit: R_X86_64_PC32 against symbol __libc_multiple_threads_ptr' defined in COMMON section in /usr/lib64/libpthread.a(pthread_create.o) /usr/src/packages/BUILD/glibc-2.9/nptl/allocatestack.c:377: relocation truncated to fit: R_X86_64_PC32 against symbol __pthread_multiple_threads’ defined in COMMON section in /usr/lib64/libpthread.a(vars.o)
/usr/lib64/libpthread.a(pthread_create.o): In function `start_thread’:
/usr/src/packages/BUILD/glibc-2.9/nptl/pthread_create.c:244: additional relocation overflows omitted from the output
make: *** [sph_tree_rk] Error 2

Does it mean that the errors are caused with libpthread.a? Is PGI’s OpenMP implemented with glibc and pthreads? Does the libpthread.a need to build with -mcmodel=medium as well?

Thanks.

Hi yus,

Does it mean that the errors are caused with libpthread.a?

Yes. The medium memory model requires the use of shared libraries or static libraries built with position independent code (-fpic). In this case, you’re trying to link with a static, non-pic, pthread library.

Is PGI’s OpenMP implemented with glibc and pthreads?

Yes, pthreads is the traditional system threading model on POSIX based systems.

Does the libpthread.a need to build with -mcmodel=medium as well?

No, but does need to built with -fpic.

It appears that you may be compiling on a Cray system? Cray’s OS does not inlcude shared system libraries and hence, you can not use the medium memory model. However, do you need large static data (-mcmodel=medium) or can you change your arrays to be dynamically allocated (i.e. F90 allocate) and use the -Mlarge_array flag?

  • Mat