[Openmp-commits] [PATCH] D94889: Fix openmp CMake build on non-Linux AArch64 systems

Chandler Carruth via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Jan 17 16:16:09 PST 2021


chandlerc created this revision.
Herald added subscribers: danielkiss, guansong, kristof.beyls, yaxunl, mgorny, mcrosier.
chandlerc requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

Checks for `/proc/cpuinfo` before reading it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94889

Files:
  openmp/runtime/cmake/LibompGetArchitecture.cmake


Index: openmp/runtime/cmake/LibompGetArchitecture.cmake
===================================================================
--- openmp/runtime/cmake/LibompGetArchitecture.cmake
+++ openmp/runtime/cmake/LibompGetArchitecture.cmake
@@ -71,13 +71,15 @@
 endfunction()
 
 function(libomp_is_aarch64_a64fx return_is_aarch64_a64fx)
-  file(READ "/proc/cpuinfo" cpu_info_content)
-  string(REGEX MATCH "CPU implementer[ \t]*: 0x46\n" cpu_implementer ${cpu_info_content})
-  string(REGEX MATCH "CPU architecture[ \t]*: 8\n" cpu_architecture ${cpu_info_content})
-
   set(is_aarch64_a64fx FALSE)
-  if (cpu_architecture AND cpu_implementer)
-    set(is_aarch64_a64fx TRUE)
+  if (EXISTS "/proc/cpuinfo")
+    file(READ "/proc/cpuinfo" cpu_info_content)
+    string(REGEX MATCH "CPU implementer[ \t]*: 0x46\n" cpu_implementer ${cpu_info_content})
+    string(REGEX MATCH "CPU architecture[ \t]*: 8\n" cpu_architecture ${cpu_info_content})
+
+    if (cpu_architecture AND cpu_implementer)
+      set(is_aarch64_a64fx TRUE)
+    endif()
   endif()
 
   set(${return_is_aarch64_a64fx} "${is_aarch64_a64fx}" PARENT_SCOPE)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94889.317247.patch
Type: text/x-patch
Size: 1108 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210118/714db98e/attachment.bin>


More information about the Openmp-commits mailing list