"-fomit-frame-pointer" means the way we don't have to pushq %rbp and move %rsp, %rbp; we need to only change the value of %rsp. As far as i think, stack frame dealing with the base pointer and stack frame without it don't have differences in terms of benefits. Could you explain what benefits "stack-frame without dealing with %ebp" has?
Asked
Active
Viewed 287 times
1
Peter Cordes
- 286,368
- 41
- 520
- 731
주혜민
- 47
- 5
-
1The code generator can now use ebp as a general purpose register, improves efficiency of legacy 32-bit code. This doesn't get used often, it makes code very hard to debug since stack traces can now only be generated accurately with debug metadata. – Hans Passant Oct 11 '20 at 11:38
-
1It *does* get used very often since at least gcc enables it with `-O2` automatically. – Jester Oct 11 '20 at 11:50
-
2@HansPassant: It's on by default when optimization is enabled, even for 32-bit code in GCC for several years now; I'd hardly say it "doesn't get used often". It's been on by default since forever in x86-64 code; OP mentions RBP as well. Modern Linux (x86-64 System V ABI) treats the `.eh_frame` metadata as necessary, not as "debug" info: it generates it by default, and doesn't strip it in otherwise stripped binaries, even for C. (It's necessary for C++ exception handling, but not really for C except for backtraces) – Peter Cordes Oct 11 '20 at 11:50