V20.9: relocation R_X86_64_PC32 against symbol `__pgi_uacc_set_ctxrel' crash at link

When compiling a large C++ shared library I encounter the following error at link time:

/usr/bin/ld: /tmp/pgcudafatFKVdDBx3zswD.o: relocation R_X86_64_PC32 against symbol `__pgi_uacc_set_ctxrel' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
pgacclnk: child process exit status 1: /usr/bin/ld

The error is a bit or a red herring as I have confirmed that all sources included in this library already is built with -fPIC. My acc specific compilation flags are “-acc -ta=tesla:ccall,nordc”. With previous versions of the PGI compiler I found that the nordc option is necessary for correct results. Everything worked well with PGI19.10, but I am attempting to upgrade to PGI 20.9 due to a blocking bug in another one of our tools. Do you have any ideas of what could be causing this?

Hi David,

Are you using nvc++ or pgc++ to created the shared object? If so, can you try removing “nordc” from the build and link? We added support for device linking in shared objects so “nordc” may not be needed any longer.

I was able to recreate the problem but only when “nordc” was used. I’ll investigate a bit more and file a report, but wanted to see if removing nordc helped.


Hi Mat,

Indeed, I tried this last night and removing nordc allows it to link properly. Unfortunately I now have some weird failures at runtime that I need to better characterize. I was hoping to avoid any changes to the acc settings that could have unexpected side effects. However, if I can get it working without nordc then that is a path I am happy to take. I will continue on this path and provide an update ASAP.



Sounds like a plan.

I’ll start a dialogue with engineering to see what we can do on our end. Though hopefully using RDC works since that’s the best path forward anyway.