Fix build with gcc10

This commit is contained in:
Dave Airlie 2020-02-07 09:32:00 +10:00
parent 78f1aa6061
commit fd5affe7e3
2 changed files with 44 additions and 1 deletions

39
fix-ocl-icd-gcc10.patch Normal file
View File

@ -0,0 +1,39 @@
From 4667bddd365bcc1dc66c483835971f0083b44b1d Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyfox@gentoo.org>
Date: Wed, 22 Jan 2020 19:38:23 +0000
Subject: [PATCH] icd_generator.rb: fix build failure against gcc-10
On gcc-10 (and gcc-9 -fno-common) build fails as:
```
libtool: link: gcc -shared -fPIC -DPIC .libs/libdummy_icd.o .libs/libdummy_icd_gen.o \
-ldl -g -O2 -Wl,-soname -Wl,libdummycl.so.0 -o .libs/libdummycl.so.0.0.0
ld: .libs/libdummy_icd_gen.o:/home/slyfox/dev/git/ocl-icd/libdummy_icd_gen.h:226:
multiple definition of `master_dispatch'; .libs/libdummy_icd.o:/home/slyfox/dev/git/ocl-icd/libdummy_icd_gen.h:226: first defined here
```
gcc-10 will change the default from -fcommon to fno-common:
https://gcc.gnu.org/PR85678.
The error also happens if CFLAGS=-fno-common passed explicitly.
Reported-by: Anthony Parsons
Bug: https://bugs.gentoo.org/706098
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
icd_generator.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/icd_generator.rb b/icd_generator.rb
index 49443b8..764cabb 100644
--- a/icd_generator.rb
+++ b/icd_generator.rb
@@ -207,7 +207,7 @@ def self.generate_libdummy_icd_header
}
libdummy_icd_structures += "};\n\n"
libdummy_icd_structures += "#pragma GCC visibility push(hidden)\n\n"
- libdummy_icd_structures += "struct _cl_icd_dispatch master_dispatch; \n\n"
+ libdummy_icd_structures += "extern struct _cl_icd_dispatch master_dispatch; \n\n"
$use_name_in_test.each { |k, f|
libdummy_icd_structures += "typeof(#{f}) INT#{f};\n"
}

View File

@ -1,12 +1,13 @@
Name: ocl-icd
Version: 2.2.12
Release: 8%{?dist}
Release: 9%{?dist}
Summary: OpenCL Library (Installable Client Library) Bindings
License: BSD
URL: https://forge.imag.fr/projects/ocl-icd/
Source0: https://forge.imag.fr/frs/download.php/836/%{name}-%{version}.tar.gz
Patch0: fix-ocl-icd-gcc10.patch
BuildRequires: gcc
BuildRequires: automake
BuildRequires: autoconf
@ -57,6 +58,9 @@ make check
%{_libdir}/pkgconfig/OpenCL.pc
%changelog
* Fri Feb 07 2020 Dave Airlie <airlied@redhat.com> - 2.2.12-9
- Fix build with gcc10
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.12-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild