From 9301c425fa5de5d5dec732d94ee9e830b639e856 Mon Sep 17 00:00:00 2001 From: Ishita Ray Date: Tue, 17 Sep 2024 13:31:01 -0400 Subject: [PATCH] Add CMAKE_C_COMPILER_IS_OPENXL macro for related flags Add CMAKE_C_COMPILER_IS_OPENXL macro to add the compiler flags needed by openXL17 Signed-off-by: Ishita Ray --- runtime/cmake/platform/os/aix.cmake | 9 +- runtime/cmake/platform/toolcfg/gnu.cmake | 5 +- runtime/compiler/CMakeLists.txt | 6 +- runtime/compiler/env/J9KnownObjectTable.cpp | 7 +- runtime/compiler/env/VMJ9.cpp | 25 +--- runtime/compiler/env/alloca_openxl.h | 25 ++++ runtime/compiler/env/j9method.cpp | 37 +---- runtime/compiler/runtime/JitRuntime.cpp | 31 +--- .../runtime/SymbolValidationManager.cpp | 13 +- .../configure_includes/configure_aix_ppc.mk | 10 +- runtime/makelib/targets.mk.aix.inc.ftl | 56 +++++-- runtime/oti/j9nonbuilder.h | 5 +- .../tests/redirector/jep178/CMakeLists.txt | 6 +- runtime/verbose/CMakeLists.txt | 140 ++++++++++++------ 14 files changed, 214 insertions(+), 161 deletions(-) create mode 100644 runtime/compiler/env/alloca_openxl.h diff --git a/runtime/cmake/platform/os/aix.cmake b/runtime/cmake/platform/os/aix.cmake index 9306d717312..7d08a6297cf 100644 --- a/runtime/cmake/platform/os/aix.cmake +++ b/runtime/cmake/platform/os/aix.cmake @@ -23,5 +23,10 @@ # Override cmake default of ".a" for shared libs on aix set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-G,-brtl,-bernotok,-bnoentry,-bnolibpath") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-brtl") +if(CMAKE_C_COMPILER_IS_OPENXL) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-G,-brtl,-bernotok,-bnoentry,-bnolibpath -latomic -lperfstat -liconv") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-brtl -latomic -lperfstat -liconv") +else() + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-G,-brtl,-bernotok,-bnoentry,-bnolibpath") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-brtl") +endif() diff --git a/runtime/cmake/platform/toolcfg/gnu.cmake b/runtime/cmake/platform/toolcfg/gnu.cmake index 067e52df728..1b2aaf20b37 100644 --- a/runtime/cmake/platform/toolcfg/gnu.cmake +++ b/runtime/cmake/platform/toolcfg/gnu.cmake @@ -34,8 +34,9 @@ list(APPEND OMR_PLATFORM_CXX_COMPILE_OPTIONS -fno-threadsafe-statics) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti") # Raise an error if a shared library has any unresolved symbols. -# This flag isn't supported on OSX, but it has this behaviour by default -if(NOT OMR_OS_OSX) +# This flag isn't supported on OSX and on AIX while using openxl compiler, +# but it has this behaviour by default. +if(NOT OMR_OS_OSX AND NOT OMR_OS_AIX AND NOT CMAKE_C_COMPILER_IS_OPENXL) set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,defs ${CMAKE_SHARED_LINKER_FLAGS}") endif() diff --git a/runtime/compiler/CMakeLists.txt b/runtime/compiler/CMakeLists.txt index c817349d71d..b75b90d2796 100644 --- a/runtime/compiler/CMakeLists.txt +++ b/runtime/compiler/CMakeLists.txt @@ -284,7 +284,11 @@ elseif(OMR_OS_AIX) -DSUPPORTS_THREAD_LOCAL ) if(OMR_ENV_DATA64) - list(APPEND J9_SHAREDFLAGS -q64) + if(CMAKE_C_COMPILER_IS_OPENXL) + list(APPEND J9_SHAREDFLAGS -m64) + else() + list(APPEND J9_SHAREDFLAGS -q64) + endif() if(OMR_TOOLCONFIG STREQUAL "xlc") # Modify the arch tuning value we inherit from OMR. list(REMOVE_ITEM TR_COMPILE_OPTIONS "-qarch=pwr7") diff --git a/runtime/compiler/env/J9KnownObjectTable.cpp b/runtime/compiler/env/J9KnownObjectTable.cpp index d545181ff1e..d07c40d2b73 100644 --- a/runtime/compiler/env/J9KnownObjectTable.cpp +++ b/runtime/compiler/env/J9KnownObjectTable.cpp @@ -21,6 +21,7 @@ *******************************************************************************/ #include "compile/Compilation.hpp" +#include "env/alloca_openxl.h" #include "env/j9fieldsInfo.h" #include "env/KnownObjectTable.hpp" #include "env/StackMemoryRegion.hpp" @@ -474,11 +475,7 @@ J9::KnownObjectTable::dumpTo(TR::FILE *file, TR::Compilation *comp) // Collect field info and determine which objects are reachable from other objects // TR_BitVector reachable(endIndex, comp->trMemory(), stackAlloc, notGrowable); - #if defined(__open_xl__) - TR_VMFieldsInfo **fieldsInfoByIndex = (TR_VMFieldsInfo**)__builtin_alloca(endIndex * sizeof(TR_VMFieldsInfo*)); - #else - TR_VMFieldsInfo **fieldsInfoByIndex = (TR_VMFieldsInfo**)alloca(endIndex * sizeof(TR_VMFieldsInfo*)); - #endif + TR_VMFieldsInfo **fieldsInfoByIndex = (TR_VMFieldsInfo**)alloca(endIndex * sizeof(TR_VMFieldsInfo*)); for (i = 1; i < endIndex; i++) { uintptr_t object = self()->getPointer(i); diff --git a/runtime/compiler/env/VMJ9.cpp b/runtime/compiler/env/VMJ9.cpp index d914dc01943..e97348ff1d2 100644 --- a/runtime/compiler/env/VMJ9.cpp +++ b/runtime/compiler/env/VMJ9.cpp @@ -27,6 +27,7 @@ #endif /* defined(J9VM_OPT_JITSERVER) */ #include "env/VMJ9.h" +#include "env/alloca_openxl.h" #include #include @@ -4552,11 +4553,7 @@ TR_J9VMBase::lookupArchetype(TR_OpaqueClassBlock *clazz, const char *name, const // placeholder argument. findClosestArchetype will progressively truncate // the other arguments until the best match is found. // - #if defined(__open_xl__) - char *truncatedSignature = (char*)__builtin_alloca(strlen(signature)+2); // + 'I' + null terminator - #else - char *truncatedSignature = (char*)alloca(strlen(signature)+2); // + 'I' + null terminator - #endif + char *truncatedSignature = (char*)alloca(strlen(signature)+2); // + 'I' + null terminator strcpy(truncatedSignature, signature); char toInsert = 'I'; char *cur; @@ -4579,18 +4576,10 @@ TR_J9VMBase::lookupMethodHandleThunkArchetype(uintptr_t methodHandle) // uintptr_t thunkableSignatureString = methodHandle_thunkableSignature((uintptr_t)methodHandle); intptr_t thunkableSignatureLength = getStringUTF8Length(thunkableSignatureString); - #if defined(__open_xl__) - char *thunkSignature = (char*)__builtin_alloca(thunkableSignatureLength+1); - #else - char *thunkSignature = (char*)alloca(thunkableSignatureLength+1); - #endif + char *thunkSignature = (char*)alloca(thunkableSignatureLength+1); getStringUTF8(thunkableSignatureString, thunkSignature, thunkableSignatureLength+1); - #if defined(__open_xl__) - char *archetypeSpecimenSignature = (char*)__builtin_alloca(thunkableSignatureLength+20); - #else - char *archetypeSpecimenSignature = (char*)alloca(thunkableSignatureLength+20); - #endif + char *archetypeSpecimenSignature = (char*)alloca(thunkableSignatureLength+20); strcpy(archetypeSpecimenSignature, thunkSignature); char *returnType = (1+strchr(archetypeSpecimenSignature, ')')); switch (returnType[0]) @@ -9827,11 +9816,7 @@ void JNICALL Java_java_lang_invoke_MutableCallSite_invalidate return; } - #if defined(__open_xl__) - jlong *cookies = (jlong*)__builtin_alloca(numSites * sizeof(cookies[0])); - #else - jlong *cookies = (jlong*)alloca(numSites * sizeof(cookies[0])); - #endif + jlong *cookies = (jlong*)alloca(numSites * sizeof(cookies[0])); env->GetLongArrayRegion(cookieArrayObject, 0, numSites, cookies); if (!env->ExceptionCheck()) { diff --git a/runtime/compiler/env/alloca_openxl.h b/runtime/compiler/env/alloca_openxl.h new file mode 100644 index 00000000000..aa1b88a15ea --- /dev/null +++ b/runtime/compiler/env/alloca_openxl.h @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright IBM Corp. and others 2000 + * + * This program and the accompanying materials are made available under + * the terms of the Eclipse Public License 2.0 which accompanies this + * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ + * or the Apache License, Version 2.0 which accompanies this distribution and + * is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * This Source Code may also be made available under the following + * Secondary Licenses when the conditions for such availability set + * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU + * General Public License, version 2 with the GNU Classpath + * Exception [1] and GNU General Public License, version 2 with the + * OpenJDK Assembly Exception [2]. + * + * [1] https://www.gnu.org/software/classpath/license.html + * [2] https://openjdk.org/legal/assembly-exception.html + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 + *******************************************************************************/ + +#if defined(__open_xl__) +#define alloca(size) __builtin_alloca(size) +#endif /* defined(__open_xl__) */ diff --git a/runtime/compiler/env/j9method.cpp b/runtime/compiler/env/j9method.cpp index 76ba1adde69..9088b0710f8 100644 --- a/runtime/compiler/env/j9method.cpp +++ b/runtime/compiler/env/j9method.cpp @@ -21,6 +21,7 @@ *******************************************************************************/ #include "env/j9method.h" +#include "env/alloca_openxl.h" #include #include "bcnames.h" @@ -8041,11 +8042,7 @@ TR_J9ByteCodeIlGenerator::runFEMacro(TR::SymbolReference *symRef) "type", "Ljava/lang/invoke/MethodType;"), "methodDescriptor", "Ljava/lang/String;"); methodDescriptorLength = fej9->getStringUTF8Length(methodDescriptorRef); - #if defined(__open_xl__) - methodDescriptor = (char*)__builtin_alloca(methodDescriptorLength+1); - #else - methodDescriptor = (char*)alloca(methodDescriptorLength+1); - #endif + methodDescriptor = (char*)alloca(methodDescriptorLength+1); fej9->getStringUTF8(methodDescriptorRef, methodDescriptor, methodDescriptorLength+1); } @@ -8246,11 +8243,7 @@ TR_J9ByteCodeIlGenerator::runFEMacro(TR::SymbolReference *symRef) "type", "Ljava/lang/invoke/MethodType;"), "methodDescriptor", "Ljava/lang/String;"); methodDescriptorLength = fej9->getStringUTF8Length(methodDescriptorRef); - #if defined(__open_xl__) - methodDescriptor = (char*)__builtin_alloca(methodDescriptorLength+1); - #else - methodDescriptor = (char*)alloca(methodDescriptorLength+1); - #endif + methodDescriptor = (char*)alloca(methodDescriptorLength+1); fej9->getStringUTF8(methodDescriptorRef, methodDescriptor, methodDescriptorLength+1); } @@ -8359,11 +8352,7 @@ TR_J9ByteCodeIlGenerator::runFEMacro(TR::SymbolReference *symRef) "type", "Ljava/lang/invoke/MethodType;"), "methodDescriptor", "Ljava/lang/String;"); methodDescriptorLength = fej9->getStringUTF8Length(methodDescriptorRef); - #if defined(__open_xl__) - nextHandleSignature = (char*)__builtin_alloca(methodDescriptorLength+1); - #else - nextHandleSignature = (char*)alloca(methodDescriptorLength+1); - #endif + nextHandleSignature = (char*)alloca(methodDescriptorLength+1); fej9->getStringUTF8(methodDescriptorRef, nextHandleSignature, methodDescriptorLength+1); } @@ -8844,11 +8833,7 @@ TR_J9ByteCodeIlGenerator::runFEMacro(TR::SymbolReference *symRef) // Construct the signature string for the array class // - #if defined(__open_xl__) - char *arrayClassSignature = (char*)__builtin_alloca(arity + leafClassNameLength + 3); // 3 = 'L' + ';' + null terminator - #else - char *arrayClassSignature = (char*)alloca(arity + leafClassNameLength + 3); // 3 = 'L' + ';' + null terminator - #endif + char *arrayClassSignature = (char*)alloca(arity + leafClassNameLength + 3); // 3 = 'L' + ';' + null terminator memset(arrayClassSignature, '[', arity); if (isPrimitiveClass) { @@ -9192,11 +9177,7 @@ TR_J9ByteCodeIlGenerator::runFEMacro(TR::SymbolReference *symRef) uintptr_t methodDescriptorRef = fej9->getReferenceField(finallyType, "methodDescriptor", "Ljava/lang/String;"); int methodDescriptorLength = fej9->getStringUTF8Length(methodDescriptorRef); - #if defined(__open_xl__) - methodDescriptor = (char*)__builtin_alloca(methodDescriptorLength+1); - #else - methodDescriptor = (char*)alloca(methodDescriptorLength+1); - #endif + methodDescriptor = (char*)alloca(methodDescriptorLength+1); fej9->getStringUTF8(methodDescriptorRef, methodDescriptor, methodDescriptorLength+1); } @@ -9382,11 +9363,7 @@ TR_J9ByteCodeIlGenerator::runFEMacro(TR::SymbolReference *symRef) "type", "Ljava/lang/invoke/MethodType;"), "methodDescriptor", "Ljava/lang/String;"); intptr_t methodDescriptorLength = fej9->getStringUTF8Length(methodDescriptorRef); - #if defined(__open_xl__) - nextSignature = (char*)__builtin_alloca(methodDescriptorLength+1); - #else - nextSignature = (char*)alloca(methodDescriptorLength+1); - #endif + nextSignature = (char*)alloca(methodDescriptorLength+1); fej9->getStringUTF8(methodDescriptorRef, nextSignature, methodDescriptorLength+1); } diff --git a/runtime/compiler/runtime/JitRuntime.cpp b/runtime/compiler/runtime/JitRuntime.cpp index ff0b4f8b9fb..e785acf0a90 100644 --- a/runtime/compiler/runtime/JitRuntime.cpp +++ b/runtime/compiler/runtime/JitRuntime.cpp @@ -46,6 +46,7 @@ #include "control/Options_inlines.hpp" #include "control/Recompilation.hpp" #include "control/CompilationStrategy.hpp" +#include "env/alloca_openxl.h" #include "env/CompilerEnv.hpp" #include "env/IO.hpp" #include "env/J2IThunk.hpp" @@ -1451,11 +1452,7 @@ static void printMethodHandleArgs(j9object_t methodHandle, void **stack, J9VMThr uintptr_t sigObject = fej9->methodType_descriptor(fej9->methodHandle_type((uintptr_t)methodHandle)); intptr_t sigLength = fej9->getStringUTF8Length(sigObject); - #if defined(__open_xl__) - char *sig = (char*)__builtin_alloca(sigLength+1); - #else - char *sig = (char*)alloca(sigLength+1); - #endif + char *sig = (char*)alloca(sigLength+1); fej9->getStringUTF8(sigObject, sig, sigLength+1); if (vlogTag) @@ -1583,11 +1580,7 @@ uint8_t *compileMethodHandleThunk(j9object_t methodHandle, j9object_t arg, J9VMT uintptr_t methodType = fej9->methodHandle_type((uintptr_t)methodHandle); uintptr_t descriptorObject = fej9->methodType_descriptor(methodType); intptr_t descriptorLength = fej9->getStringUTF8Length(descriptorObject); - #if defined(__open_xl__) - char *descriptorNTS = (char*)__builtin_alloca(descriptorLength+1); // NTS = null-terminated string - #else - char *descriptorNTS = (char*)alloca(descriptorLength+1); // NTS = null-terminated string - #endif + char *descriptorNTS = (char*)alloca(descriptorLength+1); // NTS = null-terminated string fej9->getStringUTF8(descriptorObject, descriptorNTS, descriptorLength+1); TR_VerboseLog::writeLineLocked(TR_Vlog_MHD, "%p %.*s %p hash %x type %p %s", vmThread, classNameLength, className, methodHandle, hashCode, methodType, descriptorNTS); } @@ -1617,11 +1610,7 @@ uint8_t *compileMethodHandleThunk(j9object_t methodHandle, j9object_t arg, J9VMT { uintptr_t thunkableSignatureString = fej9->methodHandle_thunkableSignature((uintptr_t)methodHandle); intptr_t thunkableSignatureLength = fej9->getStringUTF8Length(thunkableSignatureString); - #if defined(__open_xl__) - char *thunkSignature = (char*)__builtin_alloca(thunkableSignatureLength+1); - #else - char *thunkSignature = (char*)alloca(thunkableSignatureLength+1); - #endif + char *thunkSignature = (char*)alloca(thunkableSignatureLength+1); fej9->getStringUTF8(thunkableSignatureString, thunkSignature, thunkableSignatureLength+1); TR_VerboseLog::writeLineLocked(TR_Vlog_MHD, "%p Looking up archetype for class %.*s signature %s", vmThread, classNameLength, className, thunkSignature); } @@ -1714,11 +1703,7 @@ void *initialInvokeExactThunk(j9object_t methodHandle, J9VMThread *vmThread) uintptr_t thunkableSignatureString = fej9->methodHandle_thunkableSignature((uintptr_t)methodHandle); intptr_t thunkableSignatureLength = fej9->getStringUTF8Length(thunkableSignatureString); - #if defined(__open_xl__) - char *thunkSignature = (char*)__builtin_alloca(thunkableSignatureLength+1); - #else - char *thunkSignature = (char*)alloca(thunkableSignatureLength+1); - #endif + char *thunkSignature = (char*)alloca(thunkableSignatureLength+1); fej9->getStringUTF8(thunkableSignatureString, thunkSignature, thunkableSignatureLength+1); uintptr_t thunkTuple = fej9->getReferenceField((uintptr_t)methodHandle, "thunks", "Ljava/lang/invoke/ThunkTuple;"); @@ -1732,11 +1717,7 @@ void *initialInvokeExactThunk(j9object_t methodHandle, J9VMThread *vmThread) uintptr_t methodType = fej9->methodHandle_type((uintptr_t)methodHandle); uintptr_t descriptorObject = fej9->methodType_descriptor(methodType); intptr_t descriptorLength = fej9->getStringUTF8Length(descriptorObject); - #if defined(__open_xl__) - char *descriptorNTS = (char*)__builtin_alloca(descriptorLength+1); // NTS = null-terminated string - #else - char *descriptorNTS = (char*)alloca(descriptorLength+1); // NTS = null-terminated string - #endif + char *descriptorNTS = (char*)alloca(descriptorLength+1); // NTS = null-terminated string fej9->getStringUTF8(descriptorObject, descriptorNTS, descriptorLength+1); TR_VerboseLog::writeLineLocked(TR_Vlog_MHD, "%p %.*s %p hash %x type %p %s", vmThread, classNameLength, className, methodHandle, hashCode, methodType, descriptorNTS); TR_VerboseLog::writeLineLocked(TR_Vlog_MHD, "%p ThunkTuple %p thunkableSignature: %s", vmThread, thunkTuple, thunkSignature); diff --git a/runtime/compiler/runtime/SymbolValidationManager.cpp b/runtime/compiler/runtime/SymbolValidationManager.cpp index a19788bcc93..d2e235f9ce8 100644 --- a/runtime/compiler/runtime/SymbolValidationManager.cpp +++ b/runtime/compiler/runtime/SymbolValidationManager.cpp @@ -22,6 +22,7 @@ #include #include "env/VMJ9.h" +#include "env/alloca_openxl.h" #include "env/ClassLoaderTable.hpp" #include "env/PersistentCHTable.hpp" #include "env/VMAccessCriticalSection.hpp" @@ -1471,20 +1472,12 @@ TR::SymbolValidationManager::validateMethodFromClassAndSignatureRecord(uint16_t TR_OpaqueClassBlock *beholder = getClassFromID(beholderID, SymOptional); J9UTF8 *methodNameData = J9ROMMETHOD_NAME(romMethod); - #if defined(__open_xl__) - char *methodName = (char *)__builtin_alloca(J9UTF8_LENGTH(methodNameData)+1); - #else - char *methodName = (char *)alloca(J9UTF8_LENGTH(methodNameData)+1); - #endif + char *methodName = (char *)alloca(J9UTF8_LENGTH(methodNameData)+1); strncpy(methodName, reinterpret_cast(J9UTF8_DATA(methodNameData)), J9UTF8_LENGTH(methodNameData)); methodName[J9UTF8_LENGTH(methodNameData)] = '\0'; J9UTF8 *methodSigData = J9ROMMETHOD_SIGNATURE(romMethod); - #if defined(__open_xl__) - char *methodSig = (char *)__builtin_alloca(J9UTF8_LENGTH(methodSigData)+1); - #else - char *methodSig = (char *)alloca(J9UTF8_LENGTH(methodSigData)+1); - #endif + char *methodSig = (char *)alloca(J9UTF8_LENGTH(methodSigData)+1); strncpy(methodSig, reinterpret_cast(J9UTF8_DATA(methodSigData)), J9UTF8_LENGTH(methodSigData)); methodSig[J9UTF8_LENGTH(methodSigData)] = '\0'; diff --git a/runtime/gc_glue_java/configure_includes/configure_aix_ppc.mk b/runtime/gc_glue_java/configure_includes/configure_aix_ppc.mk index b923fc6f218..cd0c45bbb93 100644 --- a/runtime/gc_glue_java/configure_includes/configure_aix_ppc.mk +++ b/runtime/gc_glue_java/configure_includes/configure_aix_ppc.mk @@ -77,6 +77,10 @@ CONFIGURE_ARGS += 'OMR_HOST_OS=aix' CONFIGURE_ARGS += 'OMR_HOST_ARCH=ppc' CONFIGURE_ARGS += 'OMR_TARGET_DATASIZE=$(TEMP_TARGET_DATASIZE)' CONFIGURE_ARGS += 'OMR_TOOLCHAIN=xlc' - -CONFIGURE_ARGS+= 'GLOBAL_CFLAGS=-qstackprotect' -CONFIGURE_ARGS+= 'GLOBAL_CXXFLAGS=-qstackprotect' +ifeq ($(OMR_ENV_OPENXL),1) + CONFIGURE_ARGS += 'GLOBAL_CFLAGS=-fstack-protector' + CONFIGURE_ARGS += 'GLOBAL_CXXFLAGS=-fstack-protector' +else + CONFIGURE_ARGS += 'GLOBAL_CFLAGS=-qstackprotect' + CONFIGURE_ARGS += 'GLOBAL_CXXFLAGS=-qstackprotect' +endif diff --git a/runtime/makelib/targets.mk.aix.inc.ftl b/runtime/makelib/targets.mk.aix.inc.ftl index 40adeae5e53..918989ba041 100644 --- a/runtime/makelib/targets.mk.aix.inc.ftl +++ b/runtime/makelib/targets.mk.aix.inc.ftl @@ -55,7 +55,11 @@ endif ifeq ($(j9vm_env_data64),1) UMA_ASPP_DEBUG += -g UMA_LIB_LINKER_FLAGS += -X64 - UMA_CC_MODE += -q64 + ifeq ($(OMR_ENV_OPENXL),1) + UMA_CC_MODE += -m64 + else + UMA_CC_MODE += -q64 + endif else UMA_ASPP_DEBUG += $(VMASMDEBUG) UMA_LIB_LINKER_FLAGS += -X32 @@ -98,13 +102,22 @@ else endif ifeq (,$(findstring xlclang,$(notdir $(CC)))) - # xlc options - CFLAGS += -q mbcs -qinfo=pro + ifeq ($(OMR_ENV_OPENXL),1) + # for openxl do nothing + else + # xlc options + CFLAGS += -q mbcs -qinfo=pro + endif else - # xlclang options + # xlclang options CFLAGS += -qxlcompatmacros endif -CFLAGS += -qlanglvl=extended -qarch=ppc -qalias=noansi -qxflag=LTOL:LTOL0 -qsuppress=1506-1108 -qstackprotect +ifeq ($(OMR_ENV_OPENXL),1) + #openxl options + CFLAGS += -std=c89 -qarch=ppc -fno-strict-aliasing -fstack-protector +else + CFLAGS += -qlanglvl=extended -qarch=ppc -qalias=noansi -qxflag=LTOL:LTOL0 -qsuppress=1506-1108 -qstackprotect +endif CFLAGS += -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE -DRS6000 -DAIXPPC -D_LARGE_FILES ifdef I5_VERSION @@ -114,13 +127,26 @@ else endif ifeq (,$(findstring xlclang++,$(notdir $(CXX)))) - # xlc++ options - CXXFLAGS += -q mbcs -qinfo=pro + ifeq ($(OMR_ENV_OPENXL),1) + # for openxl do nothing + else + # xlc++ options + CXXFLAGS += -q mbcs -qinfo=pro + else + # openxl options + CXXFLAGS += -fno-rtti -fno-exceptions + endif else # xlclang++ options CXXFLAGS += -qxlcompatmacros -fno-rtti -fno-exceptions + CXXFLAGS += -qxlcompatmacros -fno-rtti -fno-exceptions +endif +ifeq ($(OMR_ENV_OPENXL),1) + # openxl options + CXXFLAGS += -std=c++11 -qarch=ppc -fno-strict-aliasing -fstack-protector +else + CXXFLAGS += -qlanglvl=extended0x -qarch=ppc -qalias=noansi -qxflag=LTOL:LTOL0 -qsuppress=1506-1108 -qstackprotect endif -CXXFLAGS += -qlanglvl=extended0x -qarch=ppc -qalias=noansi -qxflag=LTOL:LTOL0 -qsuppress=1506-1108 -qstackprotect CXXFLAGS += -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE -DRS6000 -DAIXPPC -D_LARGE_FILES CPPFLAGS += -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE -DRS6000 -DAIXPPC -D_LARGE_FILES @@ -143,7 +169,11 @@ endif UMA_SYS_LINK_PATH := -L/usr/lib/threads ifeq ($(j9vm_env_data64),1) - UMA_DLL_LINK_FLAGS += -q64 + ifeq ($(OMR_ENV_OPENXL),1) + UMA_DLL_LINK_FLAGS += -m64 + else + UMA_DLL_LINK_FLAGS += -q64 + endif else UMA_DLL_LINK_FLAGS += -q32 endif @@ -178,7 +208,11 @@ $(patsubst %.s,%.o,$(filter %.s,$(UMA_FILES_TO_PREPROCESS))) : %$(UMA_DOT_O) : % ifdef UMA_TREAT_WARNINGS_AS_ERRORS ifndef UMA_SUPPRESS_WARNINGS_AS_ERRORS - CFLAGS += -qhalt=w - CXXFLAGS += -qhalt=w + ifeq ($(OMR_ENV_OPENXL),1) + # if compiler is openxl do nothing + else + CFLAGS += -qhalt=w + CXXFLAGS += -qhalt=w + endif endif endif diff --git a/runtime/oti/j9nonbuilder.h b/runtime/oti/j9nonbuilder.h index 66213f37e77..b4ccb4f63e4 100644 --- a/runtime/oti/j9nonbuilder.h +++ b/runtime/oti/j9nonbuilder.h @@ -1581,10 +1581,9 @@ typedef struct J9ExceptionHandler { U_32 exceptionClassIndex; } J9ExceptionHandler; -//JACKIE: not sure where defined(__open_xl__) condition should go -#if defined(__xlC__) || defined(J9ZOS390) || defined(__open_xl__) /* Covers: Z/OS, AIX, Linux PPC*/ +#if defined(__xlC__) || defined(J9ZOS390) || defined(__open_xl__) /* Covers: AIX, Linux PPC and z/OS. */ #pragma pack(1) -#elif defined(__ibmxl__) || defined(__open_xl__) || defined(__GNUC__) || defined(_MSC_VER) /* Covers: Linux PPC LE, Windows, Linux x86 */ +#elif defined(__ibmxl__) || defined(__GNUC__) || defined(_MSC_VER) /* Covers: Linux PPC LE, Windows, Linux x86 */ #pragma pack(push, 1) /* Above covers all the platform for J9 VM compile jobs. DDR is compiled with EDG compiler, there following is for DDR compile */ #elif defined(LINUXPPC) || defined(AIXPPC) diff --git a/runtime/tests/redirector/jep178/CMakeLists.txt b/runtime/tests/redirector/jep178/CMakeLists.txt index 287f65d80b5..de53fb74714 100644 --- a/runtime/tests/redirector/jep178/CMakeLists.txt +++ b/runtime/tests/redirector/jep178/CMakeLists.txt @@ -34,7 +34,11 @@ if(OMR_OS_LINUX) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic") endif() elseif(OMR_OS_AIX) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qpic -brtl -bexpall") + if(CMAKE_C_COMPILER_IS_OPENXL) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpic -brtl -bexpall") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qpic -brtl -bexpall") + endif() endif() j9vm_add_executable(testjep178_static diff --git a/runtime/verbose/CMakeLists.txt b/runtime/verbose/CMakeLists.txt index 94eabf11665..c589d862f7f 100644 --- a/runtime/verbose/CMakeLists.txt +++ b/runtime/verbose/CMakeLists.txt @@ -62,30 +62,52 @@ target_include_directories(j9vrb ${j9vm_SOURCE_DIR}/shared_common/include ) -target_link_libraries(j9vrb - PRIVATE - j9vm_interface - j9vm_gc_includes - j9vm_compiler_defines - - j9stackmap - j9verutil - j9pool - j9modronstartup - j9gcvrbjava - j9gcvrbold - j9gcvrbevents - j9gcvrbhdlrstandardjava - j9gcvrbhdlrrealtime - j9gcvrbhdlrvlhgc - j9zip - j9utilcore - j9gc - j9gctrc - j9gcapi - j9gctrcstandard - j9gctrcvlhgc -) +if(DEFINED OMR_OS_AIX AND DEFINED CMAKE_C_COMPILER_IS_OPENXL) + target_link_libraries(j9vrb + PRIVATE + j9vm_interface + j9vm_gc_includes + j9vm_compiler_defines + + j9stackmap + j9verutil + j9pool + j9modronstartup + j9gcvrbjava + j9gcvrbold + j9gcvrbevents + j9gcvrbhdlrstandardjava + j9gcvrbhdlrrealtime + j9gcvrbhdlrvlhgc + j9zip + j9utilcore + j9gc + j9gctrc + j9gcapi + j9gctrcstandard + j9gctrcvlhgc + ) +else() + target_link_libraries(j9vrb + PRIVATE + j9vm_interface + j9vm_gc_includes + j9vm_compiler_defines + + j9stackmap + j9verutil + j9pool + j9modronstartup + j9gcvrbjava + j9gcvrbold + j9gcvrbevents + j9gcvrbhdlrstandardjava + j9gcvrbhdlrrealtime + j9gcvrbhdlrvlhgc + j9zip + j9utilcore + ) +endif() target_compile_definitions(j9vrb PRIVATE @@ -125,30 +147,52 @@ if(OMR_MIXED_REFERENCES_MODE_STATIC) ${j9vm_SOURCE_DIR}/shared_common/include ) - target_link_libraries(j9vrb_full - PRIVATE - j9vm_interface - j9vm_gc_includes - j9vm_compiler_defines - - j9stackmap - j9verutil - j9pool - j9modronstartup_full - j9gcvrbjava_full - j9gcvrbold_full - j9gcvrbevents_full - j9gcvrbhdlrstandardjava_full - j9gcvrbhdlrrealtime_full - j9gcvrbhdlrvlhgc_full - j9zip - j9utilcore - j9gc - j9gctrc - j9gcapi - j9gctrcstandard - j9gctrcvlhgc - ) + if(DEFINED OMR_OS_AIX AND DEFINED CMAKE_C_COMPILER_IS_OPENXL) + target_link_libraries(j9vrb_full + PRIVATE + j9vm_interface + j9vm_gc_includes + j9vm_compiler_defines + + j9stackmap + j9verutil + j9pool + j9modronstartup_full + j9gcvrbjava_full + j9gcvrbold_full + j9gcvrbevents_full + j9gcvrbhdlrstandardjava_full + j9gcvrbhdlrrealtime_full + j9gcvrbhdlrvlhgc_full + j9zip + j9utilcore + j9gc + j9gctrc + j9gcapi + j9gctrcstandard + j9gctrcvlhgc + ) + else() + target_link_libraries(j9vrb_full + PRIVATE + j9vm_interface + j9vm_gc_includes + j9vm_compiler_defines + + j9stackmap + j9verutil + j9pool + j9modronstartup_full + j9gcvrbjava_full + j9gcvrbold_full + j9gcvrbevents_full + j9gcvrbhdlrstandardjava_full + j9gcvrbhdlrrealtime_full + j9gcvrbhdlrvlhgc_full + j9zip + j9utilcore + ) + endif() target_compile_definitions(j9vrb_full PRIVATE