On Thu 17 Oct 2019 at 15:47:49 +0200, Rhialto wrote: > I can't really believe that this is the first package that actually uses > anything from libgcc.a in a shared library, either. It seems I'll have to believe it (with an additional restriction about c++), since some experiments show that "g++7 -shared" systematically leaves out the -lgcc option on its linker invocation (but l-gcc_s is still there). Is it intentional that g++7 leaves out -lgcc when given the -shared option? (My guess: no, because gcc7, g++5 and gcc5 behave differently.) Given a simple file c.c, I tried commands like below. (where P=/usr/pkg/gcc7/bin/) (I also tried a lot more with more options as used in the webkit link, but they turned out to make no difference) I paste just the linker command (ld or collect2) here. gcc --version gcc (nb3 20180905) 5.5.0 $P/gcc --version gcc (GCC) 7.4.0 $P/g++ -v -shared c.c (broken, no -lgcc in sight) /usr/pkg/gcc7/libexec/gcc/x86_64--netbsd/7.4.0/collect2 -plugin /usr/pkg/gcc7/libexec/gcc/x86_64--netbsd/7.4.0/liblto_plugin.so -plugin-opt=/usr/pkg/gcc7/libexec/gcc/x86_64--netbsd/7.4.0/lto-wrapper -plugin-opt=-fresolution=/var/tmp//ccp7djD6.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -shared /usr/lib/crti.o /usr/lib/crtbeginS.o -L/usr/pkg/gcc7/lib/gcc/x86_64--netbsd/7.4.0 -L/usr/pkg/gcc7/lib/gcc/x86_64--netbsd/7.4.0/../../../../x86_64--netbsd/lib -L/usr/pkg/gcc7/lib/gcc/x86_64--netbsd/7.4.0/../../.. -R/usr/pkg/gcc7/x86_64--netbsd/lib/. -R/usr/pkg/gcc7/lib/. /var/tmp//ccsSwDFY.o -lstdc++ -lm -lgcc_s -lc -lgcc_s /usr/lib/crtendS.o /usr/lib/crtn.o $P/g++ -v c.c (ok) /usr/pkg/gcc7/libexec/gcc/x86_64--netbsd/7.4.0/collect2 -plugin /usr/pkg/gcc7/libexec/gcc/x86_64--netbsd/7.4.0/liblto_plugin.so -plugin-opt=/usr/pkg/gcc7/libexec/gcc/x86_64--netbsd/7.4.0/lto-wrapper -plugin-opt=-fresolution=/var/tmp//ccScTJeZ.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -dc -dp -e _start -dynamic-linker /usr/libexec/ld.elf_so /usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/pkg/gcc7/lib/gcc/x86_64--netbsd/7.4.0 -L/usr/pkg/gcc7/lib/gcc/x86_64--netbsd/7.4.0/../../../../x86_64--netbsd/lib -L/usr/pkg/gcc7/lib/gcc/x86_64--netbsd/7.4.0/../../.. -R/usr/pkg/gcc7/x86_64--netbsd/lib/. -R/usr/pkg/gcc7/lib/. /var/tmp//ccMJSuAP.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/crtend.o /usr/lib/crtn.o $P/gcc -v -shared c.c (ok) /usr/pkg/gcc7/libexec/gcc/x86_64--netbsd/7.4.0/collect2 -plugin /usr/pkg/gcc7/libexec/gcc/x86_64--netbsd/7.4.0/liblto_plugin.so -plugin-opt=/usr/pkg/gcc7/libexec/gcc/x86_64--netbsd/7.4.0/lto-wrapper -plugin-opt=-fresolution=/var/tmp//cchJw4ZX.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -shared /usr/lib/crti.o /usr/lib/crtbeginS.o -L/usr/pkg/gcc7/lib/gcc/x86_64--netbsd/7.4.0 -L/usr/pkg/gcc7/lib/gcc/x86_64--netbsd/7.4.0/../../../../x86_64--netbsd/lib -L/usr/pkg/gcc7/lib/gcc/x86_64--netbsd/7.4.0/../../.. -R/usr/pkg/gcc7/x86_64--netbsd/lib/. -R/usr/pkg/gcc7/lib/. /var/tmp//ccjJAPgA.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtendS.o /usr/lib/crtn.o g++ -v -shared c.c (ok) d -plugin /usr/libexec/liblto_plugin.so -plugin-opt=/usr/libexec/lto-wrapper -plugin-opt=-fresolution=/var/tmp//ccvTvcEb.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -shared /usr/lib/crti.o /usr/lib/crtbeginS.o /var/tmp//ccx5Bf0b.o -lstdc++ -lm --as-needed -lgcc_s --no-as-needed -lgcc -lc --as-needed -lgcc_s --no-as-needed -lgcc /usr/lib/crtendS.o /usr/lib/crtn.o gcc -v -shared c.c (ok) ld -plugin /usr/libexec/liblto_plugin.so -plugin-opt=/usr/libexec/lto-wrapper -plugin-opt=-fresolution=/var/tmp//ccoA2F2I.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -shared /usr/lib/crti.o /usr/lib/crtbeginS.o /var/tmp//ccj7znNg.o --as-needed -lgcc_s --no-as-needed -lgcc -lc --as-needed -lgcc_s --no-as-needed -lgcc /usr/lib/crtendS.o /usr/lib/crtn.o -Olaf. -- Olaf 'Rhialto' Seibert -- rhialto at falu dot nl ___ Anyone who is capable of getting themselves made President should on \X/ no account be allowed to do the job. --Douglas Adams, "THGTTG"
Attachment:
signature.asc
Description: PGP signature