Re: [cc65] Specifying segment for library code?

From: Oliver Schmidt <ol.sc1web.de>
Date: 2012-06-03 01:15:46
Hi,

>> > That is possible with an intermediate step. Use the linker to create your main
>> > program. Use some perl magic to retrieve all identifiers from the map file and
>> > generate an asm file with "name := value" pairs. Then assemble and link this
>> > object file to the overlays. As a result, the overlays will use functions in
>> > the main program, if they are already there, and have their own copies of
>> > everything else.
>>
>> As far as I understand that approach would link strncmp into the main
>> program and allow to use it from the overlay _too_. The question here
>> was to have it linked into the overlay _only_.
>
> No. If the function is in the main module, the overlays will use that one. If
> it is not, the linker will link the library function to the overlay(s).

Okay, the original question was:

"For example,  if I have an overlay that uses strncmp, but the main
program doesn't, it would be nice to be able to tell the linker to
link strncmp to the overlay and not to the main program."

Why does one need any special "magic" to do that? I don't see so. Just
linking the overlay against the C library.

>> The (more usual) scenario of linking all library stuff needed by any
>> overlay into main can easily archived by by linking the main and all
>> overlays in one single linker "session" as shown in the overlay sample
>> contained in the last cc65 release

> That may be a common scenario, but as far as I understand it it is different
> from what he asked for.

For sure - but as far as I can see we both extended the original
question - just in the opposite direction, didn't we?

>> (but not the present in the current snapshot !).
>
> Why that? Anything I should know but don't remember?

Because you added the "%o.ovl" feature to the linker I asked you for
and I commited to create generic overlay linker configs for the CBMs,
Apple and Atatri using it instead of the "fixed" example. But I didn't
do so by now :-(

Regards,
Oliver
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Jun 3 01:16:00 2012

This archive was generated by hypermail 2.1.8 : 2012-06-03 01:16:03 CEST