Last active
November 24, 2020 22:06
-
-
Save hjelmn/9fa1a7742acad71f404544a03bda414a to your computer and use it in GitHub Desktop.
Patches for llvm 7.1.0 for AArch64 macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ru cfe-7.1.0.src/lib/Driver/ToolChains/Darwin.cpp cfe-7.1.0.src.patched/lib/Driver/ToolChains/Darwin.cpp | |
--- cfe-7.1.0.src/lib/Driver/ToolChains/Darwin.cpp 2018-08-14 03:10:53.000000000 -0600 | |
+++ cfe-7.1.0.src.patched/lib/Driver/ToolChains/Darwin.cpp 2020-11-24 15:00:20.000000000 -0700 | |
@@ -1524,8 +1524,16 @@ | |
llvm::Triple::OSType OSTy = llvm::Triple::UnknownOS; | |
StringRef MachOArchName = Toolchain.getMachOArchName(Args); | |
- if (MachOArchName == "armv7" || MachOArchName == "armv7s" || | |
- MachOArchName == "arm64") | |
+ if (MachOArchName == "arm64") { | |
+#if __arm64__ | |
+ // A clang running on an Apple Silicon mac defaults | |
+ // to building for mac when building for arm64 rather than | |
+ // defaulting to iOS. | |
+ OSTy = llvm::Triple::MacOSX; | |
+#else | |
+ OSTy = llvm::Triple::IOS; | |
+#endif | |
+ } else if (MachOArchName == "armv7" || MachOArchName == "armv7s") | |
OSTy = llvm::Triple::IOS; | |
else if (MachOArchName == "armv7k") | |
OSTy = llvm::Triple::WatchOS; | |
diff -ru cfe-7.1.0.src/test/lit.cfg.py cfe-7.1.0.src.patched/test/lit.cfg.py | |
--- cfe-7.1.0.src/test/lit.cfg.py 2018-08-07 00:57:36.000000000 -0600 | |
+++ cfe-7.1.0.src.patched/test/lit.cfg.py 2020-11-24 15:00:20.000000000 -0700 | |
@@ -152,6 +152,10 @@ | |
if not re.match(r'.*-(cygwin)$', config.target_triple): | |
config.available_features.add('clang-driver') | |
+# Tests that are specific to the Apple Silicon macOS. | |
+if re.match(r'^arm64(e)?-apple-(macos|darwin)', config.target_triple): | |
+ config.available_features.add('apple-silicon-mac') | |
+ | |
# [PR18856] Depends to remove opened file. On win32, a file could be removed | |
# only if all handles were closed. | |
if platform.system() not in ['Windows']: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ru compiler-rt-7.1.0.src/cmake/Modules/CompilerRTDarwinUtils.cmake compiler-rt-7.1.0.src.patched/cmake/Modules/CompilerRTDarwinUtils.cmake | |
--- compiler-rt-7.1.0.src/cmake/Modules/CompilerRTDarwinUtils.cmake 2018-06-27 06:56:34.000000000 -0600 | |
+++ compiler-rt-7.1.0.src.patched/cmake/Modules/CompilerRTDarwinUtils.cmake 2020-11-24 12:21:43.000000000 -0700 | |
@@ -213,6 +213,15 @@ | |
endforeach(cflag) | |
endif() | |
+ if ("${LIB_OS}" MATCHES ".*sim$") | |
+ # Pass an explicit -simulator environment to the -target option to ensure | |
+ # that we don't rely on the architecture to infer whether we're building | |
+ # for the simulator. | |
+ string(REGEX REPLACE "sim" "" base_os "${LIB_OS}") | |
+ list(APPEND builtin_cflags | |
+ -target "${LIB_ARCH}-apple-${base_os}${DARWIN_${LIBOS}_BUILTIN_MIN_VER}-simulator") | |
+ endif() | |
+ | |
set_target_compile_flags(${libname} | |
${sysroot_flag} | |
${DARWIN_${LIB_OS}_BUILTIN_MIN_VER_FLAG} | |
@@ -328,16 +337,13 @@ | |
endif() | |
endforeach() | |
- # We put the x86 sim slices into the archives for their base OS | |
foreach (os ${ARGN}) | |
- if(NOT ${os} MATCHES ".*sim$") | |
- darwin_lipo_libs(clang_rt.${os} | |
- PARENT_TARGET builtins | |
- LIPO_FLAGS ${${os}_builtins_lipo_flags} ${${os}sim_builtins_lipo_flags} | |
- DEPENDS ${${os}_builtins_libs} ${${os}sim_builtins_libs} | |
- OUTPUT_DIR ${COMPILER_RT_LIBRARY_OUTPUT_DIR} | |
- INSTALL_DIR ${COMPILER_RT_LIBRARY_INSTALL_DIR}) | |
- endif() | |
+ darwin_lipo_libs(clang_rt.${os} | |
+ PARENT_TARGET builtins | |
+ LIPO_FLAGS ${${os}_builtins_lipo_flags} | |
+ DEPENDS ${${os}_builtins_libs} | |
+ OUTPUT_DIR ${COMPILER_RT_LIBRARY_OUTPUT_DIR} | |
+ INSTALL_DIR ${COMPILER_RT_LIBRARY_INSTALL_DIR}) | |
endforeach() | |
darwin_add_embedded_builtin_libraries() | |
endmacro() | |
Only in compiler-rt-7.1.0.src.patched/cmake/Modules: CompilerRTDarwinUtils.cmake.orig | |
Only in compiler-rt-7.1.0.src.patched: foo | |
diff -ru compiler-rt-7.1.0.src/lib/sanitizer_common/sanitizer_platform_interceptors.h compiler-rt-7.1.0.src.patched/lib/sanitizer_common/sanitizer_platform_interceptors.h | |
--- compiler-rt-7.1.0.src/lib/sanitizer_common/sanitizer_platform_interceptors.h 2018-06-20 14:13:25.000000000 -0600 | |
+++ compiler-rt-7.1.0.src.patched/lib/sanitizer_common/sanitizer_platform_interceptors.h 2020-11-24 12:28:35.000000000 -0700 | |
@@ -311,7 +311,7 @@ | |
#define SANITIZER_INTERCEPT_STATFS \ | |
(SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID || SI_SOLARIS) | |
#define SANITIZER_INTERCEPT_STATFS64 \ | |
- ((SI_MAC && !SI_IOS) || SI_LINUX_NOT_ANDROID) | |
+ (((SI_MAC && !TARGET_CPU_ARM64) && !SI_IOS) || SI_LINUX_NOT_ANDROID) | |
#define SANITIZER_INTERCEPT_STATVFS \ | |
(SI_FREEBSD || SI_NETBSD || SI_OPENBSD || SI_LINUX_NOT_ANDROID) | |
#define SANITIZER_INTERCEPT_STATVFS64 SI_LINUX_NOT_ANDROID | |
diff -ru compiler-rt-7.1.0.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cc compiler-rt-7.1.0.src.patched/lib/sanitizer_common/sanitizer_platform_limits_posix.cc | |
--- compiler-rt-7.1.0.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cc 2018-09-06 02:19:33.000000000 -0600 | |
+++ compiler-rt-7.1.0.src.patched/lib/sanitizer_common/sanitizer_platform_limits_posix.cc 2020-11-24 12:10:08.000000000 -0700 | |
@@ -198,7 +198,7 @@ | |
namespace __sanitizer { | |
unsigned struct_utsname_sz = sizeof(struct utsname); | |
unsigned struct_stat_sz = sizeof(struct stat); | |
-#if !SANITIZER_IOS && !SANITIZER_FREEBSD | |
+#if !SANITIZER_IOS && !(SANITIZER_MAC && TARGET_CPU_ARM64) | |
unsigned struct_stat64_sz = sizeof(struct stat64); | |
#endif // !SANITIZER_IOS && !SANITIZER_FREEBSD | |
unsigned struct_rusage_sz = sizeof(struct rusage); | |
@@ -223,7 +223,7 @@ | |
unsigned struct_sched_param_sz = sizeof(struct sched_param); | |
-#if SANITIZER_MAC && !SANITIZER_IOS | |
+#if (SANITIZER_MAC && !TARGET_CPU_ARM64) && !SANITIZER_IOS | |
unsigned struct_statfs64_sz = sizeof(struct statfs64); | |
#endif // SANITIZER_MAC && !SANITIZER_IOS | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ru openmp-7.1.0.src/runtime/src/z_Linux_asm.S openmp-7.1.0.src.patched/runtime/src/z_Linux_asm.S | |
--- openmp-7.1.0.src/runtime/src/z_Linux_asm.S 2017-07-11 12:04:56.000000000 -0600 | |
+++ openmp-7.1.0.src.patched/runtime/src/z_Linux_asm.S 2020-11-24 11:04:14.000000000 -0700 | |
@@ -1715,10 +1715,12 @@ | |
.comm .gomp_critical_user_,32,8 | |
.data | |
.align 8 | |
- .global __kmp_unnamed_critical_addr | |
-__kmp_unnamed_critical_addr: | |
+ .global KMP_PREFIX_UNDERSCORE(__kmp_unnamed_critical_addr) | |
+KMP_PREFIX_UNDERSCORE(__kmp_unnamed_critical_addr): | |
.8byte .gomp_critical_user_ | |
- .size __kmp_unnamed_critical_addr,8 | |
+#ifdef __ELF__ | |
+ .size KMP_PREFIX_UNDERSCORE(__kmp_unnamed_critical_addr),8 | |
+#endif | |
#endif /* KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 */ | |
#if KMP_OS_LINUX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment