diff options
author | wood <wood@138bc75d-0d04-0410-961f-82ee72b054a4> | 1992-03-19 20:41:45 +0000 |
---|---|---|
committer | wood <wood@138bc75d-0d04-0410-961f-82ee72b054a4> | 1992-03-19 20:41:45 +0000 |
commit | b13ae905989939875f841b96cbf34b0e11fac4e2 (patch) | |
tree | 835f283d52c10e4198adffd60d81eb776bc62c10 /gcc/crtstuff.c | |
parent | 30e4ba0e6d406fc4edc0b180dda4afacc84462a1 (diff) | |
download | gcc-b13ae905989939875f841b96cbf34b0e11fac4e2.tar.gz |
*** empty log message ***
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@526 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/crtstuff.c')
-rw-r--r-- | gcc/crtstuff.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c index e1f5934f305..a13fbf20ba8 100644 --- a/gcc/crtstuff.c +++ b/gcc/crtstuff.c @@ -69,8 +69,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef INIT_SECTION_ASM_OP -/* Force cc1 to switch to .text section. */ -static void force_to_text () { } +/* The function __do_global_ctors_aux is compiled twice (once in crtbegin.o + and once in crtend.o). It must be declared static to aviod a link + error. Here, we define __do_global_ctors as an externally callable + function. It is externally callable so that __main can invoke it when + INVOKE__main is defined. This has the additional effect of forcing cc1 + to switch to the .text section. */ +void __do_global_ctors () { __do_global_ctors_aux (); } asm (INIT_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */ @@ -90,7 +95,7 @@ asm (INIT_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */ file-scope static-storage C++ objects within shared libraries. */ static void -__do_global_ctors () /* prologue goes in .init section */ +__do_global_ctors_aux () /* prologue goes in .init section */ { asm (TEXT_SECTION_ASM_OP); /* don't put epilogue and body in .init */ DO_GLOBAL_CTORS_BODY; @@ -104,11 +109,19 @@ static func_ptr force_to_data[0] = { }; /* The -1 is a flag to __do_global_[cd]tors indicating that this table does not start with a count of elements. */ +#ifdef CTOR_LIST_BEGIN +CTOR_LIST_BEGIN; +#else asm (CTORS_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */ func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }; +#endif +#ifdef DTOR_LIST_BEGIN +DTOR_LIST_BEGIN; +#else asm (DTORS_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */ func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) }; +#endif #endif /* defined(CRT_BEGIN) */ @@ -129,7 +142,7 @@ func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) }; */ static void -__do_global_ctors () /* prologue goes in .text section */ +__do_global_ctors_aux () /* prologue goes in .text section */ { asm (INIT_SECTION_ASM_OP); DO_GLOBAL_CTORS_BODY; @@ -141,10 +154,18 @@ __do_global_ctors () /* prologue goes in .text section */ /* Force cc1 to switch to .data section. */ static func_ptr force_to_data[0] = { }; +#ifdef CTOR_LIST_END +CTOR_LIST_END; +#else asm (CTORS_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */ func_ptr __CTOR_END__[1] = { (func_ptr) 0 }; +#endif +#ifdef DTOR_LIST_END +DTOR_LIST_END; +#else asm (DTORS_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */ func_ptr __DTOR_END__[1] = { (func_ptr) 0 }; +#endif #endif /* defined(CRT_END) */ |