Re: [cc65] Segment EXEHDR does not exist - while using ld65 directly

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2009-07-07 17:50:02
Hi!

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 startup code to 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 part of the startup code
(because returning from main() is like calling exit()). So when calling
exit(), you do actually generate a dependency to the startup code and the
linker will include it. This in turn fixes above error messages.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
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 7 17:52:13 2009

This archive was generated by hypermail 2.1.8 : 2009-07-07 17:52:16 CEST