build: Set -mrelax to remove trampolines while linking

Avr GCC automatically marks all indirect calls for trampoline generation
irregardless of the target.

This can be avoided by forcing -mshort-calls or using -mrelax that
removes the trampoline at link time (after the call location has been
proven to be reachable).

This saves 510 bytes on the current build (the trampolines section is
now empty as expected).
pull/220/head
Yuri D'Elia 2022-10-16 14:35:34 +02:00
parent 08230b9d7a
commit 4ff990d130
1 changed files with 1 additions and 1 deletions

View File

@ -106,7 +106,7 @@ if(CMAKE_CROSSCOMPILING)
set(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) set(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
# mcu related settings # mcu related settings
set(MCU_FLAGS -mmcu=atmega32u4 -DF_CPU=16000000L) set(MCU_FLAGS -mmcu=atmega32u4 -DF_CPU=16000000L -mrelax)
add_compile_options(${MCU_FLAGS}) add_compile_options(${MCU_FLAGS})
add_link_options(${MCU_FLAGS}) add_link_options(${MCU_FLAGS})