3 ms·
Should the linker not throw away dead code?
by FnuGk 10y ago
Should the linker not throw away dead code?
- phaedrus 10y agoIt depends on the linker and the command line options to the compiler and the linker. I was surprised to find out that, e.g., GCC, has this off by default and you have to pass options to enable it.
- Peaker 10y agoNormally, if you use archive (.a) files, then any .o files within them that are not needed, are thrown away. But that is at .o file granularity. There's no per-symbol dead code elimination. And if you provide a list of .o files (no .a files) then it doesn't throw away anything at all.