diff options
author | Alexander Lobakin <alobakin@pm.me> | 2021-01-16 15:02:53 +0000 |
---|---|---|
committer | Thomas Bogendoerfer <tsbogend@alpha.franken.de> | 2021-01-18 15:55:29 +0100 |
commit | d9e84fb1a34efd0ca3f68f481a051f26a952e383 (patch) | |
tree | 1c17880945a6c729504e969f6b8f1cc0709e7540 /arch/mips/tools | |
parent | 049a68efbf0bb29d012f2d73b91c674ca2d805fe (diff) |
MIPS: relocatable: optimize the relocation process
For now, vmlinux relocation functions for relocatable kernel are
implemented as an array of handlers of a particular type.
Convert that array into a single switch-case function to:
- remove unused arguments;
- change the return type of simple handlers to void;
- remove the array and don't use any data at all;
- avoid using indirect calls;
- allow the compiler to inline and greatly optimize
the relocation function[s];
and also mark do_relocations() and show_kernel_relocation() static
as they aren't used anywhere else.
The result on MIPS32 R2 with GCC 10.2 -O2 is:
scripts/bloat-o-meter -c arch/mips/kernel/__relocate.o arch/mips/kernel/relocate.o
add/remove: 0/6 grow/shrink: 1/0 up/down: 356/-640 (-284)
Function old new delta
relocate_kernel 852 1208 +356
apply_r_mips_32_rel 20 - -20
apply_r_mips_hi16_rel 40 - -40
apply_r_mips_64_rel 44 - -44
apply_r_mips_26_rel 144 - -144
show_kernel_relocation 164 - -164
do_relocations 228 - -228
Total: Before=1780, After=1496, chg -15.96%
add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-76 (-76)
Data old new delta
reloc_handlers_rel 76 - -76
Total: Before=92, After=16, chg -82.61%
add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
RO Data old new delta
Total: Before=0, After=0, chg +0.00%
All functions were collapsed into the main one, relocate_kernel().
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'arch/mips/tools')
0 files changed, 0 insertions, 0 deletions