Skip to contentSkip to conversation

linux/export: fix reference to exported functions for parisc64

PATCH In review Helge Deller 2 participants 2 messages Sep 14, 2023 – Sep 16, 2023 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux/export: fix reference to exported functions for parisc64

Hi Greg,

could you please cherry-pick this upstream commit:

08700ec70504 ("linux/export: fix reference to exported functions for parisc64")

to the v6.5 stable kernel series?

Thanks!
Helge

---

From 08700ec705043eb0cee01b35cf5b9d63f0230d12 Mon Sep 17 00:00:00 2001
From: Masahiro Yamada <[email protected]>
Date: Wed, 6 Sep 2023 03:46:57 +0900
Subject: [PATCH] linux/export: fix reference to exported functions for
parisc64

John David Anglin reported parisc has been broken since commit ddb5cdbafaaa ("kbuild: generate KSYMTAB entries by modpost").

Like ia64, parisc64 uses a function descriptor. The function references must be prefixed with P%.

Also, symbols prefixed $$ from the library have the symbol type STT_LOPROC instead of STT_FUNC. They should be handled as functions too.

include/linux/export-internal.h +2 -0
index 1c849db953a5..45fca09b2319 100644
@@ -52,6 +52,8 @@
 
 #ifdef CONFIG_IA64
 #define KSYM_FUNC(name)		@fptr(name)
+#elif defined(CONFIG_PARISC) && defined(CONFIG_64BIT)
+#define KSYM_FUNC(name)		P%name
 #else
 #define KSYM_FUNC(name)		name
 #endif
scripts/mod/modpost.c +9 -0
index b29b29707f10..ba981f22908a 100644
@@ -1226,6 +1226,15 @@ static void check_export_symbol(struct module *mod, struct elf_info *elf,
 	 */
 	s->is_func = (ELF_ST_TYPE(sym->st_info) == STT_FUNC);
 
+	/*
+	 * For parisc64, symbols prefixed $$ from the library have the symbol type
+	 * STT_LOPROC. They should be handled as functions too.
+	 */
+	if (elf->hdr->e_ident[EI_CLASS] == ELFCLASS64 &&
+	    elf->hdr->e_machine == EM_PARISC &&
+	    ELF_ST_TYPE(sym->st_info) == STT_LOPROC)
+		s->is_func = true;
+
 	if (match(secname, PATTERNS(INIT_SECTIONS)))
 		warn("%s: %s: EXPORT_SYMBOL used for init symbol. Remove __init or EXPORT_SYMBOL.\n",
 		     mod->name, name);
#1 lore raw
Quoted 7 lines · Helge Deller

Hi Greg,

could you please cherry-pick this upstream commit:

08700ec70504 ("linux/export: fix reference to exported functions for parisc64")

to the v6.5 stable kernel series?

Now queued up, thanks.

greg k-h