Add upstream patch to fix ARM arch detection

This commit is contained in:
Peter Robinson 2017-05-26 09:33:45 +01:00
parent 7f13ab517e
commit e4daa7c3f5
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From d7f89ad2696a253296a5116bd89fe3031de1fb1c Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Thu, 25 May 2017 19:46:47 +0000
Subject: [PATCH] Use generic cpu when LLVM can't detect the host processor
LLVM's CPU detection is very basic, it parses /proc/cpuinfo and uses
information from their to look up CPUs in its own internal tables.
These tables are incomplete, so it's not uncommon for LLVM to not
be able to detect the CPU.
Ideally pocl would use something better than llc --version for CPU
detection, but for now we can at least fallback to the generic
cpu when LLVM can't detect the host.
---
cmake/LLVM.cmake | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/cmake/LLVM.cmake b/cmake/LLVM.cmake
index 22e9b851..440fc0ca 100644
--- a/cmake/LLVM.cmake
+++ b/cmake/LLVM.cmake
@@ -567,6 +567,10 @@ endif()
set_cache_var(LLC_TRIPLE "LLC_TRIPLE")
+# FIXME: The cpu name printed by llc --version is the same cpu that will be
+# targeted if ypu pass -mcpu=native to llc, so we could replace this auto-detection
+# with just: set(LLC_HOST_CPU "native"), however, we can't do this at the moment
+# because of the work-around for arm1176jz-s.
if(NOT DEFINED LLC_HOST_CPU AND NOT CMAKE_CROSSCOMPILING)
message(STATUS "Find out LLC host CPU with ${LLVM_LLC}")
execute_process(COMMAND ${LLVM_LLC} "--version" RESULT_VARIABLE RES_VAR OUTPUT_VARIABLE OUTPUT_VAR)
@@ -589,7 +593,8 @@ if(NOT DEFINED LLC_HOST_CPU AND NOT CMAKE_CROSSCOMPILING)
endif()
if(LLC_HOST_CPU MATCHES "unknown")
- message(FATAL_ERROR "LLVM could not recognize your CPU model automatically. Please rerun cmake with -DLLC_HOST_CPU=<model> (to see a list of models, try: llc -mcpu help)")
+ message(WARNING "LLVM could not recognize your CPU model automatically. Using a generic CPU target.")
+ set(LLC_HOST_CPU "generic")
endif()
set(LLC_HOST_CPU "${LLC_HOST_CPU}" CACHE STRING "The Host CPU to use with llc")

View File

@ -6,7 +6,7 @@
Summary: Portable Computing Language - an OpenCL implementation
Name: pocl
Version: 0.14
Release: 1%{?dist}
Release: 2%{?dist}
# The whole code is under MIT
# except include/utlist.h which is under BSD (and unbundled) and
@ -16,6 +16,7 @@ URL: http://pocl.sourceforge.net
Source0: http://portablecl.org/downloads/%{name}-%{version}.tar.gz
Patch1: 0001-wrap-more-stuff-for-64-bit-atomics.patch
Patch2: pocl-fix-arm-detection.patch
# aarch64 seems to have a build system problem that makes it pass -march=(unknown).
# ppc64 builds fine, but: 41% tests passed, 64 tests failed out of 108.
# ppc64le fails with compilation errors.
@ -128,6 +129,9 @@ popd
%{_includedir}/%{name}u.h
%changelog
* Fri May 26 2017 Peter Robinson <pbrobinson@fedoraproject.org> 0.14-2
- Add upstream patch to fix ARM arch detection
* Wed Apr 12 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.14-1
- Update to 0.14