gccgo: fix runtime compilation on NetBSD

si_code in siginfo_t is a macro on NetBSD, not a member of the
struct itself, so add a C trampoline for receiving its value.

Also replace references to mos.waitsemacount with the replacement and
add some helpers from os_netbsd.go in the GC repository.

Update golang/go#38538.

Change-Id: I818069de3eea8f3d33479542a798c729c9efd042
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/228918
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 files changed