Go patch committed: Change name mangling convention

Ian Lance Taylor iant@golang.org
Fri Nov 20 20:44:44 GMT 2020

This patch to the Go frontend and libgo changes the name mangling
convention.  The previous convention (which was actually the second
one) turned out to be ambiguous when the path to a package contained a
dot; this is a common case, as many package paths are of the form
"github.com/name/package".  The previous convention also did not
support package paths that start with a digit, which is less common
but does occur (https://golang.org/issue/41862).

This patch rewrites and somewhat simplifies the naming convention.
Now dot is used only as a separator character and for special names.
Actual name mangling, for representing Unicode characters and other
non-ASCII alphanumerics, is now done with an underscore.  This has the
advantage of being simpler, in that it avoids the overloading that the
previous convention applied to dot.  It has the disadvantage that
mangled symbol names look somewhat like valid Go names, since valid Go
names can of course contain underscore.  Still, it seems like the best

This patch increments the libgo major version number, since many
symbol names have changed.

Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt.gz
Type: application/gzip
Size: 40086 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201120/4e87755d/attachment-0001.gz>

More information about the Gcc-patches mailing list