Commit 6183d68b authored by Sven Schnelle's avatar Sven Schnelle Committed by Helge Deller

parisc: use pr_debug() in kernel/module.c

Instead of using our own version, switch to the generic
pr_() calls.
Signed-off-by: default avatarSven Schnelle <svens@stackframe.org>
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent e4eab1ce
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
* However, SEGREL32 is used only for PARISC unwind entries, and we want * However, SEGREL32 is used only for PARISC unwind entries, and we want
* those entries to have an absolute address, and not just an offset. * those entries to have an absolute address, and not just an offset.
* *
* The unwind table mechanism has the ability to specify an offset for * The unwind table mechanism has the ability to specify an offset for
* the unwind table; however, because we split off the init functions into * the unwind table; however, because we split off the init functions into
* a different piece of memory, it is not possible to do this using a * a different piece of memory, it is not possible to do this using a
* single offset. Instead, we use the above hack for now. * single offset. Instead, we use the above hack for now.
*/ */
...@@ -53,12 +53,6 @@ ...@@ -53,12 +53,6 @@
#include <asm/unwind.h> #include <asm/unwind.h>
#include <asm/sections.h> #include <asm/sections.h>
#if 0
#define DEBUGP printk
#else
#define DEBUGP(fmt...)
#endif
#define RELOC_REACHABLE(val, bits) \ #define RELOC_REACHABLE(val, bits) \
(( ( !((val) & (1<<((bits)-1))) && ((val)>>(bits)) != 0 ) || \ (( ( !((val) & (1<<((bits)-1))) && ((val)>>(bits)) != 0 ) || \
( ((val) & (1<<((bits)-1))) && ((val)>>(bits)) != (((__typeof__(val))(~0))>>((bits)+2)))) ? \ ( ((val) & (1<<((bits)-1))) && ((val)>>(bits)) != (((__typeof__(val))(~0))>>((bits)+2)))) ? \
...@@ -300,7 +294,7 @@ unsigned int arch_mod_section_prepend(struct module *mod, ...@@ -300,7 +294,7 @@ unsigned int arch_mod_section_prepend(struct module *mod,
* sizeof(struct stub_entry); * sizeof(struct stub_entry);
} }
#define CONST #define CONST
int module_frob_arch_sections(CONST Elf_Ehdr *hdr, int module_frob_arch_sections(CONST Elf_Ehdr *hdr,
CONST Elf_Shdr *sechdrs, CONST Elf_Shdr *sechdrs,
CONST char *secstrings, CONST char *secstrings,
...@@ -386,7 +380,7 @@ static Elf64_Word get_got(struct module *me, unsigned long value, long addend) ...@@ -386,7 +380,7 @@ static Elf64_Word get_got(struct module *me, unsigned long value, long addend)
got[i].addr = value; got[i].addr = value;
out: out:
DEBUGP("GOT ENTRY %d[%x] val %lx\n", i, i*sizeof(struct got_entry), pr_debug("GOT ENTRY %d[%lx] val %lx\n", i, i*sizeof(struct got_entry),
value); value);
return i * sizeof(struct got_entry); return i * sizeof(struct got_entry);
} }
...@@ -539,7 +533,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, ...@@ -539,7 +533,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
//unsigned long dp = (unsigned long)$global$; //unsigned long dp = (unsigned long)$global$;
register unsigned long dp asm ("r27"); register unsigned long dp asm ("r27");
DEBUGP("Applying relocate section %u to %u\n", relsec, pr_debug("Applying relocate section %u to %u\n", relsec,
targetsec); targetsec);
for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
/* This is where to make the change */ /* This is where to make the change */
...@@ -563,7 +557,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, ...@@ -563,7 +557,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
#if 0 #if 0
#define r(t) ELF32_R_TYPE(rel[i].r_info)==t ? #t : #define r(t) ELF32_R_TYPE(rel[i].r_info)==t ? #t :
DEBUGP("Symbol %s loc 0x%x val 0x%x addend 0x%x: %s\n", pr_debug("Symbol %s loc 0x%x val 0x%x addend 0x%x: %s\n",
strtab + sym->st_name, strtab + sym->st_name,
(uint32_t)loc, val, addend, (uint32_t)loc, val, addend,
r(R_PARISC_PLABEL32) r(R_PARISC_PLABEL32)
...@@ -604,7 +598,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, ...@@ -604,7 +598,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
/* See note about special handling of SEGREL32 at /* See note about special handling of SEGREL32 at
* the beginning of this file. * the beginning of this file.
*/ */
*loc = fsel(val, addend); *loc = fsel(val, addend);
break; break;
case R_PARISC_SECREL32: case R_PARISC_SECREL32:
/* 32-bit section relative address. */ /* 32-bit section relative address. */
...@@ -683,7 +677,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, ...@@ -683,7 +677,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
Elf_Addr loc0; Elf_Addr loc0;
unsigned int targetsec = sechdrs[relsec].sh_info; unsigned int targetsec = sechdrs[relsec].sh_info;
DEBUGP("Applying relocate section %u to %u\n", relsec, pr_debug("Applying relocate section %u to %u\n", relsec,
targetsec); targetsec);
for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
/* This is where to make the change */ /* This is where to make the change */
...@@ -725,7 +719,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, ...@@ -725,7 +719,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
case R_PARISC_LTOFF21L: case R_PARISC_LTOFF21L:
/* LT-relative; left 21 bits */ /* LT-relative; left 21 bits */
val = get_got(me, val, addend); val = get_got(me, val, addend);
DEBUGP("LTOFF21L Symbol %s loc %p val %lx\n", pr_debug("LTOFF21L Symbol %s loc %p val %llx\n",
strtab + sym->st_name, strtab + sym->st_name,
loc, val); loc, val);
val = lrsel(val, 0); val = lrsel(val, 0);
...@@ -736,14 +730,14 @@ int apply_relocate_add(Elf_Shdr *sechdrs, ...@@ -736,14 +730,14 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
/* LT-relative; right 14 bits */ /* LT-relative; right 14 bits */
val = get_got(me, val, addend); val = get_got(me, val, addend);
val = rrsel(val, 0); val = rrsel(val, 0);
DEBUGP("LTOFF14R Symbol %s loc %p val %lx\n", pr_debug("LTOFF14R Symbol %s loc %p val %llx\n",
strtab + sym->st_name, strtab + sym->st_name,
loc, val); loc, val);
*loc = mask(*loc, 14) | reassemble_14(val); *loc = mask(*loc, 14) | reassemble_14(val);
break; break;
case R_PARISC_PCREL22F: case R_PARISC_PCREL22F:
/* PC-relative; 22 bits */ /* PC-relative; 22 bits */
DEBUGP("PCREL22F Symbol %s loc %p val %lx\n", pr_debug("PCREL22F Symbol %s loc %p val %llx\n",
strtab + sym->st_name, strtab + sym->st_name,
loc, val); loc, val);
val += addend; val += addend;
...@@ -775,7 +769,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, ...@@ -775,7 +769,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
val = get_stub(me, val, addend, ELF_STUB_GOT, val = get_stub(me, val, addend, ELF_STUB_GOT,
loc0, targetsec); loc0, targetsec);
} }
DEBUGP("STUB FOR %s loc %lx, val %lx+%lx at %lx\n", pr_debug("STUB FOR %s loc %px, val %llx+%llx at %llx\n",
strtab + sym->st_name, loc, sym->st_value, strtab + sym->st_name, loc, sym->st_value,
addend, val); addend, val);
val = (val - dot - 8)/4; val = (val - dot - 8)/4;
...@@ -795,7 +789,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, ...@@ -795,7 +789,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
/* See note about special handling of SEGREL32 at /* See note about special handling of SEGREL32 at
* the beginning of this file. * the beginning of this file.
*/ */
*loc = fsel(val, addend); *loc = fsel(val, addend);
break; break;
case R_PARISC_SECREL32: case R_PARISC_SECREL32:
/* 32-bit section relative address. */ /* 32-bit section relative address. */
...@@ -805,14 +799,14 @@ int apply_relocate_add(Elf_Shdr *sechdrs, ...@@ -805,14 +799,14 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
/* 64-bit function address */ /* 64-bit function address */
if(in_local(me, (void *)(val + addend))) { if(in_local(me, (void *)(val + addend))) {
*loc64 = get_fdesc(me, val+addend); *loc64 = get_fdesc(me, val+addend);
DEBUGP("FDESC for %s at %p points to %lx\n", pr_debug("FDESC for %s at %llx points to %llx\n",
strtab + sym->st_name, *loc64, strtab + sym->st_name, *loc64,
((Elf_Fdesc *)*loc64)->addr); ((Elf_Fdesc *)*loc64)->addr);
} else { } else {
/* if the symbol is not local to this /* if the symbol is not local to this
* module then val+addend is a pointer * module then val+addend is a pointer
* to the function descriptor */ * to the function descriptor */
DEBUGP("Non local FPTR64 Symbol %s loc %p val %lx\n", pr_debug("Non local FPTR64 Symbol %s loc %p val %llx\n",
strtab + sym->st_name, strtab + sym->st_name,
loc, val); loc, val);
*loc64 = val + addend; *loc64 = val + addend;
...@@ -843,7 +837,7 @@ register_unwind_table(struct module *me, ...@@ -843,7 +837,7 @@ register_unwind_table(struct module *me,
end = table + sechdrs[me->arch.unwind_section].sh_size; end = table + sechdrs[me->arch.unwind_section].sh_size;
gp = (Elf_Addr)me->core_layout.base + me->arch.got_offset; gp = (Elf_Addr)me->core_layout.base + me->arch.got_offset;
DEBUGP("register_unwind_table(), sect = %d at 0x%p - 0x%p (gp=0x%lx)\n", pr_debug("register_unwind_table(), sect = %d at 0x%p - 0x%p (gp=0x%lx)\n",
me->arch.unwind_section, table, end, gp); me->arch.unwind_section, table, end, gp);
me->arch.unwind = unwind_table_add(me->name, 0, gp, table, end); me->arch.unwind = unwind_table_add(me->name, 0, gp, table, end);
} }
...@@ -899,7 +893,7 @@ int module_finalize(const Elf_Ehdr *hdr, ...@@ -899,7 +893,7 @@ int module_finalize(const Elf_Ehdr *hdr,
} }
} }
DEBUGP("module %s: strtab %p, symhdr %p\n", pr_debug("module %s: strtab %p, symhdr %p\n",
me->name, strtab, symhdr); me->name, strtab, symhdr);
if(me->arch.got_count > MAX_GOTS) { if(me->arch.got_count > MAX_GOTS) {
...@@ -918,7 +912,7 @@ int module_finalize(const Elf_Ehdr *hdr, ...@@ -918,7 +912,7 @@ int module_finalize(const Elf_Ehdr *hdr,
oldptr = (void *)symhdr->sh_addr; oldptr = (void *)symhdr->sh_addr;
newptr = oldptr + 1; /* we start counting at 1 */ newptr = oldptr + 1; /* we start counting at 1 */
nsyms = symhdr->sh_size / sizeof(Elf_Sym); nsyms = symhdr->sh_size / sizeof(Elf_Sym);
DEBUGP("OLD num_symtab %lu\n", nsyms); pr_debug("OLD num_symtab %lu\n", nsyms);
for (i = 1; i < nsyms; i++) { for (i = 1; i < nsyms; i++) {
oldptr++; /* note, count starts at 1 so preincrement */ oldptr++; /* note, count starts at 1 so preincrement */
...@@ -933,7 +927,7 @@ int module_finalize(const Elf_Ehdr *hdr, ...@@ -933,7 +927,7 @@ int module_finalize(const Elf_Ehdr *hdr,
} }
nsyms = newptr - (Elf_Sym *)symhdr->sh_addr; nsyms = newptr - (Elf_Sym *)symhdr->sh_addr;
DEBUGP("NEW num_symtab %lu\n", nsyms); pr_debug("NEW num_symtab %lu\n", nsyms);
symhdr->sh_size = nsyms * sizeof(Elf_Sym); symhdr->sh_size = nsyms * sizeof(Elf_Sym);
/* find .altinstructions section */ /* find .altinstructions section */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment