unused code removal during linkage

This commit is contained in:
Timerix22 2023-05-19 19:44:39 +06:00
parent f4e666640e
commit ededa875d6
2 changed files with 5 additions and 3 deletions

2
cbuild

@ -1 +1 @@
Subproject commit e8e42424d329ef1e75fb827ddf85d55b4cd89169
Subproject commit 991ee072b3b0e4507c80dfac873c7d41d06f0b69

View File

@ -46,7 +46,9 @@ case "$TASK" in
# -fuse-linker-plugin is required to use static libs with lto
# -fprofile-use enables compiler to use profiling info files to optimize executable
# -fprofile-prefix-path sets path where profiling info about objects are be saved
C_ARGS="-O2 -flto=auto -fuse-linker-plugin -fprofile-use -fprofile-prefix-path=$(realpath $OBJDIR)/objects"
# -fdata-sections -ffunction-sections -Wl,--gc-sections removes unused code
C_ARGS="-O2 -flto=auto -fuse-linker-plugin -fprofile-use -fprofile-prefix-path=$(realpath $OBJDIR)/objects \
-fdata-sections -ffunction-sections -Wl,--gc-sections"
CPP_ARGS="$C_ARGS"
LINKER_ARGS="$CPP_ARGS"
PRE_TASK_SCRIPT=
@ -82,7 +84,7 @@ case "$TASK" in
;;
# creates static library
build_static_lib)
C_ARGS="-O2 -fpic"
C_ARGS="-O2 -fpic -fdata-sections -ffunction-sections"
CPP_ARGS="$C_ARGS"
PRE_TASK_SCRIPT=
TASK_SCRIPT=cbuild/default_tasks/build_static_lib.sh