From ededa875d6d1b5947e4516588489b1c8c64e940f Mon Sep 17 00:00:00 2001 From: Timerix22 Date: Fri, 19 May 2023 19:44:39 +0600 Subject: [PATCH] unused code removal during linkage --- cbuild | 2 +- default.config | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cbuild b/cbuild index e8e4242..991ee07 160000 --- a/cbuild +++ b/cbuild @@ -1 +1 @@ -Subproject commit e8e42424d329ef1e75fb827ddf85d55b4cd89169 +Subproject commit 991ee072b3b0e4507c80dfac873c7d41d06f0b69 diff --git a/default.config b/default.config index 241c3ca..8116b7a 100644 --- a/default.config +++ b/default.config @@ -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