diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-10-12 01:06:43 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-10-12 01:06:43 +0000 |
commit | 47370f050940a2e140e89fc0d46e808fab206f04 (patch) | |
tree | db8d3f678ba5fd8a4c6bd397af5a5c4e0d55f4bd /gcc/go/gofrontend/go-encode-id.h | |
parent | 36cefd37da8b7819b10664f6c740e6a839b3ea08 (diff) | |
download | gcc-47370f050940a2e140e89fc0d46e808fab206f04.zip gcc-47370f050940a2e140e89fc0d46e808fab206f04.tar.gz gcc-47370f050940a2e140e89fc0d46e808fab206f04.tar.bz2 |
compiler: mangle dots in pkgpath
We need to mangle dots to avoid problems with -fgo-pkgpath=a.0.
That will confuse the name mangling, which assumes that names
entering the mangling cannot contain arbitrary dot characters.
We don't need to mangle other characters; go_encode_id will handle them.
Fixes golang/go#33871
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/200838
From-SVN: r276913
Diffstat (limited to 'gcc/go/gofrontend/go-encode-id.h')
-rw-r--r-- | gcc/go/gofrontend/go-encode-id.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/go-encode-id.h b/gcc/go/gofrontend/go-encode-id.h index 70126ba..2d09b0c 100644 --- a/gcc/go/gofrontend/go-encode-id.h +++ b/gcc/go/gofrontend/go-encode-id.h @@ -34,4 +34,12 @@ go_selectively_encode_id(const std::string &id); extern std::string go_mangle_struct_tag(const std::string& tag); +// Encode a package path. A package path can contain any arbitrary +// character, including '.'. go_encode_id expects that any '.' will +// be inserted by name mangling in a controlled manner. So first +// translate any '.' using the same .x encoding as used by +// go_mangle_struct_tag. +extern std::string +go_mangle_pkgpath(const std::string& pkgpath); + #endif // !defined(GO_ENCODE_ID_H) |