arm: use -fomit-frame-pointer
The frame pointer was already omitted in the object files that TinyGo emits, but wasn't yet omitted in the C files it compiles. Omitting the frame pointer is good for code size (and perhaps performance). The frame pointer was originally used for printing stack traces in a debugger. However, advances in DWARF debug info have made it largely unnecessary (debug info contains enough information now to recover the frame pointer even without an explicit frame pointer register). In fact, GDB has been able to produce backtraces in TinyGo compiled code for a while now while it didn't include a frame pointer.
Этот коммит содержится в:
родитель
639ec1e6ee
коммит
dd0fb1dd9a
3 изменённых файлов: 3 добавлений и 1 удалений
|
@ -69,7 +69,7 @@ func (l *Library) Load(target string) (path string, err error) {
|
||||||
// Precalculate the flags to the compiler invocation.
|
// Precalculate the flags to the compiler invocation.
|
||||||
args := append(l.cflags(), "-c", "-Oz", "-g", "-ffunction-sections", "-fdata-sections", "-Wno-macro-redefined", "--target="+target, "-fdebug-prefix-map="+dir+"="+remapDir)
|
args := append(l.cflags(), "-c", "-Oz", "-g", "-ffunction-sections", "-fdata-sections", "-Wno-macro-redefined", "--target="+target, "-fdebug-prefix-map="+dir+"="+remapDir)
|
||||||
if strings.HasPrefix(target, "arm") || strings.HasPrefix(target, "thumb") {
|
if strings.HasPrefix(target, "arm") || strings.HasPrefix(target, "thumb") {
|
||||||
args = append(args, "-fshort-enums")
|
args = append(args, "-fshort-enums", "-fomit-frame-pointer")
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(target, "riscv32-") {
|
if strings.HasPrefix(target, "riscv32-") {
|
||||||
args = append(args, "-march=rv32imac", "-mabi=ilp32", "-fforce-enable-int128")
|
args = append(args, "-march=rv32imac", "-mabi=ilp32", "-fforce-enable-int128")
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
"-mthumb",
|
"-mthumb",
|
||||||
"-Werror",
|
"-Werror",
|
||||||
"-fshort-enums",
|
"-fshort-enums",
|
||||||
|
"-fomit-frame-pointer",
|
||||||
"-fno-exceptions", "-fno-unwind-tables",
|
"-fno-exceptions", "-fno-unwind-tables",
|
||||||
"-ffunction-sections", "-fdata-sections"
|
"-ffunction-sections", "-fdata-sections"
|
||||||
],
|
],
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"-Oz",
|
"-Oz",
|
||||||
"-Werror",
|
"-Werror",
|
||||||
"-fshort-enums",
|
"-fshort-enums",
|
||||||
|
"-fomit-frame-pointer",
|
||||||
"-Qunused-arguments",
|
"-Qunused-arguments",
|
||||||
"-fno-exceptions", "-fno-unwind-tables",
|
"-fno-exceptions", "-fno-unwind-tables",
|
||||||
"-ffunction-sections", "-fdata-sections"
|
"-ffunction-sections", "-fdata-sections"
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче