compiler: rationalize external symbol names

Programming / Compilers / GCC - ian [138bc75d-0d04-0410-961f-82ee72b054a4] - 24 January 2018 23:50 EST

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.

Reviewed-on: https://go-review.googlesource.com/89555

- go.go-torture/execute/names-1.go: New test.

13f2fdb8774 compiler: rationalize external symbol names
gcc/go/gofrontend/MERGE | 2 +-
gcc/go/gofrontend/escape.cc | 53 +-
gcc/go/gofrontend/expressions.cc | 39 +-
gcc/go/gofrontend/go-encode-id.cc | 84 ++-
gcc/go/gofrontend/go-encode-id.h | 14 +-
gcc/go/gofrontend/gogo.cc | 10 +-
gcc/go/gofrontend/gogo.h | 29 +-
gcc/go/gofrontend/lex.cc | 9 +-
gcc/go/gofrontend/names.cc | 778 ++++++++++++++++---------
gcc/go/gofrontend/statements.cc | 2 +-
gcc/go/gofrontend/types.cc | 32 +-
gcc/testsuite/ChangeLog | 4 +
gcc/testsuite/go.go-torture/execute/names-1.go | 195 +++++++
libgo/go/runtime/crash_test.go | 4 +-
libgo/go/runtime/panic.go | 2 +-
libgo/go/runtime/pprof/pprof_test.go | 2 +-
libgo/go/syscall/wait.c | 18 +-
libgo/runtime/go-callers.c | 11 +-
libgo/runtime/go-unsafe-pointer.c | 12 +-
19 files changed, 924 insertions(+), 376 deletions(-)

Upstream: gcc.gnu.org


  • Share