Can't profile code, compile time error _mcount

Using pgi/7.2 trying to compile a users code with profiling. The user links the code into a shared library which he then dlopen()'s latter and uses.

When he trys to link the library he gets an error:

Linking CompressibleNS shared object:
ld -shared --export-dynamic -undefined dynamic_lookup -soname=…/…/lib/libCompressibleNS.so -o …/…/lib/libCompressibleNS.so xf_CompressibleNS.o xf_CompressibleNS_Diff.o xf_CompressibleNS_Conv.o
ld: xf_CompressibleNS.o: relocation R_X86_64_PC32 against `_mcount’ can not be used when making a shared object; recompile with -fPIC
ld: final link failed: Bad value

Any insight? the ‘relocation’ part normally means that I need to use -mcmodel=medium but there is no way that is right for this code. (not needed when not profiling). Also the code compiles and profiles with gcc just fine. Just runs faster under pgcc, so wanted to profile with pgcc also.

Any help would be good.

Brock Palen

Hi Brock,

Unfortunately, we don’t yet support profiling within shared objects. We do have an open feature request (TPR#14852), but I don’t know the time frame when we’ll be able to add this.

Best Regards,
Mat