https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99896
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Tom de Vries from comment #0) > With g++, we have instead: > ... > collect2 ... main.o foo.o -lpcre2-posix ... > ... It isn't dropped, it's moved to the end: main.o foo.o -lpcre2-posix -lstdc++ -lm -lc -lgcc_s -lgcc -lc -lgcc_s -lgcc If you need it before foo.o then -Wl,-lc seems like the right workaround for me. Why is it needed there anyway though?