Skip to content

Commit 3e3bee4

Browse files
author
Filip Jagodzinski
committed
GCC: Add the -u flag to keep the main() symbol
This fixes the undefined reference to 'main' that arose after adding the "-flto" flag to compilation. This was the case for combined "-Wl,--wrap,main" and "-flto" flags.
1 parent 516153e commit 3e3bee4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tools/profiles/develop.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
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"]
15+
"-Wl,-n", "-u main"]
1616
},
1717
"ARMC6": {
1818
"common": ["-c", "--target=arm-arm-none-eabi", "-mthumb", "-Os",

tools/profiles/release.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
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"]
15+
"-Wl,-n", "-u main"]
1616
},
1717
"ARMC6": {
1818
"common": ["-c", "--target=arm-arm-none-eabi", "-mthumb", "-Oz",

0 commit comments

Comments
 (0)