Don't try to call SYSUNINIT functions if there was a link error.

Reviewed by: Peter Wemm <peter@netplex.com.au>
This commit is contained in:
Doug Rabson 1999-01-25 08:42:24 +00:00
parent 0346639d07
commit 149a155c3b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=43185
5 changed files with 22 additions and 6 deletions

View file

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: kern_linker.c,v 1.21 1999/01/19 22:26:46 peter Exp $
* $Id: kern_linker.c,v 1.22 1999/01/23 03:45:22 peter Exp $
*/
#include "opt_ddb.h"
@ -355,6 +355,7 @@ linker_make_file(const char* pathname, void* priv, struct linker_file_ops* ops)
lf->refs = 1;
lf->userrefs = 0;
lf->flags = 0;
lf->filename = (char*) (lf + 1);
strcpy(lf->filename, filename);
lf->id = next_file_id++;
@ -410,7 +411,9 @@ linker_file_unload(linker_file_t file)
goto out;
}
linker_file_sysuninit(file);
/* Don't try to run SYSUNINITs if we are unloaded due to a link error */
if (file->flags & LINKER_FILE_LINKED)
linker_file_sysuninit(file);
TAILQ_REMOVE(&files, file, link);
lockmgr(&lock, LK_RELEASE, 0, curproc);

View file

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: link_aout.c,v 1.16 1998/11/03 14:25:21 peter Exp $
* $Id: link_aout.c,v 1.17 1998/11/04 15:20:57 peter Exp $
*/
#ifndef __alpha__
@ -115,6 +115,7 @@ link_aout_init(void* arg)
linker_kernel_file->address = (caddr_t) 0xf0100000;
linker_kernel_file->size = -0xf0100000;
linker_current_file = linker_kernel_file;
linker_kernel_file->flags |= LINKER_FILE_LINKED;
}
#endif
}
@ -171,6 +172,7 @@ link_aout_load_module(const char* filename, linker_file_t* result)
linker_file_unload(lf);
return(error);
}
lf->flags |= LINKER_FILE_LINKED;
*result = lf;
return(0);
}
@ -253,6 +255,7 @@ link_aout_load_file(const char* filename, linker_file_t* result)
goto out;
}
lf->flags |= LINKER_FILE_LINKED;
*result = lf;
out:

View file

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: link_elf.c,v 1.10 1998/11/06 15:16:07 peter Exp $
* $Id: link_elf.c,v 1.11 1998/12/31 09:17:20 peter Exp $
*/
#include <sys/param.h>
@ -175,6 +175,7 @@ link_elf_init(void* arg)
}
(void)parse_module_symbols(linker_kernel_file);
linker_current_file = linker_kernel_file;
linker_kernel_file->flags |= LINKER_FILE_LINKED;
}
#endif
}
@ -384,6 +385,7 @@ link_elf_load_module(const char *filename, linker_file_t *result)
return error;
}
(void)parse_module_symbols(lf);
lf->flags |= LINKER_FILE_LINKED;
*result = lf;
return (0);
}
@ -673,6 +675,8 @@ link_elf_load_file(const char* filename, linker_file_t* result)
ef->ddbstrcnt = strcnt;
ef->ddbstrtab = ef->strbase;
lf->flags |= LINKER_FILE_LINKED;
nosyms:
*result = lf;

View file

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: link_elf.c,v 1.10 1998/11/06 15:16:07 peter Exp $
* $Id: link_elf.c,v 1.11 1998/12/31 09:17:20 peter Exp $
*/
#include <sys/param.h>
@ -175,6 +175,7 @@ link_elf_init(void* arg)
}
(void)parse_module_symbols(linker_kernel_file);
linker_current_file = linker_kernel_file;
linker_kernel_file->flags |= LINKER_FILE_LINKED;
}
#endif
}
@ -384,6 +385,7 @@ link_elf_load_module(const char *filename, linker_file_t *result)
return error;
}
(void)parse_module_symbols(lf);
lf->flags |= LINKER_FILE_LINKED;
*result = lf;
return (0);
}
@ -673,6 +675,8 @@ link_elf_load_file(const char* filename, linker_file_t* result)
ef->ddbstrcnt = strcnt;
ef->ddbstrtab = ef->strbase;
lf->flags |= LINKER_FILE_LINKED;
nosyms:
*result = lf;

View file

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: linker.h,v 1.10 1998/11/04 15:20:58 peter Exp $
* $Id: linker.h,v 1.11 1998/11/11 13:04:40 peter Exp $
*/
#ifndef _SYS_LINKER_H_
@ -86,6 +86,8 @@ struct common_symbol {
struct linker_file {
int refs; /* reference count */
int userrefs; /* kldload(2) count */
int flags;
#define LINKER_FILE_LINKED 0x1 /* file has been fully linked */
TAILQ_ENTRY(linker_file) link; /* list of all loaded files */
char* filename; /* file which was loaded */
int id; /* unique id */