On Sun, Jan 20, 2013 at 3:42 AM, Toon Moene <toon@xxxxxxxxx> wrote: > On 01/20/2013 06:59 AM, Ian Lance Taylor wrote: > >> On Sat, Jan 19, 2013 at 10:36 AM, Toon Moene<toon@xxxxxxxxx> wrote: >>> >>> >>> 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 >> >> >> I have no idea why this is happening to you but I can tell you what it >> means. The symbol "cos" has been defined as an IFUNC symbol in your >> library. That means that the actual value of "cos" will be selected >> at runtime, presumably with a version of "cos" that will execute >> quickly on the processor as detected at runtime. Furthermore, some >> piece of code in the library is using "cos" in some way other than >> simply calling it, e.g., taking the address of the function. As it >> happens, taking the address of an IFUNC function in code not compiled >> with -fpie or -fpic is problematic, because that code will produce >> different addresses in different shared libraries, meaning that >> function pointer equality will not work. The linker is telling you >> about this problem, and telling you to fix it by recompiling with >> -fpie. > > > Would placing them in a table like this cause that problem ? > > static funcs_t Func[] = { > /* Compile-time evaluable functions */ > "sin", 1, (void *)sin, NULL, 1, 0, > "cos", 1, (void *)cos, NULL, 1, 0, > "tan", 1, (void *)tan, NULL, 1, 0, Yes, that would count as a reference to an IFUNC function other than calling it. That code needs to be compiled with -fpie (or -fpic). Ian