Skip to content

Conversation

@Deigue
Copy link
Contributor

@Deigue Deigue commented Apr 25, 2024

Adds the initial set of changes to support compilation with Open XL on z/OS. This will define the alternative flags and configuration that needs to be used by the wyvern compiler while running on z/OS.

(This is one part of the multiple changes added for supporting Open XL compilation on OMR)

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for supporting the project, and congratulations on your first contribution! A project committer will shortly review your contribution. In the mean time, if you haven't had a chance please skim over the contribution guidelines which all pull requests must adhere to. If the ECA pull request check fails, have a look at the instructions for signing the ECA in the legal considerations section.

If you run into any problems our community will be happy to assist you in any way we can. There are a number of recommended ways to interact with the community. We encourage you to ask questions, or drop by to say hello.

@Deigue Deigue force-pushed the openxl-toolchain branch 2 times, most recently from 3f0b73e to c39496d Compare April 26, 2024 15:24
@Deigue Deigue force-pushed the openxl-toolchain branch 2 times, most recently from 3ccf780 to e34c258 Compare May 6, 2024 19:12
@Deigue Deigue force-pushed the openxl-toolchain branch from e34c258 to e63f484 Compare May 21, 2024 20:11
@babsingh
Copy link
Contributor

babsingh commented Jun 3, 2024

jenkins build all

@Deigue Deigue force-pushed the openxl-toolchain branch 2 times, most recently from b9fb8d3 to f7c2ff6 Compare June 3, 2024 18:45
@Deigue Deigue force-pushed the openxl-toolchain branch 2 times, most recently from ff73ec3 to c1479dd Compare June 10, 2024 16:59
@Deigue
Copy link
Contributor Author

Deigue commented Jun 10, 2024

Changes here confirmed all passing j11 / j17 / j21 builds.

@babsingh
Copy link
Contributor

jenkins build all

Copy link
Contributor

@babsingh babsingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High level feedback:

  • Squash the two commits into a single commit.
  • Revise and improve comments.
  • Remove dead code.

-m64
)
else()
# -qarch should be there for 32 and 64 C/CXX flags but the C compiler is used for the assembler and it has trouble with some assembly files if it is specified
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Spread comments longer than 100 chars across multiple lines.
  • End comments with a full stop / period.
Suggested change
# -qarch should be there for 32 and 64 C/CXX flags but the C compiler is used for the assembler and it has trouble with some assembly files if it is specified
# -qarch should be there for 32 and 64 C/CXX flags but the C compiler is used for
# the assembler and it has trouble with some assembly files if it is specified.

Comment on lines 131 to 136
#"\"-Wc,xplink\"" # link with xplink calling convention
#"\"-Wc,rostring\"" # place string literals in read only storage
#"\"-Wc,FLOAT(IEEE,FOLD,AFP)\"" # Use IEEE (instead of IBM Hex Format) style floats
#"\"-Wc,enum(4)\"" # Specifies how many bytes of storage enums occupy
#"\"-Wa,goff\"" # Assemble into GOFF object files
#"\"-Wc,NOANSIALIAS\"" # Do not generate ALIAS binder control statements
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove dead code instead of commenting it.

string(APPEND CMAKE_ASM_FLAGS " \"-Wa,-mgoff\"")
string(APPEND CMAKE_ASM_FLAGS " \"-Wa,-mSYSPARM(BIT64)\"")

# commenting out options progressively as they are not needed with Open XL, can remove in cleanup later.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation is off, but this comment should go away since dead code will be removed.

endfunction()
else()
function(_omr_toolchain_process_exports TARGET_NAME)
# we only need to do something if we are dealing with a shared library
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First person should be avoided since it is informal and takes attention away from the key point.

@babsingh
Copy link
Contributor

@keithc-ca Can you please review this PR?

set(CMAKE_C_COMPILER_IS_OPENXL ON CACHE BOOL "ibm-clang is the C compiler")
set(_OMR_TOOLCONFIG "openxl")
else()
message(STATUS "NO MATCH")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this should be fatal (like line 219)?
Actually, I think line 219 should use CMAKE_C_COMPILER_ID instead of CMAKE_CXX_COMPILER_ID.

Copy link
Contributor Author

@Deigue Deigue Jun 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Keith, I was verifying all my cleanup changes with different builds. After making the above-mentioned changes, while Open XL passes with no problems, XLC build gives a fatal error, because I guess it is entering this z/OS section, but not matching with the other xlclang compilers and in place of the "NO MATCH" its just throwing the error.

Perhaps it makes more sense to update this to
message(STATUS "NO XLClang match. Using xlc toolchain.")

with the above, both XLC / OpenXL are now compiling successfully.

Does this sound good?

Comment on lines 2 to 20

# Copyright (c) 2017, 2024 IBM Corp. and others
#
# 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 http://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] http://openjdk.java.net/legal/assembly-exception.html
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
###############################################################################
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the right copyright notice. The year should be 2024 (since this file is new); we don't need blank line 2; and the URLs and SPDX are wrong. This should be copied from an existing file.

Comment on lines 61 to 63
# Testarossa build variables. Longer term the distinction between TR and the rest
# of the OMR code should be heavily reduced. In the mean time, we keep
# the distinction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Punctuation.

Comment on lines 123 to 124


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one blank line, please.

set(OMR_C_WARNINGS_AS_ERROR_FLAG -qhalt=w)
set(OMR_CXX_WARNINGS_AS_ERROR_FLAG -qhalt=w)

# There is no enhanced warning for XLC right now
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not be used for xlc: why is that compiler even mentioned here?

ddr/Makefile Outdated
OMR_TOOLCHAIN ?= gcc

ifneq (,$(filter gcc xlc,$(OMR_TOOLCHAIN)))
ifneq (,$(filter gcc xlc openxl,$(OMR_TOOLCHAIN)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care about non-cmake builds with OpenXL? If not, the remaining changes should be removed.

@Deigue Deigue force-pushed the openxl-toolchain branch 2 times, most recently from 5ce9dec to a47dfb7 Compare June 18, 2024 14:59
@keithc-ca
Copy link
Contributor

The commit message and the discussion here should refer to "z/OS", not "zos".

@Deigue Deigue changed the title Add Open XL toolchain and config changes for zos Add Open XL toolchain and config changes for z/OS Jun 19, 2024
@Deigue Deigue force-pushed the openxl-toolchain branch 2 times, most recently from 57cc58e to 69a94df Compare June 19, 2024 17:48
@Deigue
Copy link
Contributor Author

Deigue commented Jun 19, 2024

Thanks for the feedback/cleanup suggestions. I've addressed the above comments and verified builds are passing.

@Deigue Deigue force-pushed the openxl-toolchain branch from 69a94df to 979c63b Compare June 19, 2024 17:51
Comment on lines 27 to 28
omr_remove_flags(CMAKE_ASM_FLAGS -qhalt=e)
omr_remove_flags(CMAKE_CXX_FLAGS -qhalt=s)
omr_remove_flags(CMAKE_C_FLAGS -qhalt=e)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest languages should be addressed in a consistent order; see lines 34-35 and elsewhere, where C is handled before C++.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reordered to put C_FLAGS first as seen in other places.

Comment on lines 51 to 52
# -march should be there for 32 and 64 C/CXX flags but the C compiler is used for
# the assembler and it has trouble with some assembly files if it is specified.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this comment reference 64-bit compiles here in the 32-bit branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed along with the rest of "ppc" section, as POWER support will be contributed by another developer as mentioned below.

endmacro(omr_toolconfig_global_setup)
endif()

if(OMR_HOST_ARCH STREQUAL "ppc")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has any of this been tested on POWER? I see several -q options which appear to be in the xlc style.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another dev (Jackie) is working on support for POWER, as such I will be removing this untested section from here. Believe she has commits that are adding support separately so this section should be not here.

set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -X64 cr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -X64 <TARGET>")
endif()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please omit this blank line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed extra line.


set(CMAKE_ASM_FLAGS "-fno-integrated-as")
string(APPEND CMAKE_ASM_FLAGS " \"-Wa,-mgoff\"")
string(APPEND CMAKE_ASM_FLAGS " \"-Wa,-mSYSPARM(BIT64)\"")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't BIT64 be conditional on OMR_ENV_DATA64?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the missing conditional

configure Outdated
OMR_TOOLCHAIN
The toolchain used to build the package. One of: gcc,xlc,msvc
The toolchain used to build the package. One of:
gcc,xlc,msvc,openxl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not be modified: it's not used in cmake builds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

configure.ac Outdated
AC_ARG_VAR([OMR_HOST_ARCH], [The architecture of the CPU where the package will run. One of: aarch64,arm,ppc,riscv,s390,x86])
AC_ARG_VAR([OMR_TARGET_DATASIZE], [Specifies whether the package will run in 32- or 64-bit mode. One of: 31,32,64])
AC_ARG_VAR([OMR_TOOLCHAIN], [The toolchain used to build the package. One of: gcc,xlc,msvc])
AC_ARG_VAR([OMR_TOOLCHAIN], [The toolchain used to build the package. One of: gcc,xlc,msvc,openxl])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not be modified: it's not used in cmake builds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@Deigue Deigue force-pushed the openxl-toolchain branch from 979c63b to c4851ce Compare June 27, 2024 15:28
@Deigue Deigue force-pushed the openxl-toolchain branch 2 times, most recently from 5e5e1ab to fd03c70 Compare October 29, 2024 18:01
@Deigue Deigue force-pushed the openxl-toolchain branch 2 times, most recently from 5b5b433 to add5876 Compare November 27, 2024 17:17
Comment on lines 23 to 24
list(APPEND OMR_PLATFORM_C_COMPILE_OPTIONS -qlanglvl=extended)
list(APPEND OMR_PLATFORM_CXX_COMPILE_OPTIONS -qlanglvl=extended0x)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look like xlc options, not openxl options.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@midronij Which files are currently being used by AIX for Open XL? Looks like I have this section specific to AIX where the flags aren't updated. I am assuming if the changes for AIX are already merged, they may be coming from somewhere else already. Is it safe to assume this section can be removed, just wanted to confirm.

Copy link
Contributor

@midronij midronij Feb 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently on AIX, OpenXL actually uses the GNU cmake file (cmake/modules/platform/toolcfg/gnu.cmake). Generally speaking, clang-based compilers (like OpenXL or xlclang) are considered to be GNU compilers by the config and makefiles.

That being the case, I opted to modify the existing GNU cmake files to account for the use of OpenXL on AIX, rather than create new ones for OpenXL. So you should be able to safely remove that section and any others that are specific to AIX. The only thing to be careful of is that the addition of this new file doesn't break the AIX build, since my changes don't take its existence into account.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it should be mutually exclusive then, Thanks. I will remove the above section.

Comment on lines 148 to 150
if("@OMR_OS_ZOS@" AND "@OMR_ENV_DATA64@" AND NOT "@CMAKE_C_COMPILER_IS_OPENXL@")
# We need to set 64 bit code generation to ensure that limits.h macros are set correctly.
list(APPEND pp_command "-Wc,lp64")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does openxl only support 64-bit targets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think so, but this exclusion was simply added so that the build knows not append this flag. For Open-XL, this is applied by default without specifying. Adding it to the full command with the "-Wc" format causes compilation error as it is not recognized.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think CMAKE_C_COMPILER_IS_OPENXL should not be used, in favour of using OMR_TOOLCONFIG STREQUAL "openxl".

@Deigue Deigue force-pushed the openxl-toolchain branch 2 times, most recently from 4f919e5 to 6b3489e Compare February 19, 2025 16:19
@Deigue
Copy link
Contributor Author

Deigue commented Feb 19, 2025

Made the requested changes based on Keith's feedback and also rebased with latest master.
Please review.

@Deigue Deigue requested a review from keithc-ca February 19, 2025 16:20
Comment on lines 148 to 150
if("@OMR_OS_ZOS@" AND "@OMR_ENV_DATA64@" AND NOT "@CMAKE_C_COMPILER_IS_OPENXL@")
# We need to set 64 bit code generation to ensure that limits.h macros are set correctly.
list(APPEND pp_command "-Wc,lp64")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think CMAKE_C_COMPILER_IS_OPENXL should not be used, in favour of using OMR_TOOLCONFIG STREQUAL "openxl".

Comment on lines 21 to 22


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One blank at a time, please.


list(APPEND OMR_PLATFORM_CXX_COMPILE_OPTIONS
-march=${OMR_ZOS_COMPILE_ARCHITECTURE}
"-std=gnu++14"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why gnu and not c as in -std=c++14?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sean from the cpp team recommended to use gnu++14 over c++14 to avoid using _EXT in most places ...
More specifics regarding feedback there:
_EXT required for alloca() not being exposed in javadump.cpp

Use -std=gnu++14.  The closest XL option to -std=c++14 is -qlanglvl=ansi.  With that XL option you would need to add 
_EXT too.  The -std=gnu* options are the closest to -qlanglvl=etended.   stdlib.h will declare alloca() with -std=gnu*.
---
If you say you want a standard language level (like std=c++14), then you do need to specify the _EXT to say you want
extensions. If you use extension based language levels (like the gnu versions) then you get most extensions enabled by
default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Please add a comment that summarizes that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see that comment.

-mnocsect
)

# Configure the platform dependent library for multithreading.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please hyphenate "platform-dependent".

Comment on lines 88 to 94
if(CMAKE_C_COMPILER_IS_XLCLANG)
# The -P option doesn't sit well with XLClang, so it's not included. It causes:
# "ld: 0711-317 ERROR: Undefined symbol: <SYMBOL>" when libj9jit29.so is getting linked.
set(SPP_FLAGS -E)
else()
set(SPP_FLAGS -E -P)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't CMAKE_C_COMPILER_IS_XLCLANG only true when OMR_TOOLCONFIG is xlc (in which case this file would not be used)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, will remove the conditional and keep the path thats always taken for open-xl.

@Deigue Deigue force-pushed the openxl-toolchain branch from 6b3489e to 2919044 Compare March 5, 2025 16:14
@Deigue
Copy link
Contributor Author

Deigue commented Mar 5, 2025

Addressed comments above, please review @keithc-ca

@Deigue Deigue requested a review from keithc-ca March 5, 2025 16:15
list(APPEND pp_command "-xc++")
endif()
if("@OMR_OS_ZOS@" AND "@OMR_ENV_DATA64@")
if("@OMR_OS_ZOS@" AND "@OMR_ENV_DATA64@" AND NOT OMR_TOOLCONFIG STREQUAL "openxl")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMR_TOOLCONFIG must be referenced like other variables used in this file:

		if("@OMR_OS_ZOS@" AND "@OMR_ENV_DATA64@" AND NOT "@OMR_TOOLCONFIG@" STREQUAL "openxl")


list(APPEND OMR_PLATFORM_CXX_COMPILE_OPTIONS
-march=${OMR_ZOS_COMPILE_ARCHITECTURE}
"-std=gnu++14"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see that comment.

elseif(CMAKE_C_COMPILER_ID MATCHES "^XL(Clang)?$" OR CMAKE_C_COMPILER_ID STREQUAL "zOS")
# In CMake 3.14 and prior, XLClang uses CMAKE_C_COMPILER_ID "XL"
# In CMake 3.15 and beyond, XLClang uses CMAKE_C_COMPILER_ID "XLClang"
set(_OMR_TOOLCONFIG "xlc")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMAKE_C_COMPILER_IS_OPENXL should not be define, but there are references elsewhere so it will need to stay temporarily.

I was suggesting that line 205 should be

		elseif((CMAKE_C_COMPILER_ID MATCHES "IBMClang$") OR (CMAKE_C_COMPILER MATCHES ".*ibm-clang.*"))

and lines 219-221 should be removed.

@Deigue Deigue force-pushed the openxl-toolchain branch 2 times, most recently from 941d38a to 445c7a6 Compare March 11, 2025 18:55
@Deigue
Copy link
Contributor Author

Deigue commented Mar 11, 2025

@keithc-ca Have made the above suggested changes. Apologies for the missing comment, I had accidentally added it somewhere else and it did not make it into earlier commit. Should be there now.

@Deigue Deigue requested a review from keithc-ca March 11, 2025 18:57
Comment on lines 46 to 48
# -std=gnu++14 is used over -std=cpp++14, as the gnu* options are closest to
# -qlanglvl=extended (Enabling most extensions by default). This is preferred
# in order to avoid defining _EXT repeatedly in most places.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the trailing space on line 46; "enabling" should not be capitalized.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Adds the initial set of changes to support compilation with
Open XL on z/OS. This will define the alternative flags and
configuration that needs to be used by the wyvern compiler
while running on z/OS.

Signed-off-by: Gaurav Chaudhari <gaurav.chaudhari@ibm.com>
@Deigue Deigue force-pushed the openxl-toolchain branch from 445c7a6 to 0126fe0 Compare March 12, 2025 14:45
@Deigue Deigue requested a review from keithc-ca March 12, 2025 14:45
@babsingh
Copy link
Contributor

jenkins build all

@babsingh
Copy link
Contributor

babsingh commented Mar 13, 2025

Infra failure on riscv. But, this PR's changes don't impact riscv. So, we can merge it without a riscv PR build.

@babsingh babsingh merged commit 7dfa384 into eclipse-omr:master Mar 13, 2025
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants