Re: [cc65] Splitting crt0.s files in two?

From: Ullrich von Bassewitz <>
Date: 2009-11-05 22:22:01
On Thu, Nov 05, 2009 at 10:05:56AM -0800, Fatih Ayg√ľn wrote:
> If the library contained a simple binary header, forced to be linked in by the default config,
> which in turn looks for a start label, forcing the c initialization to be linked in, unless the
> label is already defined, it would be much easier:

I see your point, but there are two problems with it: First, a linker config
cannot force an object module to be linked. I've evaluated this when the
startup code moved into the library, but dismissed it, because the
implementation was too much work. Second, you cannot use the same config for C
programs and assembler programs, because the config for C programs contains
more segments. It would be possible to make these segments optional, but this
would in turn mean that there are no error messages if the segments are
missing because of a real error.

So a possible implementation would need a separate config for assembler
programs. A user who wants to use this config and the header from the library
would also need to add "-u __HEADER__" or whatever to the linker command line
to force the header module linked in, and he must know that the header
references a symbol named "startup" or whatever and that this symbol is called
when the program starts.

While I've already agreed that additional linker config files for assembly
programs may be an addition worth thinking about, I cannot see the advantage
of separating the header. Even I would have to lookup both things mentioned
above (using -u and the startup symbol) several times in the docs. And given
that, isn't it easier to just copy the header to your assembler source?

> > In addition, you
> > will have to tell the linker to add the header from the library. All this
> > together is probably too much for any casual ca65 user.
> No. The default config file will tell that. And changing the binary format will be a simple matter of
> using an alternative linker config.

Exactly this is not possible - see above.

> I was referring to a bootable disk image, a disk image without any file system in it.

Ok. But this is probably not what a newcomer will start with.

I know that the ca65/ld65 combo is powerful, but difficult to master for new
users. But I don't see how separating the header from the C startup code can
help here.



Ullrich von Bassewitz                        
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Nov 5 22:24:05 2009

This archive was generated by hypermail 2.1.8 : 2009-11-05 22:24:06 CET