Skip to content

Commit 08700ec

Browse files
masahir0yhdeller
authored andcommitted
linux/export: fix reference to exported functions for parisc64
John David Anglin reported parisc has been broken since commit ddb5cdb ("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. Fixes: ddb5cdb ("kbuild: generate KSYMTAB entries by modpost") Reported-by: John David Anglin <dave.anglin@bell.net> Tested-by: John David Anglin <dave.anglin@bell.net> Tested-by: Helge Deller <deller@gmx.de> Closes: https://lore.kernel.org/linux-parisc/1901598a-e11d-f7dd-a5d9-9a69d06e6b6e@bell.net/T/#u Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent e5ef93d commit 08700ec

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

include/linux/export-internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252

5353
#ifdef CONFIG_IA64
5454
#define KSYM_FUNC(name) @fptr(name)
55+
#elif defined(CONFIG_PARISC) && defined(CONFIG_64BIT)
56+
#define KSYM_FUNC(name) P%name
5557
#else
5658
#define KSYM_FUNC(name) name
5759
#endif

scripts/mod/modpost.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,15 @@ static void check_export_symbol(struct module *mod, struct elf_info *elf,
12261226
*/
12271227
s->is_func = (ELF_ST_TYPE(sym->st_info) == STT_FUNC);
12281228

1229+
/*
1230+
* For parisc64, symbols prefixed $$ from the library have the symbol type
1231+
* STT_LOPROC. They should be handled as functions too.
1232+
*/
1233+
if (elf->hdr->e_ident[EI_CLASS] == ELFCLASS64 &&
1234+
elf->hdr->e_machine == EM_PARISC &&
1235+
ELF_ST_TYPE(sym->st_info) == STT_LOPROC)
1236+
s->is_func = true;
1237+
12291238
if (match(secname, PATTERNS(INIT_SECTIONS)))
12301239
warn("%s: %s: EXPORT_SYMBOL used for init symbol. Remove __init or EXPORT_SYMBOL.\n",
12311240
mod->name, name);

0 commit comments

Comments
 (0)