All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] H8/300 module fix
Date: Sun, 23 May 2004 21:40:31 +0900	[thread overview]
Message-ID: <m2y8njs4e8.wl%ysato@users.sourceforge.jp> (raw)

- fix relocation
- define SYMBOL_PREFIX

-- 
Yoshinori Sato
<ysato@users.sourceforge.jp>

diff -ur linux-2.6.6-bk9/arch/h8300/kernel/h8300_ksyms.c linux-2.6.6-h8300/arch/h8300/kernel/h8300_ksyms.c
--- linux-2.6.6-bk9/arch/h8300/kernel/h8300_ksyms.c	2004-05-23 21:11:56.000000000 +0900
+++ linux-2.6.6-h8300/arch/h8300/kernel/h8300_ksyms.c	2004-05-23 21:01:50.000000000 +0900
@@ -40,6 +40,8 @@
 EXPORT_SYMBOL(ip_fast_csum);
 
 EXPORT_SYMBOL(kernel_thread);
+EXPORT_SYMBOL(enable_irq);
+EXPORT_SYMBOL(disable_irq);
 
 /* Networking helper routines. */
 EXPORT_SYMBOL(csum_partial_copy);
diff -ur linux-2.6.6-bk9/arch/h8300/kernel/module.c linux-2.6.6-h8300/arch/h8300/kernel/module.c
--- linux-2.6.6-bk9/arch/h8300/kernel/module.c	2004-05-23 21:11:56.000000000 +0900
+++ linux-2.6.6-h8300/arch/h8300/kernel/module.c	2004-05-23 21:01:50.000000000 +0900
@@ -67,7 +67,6 @@
 		Elf32_Sym *sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
 			+ ELF32_R_SYM(rela[i].r_info);
 		uint32_t v = sym->st_value + rela[i].r_addend;
-		uint32_t dot = sechdrs[symindex].sh_addr + rela[i].r_offset;
 
 		switch (ELF32_R_TYPE(rela[i].r_info)) {
 		case R_H8_DIR24R8:
@@ -75,14 +74,15 @@
 			*loc = (*loc & 0xff000000) | ((*loc & 0xffffff) + v);
 			break;
 		case R_H8_DIR24A8:
-			*loc += v;
+			if (ELF32_R_SYM(rela[i].r_info))
+				*loc += v;
 			break;
 		case R_H8_DIR32:
 		case R_H8_DIR32A16:
 			*loc += v;
 			break;
 		case R_H8_PCREL16:
-			v -= dot + 2;
+			v -= (unsigned long)loc + 2;
 			if ((Elf32_Sword)v > 0x7fff || 
 			    (Elf32_Sword)v < -(Elf32_Sword)0x8000)
 				goto overflow;
@@ -90,7 +90,7 @@
 				*(unsigned short *)loc = v;
 			break;
 		case R_H8_PCREL8:
-			v -= dot + 1;
+			v -= (unsigned long)loc + 1;
 			if ((Elf32_Sword)v > 0x7f || 
 			    (Elf32_Sword)v < -(Elf32_Sword)0x80)
 				goto overflow;
@@ -105,7 +105,7 @@
 	}
 	return 0;
  overflow:
-	printk(KERN_ERR "module %s: relocation offset overflow: %p\n",
+	printk(KERN_ERR "module %s: relocation offset overflow: %08x\n",
 	       me->name, rela[i].r_offset);
 	return -ENOEXEC;
 }
diff -ur linux-2.6.6-bk9/include/asm-h8300/module.h linux-2.6.6-h8300/include/asm-h8300/module.h
--- linux-2.6.6-bk9/include/asm-h8300/module.h	2004-05-23 21:12:07.000000000 +0900
+++ linux-2.6.6-h8300/include/asm-h8300/module.h	2004-05-23 21:00:28.000000000 +0900
@@ -8,4 +8,6 @@
 #define Elf_Sym Elf32_Sym
 #define Elf_Ehdr Elf32_Ehdr
 
+#define MODULE_SYMBOL_PREFIX "_"
+
 #endif /* _ASM_H8/300_MODULE_H */
diff -ur linux-2.6.6-bk9/scripts/mk_elfconfig.c linux-2.6.6-h8300/scripts/mk_elfconfig.c
--- linux-2.6.6-bk9/scripts/mk_elfconfig.c	2004-01-09 16:00:04.000000000 +0900
+++ linux-2.6.6-h8300/scripts/mk_elfconfig.c	2004-05-23 21:01:08.000000000 +0900
@@ -55,7 +55,7 @@
 	else
 		abort();
 
-	if (strcmp(argv[1], "v850") == 0)
+	if ((strcmp(argv[1], "v850") == 0) || (strcmp(argv[1], "h8300") == 0))
 		printf("#define MODULE_SYMBOL_PREFIX \"_\"\n");
 	else 
 		printf("#define MODULE_SYMBOL_PREFIX \"\"\n");

             reply	other threads:[~2004-05-23 12:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-23 12:40 Yoshinori Sato [this message]
2004-05-23 13:57 ` [PATCH] H8/300 ne driver module fix Yoshinori Sato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2y8njs4e8.wl%ysato@users.sourceforge.jp \
    --to=ysato@users.sourceforge.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.