Skip to content

Commit b03f974

Browse files
author
Filip Jagodzinski
committed
GCC: Move link-time optimizer flags to extensions dir
Disable the lto for the default develop and release prifiles and move the flags to tools/profiles/extensions/lto.json profile. Usage: mbed compile --profile release --profile tools/profiles/extensions/lto.json
1 parent 3e3bee4 commit b03f974

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

tools/profiles/develop.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
"-fmessage-length=0", "-fno-exceptions",
66
"-ffunction-sections", "-fdata-sections", "-funsigned-char",
77
"-MMD",
8-
"-fomit-frame-pointer", "-Os", "-flto", "-g", "-DMBED_TRAP_ERRORS_ENABLED=1"],
8+
"-fomit-frame-pointer", "-Os", "-g", "-DMBED_TRAP_ERRORS_ENABLED=1"],
99
"asm": ["-c", "-x", "assembler-with-cpp"],
1010
"c": ["-c", "-std=gnu11"],
1111
"cxx": ["-c", "-std=gnu++14", "-fno-rtti", "-Wvla"],
1212
"ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r",
1313
"-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r", "-Wl,--wrap,_memalign_r",
1414
"-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit",
15-
"-Wl,-n", "-u main"]
15+
"-Wl,-n"]
1616
},
1717
"ARMC6": {
1818
"common": ["-c", "--target=arm-arm-none-eabi", "-mthumb", "-Os",

tools/profiles/extensions/lto.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
"ARMC6": {
33
"common": ["-flto"],
44
"ld": ["--lto", "--lto_level=Oz"]
5+
},
6+
"GCC_ARM": {
7+
"common": ["-flto"],
8+
"ld": ["-u main"]
59
}
610
}

tools/profiles/release.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
"-fmessage-length=0", "-fno-exceptions",
66
"-ffunction-sections", "-fdata-sections", "-funsigned-char",
77
"-MMD",
8-
"-fomit-frame-pointer", "-Os", "-flto", "-DNDEBUG", "-g"],
8+
"-fomit-frame-pointer", "-Os", "-DNDEBUG", "-g"],
99
"asm": ["-c", "-x", "assembler-with-cpp"],
1010
"c": ["-c", "-std=gnu11"],
1111
"cxx": ["-c", "-std=gnu++14", "-fno-rtti", "-Wvla"],
1212
"ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r",
1313
"-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r", "-Wl,--wrap,_memalign_r",
1414
"-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit",
15-
"-Wl,-n", "-u main"]
15+
"-Wl,-n"]
1616
},
1717
"ARMC6": {
1818
"common": ["-c", "--target=arm-arm-none-eabi", "-mthumb", "-Oz",

0 commit comments

Comments
 (0)