Link time subst

NOT FINISHED!
Don't merge this with master!!