Thanks for the response. I have read that and partially implemented it where it made sense for my use case. I'm think this is a different problem however.
I have already removed everything that isn't referenced, which is the main point of the article. The functions that are being called are referenced by the call so the linker can't remove them. It's just that the call is pointless. In the generated C the functions are marked as N_NOINLINE. I think that if they weren't, maybe the compiler would remove the call, but can't test that until lunch. Either way, removing calls that do nothing is a problem I expected Nim to be able to do. Another way to remove the call would be to have the setup calls be macros that expand to nothing if the call were unnecessary.
