From 531451c39a0c4bb4b9c8d83297092f42398538fd Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Mon, 13 Apr 2020 13:08:09 -0400 Subject: [PATCH 1/8] New package: roct-thunk-interface-3.3.0 --- common/shlibs | 1 + srcpkgs/roct-thunk-interface-devel | 1 + .../patches/cmake-dev-libdir.patch | 10 ++++++ .../roct-thunk-interface/patches/musl.patch | 29 ++++++++++++++++ srcpkgs/roct-thunk-interface/template | 33 +++++++++++++++++++ 5 files changed, 74 insertions(+) create mode 120000 srcpkgs/roct-thunk-interface-devel create mode 100644 srcpkgs/roct-thunk-interface/patches/cmake-dev-libdir.patch create mode 100644 srcpkgs/roct-thunk-interface/patches/musl.patch create mode 100644 srcpkgs/roct-thunk-interface/template diff --git a/common/shlibs b/common/shlibs index 60ad7fb85d5..e22d4a7a8d1 100644 --- a/common/shlibs +++ b/common/shlibs @@ -3862,3 +3862,4 @@ libtagparser.so.9 tagparser-9.1.2_1 libqtutilities.so.6 qtutilities-6.0.4_1 libkdsoap.so.1.9.0 KDSoap-1.9.0_1 libstoken.so.1 stoken-0.92_1 +libhsakmt.so.1 roct-thunk-interface-3.3.0_1 diff --git a/srcpkgs/roct-thunk-interface-devel b/srcpkgs/roct-thunk-interface-devel new file mode 120000 index 00000000000..ac3f2cc684c --- /dev/null +++ b/srcpkgs/roct-thunk-interface-devel @@ -0,0 +1 @@ +roct-thunk-interface \ No newline at end of file diff --git a/srcpkgs/roct-thunk-interface/patches/cmake-dev-libdir.patch b/srcpkgs/roct-thunk-interface/patches/cmake-dev-libdir.patch new file mode 100644 index 00000000000..98c7f1e459c --- /dev/null +++ b/srcpkgs/roct-thunk-interface/patches/cmake-dev-libdir.patch @@ -0,0 +1,10 @@ +--- CMakeLists.txt.old 2020-04-18 19:45:17.306081135 -0400 ++++ CMakeLists.txt 2020-04-18 19:46:51.300753636 -0400 +@@ -146,6 +146,7 @@ + COMMAND ${CMAKE_COMMAND} + -DSOURCE_DIR="${SOURCE_DIR}" + -DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}" ++ -DCMAKE_INSTALL_LIBDIR="${CMAKE_INSTALL_LIBDIR}" + -DCPACK_RPM_PACKAGE_REQUIRES="hsakmt-roct" + -DCPACK_PACKAGING_INSTALL_PREFIX="${CPACK_PACKAGING_INSTALL_PREFIX}" + -DVERSION="${BUILD_VERSION_STRING}" diff --git a/srcpkgs/roct-thunk-interface/patches/musl.patch b/srcpkgs/roct-thunk-interface/patches/musl.patch new file mode 100644 index 00000000000..aeea9832411 --- /dev/null +++ b/srcpkgs/roct-thunk-interface/patches/musl.patch @@ -0,0 +1,29 @@ +diff -r -u old/src/libhsakmt.h new/src/libhsakmt.h +--- src/libhsakmt.h 2020-03-04 15:00:47.000000000 -0500 ++++ src/libhsakmt.h 2020-04-13 12:58:30.444865992 -0400 +@@ -54,6 +54,10 @@ + #define CHECK_KFD_OPEN() \ + do { if (kfd_open_count == 0 || hsakmt_forked) return HSAKMT_STATUS_KERNEL_IO_CHANNEL_NOT_OPENED; } while (0) + ++/*On some platforms, a PAGE_SIZE macro eclipses the extern variable*/ ++#ifdef PAGE_SIZE ++#undef PAGE_SIZE ++#endif + extern int PAGE_SIZE; + extern int PAGE_SHIFT; + +diff -r -u old/src/topology.c new/src/topology.c +--- src/topology.c 2020-03-04 15:00:47.000000000 -0500 ++++ src/topology.c 2020-04-13 13:01:31.209870701 -0400 +@@ -38,6 +38,11 @@ + #include "libhsakmt.h" + #include "fmm.h" + ++/*Needed on MUSL*/ ++#ifndef MAXNAMLEN ++#define MAXNAMLEN PATH_MAX ++#endif ++ + /* Number of memory banks added by thunk on top of topology + * This only includes static heaps like LDS, scratch and SVM, + * not for MMIO_REMAP heap. MMIO_REMAP memory bank is reported diff --git a/srcpkgs/roct-thunk-interface/template b/srcpkgs/roct-thunk-interface/template new file mode 100644 index 00000000000..55a1fc6074a --- /dev/null +++ b/srcpkgs/roct-thunk-interface/template @@ -0,0 +1,33 @@ +# Template file for 'roct-thunk-interface' +pkgname=roct-thunk-interface +version=3.3.0 +revision=1 +archs="x86_64*" +wrksrc="ROCT-Thunk-Interface-roc-${version}" +build_style=cmake +make_build_target="all build-dev" +make_install_target="install install-dev" +hostmakedepends="cmake pkg-config" +makedepends="pciutils-devel libnuma-devel" +short_desc="Radeon Open Compute Thunk Interface" +maintainer="Andrew J. Hesford " +license="MIT" +homepage="https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface" +distfiles="${homepage}/archive/roc-${version}.tar.gz" +checksum=2cabe9d2cfa72031c05d11290837c476182e72d8dec2049298f691143fdd212b +nocross=yes + +post_install() { + vlicense LICENSE.md +} + +roct-thunk-interface-devel_package() { + depends="${sourcepkg}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove "usr/lib/*.so" + vmove usr/share/pkgconfig + vmove usr/lib/cmake + } +} From 08cad6f6f48c837a1c67f501abd89425c5a5f61c Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Mon, 13 Apr 2020 15:27:27 -0400 Subject: [PATCH 2/8] New package: rocr-runtime-3.3.0 --- common/shlibs | 1 + srcpkgs/rocr-runtime-devel | 1 + srcpkgs/rocr-runtime/patches/cmake.patch | 27 +++++++++++++++++++++ srcpkgs/rocr-runtime/template | 30 ++++++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 120000 srcpkgs/rocr-runtime-devel create mode 100644 srcpkgs/rocr-runtime/patches/cmake.patch create mode 100644 srcpkgs/rocr-runtime/template diff --git a/common/shlibs b/common/shlibs index e22d4a7a8d1..68b07cb65bd 100644 --- a/common/shlibs +++ b/common/shlibs @@ -3863,3 +3863,4 @@ libqtutilities.so.6 qtutilities-6.0.4_1 libkdsoap.so.1.9.0 KDSoap-1.9.0_1 libstoken.so.1 stoken-0.92_1 libhsakmt.so.1 roct-thunk-interface-3.3.0_1 +libhsa-runtime64.so.1 rocr-runtime-3.3.0_1 diff --git a/srcpkgs/rocr-runtime-devel b/srcpkgs/rocr-runtime-devel new file mode 120000 index 00000000000..be838f22d81 --- /dev/null +++ b/srcpkgs/rocr-runtime-devel @@ -0,0 +1 @@ +rocr-runtime \ No newline at end of file diff --git a/srcpkgs/rocr-runtime/patches/cmake.patch b/srcpkgs/rocr-runtime/patches/cmake.patch new file mode 100644 index 00000000000..93b74cd2297 --- /dev/null +++ b/srcpkgs/rocr-runtime/patches/cmake.patch @@ -0,0 +1,27 @@ +--- src/CMakeLists.txt.old 2020-04-18 20:01:48.549636995 -0400 ++++ src/CMakeLists.txt 2020-04-18 20:04:00.177179781 -0400 +@@ -108,8 +108,8 @@ + ## ROCr build internal versioning + add_definitions ( -DROCR_BUILD_ID=${PACKAGE_VERSION_STRING} ) + +-## Set RUNPATH - ../../lib covers use of the legacy symlink in /hsa/lib/ +-set(CMAKE_INSTALL_RPATH "$ORIGIN;$ORIGIN/../../lib;$ORIGIN/../../lib64;$ORIGIN/../lib64") ++## Set RUNPATH ++set(CMAKE_INSTALL_RPATH "$ORIGIN;$ORIGIN/../lib") + + ## ------------------------- Linux Compiler and Linker options ------------------------- + set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -fexceptions -fno-rtti -fvisibility=hidden -Wno-error=sign-compare -Wno-sign-compare -Wno-write-strings -Wno-conversion-null -fno-math-errno -fno-threadsafe-statics -fmerge-all-constants -fms-extensions -Wno-error=comment -Wno-comment -Wno-error=pointer-arith -Wno-pointer-arith -Wno-error=unused-variable -Wno-error=unused-function" ) +@@ -185,11 +185,8 @@ + add_custom_target ( hsa_lib_link2 ALL WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${CMAKE_COMMAND} -E create_symlink ../hsa/lib/${CORE_RUNTIME_LIBRARY}.so.${SO_MAJOR} ${CORE_RUNTIME_LIBRARY}-link.so.${SO_MAJOR} ) + + ## Set install information +-install ( TARGETS ${CORE_RUNTIME_TARGET} LIBRARY DESTINATION hsa/lib ) +-install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/inc/ DESTINATION hsa/include/hsa ) +-install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/hsa_include_link DESTINATION include PERMISSIONS OWNER_WRITE OWNER_READ RENAME hsa ) +-install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${CORE_RUNTIME_LIBRARY}-link.so DESTINATION lib PERMISSIONS OWNER_WRITE OWNER_READ RENAME ${CORE_RUNTIME_LIBRARY}.so ) +-install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${CORE_RUNTIME_LIBRARY}-link.so.${SO_MAJOR} DESTINATION lib PERMISSIONS OWNER_WRITE OWNER_READ RENAME ${CORE_RUNTIME_LIBRARY}.so.${SO_MAJOR} ) ++install ( TARGETS ${CORE_RUNTIME_TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) ++install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/inc/ DESTINATION include/hsa ) + + ## Packaging directives + set ( CPACK_GENERATOR "DEB;RPM" CACHE STRING "Package types to build") diff --git a/srcpkgs/rocr-runtime/template b/srcpkgs/rocr-runtime/template new file mode 100644 index 00000000000..5ee22140f1f --- /dev/null +++ b/srcpkgs/rocr-runtime/template @@ -0,0 +1,30 @@ +# Template file for 'rocr-runtime' +pkgname=rocr-runtime +version=3.3.0 +revision=1 +archs="x86_64*" +wrksrc="ROCR-Runtime-rocm-${version}" +build_wrksrc="src" +build_style=cmake +hostmakedepends="cmake pkg-config" +makedepends="roct-thunk-interface-devel elfutils-devel" +short_desc="Radeon Open Compute HSA Runtime" +maintainer="Andrew J. Hesford " +license="NCSA" +homepage="https://github.com/RadeonOpenCompute/ROCR-Runtime" +distfiles="${homepage}/archive/rocm-${version}.tar.gz" +checksum=fa2d2d1f8a61d8a6952d377cf288d78c61776c3c2a666f163cafc3aa19ab0b61 +nocross=yes + +post_install() { + vlicense ../LICENSE.txt +} + +rocr-runtime-devel_package() { + depends="${sourcepkg}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove "usr/lib/*.so" + } +} From ea7422d5c26bd446f70a52e6e81188b9918b748d Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Mon, 13 Apr 2020 18:07:34 -0400 Subject: [PATCH 3/8] New package: rocm-llvm-3.3.0 --- srcpkgs/rocm-llvm/template | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 srcpkgs/rocm-llvm/template diff --git a/srcpkgs/rocm-llvm/template b/srcpkgs/rocm-llvm/template new file mode 100644 index 00000000000..26942e3ea46 --- /dev/null +++ b/srcpkgs/rocm-llvm/template @@ -0,0 +1,25 @@ +# Template file for 'rocm-llvm' +pkgname=rocm-llvm +version=3.3.0 +revision=1 +archs="x86_64*" +wrksrc="llvm-project-rocm-ocl-${version}" +build_wrksrc=llvm +build_style=cmake +configure_args="-DCMAKE_INSTALL_PREFIX:PATH=/usr/lib/rocm-llvm + -DLLVM_ENABLE_PROJECTS='llvm;clang;lld' -DLLVM_TARGETS_TO_BUILD='AMDGPU' + -DLLVM_BUILD_DOCS=NO -DLLVM_ENABLE_OCAMLDOC=OFF + -DLLVM_ENABLE_SPHINX=NO -DLLVM_ENABLE_DOXYGEN=OFF + -DLLVM_INSTALL_UTILS=ON -DLLVM_VERSION_SUFFIX=roc -DOCAMLFIND=NO" +hostmakedepends="cmake pkg-config python3" +short_desc="Radeon Open Compute LLVM toolchain" +maintainer="Andrew J. Hesford " +license="Apache-2.0, NCSA, custom:LLVM-Exceptions" +homepage="https://github.com/RadeonOpenCompute/llvm-project" +distfiles="${homepage}/archive/rocm-ocl-${version}.tar.gz" +checksum=a2bef7042e8e2f2cd8548cb246b88322e1c77188839983dcac8312d56f544dc8 +nocross=yes + +post_install() { + vlicense LICENSE.TXT +} From 0ee2359856f75dacd03c580552e93d58e9a91307 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Tue, 14 Apr 2020 10:25:31 -0400 Subject: [PATCH 4/8] New package: rocm-device-libs-3.3.0 --- srcpkgs/rocm-device-libs/template | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 srcpkgs/rocm-device-libs/template diff --git a/srcpkgs/rocm-device-libs/template b/srcpkgs/rocm-device-libs/template new file mode 100644 index 00000000000..fcb4eb0d53e --- /dev/null +++ b/srcpkgs/rocm-device-libs/template @@ -0,0 +1,37 @@ +# Template file for 'rocm-device-libs' +pkgname=rocm-device-libs +version=3.3.0 +revision=1 +archs="x86_64*" +wrksrc="ROCm-Device-Libs-rocm-ocl-${version}" +build_style=cmake +configure_args="-DLLVM_DIR:PATH=/usr/lib/rocm-llvm + -DCMAKE_INSTALL_LIBDIR:PATH=lib/rocm-device-libs" +hostmakedepends="cmake rocm-llvm" +short_desc="Radeon Open Compute device libraries" +maintainer="Andrew J. Hesford " +license="NCSA" +homepage="https://github.com/RadeonOpenCompute/ROCm-Device-Libs" +distfiles="${homepage}/archive/rocm-ocl-${version}.tar.gz" +checksum=706b08230790e08ca6a7a2fb7687d6131fd39a562148340e00fa37a6c06769c5 +nocross=yes + +pre_configure() { + # Put bytecodes in a lib/ subdirectory + vsed -i Packages.cmake -e 's@/lib/@/${CMAKE_INSTALL_LIBDIR}/@' + vsed -i OCL.cmake -e 's@DESTINATION lib$@DESTINATION ${CMAKE_INSTALL_LIBDIR}@' + + # Build the prepare-builtins executable with native compiler + mkdir -p utils/build + cd utils/build + _prepare_builtins="$PWD/prepare-builtins/prepare-builtins" + cmake ${configure_args} .. + make ${makejobs} + + # Add path to prepare-builtins for cmake + configure_args+=" -DPREPARE_BUILTINS='${_prepare_builtins}'" +} + +post_install() { + vlicense LICENSE +} From b032bbe813e08f4e6e6a22077c577daab8680876 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Mon, 13 Apr 2020 18:30:00 -0400 Subject: [PATCH 5/8] New package: rocm-comgr-3.3.0 --- common/shlibs | 1 + srcpkgs/rocm-comgr-devel | 1 + srcpkgs/rocm-comgr/template | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 120000 srcpkgs/rocm-comgr-devel create mode 100644 srcpkgs/rocm-comgr/template diff --git a/common/shlibs b/common/shlibs index 68b07cb65bd..7d69d12b1e6 100644 --- a/common/shlibs +++ b/common/shlibs @@ -3864,3 +3864,4 @@ libkdsoap.so.1.9.0 KDSoap-1.9.0_1 libstoken.so.1 stoken-0.92_1 libhsakmt.so.1 roct-thunk-interface-3.3.0_1 libhsa-runtime64.so.1 rocr-runtime-3.3.0_1 +libamd_comgr.so.1 rocm-comgr-3.3.0_1 diff --git a/srcpkgs/rocm-comgr-devel b/srcpkgs/rocm-comgr-devel new file mode 120000 index 00000000000..3f5ce255e07 --- /dev/null +++ b/srcpkgs/rocm-comgr-devel @@ -0,0 +1 @@ +rocm-comgr \ No newline at end of file diff --git a/srcpkgs/rocm-comgr/template b/srcpkgs/rocm-comgr/template new file mode 100644 index 00000000000..c228bcd4d1f --- /dev/null +++ b/srcpkgs/rocm-comgr/template @@ -0,0 +1,32 @@ +# Template file for 'rocm-comgr' +pkgname=rocm-comgr +version=3.3.0 +revision=1 +archs="x86_64*" +wrksrc="ROCm-CompilerSupport-rocm-${version}" +build_wrksrc="lib/comgr" +build_style=cmake +configure_args="-DClang_DIR:PATH=/usr/lib/rocm-llvm/lib/cmake/clang" +hostmakedepends="cmake pkg-config rocm-llvm" +makedepends="rocm-device-libs" +short_desc="Radeon Open Compute Code Object Manager" +maintainer="Andrew J. Hesford " +license="BSD-3-Clause" +homepage="https://github.com/RadeonOpenCompute/ROCm-CompilerSupport" +distfiles="${homepage}/archive/rocm-${version}.tar.gz" +checksum=01e2524e0f28ecd6f46c9720f279207de935d826b0172158792aa3ec86af9ca7 +nocross=yes + +post_install() { + vlicense LICENSE.txt +} + +rocm-comgr-devel_package() { + depends="${sourcepkg}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove "usr/lib/*.so" + vmove usr/lib/cmake + } +} From 625c567a70470aee7729966ac2533c5bc5cd59ac Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Fri, 17 Apr 2020 12:11:25 -0400 Subject: [PATCH 6/8] New package: rocminfo-3.3.0 --- srcpkgs/rocminfo/template | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 srcpkgs/rocminfo/template diff --git a/srcpkgs/rocminfo/template b/srcpkgs/rocminfo/template new file mode 100644 index 00000000000..57d0640dd69 --- /dev/null +++ b/srcpkgs/rocminfo/template @@ -0,0 +1,22 @@ +# Template file for 'rocminfo' +pkgname=rocminfo +version=3.3.0 +revision=1 +archs="x86_64*" +wrksrc="rocminfo-rocm-${version}" +build_style=cmake +configure_args="-DROCM_DIR=/usr" +hostmakedepends="cmake pkg-config" +makedepends="rocr-runtime-devel" +short_desc="Radeon Open Compute system information reporter" +maintainer="Andrew J. Hesford " +license="NCSA" +homepage="https://github.com/RadeonOpenCompute/rocminfo" +distfiles="${homepage}/archive/rocm-${version}.tar.gz" +checksum=e666f662c9e465aaabbbd0b109d87e017243cdf1a0898fabf5a90947bb3dbcd7 +nocross=yes +python_version=3 + +post_install() { + vlicense License.txt +} From f69ae7f2f4159216d382a145b53b0ead7783d5b2 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Sun, 19 Apr 2020 15:01:40 -0400 Subject: [PATCH 7/8] New package: rocm-bandwidth-test-3.3.0 --- srcpkgs/rocm-bandwidth-test/template | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 srcpkgs/rocm-bandwidth-test/template diff --git a/srcpkgs/rocm-bandwidth-test/template b/srcpkgs/rocm-bandwidth-test/template new file mode 100644 index 00000000000..5c5058b693d --- /dev/null +++ b/srcpkgs/rocm-bandwidth-test/template @@ -0,0 +1,20 @@ +# Template file for 'rocm-bandwidth-test' +pkgname=rocm-bandwidth-test +version=3.3.0 +revision=1 +archs="x86_64*" +wrksrc="rocm_bandwidth_test-rocm-${version}" +build_style=cmake +hostmakedepends="cmake" +makedepends="rocr-runtime-devel roct-thunk-interface-devel" +short_desc="Radeon Open Compute bandwidth test" +maintainer="Andrew J. Hesford " +license="NCSA" +homepage="https://github.com/RadeonOpenCompute/rocm_bandwidth_test" +distfiles="${homepage}/archive/rocm-${version}.tar.gz" +checksum=f5f914073018619dc91662d5bf630903dfa4db9136d603591917fdfb3c9164ce +nocross=yes + +post_install() { + vlicense LICENSE.txt +} From 5e82f67d086f9c93673d244f604fc1a3b7a71c63 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Tue, 14 Apr 2020 10:25:54 -0400 Subject: [PATCH 8/8] New package: rocm-opencl-runtime-3.3.0 [ci skip] --- common/shlibs | 2 + srcpkgs/rocm-opencl-runtime-clinfo | 1 + srcpkgs/rocm-opencl-runtime-devel | 1 + .../files/libelf-musl.patch | 688 ++++++++++++++++++ .../files/runtime-musl.patch | 11 + srcpkgs/rocm-opencl-runtime/files/sys_queue.h | 574 +++++++++++++++ .../rocm-opencl-runtime/patches/cmake.patch | 126 ++++ srcpkgs/rocm-opencl-runtime/template | 82 +++ 8 files changed, 1485 insertions(+) create mode 120000 srcpkgs/rocm-opencl-runtime-clinfo create mode 120000 srcpkgs/rocm-opencl-runtime-devel create mode 100644 srcpkgs/rocm-opencl-runtime/files/libelf-musl.patch create mode 100644 srcpkgs/rocm-opencl-runtime/files/runtime-musl.patch create mode 100644 srcpkgs/rocm-opencl-runtime/files/sys_queue.h create mode 100644 srcpkgs/rocm-opencl-runtime/patches/cmake.patch create mode 100644 srcpkgs/rocm-opencl-runtime/template diff --git a/common/shlibs b/common/shlibs index 7d69d12b1e6..73a205152d0 100644 --- a/common/shlibs +++ b/common/shlibs @@ -3865,3 +3865,5 @@ libstoken.so.1 stoken-0.92_1 libhsakmt.so.1 roct-thunk-interface-3.3.0_1 libhsa-runtime64.so.1 rocr-runtime-3.3.0_1 libamd_comgr.so.1 rocm-comgr-3.3.0_1 +libOpenCL-ROCm.so.1 rocm-opencl-runtime-3.3.0_1 +libamdocl64.so rocm-opencl-runtime-3.3.0_1 diff --git a/srcpkgs/rocm-opencl-runtime-clinfo b/srcpkgs/rocm-opencl-runtime-clinfo new file mode 120000 index 00000000000..b2cda7e229d --- /dev/null +++ b/srcpkgs/rocm-opencl-runtime-clinfo @@ -0,0 +1 @@ +rocm-opencl-runtime \ No newline at end of file diff --git a/srcpkgs/rocm-opencl-runtime-devel b/srcpkgs/rocm-opencl-runtime-devel new file mode 120000 index 00000000000..b2cda7e229d --- /dev/null +++ b/srcpkgs/rocm-opencl-runtime-devel @@ -0,0 +1 @@ +rocm-opencl-runtime \ No newline at end of file diff --git a/srcpkgs/rocm-opencl-runtime/files/libelf-musl.patch b/srcpkgs/rocm-opencl-runtime/files/libelf-musl.patch new file mode 100644 index 00000000000..a3705c259a9 --- /dev/null +++ b/srcpkgs/rocm-opencl-runtime/files/libelf-musl.patch @@ -0,0 +1,688 @@ +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/_libelf.h compiler/lib/loaders/elf/utils/libelf/_libelf.h +--- compiler/lib/loaders/elf/utils/libelf.orig/_libelf.h 2020-04-19 08:59:34.201386585 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/_libelf.h 2020-04-19 09:04:12.950433528 -0400 +@@ -30,7 +30,7 @@ + #define __LIBELF_H_ + + #include +-#include ++#include "sys_queue.h" + + #include "_libelf_config.h" + +@@ -179,7 +179,9 @@ + * Function Prototypes. + */ + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + Elf_Data *_libelf_allocate_data(Elf_Scn *_s); + Elf *_libelf_allocate_elf(Elf_Mem *mem); + Elf_Scn *_libelf_allocate_scn(Elf *_e, size_t _ndx); +@@ -213,6 +215,8 @@ + Elf_Data *_libelf_xlate(Elf_Data *_d, const Elf_Data *_s, + unsigned int _encoding, int _elfclass, int _direction); + int _libelf_xlate_shtype(uint32_t _sht); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* __LIBELF_H_ */ +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_begin.c compiler/lib/loaders/elf/utils/libelf/elf_begin.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_begin.c 2020-04-19 08:59:34.201386585 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_begin.c 2020-04-19 09:01:04.313212042 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #if !defined(WIN32) + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_end.c compiler/lib/loaders/elf/utils/libelf/elf_end.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_end.c 2020-04-19 08:59:34.201386585 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_end.c 2020-04-19 09:01:14.895204681 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #if !defined(WIN32) + #include + #endif +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_errmsg.c compiler/lib/loaders/elf/utils/libelf/elf_errmsg.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_errmsg.c 2020-04-19 08:59:34.201386585 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_errmsg.c 2020-04-19 09:01:16.753207065 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_errno.c compiler/lib/loaders/elf/utils/libelf/elf_errno.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_errno.c 2020-04-19 08:59:34.201386585 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_errno.c 2020-04-19 09:01:18.669209528 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + + #include "_libelf.h" +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_fill.c compiler/lib/loaders/elf/utils/libelf/elf_fill.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_fill.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_fill.c 2020-04-19 09:01:21.109212667 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + + #include "_libelf.h" +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_flag.c compiler/lib/loaders/elf/utils/libelf/elf_flag.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_flag.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_flag.c 2020-04-19 09:01:23.376215579 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + + #include "_libelf.h" +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_getarhdr.c compiler/lib/loaders/elf/utils/libelf/elf_getarhdr.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_getarhdr.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_getarhdr.c 2020-04-19 09:01:25.414218197 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + + #include "_libelf.h" +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_getarsym.c compiler/lib/loaders/elf/utils/libelf/elf_getarsym.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_getarsym.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_getarsym.c 2020-04-19 09:01:27.575220978 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + + #include "_libelf.h" +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_getbase.c compiler/lib/loaders/elf/utils/libelf/elf_getbase.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_getbase.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_getbase.c 2020-04-19 09:01:29.963224043 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + + #include "_libelf.h" +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_getident.c compiler/lib/loaders/elf/utils/libelf/elf_getident.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_getident.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_getident.c 2020-04-19 09:01:31.912226551 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_hash.c compiler/lib/loaders/elf/utils/libelf/elf_hash.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_hash.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_hash.c 2020-04-19 09:01:33.877229069 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + + #include "_libelf_config.h" +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_kind.c compiler/lib/loaders/elf/utils/libelf/elf_kind.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_kind.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_kind.c 2020-04-19 09:01:35.940231721 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + + #include "_libelf.h" +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_memory.c compiler/lib/loaders/elf/utils/libelf/elf_memory.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_memory.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_memory.c 2020-04-19 09:01:38.171234596 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_next.c compiler/lib/loaders/elf/utils/libelf/elf_next.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_next.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_next.c 2020-04-19 09:01:40.063237028 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_phnum.c compiler/lib/loaders/elf/utils/libelf/elf_phnum.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_phnum.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_phnum.c 2020-04-19 09:01:42.480240134 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_rand.c compiler/lib/loaders/elf/utils/libelf/elf_rand.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_rand.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_rand.c 2020-04-19 09:01:45.061243452 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_rawfile.c compiler/lib/loaders/elf/utils/libelf/elf_rawfile.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_rawfile.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_rawfile.c 2020-04-19 09:01:46.988245928 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + + #include "_libelf.h" +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_scn.c compiler/lib/loaders/elf/utils/libelf/elf_scn.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_scn.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_scn.c 2020-04-19 09:00:19.724298403 -0400 +@@ -24,8 +24,7 @@ + * SUCH DAMAGE. + */ + +-#include +-#include ++#include "sys_queue.h" + + #include + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_shnum.c compiler/lib/loaders/elf/utils/libelf/elf_shnum.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_shnum.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_shnum.c 2020-04-19 09:01:51.763252060 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_shstrndx.c compiler/lib/loaders/elf/utils/libelf/elf_shstrndx.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_shstrndx.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_shstrndx.c 2020-04-19 09:01:53.532254340 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/elf_version.c compiler/lib/loaders/elf/utils/libelf/elf_version.c +--- compiler/lib/loaders/elf/utils/libelf.orig/elf_version.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/elf_version.c 2020-04-19 09:02:01.337264370 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + + #include "_libelf.h" +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf.h compiler/lib/loaders/elf/utils/libelf/gelf.h +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf.h 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf.h 2020-04-19 09:04:29.669455020 -0400 +@@ -29,8 +29,6 @@ + #ifndef _GELF_H_ + #define _GELF_H_ + +-#include +- + #include + + typedef Elf64_Addr GElf_Addr; /* Addresses */ +@@ -72,7 +70,9 @@ + #define GELF_ST_TYPE ELF64_ST_TYPE + #define GELF_ST_VISIBILITY ELF64_ST_VISIBILITY + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + long gelf_checksum(Elf *_elf); + size_t gelf_fsize(Elf *_elf, Elf_Type _type, size_t _count, + unsigned int _version); +@@ -109,6 +109,8 @@ + int gelf_update_move(Elf_Data *_dst, int _index, GElf_Move *_src); + int gelf_update_syminfo(Elf_Data *_dst, int _index, GElf_Syminfo *_src); + #endif +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* _GELF_H_ */ +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_cap.c compiler/lib/loaders/elf/utils/libelf/gelf_cap.c +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_cap.c 2020-04-19 08:59:34.202386583 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf_cap.c 2020-04-19 09:02:05.429269632 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_checksum.c compiler/lib/loaders/elf/utils/libelf/gelf_checksum.c +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_checksum.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf_checksum.c 2020-04-19 09:02:08.192273183 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_dyn.c compiler/lib/loaders/elf/utils/libelf/gelf_dyn.c +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_dyn.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf_dyn.c 2020-04-19 09:02:10.020275525 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_ehdr.c compiler/lib/loaders/elf/utils/libelf/gelf_ehdr.c +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_ehdr.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf_ehdr.c 2020-04-19 09:02:11.882277926 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_fsize.c compiler/lib/loaders/elf/utils/libelf/gelf_fsize.c +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_fsize.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf_fsize.c 2020-04-19 09:02:14.139280827 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_getclass.c compiler/lib/loaders/elf/utils/libelf/gelf_getclass.c +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_getclass.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf_getclass.c 2020-04-19 09:02:17.269284848 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + + #include "_libelf.h" +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_move.c compiler/lib/loaders/elf/utils/libelf/gelf_move.c +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_move.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf_move.c 2020-04-19 09:02:18.974287034 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_phdr.c compiler/lib/loaders/elf/utils/libelf/gelf_phdr.c +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_phdr.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf_phdr.c 2020-04-19 09:02:20.676289227 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_rel.c compiler/lib/loaders/elf/utils/libelf/gelf_rel.c +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_rel.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf_rel.c 2020-04-19 09:02:23.177292435 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_rela.c compiler/lib/loaders/elf/utils/libelf/gelf_rela.c +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_rela.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf_rela.c 2020-04-19 09:02:25.246295100 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_shdr.c compiler/lib/loaders/elf/utils/libelf/gelf_shdr.c +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_shdr.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf_shdr.c 2020-04-19 09:02:28.325299060 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_sym.c compiler/lib/loaders/elf/utils/libelf/gelf_sym.c +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_sym.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf_sym.c 2020-04-19 09:02:30.113301356 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_syminfo.c compiler/lib/loaders/elf/utils/libelf/gelf_syminfo.c +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_syminfo.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf_syminfo.c 2020-04-19 09:02:31.906303662 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_symshndx.c compiler/lib/loaders/elf/utils/libelf/gelf_symshndx.c +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_symshndx.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf_symshndx.c 2020-04-19 09:02:33.626305873 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/gelf_xlate.c compiler/lib/loaders/elf/utils/libelf/gelf_xlate.c +--- compiler/lib/loaders/elf/utils/libelf.orig/gelf_xlate.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/gelf_xlate.c 2020-04-19 09:02:35.921308822 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf.h compiler/lib/loaders/elf/utils/libelf/libelf.h +--- compiler/lib/loaders/elf/utils/libelf.orig/libelf.h 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/libelf.h 2020-04-19 09:04:38.760466706 -0400 +@@ -30,7 +30,7 @@ + #define _LIBELF_H_ + + #include +-#include ++#include "sys_queue.h" + #include + #ifndef EM_HSAIL + #define EM_HSAIL 0xAF5A +@@ -187,7 +187,9 @@ + #define ELF_F_ARCHIVE 0x100U /* archive creation */ + #define ELF_F_ARCHIVE_SYSV 0x200U /* SYSV style archive */ + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + Elf *elf_begin(int _fd, Elf_Cmd _cmd, Elf *_elf, Elf_Mem *_mem); + int elf_cntl(Elf *_elf, Elf_Cmd _cmd); + int elf_end(Elf *_elf); +@@ -257,6 +259,8 @@ + unsigned int _enc); + Elf_Data *elf64_xlatetom(Elf_Data *_dst, const Elf_Data *_src, + unsigned int _enc); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* _LIBELF_H_ */ +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_align.c compiler/lib/loaders/elf/utils/libelf/libelf_align.c +--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_align.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/libelf_align.c 2020-04-19 09:02:40.660314911 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_allocate.c compiler/lib/loaders/elf/utils/libelf/libelf_allocate.c +--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_allocate.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/libelf_allocate.c 2020-04-19 09:02:43.079318019 -0400 +@@ -28,8 +28,6 @@ + * Internal APIs + */ + +-#include +- + #if !defined(WIN32) + #include + #endif +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_ar.c compiler/lib/loaders/elf/utils/libelf/libelf_ar.c +--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_ar.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/libelf_ar.c 2020-04-19 09:02:44.763320187 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_ar_util.c compiler/lib/loaders/elf/utils/libelf/libelf_ar_util.c +--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_ar_util.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/libelf_ar_util.c 2020-04-19 09:02:46.461322369 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_checksum.c compiler/lib/loaders/elf/utils/libelf/libelf_checksum.c +--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_checksum.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/libelf_checksum.c 2020-04-19 09:02:48.645325173 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + + #include "_libelf.h" +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_convert.c compiler/lib/loaders/elf/utils/libelf/libelf_convert.c +--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_convert.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/libelf_convert.c 2020-04-19 09:02:50.883328053 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_data.c compiler/lib/loaders/elf/utils/libelf/libelf_data.c +--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_data.c 2020-04-19 08:59:34.203386581 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/libelf_data.c 2020-04-19 09:02:52.951330708 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + + #include "_libelf.h" +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_ehdr.c compiler/lib/loaders/elf/utils/libelf/libelf_ehdr.c +--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_ehdr.c 2020-04-19 08:59:34.204386579 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/libelf_ehdr.c 2020-04-19 09:02:55.176333563 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_extended.c compiler/lib/loaders/elf/utils/libelf/libelf_extended.c +--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_extended.c 2020-04-19 08:59:34.204386579 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/libelf_extended.c 2020-04-19 09:02:57.932337110 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_msize.c compiler/lib/loaders/elf/utils/libelf/libelf_msize.c +--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_msize.c 2020-04-19 08:59:34.204386579 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/libelf_msize.c 2020-04-19 09:03:02.201342598 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_phdr.c compiler/lib/loaders/elf/utils/libelf/libelf_phdr.c +--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_phdr.c 2020-04-19 08:59:34.204386579 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/libelf_phdr.c 2020-04-19 09:03:04.194345160 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + #include +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_shdr.c compiler/lib/loaders/elf/utils/libelf/libelf_shdr.c +--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_shdr.c 2020-04-19 08:59:34.204386579 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/libelf_shdr.c 2020-04-19 09:03:05.795347218 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + +diff -u -r compiler/lib/loaders/elf/utils/libelf.orig/libelf_xlate.c compiler/lib/loaders/elf/utils/libelf/libelf_xlate.c +--- compiler/lib/loaders/elf/utils/libelf.orig/libelf_xlate.c 2020-04-19 08:59:34.204386579 -0400 ++++ compiler/lib/loaders/elf/utils/libelf/libelf_xlate.c 2020-04-19 09:03:09.472351944 -0400 +@@ -24,8 +24,6 @@ + * SUCH DAMAGE. + */ + +-#include +- + #include + #include + diff --git a/srcpkgs/rocm-opencl-runtime/files/runtime-musl.patch b/srcpkgs/rocm-opencl-runtime/files/runtime-musl.patch new file mode 100644 index 00000000000..ea18e90e09c --- /dev/null +++ b/srcpkgs/rocm-opencl-runtime/files/runtime-musl.patch @@ -0,0 +1,11 @@ +--- runtime/os/os_posix.cpp.orig 2020-04-19 09:13:51.701982901 -0400 ++++ runtime/os/os_posix.cpp 2020-04-19 09:14:04.156947422 -0400 +@@ -44,6 +44,8 @@ + #include + #include + ++#include // for basename ++ + + namespace amd { + diff --git a/srcpkgs/rocm-opencl-runtime/files/sys_queue.h b/srcpkgs/rocm-opencl-runtime/files/sys_queue.h new file mode 100644 index 00000000000..daf4553d33e --- /dev/null +++ b/srcpkgs/rocm-opencl-runtime/files/sys_queue.h @@ -0,0 +1,574 @@ +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + */ + +#ifndef _SYS_QUEUE_H_ +#define _SYS_QUEUE_H_ + +/* + * This file defines five types of data structures: singly-linked lists, + * lists, simple queues, tail queues, and circular queues. + * + * A singly-linked list is headed by a single forward pointer. The + * elements are singly linked for minimum space and pointer manipulation + * overhead at the expense of O(n) removal for arbitrary elements. New + * elements can be added to the list after an existing element or at the + * head of the list. Elements being removed from the head of the list + * should use the explicit macro for this purpose for optimum + * efficiency. A singly-linked list may only be traversed in the forward + * direction. Singly-linked lists are ideal for applications with large + * datasets and few or no removals or for implementing a LIFO queue. + * + * A list is headed by a single forward pointer (or an array of forward + * pointers for a hash table header). The elements are doubly linked + * so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before + * or after an existing element or at the head of the list. A list + * may only be traversed in the forward direction. + * + * A simple queue is headed by a pair of pointers, one the head of the + * list and the other to the tail of the list. The elements are singly + * linked to save space, so elements can only be removed from the + * head of the list. New elements can be added to the list after + * an existing element, at the head of the list, or at the end of the + * list. A simple queue may only be traversed in the forward direction. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may be traversed in either direction. + * + * A circle queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or after + * an existing element, at the head of the list, or at the end of the list. + * A circle queue may be traversed in either direction, but has a more + * complex end of list detection. + * + * For details on the use of these macros, see the queue(3) manual page. + */ + +/* + * List definitions. + */ +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + +#define LIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} + +/* + * List functions. + */ +#define LIST_INIT(head) do { \ + (head)->lh_first = NULL; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_AFTER(listelm, elm, field) do { \ + if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ + (listelm)->field.le_next->field.le_prev = \ + &(elm)->field.le_next; \ + (listelm)->field.le_next = (elm); \ + (elm)->field.le_prev = &(listelm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.le_prev = (listelm)->field.le_prev; \ + (elm)->field.le_next = (listelm); \ + *(listelm)->field.le_prev = (elm); \ + (listelm)->field.le_prev = &(elm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.le_next = (head)->lh_first) != NULL) \ + (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ + (head)->lh_first = (elm); \ + (elm)->field.le_prev = &(head)->lh_first; \ +} while (/*CONSTCOND*/0) + +#define LIST_REMOVE(elm, field) do { \ + if ((elm)->field.le_next != NULL) \ + (elm)->field.le_next->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = (elm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_FOREACH(var, head, field) \ + for ((var) = ((head)->lh_first); \ + (var); \ + (var) = ((var)->field.le_next)) + +/* + * List access methods. + */ +#define LIST_EMPTY(head) ((head)->lh_first == NULL) +#define LIST_FIRST(head) ((head)->lh_first) +#define LIST_NEXT(elm, field) ((elm)->field.le_next) + + +/* + * Singly-linked List definitions. + */ +#define SLIST_HEAD(name, type) \ +struct name { \ + struct type *slh_first; /* first element */ \ +} + +#define SLIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define SLIST_ENTRY(type) \ +struct { \ + struct type *sle_next; /* next element */ \ +} + +/* + * Singly-linked List functions. + */ +#define SLIST_INIT(head) do { \ + (head)->slh_first = NULL; \ +} while (/*CONSTCOND*/0) + +#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ + (elm)->field.sle_next = (slistelm)->field.sle_next; \ + (slistelm)->field.sle_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define SLIST_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.sle_next = (head)->slh_first; \ + (head)->slh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE_HEAD(head, field) do { \ + (head)->slh_first = (head)->slh_first->field.sle_next; \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE(head, elm, type, field) do { \ + if ((head)->slh_first == (elm)) { \ + SLIST_REMOVE_HEAD((head), field); \ + } \ + else { \ + struct type *curelm = (head)->slh_first; \ + while(curelm->field.sle_next != (elm)) \ + curelm = curelm->field.sle_next; \ + curelm->field.sle_next = \ + curelm->field.sle_next->field.sle_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define SLIST_FOREACH(var, head, field) \ + for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) + +/* + * Singly-linked List access methods. + */ +#define SLIST_EMPTY(head) ((head)->slh_first == NULL) +#define SLIST_FIRST(head) ((head)->slh_first) +#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) + + +/* + * Singly-linked Tail queue declarations. + */ +#define STAILQ_HEAD(name, type) \ +struct name { \ + struct type *stqh_first; /* first element */ \ + struct type **stqh_last; /* addr of last next element */ \ +} + +#define STAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).stqh_first } + +#define STAILQ_ENTRY(type) \ +struct { \ + struct type *stqe_next; /* next element */ \ +} + +/* + * Singly-linked Tail queue functions. + */ +#define STAILQ_INIT(head) do { \ + (head)->stqh_first = NULL; \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (head)->stqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.stqe_next = NULL; \ + *(head)->stqh_last = (elm); \ + (head)->stqh_last = &(elm)->field.stqe_next; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (listelm)->field.stqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define STAILQ_REMOVE_HEAD(head, field) do { \ + if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_REMOVE(head, elm, type, field) do { \ + if ((head)->stqh_first == (elm)) { \ + STAILQ_REMOVE_HEAD((head), field); \ + } else { \ + struct type *curelm = (head)->stqh_first; \ + while (curelm->field.stqe_next != (elm)) \ + curelm = curelm->field.stqe_next; \ + if ((curelm->field.stqe_next = \ + curelm->field.stqe_next->field.stqe_next) == NULL) \ + (head)->stqh_last = &(curelm)->field.stqe_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define STAILQ_FOREACH(var, head, field) \ + for ((var) = ((head)->stqh_first); \ + (var); \ + (var) = ((var)->field.stqe_next)) + +#define STAILQ_CONCAT(head1, head2) do { \ + if (!STAILQ_EMPTY((head2))) { \ + *(head1)->stqh_last = (head2)->stqh_first; \ + (head1)->stqh_last = (head2)->stqh_last; \ + STAILQ_INIT((head2)); \ + } \ +} while (/*CONSTCOND*/0) + +/* + * Singly-linked Tail queue access methods. + */ +#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) +#define STAILQ_FIRST(head) ((head)->stqh_first) +#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) + + +/* + * Simple queue definitions. + */ +#define SIMPLEQ_HEAD(name, type) \ +struct name { \ + struct type *sqh_first; /* first element */ \ + struct type **sqh_last; /* addr of last next element */ \ +} + +#define SIMPLEQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).sqh_first } + +#define SIMPLEQ_ENTRY(type) \ +struct { \ + struct type *sqe_next; /* next element */ \ +} + +/* + * Simple queue functions. + */ +#define SIMPLEQ_INIT(head) do { \ + (head)->sqh_first = NULL; \ + (head)->sqh_last = &(head)->sqh_first; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ + (head)->sqh_last = &(elm)->field.sqe_next; \ + (head)->sqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.sqe_next = NULL; \ + *(head)->sqh_last = (elm); \ + (head)->sqh_last = &(elm)->field.sqe_next; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ + (head)->sqh_last = &(elm)->field.sqe_next; \ + (listelm)->field.sqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE_HEAD(head, field) do { \ + if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ + (head)->sqh_last = &(head)->sqh_first; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE(head, elm, type, field) do { \ + if ((head)->sqh_first == (elm)) { \ + SIMPLEQ_REMOVE_HEAD((head), field); \ + } else { \ + struct type *curelm = (head)->sqh_first; \ + while (curelm->field.sqe_next != (elm)) \ + curelm = curelm->field.sqe_next; \ + if ((curelm->field.sqe_next = \ + curelm->field.sqe_next->field.sqe_next) == NULL) \ + (head)->sqh_last = &(curelm)->field.sqe_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_FOREACH(var, head, field) \ + for ((var) = ((head)->sqh_first); \ + (var); \ + (var) = ((var)->field.sqe_next)) + +/* + * Simple queue access methods. + */ +#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL) +#define SIMPLEQ_FIRST(head) ((head)->sqh_first) +#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) + + +/* + * Tail queue definitions. + */ +#define _TAILQ_HEAD(name, type, qual) \ +struct name { \ + qual type *tqh_first; /* first element */ \ + qual type *qual *tqh_last; /* addr of last next element */ \ +} +#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) + +#define TAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).tqh_first } + +#define _TAILQ_ENTRY(type, qual) \ +struct { \ + qual type *tqe_next; /* next element */ \ + qual type *qual *tqe_prev; /* address of previous next element */\ +} +#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) + +/* + * Tail queue functions. + */ +#define TAILQ_INIT(head) do { \ + (head)->tqh_first = NULL; \ + (head)->tqh_last = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ + (head)->tqh_first->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_first = (elm); \ + (elm)->field.tqe_prev = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &(elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ + (elm)->field.tqe_next->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (listelm)->field.tqe_next = (elm); \ + (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ + (elm)->field.tqe_next = (listelm); \ + *(listelm)->field.tqe_prev = (elm); \ + (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_REMOVE(head, elm, field) do { \ + if (((elm)->field.tqe_next) != NULL) \ + (elm)->field.tqe_next->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_FOREACH(var, head, field) \ + for ((var) = ((head)->tqh_first); \ + (var); \ + (var) = ((var)->field.tqe_next)) + +#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ + (var); \ + (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) + +#define TAILQ_CONCAT(head1, head2, field) do { \ + if (!TAILQ_EMPTY(head2)) { \ + *(head1)->tqh_last = (head2)->tqh_first; \ + (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ + (head1)->tqh_last = (head2)->tqh_last; \ + TAILQ_INIT((head2)); \ + } \ +} while (/*CONSTCOND*/0) + +/* + * Tail queue access methods. + */ +#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) +#define TAILQ_FIRST(head) ((head)->tqh_first) +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) + +#define TAILQ_LAST(head, headname) \ + (*(((struct headname *)((head)->tqh_last))->tqh_last)) +#define TAILQ_PREV(elm, headname, field) \ + (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) + + +/* + * Circular queue definitions. + */ +#define CIRCLEQ_HEAD(name, type) \ +struct name { \ + struct type *cqh_first; /* first element */ \ + struct type *cqh_last; /* last element */ \ +} + +#define CIRCLEQ_HEAD_INITIALIZER(head) \ + { (void *)&head, (void *)&head } + +#define CIRCLEQ_ENTRY(type) \ +struct { \ + struct type *cqe_next; /* next element */ \ + struct type *cqe_prev; /* previous element */ \ +} + +/* + * Circular queue functions. + */ +#define CIRCLEQ_INIT(head) do { \ + (head)->cqh_first = (void *)(head); \ + (head)->cqh_last = (void *)(head); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm)->field.cqe_next; \ + (elm)->field.cqe_prev = (listelm); \ + if ((listelm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (listelm)->field.cqe_next->field.cqe_prev = (elm); \ + (listelm)->field.cqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm); \ + (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ + if ((listelm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (listelm)->field.cqe_prev->field.cqe_next = (elm); \ + (listelm)->field.cqe_prev = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.cqe_next = (head)->cqh_first; \ + (elm)->field.cqe_prev = (void *)(head); \ + if ((head)->cqh_last == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (head)->cqh_first->field.cqe_prev = (elm); \ + (head)->cqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.cqe_next = (void *)(head); \ + (elm)->field.cqe_prev = (head)->cqh_last; \ + if ((head)->cqh_first == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (head)->cqh_last->field.cqe_next = (elm); \ + (head)->cqh_last = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_REMOVE(head, elm, field) do { \ + if ((elm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm)->field.cqe_prev; \ + else \ + (elm)->field.cqe_next->field.cqe_prev = \ + (elm)->field.cqe_prev; \ + if ((elm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm)->field.cqe_next; \ + else \ + (elm)->field.cqe_prev->field.cqe_next = \ + (elm)->field.cqe_next; \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_FOREACH(var, head, field) \ + for ((var) = ((head)->cqh_first); \ + (var) != (const void *)(head); \ + (var) = ((var)->field.cqe_next)) + +#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ + for ((var) = ((head)->cqh_last); \ + (var) != (const void *)(head); \ + (var) = ((var)->field.cqe_prev)) + +/* + * Circular queue access methods. + */ +#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) +#define CIRCLEQ_FIRST(head) ((head)->cqh_first) +#define CIRCLEQ_LAST(head) ((head)->cqh_last) +#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) +#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) + +#define CIRCLEQ_LOOP_NEXT(head, elm, field) \ + (((elm)->field.cqe_next == (void *)(head)) \ + ? ((head)->cqh_first) \ + : (elm->field.cqe_next)) +#define CIRCLEQ_LOOP_PREV(head, elm, field) \ + (((elm)->field.cqe_prev == (void *)(head)) \ + ? ((head)->cqh_last) \ + : (elm->field.cqe_prev)) + +#endif /* sys/queue.h */ diff --git a/srcpkgs/rocm-opencl-runtime/patches/cmake.patch b/srcpkgs/rocm-opencl-runtime/patches/cmake.patch new file mode 100644 index 00000000000..2c96b99d45a --- /dev/null +++ b/srcpkgs/rocm-opencl-runtime/patches/cmake.patch @@ -0,0 +1,126 @@ +--- OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/CMakeLists.txt 2019-09-10 11:53:28.000000000 -0400 ++++ OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/CMakeLists.txt 2020-04-16 20:16:13.481180757 -0400 +@@ -73,11 +73,11 @@ + + set (OPENCL_ICD_LOADER_HEADERS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/inc CACHE PATH "Path to OpenCL Headers") + +-add_library (OpenCL ${OPENCL_ICD_LOADER_SOURCES}) +-set_target_properties (OpenCL PROPERTIES VERSION "1.2" SOVERSION "1") ++add_library (OpenCL-ROCm ${OPENCL_ICD_LOADER_SOURCES}) ++set_target_properties (OpenCL-ROCm PROPERTIES VERSION "1.2" SOVERSION "1") + + if (WIN32) +- target_link_libraries (OpenCL cfgmgr32.lib) ++ target_link_libraries (OpenCL-ROCm cfgmgr32.lib) + + option (OPENCL_ICD_LOADER_REQUIRE_WDK "Build with D3DKMT support, which requires the Windows WDK." ON) + if (OPENCL_ICD_LOADER_REQUIRE_WDK) +@@ -92,10 +92,10 @@ + get_filename_component(WDK_DIRECTORY ${LATEST_D3DKMT_HEADER} DIRECTORY) + get_filename_component(WDK_DIRECTORY ${WDK_DIRECTORY} DIRECTORY) + message(STATUS "Found the Windows WDK in: ${WDK_DIRECTORY}") +- target_compile_definitions(OpenCL PRIVATE OPENCL_ICD_LOADER_REQUIRE_WDK) +- target_include_directories(OpenCL PRIVATE ${WDK_DIRECTORY}/um) +- target_include_directories(OpenCL PRIVATE ${WDK_DIRECTORY}/km) +- target_include_directories(OpenCL PRIVATE ${WDK_DIRECTORY}/shared) ++ target_compile_definitions(OpenCL-ROCm PRIVATE OPENCL_ICD_LOADER_REQUIRE_WDK) ++ target_include_directories(OpenCL-ROCm PRIVATE ${WDK_DIRECTORY}/um) ++ target_include_directories(OpenCL-ROCm PRIVATE ${WDK_DIRECTORY}/km) ++ target_include_directories(OpenCL-ROCm PRIVATE ${WDK_DIRECTORY}/shared) + else() + message(FATAL_ERROR "The Windows WDK was not found. Consider disabling OPENCL_ICD_LOADER_REQUIRE_WDK. Aborting.") + endif() +@@ -113,25 +113,25 @@ + endif() + else() + if (APPLE) +- target_link_libraries (OpenCL ${CMAKE_THREAD_LIBS_INIT}) ++ target_link_libraries (OpenCL-ROCm ${CMAKE_THREAD_LIBS_INIT}) + else () +- set_target_properties (OpenCL PROPERTIES LINK_FLAGS "-Wl,--version-script -Wl,${CMAKE_CURRENT_SOURCE_DIR}/loader/linux/icd_exports.map") +- target_link_libraries (OpenCL ${CMAKE_THREAD_LIBS_INIT}) ++ set_target_properties (OpenCL-ROCm PROPERTIES LINK_FLAGS "-Wl,--version-script -Wl,${CMAKE_CURRENT_SOURCE_DIR}/loader/linux/icd_exports.map") ++ target_link_libraries (OpenCL-ROCm ${CMAKE_THREAD_LIBS_INIT}) + endif () + endif () + + include_directories (${OPENCL_ICD_LOADER_HEADERS_DIR}) + add_definitions (-DCL_TARGET_OPENCL_VERSION=220) + +-target_include_directories (OpenCL PRIVATE ${CMAKE_CURRENT_BINARY_DIR} loader) +-target_link_libraries (OpenCL ${CMAKE_DL_LIBS}) ++target_include_directories (OpenCL-ROCm PRIVATE ${CMAKE_CURRENT_BINARY_DIR} loader) ++target_link_libraries (OpenCL-ROCm ${CMAKE_DL_LIBS}) + + include (CTest) + if (BUILD_TESTING) + add_subdirectory (test) + endif() + +-install (TARGETS OpenCL ++install (TARGETS OpenCL-ROCm + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +--- OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/test/loader_test/CMakeLists.txt 2019-09-10 11:53:28.000000000 -0400 ++++ OpenCL-ICD-Loader-6c03f8b58fafd9dd693eaac826749a5cfad515f8/test/loader_test/CMakeLists.txt 2020-04-16 20:16:56.647026589 -0400 +@@ -12,4 +12,4 @@ + test_clgl.c + test_image_objects.c ) + +-target_link_libraries (icd_loader_test OpenCL IcdLog) ++target_link_libraries (icd_loader_test OpenCL-ROCm IcdLog) +--- ROCm-OpenCL-Runtime-roc-3.3.0/CMakeLists.txt 2020-04-28 07:29:51.864446603 -0400 ++++ ROCm-OpenCL-Runtime-roc-3.3.0/CMakeLists.txt 2020-04-28 07:32:45.245793180 -0400 +@@ -101,30 +101,30 @@ + rocm_setup_version( VERSION "2.0.0" ) + + # MAIN package +-install(PROGRAMS $ +- DESTINATION bin/x86_64 ++install(PROGRAMS $ ++ DESTINATION bin + COMPONENT MAIN) + install(PROGRAMS $ +- DESTINATION lib/x86_64 ++ DESTINATION lib + COMPONENT MAIN) +-install(PROGRAMS $ +- DESTINATION lib/x86_64 ++install(PROGRAMS $ ++ DESTINATION lib + COMPONENT MAIN) +-install(PROGRAMS $ +- DESTINATION lib/x86_64 ++install(PROGRAMS $ ++ DESTINATION lib + COMPONENT MAIN) + + # DEV package + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/api/opencl/khronos/headers/opencl2.2/CL" +- DESTINATION include ++ DESTINATION include/rocm + COMPONENT DEV + USE_SOURCE_PERMISSIONS + PATTERN cl_d3d10.h EXCLUDE + PATTERN cl_d3d11.h EXCLUDE + PATTERN cl_dx9_media_sharing.h EXCLUDE + PATTERN cl_egl.h EXCLUDE) +-install(PROGRAMS $ +- DESTINATION lib/x86_64 ++install(PROGRAMS $ ++ DESTINATION lib + COMPONENT DEV) + + # Generic CPACK variables +--- ROCm-OpenCL-Runtime-roc-3.3.0/tools/clinfo/CMakeLists.txt 2020-04-28 07:29:51.882446535 -0400 ++++ ROCm-OpenCL-Runtime-roc-3.3.0/tools/clinfo/CMakeLists.txt 2020-04-28 07:30:05.627394732 -0400 +@@ -6,6 +6,6 @@ + + add_definitions(-DHAVE_CL2_HPP) + +-add_executable(clinfo clinfo.cpp) ++add_executable(rocm-clinfo clinfo.cpp) + +-target_link_libraries(clinfo OpenCL) ++target_link_libraries(rocm-clinfo OpenCL-ROCm) diff --git a/srcpkgs/rocm-opencl-runtime/template b/srcpkgs/rocm-opencl-runtime/template new file mode 100644 index 00000000000..f83c6e64149 --- /dev/null +++ b/srcpkgs/rocm-opencl-runtime/template @@ -0,0 +1,82 @@ +# Template file for 'rocm-opencl-runtime' +pkgname=rocm-opencl-runtime +version=3.3.0 +revision=1 +_ocl_icd_name="OpenCL-ICD-Loader" +_ocl_icd_ver="6c03f8b58fafd9dd693eaac826749a5cfad515f8" +archs="x86_64*" +create_wrksrc=yes +build_wrksrc="ROCm-OpenCL-Runtime-roc-${version}" +build_style=cmake +configure_args="-DUSE_COMGR_LIBRARY=yes" +hostmakedepends="cmake pkg-config" +makedepends="libglvnd-devel rocm-comgr-devel + roct-thunk-interface-devel rocr-runtime-devel" +depends="rocm-comgr" +short_desc="Radeon Open Compute OpenCL runtime" +maintainer="Andrew J. Hesford " +license="MIT" +homepage="https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime" +_rocroot="https://github.com/RadeonOpenCompute" +distfiles="${_rocroot}/ROCm-OpenCL-Runtime/archive/roc-${version}.tar.gz + ${_rocroot}/rocm-cmake/archive/rocm-${version}.tar.gz + https://github.com/KhronosGroup/${_ocl_icd_name}/archive/${_ocl_icd_ver}.tar.gz" +checksum="ac6999f1a491ab066286c2bd6adf50f08f831286f56e267879f9f7eced22f98e + 76ed3ee8e56cf3246011cf7723c2abda539e1136e7e7f6909bfa45d268b8644f + c94d5bb6dc980c4d41d73e2b81663a19aabe494e923e2d0eec72a4c95b318438" +nocross=yes + +post_patch() { + if [ "$XBPS_LIBC" = "musl" ]; then + # Copy sys/queue.h locally for MUSL builds + libelf_dir="compiler/lib/loaders/elf/utils/libelf" + cp "${FILESDIR}/sys_queue.h" "${libelf_dir}" + + # Remove dependence on glibc + patch -Np0 < ${FILESDIR}/libelf-musl.patch + patch -Np0 < ${FILESDIR}/runtime-musl.patch + vsed -e '/glibc_functions.cpp/d' -i api/opencl/amdocl/CMakeLists.txt + fi +} + +pre_configure() { + # ROCm requires a very specific Khronos ICD loader version in the tree + # Keep the ICD loader config in /etc/rocm/vendors to avoid conflicts + _ocl_icd_dir="${_ocl_icd_name}-${_ocl_icd_ver}" + ln -sf "${wrksrc}/${_ocl_icd_dir}" api/opencl/khronos/icd + vsed -i "${wrksrc}/${_ocl_icd_dir}/loader/icd_platform.h" \ + -e 's@/etc/OpenCL/vendors/@/etc/rocm/vendors/@g' + + # CMake modules probably not useful anywhere but for this build + ln -sf "${wrksrc}/rocm-cmake-rocm-${version}/share/rocm/cmake"/*.cmake cmake + + # Fix the dlopen macro to point to versioned libamd_comgr shared object + vsed -i 'runtime/device/comgrctx.cpp' \ + -e 's/\blibamd_comgr\(32\)\?.so\b/&.1/g' +} + +post_install() { + vlicense License + + # Create descriptor to allow the ICD loader to find the driver + _ocl_icd_dir="etc/rocm/vendors" + vmkdir "${_ocl_icd_dir}" + echo "libamdocl64.so" > "${DESTDIR}/${_ocl_icd_dir}/amdocl64.icd" +} + +rocm-opencl-runtime-devel_package() { + depends="${sourcepkg}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/lib/libOpenCL-ROCm.so + vmove usr/include + } +} + +rocm-opencl-runtime-clinfo_package() { + depends="${sourcepkg}>=${version}_${revision}" + short_desc+=" - clinfo" + pkg_install() { + vmove usr/bin/rocm-clinfo + } +}