From 47edc1561a39dc07ae4711e38b985ada7dc1693e Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 23 May 2022 16:46:48 -0700 Subject: [PATCH] Move -fno-openmp-implicit-rpath option from CFLAGS to LDFLAGS This option needs to be passed to the linker not the compiler. --- macros | 14 +++++++------- redhat-rpm-config.spec | 7 +++++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/macros b/macros index be51cd4..7c47920 100644 --- a/macros +++ b/macros @@ -64,15 +64,17 @@ # the corresponding variable names. %build_fflags %{optflags} -I%{_fmoddir} +# When clang is used as a linker driver, it does not auto-detect the LTO +# bytecode and neither does bfd, so we need to explicitly pass the -flto +# flag when linking. +%_clang_extra_ldflags %{?_lto_cflags} -fno-openmp-implicit-rpath + # Link editor flags. This is usually called LDFLAGS in makefiles. # (Some makefiles use LFLAGS instead.) The default value assumes that # the flags, while intended for ld, are still passed through the gcc # compiler driver. At the beginning of %%build, the environment # variable RPM_LD_FLAGS to this value. -# When clang is used as a linker driver, it does not auto-detect the LTO -# bytecode and neither does bfd, so we need to explicitly pass the -flto -# flag when linking. -%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} %{_annotation_ldflags} %[ "%{toolchain}" == "clang" ? "%{?_lto_cflags}" : "" ] %{_build_id_flags} %{?_package_note_flags} +%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} %{_annotation_ldflags} %[ "%{toolchain}" == "clang" ? "%{?_clang_extra_ldflags}" : "" ] %{_build_id_flags} %{?_package_note_flags} # Expands to shell code to set the compiler/linker environment # variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have @@ -354,9 +356,7 @@ print(result) # If they are needed then add "%define _legacy_common_support 1" to the spec file. %_legacy_options %{?_legacy_common_support: -fcommon} -%_clang_extra_flags --start-no-unused-arguments -fno-openmp-implicit-rpath --end-no-unused-arguments - -%__global_compiler_flags %{_general_options} %{_warning_options} %{_preprocessor_defines} %{_hardened_cflags} %{_annotation_cflags} %{_legacy_options} %[ "%{toolchain}" == "clang" ? "%{_clang_extra_flags}" : "%{nil}" ] +%__global_compiler_flags %{_general_options} %{_warning_options} %{_preprocessor_defines} %{_hardened_cflags} %{_annotation_cflags} %{_legacy_options} # Automatically trim changelog entries after 2 years %_changelog_trimage %{expr:2*365*24*60*60} diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 86f3be9..6d7d577 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,8 +6,8 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 219 -Release: 2%{?dist} +Version: 220 +Release: 1%{?dist} # No version specified. License: GPL+ URL: https://src.fedoraproject.org/rpms/redhat-rpm-config @@ -217,6 +217,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %doc buildflags.md %changelog +* Fri May 27 2022 Tom Stellard - 220-1 +- Move -fno-openmp-implicit-rpath option from CFLAGS to LDFLAGS + * Tue May 17 2022 Miro HronĨok - 219-2 - Remove a tab character from the definition of %%__global_compiler_flags - Fixes: rhbz#2083296