Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8135658 | emb-9 | Volker Simonis | P4 | Resolved | Fixed | team |
In semaphore_posix.hpp timedwait is declared as follows:
class PosixSemaphore : public CHeapObj<mtInternal> {
private:
bool timedwait(struct timespec ts);
}
but in os_posix.cpp it is defined as follows:
bool PosixSemaphore::timedwait(const struct timespec ts) {
On Solaris 10/11 on Sparc with SS12u3 (Sun C++ 5.12 SunOS_sparc 2011/11/16) this gives an error in the release build:
Undefined first referenced
symbol in file
bool PosixSemaphore::timedwait(timespec) os_solaris.o
This is because the caller in os_solaris.o requires:
/usr/ccs/bin/nm -C hotspot/solaris_sparcv9_compiler2/product/os_solaris.o | grep timedwait
[456] | 0| 0|FUNC |GLOB |0 |UNDEF |bool PosixSemaphore::timedwait(timespec)
[__1cOPosixSemaphoreJtimedwait6MnItimespec__b_]
but the implementation in os_posix.o has:
/usr/ccs/bin/nm -C hotspot/solaris_sparcv9_compiler2/product/os_posix.o | grep timedwait
[61] | 6928| 124|FUNC |GLOB |0 |2 |bool PosixSemaphore::timedwait(const timespec)
[__1cOPosixSemaphoreJtimedwait6MknItimespec__b_]
Strange enough, the error doesn't seem to happen on Solaris/AMD64 (using the exactly same compiler version) and I absolutely can not see how this error is related to the CPU architecture!
I also can not understand why nobody has seen this before?
Fortunately, the fix is trivial - just remove the const qualifier from the method definition.
class PosixSemaphore : public CHeapObj<mtInternal> {
private:
bool timedwait(struct timespec ts);
}
but in os_posix.cpp it is defined as follows:
bool PosixSemaphore::timedwait(const struct timespec ts) {
On Solaris 10/11 on Sparc with SS12u3 (Sun C++ 5.12 SunOS_sparc 2011/11/16) this gives an error in the release build:
Undefined first referenced
symbol in file
bool PosixSemaphore::timedwait(timespec) os_solaris.o
This is because the caller in os_solaris.o requires:
/usr/ccs/bin/nm -C hotspot/solaris_sparcv9_compiler2/product/os_solaris.o | grep timedwait
[456] | 0| 0|FUNC |GLOB |0 |UNDEF |bool PosixSemaphore::timedwait(timespec)
[__1cOPosixSemaphoreJtimedwait6MnItimespec__b_]
but the implementation in os_posix.o has:
/usr/ccs/bin/nm -C hotspot/solaris_sparcv9_compiler2/product/os_posix.o | grep timedwait
[61] | 6928| 124|FUNC |GLOB |0 |2 |bool PosixSemaphore::timedwait(const timespec)
[__1cOPosixSemaphoreJtimedwait6MknItimespec__b_]
Strange enough, the error doesn't seem to happen on Solaris/AMD64 (using the exactly same compiler version) and I absolutely can not see how this error is related to the CPU architecture!
I also can not understand why nobody has seen this before?
Fortunately, the fix is trivial - just remove the const qualifier from the method definition.
- backported by
-
JDK-8135658 Signature mismatch between declaration and definition of PosixSemaphore::timedwait
-
- Resolved
-
- relates to
-
JDK-8087322 Implement a Semaphore utility class
-
- Resolved
-