__u_boot__symtab -> __usymtab
This commit is contained in:
parent
2443c7a6f1
commit
236d55a06a
|
@ -75,9 +75,9 @@ SECTIONS
|
||||||
.u_boot_initcalls : { INITCALLS }
|
.u_boot_initcalls : { INITCALLS }
|
||||||
___u_boot_initcalls_end = .;
|
___u_boot_initcalls_end = .;
|
||||||
|
|
||||||
___u_boot_symtab_start = .;
|
___usymtab_start = .;
|
||||||
.u_boot_symtab : { U_BOOT_SYMS }
|
__usymtab : { U_BOOT_SYMS }
|
||||||
___u_boot_symtab_end = .;
|
___usymtab_end = .;
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
__bss_start = .;
|
__bss_start = .;
|
||||||
|
|
|
@ -107,9 +107,9 @@ SECTIONS
|
||||||
__u_boot_initcalls_end = .;
|
__u_boot_initcalls_end = .;
|
||||||
__initcall_entries = (__u_boot_initcalls_end - __u_boot_initcalls_start) >> 2;
|
__initcall_entries = (__u_boot_initcalls_end - __u_boot_initcalls_start) >> 2;
|
||||||
|
|
||||||
__u_boot_symtab_start = .;
|
__usymtab_start = .;
|
||||||
.u_boot_symtab : { U_BOOT_SYMS }
|
__usymtab : { U_BOOT_SYMS }
|
||||||
__u_boot_symtab_end = .;
|
__usymtab_end = .;
|
||||||
|
|
||||||
__early_init_data_begin = .;
|
__early_init_data_begin = .;
|
||||||
.early_init_data : { *(.early_init_data) }
|
.early_init_data : { *(.early_init_data) }
|
||||||
|
|
|
@ -60,9 +60,9 @@ SECTIONS
|
||||||
.u_boot_initcalls : { INITCALLS }
|
.u_boot_initcalls : { INITCALLS }
|
||||||
__u_boot_initcalls_end = .;
|
__u_boot_initcalls_end = .;
|
||||||
|
|
||||||
__u_boot_symtab_start = .;
|
__usymtab_start = .;
|
||||||
.u_boot_symtab : { U_BOOT_SYMS }
|
__usymtab : { U_BOOT_SYMS }
|
||||||
__u_boot_symtab_end = .;
|
__usymtab_end = .;
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
__bss_start = .;
|
__bss_start = .;
|
||||||
|
|
|
@ -45,8 +45,8 @@ static unsigned int find_sec(Elf_Ehdr *hdr,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Provided by the linker */
|
/* Provided by the linker */
|
||||||
extern const struct kernel_symbol __u_boot_symtab_start[];
|
extern const struct kernel_symbol __usymtab_start[];
|
||||||
extern const struct kernel_symbol __u_boot_symtab_end[];
|
extern const struct kernel_symbol __usymtab_end[];
|
||||||
|
|
||||||
/* lookup symbol in given range of kernel_symbols */
|
/* lookup symbol in given range of kernel_symbols */
|
||||||
static const struct kernel_symbol *lookup_symbol(const char *name,
|
static const struct kernel_symbol *lookup_symbol(const char *name,
|
||||||
|
@ -67,8 +67,8 @@ static unsigned long resolve_symbol(Elf32_Shdr *sechdrs,
|
||||||
const struct kernel_symbol *ks;
|
const struct kernel_symbol *ks;
|
||||||
|
|
||||||
debug("%s: %s\n", __FUNCTION__, name);
|
debug("%s: %s\n", __FUNCTION__, name);
|
||||||
ks = lookup_symbol(name, __u_boot_symtab_start,
|
ks = lookup_symbol(name, __usymtab_start,
|
||||||
__u_boot_symtab_end);
|
__usymtab_end);
|
||||||
|
|
||||||
if (ks)
|
if (ks)
|
||||||
return ks->value;
|
return ks->value;
|
||||||
|
|
|
@ -11,4 +11,4 @@
|
||||||
|
|
||||||
#define U_BOOT_CMDS *(SORT_BY_NAME(.u_boot_cmd*))
|
#define U_BOOT_CMDS *(SORT_BY_NAME(.u_boot_cmd*))
|
||||||
|
|
||||||
#define U_BOOT_SYMS *(__u_boot_symtab)
|
#define U_BOOT_SYMS *(__usymtab)
|
||||||
|
|
|
@ -19,13 +19,13 @@ struct kernel_symbol
|
||||||
/* For every exported symbol, place a struct in the __ksymtab section */
|
/* For every exported symbol, place a struct in the __ksymtab section */
|
||||||
#define __EXPORT_SYMBOL(sym, sec) \
|
#define __EXPORT_SYMBOL(sym, sec) \
|
||||||
extern typeof(sym) sym; \
|
extern typeof(sym) sym; \
|
||||||
static const char __u_boot_strtab_##sym[] \
|
static const char __ustrtab_##sym[] \
|
||||||
__attribute__((section("__u_boot_symtab_strings"))) \
|
__attribute__((section("__usymtab_strings"))) \
|
||||||
= MODULE_SYMBOL_PREFIX #sym; \
|
= MODULE_SYMBOL_PREFIX #sym; \
|
||||||
static const struct kernel_symbol __u_boot_symtab_##sym \
|
static const struct kernel_symbol __usymtab_##sym \
|
||||||
__used \
|
__used \
|
||||||
__attribute__((section("__u_boot_symtab" sec), unused)) \
|
__attribute__((section("__usymtab" sec), unused)) \
|
||||||
= { (unsigned long)&sym, __u_boot_strtab_##sym }
|
= { (unsigned long)&sym, __ustrtab_##sym }
|
||||||
|
|
||||||
#define EXPORT_SYMBOL(sym) \
|
#define EXPORT_SYMBOL(sym) \
|
||||||
__EXPORT_SYMBOL(sym, "")
|
__EXPORT_SYMBOL(sym, "")
|
||||||
|
|
|
@ -13,7 +13,23 @@
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "modpost.h"
|
#include "modpost.h"
|
||||||
//#include "../../include/license.h"
|
|
||||||
|
#if 0
|
||||||
|
/* Once we decide to actually make use of the license it should
|
||||||
|
* go back to the include file.
|
||||||
|
*/
|
||||||
|
#include "../../include/license.h"
|
||||||
|
#else
|
||||||
|
static inline int license_is_gpl_compatible(const char *license)
|
||||||
|
{
|
||||||
|
return (strcmp(license, "GPL") == 0
|
||||||
|
|| strcmp(license, "GPL v2") == 0
|
||||||
|
|| strcmp(license, "GPL and additional rights") == 0
|
||||||
|
|| strcmp(license, "Dual BSD/GPL") == 0
|
||||||
|
|| strcmp(license, "Dual MIT/GPL") == 0
|
||||||
|
|| strcmp(license, "Dual MPL/GPL") == 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Are we using CONFIG_MODVERSIONS? */
|
/* Are we using CONFIG_MODVERSIONS? */
|
||||||
int modversions = 0;
|
int modversions = 0;
|
||||||
|
@ -75,8 +91,8 @@ static int is_vmlinux(const char *modname)
|
||||||
else
|
else
|
||||||
myname = modname;
|
myname = modname;
|
||||||
|
|
||||||
return (strcmp(myname, "vmlinux") == 0) ||
|
return (strcmp(myname, "uboot") == 0) ||
|
||||||
(strcmp(myname, "vmlinux.o") == 0);
|
(strcmp(myname, "uboot.o") == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *do_nofail(void *ptr, const char *expr)
|
void *do_nofail(void *ptr, const char *expr)
|
||||||
|
@ -232,7 +248,7 @@ static enum export export_no(const char * s)
|
||||||
}
|
}
|
||||||
return export_unknown;
|
return export_unknown;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
static enum export export_from_sec(struct elf_info *elf, Elf_Section sec)
|
static enum export export_from_sec(struct elf_info *elf, Elf_Section sec)
|
||||||
{
|
{
|
||||||
if (sec == elf->export_sec)
|
if (sec == elf->export_sec)
|
||||||
|
@ -248,7 +264,7 @@ static enum export export_from_sec(struct elf_info *elf, Elf_Section sec)
|
||||||
else
|
else
|
||||||
return export_unknown;
|
return export_unknown;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/**
|
/**
|
||||||
* Add an exported symbol - it may have already been added without a
|
* Add an exported symbol - it may have already been added without a
|
||||||
* CRC, in this case just update the CRC
|
* CRC, in this case just update the CRC
|
||||||
|
@ -403,15 +419,15 @@ static int parse_elf(struct elf_info *info, const char *filename)
|
||||||
if (strcmp(secname, ".modinfo") == 0) {
|
if (strcmp(secname, ".modinfo") == 0) {
|
||||||
info->modinfo = (void *)hdr + sechdrs[i].sh_offset;
|
info->modinfo = (void *)hdr + sechdrs[i].sh_offset;
|
||||||
info->modinfo_len = sechdrs[i].sh_size;
|
info->modinfo_len = sechdrs[i].sh_size;
|
||||||
} else if (strcmp(secname, "__ksymtab") == 0)
|
} else if (strcmp(secname, "__usymtab") == 0)
|
||||||
info->export_sec = i;
|
info->export_sec = i;
|
||||||
else if (strcmp(secname, "__ksymtab_unused") == 0)
|
else if (strcmp(secname, "__usymtab_unused") == 0)
|
||||||
info->export_unused_sec = i;
|
info->export_unused_sec = i;
|
||||||
else if (strcmp(secname, "__ksymtab_gpl") == 0)
|
else if (strcmp(secname, "__usymtab_gpl") == 0)
|
||||||
info->export_gpl_sec = i;
|
info->export_gpl_sec = i;
|
||||||
else if (strcmp(secname, "__ksymtab_unused_gpl") == 0)
|
else if (strcmp(secname, "__usymtab_unused_gpl") == 0)
|
||||||
info->export_unused_gpl_sec = i;
|
info->export_unused_gpl_sec = i;
|
||||||
else if (strcmp(secname, "__ksymtab_gpl_future") == 0)
|
else if (strcmp(secname, "__usymtab_gpl_future") == 0)
|
||||||
info->export_gpl_future_sec = i;
|
info->export_gpl_future_sec = i;
|
||||||
|
|
||||||
if (sechdrs[i].sh_type != SHT_SYMTAB)
|
if (sechdrs[i].sh_type != SHT_SYMTAB)
|
||||||
|
@ -442,8 +458,8 @@ static void parse_elf_finish(struct elf_info *info)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CRC_PFX MODULE_SYMBOL_PREFIX "__crc_"
|
#define CRC_PFX MODULE_SYMBOL_PREFIX "__crc_"
|
||||||
#define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__ksymtab_"
|
#define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__usymtab_"
|
||||||
#if 0
|
|
||||||
static void handle_modversions(struct module *mod, struct elf_info *info,
|
static void handle_modversions(struct module *mod, struct elf_info *info,
|
||||||
Elf_Sym *sym, const char *symname)
|
Elf_Sym *sym, const char *symname)
|
||||||
{
|
{
|
||||||
|
@ -513,7 +529,6 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse tag=value strings from .modinfo section
|
* Parse tag=value strings from .modinfo section
|
||||||
|
@ -1221,12 +1236,12 @@ static int exit_section_ref_ok(const char *name)
|
||||||
|
|
||||||
static void read_symbols(char *modname)
|
static void read_symbols(char *modname)
|
||||||
{
|
{
|
||||||
// const char *symname;
|
const char *symname;
|
||||||
char *version;
|
char *version;
|
||||||
// char *license;
|
char *license;
|
||||||
struct module *mod;
|
struct module *mod;
|
||||||
struct elf_info info = { };
|
struct elf_info info = { };
|
||||||
// Elf_Sym *sym;
|
Elf_Sym *sym;
|
||||||
|
|
||||||
if (!parse_elf(&info, modname))
|
if (!parse_elf(&info, modname))
|
||||||
return;
|
return;
|
||||||
|
@ -1239,7 +1254,7 @@ static void read_symbols(char *modname)
|
||||||
have_vmlinux = 1;
|
have_vmlinux = 1;
|
||||||
mod->skip = 1;
|
mod->skip = 1;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
license = get_modinfo(info.modinfo, info.modinfo_len, "license");
|
license = get_modinfo(info.modinfo, info.modinfo_len, "license");
|
||||||
while (license) {
|
while (license) {
|
||||||
if (license_is_gpl_compatible(license))
|
if (license_is_gpl_compatible(license))
|
||||||
|
@ -1251,15 +1266,13 @@ static void read_symbols(char *modname)
|
||||||
license = get_next_modinfo(info.modinfo, info.modinfo_len,
|
license = get_next_modinfo(info.modinfo, info.modinfo_len,
|
||||||
"license", license);
|
"license", license);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if 0
|
|
||||||
for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
|
for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
|
||||||
symname = info.strtab + sym->st_name;
|
symname = info.strtab + sym->st_name;
|
||||||
|
|
||||||
handle_modversions(mod, &info, sym, symname);
|
handle_modversions(mod, &info, sym, symname);
|
||||||
handle_moddevtable(mod, &info, sym, symname);
|
// handle_moddevtable(mod, &info, sym, symname);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
check_sec_ref(mod, modname, &info, init_section, init_section_ref_ok);
|
check_sec_ref(mod, modname, &info, init_section, init_section_ref_ok);
|
||||||
check_sec_ref(mod, modname, &info, exit_section, exit_section_ref_ok);
|
check_sec_ref(mod, modname, &info, exit_section, exit_section_ref_ok);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue