[gn] Use target_cc for unsafe_buffers_mappings compiler flag check

When building for Android locally, we would do the check for the
unsafe_buffers_mappings compiler flag on the host version of cc, this
caused local builds where the host cc supported this flag to fail as
Android NDK's version of cc didn't support this flag.

Moved the toolchain target logic so we have access to target_ar,
target_cc, and target_cxx in all BUILD.gn files to share logic, then
used target_cc instead of cc when doing the compiler flag check.

Change-Id: I7a218a645d75493a1e51df5bf178d10d1be0f80b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1380937
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Nathan Sanchez <nathanasanchez@google.com>
3 files changed