From 6df588c4dd4f33770e614f211fd78a5b39615a7d Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Feb 05 2018 18:07:23 +0000 Subject: Fix build with gcc 8 --- diff --git a/0001-Fix-build-with-gcc-8.patch b/0001-Fix-build-with-gcc-8.patch new file mode 100644 index 0000000..f1801a4 --- /dev/null +++ b/0001-Fix-build-with-gcc-8.patch @@ -0,0 +1,31 @@ +From 2f833f3868f30c27e9ad8fd75b5730267d9e17e8 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Mon, 5 Feb 2018 08:59:51 -0800 +Subject: [PATCH] Fix build with gcc 8 + +src/topology.c:830:3: error: 'strncpy' specified bound 64 equals destination size [-Werror=stringop-truncation] + strncpy((char *)props->AMDName, hsa_gfxip->amd_name, sizeof(props->AMDName)); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +--- + src/topology.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/topology.c b/src/topology.c +index ef330af..2446e1f 100644 +--- a/src/topology.c ++++ b/src/topology.c +@@ -827,7 +827,10 @@ HSAKMT_STATUS topology_sysfs_get_node_props(uint32_t node_id, + } + + /* Retrieve the CAL name of the node */ +- strncpy((char *)props->AMDName, hsa_gfxip->amd_name, sizeof(props->AMDName)); ++ /* FIXME: This could be sizeof(props->AMDName), but we need to use ++ * sizeof(props->AMDName) - 1 to work around a bug in gcc 8.*/ ++ strncpy((char *)props->AMDName, hsa_gfxip->amd_name, sizeof(props->AMDName) - 1); ++ props->AMDName[sizeof(props->AMDName) - 1] = '\0'; + if (props->NumCPUCores) { + /* Is APU node */ + ret = topology_get_cpu_model_name(props, true); +-- +2.13.6 + diff --git a/hsakmt.spec b/hsakmt.spec index a59be73..87764c2 100644 --- a/hsakmt.spec +++ b/hsakmt.spec @@ -3,7 +3,7 @@ Name: hsakmt Version: 1.0.6 -Release: 1.20171026git%{shortcommit}%{?dist} +Release: 2.20171026git%{shortcommit}%{?dist} Summary: AMD's HSA thunk library License: MIT @@ -11,6 +11,7 @@ URL: https://github.com/RadeonOpenCompute/ROCm Source0: https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface/archive/%{commit}/lib%{name}-%{shortcommit}.tar.gz Patch0: 0001-Fix-install-targets.patch Patch1: 0001-CMakeLists-Set-the-correct-default-version.patch +Patch2: 0001-Fix-build-with-gcc-8.patch ExclusiveArch: x86_64 BuildRequires: cmake @@ -58,6 +59,9 @@ cd build %{_includedir}/libhsakmt/linux/kfd_ioctl.h %changelog +* Mon Feb 05 2018 Tom Stellard - 1.0.6-2.20171026git172d101 +- Fix build with gcc 8 + * Thu Oct 26 2017 Tom Stellard - 1.0.6-1.20171026git172d101 - Update with latest code from https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface