diff --git a/sys/conf/kmod_syms.awk b/sys/conf/kmod_syms.awk --- a/sys/conf/kmod_syms.awk +++ b/sys/conf/kmod_syms.awk @@ -2,6 +2,7 @@ # Read global symbols from object file. BEGIN { + modname = ARGV[1] while ("${NM:='nm'} -g " ARGV[1] | getline) { if (match($0, /^[^[:space:]]+ [^AU] (.*)$/)) { syms[$3] = $2 @@ -12,7 +13,12 @@ # De-list symbols from the export list. { - delete syms[$0] + smbl = $0 + if (!(smbl in syms)) { + printf "Symbol %s is not present in %s\n", \ + smbl, modname > "/dev/stderr" + } + delete syms[smbl] } # Strip commons, make everything else local. diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -911,7 +911,7 @@ linker_file_t lf; TAILQ_FOREACH(lf, &linker_files, link) { - if (LINKER_LOOKUP_SYMBOL(lf, symstr, sym) == 0) + if (LINKER_LOOKUP_DEBUG_SYMBOL(lf, symstr, sym) == 0) return (0); } return (ENOENT); @@ -955,7 +955,7 @@ linker_file_t lf; TAILQ_FOREACH(lf, &linker_files, link) { - if (LINKER_SYMBOL_VALUES(lf, sym, symval) == 0) + if (LINKER_DEBUG_SYMBOL_VALUES(lf, sym, symval) == 0) return (0); } return (ENOENT); diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -144,8 +144,12 @@ linker_file_t *); static int link_elf_lookup_symbol(linker_file_t, const char *, c_linker_sym_t *); +static int link_elf_lookup_debug_symbol(linker_file_t, const char *, + c_linker_sym_t *); static int link_elf_symbol_values(linker_file_t, c_linker_sym_t, linker_symval_t *); +static int link_elf_debug_symbol_values(linker_file_t, c_linker_sym_t, + linker_symval_t*); static int link_elf_search_symbol(linker_file_t, caddr_t, c_linker_sym_t *, long *); @@ -164,7 +168,9 @@ static kobj_method_t link_elf_methods[] = { KOBJMETHOD(linker_lookup_symbol, link_elf_lookup_symbol), + KOBJMETHOD(linker_lookup_debug_symbol, link_elf_lookup_debug_symbol), KOBJMETHOD(linker_symbol_values, link_elf_symbol_values), + KOBJMETHOD(linker_debug_symbol_values, link_elf_debug_symbol_values), KOBJMETHOD(linker_search_symbol, link_elf_search_symbol), KOBJMETHOD(linker_unload, link_elf_unload_file), KOBJMETHOD(linker_load_file, link_elf_load_file), @@ -188,6 +194,11 @@ link_elf_methods, sizeof(struct elf_file) }; +static bool link_elf_leak_locals; +SYSCTL_BOOL(_debug, OID_AUTO, link_elf_leak_locals, + CTLFLAG_RWTUN, &link_elf_leak_locals, 0, + "Allow local symbols to participate in global module symbol resolution"); + typedef int (*elf_reloc_fn)(linker_file_t lf, Elf_Addr relocbase, const void *data, int type, elf_lookup_fn lookup); @@ -1490,14 +1501,14 @@ } static int -link_elf_lookup_symbol(linker_file_t lf, const char *name, c_linker_sym_t *sym) +link_elf_lookup_symbol1(linker_file_t lf, const char *name, c_linker_sym_t *sym, + bool see_local) { elf_file_t ef = (elf_file_t) lf; unsigned long symnum; const Elf_Sym* symp; const char *strp; unsigned long hash; - int i; /* If we don't have a hash, bail. */ if (ef->buckets == NULL || ef->nbuckets == 0) { @@ -1528,8 +1539,11 @@ (symp->st_value != 0 && (ELF_ST_TYPE(symp->st_info) == STT_FUNC || ELF_ST_TYPE(symp->st_info) == STT_GNU_IFUNC))) { - *sym = (c_linker_sym_t) symp; - return (0); + if (see_local || + ELF_ST_BIND(symp->st_info) != STB_LOCAL) { + *sym = (c_linker_sym_t) symp; + return (0); + } } return (ENOENT); } @@ -1537,11 +1551,29 @@ symnum = ef->chains[symnum]; } - /* If we have not found it, look at the full table (if loaded) */ - if (ef->symtab == ef->ddbsymtab) - return (ENOENT); + return (ENOENT); +} + +static int +link_elf_lookup_symbol(linker_file_t lf, const char *name, c_linker_sym_t *sym) +{ + if (link_elf_leak_locals) + return (link_elf_lookup_debug_symbol(lf, name, sym)); + return (link_elf_lookup_symbol1(lf, name, sym, false)); +} + +static int +link_elf_lookup_debug_symbol(linker_file_t lf, const char *name, + c_linker_sym_t *sym) +{ + elf_file_t ef = (elf_file_t)lf; + const Elf_Sym* symp; + const char *strp; + int i; + + if (link_elf_lookup_symbol1(lf, name, sym, true) == 0) + return (0); - /* Exhaustive search */ for (i = 0, symp = ef->ddbsymtab; i < ef->ddbsymcnt; i++, symp++) { strp = ef->ddbstrtab + symp->st_name; if (strcmp(name, strp) == 0) { @@ -1560,8 +1592,8 @@ } static int -link_elf_symbol_values(linker_file_t lf, c_linker_sym_t sym, - linker_symval_t *symval) +link_elf_symbol_values1(linker_file_t lf, c_linker_sym_t sym, + linker_symval_t *symval, bool see_local) { elf_file_t ef; const Elf_Sym *es; @@ -1569,7 +1601,9 @@ ef = (elf_file_t)lf; es = (const Elf_Sym *)sym; - if (es >= ef->symtab && es < (ef->symtab + ef->nchains)) { + if (es >= ef->symtab && es < ef->symtab + ef->nchains) { + if (!see_local && ELF_ST_BIND(es->st_info) == STB_LOCAL) + return (ENOENT); symval->name = ef->strtab + es->st_name; val = (caddr_t)ef->address + es->st_value; if (ELF_ST_TYPE(es->st_info) == STT_GNU_IFUNC) @@ -1578,8 +1612,31 @@ symval->size = es->st_size; return (0); } + return (ENOENT); +} + +static int +link_elf_symbol_values(linker_file_t lf, c_linker_sym_t sym, + linker_symval_t *symval) +{ + if (link_elf_leak_locals) + return (link_elf_debug_symbol_values(lf, sym, symval)); + return (link_elf_symbol_values1(lf, sym, symval, false)); +} + +static int +link_elf_debug_symbol_values(linker_file_t lf, c_linker_sym_t sym, + linker_symval_t *symval) +{ + elf_file_t ef = (elf_file_t)lf; + const Elf_Sym *es = (const Elf_Sym *)sym; + caddr_t val; + + if (link_elf_symbol_values1(lf, sym, symval, true) == 0) + return (0); if (ef->symtab == ef->ddbsymtab) return (ENOENT); + if (es >= ef->ddbsymtab && es < (ef->ddbsymtab + ef->ddbsymcnt)) { symval->name = ef->ddbstrtab + es->st_name; val = (caddr_t)ef->address + es->st_value; @@ -1596,12 +1653,12 @@ link_elf_search_symbol(linker_file_t lf, caddr_t value, c_linker_sym_t *sym, long *diffp) { - elf_file_t ef = (elf_file_t) lf; - u_long off = (uintptr_t) (void *) value; + elf_file_t ef = (elf_file_t)lf; + u_long off = (uintptr_t)(void *)value; u_long diff = off; u_long st_value; - const Elf_Sym* es; - const Elf_Sym* best = NULL; + const Elf_Sym *es; + const Elf_Sym *best = NULL; int i; for (i = 0, es = ef->ddbsymtab; i < ef->ddbsymcnt; i++, es++) { @@ -1711,7 +1768,7 @@ { linker_symval_t symval; elf_file_t ef = (elf_file_t)file; - const Elf_Sym* symp; + const Elf_Sym *symp; int i, error; /* Exhaustive search */ diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -131,8 +132,12 @@ static int link_elf_load_file(linker_class_t, const char *, linker_file_t *); static int link_elf_lookup_symbol(linker_file_t, const char *, c_linker_sym_t *); +static int link_elf_lookup_debug_symbol(linker_file_t, const char *, + c_linker_sym_t *); static int link_elf_symbol_values(linker_file_t, c_linker_sym_t, linker_symval_t *); +static int link_elf_debug_symbol_values(linker_file_t, c_linker_sym_t, + linker_symval_t *); static int link_elf_search_symbol(linker_file_t, caddr_t value, c_linker_sym_t *sym, long *diffp); @@ -153,7 +158,9 @@ static kobj_method_t link_elf_methods[] = { KOBJMETHOD(linker_lookup_symbol, link_elf_lookup_symbol), + KOBJMETHOD(linker_lookup_debug_symbol, link_elf_lookup_debug_symbol), KOBJMETHOD(linker_symbol_values, link_elf_symbol_values), + KOBJMETHOD(linker_debug_symbol_values, link_elf_debug_symbol_values), KOBJMETHOD(linker_search_symbol, link_elf_search_symbol), KOBJMETHOD(linker_unload, link_elf_unload_file), KOBJMETHOD(linker_load_file, link_elf_load_file), @@ -177,6 +184,11 @@ link_elf_methods, sizeof(struct elf_file) }; +static bool link_elf_obj_leak_locals; +SYSCTL_BOOL(_debug, OID_AUTO, link_elf_obj_leak_locals, + CTLFLAG_RWTUN, &link_elf_obj_leak_locals, 0, + "Allow local symbols to participate in global module symbol resolution"); + static int relocate_file(elf_file_t ef); static void elf_obj_cleanup_globals_cache(elf_file_t); @@ -1407,9 +1419,10 @@ } static int -link_elf_lookup_symbol(linker_file_t lf, const char *name, c_linker_sym_t *sym) +link_elf_lookup_symbol1(linker_file_t lf, const char *name, c_linker_sym_t *sym, + bool see_local) { - elf_file_t ef = (elf_file_t) lf; + elf_file_t ef = (elf_file_t)lf; const Elf_Sym *symp; const char *strp; int i; @@ -1417,16 +1430,34 @@ for (i = 0, symp = ef->ddbsymtab; i < ef->ddbsymcnt; i++, symp++) { strp = ef->ddbstrtab + symp->st_name; if (symp->st_shndx != SHN_UNDEF && strcmp(name, strp) == 0) { - *sym = (c_linker_sym_t) symp; - return 0; + if (see_local || + ELF_ST_BIND(symp->st_info) == STB_GLOBAL) { + *sym = (c_linker_sym_t) symp; + return (0); + } + return (ENOENT); } } - return ENOENT; + return (ENOENT); } static int -link_elf_symbol_values(linker_file_t lf, c_linker_sym_t sym, - linker_symval_t *symval) +link_elf_lookup_symbol(linker_file_t lf, const char *name, c_linker_sym_t *sym) +{ + return (link_elf_lookup_symbol1(lf, name, sym, + link_elf_obj_leak_locals)); +} + +static int +link_elf_lookup_debug_symbol(linker_file_t lf, const char *name, + c_linker_sym_t *sym) +{ + return (link_elf_lookup_symbol1(lf, name, sym, true)); +} + +static int +link_elf_symbol_values1(linker_file_t lf, c_linker_sym_t sym, + linker_symval_t *symval, bool see_local) { elf_file_t ef; const Elf_Sym *es; @@ -1436,23 +1467,40 @@ es = (const Elf_Sym*) sym; val = (caddr_t)es->st_value; if (es >= ef->ddbsymtab && es < (ef->ddbsymtab + ef->ddbsymcnt)) { + if (!see_local && ELF_ST_BIND(es->st_info) == STB_LOCAL) + return (ENOENT); symval->name = ef->ddbstrtab + es->st_name; val = (caddr_t)es->st_value; if (ELF_ST_TYPE(es->st_info) == STT_GNU_IFUNC) val = ((caddr_t (*)(void))val)(); symval->value = val; symval->size = es->st_size; - return 0; + return (0); } - return ENOENT; + return (ENOENT); +} + +static int +link_elf_symbol_values(linker_file_t lf, c_linker_sym_t sym, + linker_symval_t *symval) +{ + return (link_elf_symbol_values1(lf, sym, symval, + link_elf_obj_leak_locals)); +} + +static int +link_elf_debug_symbol_values(linker_file_t lf, c_linker_sym_t sym, + linker_symval_t *symval) +{ + return (link_elf_symbol_values1(lf, sym, symval, true)); } static int link_elf_search_symbol(linker_file_t lf, caddr_t value, c_linker_sym_t *sym, long *diffp) { - elf_file_t ef = (elf_file_t) lf; - u_long off = (uintptr_t) (void *) value; + elf_file_t ef = (elf_file_t)lf; + u_long off = (uintptr_t)(void *)value; u_long diff = off; u_long st_value; const Elf_Sym *es; @@ -1480,7 +1528,7 @@ *diffp = diff; *sym = (c_linker_sym_t) best; - return 0; + return (0); } /* @@ -1779,25 +1827,21 @@ static long link_elf_symtab_get(linker_file_t lf, const Elf_Sym **symtab) { - elf_file_t ef = (elf_file_t)lf; - - *symtab = ef->ddbsymtab; - - if (*symtab == NULL) - return (0); + elf_file_t ef = (elf_file_t)lf; - return (ef->ddbsymcnt); + *symtab = ef->ddbsymtab; + if (*symtab == NULL) + return (0); + return (ef->ddbsymcnt); } static long link_elf_strtab_get(linker_file_t lf, caddr_t *strtab) { - elf_file_t ef = (elf_file_t)lf; - - *strtab = ef->ddbstrtab; - - if (*strtab == NULL) - return (0); + elf_file_t ef = (elf_file_t)lf; - return (ef->ddbstrcnt); + *strtab = ef->ddbstrtab; + if (*strtab == NULL) + return (0); + return (ef->ddbstrcnt); } diff --git a/sys/kern/linker_if.m b/sys/kern/linker_if.m --- a/sys/kern/linker_if.m +++ b/sys/kern/linker_if.m @@ -40,12 +40,24 @@ c_linker_sym_t* symp; }; +METHOD int lookup_debug_symbol { + linker_file_t file; + const char* name; + c_linker_sym_t* symp; +}; + METHOD int symbol_values { linker_file_t file; c_linker_sym_t sym; linker_symval_t* valp; }; +METHOD int debug_symbol_values { + linker_file_t file; + c_linker_sym_t sym; + linker_symval_t* valp; +}; + METHOD int search_symbol { linker_file_t file; caddr_t value; diff --git a/sys/modules/aic7xxx/ahc/Makefile b/sys/modules/aic7xxx/ahc/Makefile --- a/sys/modules/aic7xxx/ahc/Makefile +++ b/sys/modules/aic7xxx/ahc/Makefile @@ -52,4 +52,6 @@ CLEANFILES= ${GENSRCS} .endif +EXPORT_SYMS= YES + .include diff --git a/sys/modules/alq/Makefile b/sys/modules/alq/Makefile --- a/sys/modules/alq/Makefile +++ b/sys/modules/alq/Makefile @@ -4,4 +4,6 @@ KMOD= alq SRCS= opt_mac.h vnode_if.h kern_alq.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/amdsmn/Makefile b/sys/modules/amdsmn/Makefile --- a/sys/modules/amdsmn/Makefile +++ b/sys/modules/amdsmn/Makefile @@ -5,4 +5,6 @@ KMOD= amdsmn SRCS= amdsmn.c bus_if.h device_if.h pci_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/amr/Makefile b/sys/modules/amr/Makefile --- a/sys/modules/amr/Makefile +++ b/sys/modules/amr/Makefile @@ -16,4 +16,6 @@ # Debugging #CFLAGS+= -DAMR_DEBUG=3 +EXPORT_SYMS= YES + .include diff --git a/sys/modules/ata/atacore/Makefile b/sys/modules/ata/atacore/Makefile --- a/sys/modules/ata/atacore/Makefile +++ b/sys/modules/ata/atacore/Makefile @@ -6,4 +6,6 @@ SRCS= ata-all.c ata_if.c ata-lowlevel.c SRCS+= ata_if.h bus_if.h device_if.h opt_cam.h pci_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/ata/atapci/Makefile b/sys/modules/ata/atapci/Makefile --- a/sys/modules/ata/atapci/Makefile +++ b/sys/modules/ata/atapci/Makefile @@ -8,4 +8,6 @@ SRCS= ata-pci.c ata-dma.c ata-sata.c SRCS+= ata_if.h bus_if.h device_if.h pci_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/ata/atapci/chipsets/atasiliconimage/Makefile b/sys/modules/ata/atapci/chipsets/atasiliconimage/Makefile --- a/sys/modules/ata/atapci/chipsets/atasiliconimage/Makefile +++ b/sys/modules/ata/atapci/chipsets/atasiliconimage/Makefile @@ -6,4 +6,6 @@ SRCS= ata-siliconimage.c SRCS+= ata_if.h bus_if.h device_if.h pci_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/ath_hal/Makefile b/sys/modules/ath_hal/Makefile --- a/sys/modules/ath_hal/Makefile +++ b/sys/modules/ath_hal/Makefile @@ -44,4 +44,6 @@ .include +EXPORT_SYMS= YES + CWARNFLAGS.ah_regdomain.c= ${NO_WSHIFT_COUNT_NEGATIVE} ${NO_WSHIFT_COUNT_OVERFLOW} diff --git a/sys/modules/backlight/Makefile b/sys/modules/backlight/Makefile --- a/sys/modules/backlight/Makefile +++ b/sys/modules/backlight/Makefile @@ -10,4 +10,6 @@ backlight_if.h \ backlight_if.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/bhnd/Makefile b/sys/modules/bhnd/Makefile --- a/sys/modules/bhnd/Makefile +++ b/sys/modules/bhnd/Makefile @@ -22,7 +22,7 @@ SRCS+= bhnd_sprom_chipc.c \ bhnd_pmu_chipc.c - + SRCS+= bhnd_pwrctl.c \ bhnd_pwrctl_subr.c \ bhnd_pwrctl_if.c \ @@ -71,5 +71,7 @@ siba \ siba_bhndb +EXPORT_SYMS= YES + .include .include diff --git a/sys/modules/bhnd/bhndb/Makefile b/sys/modules/bhnd/bhndb/Makefile --- a/sys/modules/bhnd/bhndb/Makefile +++ b/sys/modules/bhnd/bhndb/Makefile @@ -15,4 +15,6 @@ SRCS+= device_if.h bus_if.h pci_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/bridgestp/Makefile b/sys/modules/bridgestp/Makefile --- a/sys/modules/bridgestp/Makefile +++ b/sys/modules/bridgestp/Makefile @@ -5,4 +5,6 @@ KMOD= bridgestp SRCS= bridgestp.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/ctl/Makefile b/sys/modules/ctl/Makefile --- a/sys/modules/ctl/Makefile +++ b/sys/modules/ctl/Makefile @@ -28,4 +28,6 @@ MFILES= kern/bus_if.m kern/device_if.m +EXPORT_SYMS= YES + .include diff --git a/sys/modules/cxgbe/if_cxgbe/Makefile b/sys/modules/cxgbe/if_cxgbe/Makefile --- a/sys/modules/cxgbe/if_cxgbe/Makefile +++ b/sys/modules/cxgbe/if_cxgbe/Makefile @@ -44,4 +44,6 @@ CFLAGS+= -I${CXGBE} +EXPORT_SYMS= YES + .include diff --git a/sys/modules/dcons/Makefile b/sys/modules/dcons/Makefile --- a/sys/modules/dcons/Makefile +++ b/sys/modules/dcons/Makefile @@ -17,4 +17,6 @@ CFLAGS+= -I${SRCTOP}/sys +EXPORT_SYMS= YES + .include diff --git a/sys/modules/efirt/Makefile b/sys/modules/efirt/Makefile --- a/sys/modules/efirt/Makefile +++ b/sys/modules/efirt/Makefile @@ -17,4 +17,6 @@ ${.IMPSRC} -o ${.TARGET} .endif +EXPORT_SYMS= YES + .include diff --git a/sys/modules/evdev/Makefile b/sys/modules/evdev/Makefile --- a/sys/modules/evdev/Makefile +++ b/sys/modules/evdev/Makefile @@ -6,4 +6,6 @@ SRCS= cdev.c evdev.c evdev_mt.c evdev_utils.c SRCS+= opt_evdev.h bus_if.h device_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/exca/Makefile b/sys/modules/exca/Makefile --- a/sys/modules/exca/Makefile +++ b/sys/modules/exca/Makefile @@ -5,4 +5,6 @@ KMOD= exca SRCS= exca.c device_if.h bus_if.h power_if.h card_if.h pccarddevs.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/firewire/firewire/Makefile b/sys/modules/firewire/firewire/Makefile --- a/sys/modules/firewire/firewire/Makefile +++ b/sys/modules/firewire/firewire/Makefile @@ -11,4 +11,6 @@ iec13213.h iec68113.h \ fwcrom.c fwdev.c fwmem.c fwmem.h fwdma.c fwdma.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/firmware/Makefile b/sys/modules/firmware/Makefile --- a/sys/modules/firmware/Makefile +++ b/sys/modules/firmware/Makefile @@ -5,4 +5,6 @@ KMOD= firmware SRCS= subr_firmware.c vnode_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/geom/geom_flashmap/Makefile b/sys/modules/geom/geom_flashmap/Makefile --- a/sys/modules/geom/geom_flashmap/Makefile +++ b/sys/modules/geom/geom_flashmap/Makefile @@ -5,4 +5,6 @@ KMOD= geom_flashmap SRCS= geom_flashmap.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/gpio/gpiobus/Makefile b/sys/modules/gpio/gpiobus/Makefile --- a/sys/modules/gpio/gpiobus/Makefile +++ b/sys/modules/gpio/gpiobus/Makefile @@ -42,4 +42,6 @@ CFLAGS+= -I. -I${SRCTOP}/sys/dev/gpio/ +EXPORT_SYMS= YES + .include diff --git a/sys/modules/hid/hconf/Makefile b/sys/modules/hid/hconf/Makefile --- a/sys/modules/hid/hconf/Makefile +++ b/sys/modules/hid/hconf/Makefile @@ -7,4 +7,6 @@ SRCS+= opt_hid.h SRCS+= bus_if.h device_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/hid/hid/Makefile b/sys/modules/hid/hid/Makefile --- a/sys/modules/hid/hid/Makefile +++ b/sys/modules/hid/hid/Makefile @@ -7,4 +7,6 @@ SRCS+= opt_hid.h SRCS+= bus_if.h device_if.h hid_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/hid/hidbus/Makefile b/sys/modules/hid/hidbus/Makefile --- a/sys/modules/hid/hidbus/Makefile +++ b/sys/modules/hid/hidbus/Makefile @@ -6,4 +6,6 @@ SRCS= hidbus.c SRCS+= bus_if.h device_if.h hid_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/hid/hidmap/Makefile b/sys/modules/hid/hidmap/Makefile --- a/sys/modules/hid/hidmap/Makefile +++ b/sys/modules/hid/hidmap/Makefile @@ -7,4 +7,6 @@ SRCS+= opt_hid.h SRCS+= bus_if.h device_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/hyperv/vmbus/Makefile b/sys/modules/hyperv/vmbus/Makefile --- a/sys/modules/hyperv/vmbus/Makefile +++ b/sys/modules/hyperv/vmbus/Makefile @@ -35,4 +35,6 @@ CFLAGS+= -I${SRCTOP}/sys/dev/hyperv/include \ -I${SRCTOP}/sys/dev/hyperv/vmbus +EXPORT_SYMS= YES + .include diff --git a/sys/modules/i2c/iicbb/Makefile b/sys/modules/i2c/iicbb/Makefile --- a/sys/modules/i2c/iicbb/Makefile +++ b/sys/modules/i2c/iicbb/Makefile @@ -10,4 +10,6 @@ SRCS = device_if.h bus_if.h iicbus_if.h \ iicbb_if.h iicbb_if.c iicbb.c ${ofw_bus_if} opt_platform.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/i2c/iicbus/Makefile b/sys/modules/i2c/iicbus/Makefile --- a/sys/modules/i2c/iicbus/Makefile +++ b/sys/modules/i2c/iicbus/Makefile @@ -24,4 +24,6 @@ SRCS+= ofw_iicbus.c ofw_bus_if.h .endif +EXPORT_SYMS= YES + .include diff --git a/sys/modules/i2c/mux/iicmux/Makefile b/sys/modules/i2c/mux/iicmux/Makefile --- a/sys/modules/i2c/mux/iicmux/Makefile +++ b/sys/modules/i2c/mux/iicmux/Makefile @@ -16,4 +16,6 @@ SRCS+= ofw_bus_if.h .endif +EXPORT_SYMS= YES + .include diff --git a/sys/modules/i2c/smbus/Makefile b/sys/modules/i2c/smbus/Makefile --- a/sys/modules/i2c/smbus/Makefile +++ b/sys/modules/i2c/smbus/Makefile @@ -5,4 +5,6 @@ SRCS = device_if.h bus_if.h smbus_if.h smbus_if.c \ smbconf.h smbconf.c smbus.h smbus.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/ibcore/Makefile b/sys/modules/ibcore/Makefile --- a/sys/modules/ibcore/Makefile +++ b/sys/modules/ibcore/Makefile @@ -52,6 +52,8 @@ CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include CFLAGS+= -DINET6 -DINET -DCONFIG_INFINIBAND_USER_MEM +EXPORT_SYMS= YES + .include CWARNFLAGS+= -Wno-cast-qual -Wno-pointer-arith -Wno-redundant-decls diff --git a/sys/modules/if_gif/Makefile b/sys/modules/if_gif/Makefile --- a/sys/modules/if_gif/Makefile +++ b/sys/modules/if_gif/Makefile @@ -10,4 +10,6 @@ SRCS.INET=in_gif.c SRCS.INET6=in6_gif.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/if_infiniband/Makefile b/sys/modules/if_infiniband/Makefile --- a/sys/modules/if_infiniband/Makefile +++ b/sys/modules/if_infiniband/Makefile @@ -7,4 +7,6 @@ opt_inet.h \ opt_inet6.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/iflib/Makefile b/sys/modules/iflib/Makefile --- a/sys/modules/iflib/Makefile +++ b/sys/modules/iflib/Makefile @@ -11,4 +11,6 @@ SRCS+= device_if.h bus_if.h pci_if.h pci_iov_if.h ifdi_if.h SRCS+= opt_acpi.h opt_inet.h opt_inet6.h opt_sched.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/ipfw/Makefile b/sys/modules/ipfw/Makefile --- a/sys/modules/ipfw/Makefile +++ b/sys/modules/ipfw/Makefile @@ -19,4 +19,6 @@ #CFLAGS+= -DIPFIREWALL_DEFAULT_TO_ACCEPT # +EXPORT_SYMS= YES + .include diff --git a/sys/modules/iscsi/Makefile b/sys/modules/iscsi/Makefile --- a/sys/modules/iscsi/Makefile +++ b/sys/modules/iscsi/Makefile @@ -22,4 +22,6 @@ MFILES= kern/bus_if.m kern/device_if.m dev/iscsi/icl_conn_if.m +EXPORT_SYMS= YES + .include diff --git a/sys/modules/ixl/Makefile b/sys/modules/ixl/Makefile --- a/sys/modules/ixl/Makefile +++ b/sys/modules/ixl/Makefile @@ -22,4 +22,6 @@ # CFLAGS += -DIXL_IW # SRCS += ixl_iw.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/kgssapi/Makefile b/sys/modules/kgssapi/Makefile --- a/sys/modules/kgssapi/Makefile +++ b/sys/modules/kgssapi/Makefile @@ -51,4 +51,6 @@ gssd_clnt.c: $S/kgssapi/gssd.x RPCGEN_CPP=${CPP:Q} rpcgen -lM $S/kgssapi/gssd.x | grep -v string.h > gssd_clnt.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/krpc/Makefile b/sys/modules/krpc/Makefile --- a/sys/modules/krpc/Makefile +++ b/sys/modules/krpc/Makefile @@ -55,4 +55,6 @@ rpctlssd_clnt.c: $S/rpc/rpcsec_tls/rpctlssd.x RPCGEN_CPP=${CPP:Q} rpcgen -lM $S/rpc/rpcsec_tls/rpctlssd.x | grep -v string.h > rpctlssd_clnt.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/libalias/libalias/Makefile b/sys/modules/libalias/libalias/Makefile --- a/sys/modules/libalias/libalias/Makefile +++ b/sys/modules/libalias/libalias/Makefile @@ -5,4 +5,6 @@ KMOD= libalias SRCS= alias.c alias_db.c alias_proxy.c alias_util.c alias_mod.c alias_sctp.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/linux/Makefile b/sys/modules/linux/Makefile --- a/sys/modules/linux/Makefile +++ b/sys/modules/linux/Makefile @@ -113,4 +113,6 @@ .warning Building Linuxulator outside of a kernel does not make sense .endif +EXPORT_SYMS= YES + .include diff --git a/sys/modules/linux64/Makefile b/sys/modules/linux64/Makefile --- a/sys/modules/linux64/Makefile +++ b/sys/modules/linux64/Makefile @@ -85,4 +85,6 @@ .warning Building Linuxulator outside of a kernel does not make sense .endif +EXPORT_SYMS= YES + .include diff --git a/sys/modules/linux_common/Makefile b/sys/modules/linux_common/Makefile --- a/sys/modules/linux_common/Makefile +++ b/sys/modules/linux_common/Makefile @@ -9,8 +9,6 @@ EXPORT_SYMS= EXPORT_SYMS+= linux_emul_path -EXPORT_SYMS+= linux_ioctl_register_handler -EXPORT_SYMS+= linux_ioctl_unregister_handler EXPORT_SYMS+= linux_get_osname EXPORT_SYMS+= linux_get_osrelease @@ -18,4 +16,6 @@ .warning Building Linuxulator outside of a kernel does not make sense .endif +EXPORT_SYMS= YES + .include diff --git a/sys/modules/linuxkpi/Makefile b/sys/modules/linuxkpi/Makefile --- a/sys/modules/linuxkpi/Makefile +++ b/sys/modules/linuxkpi/Makefile @@ -39,4 +39,6 @@ CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include +EXPORT_SYMS= YES + .include diff --git a/sys/modules/mfi/Makefile b/sys/modules/mfi/Makefile --- a/sys/modules/mfi/Makefile +++ b/sys/modules/mfi/Makefile @@ -15,4 +15,6 @@ #CFLAGS += -DMFI_DEBUG +EXPORT_SYMS= YES + .include diff --git a/sys/modules/mii/Makefile b/sys/modules/mii/Makefile --- a/sys/modules/mii/Makefile +++ b/sys/modules/mii/Makefile @@ -13,12 +13,6 @@ SRCS+= ukphy.c ukphy_subr.c SRCS+= xmphy.c -EXPORT_SYMS= mii_attach \ - mii_bitbang_readreg \ - mii_bitbang_sync \ - mii_bitbang_writereg \ - mii_mediachg \ - mii_pollstat \ - mii_tick +EXPORT_SYMS= YES .include diff --git a/sys/modules/mlx4/Makefile b/sys/modules/mlx4/Makefile --- a/sys/modules/mlx4/Makefile +++ b/sys/modules/mlx4/Makefile @@ -30,6 +30,8 @@ CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include +EXPORT_SYMS= YES + .include CFLAGS+= -Wno-cast-qual -Wno-pointer-arith diff --git a/sys/modules/mlx5/Makefile b/sys/modules/mlx5/Makefile --- a/sys/modules/mlx5/Makefile +++ b/sys/modules/mlx5/Makefile @@ -51,6 +51,8 @@ mlx5fpga_ipsec.c .endif +EXPORT_SYMS= YES + .include CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} diff --git a/sys/modules/mlxfw/Makefile b/sys/modules/mlxfw/Makefile --- a/sys/modules/mlxfw/Makefile +++ b/sys/modules/mlxfw/Makefile @@ -15,4 +15,6 @@ -I${SRCTOP}/sys/contrib/xz-embedded/freebsd \ -I${SRCTOP}/sys/contrib/xz-embedded/linux/lib/xz +EXPORT_SYMS= YES + .include diff --git a/sys/modules/netgraph/atm/atmbase/Makefile b/sys/modules/netgraph/atm/atmbase/Makefile --- a/sys/modules/netgraph/atm/atmbase/Makefile +++ b/sys/modules/netgraph/atm/atmbase/Makefile @@ -15,4 +15,6 @@ CFLAGS+= -I${LIBBASE} # -DNGATM_DEBUG +EXPORT_SYMS= YES + .include diff --git a/sys/modules/netgraph/bluetooth/bluetooth/Makefile b/sys/modules/netgraph/bluetooth/bluetooth/Makefile --- a/sys/modules/netgraph/bluetooth/bluetooth/Makefile +++ b/sys/modules/netgraph/bluetooth/bluetooth/Makefile @@ -8,4 +8,6 @@ KMOD= ng_bluetooth SRCS= ng_bluetooth.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/netgraph/bluetooth/socket/Makefile b/sys/modules/netgraph/bluetooth/socket/Makefile --- a/sys/modules/netgraph/bluetooth/socket/Makefile +++ b/sys/modules/netgraph/bluetooth/socket/Makefile @@ -13,4 +13,6 @@ ng_btsocket_rfcomm.c \ ng_btsocket_sco.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/netgraph/netgraph/Makefile b/sys/modules/netgraph/netgraph/Makefile --- a/sys/modules/netgraph/netgraph/Makefile +++ b/sys/modules/netgraph/netgraph/Makefile @@ -4,4 +4,6 @@ KMOD= netgraph SRCS= ng_base.c ng_parse.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/nfscommon/Makefile b/sys/modules/nfscommon/Makefile --- a/sys/modules/nfscommon/Makefile +++ b/sys/modules/nfscommon/Makefile @@ -14,4 +14,6 @@ opt_nfs.h \ opt_ufs.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/nfssvc/Makefile b/sys/modules/nfssvc/Makefile --- a/sys/modules/nfssvc/Makefile +++ b/sys/modules/nfssvc/Makefile @@ -5,4 +5,6 @@ SRCS= nfs_nfssvc.c \ opt_nfs.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/ntb/ntb/Makefile b/sys/modules/ntb/ntb/Makefile --- a/sys/modules/ntb/ntb/Makefile +++ b/sys/modules/ntb/ntb/Makefile @@ -6,4 +6,6 @@ SRCS = ntb.c ntb_if.c SRCS += device_if.h bus_if.h ntb_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/ntb/ntb_transport/Makefile b/sys/modules/ntb/ntb_transport/Makefile --- a/sys/modules/ntb/ntb_transport/Makefile +++ b/sys/modules/ntb/ntb_transport/Makefile @@ -6,4 +6,6 @@ SRCS = ntb_transport.c SRCS += device_if.h bus_if.h ntb_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/nvme/Makefile b/sys/modules/nvme/Makefile --- a/sys/modules/nvme/Makefile +++ b/sys/modules/nvme/Makefile @@ -23,4 +23,6 @@ opt_nvme.h \ pci_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/ow/owc/Makefile b/sys/modules/ow/owc/Makefile --- a/sys/modules/ow/owc/Makefile +++ b/sys/modules/ow/owc/Makefile @@ -7,4 +7,6 @@ SRCS+= gpio_if.h gpiobus_if.h owll_if.h ofw_bus_if.h bus_if.h device_if.h SRCS+= opt_platform.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/pf/Makefile b/sys/modules/pf/Makefile --- a/sys/modules/pf/Makefile +++ b/sys/modules/pf/Makefile @@ -23,4 +23,6 @@ .endif .endif +EXPORT_SYMS= YES + .include diff --git a/sys/modules/ppbus/Makefile b/sys/modules/ppbus/Makefile --- a/sys/modules/ppbus/Makefile +++ b/sys/modules/ppbus/Makefile @@ -7,7 +7,7 @@ opt_ppb_1284.h \ ppb_1284.c ppb_base.c ppb_msq.c ppbconf.c -EXPORT_SYMS= ppb_attach_device \ +EXPORT_SYMS= \ ppb_request_bus \ ppb_release_bus \ ppb_get_status \ @@ -17,6 +17,9 @@ ppb_get_epp_protocol \ ppb_set_mode \ ppb_get_mode \ - ppb_write + ppb_write \ + ppb_lock + +EXPORT_SYMS= YES .include diff --git a/sys/modules/procfs/Makefile b/sys/modules/procfs/Makefile --- a/sys/modules/procfs/Makefile +++ b/sys/modules/procfs/Makefile @@ -18,11 +18,11 @@ SRCS+= procfs.c EXPORT_SYMS= -EXPORT_SYMS+= procfs_attr EXPORT_SYMS+= procfs_candebug EXPORT_SYMS+= procfs_docurproc EXPORT_SYMS+= procfs_doprocfile EXPORT_SYMS+= procfs_doprocmem EXPORT_SYMS+= procfs_notsystem +EXPORT_SYMS+= procfs_attr_rw .include diff --git a/sys/modules/pseudofs/Makefile b/sys/modules/pseudofs/Makefile --- a/sys/modules/pseudofs/Makefile +++ b/sys/modules/pseudofs/Makefile @@ -10,7 +10,8 @@ pseudofs_vncache.c \ pseudofs_vnops.c -EXPORT_SYMS= pfs_mount \ +EXPORT_SYMS= pfs_cmount \ + pfs_mount \ pfs_unmount \ pfs_root \ pfs_statfs \ @@ -19,8 +20,6 @@ pfs_create_dir \ pfs_create_file \ pfs_create_link \ - pfs_disable \ - pfs_enable \ pfs_destroy .if !defined(KERNBUILDDIR) diff --git a/sys/modules/pwm/pwmbus/Makefile b/sys/modules/pwm/pwmbus/Makefile --- a/sys/modules/pwm/pwmbus/Makefile +++ b/sys/modules/pwm/pwmbus/Makefile @@ -17,4 +17,6 @@ pwmbus_if.c \ pwmbus_if.h \ +EXPORT_SYMS= YES + .include diff --git a/sys/modules/rc4/Makefile b/sys/modules/rc4/Makefile --- a/sys/modules/rc4/Makefile +++ b/sys/modules/rc4/Makefile @@ -5,4 +5,6 @@ KMOD= rc4 SRCS= rc4.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/rtwn/Makefile b/sys/modules/rtwn/Makefile --- a/sys/modules/rtwn/Makefile +++ b/sys/modules/rtwn/Makefile @@ -47,4 +47,6 @@ @echo "#define RTWN_WITHOUT_UCODE 1" >> ${.TARGET} .endif +EXPORT_SYMS= YES + .include diff --git a/sys/modules/sdhci/Makefile b/sys/modules/sdhci/Makefile --- a/sys/modules/sdhci/Makefile +++ b/sys/modules/sdhci/Makefile @@ -5,4 +5,6 @@ KMOD= sdhci SRCS= sdhci.c sdhci.h sdhci_if.c sdhci_if.h device_if.h bus_if.h mmcbr_if.h opt_mmccam.h opt_cam.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/sound/driver/sbc/Makefile b/sys/modules/sound/driver/sbc/Makefile --- a/sys/modules/sound/driver/sbc/Makefile +++ b/sys/modules/sound/driver/sbc/Makefile @@ -6,4 +6,6 @@ SRCS= device_if.h bus_if.h isa_if.h pci_if.h SRCS+= sbc.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/sound/driver/spicds/Makefile b/sys/modules/sound/driver/spicds/Makefile --- a/sys/modules/sound/driver/spicds/Makefile +++ b/sys/modules/sound/driver/spicds/Makefile @@ -6,4 +6,6 @@ SRCS= device_if.h bus_if.h isa_if.h pci_if.h SRCS+= spicds.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/spi/spibus/Makefile b/sys/modules/spi/spibus/Makefile --- a/sys/modules/spi/spibus/Makefile +++ b/sys/modules/spi/spibus/Makefile @@ -17,4 +17,6 @@ spibus_if.c \ spibus_if.h \ +EXPORT_SYMS= YES + .include diff --git a/sys/modules/spigen/Makefile b/sys/modules/spigen/Makefile --- a/sys/modules/spigen/Makefile +++ b/sys/modules/spigen/Makefile @@ -16,4 +16,6 @@ SRCS+= ofw_bus_if.h .endif +EXPORT_SYMS= YES + .include diff --git a/sys/modules/superio/Makefile b/sys/modules/superio/Makefile --- a/sys/modules/superio/Makefile +++ b/sys/modules/superio/Makefile @@ -6,4 +6,6 @@ SRCS= superio.c SRCS+= device_if.h bus_if.h isa_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/sysvipc/sysvmsg/Makefile b/sys/modules/sysvipc/sysvmsg/Makefile --- a/sys/modules/sysvipc/sysvmsg/Makefile +++ b/sys/modules/sysvipc/sysvmsg/Makefile @@ -5,4 +5,6 @@ KMOD= sysvmsg SRCS= sysv_msg.c opt_sysvipc.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/sysvipc/sysvsem/Makefile b/sys/modules/sysvipc/sysvsem/Makefile --- a/sys/modules/sysvipc/sysvsem/Makefile +++ b/sys/modules/sysvipc/sysvsem/Makefile @@ -5,4 +5,6 @@ KMOD= sysvsem SRCS= sysv_sem.c opt_sysvipc.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/sysvipc/sysvshm/Makefile b/sys/modules/sysvipc/sysvshm/Makefile --- a/sys/modules/sysvipc/sysvshm/Makefile +++ b/sys/modules/sysvipc/sysvshm/Makefile @@ -5,4 +5,6 @@ KMOD= sysvshm SRCS= sysv_shm.c opt_sysvipc.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/toecore/Makefile b/sys/modules/toecore/Makefile --- a/sys/modules/toecore/Makefile +++ b/sys/modules/toecore/Makefile @@ -6,4 +6,6 @@ SRCS= toecore.c SRCS+= opt_ofed.h opt_inet.h opt_inet6.h opt_kern_tls.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/ufs/Makefile b/sys/modules/ufs/Makefile --- a/sys/modules/ufs/Makefile +++ b/sys/modules/ufs/Makefile @@ -14,4 +14,6 @@ CFLAGS+= -DSOFTUPDATES -DUFS_DIRHASH .endif +EXPORT_SYMS= YES + .include diff --git a/sys/modules/usb/ucom/Makefile b/sys/modules/usb/ucom/Makefile --- a/sys/modules/usb/ucom/Makefile +++ b/sys/modules/usb/ucom/Makefile @@ -33,4 +33,6 @@ SRCS= opt_bus.h opt_usb.h opt_gdb.h device_if.h bus_if.h usb_if.h usbdevs.h \ usb_serial.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/usb/uether/Makefile b/sys/modules/usb/uether/Makefile --- a/sys/modules/usb/uether/Makefile +++ b/sys/modules/usb/uether/Makefile @@ -34,4 +34,6 @@ miibus_if.h opt_inet.h \ usb_ethernet.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/usb/uhid/Makefile b/sys/modules/usb/uhid/Makefile --- a/sys/modules/usb/uhid/Makefile +++ b/sys/modules/usb/uhid/Makefile @@ -33,4 +33,6 @@ SRCS= opt_bus.h opt_hid.h opt_usb.h device_if.h bus_if.h usb_if.h \ vnode_if.h usbdevs.h uhid.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/usb/usb/Makefile b/sys/modules/usb/usb/Makefile --- a/sys/modules/usb/usb/Makefile +++ b/sys/modules/usb/usb/Makefile @@ -41,4 +41,6 @@ SRCS+= usb_fdt_support.c ofw_bus_if.h .endif +EXPORT_SYMS= YES + .include diff --git a/sys/modules/virtio/virtio/Makefile b/sys/modules/virtio/virtio/Makefile --- a/sys/modules/virtio/virtio/Makefile +++ b/sys/modules/virtio/virtio/Makefile @@ -32,4 +32,6 @@ SRCS+= virtio_if.c virtio_if.h SRCS+= bus_if.h device_if.h +EXPORT_SYMS= YES + .include diff --git a/sys/modules/wlan/Makefile b/sys/modules/wlan/Makefile --- a/sys/modules/wlan/Makefile +++ b/sys/modules/wlan/Makefile @@ -16,6 +16,8 @@ SRCS+= bus_if.h device_if.h opt_ddb.h opt_inet.h opt_inet6.h \ opt_tdma.h opt_wlan.h +EXPORT_SYMS= YES + .include CWARNFLAGS.ieee80211_adhoc.c= -Wno-unused-function diff --git a/sys/modules/xdr/Makefile b/sys/modules/xdr/Makefile --- a/sys/modules/xdr/Makefile +++ b/sys/modules/xdr/Makefile @@ -9,4 +9,6 @@ xdr_reference.c \ xdr_sizeof.c +EXPORT_SYMS= YES + .include diff --git a/sys/modules/xz/Makefile b/sys/modules/xz/Makefile --- a/sys/modules/xz/Makefile +++ b/sys/modules/xz/Makefile @@ -17,4 +17,6 @@ -I${SRCTOP}/sys/contrib/xz-embedded/linux/lib/xz \ -I${SRCTOP}/sys/contrib/xz-embedded/linux/include/linux +EXPORT_SYMS= YES + .include