In the GNU toolchain, -static-libgcc implies that the unwindlib will be linked statically. However, when --unwindlib=libunwind, this flag is ignored, and a bare -lunwind is added to the linker args. Unfortunately, this means that if both libunwind.so, and libunwind.a are present in the library path, libunwind.so will be chosen in all cases where -static is not set.
This change makes -static-libgcc affect the -l flag produced by --unwindlib=libunwind. After this patch, providing -static-libgcc --unwindlib=libunwind will cause the driver to explicitly emit -l:libunwind.a to statically link libunwind. For all other cases it will emit -l:libunwind.so matching current behavior with a more explicit link line.
If you are building with -DLIBUNWIND_ENABLE_SHARED:OFF -DLIBUNWIND_ENABLE_STATIC:ON, there's no shared version available. And vice versa. This doesn't account for that.