File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,10 @@ option(LIBCXX_ENABLE_WIDE_CHARACTERS
102102 support the C functionality for wide characters. When wide characters are
103103 not supported, several parts of the library will be disabled, notably the
104104 wide character specializations of std::basic_string." ON )
105+ option (LIBCXX_ENABLE_FATLTO
106+ "Whether to compile libc++ with FatLTO enabled." ON )
107+ option (LIBCXX_ENABLE_LTO
108+ "Whether to compile libc++ with LTO enabled." ON )
105109
106110# To use time zone support in libc++ the platform needs to have the IANA
107111# database installed. Libc++ will fail to build if this is enabled on a
Original file line number Diff line number Diff line change @@ -173,6 +173,16 @@ if (APPLE AND LLVM_USE_SANITIZER)
173173 endif ()
174174endif ()
175175
176+
177+ if (LIBCXX_ENABLE_LTO)
178+ list (APPEND LIBCXX_COMPILE_FLAGS "-flto" )
179+ list (APPEND LIBCXX_LINK_FLAGS "-flto" )
180+ endif ()
181+ if (LIBCXX_ENABLE_FATLTO)
182+ list (APPEND LIBCXX_COMPILE_FLAGS "-ffat-lto-objects" )
183+ list (APPEND LIBCXX_LINK_FLAGS "-ffat-lto-objects" )
184+ endif ()
185+
176186split_list(LIBCXX_COMPILE_FLAGS)
177187split_list(LIBCXX_LINK_FLAGS)
178188
Original file line number Diff line number Diff line change @@ -143,6 +143,15 @@ if ( APPLE )
143143 endif ()
144144endif ()
145145
146+ if (LIBCXX_ENABLE_LTO)
147+ list (APPEND LIBCXXABI_COMPILE_FLAGS "-flto" )
148+ list (APPEND LIBCXXABI_LINK_FLAGS "-flto" )
149+ endif ()
150+ if (LIBCXX_ENABLE_FATLTO)
151+ list (APPEND LIBCXXABI_COMPILE_FLAGS "-ffat-lto-objects" )
152+ list (APPEND LIBCXXABI_LINK_FLAGS "-ffat-lto-objects" )
153+ endif ()
154+
146155split_list(LIBCXXABI_COMPILE_FLAGS)
147156split_list(LIBCXXABI_LINK_FLAGS)
148157
@@ -154,6 +163,7 @@ endif()
154163
155164include (WarningFlags)
156165
166+
157167# Build the shared library.
158168add_library (cxxabi_shared_objects OBJECT EXCLUDE_FROM_ALL ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS} )
159169cxx_add_warning_flags(cxxabi_shared_objects ${LIBCXXABI_ENABLE_WERROR} ${LIBCXXABI_ENABLE_PEDANTIC} )
You can’t perform that action at this time.
0 commit comments