https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108462
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- OK, so after fixing that I see /tmp/install/lib/gcc/x86_64-pc-linux-gnu/13.0.1/collect2 -plugin /tmp/install/lib/gcc/x86_64-pc-linux-gnu/13.0.1/liblto_plugin.so -plugin-opt=/tmp/install/lib/gcc/x86_64-pc-linux-gnu/13.0.1/lto-wrapper -plugin-opt=-fresolution=/tmp/cchKWOsJ.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lc -m elf_i386 -static /usr/lib/../lib/crt1.o /usr/lib/../lib/crti.o /tmp/install/lib64/gcc/x86_64-pc-linux-gnu/13.0.1/32/crtbeginT.o -L/tmp/install/lib64/gcc/x86_64-pc-linux-gnu/13.0.1/32/m2/m2iso -L/tmp/install/lib64/gcc/x86_64-pc-linux-gnu/13.0.1/32/m2/m2pim -L/tmp/install/lib64/gcc/x86_64-pc-linux-gnu/13.0.1/32 -L/tmp/install/lib64/gcc/x86_64-pc-linux-gnu/13.0.1/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/tmp/install/lib64/gcc/x86_64-pc-linux-gnu/13.0.1 -L/tmp/install/lib64/gcc/x86_64-pc-linux-gnu/13.0.1/../../.. /tmp/cc2HjFtG.o -lm2iso -lm2pim -lstdc++ -lm -lpthread --start-group -lgcc -lgcc_eh -lc --end-group /tmp/install/lib64/gcc/x86_64-pc-linux-gnu/13.0.1/32/crtend.o /usr/lib/../lib/crtn.o that means we search both install locations so we could drop either copy. Dropping the static lib in the m2/m2*/ directories would allow to prune the library search path as far as I understand (and the shared libs are in different paths anyway, with --enable-version-specific-runtime-libs they are in the place of the other static lib copy). The advantage of keeping the m2/m2*/ copy is that for the regular install the static libs would not clobber the main install location but then toolexeclib_LTLIBRARIES = libm2cor.la doesn't really support having two different locations for the static/shared lib parts. I'm going to first fix the mistake done by r13-5284-ge61d43791e0943