[Openmp-commits] [openmp] r238566 - Allow CMAKE_OSX_ARCHITECTURES to build fat library.
Jonathan Peyton
jonathan.l.peyton at intel.com
Fri May 29 09:13:56 PDT 2015
Author: jlpeyton
Date: Fri May 29 11:13:56 2015
New Revision: 238566
URL: http://llvm.org/viewvc/llvm-project?rev=238566&view=rev
Log:
Allow CMAKE_OSX_ARCHITECTURES to build fat library.
The CMAKE_OSX_ARCHITECTURES CMake variable allows users to build
universal fat libraries that contain both i386 and x86_64 code. These
changes allow this build by having the z_Linux_asm.s file detect the architecture
itself instead of receiving it through the build system.
Also, there was a LIBOMP_OSX_ARCHITECTURES CMake variable added to allow
people to only build libomp as a fat library and not the entire LLVM/Clang system.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-May/000626.html
Added:
openmp/trunk/runtime/src/kmp_platform.h (with props)
Modified:
openmp/trunk/runtime/CMakeLists.txt
openmp/trunk/runtime/src/kmp_os.h
openmp/trunk/runtime/src/makefile.mk
openmp/trunk/runtime/src/z_Linux_asm.s
Modified: openmp/trunk/runtime/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/CMakeLists.txt?rev=238566&r1=238565&r2=238566&view=diff
==============================================================================
--- openmp/trunk/runtime/CMakeLists.txt (original)
+++ openmp/trunk/runtime/CMakeLists.txt Fri May 29 11:13:56 2015
@@ -117,6 +117,13 @@ set(LIBOMP_MICRO_TESTS false CACHE BOOL
set(LIBOMP_STATS false CACHE BOOL
"Stats-Gathering functionality?")
+# - Support for universal fat binary builds on Mac
+# - Having this extra variable allows people to build this library as a universal library
+# without forcing a universal build of the llvm/clang compiler.
+set(LIBOMP_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING
+ "For Mac builds, semicolon separated list of architectures to build for universal fat binary.")
+set(CMAKE_OSX_ARCHITECTURES ${LIBOMP_OSX_ARCHITECTURES})
+
# OMPT-support
set(LIBOMP_OMPT_SUPPORT false CACHE BOOL
"OMPT-support?")
@@ -710,19 +717,6 @@ endif()
# kmp_version.o : -D _KMP_BUILD_TIME="\"$(date)}\""
set_source_files_properties(${src_dir}/kmp_version.c PROPERTIES COMPILE_DEFINITIONS "_KMP_BUILD_TIME=\"\\\"${date}\\\"\"")
-# z_Linux_asm.o : -D KMP_ARCH_*
-if(${ARM})
- set_source_files_properties(${src_dir}/z_Linux_asm.s PROPERTIES COMPILE_DEFINITIONS "KMP_ARCH_ARM")
-elseif(${AARCH64})
- set_source_files_properties(${src_dir}/z_Linux_asm.s PROPERTIES COMPILE_DEFINITIONS "KMP_ARCH_AARCH64")
-elseif(${INTEL64} OR ${MIC})
- set_source_files_properties(${src_dir}/z_Linux_asm.s PROPERTIES COMPILE_DEFINITIONS "KMP_ARCH_X86_64")
-elseif(${IA32})
- set_source_files_properties(${src_dir}/z_Linux_asm.s PROPERTIES COMPILE_DEFINITIONS "KMP_ARCH_X86")
-elseif(${PPC64})
- set_source_files_properties(${src_dir}/z_Linux_asm.s PROPERTIES COMPILE_DEFINITIONS "KMP_ARCH_PPC64")
-endif()
-
if(${WINDOWS})
set_source_files_properties(${src_dir}/thirdparty/ittnotify/ittnotify_static.c PROPERTIES COMPILE_DEFINITIONS "UNICODE")
endif()
Modified: openmp/trunk/runtime/src/kmp_os.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_os.h?rev=238566&r1=238565&r2=238566&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_os.h (original)
+++ openmp/trunk/runtime/src/kmp_os.h Fri May 29 11:13:56 2015
@@ -62,134 +62,7 @@
# error Unknown compiler
#endif
-/* ---------------------- Operating system recognition ------------------- */
-
-#define KMP_OS_LINUX 0
-#define KMP_OS_FREEBSD 0
-#define KMP_OS_DARWIN 0
-#define KMP_OS_WINDOWS 0
-#define KMP_OS_CNK 0
-#define KMP_OS_UNIX 0 /* disjunction of KMP_OS_LINUX, KMP_OS_DARWIN etc. */
-
-#define KMP_ARCH_X86 0
-#define KMP_ARCH_X86_64 0
-#define KMP_ARCH_AARCH64 0
-#define KMP_ARCH_PPC64_BE 0
-#define KMP_ARCH_PPC64_LE 0
-
-#define KMP_ARCH_PPC64 (KMP_ARCH_PPC64_LE || KMP_ARCH_PPC64_BE)
-
-
-#ifdef _WIN32
-# undef KMP_OS_WINDOWS
-# define KMP_OS_WINDOWS 1
-#endif
-
-#if ( defined __APPLE__ && defined __MACH__ )
-# undef KMP_OS_DARWIN
-# define KMP_OS_DARWIN 1
-#endif
-
-// in some ppc64 linux installations, only the second condition is met
-#if ( defined __linux )
-# undef KMP_OS_LINUX
-# define KMP_OS_LINUX 1
-#elif ( defined __linux__)
-# undef KMP_OS_LINUX
-# define KMP_OS_LINUX 1
-#else
-#endif
-
-#if ( defined __FreeBSD__ )
-# undef KMP_OS_FREEBSD
-# define KMP_OS_FREEBSD 1
-#endif
-
-#if ( defined __bgq__ )
-# undef KMP_OS_CNK
-# define KMP_OS_CNK 1
-#endif
-
-#if (1 != KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_DARWIN + KMP_OS_WINDOWS)
-# error Unknown OS
-#endif
-
-#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_DARWIN
-# undef KMP_OS_UNIX
-# define KMP_OS_UNIX 1
-#endif
-
-#if KMP_OS_WINDOWS
-# if defined _M_AMD64
-# undef KMP_ARCH_X86_64
-# define KMP_ARCH_X86_64 1
-# else
-# undef KMP_ARCH_X86
-# define KMP_ARCH_X86 1
-# endif
-#endif
-
-#if KMP_OS_UNIX
-# if defined __x86_64
-# undef KMP_ARCH_X86_64
-# define KMP_ARCH_X86_64 1
-# elif defined __i386
-# undef KMP_ARCH_X86
-# define KMP_ARCH_X86 1
-# elif defined __powerpc64__
-# if defined __LITTLE_ENDIAN__
-# undef KMP_ARCH_PPC64_LE
-# define KMP_ARCH_PPC64_LE 1
-# else
-# undef KMP_ARCH_PPC64_BE
-# define KMP_ARCH_PPC64_BE 1
-# endif
-# elif defined __aarch64__
-# undef KMP_ARCH_AARCH64
-# define KMP_ARCH_AARCH64 1
-# endif
-#endif
-
-#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7R__) || \
- defined(__ARM_ARCH_7A__)
-# define KMP_ARCH_ARMV7 1
-#endif
-
-#if defined(KMP_ARCH_ARMV7) || defined(__ARM_ARCH_6__) || \
- defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || \
- defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6T2__) || \
- defined(__ARM_ARCH_6ZK__)
-# define KMP_ARCH_ARMV6 1
-#endif
-
-#if defined(KMP_ARCH_ARMV6) || defined(__ARM_ARCH_5T__) || \
- defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) || \
- defined(__ARM_ARCH_5TEJ__)
-# define KMP_ARCH_ARMV5 1
-#endif
-
-#if defined(KMP_ARCH_ARMV5) || defined(__ARM_ARCH_4__) || \
- defined(__ARM_ARCH_4T__)
-# define KMP_ARCH_ARMV4 1
-#endif
-
-#if defined(KMP_ARCH_ARMV4) || defined(__ARM_ARCH_3__) || \
- defined(__ARM_ARCH_3M__)
-# define KMP_ARCH_ARMV3 1
-#endif
-
-#if defined(KMP_ARCH_ARMV3) || defined(__ARM_ARCH_2__)
-# define KMP_ARCH_ARMV2 1
-#endif
-
-#if defined(KMP_ARCH_ARMV2)
-# define KMP_ARCH_ARM 1
-#endif
-
-// TODO: Fixme - This is clever, but really fugly
-#if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64 + KMP_ARCH_AARCH64)
-# error Unknown or unsupported architecture
-#endif
+#include "kmp_platform.h"
#if (KMP_OS_LINUX || KMP_OS_WINDOWS) && !KMP_OS_CNK && !KMP_ARCH_PPC64
# define KMP_AFFINITY_SUPPORTED 1
Added: openmp/trunk/runtime/src/kmp_platform.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_platform.h?rev=238566&view=auto
==============================================================================
--- openmp/trunk/runtime/src/kmp_platform.h (added)
+++ openmp/trunk/runtime/src/kmp_platform.h Fri May 29 11:13:56 2015
@@ -0,0 +1,147 @@
+/*
+ * kmp_platform.h -- header for determining operating system and architecture
+ */
+
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.txt for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef KMP_PLATFORM_H
+#define KMP_PLATFORM_H
+
+/* ---------------------- Operating system recognition ------------------- */
+
+#define KMP_OS_LINUX 0
+#define KMP_OS_FREEBSD 0
+#define KMP_OS_DARWIN 0
+#define KMP_OS_WINDOWS 0
+#define KMP_OS_CNK 0
+#define KMP_OS_UNIX 0 /* disjunction of KMP_OS_LINUX, KMP_OS_DARWIN etc. */
+
+
+#ifdef _WIN32
+# undef KMP_OS_WINDOWS
+# define KMP_OS_WINDOWS 1
+#endif
+
+#if ( defined __APPLE__ && defined __MACH__ )
+# undef KMP_OS_DARWIN
+# define KMP_OS_DARWIN 1
+#endif
+
+// in some ppc64 linux installations, only the second condition is met
+#if ( defined __linux )
+# undef KMP_OS_LINUX
+# define KMP_OS_LINUX 1
+#elif ( defined __linux__)
+# undef KMP_OS_LINUX
+# define KMP_OS_LINUX 1
+#else
+#endif
+
+#if ( defined __FreeBSD__ )
+# undef KMP_OS_FREEBSD
+# define KMP_OS_FREEBSD 1
+#endif
+
+#if ( defined __bgq__ )
+# undef KMP_OS_CNK
+# define KMP_OS_CNK 1
+#endif
+
+#if (1 != KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_DARWIN + KMP_OS_WINDOWS)
+# error Unknown OS
+#endif
+
+#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_DARWIN
+# undef KMP_OS_UNIX
+# define KMP_OS_UNIX 1
+#endif
+
+/* ---------------------- Architecture recognition ------------------- */
+
+#define KMP_ARCH_X86 0
+#define KMP_ARCH_X86_64 0
+#define KMP_ARCH_AARCH64 0
+#define KMP_ARCH_PPC64_BE 0
+#define KMP_ARCH_PPC64_LE 0
+#define KMP_ARCH_PPC64 (KMP_ARCH_PPC64_LE || KMP_ARCH_PPC64_BE)
+
+#if KMP_OS_WINDOWS
+# if defined _M_AMD64
+# undef KMP_ARCH_X86_64
+# define KMP_ARCH_X86_64 1
+# else
+# undef KMP_ARCH_X86
+# define KMP_ARCH_X86 1
+# endif
+#endif
+
+#if KMP_OS_UNIX
+# if defined __x86_64
+# undef KMP_ARCH_X86_64
+# define KMP_ARCH_X86_64 1
+# elif defined __i386
+# undef KMP_ARCH_X86
+# define KMP_ARCH_X86 1
+# elif defined __powerpc64__
+# if defined __LITTLE_ENDIAN__
+# undef KMP_ARCH_PPC64_LE
+# define KMP_ARCH_PPC64_LE 1
+# else
+# undef KMP_ARCH_PPC64_BE
+# define KMP_ARCH_PPC64_BE 1
+# endif
+# elif defined __aarch64__
+# undef KMP_ARCH_AARCH64
+# define KMP_ARCH_AARCH64 1
+# endif
+#endif
+
+#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7R__) || \
+ defined(__ARM_ARCH_7A__)
+# define KMP_ARCH_ARMV7 1
+#endif
+
+#if defined(KMP_ARCH_ARMV7) || defined(__ARM_ARCH_6__) || \
+ defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || \
+ defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6T2__) || \
+ defined(__ARM_ARCH_6ZK__)
+# define KMP_ARCH_ARMV6 1
+#endif
+
+#if defined(KMP_ARCH_ARMV6) || defined(__ARM_ARCH_5T__) || \
+ defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) || \
+ defined(__ARM_ARCH_5TEJ__)
+# define KMP_ARCH_ARMV5 1
+#endif
+
+#if defined(KMP_ARCH_ARMV5) || defined(__ARM_ARCH_4__) || \
+ defined(__ARM_ARCH_4T__)
+# define KMP_ARCH_ARMV4 1
+#endif
+
+#if defined(KMP_ARCH_ARMV4) || defined(__ARM_ARCH_3__) || \
+ defined(__ARM_ARCH_3M__)
+# define KMP_ARCH_ARMV3 1
+#endif
+
+#if defined(KMP_ARCH_ARMV3) || defined(__ARM_ARCH_2__)
+# define KMP_ARCH_ARMV2 1
+#endif
+
+#if defined(KMP_ARCH_ARMV2)
+# define KMP_ARCH_ARM 1
+#endif
+
+// TODO: Fixme - This is clever, but really fugly
+#if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64 + KMP_ARCH_AARCH64)
+# error Unknown or unsupported architecture
+#endif
+
+#endif // KMP_PLATFORM_H
Propchange: openmp/trunk/runtime/src/kmp_platform.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openmp/trunk/runtime/src/kmp_platform.h
------------------------------------------------------------------------------
svn:keywords = Author Date Id Rev URL
Propchange: openmp/trunk/runtime/src/kmp_platform.h
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: openmp/trunk/runtime/src/makefile.mk
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/makefile.mk?rev=238566&r1=238565&r2=238566&view=diff
==============================================================================
--- openmp/trunk/runtime/src/makefile.mk (original)
+++ openmp/trunk/runtime/src/makefile.mk Fri May 29 11:13:56 2015
@@ -611,29 +611,6 @@ ifneq "$(filter lin ,$(os))" ""
endif
endif
-# Intel compiler has a bug: in case of cross-build if used with
-# -x assembler-with-cpp option, it defines macros for both architectures,
-# host and tartget. For example, if compiler for IA-32 architecture
-# runs on Intel(R) 64, it defines both __i386 and __x86_64. (Note it is a bug
-# only if -x assembler-with-cpp is specified, in case of C files icc defines
-# only one, target architecture). So we cannot autodetect target architecture
-# within the file, and have to pass target architecture from command line.
-ifneq "$(os)" "win"
- ifeq "$(arch)" "arm"
- z_Linux_asm$(obj) : \
- cpp-flags += -D KMP_ARCH_ARM
- else ifneq "$(filter ppc64 ppc64le,$(arch))" ""
- z_Linux_asm$(obj) : \
- cpp-flags += -D KMP_ARCH_PPC64
- else ifeq "$(arch)" "aarch64"
- z_Linux_asm$(obj) : \
- cpp-flags += -D KMP_ARCH_AARCH64
- else
- z_Linux_asm$(obj) : \
- cpp-flags += -D KMP_ARCH_X86$(if $(filter 32e mic,$(arch)),_64)
- endif
-endif
-
# Defining KMP_BUILD_DATE for all files leads to warning "incompatible redefinition", because the
# same macro is also defined in omp.h. To avoid conflict, let us define macro with different name,
# _KMP_BUILD_TIME.
Modified: openmp/trunk/runtime/src/z_Linux_asm.s
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/z_Linux_asm.s?rev=238566&r1=238565&r2=238566&view=diff
==============================================================================
--- openmp/trunk/runtime/src/z_Linux_asm.s (original)
+++ openmp/trunk/runtime/src/z_Linux_asm.s Fri May 29 11:13:56 2015
@@ -16,6 +16,8 @@
// macros
// -----------------------------------------------------------------------
+#include "kmp_platform.h"
+
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
# if __MIC__ || __MIC2__
More information about the Openmp-commits
mailing list