Add support for LTO in klp-build toolchain. The key changes are to the
symbol correlation logic.Basically, we want to:
1. Match symbols with differerent .llvm.<hash> suffixes, e.g., foo.llvm.123
to foo.llvm.456.
2. Match local symbols with promoted global symbols, e.g., local foo
with global foo.llvm.123.
1/8 and 2/8 are small cleanup/fix for existing code.
3/8 through 7/8 contains the core logic changes to correlate_symbols().
8/8 contains tests for klp-build toolchain.
Changes v1 => v2:
1. Error out on ambiguous .llvm.<hash>
Song Liu (8):
objtool/klp: Remove redundent strcmp in correlate_symbols
objtool/klp: Remove trailing '_' in demangle_name()
objtool/klp: Use sym->demangled_name for symbol_name hash
objtool/klp: Also demangle global objects
objtool/klp: Remove .llvm suffix in demangle_name()
objtool/klp: Match symbols based on demangled_name for global
variables
objtool/klp: Correlate locals to globals
livepatch: Add tests for klp-build toolchain
kernel/livepatch/Kconfig | 20 +++
kernel/livepatch/Makefile | 2 +
kernel/livepatch/tests/Makefile | 6 +
kernel/livepatch/tests/klp_test_module.c | 111 ++++++++++++++
kernel/livepatch/tests/klp_test_module.h | 8 +
kernel/livepatch/tests/klp_test_vmlinux.c | 138 ++++++++++++++++++
kernel/livepatch/tests/klp_test_vmlinux.h | 16 ++
kernel/livepatch/tests/klp_test_vmlinux_aux.c | 59 ++++++++
tools/objtool/elf.c | 95 +++++++++---
tools/objtool/include/objtool/elf.h | 3 +
tools/objtool/klp-diff.c | 92 +++++++++++-
.../selftests/livepatch/test_patches/README | 15 ++
.../test_patches/klp_test_hash_change.patch | 30 ++++
.../test_patches/klp_test_module.patch | 18 +++
.../klp_test_nonstatic_to_static.patch | 40 +++++
.../klp_test_static_to_nonstatic.patch | 39 +++++
.../test_patches/klp_test_vmlinux.patch | 18 +++
17 files changed, 688 insertions(+), 22 deletions(-)
create mode 100644 kernel/livepatch/tests/Makefile
create mode 100644 kernel/livepatch/tests/klp_test_module.c
create mode 100644 kernel/livepatch/tests/klp_test_module.h
create mode 100644 kernel/livepatch/tests/klp_test_vmlinux.c
create mode 100644 kernel/livepatch/tests/klp_test_vmlinux.h
create mode 100644 kernel/livepatch/tests/klp_test_vmlinux_aux.c
create mode 100644 tools/testing/selftests/livepatch/test_patches/README
create mode 100644
tools/testing/selftests/livepatch/test_patches/klp_test_hash_change.patch
create mode 100644
tools/testing/selftests/livepatch/test_patches/klp_test_module.patch
create mode 100644
tools/testing/selftests/livepatch/test_patches/klp_test_nonstatic_to_static.patch
create mode 100644
tools/testing/selftests/livepatch/test_patches/klp_test_static_to_nonstatic.patch
create mode 100644
tools/testing/selftests/livepatch/test_patches/klp_test_vmlinux.patch
--
2.47.3