OCL-dev / ocl-icd

OpenCL ICD Loader (free software)
BSD 2-Clause "Simplified" License
76 stars 23 forks source link

Build fails with gcc10 and -fno-common #12

Closed Bidski closed 4 years ago

Bidski commented 4 years ago

GCC10 flipped the default from -fcommon to -fno-common. This change results in this linker error.

/usr/sbin/ld: .libs/libdummycl2_la-libdummy_icd_gen.o:(.data.rel+0x0): multiple definition of `master_dispatch'; .libs/libdummycl2_la-libdummy_icd.o:(.bss+0x20): first defined here

This patch seems to resolve the linking issue. Not sure on if this breaks intended semantics or not, but make check is successful for all tests.

--- a/icd_generator.rb
+++ /bicd_generator.rb
@@ -189,7 +189,7 @@
     }
     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"
     }
Bidski commented 4 years ago

Apologies, I am using a recent release and forget to check to master :(