RFR: JDK-8214063: OpenJDK will not build on AIX while using the xlc 13.1 compiler
Baesken, Matthias
matthias.baesken at sap.com
Tue Nov 20 17:00:29 UTC 2018
Hi Adam , the webrev looks OK to me (not a Reviewer however). I think it will not break anything on lower xlc versions (like xlc 12.1 that we are using).
Are you able to do a full successful build with this change (when using xlc 13.1) ?
Do you have a chance to test with the beta-xlc after 13 and tell if your change is needed there too ?
(I think this is the interesting xlc version because we need one with better c++11/14 support in the future )
Best regards, Matthias
> Hi Tom,
>
> Sounds reasonable. I've added a webex to the bug, and here's a link to the
> bug.
>
> https://bugs.openjdk.java.net/browse/JDK-8214063
>
> This patch is required because otherwise, when building on AIX using xlc
> 3.1,
> the build fails with this error:
>
> "Visibility is not allowed on a reference to an imported symbol."
>
> We believe this is caused by JNIEXPORT and JNIIMPORT not being defined.
> Without
> this, almost no symbols are exported from shared libraries due to use of
> -qvisibility=hidden as specified in make/lib/LibCommon.gmk.
>
> For convenience, here's a summary of the diffs:
>
> --------------------------------------
> File 1 of 2) src/java.base/share/native/libjimage/NativeImageBuffer.cpp
>
> #include "osSupport.hpp"
>
> +#if defined(__xlC__) && (__xlC__ >= 0x0d01)
> +/*
> + * Version 13.1.3 of xlc seems to have trouble parsing the
> `__attribute__`
> + * annotation in the generated header file we're about to include.
> Repeating
> + * the forward declaration (without the braces) here avoids the
> diagnostic:
> + * 1540-0040 (S) The text "void" is unexpected. "visibility" may be
> undeclared or ambiguous.
> + */
> +extern "C" JNIEXPORT jobject JNICALL
> Java_jdk_internal_jimage_NativeImageBuffer_getNativeMap(JNIEnv *,
> jclass,
> jstring);
> +#endif
> +
> #include "jdk_internal_jimage_NativeImageBuffer.h"
> --------------------------------------
> File 2 of 2) src/java.base/unix/native/include/jni_md.h
>
> #define JNIIMPORT __attribute__((visibility("default")))
> #endif
> +#elif defined(__xlC__) && (__xlC__ >= 0x0d01) /* xlc version 13.1 or
> better required */
> + #define JNIEXPORT __attribute__((visibility("default")))
> + #define JNIIMPORT __attribute__((visibility("default")))
> #else
> #define JNIEXPORT
> --------------------------------------
>
> Best Regards
>
> Adam Farley
> IBM Runtimes
>
More information about the core-libs-dev
mailing list