From 4d6c83f27fd6c2979abcd1761b7b09c76203590c Mon Sep 17 00:00:00 2001 From: "Keith W. Campbell" Date: Mon, 27 Aug 2018 11:36:13 -0400 Subject: [PATCH 1/2] Define JNIEXPORT and JNIIMPORT for xlc 13.1 or newer Signed-off-by: Keith W. Campbell --- src/java.base/unix/native/include/jni_md.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/java.base/unix/native/include/jni_md.h b/src/java.base/unix/native/include/jni_md.h index 6e352038fc5..8d16d4507be 100644 --- a/src/java.base/unix/native/include/jni_md.h +++ b/src/java.base/unix/native/include/jni_md.h @@ -1,4 +1,8 @@ /* + * =========================================================================== + * (c) Copyright IBM Corp. 2018, 2018 All Rights Reserved + * =========================================================================== + * * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -37,6 +41,9 @@ #define JNIEXPORT __attribute__((visibility("default"))) #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 #define JNIIMPORT From 9929cd7da989d121b58fca7259602b732afdd6fa Mon Sep 17 00:00:00 2001 From: "Keith W. Campbell" Date: Mon, 27 Aug 2018 11:36:42 -0400 Subject: [PATCH 2/2] Add workaround for xlc bug Signed-off-by: Keith W. Campbell --- .../share/native/libjimage/NativeImageBuffer.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/java.base/share/native/libjimage/NativeImageBuffer.cpp b/src/java.base/share/native/libjimage/NativeImageBuffer.cpp index ffd8a153f70..5384451cdca 100644 --- a/src/java.base/share/native/libjimage/NativeImageBuffer.cpp +++ b/src/java.base/share/native/libjimage/NativeImageBuffer.cpp @@ -1,4 +1,8 @@ /* + * =========================================================================== + * (c) Copyright IBM Corp. 2018, 2018 All Rights Reserved + * =========================================================================== + * * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,6 +45,16 @@ #include "jimage.hpp" #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"