External linkage does not help and just encourages sloppy dependencies and can lead to weird issues when there are name collisions.
Strictly speaking this is not a true deduplication; the test output will be slightly different (due to inconsistent print statements) but I think this is close enough.