compiler: rationalize external symbol names

Encode all external symbol names using only ASCII alphanumeric
characters, underscore, and dot.  Use a scheme that can be reliably
demangled to a somewhat readable version as described in the long
comment in names.cc.

A minor cleanup discovered during this was that we were treating
function types as different if one had a NULL parameters_ field and
another has a non-NULL parameters_ field that has no parameters.  This
worked because we mangled them slightly differently.  We now mangle
them the same, so we treat them as equal, as we should anyhow.

Change-Id: I6b0b6d38c361aff729638ea0b2d43e5e09ad6995
Reviewed-on: https://go-review.googlesource.com/89555
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
16 files changed