- Set RUSTC_TARGET_CPU_X86_64 as x86-64-v2 for x86_64_v2 arch

This commit is contained in:
eabdullin 2024-09-13 23:02:24 +03:00
parent ee3b5c6e79
commit 7ecb708448
2 changed files with 16 additions and 4 deletions

View File

@ -42,6 +42,7 @@
-Cdebuginfo=%rustflags_debuginfo
-Ccodegen-units=%rustflags_codegen_units
-Cstrip=none
%[0%{?x86_64_v2} ? "-Ctarget_cpu=x86-64-v2" : ""]
%{expr:0%{?_include_frame_pointers} && ("%{_arch}" != "ppc64le" && "%{_arch}" != "s390x" && "%{_arch}" != "i386") ? "-Cforce-frame-pointers=yes" : ""}
%[0%{?_package_note_status} ? "-Clink-arg=%_package_note_flags" : ""]
}

View File

@ -682,10 +682,6 @@ mkdir -p src/llvm-project/libunwind/
%endif
%ifarch x86_64_v2
sed -i "s/-Cstrip=none/-Cstrip=none -Ctarget_cpu=x86-64-v2/g" %{S:100}
%endif
# Remove other unused vendored libraries. This leaves the directory in place,
# because some build scripts watch them, e.g. "cargo:rerun-if-changed=curl".
%define clear_dir() find ./%1 -mindepth 1 -delete
@ -750,6 +746,20 @@ find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+'
print(env)
end}
%ifarch x86_64_v2
%global rustc_target_cpus %{lua: do
local fedora = tonumber(rpm.expand("0%{?fedora}"))
local rhel = tonumber(rpm.expand("0%{?rhel}"))
local env =
" RUSTC_TARGET_CPU_X86_64=x86-64-v2"
.. " RUSTC_TARGET_CPU_PPC64LE=" .. ((rhel >= 9) and "pwr9" or "pwr8")
.. " RUSTC_TARGET_CPU_S390X=" ..
((rhel >= 9) and "z14" or (rhel == 8 or fedora >= 38) and "z13" or
(fedora >= 26) and "zEC12" or (rhel == 7) and "z196" or "z10")
print(env)
end}
%endif
# Set up shared environment variables for build/install/check.
# *_USE_PKG_CONFIG=1 convinces *-sys crates to use the system library.
%global rust_env %{shrink:
@ -1176,6 +1186,7 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%changelog
* Fri Sep 13 2024 Eduard Abdullin <eabdullin@almalinux.org> - 1.79.0-3.alma.2
- Set target_cpu=x86-64-v2 for x86_64_v2 arch in build_rustflags macro
- Set RUSTC_TARGET_CPU_X86_64 as x86-64-v2 for x86_64_v2 arch
* Mon Aug 05 2024 Eduard Abdullin <eabdullin@almalinux.org> - 1.79.0-3.alma.1
- Use x86_64 target on x86_64_v2 arch