Dead code culling at link time.

Post Reply
jacotton
Member
Posts: 89
Joined: Fri Nov 24, 2017 1:35 am

Dead code culling at link time.

Post by jacotton »

This is an advanced issue (I think anyway), but is there a plan afoot to perform dead
code culling at link time.

I ask since my code is getting rather large and I have not figured out a good way to clean
out routines that are not in fact being used.

On the surface it seems easy enough, just scan the binary and look for call/jumps to code
that is listed in the globals section.

Well any way, is someone thinking about such a thing ?

jc
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

It?s on Paulo?s wish list for the next gen version of z80asm: https://github.com/z88dk/z80asm/wiki

If you rearrange your project to one function per file and create a library then it?s feasible now, just a little awkward to manage.

Alternatively you could do it manually by compiling to object files, using z80nm and then manually excluding code.
Post Reply