Problem with the initialization of global objects in shared libraries on AIX
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
hi Volker - sorry fo delay in responding . J1 and all that. I dont know why your seeing what your seeing but I can at least try to reproduce the problem. What do you do to trigger the failure and what do you see as a result? On 27 Sep 2012, at 15:33, Volker Simonis <volker.simonis@gmail.com> wrote:
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
participants (2)
-
Steve Poole
-
Volker Simonis