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?