If the compiler and/or linker don't strip unused symbols, then how on earth is importing the module _not_ going to pull in everything in it save for
uninitialized templates?

There are data that needs to be there, but is never symbolically referenced, for example, the exception handler tables. The compiler does the best it can, like emitting one object file per function, but it always must behave conservatively.

AFAIK, dmd used to remove unused modules but then bearophile complained that unittests are not run for imported but otherwise unused modules, so it looks like frontend's responsibility, not backend's.

Reply via email to