1
/* remove.c -- remove an explicitly defined symbol. */
3
/* This file is part of DLD, a dynamic link/unlink editor for C.
5
Copyright (C) 1990 by W. Wilson Ho.
7
The author can be reached electronically by how@cs.ucdavis.edu or
8
through physical mail at:
11
Division of Computer Science
12
University of California at Davis
16
/* This program is free software; you can redistribute it and/or modify it
17
under the terms of the GNU General Public License as published by the
18
Free Software Foundation; either version 1, or (at your option) any
24
* remove a previously defined symbol defined by dld_define().
25
* If symbol is not defined by dld_fine, this function becomes no-op.
28
dld_remove_defined_symbol (name)
37
p = (char *) _dld_malloc (strlen(name) +2);
41
sp = _dld_getsym_soft (p);
44
if (sp->defined_by && sp->defined_by == _dld_dummy_entry) {
45
register struct file_chain *p = sp->referenced_by;
46
register struct file_chain *prev = 0;
49
if (p->entry->ref_count == 0) {
50
del_link_list_elt (sp->referenced_by, prev, p, next);
52
p->entry->undefined_symbol_count++;
57
if (sp->referenced_by) {
58
dld_undefined_sym_count++;
63
if (sp->defined == (N_COMM | N_EXT) && sp->value) {
65
if (sp->defined == (N_TYPE | N_EXT) && sp->value) {
67
free ((void *)sp->value);
74
if (sp->referenced_by) {
75
_dld_patch_all_files (_dld_latest_entry);
76
_dld_exec_flags_valid = 0;
80
} /* dld_remove_defined_symbol */