Re: [cc65] Secondary linker configurations

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2009-09-25 20:22:02
Hi!

On Fri, Sep 25, 2009 at 05:20:28PM +0200, Oliver Schmidt wrote:
> Would it be feasable to have "extra libs" instead of "extra objects":
> Libs to be placed on the ld65 cmdline before the "normal" target lib,
> containing alternative implementations of certain functions.
>
> Wouldn't that already solve Groepaz' usecase while still keeping the
> paradigm of "the" C- / runtime-library of the "normal" case ?!?

No, that won't work. 

Assume that your module uses cprintf, which uses putchar to output characters.
A new library replaces putchar, and is named first on the command line. The
old library contains both, cprintf and putchar. The linker knows that it needs
a function named cprintf. It searches in the new library first, but won't find
it. The new library does also contain putchar, but until now, this wasn't
referenced. The linker will then open the old library, search for cprintf and
find it. It sees that cprintf needs putchar, which is currently undefined, so
it searches the old library again, and will find the old implementation.

The difference between this scenaria and an object file for putchar is, that
the latter is always linked in. So when cprintf is found, putchar is no longer
undefined, but known, because it was in an object file encountered before.

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 Fri Sep 25 20:24:36 2009

This archive was generated by hypermail 2.1.8 : 2009-09-25 20:24:39 CEST