Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] Ignore unresolved weak symbols in module.
@ 2006-05-22 15:45 Atsushi Nemoto
  2006-05-22 18:05 ` Ralf Baechle
  0 siblings, 1 reply; 2+ messages in thread
From: Atsushi Nemoto @ 2006-05-22 15:45 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf

On Fri, 21 Apr 2006 23:33:35 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> > > The problem is if you try to load oprofile as a module.  The kernel 
> > > module linker evidentially does not understand weak symbols and refuses 
> > > to load the module because they are undefined.
> > 
> > Actually it contains code to handle weak symbols so this is a bit
> > surprising not last because STB_WEAK handling happen in the generic
> > module loader code and is being used by other architectures as well.
> 
> This is still unresolved.  The "oprofile: Unknown symbol" message is
> printed in arch/mips/kernel/module.c file.  How about this patch?

ping.


[PATCH] Ignore unresolved weak symbols in module.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c
index e54a7f4..d7bf021 100644
--- a/arch/mips/kernel/module.c
+++ b/arch/mips/kernel/module.c
@@ -288,6 +288,9 @@ int apply_relocate(Elf_Shdr *sechdrs, co
 		sym = (Elf_Sym *)sechdrs[symindex].sh_addr
 			+ ELF_MIPS_R_SYM(rel[i]);
 		if (!sym->st_value) {
+			/* Ignore unresolved weak symbol */
+			if (ELF_ST_BIND(sym->st_info) == STB_WEAK)
+				continue;
 			printk(KERN_WARNING "%s: Unknown symbol %s\n",
 			       me->name, strtab + sym->st_name);
 			return -ENOENT;
@@ -325,6 +328,9 @@ int apply_relocate_add(Elf_Shdr *sechdrs
 		sym = (Elf_Sym *)sechdrs[symindex].sh_addr
 			+ ELF_MIPS_R_SYM(rel[i]);
 		if (!sym->st_value) {
+			/* Ignore unresolved weak symbol */
+			if (ELF_ST_BIND(sym->st_info) == STB_WEAK)
+				continue;
 			printk(KERN_WARNING "%s: Unknown symbol %s\n",
 			       me->name, strtab + sym->st_name);
 			return -ENOENT;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Ignore unresolved weak symbols in module.
  2006-05-22 15:45 [PATCH] Ignore unresolved weak symbols in module Atsushi Nemoto
@ 2006-05-22 18:05 ` Ralf Baechle
  0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2006-05-22 18:05 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

Applied,

  Ralf

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-05-22 18:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-22 15:45 [PATCH] Ignore unresolved weak symbols in module Atsushi Nemoto
2006-05-22 18:05 ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox