Commit 046119b
committed
fix(rocm-compilersupport): teach rocm-llvm clang to find the AZL GCC toolchain
AZL's azurelinux-rpm-config overlay changes %_vendor from "redhat" to
"azurelinux", so GCC installs its runtime objects (crtbeginS.o, libgcc,
libstdc++, etc.) under /usr/lib/gcc/<cpu>-azurelinux-linux/<ver>/. The
upstream clang GCCInstallationDetector triple list in
clang/lib/Driver/ToolChains/Gnu.cpp only knows about a fixed set of
vendor strings ("redhat", "suse", "amazon", ...) and has no "azurelinux"
entry, so any clang built without an AZL-aware config silently fails to
find the GCC install and produces link errors like:
ld.lld: error: cannot open crtbeginS.o: No such file or directory
ld.lld: error: unable to find library -lstdc++
ld.lld: error: unable to find library -lgcc_s / -lgcc
The system llvm / llvm20 packages already work around this by writing
%{_target_platform}-clang.cfg files into /etc/clang containing
"--gcc-triple=%{_target_cpu}-%{_vendor}-linux". The rocm-llvm clang
shipped here lives at /usr/lib64/rocm/llvm/bin/ and does not read
/etc/clang, so it needs its own per-binary config file.
This was breaking the mivisionx build on x86_64 (and would similarly
break every other ROCm consumer that drives the rocm-llvm clang
directly, e.g. hipblaslt, hipcub, hipfft, rocfft, rocblas, miopen).
A rebuild of rocm-compilersupport itself also fails for the same reason
because the multi-stage %build uses its own freshly-built clang to
compile each subsequent stage.
Add three spec-search-replace overlays that drop clang.cfg / clang++.cfg
with --gcc-triple=%{_target_cpu}-%{_vendor}-linux in three places:
1. Next to the stage-1 clang inside build-llvm/bin so stage 2+ of the
in-package %build can compile and link.
2. Pre-staged inside build-llvm-2/bin before stage-2 %cmake_build runs
so the LLVM "runtimes" sub-build (compiler-rt, libcxx, libcxxabi)
can configure once stage-2 clang is produced.
3. Installed into %{bundle_prefix}/bin alongside the shipped clang so
every downstream ROCm consumer sees the right toolchain triple.
Clang automatically reads "<argv0>.cfg" from its own directory before
any system config dir, so dropping the file is sufficient — no source
patch and no version-specific maintenance. The cfg payload uses
%_vendor / %_target_cpu so it transparently follows future arch and
vendor changes. The existing "%{bundle_prefix}/bin/clang*" glob in
%files -n rocm-clang already picks up the new files.
This mirrors the existing approach in base/comps/llvm and
base/comps/llvm20 rather than introducing a new mechanism.1 parent 4bd4dd8 commit 046119b
4 files changed
Lines changed: 89 additions & 3 deletions
File tree
- base/comps/rocm-compilersupport
- locks
- specs/r/rocm-compilersupport
Lines changed: 67 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
466 | 471 | | |
467 | 472 | | |
468 | 473 | | |
| |||
501 | 506 | | |
502 | 507 | | |
503 | 508 | | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
504 | 517 | | |
505 | 518 | | |
506 | 519 | | |
| |||
706 | 719 | | |
707 | 720 | | |
708 | 721 | | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
709 | 729 | | |
710 | 730 | | |
711 | 731 | | |
| |||
0 commit comments