> On Jul 29, 2024, at 5:54 PM, Song Liu <song@xxxxxxxxxx> wrote: > > With CONFIG_LTO_CLANG=y, the compiler may add suffix to function names > to avoid duplication. This causes confusion with users of kallsyms. > On one hand, users like livepatch are required to match the symbols > exactly. On the other hand, users like kprobe would like to match to > original function names. > > Solve this by splitting kallsyms APIs. Specifically, existing APIs now > should match the symbols exactly. Add two APIs that matches the full > symbol, or only the part without .llvm.suffix. Specifically, the following > two APIs are added: > > 1. kallsyms_lookup_name_or_prefix() > 2. kallsyms_on_each_match_symbol_or_prefix() > > These APIs will be used by kprobe. > > Also cleanup some code and adjust kallsyms_selftests accordingly. > > Signed-off-by: Song Liu <song@xxxxxxxxxx> Actually, if we only remove .llvm.<hash> suffix, but keep other .XXX suffix, the *_without_suffx APIs will have the same issue Yonghong tried to fix in commit 33f0467fe06934d5e4ea6e24ce2b9c65ce618e26: binary search with symbols - .llvm.<hash> suffix is not correct. (Please see the commit log of 33f0467fe06934d5e4ea6e24ce2b9c65ce618e26 for more details.) I am updating the code to remove all .XXX suffix. This design will not have this issue. Thanks, Song