diff options
author | Nikhil Benesch <nikhil.benesch@gmail.com> | 2020-10-26 18:42:08 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-10-28 18:20:50 -0700 |
commit | 0cdde1e7ae197366e17e5ef50bf68d4d5760df01 (patch) | |
tree | 35bfb1e6e1551c39558abb3b699b032e952823c4 /libgo/go/os | |
parent | e93aae4a497c38b46df818a629c78149fe6af24b (diff) | |
download | gcc-0cdde1e7ae197366e17e5ef50bf68d4d5760df01.zip gcc-0cdde1e7ae197366e17e5ef50bf68d4d5760df01.tar.gz gcc-0cdde1e7ae197366e17e5ef50bf68d4d5760df01.tar.bz2 |
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
Diffstat (limited to 'libgo/go/os')
-rw-r--r-- | libgo/go/os/dir_regfile.go | 2 | ||||
-rw-r--r-- | libgo/go/os/user/decls_unix.go | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/libgo/go/os/dir_regfile.go b/libgo/go/os/dir_regfile.go index 1f18bab..b2e6623 100644 --- a/libgo/go/os/dir_regfile.go +++ b/libgo/go/os/dir_regfile.go @@ -15,5 +15,5 @@ package os import "syscall" -//extern readdir_r +//extern-sysinfo readdir_r func libc_readdir_r(*syscall.DIR, *syscall.Dirent, **syscall.Dirent) syscall.Errno diff --git a/libgo/go/os/user/decls_unix.go b/libgo/go/os/user/decls_unix.go index 276468c..6ffaced 100644 --- a/libgo/go/os/user/decls_unix.go +++ b/libgo/go/os/user/decls_unix.go @@ -11,17 +11,17 @@ import "syscall" // Declarations for the libc functions on most Unix systems. -//extern getpwnam_r +//extern-sysinfo getpwnam_r func libc_getpwnam_r(name *byte, pwd *syscall.Passwd, buf *byte, buflen syscall.Size_t, result **syscall.Passwd) int -//extern getpwuid_r +//extern-sysinfo getpwuid_r func libc_getpwuid_r(uid syscall.Uid_t, pwd *syscall.Passwd, buf *byte, buflen syscall.Size_t, result **syscall.Passwd) int -//extern getgrnam_r +//extern-sysinfo getgrnam_r func libc_getgrnam_r(name *byte, grp *syscall.Group, buf *byte, buflen syscall.Size_t, result **syscall.Group) int -//extern getgrgid_r +//extern-sysinfo getgrgid_r func libc_getgrgid_r(gid syscall.Gid_t, grp *syscall.Group, buf *byte, buflen syscall.Size_t, result **syscall.Group) int -//extern getgrouplist +//extern-sysinfo getgrouplist func libc_getgrouplist(user *byte, group syscall.Gid_t, groups *syscall.Gid_t, ngroups *int32) int |