https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117630
--- Comment #17 from R. Diez <rdiez-2006 at rd10 dot de> --- > > I haven't found any way to make the linker say why it is pulling certain > > symbols or object files. > > That sounds like the GNU linker "-y" option (as in "-y symbol"). Does that > not DTRT? That option didn't help me the last time I tried. Like I said, I think that some other file, like "gcc-14.2.0/libstdc++-v3/src/c++11/cow-stdexcept.cc", is referencing some other symbol in file system_error.cc . Just by pulling system_error.cc into the link process, the Linker pulls in those static instances which happen to live in that file. Because those instances have non-trivial constructors and/or destructors, the corresponding constructors and/or destructors are registered as globals for that file. Even though nothing else uses those static instances, the reference inside the related constructors or destructors is enough to make them seem "used" and prevent them from being discarded. The effect is described here: Bug 117673 - unused static object with just allocation in constructor and free in destructor is not removed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117673 I would need a more powerful linker option or linker report to navigate the dependencies, so that I can tell what symbol pulled a particular C++ module, and inspect some sort of dependency graph with all symbols in that file.