Skip to content

Commit 4585a78

Browse files
committed
⏰ rocm-llvm: auto updated to 2:7.2.4-2
It has been built because: * it failed last time and has been updated
1 parent 3a9e98c commit 4585a78

3 files changed

Lines changed: 113 additions & 14 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
From: Arch Linux contributors
2+
Subject: [compiler-rt][sanitizer] Remove linux/scc.h
3+
4+
linux/scc.h was dropped from the kernel UAPI headers and is no longer
5+
shipped by linux-api-headers >= 7.1, so building sanitizer_common fails
6+
with "fatal error: 'linux/scc.h' file not found".
7+
8+
struct_scc_modem_sz and struct_scc_stat_sz are not referenced by the
9+
ioctl interceptors, so they can be removed along with the include.
10+
11+
Backport of llvm/llvm-project commit 3dc4fd6dd ("[compiler-rt][sanitizer]
12+
Remove linux/scc.h", #194116), adjusted to apply on the ROCm fork, which
13+
predates the reindentation of that include block.
14+
15+
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
16+
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
17+
@@ -157,7 +157,6 @@
18+
#include <linux/lp.h>
19+
#include <linux/mroute.h>
20+
#include <linux/mroute6.h>
21+
-#include <linux/scc.h>
22+
#include <linux/serial.h>
23+
#include <sys/msg.h>
24+
#include <sys/ipc.h>
25+
@@ -532,8 +531,6 @@
26+
unsigned struct_kbsentry_sz = sizeof(struct kbsentry);
27+
unsigned struct_mtconfiginfo_sz = sizeof(struct mtconfiginfo);
28+
unsigned struct_nr_parms_struct_sz = sizeof(struct nr_parms_struct);
29+
- unsigned struct_scc_modem_sz = sizeof(struct scc_modem);
30+
- unsigned struct_scc_stat_sz = sizeof(struct scc_stat);
31+
unsigned struct_serial_multiport_struct_sz
32+
= sizeof(struct serial_multiport_struct);
33+
unsigned struct_serial_struct_sz = sizeof(struct serial_struct);
34+
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
35+
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
36+
@@ -1119,8 +1119,6 @@
37+
extern unsigned struct_kbsentry_sz;
38+
extern unsigned struct_mtconfiginfo_sz;
39+
extern unsigned struct_nr_parms_struct_sz;
40+
-extern unsigned struct_scc_modem_sz;
41+
-extern unsigned struct_scc_stat_sz;
42+
extern unsigned struct_serial_multiport_struct_sz;
43+
extern unsigned struct_serial_struct_sz;
44+
extern unsigned struct_sockaddr_ax25_sz;

alarmcn/rocm-llvm/PKGBUILD

Lines changed: 62 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,42 @@ pkgbase=rocm-llvm
66
pkgname=(rocm-llvm rocm-device-libs comgr)
77
epoch=2
88
pkgver=7.2.4
9-
pkgrel=1
9+
pkgrel=2
1010
arch=(aarch64)
1111
url='https://rocm.docs.amd.com/en/latest/reference/rocmcc.html'
1212
makedepends=('git' 'cmake' 'python' 'ninja' 'rocm-core' 'rocm-cmake' 'perl'
1313
'gcc-libs' 'zlib' 'zstd' 'libffi' 'libedit' 'ncurses' 'libxml2' 'patchelf')
14-
source=("$pkgbase::git+https://github.com/ROCm/llvm-project#tag=rocm-$pkgver")
15-
sha256sums=('cda215d04dfb6ede38c542d4604711d4a4623267df0f3d678491cd9fbcc32fd9')
14+
source=("$pkgbase::git+https://github.com/ROCm/llvm-project#tag=rocm-$pkgver"
15+
'0001-compiler-rt-sanitizer-Remove-linux-scc.h.patch')
16+
sha256sums=('cda215d04dfb6ede38c542d4604711d4a4623267df0f3d678491cd9fbcc32fd9'
17+
'3592a157f9c8c748a5f75d79c9e328f1c359ec6609d260a58d4b68ba97f7fe9b')
1618
options=(staticlibs !lto)
1719

20+
prepare() {
21+
# linux/scc.h is gone from linux-api-headers >= 7.1
22+
patch -Np1 -d "$pkgbase" -i "$srcdir/0001-compiler-rt-sanitizer-Remove-linux-scc.h.patch"
23+
}
24+
1825
build() {
1926
CXXFLAGS+=' -Wno-error -Wno-narrowing'
2027
CFLAGS+=' -Wno-error -Wno-narrowing'
2128
# Build only minimal debug info to reduce size
2229
CFLAGS+=' -g1'
2330
CXXFLAGS+=' -g1'
2431

32+
# flang-rt compiles the Fortran modules with the just-built flang, which
33+
# errors out on the C-only flags makepkg exports in FFLAGS (see
34+
# /usr/share/makepkg/buildenv/fortran.sh) instead of ignoring them. Drop
35+
# exactly those and keep the rest, so -march, -O2, -g and
36+
# -fno-omit-frame-pointer still apply. If Arch ever adds another C-only flag
37+
# this fails loudly rather than silently dropping hardening.
38+
local _unsupported='-(pipe|fno-plt|fexceptions|fstack-clash-protection)\b'
39+
_unsupported+='|-(mno-omit-leaf-frame-pointer|Wformat|Werror=format-security)\b'
40+
_unsupported+='|-fcf-protection(=[^ ]*)?|-ffile-prefix-map=[^ ]*|-Wp,[^ ]*'
41+
FFLAGS=$(sed -E "s@($_unsupported)@@g" <<<"$FFLAGS")
42+
FCFLAGS=$(sed -E "s@($_unsupported)@@g" <<<"$FCFLAGS")
43+
export FFLAGS FCFLAGS
44+
2545
local _rocm_exe_rpath='\$ORIGIN/../lib:\$ORIGIN/../../../lib'
2646
local _rocm_lib_rpath='\$ORIGIN'
2747
# Flags according to
@@ -33,10 +53,17 @@ build() {
3353
-D CMAKE_BUILD_TYPE=Release
3454
-D CMAKE_INSTALL_PREFIX="/opt/rocm/lib/llvm"
3555
-D LLVM_HOST_TRIPLE=$CHOST
36-
-D LLVM_ENABLE_PROJECTS='clang;lld;clang-tools-extra'
56+
# mlir is a hard dependency of flang. flang provides the `flang` driver
57+
# that `amdflang` dispatches to; without it CLANG_ENABLE_AMDCLANG still
58+
# installs `amdflang`, leaving it pointing at a non-existent binary.
59+
-D LLVM_ENABLE_PROJECTS='clang;lld;clang-tools-extra;mlir;flang'
3760
-D CLANG_ENABLE_AMDCLANG=ON
3861
-D PACKAGE_VENDOR="AMD"
39-
-D LLVM_ENABLE_RUNTIMES='compiler-rt;libunwind;libcxx;libcxxabi'
62+
# flang-rt is the Fortran runtime; without it flang cannot link anything.
63+
# The OpenMP host runtime and the AMDGPU offload plugin are built by the
64+
# separate rocm-openmp package, because the plugin needs the HSA headers
65+
# from hsa-rocr, which in turn makedepends on this package.
66+
-D LLVM_ENABLE_RUNTIMES='compiler-rt;libunwind;libcxx;libcxxabi;flang-rt'
4067
-D LIBCXX_ENABLE_SHARED=OFF
4168
-D LIBCXX_ENABLE_STATIC=ON
4269
-D LIBCXX_INSTALL_LIBRARY=OFF
@@ -64,16 +91,15 @@ build() {
6491
-D CMAKE_SKIP_INSTALL_RPATH=TRUE
6592
-D CMAKE_EXE_LINKER_FLAGS="-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$_rocm_exe_rpath"
6693
-D CMAKE_SHARED_LINKER_FLAGS="-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$_rocm_lib_rpath"
67-
-D CLANG_LINK_FLANG_LEGACY=ON
6894
-D CMAKE_CXX_STANDARD=17
95+
# Fortran driver and runtime. FLANG_RT_INCLUDE_AMD additionally builds
96+
# libflang_rt.amd.a, the part of the Fortran runtime that rocm-openmp
97+
# needs to make Fortran callable from inside OpenMP target regions.
98+
-D FLANG_RT_INCLUDE_AMD=ON
99+
-D FLANG_INCLUDE_DOCS=OFF
100+
-D FLANG_INCLUDE_TESTS=OFF
69101
)
70102
cmake "${cmake_args[@]}"
71-
# Bootstrapping libcxx, see
72-
# https://github.com/ROCm/ROCm/blob/87bc26e672e06294bd2a6a1b507ad5c9ae4cffba/tools/rocm-build/build_lightning.sh#L352-L359
73-
cmake --build build -- clang lld compiler-rt
74-
cmake --build build -- runtimes cxx
75-
cmake --build build
76-
cmake --build build -- clang-tidy
77103

78104
local cmake_device_libs_args=(
79105
-Wno-dev
@@ -83,6 +109,24 @@ build() {
83109
-D CMAKE_INSTALL_PREFIX=/opt/rocm
84110
-D CMAKE_PREFIX_PATH="$srcdir/build"
85111
)
112+
113+
# The ROCm fork adds FIR/HLFIR includes to flang/Support/OpenMP-utils.h that
114+
# upstream does not have, without declaring the matching TableGen
115+
# dependencies in flang/lib/Support/CMakeLists.txt. FortranSupport therefore
116+
# races the TableGen step and intermittently fails with
117+
# "flang/Optimizer/HLFIR/HLFIRDialect.h.inc: No such file or directory".
118+
# Building the dialects first materialises every generated header it needs;
119+
# neither dialect depends on FortranSupport, so this does not deadlock.
120+
cmake --build build -- HLFIRDialect CUFDialect
121+
122+
# Bootstrapping libcxx, see
123+
# https://github.com/ROCm/ROCm/blob/87bc26e672e06294bd2a6a1b507ad5c9ae4cffba/tools/rocm-build/build_lightning.sh#L352-L359
124+
# llvm-link and opt are pulled in early because device-libs needs them.
125+
cmake --build build -- clang lld compiler-rt llvm-link opt
126+
cmake --build build -- runtimes cxx
127+
cmake --build build
128+
cmake --build build -- clang-tidy
129+
86130
cmake "${cmake_device_libs_args[@]}"
87131
cmake --build build-device-libs
88132

@@ -100,10 +144,11 @@ build() {
100144
}
101145

102146
package_rocm-llvm() {
103-
pkgdesc='Radeon Open Compute - LLVM toolchain (llvm, clang, lld)'
147+
pkgdesc='Radeon Open Compute - LLVM toolchain (llvm, clang, lld, flang)'
104148
license=('Apache-2.0 WITH LLVM-exception')
105149
depends=('rocm-core' 'perl' 'glibc' 'libgcc' 'libstdc++' 'zlib' 'zstd' 'libffi' 'libedit'
106150
'ncurses' 'libxml2')
151+
optdepends=('rocm-openmp: OpenMP host runtime and GPU offloading')
107152

108153
DESTDIR="$pkgdir" cmake --install build
109154

@@ -113,7 +158,7 @@ package_rocm-llvm() {
113158
# Some packages require amdclang to be found in /opt/rocm/bin
114159
mkdir -p "$pkgdir/opt/rocm/bin"
115160
local _compiler
116-
for _compiler in amdclang amdclang++ amdclang-cl amdclang-cpp amdlld; do
161+
for _compiler in amdclang amdclang++ amdclang-cl amdclang-cpp amdflang amdlld; do
117162
ln -s /opt/rocm/lib/llvm/bin/$_compiler "$pkgdir/opt/rocm/bin/$_compiler"
118163
done
119164

@@ -127,6 +172,9 @@ package_rocm-llvm() {
127172
install -Dm644 clang-tools-extra/LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/clang-tools-extra-LICENSE"
128173
install -Dm644 compiler-rt/LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/compiler-rt-LICENSE"
129174
install -Dm644 lld/LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/lld-LICENSE"
175+
install -Dm644 flang/LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/flang-LICENSE"
176+
install -Dm644 flang-rt/LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/flang-rt-LICENSE"
177+
install -Dm644 mlir/LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/mlir-LICENSE"
130178
}
131179

132180
package_rocm-device-libs() {

alarmcn/rocm-llvm/REUSE.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,10 @@ path = [
2020
]
2121
SPDX-FileCopyrightText = "Arch Linux contributors"
2222
SPDX-License-Identifier = "0BSD"
23+
24+
[[annotations]]
25+
path = [
26+
"0001-compiler-rt-sanitizer-Remove-linux-scc.h.patch",
27+
]
28+
SPDX-FileCopyrightText = "LLVM contributors"
29+
SPDX-License-Identifier = "Apache-2.0 WITH LLVM-exception"

0 commit comments

Comments
 (0)