[Openmp-commits] [PATCH] D42795: make libomp work on amd64 x32 ABI

Martin Scheffler via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Feb 1 06:58:21 PST 2018


The_Bishop created this revision.
The_Bishop added a project: OpenMP.
Herald added a subscriber: openmp-commits.

added some if/then for this ABI and extended one test case.


Repository:
  rOMP OpenMP

https://reviews.llvm.org/D42795

Files:
  runtime/cmake/LibompMicroTests.cmake
  runtime/src/kmp_affinity.h
  runtime/src/kmp_os.h


Index: runtime/src/kmp_os.h
===================================================================
--- runtime/src/kmp_os.h
+++ runtime/src/kmp_os.h
@@ -153,7 +153,7 @@
 #error "Can't determine size_t printf format specifier."
 #endif
 
-#if KMP_ARCH_X86
+#if KMP_ARCH_X86 || ( KMP_ARCH_X86_64 && __ILP32__ )
 #define KMP_SIZE_T_MAX (0xFFFFFFFF)
 #else
 #define KMP_SIZE_T_MAX (0xFFFFFFFFFFFFFFFF)
Index: runtime/src/kmp_affinity.h
===================================================================
--- runtime/src/kmp_affinity.h
+++ runtime/src/kmp_affinity.h
@@ -191,6 +191,19 @@
 #error Wrong code for getaffinity system call.
 #endif /* __NR_sched_getaffinity */
 #elif KMP_ARCH_X86_64
+#if __ILP32__
+#define __X32_SYSCALL_BIT 0x40000000
+#ifndef __NR_sched_setaffinity
+#define __NR_sched_setaffinity  (__X32_SYSCALL_BIT + 203)
+#elif __NR_sched_setaffinity != (__X32_SYSCALL_BIT + 203)
+#error Wrong code for setaffinity system call.
+#endif /* __NR_sched_setaffinity */
+#ifndef __NR_sched_getaffinity
+#define __NR_sched_getaffinity  (__X32_SYSCALL_BIT + 204)
+#elif __NR_sched_getaffinity != (__X32_SYSCALL_BIT + 204)
+#error Wrong code for getaffinity system call.
+#endif /* __NR_sched_getaffinity */
+#else
 #ifndef __NR_sched_setaffinity
 #define __NR_sched_setaffinity 203
 #elif __NR_sched_setaffinity != 203
@@ -201,6 +214,7 @@
 #elif __NR_sched_getaffinity != 204
 #error Wrong code for getaffinity system call.
 #endif /* __NR_sched_getaffinity */
+#endif
 #elif KMP_ARCH_PPC64
 #ifndef __NR_sched_setaffinity
 #define __NR_sched_setaffinity 222
Index: runtime/cmake/LibompMicroTests.cmake
===================================================================
--- runtime/cmake/LibompMicroTests.cmake
+++ runtime/cmake/LibompMicroTests.cmake
@@ -198,6 +198,7 @@
     elseif(${INTEL64})
       libomp_append(libomp_expected_library_deps libc.so.6)
       libomp_append(libomp_expected_library_deps ld-linux-x86-64.so.2)
+      libomp_append(libomp_expected_library_deps ld-linux-x32.so.2)
     elseif(${ARM})
       libomp_append(libomp_expected_library_deps libc.so.6)
       libomp_append(libomp_expected_library_deps libffi.so.6)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42795.132390.patch
Type: text/x-patch
Size: 2147 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20180201/8aab29fc/attachment.bin>


More information about the Openmp-commits mailing list