This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Linker error on HP-UX with OpenMP


I was able to reproduce this error with the small test program below. The program compiles and runs okay on Linux, but not on HP-UX.

I have tried building more recent versions of gcc on HP-UX, but gcc-4.7.4 is the most recent version with which I've had success.


$ cat prog.f90
module mod1

integer, parameter :: n = 1000000

contains

  subroutine sub(j, res)
  implicit none
  integer :: j
  real :: res
  real :: y(n)
  real :: z(n)
  logical :: is_first=.true.
  save y, z, is_first
!$omp threadprivate(is_first, y, z)

  if (is_first) then
    y(:) = 1.0
    z(:) = 2.0
    is_first=.false.
  endif

  y(j) = y(j) + 1.0
  z(j) = z(j) + 2.0

  res = y(j) + z(j)

  end subroutine sub

end module mod1




program test

use mod1, only: n, sub

implicit none

integer :: i
real :: x, y

x = 0.0
y = 0.0
!$omp parallel do reduction(+: y)
do i=1,n
   call sub(i, x)
   y = y + x
enddo
!$omp end parallel do

print *, y

end program test

$ gfortran -mlp64 -fopenmp prog.f90
ld: The value 0x3d0918 does not fit when applying the relocation TPREL22 or DTPREL22 for symbol "z.839" at offset 0x102 in section index 1 of file /var/tmp//ccWaJnu6.o ld: The value 0x3d0918 does not fit when applying the relocation TPREL22 or DTPREL22 for symbol "z.839" at offset 0x242 in section index 1 of file /var/tmp//ccWaJnu6.o ld: The value 0x3d0918 does not fit when applying the relocation TPREL22 or DTPREL22 for symbol "z.839" at offset 0x292 in section index 1 of file /var/tmp//ccWaJnu6.o ld: The value 0x3d0918 does not fit when applying the relocation TPREL22 or DTPREL22 for symbol "z.839" at offset 0x312 in section index 1 of file /var/tmp//ccWaJnu6.o
4 errors.
collect2: error: ld returned 1 exit status

$ uname -a
HP-UX rx2800 B.11.31 U ia64 ...

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/joshua2/opt/gcc/hp/gcc-4.7.4/libexec/gcc/ia64-hp-hpux11.31/4.7.4/lto-wrapper
Target: ia64-hp-hpux11.31
Configured with: /home/joshua2/opt/gcc/hp/gcc-4.7.4-src/configure --prefix=/home/joshua2/opt/gcc/hp/gcc-4.7.4 --with-gnu-as --with-as=/opt/hp-gcc/bin/as --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.7.4 (GCC)

$ ld -V
ld: 92453-07 linker ld HP Itanium(R) B.12.58  IPF/IPF
ld: No input files
Fatal error.


It compiles and runs okay without OpenMP:

$ gfortran -mlp64  prog.f90
$ ./a.out
   6000000.00





On 2015-05-20 11:31 AM, Josh Hykes wrote:
Hello,



I posted this to the GNU Fortran Google Groups forum, but someone there
suggested I post here instead.



I am trying to use gfortran on our HP-UX B.11.31 ia64 machine. After
several false starts, I was able to build gcc-4.7.4 using HP's aCC
compiler (I had to disable java).



Our code compiles with gfortran and runs successfully on the HP without
OpenMP. (It compiles and runs okay with OpenMP on a variety of other
platforms and compilers, including gfortran on linux.)



When I enable OpenMP with -fopenmp, the compilation fails in the linker
stage with a series of errors like the following:



ld: The value 0xd01bf8 does not fit when applying the relocation TPREL22
or DTPREL22 for symbol "ainf.2311" at offset 0x14cf1 in section index 1
of file gendpx.o

ld: The value 0xd01bf8 does not fit when applying the relocation TPREL22
or DTPREL22 for symbol "ainf.2311" at offset 0x14da0 in section index 1
of file gendpx.o



The array ainf is a save'd automatic array that is declared
threadprivate. There is no GNU linker on HP-UX, so this is using the HP
linker.



I am compiling with the following options:



-mlp64 -O2 -fconvert=big-endian -fbacktrace
-ffpe-trap=invalid,zero,overflow -fPIC -fopenmp



I have experimented with a variety of gfortran and linker options, but
none of them have allowed me to fix the above relocation error. Does
anyone have any experience with this error message, or any suggestions
that I could try?



-Josh





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