Browse Source

Hide __atexit and __atexit_register_cleanup()

Wrap __cxa_{atexit,finalize}() so the call from exit() goes direct
Switch regress/lib/libc/atexit/ to be built with -static so that it can
still access __atexit*
ok millert@ jca@
OPENBSD_5_9
guenther 8 years ago
parent
commit
545241c6f9
2 changed files with 9 additions and 2 deletions
  1. +3
    -1
      src/lib/libc/stdlib/atexit.c
  2. +6
    -1
      src/lib/libc/stdlib/atexit.h

+ 3
- 1
src/lib/libc/stdlib/atexit.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: atexit.c,v 1.21 2015/04/07 01:27:07 guenther Exp $ */
/* $OpenBSD: atexit.c,v 1.22 2015/10/25 18:01:24 guenther Exp $ */
/*
* Copyright (c) 2002 Daniel Hartmeier
* All rights reserved.
@ -103,6 +103,7 @@ unlock:
_ATEXIT_UNLOCK();
return (ret);
}
DEF_STRONG(__cxa_atexit);
/*
* Call all handlers registered with __cxa_atexit() for the shared
@ -180,6 +181,7 @@ restart:
}
}
DEF_STRONG(__cxa_finalize);
/*
* Register the cleanup function


+ 6
- 1
src/lib/libc/stdlib/atexit.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: atexit.h,v 1.9 2014/06/18 19:01:10 kettenis Exp $ */
/* $OpenBSD: atexit.h,v 1.10 2015/10/25 18:01:24 guenther Exp $ */
/*
* Copyright (c) 2002 Daniel Hartmeier
@ -41,7 +41,12 @@ struct atexit {
} fns[1]; /* the table itself */
};
__BEGIN_HIDDEN_DECLS
extern struct atexit *__atexit; /* points to head of LIFO stack */
__END_HIDDEN_DECLS
int __cxa_atexit(void (*)(void *), void *, void *);
void __cxa_finalize(void *);
PROTO_NORMAL(__cxa_atexit);
PROTO_NORMAL(__cxa_finalize);

Loading…
Cancel
Save