rhel 8 gcc/g++ 8.3.1 shared library has no "_init" symbol

Posted on

Hello experts,

I am trying to rebuild our internal libraries on rhel 8, with gcc/g++ 8.3.1. The build completed. But cannot be loaded by the application due to the fact that the "_init" symbol is missing/removed from the shared library. We make the following all to get more information from the library.

dlsym( libHandle, (const char*) "_init" )

and it returns null with the new build.

For all build from rhel 7 and before this can be verified with "nm" command, e.g.

nm -D "mylib.so" | grep "_init"

000000000032b6b0 T _init

However, when run the same command with lib built on rhel 8, nothing was found.

Is there a way to force the link to export "_init" symbol explicitly?