summaryrefslogtreecommitdiffstats
path: root/lib/csu
diff options
context:
space:
mode:
Diffstat (limited to 'lib/csu')
-rw-r--r--lib/csu/i386/c++rt0.c10
-rw-r--r--lib/csu/i386/crt0.c10
2 files changed, 16 insertions, 4 deletions
diff --git a/lib/csu/i386/c++rt0.c b/lib/csu/i386/c++rt0.c
index df85907..aa28109 100644
--- a/lib/csu/i386/c++rt0.c
+++ b/lib/csu/i386/c++rt0.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: c++rt0.c,v 1.1 1994/03/09 17:12:59 nate Exp $
+ * $Id: c++rt0.c,v 1.2 1995/05/30 05:39:36 rgrimes Exp $
*/
/*
@@ -61,6 +61,7 @@ __ctors(void)
}
extern void __init() asm(".init");
+extern void __fini() asm(".fini");
void
__init(void)
@@ -74,7 +75,12 @@ __init(void)
if (!initialized) {
initialized = 1;
__ctors();
- atexit(__dtors);
}
}
+
+void
+__fini(void)
+{
+ __dtors();
+}
diff --git a/lib/csu/i386/crt0.c b/lib/csu/i386/crt0.c
index f6f0759..7959e66 100644
--- a/lib/csu/i386/crt0.c
+++ b/lib/csu/i386/crt0.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: crt0.c,v 1.15 1995/02/07 13:27:29 jkh Exp $
+ * $Id: crt0.c,v 1.16 1995/02/24 07:51:13 phk Exp $
*/
@@ -194,6 +194,7 @@ __do_dynamic_link ()
struct exec hdr;
char *ldso;
int (*entry)();
+ int ret;
#ifdef DEBUG
/* Provision for alternate ld.so - security risk! */
@@ -259,11 +260,16 @@ __do_dynamic_link ()
crt.crt_prog = __progname;
entry = (int (*)())(crt.crt_ba + sizeof hdr);
- if ((*entry)(CRT_VERSION_BSD_3, &crt) == -1) {
+ ret = (*entry)(CRT_VERSION_BSD_3, &crt);
+ if (ret == -1) {
_FATAL("ld.so failed\n");
}
ld_entry = _DYNAMIC.d_entry;
+
+ if (ret >= LDSO_VERSION_HAS_DLEXIT)
+ atexit(ld_entry->dlexit);
+
return;
}
OpenPOWER on IntegriCloud