https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39439
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- To clearify here, -shared and shared libraries in general accept undefined referneces while linking. You can change the behavior of that, if using GNU binutils, the option would be -Wl,--no-allow-shlib-undefined .