Message-Id: <199908171505.PAA97176@out4.ibm.net> From: "Mark E." To: djgpp-workers AT delorie DOT com Date: Tue, 17 Aug 1999 11:05:47 -0400 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: crtbegin.o and crtend.o X-mailer: Pegasus Mail for Win32 (v3.11) Reply-To: djgpp-workers AT delorie DOT com Greetings, Several folks have said recently and in the past that using gcc's crtbegin.o and crtend.o would be "a good thing". I agree, and for the past several days I've been working on getting crtbegin.o and crtend.o to work with DJGPP and today I succeeded. Making crt*.o work with DJGPP will require some changes in libc. However, these changes allow the current method of initializeing EH and of calling 'constructors' and 'destructors' to continue working for as long as neccessary. I'll send the GCC folks the patch to fix up crt*.o for DJGPP as soon as have time to generate the patch and write the ChangeLog. I'm not up on my x86 assembly, so my crt0.S may not be as efficient as it could be. BTW, the current crt0.S used spaces instead of tabs where it was patched initialize C++ EH. *** src/libc/crt0/crt0.S.orig Wed Aug 11 02:24:36 1999 --- src/libc/crt0/crt0.S Tue Aug 17 10:59:34 1999 *************** use_stubinfo_stack_size: *** 293,302 **** movl %eax, %esp xorl %ebp, %ebp ! pushl $_frame_struct ! pushl $_CRT0_EH_FRAME_BEGIN_ ! call ___register_frame_info ! addl $8, %esp call ___crt1_startup /* run program */ jmp exit --- 293,307 ---- movl %eax, %esp xorl %ebp, %ebp ! movl gcc_init, %eax ! movl gcc_init_end, %ecx ! cmpl %eax, %ecx ! jne call_crt1_startup ! pushl $_frame_struct ! pushl $_CRT0_EH_FRAME_BEGIN_ ! call ___register_frame_info ! addl $8, %esp ! call_crt1_startup: call ___crt1_startup /* run program */ jmp exit *** src/libc/crt0/_main.c.orig Fri Nov 24 21:06:58 1995 --- src/libc/crt0/_main.c Tue Aug 17 10:55:24 1999 *************** *** 1,3 **** --- 1,4 ---- + /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include #include *************** *** 5,10 **** --- 6,13 ---- typedef void (*FUNC)(void); extern FUNC djgpp_first_ctor[] __asm__("djgpp_first_ctor"); extern FUNC djgpp_last_ctor[] __asm__("djgpp_last_ctor"); + extern FUNC gcc_init __asm__("gcc_init"); + extern FUNC gcc_init_end __asm__("gcc_init_end"); void __main(void) *************** __main(void) *** 14,19 **** if (been_there_done_that == __bss_count) return; been_there_done_that = __bss_count; ! for (i=0; i