s390/decompressor: add symbols support
authorVasily Gorbik <gor@linux.ibm.com>
Wed, 11 Nov 2020 09:59:40 +0000 (10:59 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Fri, 20 Nov 2020 18:19:11 +0000 (19:19 +0100)
commit246218962e2175cd1dfa1e5467e9bffae5cc7b5e
tree537361b78c16c2f828237416477db73c61c67551
parentec55d1e1dbea990145644bd6838c061e8113cc4d
s390/decompressor: add symbols support

Information printed by print_pgm_check_info() is crucial for
debugging decompressor problems. Printing instruction addresses is
better than nothing, but turns further debugging into tedious job of
figuring out which function those addresses correspond to.

This change adds simplistic symbols resolution support. And adds %pS
format specifier support to decompressor_printk().

Decompressor symbols list is extracted and sorted with
nm -n -S:
...
0000000000010000 0000000000000014 T startup
0000000000010014 00000000000000b0 t startup_normal
0000000000010180 00000000000000b2 t startup_kdump
...

Then functions are filtered and contracted to a form:
"10000 14 startup\0""10014 b0 startup_normal\0""10180 b2 startup_kdump\0"
...
Which makes it trivial to find beginning of an entry and names are 0
terminated, so could be used as is. Symbols are binary-searched.

To get symbols list with final addresses and then get it into the
decompressor's image the same trick as for kallsyms is used.
Decompressor's vmlinux is linked twice.

Symbols are stored in .decompressor.syms section, current size is about
2kb.

Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/boot/compressed/.gitignore
arch/s390/boot/compressed/Makefile
arch/s390/boot/compressed/vmlinux.lds.S
arch/s390/boot/pgm_check_info.c