Speaking about C and C++ on Linux, I have an impression that the compilers seldom can decide that the whole functions aren't used, especially because most libraries and programs "export" "everything" by default, so only on run-time it can be decided what will be actually used -- the last linking step happens only when you start the program, by the loader.
Yeah, isn't this just link-time optimization?
It's called dead code elimination/optimization and compilers can do it without LTO, with LTO you can can get more savings but ymmv.
The original comment pointed out "entry points", so I assumed that they were talking about libraries rather than standard dead code elimination (which has been a thing for quite some time).