Skip to content

Commit ab0ee50

Browse files
committed
vxOpenLibm - v1.0.1-rc0 : enable LTO support
*fix* > [patches] | [cmake] force use SH4A-NOFPU target | [cmake] force LTO as default | [cmake] use `sh-elf-vhex-gcc-ar` instead of `sh-elf-vhex-ar` to magically support LTO plugins
1 parent 34d505f commit ab0ee50

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

patches/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,24 @@ add_compile_options(
202202
-Wno-implicit-function-declaration
203203
-Wall
204204
-Wextra
205+
-Os
205206
-fPIC
206207
-ffreestanding
208+
-flto
207209
-nostdlib
208-
-m3
209210
-mb
211+
-m4-nofpu
210212
-std=c99
211213
-fno-gnu89-inline
212214
-fno-builtin
213-
-O3
214215
)
216+
217+
# Generate the archive with gcc-ar instead of ar as it will load the LTO
218+
# plugin which is required to generate a usable archive.
219+
set(CMAKE_C_ARCHIVE_CREATE "${CMAKE_C_COMPILER_AR} qcs <TARGET> <OBJECTS>")
220+
# Also the ranlib rule (useless because ar is passed the s flag anyway)
221+
set(CMAKE_C_ARCHIVE_FINISH "${CMAKE_C_COMPILER_RANLIB} <TARGET>")
222+
215223
add_library(openlibm ${VXOPENLIBM_SOURCES})
216224

217225
## install configuration

0 commit comments

Comments
 (0)