Add conditional support for always including frame pointers

If `%_include_frame_pointers` is defined, add `-fno-omit-frame-pointer`
and `-mno-omit-leaf-frame-pointer` to the compiler flags to ensure frame
pointers are always included.

This is in preparation for
https://fedoraproject.org/wiki/Changes/fno-omit-frame-pointer
This commit is contained in:
Davide Cavalca 2022-12-28 12:17:38 -08:00
parent f857d65cdd
commit 04a4350d3e
3 changed files with 19 additions and 2 deletions

View File

@ -278,6 +278,10 @@ will be used to generate `%_package_note_file`. If `%_package_note_flags`
is undefined, the linker argument that injects the script will not be added
to `%build_ldfags`, but the linker script would still be generated.
### Frame pointers
Frame pointers will be included by default if the `%_include_frame_pointers`
macro is defined.
### Post-build ELF object processing
@ -461,6 +465,10 @@ by undefining the `%_annotated_build` RPM macro (see above). Binary
watermarks are currently disabled on armhpf, and with the `clang`
toolchain.
If frame pointers are enabled by default (via `%_include_frame_pointers),
the `-fno-omit-frame-pointer` and `-mno-omit-leaf-frame-pointer` flags will
be added.
### Architecture-specific compiler flags
These compiler flags are enabled for all builds (hardened/annotated or

8
macros
View File

@ -333,6 +333,12 @@ print(result)
# to move the annobin notes into the separate debuginfo file.
%_find_debuginfo_extra_opts %{?_annotated_build:--remove-section .gnu.build.attributes}
# Always include frame pointer information
# https://fedoraproject.org/wiki/Changes/fno-omit-frame-pointer
# Use "%define _include_frame_pointers 1" to enable.
#%_include_frame_pointers 1
%_frame_pointers_cflags %{?_include_frame_pointers:-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer}
# Fail linking if there are undefined symbols. Required for proper
# ELF symbol versioning support. Disabled by default.
# Use "%define _ld_strict_symbol_defs 1" to enable.
@ -368,7 +374,7 @@ print(result)
# If they are needed then add "%define _legacy_common_support 1" to the spec file.
%_legacy_options %{?_legacy_common_support: -fcommon}
%__global_compiler_flags %{_general_options} %{_warning_options} %{_preprocessor_defines} %{_hardened_cflags} %{_annotation_cflags} %{_legacy_options}
%__global_compiler_flags %{_general_options} %{_warning_options} %{_preprocessor_defines} %{_hardened_cflags} %{_annotation_cflags} %{_frame_pointers_cflags} %{_legacy_options}
# Automatically trim changelog entries after 2 years
%_changelog_trimage %{expr:2*365*24*60*60}

View File

@ -4,7 +4,7 @@
# 2) When making changes, increment the version (in baserelease) by 1.
# rpmdev-bumpspec and other tools update the macro below, which is used
# in Version: to get the desired effect.
%global baserelease 235
%global baserelease 236
Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config
@ -221,6 +221,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
%doc buildflags.md
%changelog
* Wed Dec 28 2022 Davide Cavalca <dcavalca@fedoraproject.org> - 236-1
- Add conditional support for always including frame pointers
* Sat Dec 10 2022 Florian Weimer <fweimer@redhat.com> - 235-1
- Add %%_configure_use_runstatedir to disable --runstatedir configure option