ar segfaults when using a plugin from /usr/lib/bfd-plugins that is a symlink. Here is how to reproduce: echo "int foo(){}" | gcc -flto -O2 -c -x c -o foo.o - echo "int bar(){}" | gcc -flto -O2 -c -x c -o bar.o - ln -s /usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so.0.0.0 /usr/lib/bfd-plugins/ ar crs foo.a foo.o bar.o Segmentation fault (core dumped) If the plugin is copied directly and not a symlink, then there is no segfault: rm /usr/lib/bfd-plugins/liblto_plugin.so.0.0.0 cp /usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so.0.0.0 /usr/lib/bfd-plugins/ ar crs foo.a foo.o bar.o
It also seems like the LLVMgold.so plugin does not have the same problem. This similar sequence works with this plugin: echo "int foo(){}" | clang -flto -O2 -c -x c -o foo.o - echo "int bar(){}" | clang -flto -O2 -c -x c -o bar.o - ln -s /usr/lib64/LLVMgold.so /usr/lib/bfd-plugins/ ar crs foo.a foo.o bar.o
Please try binutils 2.34 branch.
Hi Tom, I am sorry but I cannot reproduce this. It seems very strange that a symlink should be causing a segmentation fault when a copy does not. The "ar" program that you are running - is this the binutils ar binary or is it an alias/symlink for the gcc-ar script ? If you have the symlink in place and you run: ar crs --plugin /usr/lib/bfd-plugins/liblto_plugin.so.0.0.0 foo.a foo.o bar.o Does that work ? Does the problem persist if you use the current mainline development sources for the binutils rather than the 2.34 release ? Cheers Nick
(In reply to Nick Clifton from comment #3) > Hi Tom, > > I am sorry but I cannot reproduce this. It seems very strange that a > symlink should be causing a segmentation fault when a copy does not. > I am able to reproduce this running in the fedora:rawhide container image, so you may want to give that a try. > The "ar" program that you are running - is this the binutils ar binary > or is it an alias/symlink for the gcc-ar script ? > ar is not a symlink or alias as far as I can tell. > If you have the symlink in place and you run: > > ar crs --plugin /usr/lib/bfd-plugins/liblto_plugin.so.0.0.0 foo.a foo.o > bar.o > > Does that work ? > Yes, this works. > Does the problem persist if you use the current mainline development > sources for the binutils rather than the 2.34 release ? > I will try the development sources. I'm currently testing with gcc-10.0.1-0.12.fc33 and binutils-2.34-3.fc33. > Cheers > Nick
This might be a fedora specific bug, so try filing a bug there first.
(In reply to Andreas Schwab from comment #5) > This might be a fedora specific bug, so try filing a bug there first. It looks like this is caused by a Fedora specific patch, so I've filed a bug in the Fedora bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1828587
Fedora specific.