Nvc adds -z now to linking causes error in plugin based codes on arm64 / GH200

I am currently porting a plugin based tool to the GH200 architecture employing nvc and nvfortran. Thereby I ran into the following problem. All plugins are of the following structure:

void callback_to_main(void *arg); 

void register_plugin(struct plugin_t * reg)
{
  strcpy(reg -> name, "Test Plugin"); 
  ...
}

void compute(void *arg) 
{
  ...
  callback_to_main(arg); 
  ...
}

Within a management tool, I look for the available plugins using:

 void *handle = dlopen("plugin.so", RTLD_LOCAL | RTLD_LAZY); 
 void *reg_function = dlsym(handle, "register_plugin"); 

The management tool does not provide the callback_to_main function or any other reference the plugin code can use from the real compute code.

Compiling the code on x86-64 with GCC, CLANG, NVHPC 24.3/7 everything works. Moving to arm64 on a GH200 chip with NVHPC, the code compiles but executing the tool leads to

./plugin.so: undefined symbol: callback_to_main

Analyzing the differences between x86 and arm64 shows that on arm the nvc adds

-z now

to the linker call, which in fact destroys the above plugin schemes. Looking in compiler/bin/rcfiles/arm64 the following line appears 3 times, which causes the problem:

append(LDARGS=-z now)

Why is this required and how can I deactivate this behaviour such that plugin architectures will work properly again?

Hi Koehlerm,

I added an issue report, TPR#36536, and sent it to engineering for investigation.

It appears that it was required to fix a problem where when runtime symbol relocation is enabled, the SVE state is not always saved. They are going to investigate if there are other ways to address the original problem.

-Mat

Is there any chance to get a workaround by now? Since this error came somehow unexpected since on x86-64 everything worked fine and without changing the compiler and linker flags it offers a completely different behavior.

The workaround would be to edit the “rcfiles/arm64” and remove the references to “-z now”.

While I don’t know if this would cause other issues, given the problem it’s intending to solve only occurs on Graviton3 and a64fx when using SVE, if you’re on a Grace system, I doubt it would be an issue to remove it.