https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86535

--- Comment #16 from Piotr Kubaj <pkubaj at anongoth dot pl> ---
(In reply to Ian Lance Taylor from comment #15)
> I committed a patch that should fix the nanotime problem.
> 
> Some of the other issues you describe will most likely require a fix in the
> libgo/mkrsysinfo.sh script, which generates the file runtime_sysinfo.go. 
> For example, that is likely the problem with _CTL_HW and _HW_PAGESIZE.
> 
> For sysctl we'll need a declaration with a //extern comment.
> 
> I'm happy to advise but I don't realistically have the time to do the work
> myself.

Thank you.

I'm fine to work on it myself, it looks like just couple function definitions
are missing.

However, I didn't hack on GCC before, I'm really not sure where I should add
the appriopriate include with a system C header.

I hope you can help me with one example and then I'll figure the rest out
myself. I already saw that some functions are defined in *stub*.go files and
managed to fix one error with a simple patch:
--- libgo/go/runtime/timestub2.go.orig  2019-03-03 12:33:56.339627000 +0100
+++ libgo/go/runtime/timestub2.go       2019-03-03 12:34:11.055696000 +0100
@@ -4,7 +4,6 @@

 // +build !darwin
 // +build !windows
-// +build !freebsd
 // +build !aix

 package runtime

To fix missing archauxv function, I added libgo/go/runtime/os_freebsd_ppc64.go,
with contents basically copied from os_linux_ppc64x.go, only +build is changed
to apply on freebsd,ppc64. IMO that file should be moved to os_ppc64x.go to
apply on each OS.

But there are other errors like:
/usr/local/poudriere/ports/default/lang/gcc9-devel/work/gcc-9-20190224/libgo/go/runtime/os_freebsd.go:15:76:
error: use of undefined type 'umtx_time'
   15 | func sys_umtx_op(addr *uint32, mode int32, val uint32, uaddr1 uintptr,
ts *umtx_time) int32
      |                                                                        
   ^

umtx_time is a C struct defined in sys/_umtx.h, but you're supposed to actually
include sys/umtx.h (sys/umtx.h includes sys/_umtx.h).

I tried to add:
// #include <sys/umtx.h>
import "C"

to libgo/go/runtime/os_freebsd.go, but that didn't work. I also saw that some
includes are set in libgo/go/internal/x/net/route/defs_freebsd.go, but
including sys/umtx.h also didn't work.

Reply via email to