History

kallsyms: increase maximum kernel symbol length to 512

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.

Miguel Ojeda committed 5 years ago

Commit b8a94bf1 parent 73bbb946 files · +8 −8Browse files

Showing the changes to scripts (1 of 6 files). Show all

Unified · Split

scripts/kallsyms.c+2−2
@@ -30,7 +30,7 @@ · 29 unmodified lines
3030 #define _stringify_1(x) #x
3131 #define _stringify(x) _stringify_1(x)
3232
33−#define KSYM_NAME_LEN 128
33+#define KSYM_NAME_LEN 512
3434
3535 /*
3636 * A substantially bigger size than the current maximum.
@@ -39,7 +39,7 @@ · 2 unmodified lines
3939 * for the fscanf() format string. Therefore, a _Static_assert() is
4040 * used instead to maintain the relationship with KSYM_NAME_LEN.
4141 */
42−#define KSYM_NAME_LEN_BUFFER 512
42+#define KSYM_NAME_LEN_BUFFER 2048
4343 _Static_assert(
4444 KSYM_NAME_LEN_BUFFER == KSYM_NAME_LEN * 4,
4545 "Please keep KSYM_NAME_LEN_BUFFER in sync with KSYM_NAME_LEN"

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t