Problem with the initialization of global objects in shared libraries on AIX

Volker Simonis volker.simonis at gmail.com
Thu Sep 27 07:33:53 PDT 2012


Hi,

I'm having a real strange problem with the initialization of global
objects in our HotSpot port  (libjvm.so) on AIX:

CodeHeap * CodeCache::_heap = new CodeHeap();

void CodeCache::initialize() {
  if (!_heap->reserve(...)) {
...

The problem is that 'CodeCache::_heap' is a global variable which
should be initialized at the time when 'CodeCache::initialize()' is
called.
But in our OpenJDK port of the libjvm.so it isn't. Its actually NULL
and the VM crashes. I'm also seeing this lack of initialization for
globals in different compilation units from libjvm.so.

In our internal SAP JVM version, we have exactly the same code and it
works. I try to build the OpenJDK version with exactly the same
command line flags so I really don't see the difference (we're using
xlc 10 on AIX 5.3). C++ files are compiled with 'xlC_r -q64
-qpic=large -qlanglvl=extc99 -qnortti -qnoeh', the shared library
(libjvm.so) is linked with 'xlC_r -q64  -b64 -bexpall -G -bnoentry
-qmkshrobj -brtl -bnolibpath -Wl,-lC_r -lm -ldl -lpthread' and the
java executable is linked with  'xlc_r -b64 -brtl -bnolibpath -liconv
-lpthread'.

Any idea what can cause this strange problem?

Thank you and best regards,
Volker


More information about the ppc-aix-port-dev mailing list