Revert r284153, as I believe it breaks the dtrace sdt module. I will

fix the original issue a different way.
This commit is contained in:
John Baldwin 2015-06-08 18:06:00 +00:00
parent c2bc5b15eb
commit 15c2b30155

View File

@ -137,8 +137,6 @@ static int linker_file_add_dependency(linker_file_t file,
linker_file_t dep); linker_file_t dep);
static caddr_t linker_file_lookup_symbol_internal(linker_file_t file, static caddr_t linker_file_lookup_symbol_internal(linker_file_t file,
const char* name, int deps); const char* name, int deps);
static int linker_file_lookup_set_locked(linker_file_t file,
const char *name, void *firstp, void *lastp, int *countp);
static int linker_load_module(const char *kldname, static int linker_load_module(const char *kldname,
const char *modname, struct linker_file *parent, const char *modname, struct linker_file *parent,
const struct mod_depend *verinfo, struct linker_file **lfpp); const struct mod_depend *verinfo, struct linker_file **lfpp);
@ -191,8 +189,7 @@ linker_file_sysinit(linker_file_t lf)
sx_assert(&kld_sx, SA_XLOCKED); sx_assert(&kld_sx, SA_XLOCKED);
if (linker_file_lookup_set_locked(lf, "sysinit_set", &start, &stop, if (linker_file_lookup_set(lf, "sysinit_set", &start, &stop, NULL) != 0)
NULL) != 0)
return; return;
/* /*
* Perform a bubble sort of the system initialization objects by * Perform a bubble sort of the system initialization objects by
@ -240,7 +237,7 @@ linker_file_sysuninit(linker_file_t lf)
sx_assert(&kld_sx, SA_XLOCKED); sx_assert(&kld_sx, SA_XLOCKED);
if (linker_file_lookup_set_locked(lf, "sysuninit_set", &start, &stop, if (linker_file_lookup_set(lf, "sysuninit_set", &start, &stop,
NULL) != 0) NULL) != 0)
return; return;
@ -291,8 +288,7 @@ linker_file_register_sysctls(linker_file_t lf)
sx_assert(&kld_sx, SA_XLOCKED); sx_assert(&kld_sx, SA_XLOCKED);
if (linker_file_lookup_set_locked(lf, "sysctl_set", &start, &stop, if (linker_file_lookup_set(lf, "sysctl_set", &start, &stop, NULL) != 0)
NULL) != 0)
return; return;
sx_xunlock(&kld_sx); sx_xunlock(&kld_sx);
@ -313,8 +309,7 @@ linker_file_unregister_sysctls(linker_file_t lf)
sx_assert(&kld_sx, SA_XLOCKED); sx_assert(&kld_sx, SA_XLOCKED);
if (linker_file_lookup_set_locked(lf, "sysctl_set", &start, &stop, if (linker_file_lookup_set(lf, "sysctl_set", &start, &stop, NULL) != 0)
NULL) != 0)
return; return;
sx_xunlock(&kld_sx); sx_xunlock(&kld_sx);
@ -337,7 +332,7 @@ linker_file_register_modules(linker_file_t lf)
sx_assert(&kld_sx, SA_XLOCKED); sx_assert(&kld_sx, SA_XLOCKED);
if (linker_file_lookup_set_locked(lf, "modmetadata_set", &start, if (linker_file_lookup_set(lf, "modmetadata_set", &start,
&stop, NULL) != 0) { &stop, NULL) != 0) {
/* /*
* This fallback should be unnecessary, but if we get booted * This fallback should be unnecessary, but if we get booted
@ -747,8 +742,8 @@ linker_file_add_dependency(linker_file_t file, linker_file_t dep)
* This function is used in this file so we can avoid having lots of (void **) * This function is used in this file so we can avoid having lots of (void **)
* casts. * casts.
*/ */
static int int
linker_file_lookup_set_locked(linker_file_t file, const char *name, linker_file_lookup_set(linker_file_t file, const char *name,
void *firstp, void *lastp, int *countp) void *firstp, void *lastp, int *countp)
{ {
@ -756,19 +751,6 @@ linker_file_lookup_set_locked(linker_file_t file, const char *name,
return (LINKER_LOOKUP_SET(file, name, firstp, lastp, countp)); return (LINKER_LOOKUP_SET(file, name, firstp, lastp, countp));
} }
int
linker_file_lookup_set(linker_file_t file, const char *name,
void *firstp, void *lastp, int *countp)
{
int error;
sx_slock(&kld_sx);
error = linker_file_lookup_set_locked(file, name, firstp, lastp,
countp);
sx_sunlock(&kld_sx);
return (error);
}
/* /*
* List all functions in a file. * List all functions in a file.
*/ */
@ -1487,8 +1469,8 @@ linker_preload(void *arg)
/* /*
* First get a list of stuff in the kernel. * First get a list of stuff in the kernel.
*/ */
if (linker_file_lookup_set_locked(linker_kernel_file, MDT_SETNAME, if (linker_file_lookup_set(linker_kernel_file, MDT_SETNAME, &start,
&start, &stop, NULL) == 0) &stop, NULL) == 0)
linker_addmodules(linker_kernel_file, start, stop, 1); linker_addmodules(linker_kernel_file, start, stop, 1);
/* /*
@ -1497,7 +1479,7 @@ linker_preload(void *arg)
*/ */
restart: restart:
TAILQ_FOREACH(lf, &loaded_files, loaded) { TAILQ_FOREACH(lf, &loaded_files, loaded) {
error = linker_file_lookup_set_locked(lf, MDT_SETNAME, &start, error = linker_file_lookup_set(lf, MDT_SETNAME, &start,
&stop, NULL); &stop, NULL);
/* /*
* First, look to see if we would successfully link with this * First, look to see if we would successfully link with this
@ -1591,7 +1573,7 @@ linker_preload(void *arg)
panic("cannot add dependency"); panic("cannot add dependency");
} }
lf->userrefs++; /* so we can (try to) kldunload it */ lf->userrefs++; /* so we can (try to) kldunload it */
error = linker_file_lookup_set_locked(lf, MDT_SETNAME, &start, error = linker_file_lookup_set(lf, MDT_SETNAME, &start,
&stop, NULL); &stop, NULL);
if (!error) { if (!error) {
for (mdp = start; mdp < stop; mdp++) { for (mdp = start; mdp < stop; mdp++) {
@ -1628,7 +1610,7 @@ linker_preload(void *arg)
goto fail; goto fail;
} }
linker_file_register_modules(lf); linker_file_register_modules(lf);
if (linker_file_lookup_set_locked(lf, "sysinit_set", &si_start, if (linker_file_lookup_set(lf, "sysinit_set", &si_start,
&si_stop, NULL) == 0) &si_stop, NULL) == 0)
sysinit_add(si_start, si_stop); sysinit_add(si_start, si_stop);
linker_file_register_sysctls(lf); linker_file_register_sysctls(lf);
@ -2060,7 +2042,7 @@ linker_load_dependencies(linker_file_t lf)
if (error) if (error)
return (error); return (error);
} }
if (linker_file_lookup_set_locked(lf, MDT_SETNAME, &start, &stop, if (linker_file_lookup_set(lf, MDT_SETNAME, &start, &stop,
&count) != 0) &count) != 0)
return (0); return (0);
for (mdp = start; mdp < stop; mdp++) { for (mdp = start; mdp < stop; mdp++) {