https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81393
Bug ID: 81393
Summary: Bootstrap failure on s390x-linux while building libgo
against recent glibc
Product: gcc
Version: 7.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: go
Assignee: ian at airs dot com
Reporter: jakub at gcc dot gnu.org
CC: cmang at google dot com
Target Milestone: ---
Current 7 branch doesn't build against recent glibc, not just because of
libsanitizer issues tracked in another PR, but also due to:
../../../../libgo/go/syscall/syscall_linux_s390.go:16:16: error: reference to
undefined name ‘PTRACE_GETREGS’
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
^
../../../../libgo/go/syscall/syscall_linux_s390.go:20:16: error: reference to
undefined name ‘PTRACE_SETREGS’
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
^
make[6]: *** [Makefile:3331: syscall.lo] Error 1
This is because glibc has removed those in:
https://sourceware.org/bugzilla/show_bug.cgi?id=21539
claiming the kernel never supported them and it never worked.
Thus, I think syscall_linux_s390{,x}.go should probably use PTRACE_GETREGSET
and PTRACE_SETREGSET instead.
Elsewhere I found
static long
our_ptrace_getregs(pid_t pid, struct USER_REGS_TYPE *regs)
{
#ifdef AARCH64
struct iovec iovec = { regs, sizeof(*regs) };
return our_ptrace(PTRACE_GETREGSET, pid, (void *)NT_PRSTATUS, &iovec);
#else
return our_ptrace(PTRACE_GETREGS, pid, NULL, regs);
#endif
}
static long
our_ptrace_setregs(pid_t pid, struct USER_REGS_TYPE *regs)
{
#ifdef AARCH64
struct iovec iovec = { regs, sizeof(*regs) };
return our_ptrace(PTRACE_SETREGSET, pid, (void *)NT_PRSTATUS, &iovec);
#else
return our_ptrace(PTRACE_SETREGS, pid, NULL, regs);
#endif
}
where aarch64 doesn't support PTRACE_SETREGS/GETREGS similarly to s390{,x}
(though for some reason doesn't provide any syscall_linux_{arm64,aarch64}.go or
whatever). In sysinfo.go I see PTRACE_{G,S}ETREGSET defined, but not
NT_PRSTATUS (which is 1, in elf.h?), and I see _iovec type.