https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55781
Fangrui Song <maskray at google dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maskray at google dot com --- Comment #1 from Fangrui Song <maskray at google dot com> --- Still the case with gcc 9 % gcc a.o -static-libgcc -shared-libgcc '-###' |& grep -P --color '[-]lgcc\S+' ... -lgcc -lgcc_eh -lc -lgcc -lgcc_eh % g++ a.o -static-libgcc -shared-libgcc '-###' |& grep -P --color '[-]lgcc\S+' ... -lgcc -lgcc_eh -lc -lgcc -lgcc_eh That is probably because it is difficult to take the last argument of -static-libgcc and -shared-libgcc? % gcc -dumpspecs ... *libgcc: %{static|static-libgcc|static-pie:-lgcc -lgcc_eh}%{!static:%{!static-libgcc:%{!static-pie:%{!shared-libgcc:-lgcc --push-state --as-needed -lgcc_s --pop-state}%{shared-libgcc:-lgcc_s%{!shared: -lgcc}}}}}