depmod: add support for symbol namespaces
PATCH 1/1 depmod: add support for symbol namespaces
Linux v5.4 introduces symbol namespaces [1], [2]. They appear in the ksymtab as entries with the scheme
__ksymtab_NAMESPACE.symbol_name
In order to support these at depmod time, strip out namespaces when loading the System.map.
[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/[email protected]/
--- tools/depmod.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
tools/depmod.c +8 -2
@@ -2576,7 +2576,7 @@ static int depmod_load_system_map(struct depmod *depmod, const char *filename)/* eg. c0294200 R __ksymtab_devfs_alloc_devnum */ while (fgets (line,sizeof (line), fp) !=NULL ) { -char *p, *end; +char *p, *end, *delim; linenum++;
@@ -2601,7 +2601,13 @@ static int depmod_load_system_map(struct depmod *depmod, const char *filename)if (end !=NULL ) *end ='\0' ; -depmod_symbol_add (depmod, p + ksymstr_len, true,0 ,NULL ); +/* Support for namespaced symbols: __ksymtab_NAMESPACE.symbol */ + delim =strrchr (p + ksymstr_len,'.' ); +if (delim !=NULL ) +depmod_symbol_add (depmod, delim +1 , true,0 ,NULL ); +else +depmod_symbol_add (depmod, p + ksymstr_len, true,0 ,NULL ); +continue ; invalid_syntax:
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
Quoted 8 lines · Matthias Maennich
Linux v5.4 introduces symbol namespaces [1], [2]. They appear in the ksymtab as entries with the scheme
__ksymtab_NAMESPACE.symbol_name
In order to support these at depmod time, strip out namespaces when loading the System.map.
Quoted 8 lines
[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/[email protected]/Reported-by Stefan Wahren <[email protected]>Cc Lucas De Marchi <[email protected]>Cc Martijn Coenen <[email protected]>Signed-off-by Matthias Maennich <[email protected]>
with the new change merged in the kernel to remove the namespace from the middle, my understanding is that we don't need this right?
Lucas De Marchi
Quoted 35 lines
---
tools/depmod.c| 10 ++++++++--1 file changed, 8 insertions(+), 2 deletions(-)tools/depmod.c +8
-2@@ -2576,7 +2576,7 @@ static int depmod_load_system_map(struct depmod *depmod, const char *filename)/* eg. c0294200 R __ksymtab_devfs_alloc_devnum */ while (fgets (line,sizeof (line), fp) !=NULL ) { -char *p, *end; +char *p, *end, *delim; linenum++;@@ -2601,7 +2601,13 @@ static int depmod_load_system_map(struct depmod *depmod, const char *filename)if (end !=NULL ) *end ='\0' ; -depmod_symbol_add (depmod, p + ksymstr_len, true,0 ,NULL ); +/* Support for namespaced symbols: __ksymtab_NAMESPACE.symbol */ + delim =strrchr (p + ksymstr_len,'.' ); +if (delim !=NULL ) +depmod_symbol_add (depmod, delim +1 , true,0 ,NULL ); +else +depmod_symbol_add (depmod, p + ksymstr_len, true,0 ,NULL ); +continue ; invalid_syntax:Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
Quoted 12 lines · Lucas De Marchi
Quoted 11 lines · Matthias Maennich
Linux v5.4 introduces symbol namespaces [1], [2]. They appear in the ksymtab as entries with the scheme
__ksymtab_NAMESPACE.symbol_name
In order to support these at depmod time, strip out namespaces when loading the System.map.
[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/[email protected]/
Quoted 8 lines
Quoted 5 lines
Reported-by Stefan Wahren <[email protected]>Cc Lucas De Marchi <[email protected]>Cc Martijn Coenen <[email protected]>Signed-off-by Matthias Maennich <[email protected]>with the new change merged in the kernel to remove the namespace from the middle, my understanding is that we don't need this right?
Correct, we should not need this any longer.
Cheers,
Matthias
Quoted 38 lines
Lucas De Marchi
Quoted 35 lines
---
tools/depmod.c| 10 ++++++++--1 file changed, 8 insertions(+), 2 deletions(-)tools/depmod.c +8
-2@@ -2576,7 +2576,7 @@ static int depmod_load_system_map(struct depmod *depmod, const char *filename)/* eg. c0294200 R __ksymtab_devfs_alloc_devnum */ while (fgets (line,sizeof (line), fp) !=NULL ) { -char *p, *end; +char *p, *end, *delim; linenum++;@@ -2601,7 +2601,13 @@ static int depmod_load_system_map(struct depmod *depmod, const char *filename)if (end !=NULL ) *end ='\0' ; -depmod_symbol_add (depmod, p + ksymstr_len, true,0 ,NULL ); +/* Support for namespaced symbols: __ksymtab_NAMESPACE.symbol */ + delim =strrchr (p + ksymstr_len,'.' ); +if (delim !=NULL ) +depmod_symbol_add (depmod, delim +1 , true,0 ,NULL ); +else +depmod_symbol_add (depmod, p + ksymstr_len, true,0 ,NULL ); +continue ; invalid_syntax:Signature · 1 line
2.23.0.581.g78d2f28ef7-goog