Skip to content

Commit

Permalink
Cmake: Reslove LTO linker issue (#384)
Browse files Browse the repository at this point in the history
* Allow release builds with CMake

* Reslove lto object issue using slim objects. Props @recursinging
  • Loading branch information
brbrr authored Jul 21, 2021
1 parent 6946b37 commit f62f85e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmake/toolchains/stm32h750xx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ set(CMAKE_C_FLAGS "${OBJECT_GEN_FLAGS} -std=gnu99 " CACHE INTERNAL "C Compiler
set(CMAKE_CXX_FLAGS "${OBJECT_GEN_FLAGS} -Wno-register" CACHE INTERNAL "C++ Compiler options")
set(CMAKE_ASM_FLAGS "${OBJECT_GEN_FLAGS} -x assembler-with-cpp " CACHE INTERNAL "ASM Compiler options")

# Ensure the ar plugin is loaded (needed for LTO)
set(CMAKE_AR ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-gcc-ar)
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH true)
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_FINISH true)

add_compile_definitions(
CORE_CM7
STM32H750xx
Expand Down

0 comments on commit f62f85e

Please sign in to comment.