Re: ifunc function in home-build glibc, executables linked against that libm.a and PIE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/19/2013 03:11 PM, Toon Moene wrote:
[ This might not be the right mailing list to ask, but I want to start
somewhere - google-ing ifunc and pie didn't bring me any answers ]

I have made a home-build glibc-2.17 (on a core-avx system). It works
great - linking against it (instead of using the current
Debian-Testing's eglibc-2.13) brought the wall-clock time of my weather
forecasting job down from 3:35 hours to 2:45 (mostly due to a more
efficient implementation of powf, expf and logf).

However, if I try to link another weather model against that libm.a, I
get an error saying that you cannot link an executable with 'ifunc'
functions like 'cos'; however, the following "just works":

double precision x
read*,x
print*,exp(x)
print*,log(x)
print*,sin(x)
print*,cos(x)
print*,tan(x)
print*,asin(x)
print*,acos(x)
print*,atan(x)
end

and also if I replace "double precision" with "real".

So perhaps it's the special way the weather model's executable is linked:

gfortran -g -Wl,-M -Wl,-export-dynamic master.o C_code.o _odb_glue.o
-Wl,--start-group
-L/scratch/harmonie/hm_home/trunk/lib/linux.gfortran.mpi/src
-lxrd -lxla -ltfl -ltal -lsur -larp -lald -lbla -lmpa -lmse -lsurfex
-lbip -lsat -luti -lodb -lodbport -lCCMA -lECMA -Wl,--end-group dummies.o \
-L/scratch/harmonie/hm_home/trunk/lib/linux.gfortran.mpi/src -lodbdummy
-L/scratch/harmonie/hm_home/trunk/lib/linux.gfortran.mpi/src -lrgb
-lgribex -lbufr -L/home/harmonie/grib_api -lgrib_api_f90 -lgrib_api
-lnetcdff -lnetcdf -llapack -lblas -lmpi_f90 -lmpi_f77 -lmpi -lpthread
-o /scratch/harmonie/hm_home/trunk/lib/linux.gfortran.mpi/src/MASTERODB
 > /scratch/harmonie/hm_home/trunk/lib/linux.gfortran.mpi/src/load.map

The error occurs if I put my glibc-2.17's libm.a between "-lpthread" and
"-o".

And here is the complete error message:

gfortran -g -Wl,-M master.o C_code.o _odb_glue.o -Wl,--start-group -L/scratch/harmonie/hm_home/trunk/lib/linux.gfortran.mpi/src -lxrd -lxla -ltfl -ltal -lsur -larp -lald -lbla -lmpa -lmse -lsurfex -lbip -lsat -luti -lodb -lodbport -lCCMA -lECMA -Wl,--end-group dummies.o \ -L/scratch/harmonie/hm_home/trunk/lib/linux.gfortran.mpi/src -lodbdummy -L/scratch/harmonie/hm_home/trunk/lib/linux.gfortran.mpi/src -lrgb -lgribex -lbufr -L/home/harmonie/grib_api -lgrib_api_f90 -lgrib_api -lnetcdff -lnetcdf -llapack -lblas -lmpi_f90 -lmpi_f77 -lmpi -lpthread /home/toon/myglibc/lib/libm.a -o /scratch/harmonie/hm_home/trunk/lib/linux.gfortran.mpi/src/MASTERODB > /scratch/harmonie/hm_home/trunk/lib/linux.gfortran.mpi/src/load.map /usr/bin/ld: dynamic STT_GNU_IFUNC symbol `cos' with pointer equality in `/home/toon/myglibc/lib/libm.a(s_sin.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie
collect2: error: ld returned 1 exit status

Hope this helps,

--
Toon Moene - e-mail: toon@xxxxxxxxx - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux