From: Martin Str|mberg Message-Id: <200009131724.TAA23635@father.ludd.luth.se> Subject: (fwd) startup-code To: djgpp-workers AT delorie DOT com (DJGPP-WORKERS) Date: Wed, 13 Sep 2000 19:24:55 +0200 (MET DST) X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Christer Sandberg said on c.o.m.d: > Declaring a global identifier named 'end' will clatch with some > startup/exit function or data. Internal data should have underscore as prefix. > Program built from the following code will crash on exit. > int end[1000]; > int main(void) > { > memset(end, 0, sizeof(int)*1000) > return 0; > } I can confirm the problem. Digging in I find this in the output of "nm -a libc.a": dpmiexcp.o: 00001078 b .bss 00001014 d .data 00000000 t .text U __8087 ... 00001628 b _timer_ori 00000000 ? dpmiexcp.c U end U exception_stack 00000000 t gcc2_compiled. But I can't find any symbol "end" defined/declared (I don't know the assembly term) globally. How can this link at all? I also find an interesting tidbit in crt0.S: /* .lcomm __what_size_app_thinks_it_is, 4 */ .data __what_size_app_thinks_it_is: .long end Coincidence? (I don't think so.) So I try uncommenting this. No go. The symbol can't be found while linking symify. I've also tried substituting __what_size_app_thinks_it_is for end and vice versa. Looking for similar cases in the code of dpmiexcp.c I see it uses __djstack_limit. But I can't figure out where __djstack_limit is defined. Neither can I figure out why __djstack_limit can be found while __what_size_app_thinks_it_is can't. Assistance required. Right, MartinS