Jump to content
IGNORED

Trying to link too many objects


Recommended Posts

Hey guys,

 

I've done some makefile upgrading so I have sprite-sheets automatically sliced up and converted into objects. This caused me to end up with a lot of objects (each sprite a separate object), which had me end up with the 'too many objects' error when linking with CL65.

 

Is there a way to merge the objects together before linking them? I was hoping to avoid rewriting the makefile so I have the sprpck sprite output files compiled into one object file, but all searches seem to point into that direction since I can't find any documentation on it. (I believe gcc would have something along the lines of -r/-relocatable).

 

Cheers!

Edited by EvilActivity
Link to comment
Share on other sites

The way to handle this is to write the objects into a file.

 

In my Makefile every directory participating in the game creates a list of object files like this

 

 

all: $(objects)
        $(TOUCH) objlist
        $(RM) objlist
        for obj in $(objects); do $(ECHO) ../intro/$$obj >> objlist; done

 

In the linking phase I then use something like this:

 

others = \
        @../resident/objlist \
        @../bitmaps/objlist \
        @../shaken/objlist \
        @../sounds/objlist \
        @../intro/objlist \
        @../driving/objlist \
 
all: $(target)

$(target) : $(objects) $(objlists)
        $(CL) -t $(SYS) -o $@ -m lynx.map -C lynx.cfg $(objects) $(others) lynx.lib

 

This is one way to get arount the limitation of too many object files. Another way is to add them to your own library.

Link to comment
Share on other sites

That doesn't seem to do the trick for me:

 

 


d:/Projects/Lynx/CC65/bin/cl65 -t lynx -o game.lnx lynx.lib @obj/objlist
ld65: Error: Too many input files

 

There are 334 object files in the obj/objlist btw.

I'll try it with a library instead :-)

Edited by EvilActivity
Link to comment
Share on other sites

It seems that the linker can't find my sprite data when I put it in a library. Is there something special I need to do before the sprites within a library can be detected?

 

The library is created through "ar65 a sprite.lib sprite.o", while the linker is called with: "cl65 -t lynx -o game.lnx lynx.lib sprite.lib <extra-.lib/.o> game.o".

 

The sprites are created as they are in LX.NET's tutorial, an assembly file created that contains:

.global _sprite
.segment "RODATA"
_sprite: .incbin "sprite.spr"
Which is then assembled into an object with "ca65 -t lynx -o sprite.o sprite.s"
But in the end I get the unresolved external reference:

Unresolved external `_sprite' referenced in:
  game.s(36)
ld65: Error: 1 unresolved external(s) found - cannot create output file

 

Link to comment
Share on other sites

The linking order may be important. Put the sprites,lib after game.o

 

You could also try to split the @objlist files into two separate entries like @objlist1 @objlist2. There may be some internal line count limits that cause problems.

Link to comment
Share on other sites

The linking order may be important. Put the sprites,lib after game.o

 

You could also try to split the @objlist files into two separate entries like @objlist1 @objlist2. There may be some internal line count limits that cause problems.

 

Oh wow, the order did matter indeed. I thought putting them in front of the object that needs it would make more sense than putting it after it. Thanks karri!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...