public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Go patch committed: Change name mangling convention
@ 2020-11-20 20:44 Ian Lance Taylor
  2020-11-22 19:00 ` Rainer Orth
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2020-11-20 20:44 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 1197 bytes --]

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
choice.

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.

Ian

[-- Attachment #2: patch.txt.gz --]
[-- Type: application/gzip, Size: 40086 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Go patch committed: Change name mangling convention
  2020-11-20 20:44 Go patch committed: Change name mangling convention Ian Lance Taylor
@ 2020-11-22 19:00 ` Rainer Orth
  2020-11-23 16:14   ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Rainer Orth @ 2020-11-22 19:00 UTC (permalink / raw)
  To: Ian Lance Taylor via Gcc-patches; +Cc: gofrontend-dev, Ian Lance Taylor

[-- Attachment #1: Type: text/plain, Size: 1651 bytes --]

Hi Ian,

> 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
> choice.
>
> 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.

this patch broke Solaris bootstrap: linking in gotools fails with

Undefined                       first referenced
 symbol                             in file
log_1syslog.syslog__c               ../i386-pc-solaris2.11/libgo/.libs/libgo.so
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:829: buildid] Error 1

The following patch fixed this for me:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: lgs.patch --]
[-- Type: text/x-patch, Size: 411 bytes --]

diff --git a/libgo/go/log/syslog/syslog_c.c b/libgo/go/log/syslog/syslog_c.c
--- a/libgo/go/log/syslog/syslog_c.c
+++ b/libgo/go/log/syslog/syslog_c.c
@@ -12,7 +12,7 @@
    can't represent a C varargs function in Go.  */
 
 void syslog_c(intgo, const char*)
-  __asm__ (GOSYM_PREFIX "log_1syslog.syslog_c");
+  __asm__ (GOSYM_PREFIX "log_1syslog.syslog__c");
 
 void
 syslog_c (intgo priority, const char *msg)

[-- Attachment #3: Type: text/plain, Size: 152 bytes --]


	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Go patch committed: Change name mangling convention
  2020-11-22 19:00 ` Rainer Orth
@ 2020-11-23 16:14   ` Ian Lance Taylor
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Lance Taylor @ 2020-11-23 16:14 UTC (permalink / raw)
  To: Rainer Orth; +Cc: Ian Lance Taylor via Gcc-patches, gofrontend-dev

On Sun, Nov 22, 2020 at 11:00 AM Rainer Orth
<ro@cebitec.uni-bielefeld.de> wrote:
>
> > 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
> > choice.
> >
> > 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.
>
> this patch broke Solaris bootstrap: linking in gotools fails with
>
> Undefined                       first referenced
>  symbol                             in file
> log_1syslog.syslog__c               ../i386-pc-solaris2.11/libgo/.libs/libgo.so
> ld: fatal: symbol referencing errors
> collect2: error: ld returned 1 exit status
> make[2]: *** [Makefile:829: buildid] Error 1
>
> The following patch fixed this for me:

Thanks.  Committed to mainline.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-23 16:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 20:44 Go patch committed: Change name mangling convention Ian Lance Taylor
2020-11-22 19:00 ` Rainer Orth
2020-11-23 16:14   ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).