diff options
author | Emese Revfy <re.emese@gmail.com> | 2016-07-26 22:40:37 +0200 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2017-02-06 13:10:56 -0800 |
commit | b5ccf71ef7402d48e1e4e1b345158271dbcf1456 (patch) | |
tree | 84907fc23c498b567892fa1112ef110b6a3be955 /.gitignore | |
parent | e9569a422c271d2448055015e683319079023335 (diff) |
gcc-plugins: Add the initify gcc plugin
The kernel already has a mechanism to free up code and data memory that
is only used during kernel or module initialization. This plugin will
teach the compiler to find more such code and data that can be freed
after initialization.
The plugin runs in two passes. The first one tries to find all functions
that can be become __init/__exit. The second one moves string constants
(local variables and function string arguments marked by the nocapture
attribute) only referenced in __init/__exit functions to the
__initconst/__exitconst sections.
The result is a reduction in memory usage, since more code is moved into
__init and freed during boot. This plugin can be useful for embedded
systems.
If a function is called by __init and __exit functions as well then
the plugin moves it to the __exit section. This causes false positive
section mismatch errors/warnings that I don't know how to handle yet.
The instrumentation pass of the latent_entropy plugin must run after
the initify plugin to increase coverage (initify will move functions
into init, where latent_entropy will instrument them).
Example build against v4.10-rc2:
defconfig (x86_64, gcc 5.4.0)
* 2171 initified strings
* 17 initified functions
section size (before) size (with initify) change
---------- ------------- ------------------- ------
.rodata 3362592 3333920 -28672
.init.data 577208 661432 +84224
.exit.data 0 672 +672
.text 10633407 10629247 -4160
.init.text 444371 446839 +2468
.exit.text 8427 8427 0
header FileSiz (before) FileSiz (with initify) change
------ ---------------- ---------------------- ------
00 16347136 16318464 -28672
03 1118208 1204224 +86016
00 .text .notes __ex_table .rodata __bug_table .pci_fixup .builtin_fw
.tracedata __ksymtab __ksymtab_gpl __ksymtab_strings __param __modver
03 .init.text .altinstr_aux .init.data .x86_cpu_dev.init .altinstructions
.altinstr_replacement .iommu_table .apicdrivers .exit.text .exit.data
.smp_locks .data_nosave .bss .brk
Signed-off-by: Emese Revfy <re.emese@gmail.com>
[kees: expanded commit message]
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions