libgo: only build syscall test with -static if it works

Test whether -static works, and use it if possible.

This time for sure.

For https://gcc.gnu.org/PR95061

Change-Id: Ia3f8916422e53c26dab94502423282559c92aae7
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/234024
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 files changed