gcc/gotools
Nikhil Benesch 0cdde1e7ae libgo: handle linking to NetBSD's versioned symbols
On NetBSD, for backwards compatibility, various libc symbols are
renamed to a symbol with a version suffix. For example, this is the
(abbreviated) definition of sigaction:

    int sigaction(...) __asm__ ("__sigaction14")

This poses a challenge for libgo, which attempts to link sigaction by
way of an "//extern" comment:

    //extern sigaction
    func sigaction(...)

This results in a reference to the deprecated compatibility symbol
"sigaction", rather than the desired "__sigaction14" symbol.

This patch introduces a new "//extern-sysinfo" comment to handle this
situation. The new mklinknames.awk script scans a package for these
comments and outputs a "//go:linkname" directive that links the wrapper
to the correct versioned symbol, as determined by parsing the __asm__
annotation on the function's declaration in gen-sysinfo.go.

For now, only the following packages are scanned by mklinknames.awk:

    os
    os/user
    runtime
    syscall

gotools/:
	* Makefile.am (check-runtime): Add runtime_linknames.go to
	--extrafiles.
	* Makefile.in: Regenerate.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/265125
2020-10-28 18:20:50 -07:00
..
ChangeLog libgo: update to Go1.14beta1 2020-01-21 23:53:22 -08:00
Makefile.am libgo: handle linking to NetBSD's versioned symbols 2020-10-28 18:20:50 -07:00
Makefile.in libgo: handle linking to NetBSD's versioned symbols 2020-10-28 18:20:50 -07:00
README
aclocal.m4 Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
configure Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
configure.ac Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
go.1
gofmt.1

README

This directory builds tools used by people working in the Go language.
The source code for these tools lives in libgo/go/cmd, where it is
copied from the master gofrontend repository.  This directory contains
only the configure/Makefile instructions required to build the tools.

This directory builds two programs for general use: go and gofmt.  It
also builds one program for internal use by the go tool: cgo.  For
more information on these tools see the doc.go files in the relevant
source code, which can also be seen hosted at golang.org:

http://golang.org/cmd/go
http://golang.org/cmd/gofmt
http://golang.org/cmd/cgo