diff options
author | H.J. Lu <hjl@gnu.org> | 1999-02-27 22:21:58 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1999-02-27 15:21:58 -0700 |
commit | 8f08ea1e474635cfba9093c0698960d33a9ef549 (patch) | |
tree | be7ee5618d4e11bd2a665ea02e2211cb4ec1f20d /gcc/crtstuff.c | |
parent | b78abfe951cc9e460ff3eb07202344d04c5e4cca (diff) | |
download | gcc-8f08ea1e474635cfba9093c0698960d33a9ef549.zip gcc-8f08ea1e474635cfba9093c0698960d33a9ef549.tar.gz gcc-8f08ea1e474635cfba9093c0698960d33a9ef549.tar.bz2 |
frame.h: Update some comments.
* frame.h: Update some comments.
* defaults.h (TARGET_ATTRIBUTE_WEAK): Define.
* crtstuff.c (__register_frame_info, __deregister_frame_info): Declare
using TARGET_WEAK_ATTRIBUTE.
(__do_global_dtors_aux): Check if __deregister_frame_info is
zero before calling it.
(__do_global_dtors): Likewise.
(frame_dummy): Check if __register_frame_info is zero before
calling it.
(__frame_dummy): Likewise.
Co-Authored-By: Jeffrey A Law <law@cygnus.com>
From-SVN: r25487
Diffstat (limited to 'gcc/crtstuff.c')
-rw-r--r-- | gcc/crtstuff.c | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c index ce2c956..b7a482a 100644 --- a/gcc/crtstuff.c +++ b/gcc/crtstuff.c @@ -56,6 +56,34 @@ Boston, MA 02111-1307, USA. */ #include <stddef.h> #include "frame.h" +/* We do not want to add the weak attribute to the declarations of these + routines in frame.h because that will cause the definition of these + symbols to be weak as well. + + This exposes a core issue, how to handle creating weak references vs + how to create weak definitions. Either we have to have the definition + of TARGET_WEAK_ATTRIBUTE be conditional in the shared header files or + have a second declaration if we want a function's references to be weak, + but not its definition. + + Making TARGET_WEAK_ATTRIBUTE conditional seems like a good solution until + one thinks about scaling to larger problems -- ie, the condition under + which TARGET_WEAK_ATTRIBUTE is active will eventually get far too + complicated. + + So, we take an approach similar to #pragma weak -- we have a second + declaration for functions that we want to have weak references. + + Neither way is particularly good. */ + +/* References to __register_frame_info and __deregister_frame_info should + be weak in this file if at all possible. */ +extern void __register_frame_info (void *, struct object *) + TARGET_ATTRIBUTE_WEAK; + +extern void *__deregister_frame_info (void *) + TARGET_ATTRIBUTE_WEAK; + #ifndef OBJECT_FORMAT_MACHO /* Provide default definitions for the pseudo-ops used to switch to the @@ -144,7 +172,8 @@ __do_global_dtors_aux () } #ifdef EH_FRAME_SECTION_ASM_OP - __deregister_frame_info (__EH_FRAME_BEGIN__); + if (__deregister_frame_info) + __deregister_frame_info (__EH_FRAME_BEGIN__); #endif completed = 1; } @@ -172,7 +201,8 @@ static void frame_dummy () { static struct object object; - __register_frame_info (__EH_FRAME_BEGIN__, &object); + if (__register_frame_info) + __register_frame_info (__EH_FRAME_BEGIN__, &object); } static void __attribute__ ((__unused__)) @@ -256,7 +286,8 @@ __do_global_dtors () (*p) (); #ifdef EH_FRAME_SECTION_ASM_OP - __deregister_frame_info (__EH_FRAME_BEGIN__); + if (__deregister_frame_info) + __deregister_frame_info (__EH_FRAME_BEGIN__); #endif } @@ -268,7 +299,8 @@ void __frame_dummy () { static struct object object; - __register_frame_info (__EH_FRAME_BEGIN__, &object); + if (__register_frame_info) + __register_frame_info (__EH_FRAME_BEGIN__, &object); } #endif #endif |