Nvc++ 26.1 cannot combine -acc with -fPIE

Our build process uses cmake, which adds -fPIE to the linker command-line. Since upgrading to nvc++ 26.1 this morning, we can no longer link executables. For example, the below simple program – without any ACC-pragmas:

#include <stdio.h>

int
main(int argc, char *argv[])
{
        printf("Hello, cruel world...\n");
        return 0;
}

Can only be built with -acc or with -fPIE – but attempting to use both fails:

% nvc++ -o hello -acc -fPIE hello.c
ld: error: relocation R_X86_64_32 cannot be used against symbol '__NV_CUDA_LOC'; recompile with -fPIC
>>> defined in /tmp/pgcudafatLpdzVZ9gNBPq.o
>>> referenced by /tmp/pgcudafatLpdzVZ9gNBPq.o:(.text+0x5)

ld: error: relocation R_X86_64_32 cannot be used against symbol '__NV_CUDA_CAP'; recompile with -fPIC
>>> defined in /tmp/pgcudafatLpdzVZ9gNBPq.o
>>> referenced by /tmp/pgcudafatLpdzVZ9gNBPq.o:(.text+0xA)
pgacclnk: child process exit status 1: /usr/bin/ld

This was not a problem with 25.1…

Hi UnitedMarsupials,

This is a known issue that we recently found internally. Though to track your report, I added TPR#38224.

-Mat