From: Andreas Beckmann Date: Sat, 9 Apr 2022 14:30:15 +0000 (+0200) Subject: [PATCH 1013/1017] allow overriding kernellib_name for distro builds with POCL_KERNELL... X-Git-Tag: archive/raspbian/3.0-7+rpi1^2~16 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e3035139935e242135a912a3a6270ce586a92fa0;p=pocl.git [PATCH 1013/1017] allow overriding kernellib_name for distro builds with POCL_KERNELLIB_NAME the kernellib_name (and corresponding llvm_cpu) can be overridden to a target with a subset of the features supported by the current cpu this will allow running e.g. code generation and tests for sse2 (but no newer features) on a modern cpu Gbp-Pq: Name 1013-allow-overriding-kernellib_name-for-distro-builds-wi.patch --- diff --git a/lib/CL/pocl_llvm_utils.cc b/lib/CL/pocl_llvm_utils.cc index 7bdfb38..018bbb3 100644 --- a/lib/CL/pocl_llvm_utils.cc +++ b/lib/CL/pocl_llvm_utils.cc @@ -189,6 +189,8 @@ const char *pocl_get_distro_kernellib_name() { if (!llvm::sys::getHostCPUFeatures(Features)) POCL_ABORT("LLVM can't get host CPU flags!\n"); + const char *custom = pocl_get_string_option("POCL_KERNELLIB_NAME", NULL); + const kernellib_features *best_match = NULL; for (const kernellib_features *kf = kernellib_feature_map; kf->kernellib_name; ++kf) { @@ -197,6 +199,8 @@ const char *pocl_get_distro_kernellib_name() { matches &= Features[*f]; if (matches) { best_match = kf; + if (custom && !strcmp(custom, kf->kernellib_name)) + break; } }