* Ben Cotton:
This change will add new macros which will make it easier for
packages
to add and remove their own compiler flags. This strategy is already
used to some extent with feature macros like %{_lto_cflags},
%{_hardening_cflags}, etc, but these new macros will give packagers
even more fine-grained control over the options.
The proposed macros for adding new flags are:
%_pkg_extra_cflags
%_pkg_extra_cxxflags
%_pkg_extra_fflags
%_pkg_extra_ldflags
Why isn't it possible to use the environment variables for this?
The proposed new macros to represent existing flags are:
%_flag_fstack_protector_strong -fstack-protector-strong
%_flag_z_now -Wl,-z,now
%_flag_z_defs -Wl,-z,defs
%_flag_flto_auto -flto=auto
%_flag_ffat_lto_objects -ffat-lto-objects
%_flag_o -O2
%_flag_f_exceptions -fexceptions
%_flag_g -g
%_flag_grecord_gcc_switches -grecord-gcc-switches
%_flag_pipe -pipe
%_flag_wall -Wall
%_flag_werror_format_security -Werror=format-security
%_flag_fortify_source -Wp,-D_FORTIFY_SOURCE=2
%_flag_glibcxx_assertions -Wp,-D_GLIBCXX_ASSERTIONS
%_flag_asynchronous_unwind_tables -fasynchronous-unwind-tables
%_flag_fstack_clash_protection -fstack-clash-protection
%_flag_fcf_protection -fcf-protection
%_flag_mbranch_protection_standard -mbranch-protection=standard
This is very misleading because in several cases, clearing the those
flags will not affect toolchain behavior because the flag in question
merely restates the toolchain default. In particular, this applies to
-fasynchronous-unwind-tables, and it would apply to -march= and -mcpu=
if those were in the list. Likewise to -Wl,-z,relro.
Is the goal of this proposal just to achieve a textual flags change
(disregarding any change in behavior), or to actually change toolchain
behavior?
If the former, I'm not sure if the actual _flag names are useful. Maybe
we can add an RPM macro to suppress or replace flags based on the flags
as they are used instead. This could also add additional error checking
because a name typo in the macro definition will not be immediately
obvious.
With these new macros, the examples from above could be re-written
as:
compiler-rt: %global _pkg_extra_cflags -D_DEFAULT_SOURCE
julia: %global _flag_glibcxx_assertions %{nil}
Do you have some background why -D_DEFAULT_SOURCE is needed? Why
doesn't upstream detect this?
Thanks,
Florian