Commit e08025ce authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[SPARC]: Implement STT_REGISTER sparc support more cleanly.

parent 2c12e127
...@@ -36,12 +36,31 @@ void module_free(struct module *mod, void *module_region) ...@@ -36,12 +36,31 @@ void module_free(struct module *mod, void *module_region)
table entries. */ table entries. */
} }
/* We don't need anything special. */ /* Make generic code ignore STT_REGISTER dummy undefined symbols. */
int module_frob_arch_sections(Elf_Ehdr *hdr, int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs, Elf_Shdr *sechdrs,
char *secstrings, char *secstrings,
struct module *mod) struct module *mod)
{ {
unsigned int symidx;
Elf32_Sym *sym;
const char *strtab;
int i;
for (symidx = 0; sechdrs[symidx].sh_type != SHT_SYMTAB; symidx++) {
if (symidx == hdr->e_shnum-1) {
printk("%s: no symtab found.\n", mod->name);
return -ENOEXEC;
}
}
sym = (Elf32_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 &&
ELF32_ST_TYPE(sym[i].st_info) == STT_REGISTER)
sym[i].st_shndx = SHN_ABS;
}
return 0; return 0;
} }
......
...@@ -143,12 +143,31 @@ void module_free(struct module *mod, void *module_region) ...@@ -143,12 +143,31 @@ void module_free(struct module *mod, void *module_region)
table entries. */ table entries. */
} }
/* We don't need anything special. */ /* Make generic code ignore STT_REGISTER dummy undefined symbols. */
int module_frob_arch_sections(Elf_Ehdr *hdr, int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs, Elf_Shdr *sechdrs,
char *secstrings, char *secstrings,
struct module *mod) struct module *mod)
{ {
unsigned int symidx;
Elf64_Sym *sym;
const char *strtab;
int i;
for (symidx = 0; sechdrs[symidx].sh_type != SHT_SYMTAB; symidx++) {
if (symidx == hdr->e_shnum-1) {
printk("%s: no symtab found.\n", mod->name);
return -ENOEXEC;
}
}
sym = (Elf64_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)
sym[i].st_shndx = SHN_ABS;
}
return 0; return 0;
} }
......
...@@ -974,11 +974,6 @@ static int simplify_symbols(Elf_Shdr *sechdrs, ...@@ -974,11 +974,6 @@ static int simplify_symbols(Elf_Shdr *sechdrs,
/* Ok if weak. */ /* Ok if weak. */
if (ELF_ST_BIND(sym[i].st_info) == STB_WEAK) if (ELF_ST_BIND(sym[i].st_info) == STB_WEAK)
break; break;
#if defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64)
/* Ok if Sparc register directive. */
if (ELF_ST_TYPE(sym[i].st_info) == STT_REGISTER)
break;
#endif
printk(KERN_WARNING "%s: Unknown symbol %s\n", printk(KERN_WARNING "%s: Unknown symbol %s\n",
mod->name, strtab + sym[i].st_name); mod->name, strtab + sym[i].st_name);
......
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