From: "Ullrich von Bassewitz"; on Tuesday, July 07, 2009; at 11:50 AM -0400 > > On Tue, Jul 07, 2009 at 04:59:49PM +0200, Jakub wrote: > > Test 2: > > cc65 -T -Osir --cpu 6502 -t atari test.c > > ca65 -l -t atari test.s > > ld65 -t atari test.o atari.lib -o test2.xex > > ld65.exe: Warning: [builtin config](15): Segment `EXEHDR' does not exist > > ld65.exe: Warning: [builtin config](25): Segment `AUTOSTRT' does not exist > > You are not linking the start-up code into the executable. > > > What is strange, after adding function call without a prototype > > (which generates warning), it works: > > > > #include <stdio.h> > > int main(void) > > { > > printf("Test\n"); > > exit(0); // <- without a prototype. xex file is generated fine! > > return 0; > > } > > That's not really strange: The exit() function is a part of the start-up > code [because, returning from main() is like calling exit()]. So, when > calling exit(), you actually do generate a dependency to the start-up > code, and the linker will include it. That, in turn, fixes the above error > messages. That reminds me of an idea: When the C compiler sees the definition of main(), it inserts a ".forceimport" line into its assembly-code output if that main() has parameters. I think that it will be useful for the compiler to generate another ".forceimport" line when it sees main() { }: .forceimport _exit That will ensure that the start-up code is linked when it is needed -- we won't need to remember to link the start-up file. In fact, we won't need a _separate_ file; the copy of it that is inside the library file will be enough. If you accept that idea, then it must be put on your "to-do" list because it needs STARTUP segment support (to guarantee where the code is put). Some of the targets do not have that segment -- yet. ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Tue Jul 14 19:40:08 2009
This archive was generated by hypermail 2.1.8 : 2009-07-14 19:40:10 CEST