diff --git a/buildflags.md b/buildflags.md index 73e0c5c..47b79f9 100644 --- a/buildflags.md +++ b/buildflags.md @@ -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 diff --git a/macros b/macros index ebab63b..938f9eb 100644 --- a/macros +++ b/macros @@ -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} diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 1820c9b..bd8bf57 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -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 - 236-1 +- Add conditional support for always including frame pointers + * Sat Dec 10 2022 Florian Weimer - 235-1 - Add %%_configure_use_runstatedir to disable --runstatedir configure option