Add -flto to ldflags for clang toolchain

Also, add a gating CI tests to ensure that future macro changes work
with clang.
This commit is contained in:
Tom Stellard 2020-08-04 18:26:08 +00:00 committed by Igor Raits
parent 8a5ee87c50
commit d698d04313
No known key found for this signature in database
GPG Key ID: 115D5AB89C5C1E1E
2 changed files with 8 additions and 2 deletions

5
macros
View File

@ -86,7 +86,10 @@
# 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.
%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags}
# 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} %[ "%{toolchain}" == "clang" ? "%{?_lto_cflags}" : "" ]
# Expands to shell code to set the compiler/linker environment
# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have

View File

@ -6,7 +6,7 @@
Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config
Version: 168
Version: 169
Release: 1%{?dist}
# No version specified.
License: GPL+
@ -212,6 +212,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
%{_rpmconfigdir}/macros.d/macros.kmp
%changelog
* Mon Aug 20 2020 Tom Stellard <tstellar@redhat.com> - 169-1
- Add -flto to ldflags for clang toolchain
* Thu Aug 20 2020 Neal Gompa <ngompa13@gmail.com> - 168-1
- Fix CC/CXX exports so arguments are included in exported variable
- Allow overrides of CC/CXX like CFLAGS and CXXFLAGS from shell variables