Do not include frame pointers on i686 and s390x for now

This commit is contained in:
Davide Cavalca 2023-01-10 12:29:21 -08:00
parent f789437d98
commit 990cc89b1b
4 changed files with 22 additions and 14 deletions

View File

@ -490,11 +490,10 @@ watermarks are currently disabled on armhpf, and with the `clang`
toolchain. toolchain.
If frame pointers are enabled by default (via `%_include_frame_pointers`), If frame pointers are enabled by default (via `%_include_frame_pointers`),
the `-fno-omit-frame-pointer` will be added on all architectures. Additional the `-fno-omit-frame-pointer` will be added on all architectures except i686
flags will be added on specific architectures: and s390x. Additional flags will be added on specific architectures:
* `-mno-omit-leaf-frame-pointer` on x86_64 and aarch64 * `-mno-omit-leaf-frame-pointer` on x86_64 and aarch64
* `-mbackchain` on s390x
### Architecture-specific compiler flags ### Architecture-specific compiler flags

View File

@ -4,7 +4,7 @@
# 2) When making changes, increment the version (in baserelease) by 1. # 2) When making changes, increment the version (in baserelease) by 1.
# rpmdev-bumpspec and other tools update the macro below, which is used # rpmdev-bumpspec and other tools update the macro below, which is used
# in Version: to get the desired effect. # in Version: to get the desired effect.
%global baserelease 239 %global baserelease 240
Summary: Red Hat specific rpm configuration files Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config Name: redhat-rpm-config
@ -221,6 +221,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
%doc buildflags.md %doc buildflags.md
%changelog %changelog
* Tue Jan 10 2023 Davide Cavalca <dcavalca@fedoraproject.org> - 240-1
- Do not include frame pointers on i686 and s390x for now
* Wed Jan 4 2023 Davide Cavalca <dcavalca@fedoraproject.org> - 239-1 * Wed Jan 4 2023 Davide Cavalca <dcavalca@fedoraproject.org> - 239-1
- Enable frame pointers by default - Enable frame pointers by default
- Set arch specific flags for frame pointers support - Set arch specific flags for frame pointers support

12
rpmrc
View File

@ -1,10 +1,10 @@
include: /usr/lib/rpm/rpmrc include: /usr/lib/rpm/rpmrc
optflags: i386 %{__global_compiler_flags} -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection %{_frame_pointers_cflags} optflags: i386 %{__global_compiler_flags} -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection
optflags: i486 %{__global_compiler_flags} -m32 -march=i486 -fasynchronous-unwind-tables -fstack-clash-protection %{_frame_pointers_cflags} optflags: i486 %{__global_compiler_flags} -m32 -march=i486 -fasynchronous-unwind-tables -fstack-clash-protection
optflags: i586 %{__global_compiler_flags} -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection %{_frame_pointers_cflags} optflags: i586 %{__global_compiler_flags} -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection
optflags: i686 %{__global_compiler_flags} -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection %{_frame_pointers_cflags} optflags: i686 %{__global_compiler_flags} -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
optflags: athlon %{__global_compiler_flags} -m32 -march=athlon -fasynchronous-unwind-tables -fstack-clash-protection %{_frame_pointers_cflags} optflags: athlon %{__global_compiler_flags} -m32 -march=athlon -fasynchronous-unwind-tables -fstack-clash-protection
optflags: x86_64 %{__global_compiler_flags} -m64 %{__cflags_arch_x86_64} -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection %{_frame_pointers_cflags} %{_frame_pointers_cflags_x86_64} optflags: x86_64 %{__global_compiler_flags} -m64 %{__cflags_arch_x86_64} -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection %{_frame_pointers_cflags} %{_frame_pointers_cflags_x86_64}
optflags: ppc64le %{__global_compiler_flags} -m64 %{__cflags_arch_ppc64le} -fasynchronous-unwind-tables -fstack-clash-protection %{_frame_pointers_cflags} optflags: ppc64le %{__global_compiler_flags} -m64 %{__cflags_arch_ppc64le} -fasynchronous-unwind-tables -fstack-clash-protection %{_frame_pointers_cflags}
@ -12,7 +12,7 @@ optflags: ppc64le %{__global_compiler_flags} -m64 %{__cflags_arch_ppc64le} -fasy
# TODO: Remove armv7hl once f36 goes EOL. # TODO: Remove armv7hl once f36 goes EOL.
optflags: armv7hl %{__global_compiler_flags} -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard %{_frame_pointers_cflags} optflags: armv7hl %{__global_compiler_flags} -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard %{_frame_pointers_cflags}
optflags: s390x %{__global_compiler_flags} -m64 %{__cflags_arch_s390x} -fasynchronous-unwind-tables -fstack-clash-protection %{_frame_pointers_cflags} %{_frame_pointers_cflags_s390x} optflags: s390x %{__global_compiler_flags} -m64 %{__cflags_arch_s390x} -fasynchronous-unwind-tables -fstack-clash-protection
optflags: aarch64 %{__global_compiler_flags} -mbranch-protection=standard -fasynchronous-unwind-tables %[ "%{toolchain}" == "gcc" ? "-fstack-clash-protection" : "" ] %{_frame_pointers_cflags} %{_frame_pointers_cflags_aarch64} optflags: aarch64 %{__global_compiler_flags} -mbranch-protection=standard -fasynchronous-unwind-tables %[ "%{toolchain}" == "gcc" ? "-fstack-clash-protection" : "" ] %{_frame_pointers_cflags} %{_frame_pointers_cflags_aarch64}

View File

@ -23,14 +23,11 @@ validate() {
fi fi
} }
for arch in aarch64 armv7hl i386 i486 i585 i686 athlon x86_64 ppc64le s390x riscv64; do for arch in aarch64 armv7hl x86_64 ppc64le riscv64; do
case "$arch" in case "$arch" in
x86_64|aarch64) x86_64|aarch64)
flags='-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer' flags='-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer'
;; ;;
s390x)
flags='-fno-omit-frame-pointer -mbackchain'
;;
*) *)
flags='-fno-omit-frame-pointer' flags='-fno-omit-frame-pointer'
;; ;;
@ -46,6 +43,15 @@ for arch in aarch64 armv7hl i386 i486 i585 i686 athlon x86_64 ppc64le s390x risc
validate "[${arch}] Test that the flags are included by default" validate "[${arch}] Test that the flags are included by default"
done done
flags='-fno-omit-frame-pointer'
for arch in i386 i486 i586 i686 athlon s390x; do
rpmeval --target="${arch}-linux" --define='%_include_frame_pointers 1' | grep -qv -- "$flags"
validate "[${arch}] Test that the flags are not included if the macro is defined"
rpmeval --target="${arch}-linux" | grep -qv -- "$flags"
validate "[${arch}] Test that the flags are not included by default"
done
echo echo
echo "${passed} passed, ${failed} failed" echo "${passed} passed, ${failed} failed"