The -fdump-go-spec flag to GCC recently changed to be more fastidious
about handling incomplete types. This caused some breakage in
mk[r]sysinfo.sh on Solaris. This commit adjusts for the new behavior.
Specifically:
* Types that refer to _in6_addr may be hidden behind a typedef and can
no longer be filtered out with `grep -v in6_addr`. Instead just
rewrite the definition of _in6_addr to [16]byte wherever it appears.
* timestruc_t is now (correctly) emitted as an alias for timespec, so this
case is handled specially.
* stdio.h is included in sysinfo.c to avoid emitting an incomplete
definition of the FILE type.
* Dummy definitions for _u?pad128_t are now emitted automatically,
which conflict with the definitions installed by mk[r]sysinfo.sh.
These definitions were actually dead code, so just remove them.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/278672
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
The syscall package depends on many NetBSD-specific types on NetBSD.
Teach mksysinfo.sh to export these types.
This alone is not sufficient to get the syscall package to compile on
NetBSD, but it's a start.
Note that the IfMsgHdr type is recapitalized to IfMsghdr, which requires
changes in the AIX port. The new capitalization is what's used by
upstream in existing NetBSD-specific code and is more consistent with
the capitalization of other C structs with the "hdr" suffix.
Updates golang/go#38538.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/261739
This CL serves as part of an initial change for enabling gollvm
building on arm64 linux, the rest of the change will be covered by
another one to the gollvm repo.
Incorporate type definition of 'uint128' to 'runtime' and 'syscall'
packges, the change is not specific to arm64 linux but made available
for all platforms.
Verified by building and unit-testing gollvm on linux x86-64 and arm64.
Verified by building and checking gccgo on linux x86-64 and arm64.
Fixesgolang/go#33711
Change-Id: I4720c7d810cfd4ef720962fb4104c5641b2459c0
From-SVN: r275919
This patch adds explicit references to various types and constants
defined by the header files included by sysinfo.c (used to drive the
generation of gen-sysinfo.go as part of the libgo build via the GCC
"-fdump-go-spec" option).
The intent is to enable clients to gather the same info generated by
"-fdump-go-spec" by instead reading the generated DWARF from a
sysinfo.o object file compiled with "-g". Some compilers (notably
clang) try to omit DWARF records for a given type unless there is an
explicit use of it in the translation unit; the additional references
are to insure that everything we want to see in the DWARF shows up.
Reviewed-on: https://go-review.googlesource.com/99063
From-SVN: r259868
PR go/81324
sysinfo.c: ignore ptrace_peeksiginfo_args from <linux/ptrace.h>
With some versions of glibc and GNU/Linux ptrace_pseeksiginfo_args is
defined in both <sys/ptrace.h> and <linux/ptrace.h>. We don't actually
care about the struct, so use a #define to avoid a redefinition error.
This fixes https://gcc.gnu.org/PR81324.
Reviewed-on: https://go-review.googlesource.com/49290
From-SVN: r250324
On MIPS, the correct structure for PtraceRegs is 'struct pt_regs' which
is declared in linux/ptrace.h. Previously no PtraceRegs structure was
created on MIPS because 'struct user_regs_struct' doesn't exist there.
Fallback to using pt_regs when the PtraceRegs structure is generated in
mksysinfo.sh, then adjust syscall_linux_mipsx.go to read the program
counter from the correct field.
In addition, implement PtraceGetRegs and PtraceSetRegs on all 3 ABI
variants.
syscall_linux_mips64x.go can now be removed since the ptrace code on
all 3 ABIs is identical.
Reviewed-on: https://go-review.googlesource.com/46150
From-SVN: r249472
As we move toward the Go 1.7 garbage collector, it's essential that all
allocation of values that can contain Go pointers be done using the
correct type descriptor. That is simplest if we do all such allocation
in Go code. This rewrites the code that converts from a Go type to a
libffi CIF into Go.
Reviewed-on: https://go-review.googlesource.com/33353
From-SVN: r242578
Remove the old locking code written in C.
Add a shell script mkrsysinfo.sh to generate the runtime_sysinfo.go
file, so that we can get Go copies of the system time structures and
other types.
Tweak the compiler so that when compiling the runtime package the
address operator does not cause local variables to escape. When the gc
compiler compiles the runtime, an escaping local variable is treated as
an error. We should implement that, instead of this change, when escape
analysis is turned on.
Tweak the compiler so that the generated C header does not include names
that start with an underscore followed by a non-upper-case letter,
except for the special cases of _defer and _panic. Otherwise we
translate C types to Go in runtime_sysinfo.go and then generate those Go
types back as C types in runtime.inc, which is useless and painful for
the C code.
Change entersyscall and friends to take a dummy argument, as the gc
versions do, to simplify calls from the shared code.
Reviewed-on: https://go-review.googlesource.com/30079
From-SVN: r240657
This is a step toward a version of mksysinfo that generates information
for the runtime package. This will be used to generate the
runtime_sysinfo.go file, which is currently directly generated by a
Makefile target.
Reviewed-on: https://go-review.googlesource.com/29683
From-SVN: r240560