mirror of https://github.com/ARMmbed/mbed-os.git
GCC: Use 'common' flags at link time
According to GCC man: To use the link-time optimizer, -flto and optimization options should be specified at compile time and during the final link. It is recommended that you compile all the files participating in the same link with the same options and also specify those options at link time. Additionally, move the '-g3' flag out of 'common' flags in the debug profile. Although the '-g' is correctly ignored by the linker, the '-glevel' is not and causes a build error "ld: unrecognized option '-g3'".pull/11856/head
parent
f87a8e0f52
commit
a5240da3b4
|
@ -1,15 +1,15 @@
|
||||||
{
|
{
|
||||||
"GCC_ARM": {
|
"GCC_ARM": {
|
||||||
"common": ["-c", "-Wall", "-Wextra",
|
"common": ["-Wall", "-Wextra",
|
||||||
"-Wno-unused-parameter", "-Wno-missing-field-initializers",
|
"-Wno-unused-parameter", "-Wno-missing-field-initializers",
|
||||||
"-fmessage-length=0", "-fno-exceptions",
|
"-fmessage-length=0", "-fno-exceptions",
|
||||||
"-ffunction-sections", "-fdata-sections", "-funsigned-char",
|
"-ffunction-sections", "-fdata-sections", "-funsigned-char",
|
||||||
"-MMD",
|
"-MMD",
|
||||||
"-fomit-frame-pointer", "-Og", "-g3", "-DMBED_DEBUG",
|
"-fomit-frame-pointer", "-Og", "-DMBED_DEBUG",
|
||||||
"-DMBED_TRAP_ERRORS_ENABLED=1"],
|
"-DMBED_TRAP_ERRORS_ENABLED=1"],
|
||||||
"asm": ["-x", "assembler-with-cpp"],
|
"asm": ["-c", "-g3", "-x", "assembler-with-cpp"],
|
||||||
"c": ["-std=gnu11"],
|
"c": ["-c", "-g3", "-std=gnu11"],
|
||||||
"cxx": ["-std=gnu++14", "-fno-rtti", "-Wvla"],
|
"cxx": ["-c", "-g3", "-std=gnu++14", "-fno-rtti", "-Wvla"],
|
||||||
"ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r",
|
"ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r",
|
||||||
"-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r", "-Wl,--wrap,_memalign_r",
|
"-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r", "-Wl,--wrap,_memalign_r",
|
||||||
"-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit",
|
"-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit",
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
{
|
{
|
||||||
"GCC_ARM": {
|
"GCC_ARM": {
|
||||||
"common": ["-c", "-Wall", "-Wextra",
|
"common": ["-Wall", "-Wextra",
|
||||||
"-Wno-unused-parameter", "-Wno-missing-field-initializers",
|
"-Wno-unused-parameter", "-Wno-missing-field-initializers",
|
||||||
"-fmessage-length=0", "-fno-exceptions",
|
"-fmessage-length=0", "-fno-exceptions",
|
||||||
"-ffunction-sections", "-fdata-sections", "-funsigned-char",
|
"-ffunction-sections", "-fdata-sections", "-funsigned-char",
|
||||||
"-MMD",
|
"-MMD",
|
||||||
"-fomit-frame-pointer", "-Os", "-g", "-DMBED_TRAP_ERRORS_ENABLED=1"],
|
"-fomit-frame-pointer", "-Os", "-g", "-DMBED_TRAP_ERRORS_ENABLED=1"],
|
||||||
"asm": ["-x", "assembler-with-cpp"],
|
"asm": ["-c", "-x", "assembler-with-cpp"],
|
||||||
"c": ["-std=gnu11"],
|
"c": ["-c", "-std=gnu11"],
|
||||||
"cxx": ["-std=gnu++14", "-fno-rtti", "-Wvla"],
|
"cxx": ["-c", "-std=gnu++14", "-fno-rtti", "-Wvla"],
|
||||||
"ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r",
|
"ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r",
|
||||||
"-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r", "-Wl,--wrap,_memalign_r",
|
"-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r", "-Wl,--wrap,_memalign_r",
|
||||||
"-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit",
|
"-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit",
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
{
|
{
|
||||||
"GCC_ARM": {
|
"GCC_ARM": {
|
||||||
"common": ["-c", "-Wall", "-Wextra",
|
"common": ["-Wall", "-Wextra",
|
||||||
"-Wno-unused-parameter", "-Wno-missing-field-initializers",
|
"-Wno-unused-parameter", "-Wno-missing-field-initializers",
|
||||||
"-fmessage-length=0", "-fno-exceptions",
|
"-fmessage-length=0", "-fno-exceptions",
|
||||||
"-ffunction-sections", "-fdata-sections", "-funsigned-char",
|
"-ffunction-sections", "-fdata-sections", "-funsigned-char",
|
||||||
"-MMD",
|
"-MMD",
|
||||||
"-fomit-frame-pointer", "-Os", "-flto", "-DNDEBUG", "-g"],
|
"-fomit-frame-pointer", "-Os", "-flto", "-DNDEBUG", "-g"],
|
||||||
"asm": ["-x", "assembler-with-cpp"],
|
"asm": ["-c", "-x", "assembler-with-cpp"],
|
||||||
"c": ["-std=gnu11"],
|
"c": ["-c", "-std=gnu11"],
|
||||||
"cxx": ["-std=gnu++14", "-fno-rtti", "-Wvla"],
|
"cxx": ["-c", "-std=gnu++14", "-fno-rtti", "-Wvla"],
|
||||||
"ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r",
|
"ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r",
|
||||||
"-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r", "-Wl,--wrap,_memalign_r",
|
"-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r", "-Wl,--wrap,_memalign_r",
|
||||||
"-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit",
|
"-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit",
|
||||||
"-Wl,-n", "-Os", "-flto"]
|
"-Wl,-n"]
|
||||||
},
|
},
|
||||||
"ARMC6": {
|
"ARMC6": {
|
||||||
"common": ["-c", "--target=arm-arm-none-eabi", "-mthumb", "-Oz",
|
"common": ["-c", "--target=arm-arm-none-eabi", "-mthumb", "-Oz",
|
||||||
|
|
|
@ -149,7 +149,8 @@ class GCC(mbedToolchain):
|
||||||
self.cppc += self.flags['cxx'] + self.flags['common']
|
self.cppc += self.flags['cxx'] + self.flags['common']
|
||||||
|
|
||||||
self.flags['ld'] += self.cpu
|
self.flags['ld'] += self.cpu
|
||||||
self.ld = [join(tool_path, "arm-none-eabi-gcc")] + self.flags['ld']
|
self.ld = [join(tool_path, "arm-none-eabi-gcc")]
|
||||||
|
self.ld += self.flags['ld'] + self.flags['common']
|
||||||
self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc", "nosys"]
|
self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc", "nosys"]
|
||||||
self.preproc = [join(tool_path, "arm-none-eabi-cpp"), "-E", "-P"]
|
self.preproc = [join(tool_path, "arm-none-eabi-cpp"), "-E", "-P"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue