Normally, 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.
It 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.