https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99896
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Tom de Vries from comment #2) > I don't understand. AFAICT, it's dropped. It's not moved to the end, > because -lc is already at the end without specifying -lc. OK, it's dropped because it's always present at the end. This is similar to adding -I/usr/include which gets ignored, because it's already going to be searched anyway as a system header directory. Quoting the manual: "If a standard system include directory, or a directory specified with -isystem, is also specified with -I, the -I option is ignored." > Um, for my understanding, does that mean you agree this is a bug in g++? No. > > Why is it needed there anyway though? > > main.o is intended to use regcomp from glibc. Foo.o is intended to use > pcre2_regcomp from pcre2-posix (which is also accessible using plain > regcomp). When -lc is droppend, regcomp from pcre2-posix is used by main > instead, which is incompatible with using re_search from glibc. Ohhh, this issue. It's clearly a bug in pcre2. Providing symbols with the same names as the ones in libc, but with different ABI, is madness.