Skip to content

Commit

Permalink
Better handle LTO_ENABLE (qmk#9832)
Browse files Browse the repository at this point in the history
* Better handle LTO_ENABLE

Especially when calling from command line

* Replace LINK_TIME_OPTIMIZATION_ENABLE with LTO_ENABLE

* Remove long for LTO from show_options.mk
  • Loading branch information
drashna committed Sep 30, 2020
1 parent 2d4e228 commit f454a7b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
3 changes: 1 addition & 2 deletions show_options.mk
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ OTHER_OPTION_NAMES = \
RGB_MATRIX_KEYPRESSES \
LED_MIRRORED \
RGBLIGHT_FULL_POWER \
Link_Time_Optimization \
LINK_TIME_OPTIMIZATION_ENABLE
LTO_ENABLE

define NAME_ECHO
@echo " $1 = $($1) # $(origin $1)"
Expand Down
9 changes: 3 additions & 6 deletions tmk_core/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,13 @@ ifeq ($(strip $(SHARED_EP_ENABLE)), yes)
endif

ifeq ($(strip $(LTO_ENABLE)), yes)
LINK_TIME_OPTIMIZATION_ENABLE = yes
endif

ifeq ($(strip $(LINK_TIME_OPTIMIZATION_ENABLE)), yes)
ifeq ($(PLATFORM),CHIBIOS)
$(info Enabling LTO on ChibiOS-targeting boards is known to have a high likelihood of failure.)
$(info If unsure, set LINK_TIME_OPTIMIZATION_ENABLE = no.)
$(info If unsure, set LTO_ENABLE = no.)
endif
EXTRAFLAGS += -flto
TMK_COMMON_DEFS += -DLINK_TIME_OPTIMIZATION_ENABLE
TMK_COMMON_DEFS += -DLTO_ENABLE
TMK_COMMON_DEFS += -DLINK_TIME_OPTIMIZATON_ENABLE
endif

# Search Path
Expand Down
2 changes: 1 addition & 1 deletion tmk_core/common/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extern "C" {
#endif

/* Disable macro and function features when LTO is enabled, since they break */
#ifdef LINK_TIME_OPTIMIZATION_ENABLE
#ifdef LTO_ENABLE
# ifndef NO_ACTION_MACRO
# define NO_ACTION_MACRO
# endif
Expand Down
2 changes: 1 addition & 1 deletion tmk_core/common/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ static void print_version(void) {
#ifdef NKRO_ENABLE
" NKRO"
#endif
#ifdef LINK_TIME_OPTIMIZATION_ENABLE
#ifdef LTO_ENABLE
" LTO"
#endif

Expand Down

0 comments on commit f454a7b

Please sign in to comment.