[gofrontend-dev] Re: Go patch committed: Improve name mangling for package paths

Than McIntosh via gcc-patches gcc-patches@gcc.gnu.org
Fri Oct 26 13:27:00 GMT 2018


Thanks for reporting this.

Sent https://go-review.googlesource.com/c/gofrontend/+/145017 with a
tentative fix.

Than

On Fri, Oct 26, 2018 at 7:55 AM Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>
> Hi Ian,
>
> > This patch by Than McIntosh improves the mangling of package paths in
> > the Go frontend.
> >
> > The current implementation of Gogo::pkgpath_for_symbol was written in
> > a way that allowed two distinct package paths to map to the same
> > symbol, which could cause collisions at link- time or compile-time.
> >
> > This patch switches to a better mangling scheme to ensure that we get
> > a unique packagepath symbol for each package.  In the new scheme
> > instead of having separate mangling schemes for identifiers and
> > package paths, the main identifier mangler ("go_encode_id") now
> > handles mangling of both packagepath characters and identifier
> > characters.
> >
> > The new mangling scheme is more intrusive: "foo/bar.Baz" is mangled as
> > "foo..z2fbar.Baz" instead of "foo_bar.Baz".  To mitigate this, this
> > patch also adds a demangling capability so that function names
> > returned from runtime.CallersFrames are converted back to their
> > original unmangled form.
> >
> > Changing the pkgpath_for_symbol scheme requires updating a number of
> > //go:linkname directives and C "__asm__" directives to match the new
> > scheme, as well as updating the 'gotest' driver (which makes
> > assumptions about the correct mapping from pkgpath symbol to package
> > name).
>
> it seems you missed a case here: both i386-pc-solaris2.* and
> sparc-sun-solaris2.* bootstraps broke linking the gotools:
>
> Undefined                       first referenced
>  symbol                             in file
> log..z2fsyslog.syslog_c             ../sparc-sun-solaris2.11/libgo/.libs/libgo.so
> ld: fatal: symbol referencing errors
> collect2: error: ld returned 1 exit status
> make[2]: *** [Makefile:751: go] Error 1
>
> The following patch fixes this allowing the links to succeed, though
> I've not run the testsuite yet.
>
>         Rainer
>
> --
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University
>
>
> --
> You received this message because you are subscribed to the Google Groups "gofrontend-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to gofrontend-dev+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



More information about the Gcc-patches mailing list