From patchwork Mon Dec 22 22:14:17 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 15391 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 799D9DDE26 for ; Tue, 23 Dec 2008 09:13:17 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760512AbYLVWMu (ORCPT ); Mon, 22 Dec 2008 17:12:50 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760517AbYLVWMu (ORCPT ); Mon, 22 Dec 2008 17:12:50 -0500 Received: from pfepb.post.tele.dk ([195.41.46.236]:51574 "EHLO pfepb.post.tele.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760497AbYLVWMs (ORCPT ); Mon, 22 Dec 2008 17:12:48 -0500 Received: from ravnborg.org (x1-6-00-1e-2a-84-ae-3e.k225.webspeed.dk [80.163.61.94]) by pfepb.post.tele.dk (Postfix) with ESMTP id A4A80F8402D; Mon, 22 Dec 2008 23:12:44 +0100 (CET) Received: by ravnborg.org (Postfix, from userid 500) id 431B9580D4; Mon, 22 Dec 2008 23:14:19 +0100 (CET) From: Sam Ravnborg To: David Miller , sparclinux Cc: Sam Ravnborg Subject: [PATCH 3/5] sparc64: use bit neutral Elf symbols Date: Mon, 22 Dec 2008 23:14:17 +0100 Message-Id: <1229984059-3743-3-git-send-email-sam@ravnborg.org> X-Mailer: git-send-email 1.6.0.2.GIT In-Reply-To: <20081222220745.GA30716@uranus.ravnborg.org> References: <20081222220745.GA30716@uranus.ravnborg.org> Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org To prepare for unification use the bit neutral versions of the Elf types defined by asm/module.h Signed-off-by: Sam Ravnborg --- arch/sparc/kernel/module_64.c | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-) diff --git a/arch/sparc/kernel/module_64.c b/arch/sparc/kernel/module_64.c index 158484b..9f7e8d0 100644 --- a/arch/sparc/kernel/module_64.c +++ b/arch/sparc/kernel/module_64.c @@ -63,7 +63,7 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, struct module *mod) { unsigned int symidx; - Elf64_Sym *sym; + Elf_Sym *sym; const char *strtab; int i; @@ -73,18 +73,18 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, return -ENOEXEC; } } - sym = (Elf64_Sym *)sechdrs[symidx].sh_addr; + sym = (Elf_Sym *)sechdrs[symidx].sh_addr; strtab = (char *)sechdrs[sechdrs[symidx].sh_link].sh_addr; for (i = 1; i < sechdrs[symidx].sh_size / sizeof(Elf_Sym); i++) { if (sym[i].st_shndx == SHN_UNDEF && - ELF64_ST_TYPE(sym[i].st_info) == STT_REGISTER) + ELF_ST_TYPE(sym[i].st_info) == STT_REGISTER) sym[i].st_shndx = SHN_ABS; } return 0; } -int apply_relocate(Elf64_Shdr *sechdrs, +int apply_relocate(Elf_Shdr *sechdrs, const char *strtab, unsigned int symindex, unsigned int relsec, @@ -95,20 +95,20 @@ int apply_relocate(Elf64_Shdr *sechdrs, return -ENOEXEC; } -int apply_relocate_add(Elf64_Shdr *sechdrs, +int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, unsigned int symindex, unsigned int relsec, struct module *me) { unsigned int i; - Elf64_Rela *rel = (void *)sechdrs[relsec].sh_addr; - Elf64_Sym *sym; + Elf_Rela *rel = (void *)sechdrs[relsec].sh_addr; + Elf_Sym *sym; u8 *location; u32 *loc32; for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { - Elf64_Addr v; + Elf_Addr v; /* This is where to make the change */ location = (u8 *)sechdrs[sechdrs[relsec].sh_info].sh_addr @@ -119,11 +119,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, /* This is the symbol it is referring to. Note that all undefined symbols have been resolved. */ - sym = (Elf64_Sym *)sechdrs[symindex].sh_addr - + ELF64_R_SYM(rel[i].r_info); + sym = (Elf_Sym *)sechdrs[symindex].sh_addr + + ELF_R_SYM(rel[i].r_info); v = sym->st_value + rel[i].r_addend; - switch (ELF64_R_TYPE(rel[i].r_info) & 0xff) { + switch (ELF_R_TYPE(rel[i].r_info) & 0xff) { case R_SPARC_64: location[0] = v >> 56; location[1] = v >> 48; @@ -143,24 +143,24 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, break; case R_SPARC_DISP32: - v -= (Elf64_Addr) location; + v -= (Elf_Addr) location; *loc32 = v; break; case R_SPARC_WDISP30: - v -= (Elf64_Addr) location; + v -= (Elf_Addr) location; *loc32 = (*loc32 & ~0x3fffffff) | ((v >> 2) & 0x3fffffff); break; case R_SPARC_WDISP22: - v -= (Elf64_Addr) location; + v -= (Elf_Addr) location; *loc32 = (*loc32 & ~0x3fffff) | ((v >> 2) & 0x3fffff); break; case R_SPARC_WDISP19: - v -= (Elf64_Addr) location; + v -= (Elf_Addr) location; *loc32 = (*loc32 & ~0x7ffff) | ((v >> 2) & 0x7ffff); break; @@ -177,14 +177,14 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, case R_SPARC_OLO10: *loc32 = (*loc32 & ~0x1fff) | (((v & 0x3ff) + - (ELF64_R_TYPE(rel[i].r_info) >> 8)) + (ELF_R_TYPE(rel[i].r_info) >> 8)) & 0x1fff); break; default: printk(KERN_ERR "module %s: Unknown relocation: %x\n", me->name, - (int) (ELF64_R_TYPE(rel[i].r_info) & 0xff)); + (int) (ELF_R_TYPE(rel[i].r_info) & 0xff)); return -ENOEXEC; }; }