Skip to content

Commit 9eb3d2e

Browse files
committed
Fix LTO implementation
1 parent c99b1df commit 9eb3d2e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/build-runtime.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,18 @@ else()
2121
get_target_property(squashfuse_INCLUDE_DIRS libsquashfuse INTERFACE_INCLUDE_DIRECTORIES)
2222
endif()
2323

24+
# must not include -flto in the following flags, otherwise the data sections will be stripped out
2425
set(runtime_cflags
25-
-std=c99 -ffunction-sections -fdata-sections -flto
26+
-std=c99 -ffunction-sections -fdata-sections
2627
-DGIT_COMMIT=\\"${GIT_COMMIT}\\"
2728
-I${squashfuse_INCLUDE_DIRS}
2829
-I${PROJECT_SOURCE_DIR}/include
2930
-I${PROJECT_SOURCE_DIR}/lib/libappimage/include
3031
-I${PROJECT_SOURCE_DIR}/lib/libappimage/src/libappimage_hashlib/include
3132
${DEPENDENCIES_CFLAGS}
3233
)
33-
set(runtime_ldflags -s -Wl,--gc-sections -flto ${DEPENDENCIES_LDFLAGS})
34+
# must not include -Wl,--gc-sections in the following flags, otherwise the data sections will be stripped out
35+
set(runtime_ldflags -s -ffunction-sections -fdata-sections -flto ${DEPENDENCIES_LDFLAGS})
3436

3537
if(BUILD_DEBUG)
3638
message(WARNING "Debug build, adding debug information")

0 commit comments

Comments
 (0)