Skip to content

Commit

Permalink
Add CMAKE_C_COMPILER_IS_OPENXL macro for related flags
Browse files Browse the repository at this point in the history
Add CMAKE_C_COMPILER_IS_OPENXL macro to add the compiler flags
needed by openXL17

Signed-off-by: Ishita Ray <ishita.ray@ibm.com>
  • Loading branch information
ishitaR88 committed Sep 26, 2024
1 parent a1ca6df commit 121bd27
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 72 deletions.
9 changes: 7 additions & 2 deletions runtime/cmake/platform/os/aix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 -latomic -lperfstat -liconv")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-brtl -latomic -lperfstat -liconv")
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()
2 changes: 1 addition & 1 deletion runtime/cmake/platform/toolcfg/gnu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ 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 AND NOT OMR_OS_AIX)
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()

Expand Down
8 changes: 6 additions & 2 deletions runtime/compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,19 @@ elseif(OMR_OS_AIX)
-DSUPPORTS_THREAD_LOCAL
)
if(OMR_ENV_DATA64)
list(APPEND J9_SHAREDFLAGS -m64)
if(OMR_OS_AIX AND 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")
list(APPEND TR_COMPILE_OPTIONS "-qarch=ppc64grsq")

if(CMAKE_C_COMPILER_IS_XLCLANG)
# xlclang/xlclang++ options
list(APPEND SPP_FLAGS -std=extc99)
list(APPEND SPP_FLAGS -qlanglvl=extc99)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lc++")
endif()
endif()
Expand Down
10 changes: 7 additions & 3 deletions runtime/gc_glue_java/configure_includes/configure_aix_ppc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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=-fstack-protector'
CONFIGURE_ARGS+= 'GLOBAL_CXXFLAGS=-fstack-protector'
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
15 changes: 12 additions & 3 deletions runtime/jilgen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,22 @@ j9vm_add_executable(constgen
jilconsts.c
)

target_link_libraries(constgen
if(DEFINED OMR_OS_AIX AND DEFINED CMAKE_C_COMPILER_IS_OPENXL)
target_link_libraries(constgen
PRIVATE
j9vm_interface
omrport
j9thr
j9util
)
else()
target_link_libraries(constgen
PRIVATE
j9vm_interface
omrport
j9thr
j9util
)
)
endif()

# Add command and target to generate jilconsts.inc/jilvalues.m4 via the constgen program.

Expand Down
2 changes: 1 addition & 1 deletion runtime/libffi/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
</makefilestub>

<!-- Build .S files on AIX -->
<makefilestub data="TARGET_MACH=-m64">
<makefilestub data="TARGET_MACH=-q64">
<include-if condition="spec.aix_ppc-64.*" />
</makefilestub>
<makefilestub data="TARGET_MACH=-q32">
Expand Down
50 changes: 40 additions & 10 deletions runtime/makelib/targets.mk.aix.inc.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ endif
ifeq ($(j9vm_env_data64),1)
UMA_ASPP_DEBUG += -g
UMA_LIB_LINKER_FLAGS += -X64
UMA_CC_MODE += -m64
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
Expand Down Expand Up @@ -98,12 +102,20 @@ else
endif

ifeq (,$(findstring xlclang,$(notdir $(CC))))
# xlc options
CFLAGS += -q mbcs -qinfo=pro
ifneq ($(OMR_ENV_OPENXL),1)
# xlc options
CFLAGS += -q mbcs -qinfo=pro
endif
else
# xlclang options
CFLAGS += -qxlcompatmacros
endif
ifneq ($(OMR_ENV_OPENXL),1)
CFLAGS += -qlanglvl=extended -qarch=ppc -qalias=noansi -qxflag=LTOL:LTOL0 -qsuppress=1506-1108 -qstackprotect
else
# xlclang options
#openxl options
CFLAGS += -std=c89 -qarch=ppc -fno-strict-aliasing -fstack-protector
endif
CFLAGS += -std=c89 -qarch=ppc -fno-strict-aliasing -fstack-protector
CFLAGS += -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE -DRS6000 -DAIXPPC -D_LARGE_FILES

ifdef I5_VERSION
Expand All @@ -113,13 +125,23 @@ else
endif

ifeq (,$(findstring xlclang++,$(notdir $(CXX))))
# xlc++ options
CXXFLAGS += -q mbcs -qinfo=pro
ifneq ($(OMR_ENV_OPENXL),1)
# xlc++ options
CXXFLAGS += -q mbcs -qinfo=pro
else
# openxl options
CXXFLAGS += -fno-rtti -fno-exceptions
endif
else
# xlclang++ options
CXXFLAGS += -fno-rtti -fno-exceptions
CXXFLAGS += -qxlcompatmacros -fno-rtti -fno-exceptions
endif
ifneq ($(OMR_ENV_OPENXL),1)
CXXFLAGS += -qlanglvl=extended0x -qarch=ppc -qalias=noansi -qxflag=LTOL:LTOL0 -qsuppress=1506-1108 -qstackprotect
else
# openxl options
CXXFLAGS += -std=c++11 -qarch=ppc -fno-strict-aliasing -fstack-protector
endif
CXXFLAGS += -std=c++11 -qarch=ppc -fno-strict-aliasing -fstack-protector
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

Expand All @@ -142,7 +164,11 @@ endif
UMA_SYS_LINK_PATH := -L/usr/lib/threads

ifeq ($(j9vm_env_data64),1)
UMA_DLL_LINK_FLAGS += -m64
ifeq ($(OMR_ENV_OPENXL),1)
UMA_DLL_LINK_FLAGS += -m64
else
UMA_DLL_LINK_FLAGS += -q64
endif
else
UMA_DLL_LINK_FLAGS += -q32
endif
Expand Down Expand Up @@ -177,5 +203,9 @@ $(patsubst %.s,%.o,$(filter %.s,$(UMA_FILES_TO_PREPROCESS))) : %$(UMA_DOT_O) : %

ifdef UMA_TREAT_WARNINGS_AS_ERRORS
ifndef UMA_SUPPRESS_WARNINGS_AS_ERRORS
ifneq ($(OMR_ENV_OPENXL),1)
CFLAGS += -qhalt=w
CXXFLAGS += -qhalt=w
endif
endif
endif
6 changes: 5 additions & 1 deletion runtime/tests/redirector/jep178/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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} -fpic -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
Expand Down
2 changes: 1 addition & 1 deletion runtime/tests/redirector/jep178/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
<makefilestub data="CFLAGS += -Wc,DLL,EXPORTALL">
<include-if condition="spec.zos_390.*"/>
</makefilestub>
<makefilestub data="UMA_CC_MODE += -fpic -brtl -bexpall">
<makefilestub data="UMA_CC_MODE += -qpic -brtl -bexpall">
<include-if condition="spec.aix_.*"/>
</makefilestub>
<makefilestub data="UMA_LINK_FLAGS += -Wl,xplink,dll">
Expand Down
140 changes: 92 additions & 48 deletions runtime/verbose/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions runtime/vm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ elseif(OMR_OS_ZOS)
-O2
"\"-Wc,TBYDBG(-qdebug=MRABIG)\""
"\"-Wc,TBYDBG(-qdebug=lincomm:ptranl:tfbagg)\""
"\"-Wc,FEDBG(-qxflag=InlineDespiteVolatileInArgs)\""
)
endif()

Expand Down

0 comments on commit 121bd27

Please sign in to comment.