crtstuff.c change is bad for (at least) OpenServer
Robert Lipe
robertl@dgii.com
Mon Jan 19 02:25:00 GMT 1998
I can't figure out of this is actually a bug or not, but I've partially
analyzed a one line change that EGCS just inherited from 2.8.0 that kills
COFF code generation on OpenServer dead. I've cc'ed Richard in hopes
he can further comment becuase I think this change was his on Dec. 23.
crtstuff.c has recently started to look like this:
before we start to execute any of the user's code. */
static void
__do_global_ctors_aux () /* prologue goes in .text section */
{
asm (INIT_SECTION_ASM_OP);
DO_GLOBAL_CTORS_BODY;
ON_EXIT (__do_global_dtors, 0);
#ifdef FORCE_INIT_SECTION_ALIGN
FORCE_INIT_SECTION_ALIGN;
#endif
// robertl This next line is the one that does us in.
asm (TEXT_SECTION_ASM_OP);
} /* epilogue and body go in .init section */
#endif /* OBJECT_FORMAT_ELF */
#else /* defined(INIT_SECTION_ASM_OP) */
Once we get past preprocessing when we're doing the stamp-crtS thang
for COFF, we get a .s that looks like this:
__gnu_compiled_c:
.text
.align 4
__do_global_ctors_aux:
pushl %ebp
movl %esp,%ebp
pushl %ebx
/APP
.section .init ,"x"
/NO_APP
movl %esp,%ebx
cmpl $0,(%esp)
je .L3
.align 4
.L8:
movl (%ebx),%eax
addl $4,%ebx
call *%eax
cmpl $0,(%ebx)
jne .L8
.L3:
/APP
.text
/NO_APP
movl -4(%ebp),%ebx
movl %ebp,%esp
popl %ebp
ret
The /APP stuff correlates with the commented out entry in the above
source.
Citing the comment that is above this code:
Note that we use some tricks here to get *just* the body and just
a function epilogue (but no function prologue) into the .init
section of the crtend.o file. Specifically, we switch to the .text
With this one line change, our epilogue is no longer in .init. It's in
.text.
Can someone that understands this change please comment if it really
was intentional? If it was, does it really contradict that comment
or do I misunderstand? If it doesn't and this really is a target-
specifc thing (doubt it, but I'll defer), how can I resolve this in
a target-specific way?
Richard, if this really wasn't the plan, can it please be addressed in
the GCC 2.8.1 branch?
Thanx.
--
Robert Lipe http://www.dgii.com/people/robertl robertl@dgii.com
More information about the Gcc
mailing list