Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
makefile: enable garbage collection of code and data when hiding symbols
This patch changes the main makefile to enable garbage collection of code and data when linking kernel with most symbols hidden. In essence it makes all object files compile with '-ffunction-sections -fdata-sections' flags only when conf_hide_symbols is ON. This allows linker to eliminate code and data (with --gc-sections) that is not really used between various compilation units. As the result it allows us to produce even smaller kernel ELF at around 4.3M, down from 5.1M when we would hide symbols only. In order to see what exact code and data gets eliminated, one can pass --print-gc-sections flags to the linker like so: ./scripts/build image=native-example fs=rofs conf_hide_symbols=1 conf_linker_extra_options=--print-gc-sections In addition this patch also changes the makefile to make linker use version script generated by ./scripts/generate_version_script.sh which is obnly enabled when conf_hide_symbols is ON. Using version script (--version-script) plays some role in futher reducing number of symbols down to what exactly we want to export in exported/<arch>/*symbols. Signed-off-by: Waldemar Kozaczuk <jwkozaczuk@gmail.com>
- Loading branch information