Skip to content

Incremental Linking

Michael Rawson edited this page Jul 12, 2023 · 1 revision

Re: gcc incremental linking

It there a way to make gcc link incrementally? It's extremely slow to have to recompile the entire lib or my entire application (which is 40mb once compiled) whenever I need to change one file. This means that if I make one change in my app, I have to wait 5 minutes for it to link. Is this how you all work?

Yes ;)

You might try to split your application into smaller parts, link them into shared objects (on linux for example there is not much difference between normal archives and shared objects) and use these to link your application.

This can work much faster than a full link.


http://www.math.utah.edu/docs/info/ld_2.html

look for -i (or, equivalently -r)


On true unixes, we could try using gold instead of ld (it's now part of binutils):

http://lwn.net/Articles/274859/

and apart from being faster on its own, it also supports incrementality:

https://gcc.gnu.org/wiki/GoldIncrementalLinking

Clone this wiki locally