[jdk21u] RFR: JDK-8319922: libCreationTimeHelper.so fails to link in JDK 21

Thomas Stuefe stuefe at openjdk.org
Fri Nov 10 14:29:58 UTC 2023


On Fri, 10 Nov 2023 14:15:26 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

> @tstuefe Could you please build with `LOG=debug` and paste the exact command line that is being used for linking on your system? I'd like to understand the error better.

Sure.

Failing:


/usr/bin/g++ -Wl,-z,defs -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -m64 -L/shared/projects/openjdk/jdk-jdk21u-dev/output-fastdebug/support/modules_libs/java.base -L/shared/projects/openjdk/jdk-jdk21u-dev/output-fastdebug/support/modules_libs/java.base/server -shared -Wl,-z,origin -Wl,-rpath,$ORIGIN -ldl -Wl,-soname=libCreationTimeHelper.so -o /shared/projects/openjdk/jdk-jdk21u-dev/output-fastdebug/support/test/jdk/jtreg/native/lib/libCreationTimeHelper.so /shared/projects/openjdk/jdk-jdk21u-dev/output-fastdebug/support/test/jdk/jtreg/native/support/libCreationTimeHelper/libCreationTimeHelper.o


With my patch:


/usr/bin/g++ -Wl,-z,defs -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -m64 -L/shared/projects/o    penjdk/jdk-jdk21u-dev/output-fastdebug/support/modules_libs/java.base -L/shared/projects/openjdk/jdk-jdk21u-dev/output-fastdebug/support/modules_libs/java.base/server -shared -Wl,-z,origin -Wl,-rpath,$ORIGIN -Wl,-soname=libCreationTimeHelper.so -o /shared/projects/openjd    k/jdk-jdk21u-dev/output-fastdebug/support/test/jdk/jtreg/native/lib/libCreationTimeHelper.so /shared/projects/openjdk/jdk-jdk21u-dev/output-fastdebug/support/test/jdk/jtreg/native/support/libCreationTimeHelper/libCreationTimeHelper.o -ldl


> 
> Edit: The reason why I ask is that the change in `make/test/JtregNativeJdk.gmk` was supposed to fix this exact problem. See also [openjdk/jdk#15792 (comment)](https://github.com/openjdk/jdk/pull/15792#discussion_r1344525162)

`-ldl` resolves all open imports of the files *that have been processed so far*. See https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html:


It makes a difference where in the command you write this option; the linker searches and
 processes libraries and object files in the order they are specified. Thus, ‘foo.o -lz bar.o’ 
searches library ‘z’ after file foo.o but before bar.o. If bar.o refers to functions in ‘z’, those 
functions may not be loaded. 


But why this is not a problem in general, only on my box, is beyond me.

-------------

PR Comment: https://git.openjdk.org/jdk21u/pull/351#issuecomment-1805835067


More information about the jdk-updates-dev mailing list