How to reproduce: 1. Create a file x.c with this line: void f() { } 2. Run this command: > cc -c -emit-llvm x.c -o x.o && cc -shared -flto x.o -o x.so 3. Observe the error: > /usr/bin/ld: unrecognized option '-plugin' > /usr/bin/ld: use the --help option for usage information > cc: error: linker command failed with exit code 1 (use -v to see invocation)
This is expected on 11.x. The base linker is still the ancient GPL2 ld.bfd from 2008. I don't think we will switch linkers on stable/11. 12.0 should have llvm's lld linker, at least on amd64, which may enable LTO (if it works).
Ok, then feel free to close it if this is an expected behavior.
You can give this a try: % cc -c -emit-llvm x.c -o x.o && cc -fuse-ld=lld -shared -flto x.o -o x.so
(In reply to Ed Maste from comment #3) This works, thanks! One project used -flto, this is how I found this problem.