https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109389
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note for shared libraries it might the case the gcc you using defaults to passing --as-needed to the linker and the clang driver does not.