diff options
| author | Zhangjin Wu <[email protected]> | 2023-07-16 02:18:54 +0800 |
|---|---|---|
| committer | Willy Tarreau <[email protected]> | 2023-08-23 04:40:22 +0200 |
| commit | bff60150f7c464d80d86f289c056c2ad2afb3c05 (patch) | |
| tree | df1827acbd23bf0a92c9d7a08a7b4ee11abaaeed /tools/perf/scripts/python/bin/stackcollapse-report | |
| parent | 20233498359a29f7b2ff4e8fbdb0a1a7c8d5744c (diff) | |
tools/nolibc: fix up startup failures for -O0 under gcc < 11.1.0
As gcc doc [1] shows:
Most optimizations are completely disabled at -O0 or if an -O level is
not set on the command line, even if individual optimization flags are
specified.
Test result [2] shows, gcc>=11.1.0 deviates from the above description,
but before gcc 11.1.0, "-O0" still forcely uses frame pointer in the
_start function even if the individual optimize("omit-frame-pointer")
flag is specified.
The frame pointer related operations will change the stack pointer (e.g.
In x86_64, an extra "push %rbp" will be inserted at the beginning of
_start) and make it differs from the one we expected, as a result, break
the whole startup function.
To fix up this issue, as suggested by Thomas, the individual "Os" and
"omit-frame-pointer" optimize flags are used together on _start function
to disable frame pointer completely even if the -O0 is set on the
command line.
[1]: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
[2]: https://lore.kernel.org/lkml/[email protected]/
Suggested-by: Thomas Weißschuh <[email protected]>
Link: https://lore.kernel.org/lkml/[email protected]/
Fixes: 7f8548589661 ("tools/nolibc: make compiler and assembler agree on the section around _start")
Signed-off-by: Zhangjin Wu <[email protected]>
Signed-off-by: Willy Tarreau <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-report')
0 files changed, 0 insertions, 0 deletions