Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core 12] arch/amd64: let the frame pointer return #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions arch/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# C Compiler Flags.
CFLAGS_COMMON=('-pipe' '-Wno-error')
CFLAGS_COMMON_OPTI=('-O2')
CFLAGS_COMMON_OPTI=('-O2' '-fno-omit-frame-pointer' '-mno-omit-leaf-frame-pointer')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some CPU architectures may not have the concept of "frame pointers", enabling frame pointers on those platforms will cause the compiler to use an emulated version of "frame pointers" (while sacrificing an extra register for storing emulated frame pointer data).

Copy link
Member

@Artoria2e5 Artoria2e5 Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the case for almost any architecture. The concept of a frame pointer comes from the ABI, not from the architecture. In the case of x86-64, %rbp is one of 16 GP registers chosen to act as a frame pointer by ABI convention, and using -fomit frees it to be used for other purposes.

Now if 16 GP registers is enough to not omit the one frame pointer, the many RISC architectures with 32 or more GP registers must be completely okay with not omitting.

CFLAGS_COMMON_DEBUG=('-O0') # not that frequently used since autotools know it.
CFLAGS_GCC=()
CFLAGS_GCC_OPTI=('-fira-loop-pressure' '-fira-hoist-pressure' '-ftree-vectorize')
Expand All @@ -28,7 +28,7 @@ OBJCXXFLAGS_COMMON_WEIRD=()
OBJCXXFLAGS_COMMON_PERMISSIVE=('-fpermissive')
# RUST Flags.
RUSTFLAGS_COMMON=()
RUSTFLAGS_COMMON_OPTI=('-Ccodegen-units=1' '-Copt-level=3' '-Cdebuginfo=line-tables-only')
RUSTFLAGS_COMMON_OPTI=('-Ccodegen-units=1' '-Copt-level=3' '-Cdebuginfo=line-tables-only' '-Cforce-frame-pointers=yes')
RUSTFLAGS_COMMON_WEIRD=()
# Use clang + lld for processing LTO
RUSTFLAGS_COMMON_OPTI_LTO=(
Expand Down
2 changes: 1 addition & 1 deletion arch/amd64.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
##arch/amd64.sh: Build definitions for amd64.
##@copyright GPL-2.0+
CFLAGS_COMMON_ARCH=('-fomit-frame-pointer' '-march=x86-64' '-mtune=sandybridge' '-msse2')
CFLAGS_COMMON_ARCH=('-march=x86-64' '-mtune=sandybridge' '-msse2')
RUSTFLAGS_COMMON_ARCH=('-Ctarget-cpu=x86-64')
2 changes: 1 addition & 1 deletion arch/amd64_avx+.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
##arch/amd64_avx.sh: Build definitions for amd64 with AVX support.
## Intel SandyBridge and AMD Bulldozer or later processors.
##@copyright GPL-2.0+
CFLAGS_COMMON_ARCH=('-fomit-frame-pointer' '-march=sandybridge')
CFLAGS_COMMON_ARCH=('-march=sandybridge')
RUSTFLAGS_COMMON_ARCH=('-Ctarget-cpu=sandybridge')
2 changes: 1 addition & 1 deletion arch/amd64_avx2+.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
##arch/amd64_avx2.sh: Build definitions for amd64 with AVX2 support.
## Intel Haswell+, AMD bdver4+, VIA eden-x4+.
##@copyright GPL-2.0+
CFLAGS_COMMON_ARCH=('-fomit-frame-pointer' '-march=haswell' '-mno-rdrnd')
CFLAGS_COMMON_ARCH=('-march=haswell' '-mno-rdrnd')
RUSTFLAGS_COMMON_ARCH=('-Ctarget-cpu=haswell' '-Ctarget-feature=-rdrnd')
Loading