mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
b8a94bfb33
Rust symbols can become quite long due to namespacing introduced by modules, types, traits, generics, etc. For instance, the following code: pub mod my_module { pub struct MyType; pub struct MyGenericType<T>(T); pub trait MyTrait { fn my_method() -> u32; } impl MyTrait for MyGenericType<MyType> { fn my_method() -> u32 { 42 } } } generates a symbol of length 96 when using the upcoming v0 mangling scheme: _RNvXNtCshGpAVYOtgW1_7example9my_moduleINtB2_13MyGenericTypeNtB2_6MyTypeENtB2_7MyTrait9my_method At the moment, Rust symbols may reach up to 300 in length. Setting 512 as the maximum seems like a reasonable choice to keep some headroom. Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Petr Mladek <pmladek@suse.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Co-developed-by: Alex Gaynor <alex.gaynor@gmail.com> Signed-off-by: Alex Gaynor <alex.gaynor@gmail.com> Co-developed-by: Wedson Almeida Filho <wedsonaf@google.com> Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com> Co-developed-by: Gary Guo <gary@garyguo.net> Signed-off-by: Gary Guo <gary@garyguo.net> Co-developed-by: Boqun Feng <boqun.feng@gmail.com> Signed-off-by: Boqun Feng <boqun.feng@gmail.com> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
30 lines
618 B
C
30 lines
618 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __TOOLS_KALLSYMS_H_
|
|
#define __TOOLS_KALLSYMS_H_ 1
|
|
|
|
#include <elf.h>
|
|
#include <linux/ctype.h>
|
|
#include <linux/types.h>
|
|
|
|
#ifndef KSYM_NAME_LEN
|
|
#define KSYM_NAME_LEN 512
|
|
#endif
|
|
|
|
static inline u8 kallsyms2elf_binding(char type)
|
|
{
|
|
if (type == 'W')
|
|
return STB_WEAK;
|
|
|
|
return isupper(type) ? STB_GLOBAL : STB_LOCAL;
|
|
}
|
|
|
|
u8 kallsyms2elf_type(char type);
|
|
|
|
bool kallsyms__is_function(char symbol_type);
|
|
|
|
int kallsyms__parse(const char *filename, void *arg,
|
|
int (*process_symbol)(void *arg, const char *name,
|
|
char type, u64 start));
|
|
|
|
#endif /* __TOOLS_KALLSYMS_H_ */
|