https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103764
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- >g++ main.cpp -shared -O3 -fPIC -L$PWD -lfoo Should be: g++ main.cpp -O3 -fPIC -L$PWD -lfoo Once I remove the -shared the program works as expected. The problem is -shared creates a shared library and all and does not create an executable. I think binutils is changing that behavior so that a shared library will actually print out a better error message. Anyways this is not a GCC bug either way.