Repository navigation
Add support for AArch64 macOS - #6204
Conversation
|
omrosdump.c and omrsignal_context.c are not implemented yet. Just disabled x86-specific parts in those files. |
|
|
||
| if(OMR_OS_LINUX) | ||
| list(APPEND OMR_PLATFORM_DEFINITIONS | ||
| -Wno-unused-but-set-variable |
There was a problem hiding this comment.
This option is not available in clang for AArch64 macOS.
There was a problem hiding this comment.
If there is an equivalent option, it should be used instead.
There was a problem hiding this comment.
I cannot find an equivalent option.
% clang --version
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: arm64-apple-darwin20.6.0
Thread model: posix
% clang -c -Wno-unused-but-set-variable hello.c
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
| if(OMR_ENV_DATA64 AND (NOT OMR_ARCH_AARCH64)) | ||
| # Set page zero size to 4KB for mapping memory below 4GB. | ||
| list(APPEND OMR_PLATFORM_EXE_LINKER_OPTIONS | ||
| -pagezero_size 0x1000 |
There was a problem hiding this comment.
You cannot change the pagezero size on AArch64 macOS.
|
Builds for x86-64 macOS and aarch64 Linux are successful in OpenJ9 project (eclipse-openj9/openj9#13700). |
|
@keithc-ca : would you like to review this PR as well? |
|
|
||
| if(OMR_OS_LINUX) | ||
| list(APPEND OMR_PLATFORM_DEFINITIONS | ||
| -Wno-unused-but-set-variable |
There was a problem hiding this comment.
If there is an equivalent option, it should be used instead.
| @@ -25,9 +25,14 @@ list(APPEND OMR_PLATFORM_DEFINITIONS | |||
| -DAARCH64GNU | |||
There was a problem hiding this comment.
What does GNU refer to here? If it is the compiler, it would seem inappropriate on macOS where clang is used.
There was a problem hiding this comment.
I don't see any uses of AARCH64GNU in OMR (nor in OpenJ9): perhaps it need not be defined.
There was a problem hiding this comment.
I guess -DAARCH64GNU came from -DARMGNU for 32-bit ARM.
I removed the option from aarch64.cmake and also from omrmakefiles/rules.linux.mk for consistency.
| list(APPEND TR_COMPILE_DEFINITIONS -DSUPPORTS_THREAD_LOCAL -DOSX) | ||
|
|
||
| if(OMR_ENV_DATA64) | ||
| if(OMR_ENV_DATA64 AND (NOT OMR_ARCH_AARCH64)) |
There was a problem hiding this comment.
The parentheses in (NOT OMR_ARCH_AARCH64) are not needed.
| __builtin___clear_cache(codeStart, codeStart+codeSize); | ||
| #else | ||
| #error Not supported yet | ||
| #error Not supported platform |
There was a problem hiding this comment.
nit: the message should be 'Unsupported platform' or 'Platform not supported'.
| #if !defined(AARCH64) | ||
| x86_thread_state_t thread_state; | ||
| x86_float_state_t float_state; | ||
| x86_exception_state_t exceptions; | ||
| #endif |
There was a problem hiding this comment.
I think the condition should be defined(_AMD64_), which should be repeated in a comment on the #endif:
#if defined(_AMD64_)
x86_thread_state_t thread_state;
x86_float_state_t float_state;
x86_exception_state_t exceptions;
#endif /* defined(_AMD64_) */
The same goes for all x86_64-specific sections below. Later, an implementation should be added for aarch64, conditional on defined(AARCH64).
| static kern_return_t | ||
| list_thread_commands(mach_port_t task_port, struct thread_command_full_64 **thread_commands, natural_t *thread_count) | ||
| { | ||
| #if !defined(AARCH64) |
There was a problem hiding this comment.
The condition should be defined(_AMD64_), which should be repeated in a comment on #else and #endif.
| uint32_t | ||
| infoForFPR(struct OMRPortLibrary *portLibrary, OMRUnixSignalInfo *info, int32_t index, const char **name, void **value) | ||
| { | ||
| #if !defined(AARCH64) |
There was a problem hiding this comment.
The condition should be defined(_AMD64_), which should be repeated in a comment on #else and #endif.
| -Wno-unused-but-set-variable | ||
| ) | ||
|
|
||
| if(OMR_OS_LINUX) |
There was a problem hiding this comment.
This should be if(OMR_TOOLCONFIG STREQUAL "gnu")
There was a problem hiding this comment.
This does not work. MacOS clang environment is recognized as a "gnu" toolchain.
There was a problem hiding this comment.
Ok, then I suggest we use CMAKE_C_COMPILER_ID, see https://github.com/eclipse/omr/blob/master/cmake/modules/platform/toolcfg/gnu.cmake#L90
There was a problem hiding this comment.
Updated the condition using CMAKE_C_COMPILER_ID.
b289212 to
c084bd8
Compare
|
I ran a build for x86-64 macOS with this PR in the following internal Jenkins job:
|
|
I have no idea why some of the checks in this PR were canceled. |
| #if defined(_AMD64_) | ||
| x86_thread_state_t thread_state; | ||
| x86_float_state_t float_state; | ||
| x86_exception_state_t exceptions; | ||
| #endif /* defined(_AMD64_) */ |
There was a problem hiding this comment.
Sorry, my suggestion to use _AMD64_ was based on outdated advice in https://github.com/eclipse/omr/blob/master/doc/CodingStandard.md: I think this should use OMR_ARCH_X86 instead.
There was a problem hiding this comment.
I wonder it should be OMR_ARCH_X86 or other symbol like J9HAMMER. What is defined with x86-64 macOS?
There was a problem hiding this comment.
I still think it should be OMR_ARCH_X86, see, for example, AtomicSupport.hpp. If we ever support 32-bit builds on OSX, we have much more work to do.
There was a problem hiding this comment.
I replaced _AMD64_ by OMR_ARCH_X86.
| -Wno-unused-but-set-variable | ||
| ) | ||
|
|
||
| if(OMR_OS_LINUX) |
There was a problem hiding this comment.
Ok, then I suggest we use CMAKE_C_COMPILER_ID, see https://github.com/eclipse/omr/blob/master/cmake/modules/platform/toolcfg/gnu.cmake#L90
| -Wno-unused-but-set-variable | ||
| ) | ||
|
|
||
| # Apple clang does not support the following option |
There was a problem hiding this comment.
Please end sentences with a period.
| #if defined(_AMD64_) | ||
| x86_thread_state_t thread_state; | ||
| x86_float_state_t float_state; | ||
| x86_exception_state_t exceptions; | ||
| #endif /* defined(_AMD64_) */ |
There was a problem hiding this comment.
I still think it should be OMR_ARCH_X86, see, for example, AtomicSupport.hpp. If we ever support 32-bit builds on OSX, we have much more work to do.
|
I updated the condition for |
| * 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 | ||
| *******************************************************************************/ | ||
|
|
||
| #if defined (__clang__) && defined (__APPLE__) |
There was a problem hiding this comment.
There should not be spaces before (, here and on line 30, to be consistent, e.g. line 32.
This commit adds changes for supporting AArch64 macOS. Signed-off-by: KONNO Kazuhiro <konno@jp.ibm.com>
|
Jenkins build all |
|
#6215 implements omrsignal_context.c. |
This commit adds changes for supporting AArch64 macOS.
Signed-off-by: KONNO Kazuhiro konno@jp.ibm.com