Re: [PATCH] depmod: add support for symbol namespaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 24, 2019 at 08:02:01AM -0700, Lucas De Marchi wrote:
On Fri, Oct 04, 2019 at 10:41:36AM +0100, Matthias Maennich wrote:
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/20190906103235.197072-1-maennich@xxxxxxxxxx/
[2] https://lore.kernel.org/lkml/20191003075826.7478-1-yamada.masahiro@xxxxxxxxxxxxx/

Reported-by: Stefan Wahren <stefan.wahren@xxxxxxxx>
Cc: Lucas De Marchi <lucas.de.marchi@xxxxxxxxx>
Cc: Martijn Coenen <maco@xxxxxxxxxxx>
Cc: linux-modules@xxxxxxxxxxxxxxx
Signed-off-by: Matthias Maennich <maennich@xxxxxxxxxx>

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


Lucas De Marchi

---
tools/depmod.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/depmod.c b/tools/depmod.c
index 391afe9fe0a0..723f4c7be88c 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -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:
--
2.23.0.581.g78d2f28ef7-goog




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux