/* Change all symbols so that st_value encodes the pointer directly. */
static int simplify_symbols(struct module *mod, const struct load_info *info)
{
Elf_Shdr *symsec = &info->sechdrs[info->index.sym];
Elf_Sym *sym = (void *)symsec->sh_addr;
unsigned long secbase;
unsigned int i;
int ret = 0;
const struct kernel_symbol *ksym;
for (i = 1; i < symsec->sh_size / sizeof(Elf_Sym); i++) {
const char *name = info->strtab + sym[i].st_name;
switch (sym[i].st_shndx) {
case SHN_COMMON:
/* Ignore common symbols */
if (!strncmp(name, "__gnu_lto", 9))
break;
/* We compiled with -fno-common. These are not
supposed to happen. */
pr_debug("Common symbol: %s\n", name);
printk("%s: please compile with -fno-common\n",
mod->name);
ret = -ENOEXEC;
break;
case SHN_ABS:
/* Don't need to do anything */
pr_debug("Absolute symbol: 0x%08lx\n",
(long)sym[i].st_value);
break;
case SHN_UNDEF:
ksym = resolve_symbol_wait(mod, info, name);
/* Ok if resolved. */
if (ksym && !IS_ERR(ksym)) {
sym[i].st_value = ksym->value;
break;
}
/* Ok if weak. */
if (!ksym && ELF_ST_BIND(sym[i].st_info) == STB_WEAK)
break;
pr_warn("%s: Unknown symbol %s (err %li)\n",
mod->name, name, PTR_ERR(ksym));
ret = PTR_ERR(ksym) ?: -ENOENT;
break;
default:
/* Divert to percpu allocation if a percpu var. */
if (sym[i].st_shndx == info->index.pcpu)
secbase = (unsigned long)mod_percpu(mod);
else
secbase = info->sechdrs[sym[i].st_shndx].sh_addr;
sym[i].st_value += secbase;
break;
}
}
return ret;
}
pr_warn("%s: Unknown symbol %s (err %li)\n",
mod->name, name, PTR_ERR(ksym));
grep -rn "Unknown symbol" ./*
./arch/arm/kernel/unwind.c:160: pr_warn("unwind: Unknown symbol address %08lx\n", addr);
./arch/mips/kernel/module.c:221: printk(KERN_WARNING "%s: Unknown symbol %s\n",
./arch/mips/kernel/module-rela.c:132: printk(KERN_WARNING "%s: Unknown symbol %s\n",
./arch/parisc/kernel/module.c:572: printk(KERN_WARNING "%s: Unknown symbol %s\n",
./arch/parisc/kernel/module.c:708: printk(KERN_WARNING "%s: Unknown symbol %s\n",
匹配到二进制文件 ./arch/x86/boot/compressed/vmlinux.bin
./kernel/module.c:1981: pr_warn("%s: Unknown symbol %s (err %li)\n",
匹配到二进制文件 ./kernel/module.o
匹配到二进制文件 ./kernel/built-in.o
./scripts/kconfig/symbol.c:868: * name to be expanded shall be prefixed by a '$'. Unknown symbol expands to
匹配到二进制文件 ./vmlinux
匹配到二进制文件 ./vmlinux.o
[ 21.511318] radeon: Unknown symbol cfb_copyarea (err 0)
[ 21.522742] radeon: Unknown symbol cfb_imageblit (err 0)
[ 21.522941] radeon: Unknown symbol cfb_fillrect (err 0)
objdump -t vesafb.o >vesafbot.txt
vesafb.o: 文件格式 elf32-i386
SYMBOL TABLE:
00000000 l df *ABS* 00000000 vesafb.c
00000000 l d .text 00000000 .text
00000000 l d .data 00000000 .data
00000000 l d .bss 00000000 .bss
00000000 l F .text 0000003a vesafb_pan_display
0000000c l O .data..read_mostly 00000004 pmi_start
00000000 l d .init.text 00000000 .init.text
00000000 l F .init.text 00000011 vesafb_driver_init
00000000 l O .data 00000058 vesafb_driver
00000040 l F .text 0000001a vesafb_remove
00000060 l F .text 00000039 vesafb_destroy
00000000 l d .exit.text 00000000 .exit.text
00000000 l F .exit.text 0000000f vesafb_driver_exit
000000a0 l F .text 000001b1 vesafb_setcolreg
00000000 l O .data..read_mostly 00000004 vga_compat
00000004 l O .data..read_mostly 00000004 depth
00000014 l O .data..read_mostly 00000004 pmi_setpal
00000008 l O .data..read_mostly 00000004 pmi_pal
00000000 l d .rodata.str1.1 00000000 .rodata.str1.1
00000000 l d .rodata.str1.4 00000000 .rodata.str1.4
00000260 l F .text 00000952 vesafb_probe
0000001c l O .data..read_mostly 00000004 inverse
000000c0 l O .data 00000044 vesafb_fix
00000120 l O .data 000000a0 vesafb_defined
00000000 l O .bss 00000004 vram_total
00000004 l O .bss 00000004 vram_remap
00000010 l O .data..read_mostly 00000004 ypan
00000018 l O .data..read_mostly 00000004 mtrr
00000060 l O .data 00000060 vesafb_ops
00000000 l O .rodata 0000000c CSWTCH.197
00000000 l d .rodata 00000000 .rodata
00000000 l d .exitcall.exit 00000000 .exitcall.exit
00000000 l O .exitcall.exit 00000004 __exitcall_vesafb_driver_exit
00000000 l d .initcall6.init 00000000 .initcall6.init
00000000 l O .initcall6.init 00000004 __initcall_vesafb_driver_init6
00000000 l d .data..read_mostly 00000000 .data..read_mostly
00000000 l d .note.GNU-stack 00000000 .note.GNU-stack
00000000 l d .comment 00000000 .comment
00000000 *UND* 00000000 __platform_driver_register
00000000 *UND* 00000000 unregister_framebuffer
00000000 *UND* 00000000 framebuffer_release
00000000 *UND* 00000000 fb_dealloc_cmap
00000000 *UND* 00000000 iounmap
00000000 *UND* 00000000 iomem_resource
00000000 *UND* 00000000 __release_region
00000000 *UND* 00000000 platform_driver_unregister
00000000 *UND* 00000000 native_io_delay
00000000 *UND* 00000000 fb_get_options
00000000 *UND* 00000000 strsep
00000000 *UND* 00000000 strcmp
00000000 *UND* 00000000 screen_info
00000000 *UND* 00000000 __request_region
00000000 *UND* 00000000 framebuffer_alloc
00000000 *UND* 00000000 kmalloc_caches
00000000 *UND* 00000000 kmem_cache_alloc
00000000 *UND* 00000000 printk
00000000 *UND* 00000000 ioport_resource
00000000 *UND* 00000000 ioremap_wc
00000000 *UND* 00000000 fb_alloc_cmap
00000000 *UND* 00000000 register_framebuffer
00000000 *UND* 00000000 strncmp
00000000 *UND* 00000000 simple_strtoul
00000000 *UND* 00000000 ioremap_cache
00000000 *UND* 00000000 mtrr_add
00000000 *UND* 00000000 ioremap_nocache
00000000 *UND* 00000000 cfb_fillrect
00000000 *UND* 00000000 cfb_copyarea
00000000 *UND* 00000000 cfb_imageblit