Joel Sing <joel@sing.id.au> writes:
> The following adds support for Go on openbsd/riscv64 - this is not
> yet upstream, which means that it will need to be maintained in the
> ports tree for the time being. This also means that there will be
> other Go packages (such as golang.org/x/sys/unix), which will not
> know about this platform. Any code that uses such packages will
> likely need to be patched (the necessary changes are included in
> the cmd/vendor/golang.org/x/sys/unix part of this diff, but I can
> assist with patches if need be).
>
> Aside from riscv64, there are some minor tweaks to the mips64 port
> (based on review feedback while upstreaming) - all other architectures
> should not be impacted by this change.
>
> ok?
>
I am able to build binaries for openbsd/riscv64 with this (I don't have
hw to test that they work though :D).
https://github.com/qbit/microca builds as expected (stdlib only)
OK abieber@
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/lang/go/Makefile,v
> retrieving revision 1.124
> diff -u -p -r1.124 Makefile
> --- Makefile 17 Sep 2022 18:42:39 -0000 1.124
> +++ Makefile 18 Sep 2022 07:51:21 -0000
> @@ -1,11 +1,12 @@
> ONLY_FOR_ARCHS = ${GO_ARCHS}
>
> -BIN_BOOTSTRAP_GOARCHS = 386 amd64 arm arm64 mips64
> +BIN_BOOTSTRAP_GOARCHS = 386 amd64 arm arm64 mips64 riscv64
> BIN_BOOTSTRAP_VERSION = 1.18.4
>
> COMMENT = Go programming language
>
> VERSION = 1.19.1
> +REVISION = 0
> DISTNAME = go${VERSION}.src
> PKGNAME = go-${VERSION}
> PKGSPEC = ${FULLPKGNAME:S/go-/go-=/}
> @@ -56,6 +57,8 @@ GOARCH = arm64
> GOARCH = 386
> .elif ${MACHINE_ARCH} == "mips64"
> GOARCH = mips64
> +.elif ${MACHINE_ARCH} == "riscv64"
> +GOARCH = riscv64
> .endif
>
> # We cannot assume that the machine running the built code will have SSE,
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/lang/go/distinfo,v
> retrieving revision 1.77
> diff -u -p -r1.77 distinfo
> --- distinfo 17 Sep 2022 18:41:50 -0000 1.77
> +++ distinfo 18 Sep 2022 07:51:21 -0000
> @@ -3,10 +3,12 @@ SHA256 (go-openbsd-amd64-bootstrap-1.18.
> SHA256 (go-openbsd-arm-bootstrap-1.18.4.tar.gz) = oxYr3cphgkHHW3fhD4MWmZy6wWGRxHL1/HgXGoR0deE=
> SHA256 (go-openbsd-arm64-bootstrap-1.18.4.tar.gz) = M7OML+r3ofvr5UaIoZ12jqDBB4ogT3sePUVDR+l2mwY=
> SHA256 (go-openbsd-mips64-bootstrap-1.18.4.tar.gz) = voP9dDKZ3hcXjyqF9r3jBSxGMZwgeBt27p41GzCKoEI=
> +SHA256 (go-openbsd-riscv64-bootstrap-1.18.4.tar.gz) = je0AbR0bVy+KMXzcmzkJ3pRBUfXoQUI44LjrrdIQOOQ=
> SHA256 (go1.19.1.src.tar.gz) = J4cbqkkPNAFBSteT+6SQhvbIVbHFhDhe13ceEgTH4Xk=
> SIZE (go-openbsd-386-bootstrap-1.18.4.tar.gz) = 148679005
> SIZE (go-openbsd-amd64-bootstrap-1.18.4.tar.gz) = 149910861
> SIZE (go-openbsd-arm-bootstrap-1.18.4.tar.gz) = 145777001
> SIZE (go-openbsd-arm64-bootstrap-1.18.4.tar.gz) = 144201762
> SIZE (go-openbsd-mips64-bootstrap-1.18.4.tar.gz) = 148034418
> +SIZE (go-openbsd-riscv64-bootstrap-1.18.4.tar.gz) = 142272942
> SIZE (go1.19.1.src.tar.gz) = 26527375
> Index: patches/patch-src_cmd_asm_internal_asm_endtoend_test_go
> ===================================================================
> RCS file: patches/patch-src_cmd_asm_internal_asm_endtoend_test_go
> diff -N patches/patch-src_cmd_asm_internal_asm_endtoend_test_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_asm_internal_asm_endtoend_test_go 18 Sep 2022 07:51:21 -0000
> @@ -0,0 +1,15 @@
> +Index: src/cmd/asm/internal/asm/endtoend_test.go
> +--- src/cmd/asm/internal/asm/endtoend_test.go.orig
> ++++ src/cmd/asm/internal/asm/endtoend_test.go
> +@@ -69,6 +69,11 @@ Diff:
> + continue
> + }
> +
> ++ // Ignore GLOBL.
> ++ if strings.HasPrefix(line, "GLOBL ") {
> ++ continue
> ++ }
> ++
> + // The general form of a test input line is:
> + // // comment
> + // INST args [// printed form] [// hex encoding]
> Index: patches/patch-src_cmd_asm_internal_asm_testdata_riscv64_s
> ===================================================================
> RCS file: patches/patch-src_cmd_asm_internal_asm_testdata_riscv64_s
> diff -N patches/patch-src_cmd_asm_internal_asm_testdata_riscv64_s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_asm_internal_asm_testdata_riscv64_s 18 Sep 2022 07:51:21 -0000
> @@ -0,0 +1,24 @@
> +Index: src/cmd/asm/internal/asm/testdata/riscv64.s
> +--- src/cmd/asm/internal/asm/testdata/riscv64.s.orig
> ++++ src/cmd/asm/internal/asm/testdata/riscv64.s
> +@@ -352,6 +352,14 @@ start:
> + MOVD F0, 4(X5) // 27b20200
> + MOVD F0, F1 // d3000022
> +
> ++ // TLS load with local-exec (LUI + ADDIW + ADD of TP + load)
> ++ MOV tls(SB), X5 // b70f00009b8f0f00b38f4f0083b20f00
> ++ MOVB tls(SB), X5 // b70f00009b8f0f00b38f4f0083820f00
> ++
> ++ // TLS store with local-exec (LUI + ADDIW + ADD of TP + store)
> ++ MOV X5, tls(SB) // b70f00009b8f0f00b38f4f0023b05f00
> ++ MOVB X5, tls(SB) // b70f00009b8f0f00b38f4f0023805f00
> ++
> + // NOT pseudo-instruction
> + NOT X5 // 93c2f2ff
> + NOT X5, X6 // 13c3f2ff
> +@@ -405,3 +413,5 @@ start:
> + FLTD F0, F1, X5 // d39200a2
> + FLED F0, F1, X5 // d38200a2
> + FEQD F0, F1, X5 // d3a200a2
> ++
> ++GLOBL tls(SB), TLSBSS, $8
> Index: patches/patch-src_cmd_dist_build_go
> ===================================================================
> RCS file: patches/patch-src_cmd_dist_build_go
> diff -N patches/patch-src_cmd_dist_build_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_dist_build_go 18 Sep 2022 07:51:21 -0000
> @@ -0,0 +1,11 @@
> +Index: src/cmd/dist/build.go
> +--- src/cmd/dist/build.go.orig
> ++++ src/cmd/dist/build.go
> +@@ -1589,6 +1589,7 @@ var cgoEnabled = map[string]bool{
> + "openbsd/arm": true,
> + "openbsd/arm64": true,
> + "openbsd/mips64": true,
> ++ "openbsd/riscv64": true,
> + "plan9/386": false,
> + "plan9/amd64": false,
> + "plan9/arm": false,
> Index: patches/patch-src_cmd_internal_obj_riscv_cpu_go
> ===================================================================
> RCS file: patches/patch-src_cmd_internal_obj_riscv_cpu_go
> diff -N patches/patch-src_cmd_internal_obj_riscv_cpu_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_internal_obj_riscv_cpu_go 18 Sep 2022 07:51:21 -0000
> @@ -0,0 +1,32 @@
> +Index: src/cmd/internal/obj/riscv/cpu.go
> +--- src/cmd/internal/obj/riscv/cpu.go.orig
> ++++ src/cmd/internal/obj/riscv/cpu.go
> +@@ -632,13 +632,25 @@ var unaryDst = map[obj.As]bool{
> +
> + // Instruction encoding masks.
> + const (
> +- // JTypeImmMask is a mask including only the immediate portion of
> +- // J-type instructions.
> +- JTypeImmMask = 0xfffff000
> ++ // BTypeImmMask is a mask including only the immediate portion of
> ++ // B-type instructions.
> ++ BTypeImmMask = 0xfe000f80
> +
> ++ // CBTypeImmMask is a mask including only the immediate portion of
> ++ // CB-type instructions.
> ++ CBTypeImmMask = 0x1c7c
> ++
> ++ // CJTypeImmMask is a mask including only the immediate portion of
> ++ // CJ-type instructions.
> ++ CJTypeImmMask = 0x1f7c
> ++
> + // ITypeImmMask is a mask including only the immediate portion of
> + // I-type instructions.
> + ITypeImmMask = 0xfff00000
> ++
> ++ // JTypeImmMask is a mask including only the immediate portion of
> ++ // J-type instructions.
> ++ JTypeImmMask = 0xfffff000
> +
> + // STypeImmMask is a mask including only the immediate portion of
> + // S-type instructions.
> Index: patches/patch-src_cmd_internal_obj_riscv_obj_go
> ===================================================================
> RCS file: patches/patch-src_cmd_internal_obj_riscv_obj_go
> diff -N patches/patch-src_cmd_internal_obj_riscv_obj_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_internal_obj_riscv_obj_go 18 Sep 2022 07:51:21 -0000
> @@ -0,0 +1,204 @@
> +Index: src/cmd/internal/obj/riscv/obj.go
> +--- src/cmd/internal/obj/riscv/obj.go.orig
> ++++ src/cmd/internal/obj/riscv/obj.go
> +@@ -1264,6 +1264,11 @@ func encodeSF(ins *instruction) uint32 {
> + return encodeS(ins.as, regI(ins.rd), regF(ins.rs1), uint32(ins.imm))
> + }
> +
> ++// encodeBImmediate encodes an immediate for a B-type RISC-V instruction.
> ++func encodeBImmediate(imm uint32) uint32 {
> ++ return (imm>>12)<<31 | ((imm>>5)&0x3f)<<25 | ((imm>>1)&0xf)<<8 | ((imm>>11)&0x1)<<7
> ++}
> ++
> + // encodeB encodes a B-type RISC-V instruction.
> + func encodeB(ins *instruction) uint32 {
> + imm := immI(ins.as, ins.imm, 13)
> +@@ -1273,7 +1278,7 @@ func encodeB(ins *instruction) uint32 {
> + if enc == nil {
> + panic("encodeB: could not encode instruction")
> + }
> +- return (imm>>12)<<31 | ((imm>>5)&0x3f)<<25 | rs2<<20 | rs1<<15 | enc.funct3<<12 | ((imm>>1)&0xf)<<8 | ((imm>>11)&0x1)<<7 | enc.opcode
> ++ return encodeBImmediate(imm) | rs2<<20 | rs1<<15 | enc.funct3<<12 | enc.opcode
> + }
> +
> + // encodeU encodes a U-type RISC-V instruction.
> +@@ -1316,16 +1321,67 @@ func encodeRawIns(ins *instruction) uint32 {
> + return uint32(ins.imm)
> + }
> +
> +-func EncodeJImmediate(imm int64) (int64, error) {
> +- if !immIFits(imm, 21) {
> +- return 0, fmt.Errorf("immediate %#x does not fit in 21 bits", imm)
> ++func extractAndShift(imm int64, bit, pos int) int64 {
> ++ return ((imm >> (bit - 1)) & 1) << (pos - 1)
> ++}
> ++
> ++func EncodeBImmediate(imm int64) (int64, error) {
> ++ if !immIFits(imm, 13) {
> ++ return 0, fmt.Errorf("immediate %#x does not fit in 13 bits", imm)
> + }
> + if imm&1 != 0 {
> + return 0, fmt.Errorf("immediate %#x is not a multiple of two", imm)
> + }
> +- return int64(encodeJImmediate(uint32(imm))), nil
> ++ return int64(encodeBImmediate(uint32(imm))), nil
> + }
> +
> ++func EncodeCBImmediate(imm int64) (int64, error) {
> ++ if !immIFits(imm, 9) {
> ++ return 0, fmt.Errorf("immediate %#x does not fit in 9 bits", imm)
> ++ }
> ++ if imm&1 != 0 {
> ++ return 0, fmt.Errorf("immediate %#x is not a multiple of two", imm)
> ++ }
> ++ imm = imm >> 1
> ++
> ++ // Bit order - [8|4:3|7:6|2:1|5]
> ++ bits := extractAndShift(imm, 8, 8)
> ++ bits |= extractAndShift(imm, 4, 7)
> ++ bits |= extractAndShift(imm, 3, 6)
> ++ bits |= extractAndShift(imm, 7, 5)
> ++ bits |= extractAndShift(imm, 6, 4)
> ++ bits |= extractAndShift(imm, 2, 3)
> ++ bits |= extractAndShift(imm, 1, 2)
> ++ bits |= extractAndShift(imm, 5, 1)
> ++
> ++ return (bits>>5)<<10 | (bits&0x1f)<<2, nil
> ++}
> ++
> ++func EncodeCJImmediate(imm int64) (int64, error) {
> ++ if !immIFits(imm, 12) {
> ++ return 0, fmt.Errorf("immediate %#x does not fit in 12 bits", imm)
> ++ }
> ++ if imm&1 != 0 {
> ++ return 0, fmt.Errorf("immediate %#x is not a multiple of two", imm)
> ++ }
> ++ imm = imm >> 1
> ++
> ++ // Bit order - [11|4|9:8|10|6|7|3:1|5]
> ++ bits := extractAndShift(imm, 11, 11)
> ++ bits |= extractAndShift(imm, 4, 10)
> ++ bits |= extractAndShift(imm, 9, 9)
> ++ bits |= extractAndShift(imm, 8, 8)
> ++ bits |= extractAndShift(imm, 10, 7)
> ++ bits |= extractAndShift(imm, 6, 6)
> ++ bits |= extractAndShift(imm, 7, 5)
> ++ bits |= extractAndShift(imm, 3, 4)
> ++ bits |= extractAndShift(imm, 2, 3)
> ++ bits |= extractAndShift(imm, 1, 2)
> ++ bits |= extractAndShift(imm, 5, 1)
> ++
> ++ return bits << 2, nil
> ++}
> ++
> + func EncodeIImmediate(imm int64) (int64, error) {
> + if !immIFits(imm, 12) {
> + return 0, fmt.Errorf("immediate %#x does not fit in 12 bits", imm)
> +@@ -1333,6 +1389,16 @@ func EncodeIImmediate(imm int64) (int64, error) {
> + return imm << 20, nil
> + }
> +
> ++func EncodeJImmediate(imm int64) (int64, error) {
> ++ if !immIFits(imm, 21) {
> ++ return 0, fmt.Errorf("immediate %#x does not fit in 21 bits", imm)
> ++ }
> ++ if imm&1 != 0 {
> ++ return 0, fmt.Errorf("immediate %#x is not a multiple of two", imm)
> ++ }
> ++ return int64(encodeJImmediate(uint32(imm))), nil
> ++}
> ++
> + func EncodeSImmediate(imm int64) (int64, error) {
> + if !immIFits(imm, 12) {
> + return 0, fmt.Errorf("immediate %#x does not fit in 12 bits", imm)
> +@@ -1819,6 +1885,53 @@ func instructionsForStore(p *obj.Prog, as obj.As, rd i
> + return []*instruction{insLUI, insADD, ins}
> + }
> +
> ++func instructionsForTLS(p *obj.Prog, ins *instruction) []*instruction {
> ++ insAddTP := &instruction{as: AADD, rd: REG_TMP, rs1: REG_TMP, rs2: REG_TP}
> ++
> ++ var inss []*instruction
> ++ if p.Ctxt.Flag_shared {
> ++ // TLS initial-exec mode - load TLS offset from GOT, add the thread pointer
> ++ // register, then load from or store to the resulting memory location.
> ++ insAUIPC := &instruction{as: AAUIPC, rd: REG_TMP}
> ++ insLoadTLSOffset := &instruction{as: ALD, rd: REG_TMP, rs1: REG_TMP}
> ++ inss = []*instruction{insAUIPC, insLoadTLSOffset, insAddTP, ins}
> ++ } else {
> ++ // TLS local-exec mode - load upper TLS offset, add the lower TLS offset,
> ++ // add the thread pointer register, then load from or store to the resulting
> ++ // memory location. Note that this differs from the suggested three
> ++ // instruction sequence, as the Go linker does not currently have an
> ++ // easy way to handle relocation across 12 bytes of machine code.
> ++ insLUI := &instruction{as: ALUI, rd: REG_TMP}
> ++ insADDIW := &instruction{as: AADDIW, rd: REG_TMP, rs1: REG_TMP}
> ++ inss = []*instruction{insLUI, insADDIW, insAddTP, ins}
> ++ }
> ++ return inss
> ++}
> ++
> ++func instructionsForTLSLoad(p *obj.Prog) []*instruction {
> ++ if p.From.Sym.Type != objabi.STLSBSS {
> ++ p.Ctxt.Diag("%v: %v is not a TLS symbol", p, p.From.Sym)
> ++ return nil
> ++ }
> ++
> ++ ins := instructionForProg(p)
> ++ ins.as, ins.rs1, ins.rs2, ins.imm = movToLoad(p.As), REG_TMP, obj.REG_NONE, 0
> ++
> ++ return instructionsForTLS(p, ins)
> ++}
> ++
> ++func instructionsForTLSStore(p *obj.Prog) []*instruction {
> ++ if p.To.Sym.Type != objabi.STLSBSS {
> ++ p.Ctxt.Diag("%v: %v is not a TLS symbol", p, p.To.Sym)
> ++ return nil
> ++ }
> ++
> ++ ins := instructionForProg(p)
> ++ ins.as, ins.rd, ins.rs1, ins.rs2, ins.imm = movToStore(p.As), REG_TMP, uint32(p.From.Reg), obj.REG_NONE, 0
> ++
> ++ return instructionsForTLS(p, ins)
> ++}
> ++
> + // instructionsForMOV returns the machine instructions for an *obj.Prog that
> + // uses a MOV pseudo-instruction.
> + func instructionsForMOV(p *obj.Prog) []*instruction {
> +@@ -1908,6 +2021,10 @@ func instructionsForMOV(p *obj.Prog) []*instruction {
> + inss = instructionsForLoad(p, movToLoad(p.As), addrToReg(p.From))
> +
> + case obj.NAME_EXTERN, obj.NAME_STATIC:
> ++ if p.From.Sym.Type == objabi.STLSBSS {
> ++ return instructionsForTLSLoad(p)
> ++ }
> ++
> + // Note that the values for $off_hi and $off_lo are currently
> + // zero and will be assigned during relocation.
> + //
> +@@ -1935,6 +2052,10 @@ func instructionsForMOV(p *obj.Prog) []*instruction {
> + inss = instructionsForStore(p, movToStore(p.As), addrToReg(p.To))
> +
> + case obj.NAME_EXTERN, obj.NAME_STATIC:
> ++ if p.To.Sym.Type == objabi.STLSBSS {
> ++ return instructionsForTLSStore(p)
> ++ }
> ++
> + // Note that the values for $off_hi and $off_lo are currently
> + // zero and will be assigned during relocation.
> + //
> +@@ -2198,10 +2319,10 @@ func assemble(ctxt *obj.Link, cursym *obj.LSym, newpro
> + break
> + }
> + if addr.Sym.Type == objabi.STLSBSS {
> +- if rt == objabi.R_RISCV_PCREL_ITYPE {
> +- rt = objabi.R_RISCV_TLS_IE_ITYPE
> +- } else if rt == objabi.R_RISCV_PCREL_STYPE {
> +- rt = objabi.R_RISCV_TLS_IE_STYPE
> ++ if ctxt.Flag_shared {
> ++ rt = objabi.R_RISCV_TLS_IE
> ++ } else {
> ++ rt = objabi.R_RISCV_TLS_LE
> + }
> + }
> +
> Index: patches/patch-src_cmd_internal_objabi_reloctype_go
> ===================================================================
> RCS file: /cvs/ports/lang/go/patches/patch-src_cmd_internal_objabi_reloctype_go,v
> retrieving revision 1.6
> diff -u -p -r1.6 patch-src_cmd_internal_objabi_reloctype_go
> --- patches/patch-src_cmd_internal_objabi_reloctype_go 28 Aug 2022 08:58:10 -0000 1.6
> +++ patches/patch-src_cmd_internal_objabi_reloctype_go 18 Sep 2022 07:51:23 -0000
> @@ -1,7 +1,57 @@
> Index: src/cmd/internal/objabi/reloctype.go
> --- src/cmd/internal/objabi/reloctype.go.orig
> +++ src/cmd/internal/objabi/reloctype.go
> -@@ -279,9 +279,24 @@ const (
> +@@ -238,14 +238,43 @@ const (
> + // AUIPC + S-type instruction pair.
> + R_RISCV_PCREL_STYPE
> +
> +- // R_RISCV_TLS_IE_ITYPE resolves a 32-bit TLS initial-exec TOC offset
> +- // address using an AUIPC + I-type instruction pair.
> +- R_RISCV_TLS_IE_ITYPE
> ++ // R_RISCV_TLS_IE resolves a 32-bit TLS initial-exec address using an
> ++ // AUIPC + I-type instruction pair.
> ++ R_RISCV_TLS_IE
> +
> +- // R_RISCV_TLS_IE_STYPE resolves a 32-bit TLS initial-exec TOC offset
> +- // address using an AUIPC + S-type instruction pair.
> +- R_RISCV_TLS_IE_STYPE
> ++ // R_RISCV_TLS_LE_ITYPE resolves a 32-bit TLS local-exec address using an
> ++ // LUI + I-type instruction sequence.
> ++ R_RISCV_TLS_LE
> +
> ++ // R_RISCV_GOT_HI20 resolves the high 20 bits of a 32-bit PC-relative GOT
> ++ // address.
> ++ R_RISCV_GOT_HI20
> ++
> ++ // R_RISCV_PCREL_32 resolves a 32-bit PC-relative address to an absolute
> ++ // value.
> ++ R_RISCV_PCREL_32
> ++
> ++ // R_RISCV_PCREL_HI20 resolves the high 20 bits of a 32-bit PC-relative
> ++ // address.
> ++ R_RISCV_PCREL_HI20
> ++
> ++ // R_RISCV_PCREL_LO12_I resolves the low 12 bits of a 32-bit PC-relative
> ++ // address using an I-type instruction.
> ++ R_RISCV_PCREL_LO12_I
> ++
> ++ // R_RISCV_PCREL_LO12_S resolves the low 12 bits of a 32-bit PC-relative
> ++ // address using an S-type instruction.
> ++ R_RISCV_PCREL_LO12_S
> ++
> ++ // R_RISCV_BRANCH resolves a 12-bit PC-relative branch offset.
> ++ R_RISCV_BRANCH
> ++
> ++ // R_RISCV_RVC_BRANCH resolves an 8-bit PC-relative branch offset.
> ++ R_RISCV_RVC_BRANCH
> ++
> ++ // R_RISCV_RVC_JUMP resolves an 11-bit PC-relative jump offset.
> ++ R_RISCV_RVC_JUMP
> ++
> + // R_PCRELDBL relocates s390x 2-byte aligned PC-relative addresses.
> + // TODO(mundaym): remove once variants can be serialized - see issue 14218.
> + R_PCRELDBL
> +@@ -279,9 +308,24 @@ const (
> // R_ADDRMIPSU (only used on mips/mips64) resolves to the sign-adjusted "upper" 16
> // bits (bit 16-31) of an external address, by encoding it into the instruction.
> R_ADDRMIPSU
> Index: patches/patch-src_cmd_internal_objabi_reloctype_string_go
> ===================================================================
> RCS file: /cvs/ports/lang/go/patches/patch-src_cmd_internal_objabi_reloctype_string_go,v
> retrieving revision 1.6
> diff -u -p -r1.6 patch-src_cmd_internal_objabi_reloctype_string_go
> --- patches/patch-src_cmd_internal_objabi_reloctype_string_go 28 Aug 2022 08:58:10 -0000 1.6
> +++ patches/patch-src_cmd_internal_objabi_reloctype_string_go 18 Sep 2022 07:51:23 -0000
> @@ -1,27 +1,57 @@
> Index: src/cmd/internal/objabi/reloctype_string.go
> --- src/cmd/internal/objabi/reloctype_string.go.orig
> +++ src/cmd/internal/objabi/reloctype_string.go
> -@@ -73,14 +73,18 @@ func _() {
> - _ = x[R_JMPLOONG64-63]
> - _ = x[R_ADDRMIPSU-64]
> - _ = x[R_ADDRMIPSTLS-65]
> +@@ -62,25 +62,37 @@ func _() {
> + _ = x[R_RISCV_CALL_TRAMP-52]
> + _ = x[R_RISCV_PCREL_ITYPE-53]
> + _ = x[R_RISCV_PCREL_STYPE-54]
> +- _ = x[R_RISCV_TLS_IE_ITYPE-55]
> +- _ = x[R_RISCV_TLS_IE_STYPE-56]
> +- _ = x[R_PCRELDBL-57]
> +- _ = x[R_ADDRLOONG64-58]
> +- _ = x[R_ADDRLOONG64U-59]
> +- _ = x[R_ADDRLOONG64TLS-60]
> +- _ = x[R_ADDRLOONG64TLSU-61]
> +- _ = x[R_CALLLOONG64-62]
> +- _ = x[R_JMPLOONG64-63]
> +- _ = x[R_ADDRMIPSU-64]
> +- _ = x[R_ADDRMIPSTLS-65]
> - _ = x[R_ADDRCUOFF-66]
> - _ = x[R_WASMIMPORT-67]
> - _ = x[R_XCOFFREF-68]
> -+ _ = x[R_MIPS_GPREL_HI16-66]
> -+ _ = x[R_MIPS_GPREL_LO16-67]
> -+ _ = x[R_MIPS_CALL16-68]
> -+ _ = x[R_MIPS_JALR-69]
> -+ _ = x[R_ADDRCUOFF-70]
> -+ _ = x[R_WASMIMPORT-71]
> -+ _ = x[R_XCOFFREF-72]
> ++ _ = x[R_RISCV_TLS_IE-55]
> ++ _ = x[R_RISCV_TLS_LE-56]
> ++ _ = x[R_RISCV_GOT_HI20-57]
> ++ _ = x[R_RISCV_PCREL_32-58]
> ++ _ = x[R_RISCV_PCREL_HI20-59]
> ++ _ = x[R_RISCV_PCREL_LO12_I-60]
> ++ _ = x[R_RISCV_PCREL_LO12_S-61]
> ++ _ = x[R_RISCV_BRANCH-62]
> ++ _ = x[R_RISCV_RVC_BRANCH-63]
> ++ _ = x[R_RISCV_RVC_JUMP-64]
> ++ _ = x[R_PCRELDBL-65]
> ++ _ = x[R_ADDRLOONG64-66]
> ++ _ = x[R_ADDRLOONG64U-67]
> ++ _ = x[R_ADDRLOONG64TLS-68]
> ++ _ = x[R_ADDRLOONG64TLSU-69]
> ++ _ = x[R_CALLLOONG64-70]
> ++ _ = x[R_JMPLOONG64-71]
> ++ _ = x[R_ADDRMIPSU-72]
> ++ _ = x[R_ADDRMIPSTLS-73]
> ++ _ = x[R_MIPS_GPREL_HI16-74]
> ++ _ = x[R_MIPS_GPREL_LO16-75]
> ++ _ = x[R_MIPS_CALL16-76]
> ++ _ = x[R_MIPS_JALR-77]
> ++ _ = x[R_ADDRCUOFF-78]
> ++ _ = x[R_WASMIMPORT-79]
> ++ _ = x[R_XCOFFREF-80]
> }
>
> -const _RelocType_name = "R_ADDRR_ADDRPOWERR_ADDRARM64R_ADDRMIPSR_ADDROFFR_SIZER_CALLR_CALLARMR_CALLARM64R_CALLINDR_CALLPOWERR_CALLMIPSR_CONSTR_PCRELR_TLS_LER_TLS_IER_GOTOFFR_PLT0R_PLT1R_PLT2R_USEFIELDR_USETYPER_USEIFACER_USEIFACEMETHODR_USEGENERICIFACEMETHODR_METHODOFFR_KEEPR_POWER_TOCR_GOTPCRELR_JMPMIPSR_DWARFSECREFR_DWARFFILEREFR_ARM64_TLS_LER_ARM64_TLS_IER_ARM64_GOTPCRELR_ARM64_GOTR_ARM64_PCRELR_ARM64_LDST8R_ARM64_LDST16R_ARM64_LDST32R_ARM64_LDST64R_ARM64_LDST128R_POWER_TLS_LER_POWER_TLS_IER_POWER_TLSR_ADDRPOWER_DSR_ADDRPOWER_GOTR_ADDRPOWER_PCRELR_ADDRPOWER_TOCRELR_ADDRPOWER_TOCREL_DSR_RISCV_CALLR_RISCV_CALL_TRAMPR_RISCV_PCREL_ITYPER_RISCV_PCREL_STYPER_RISCV_TLS_IE_ITYPER_RISCV_TLS_IE_STYPER_PCRELDBLR_ADDRLOONG64R_ADDRLOONG64UR_ADDRLOONG64TLSR_ADDRLOONG64TLSUR_CALLLOONG64R_JMPLOONG64R_ADDRMIPSUR_ADDRMIPSTLSR_ADDRCUOFFR_WASMIMPORTR_XCOFFREF"
> -+const _RelocType_name = "R_ADDRR_ADDRPOWERR_ADDRARM64R_ADDRMIPSR_ADDROFFR_SIZER_CALLR_CALLARMR_CALLARM64R_CALLINDR_CALLPOWERR_CALLMIPSR_CONSTR_PCRELR_TLS_LER_TLS_IER_GOTOFFR_PLT0R_PLT1R_PLT2R_USEFIELDR_USETYPER_USEIFACER_USEIFACEMETHODR_USEGENERICIFACEMETHODR_METHODOFFR_KEEPR_POWER_TOCR_GOTPCRELR_JMPMIPSR_DWARFSECREFR_DWARFFILEREFR_ARM64_TLS_LER_ARM64_TLS_IER_ARM64_GOTPCRELR_ARM64_GOTR_ARM64_PCRELR_ARM64_LDST8R_ARM64_LDST16R_ARM64_LDST32R_ARM64_LDST64R_ARM64_LDST128R_POWER_TLS_LER_POWER_TLS_IER_POWER_TLSR_ADDRPOWER_DSR_ADDRPOWER_GOTR_ADDRPOWER_PCRELR_ADDRPOWER_TOCRELR_ADDRPOWER_TOCREL_DSR_RISCV_CALLR_RISCV_CALL_TRAMPR_RISCV_PCREL_ITYPER_RISCV_PCREL_STYPER_RISCV_TLS_IE_ITYPER_RISCV_TLS_IE_STYPER_PCRELDBLR_ADDRLOONG64R_ADDRLOONG64UR_ADDRLOONG64TLSR_ADDRLOONG64TLSUR_CALLLOONG64R_JMPLOONG64R_ADDRMIPSUR_ADDRMIPSTLSR_MIPS_GPREL_HI16R_MIPS_GPREL_LO16R_MIPS_CALL16R_MIPS_JALRR_ADDRCUOFFR_WASMIMPORTR_XCOFFREF"
> ++const _RelocType_name = "R_ADDRR_ADDRPOWERR_ADDRARM64R_ADDRMIPSR_ADDROFFR_SIZER_CALLR_CALLARMR_CALLARM64R_CALLINDR_CALLPOWERR_CALLMIPSR_CONSTR_PCRELR_TLS_LER_TLS_IER_GOTOFFR_PLT0R_PLT1R_PLT2R_USEFIELDR_USETYPER_USEIFACER_USEIFACEMETHODR_USEGENERICIFACEMETHODR_METHODOFFR_KEEPR_POWER_TOCR_GOTPCRELR_JMPMIPSR_DWARFSECREFR_DWARFFILEREFR_ARM64_TLS_LER_ARM64_TLS_IER_ARM64_GOTPCRELR_ARM64_GOTR_ARM64_PCRELR_ARM64_LDST8R_ARM64_LDST16R_ARM64_LDST32R_ARM64_LDST64R_ARM64_LDST128R_POWER_TLS_LER_POWER_TLS_IER_POWER_TLSR_ADDRPOWER_DSR_ADDRPOWER_GOTR_ADDRPOWER_PCRELR_ADDRPOWER_TOCRELR_ADDRPOWER_TOCREL_DSR_RISCV_CALLR_RISCV_CALL_TRAMPR_RISCV_PCREL_ITYPER_RISCV_PCREL_STYPER_RISCV_TLS_IER_RISCV_TLS_LER_RISCV_GOT_HI20R_RISCV_PCREL_32R_RISCV_PCREL_HI20R_RISCV_PCREL_LO12_IR_RISCV_PCREL_LO12_SR_RISCV_BRANCHR_RISCV_RVC_BRANCHR_RISCV_RVC_JUMPR_PCRELDBLR_ADDRLOONG64R_ADDRLOONG64UR_ADDRLOONG64TLSR_ADDRLOONG64TLSUR_CALLLOONG64R_JMPLOONG64R_ADDRMIPSUR_ADDRMIPSTLSR_MIPS_GPREL_HI16R_MIPS_GPREL_LO16R_MIPS_CALL16R_MIPS_JALRR_ADDRCUOFFR_WASMIMPORTR_XCOFFREF"
>
> -var _RelocType_index = [...]uint16{0, 6, 17, 28, 38, 47, 53, 59, 68, 79, 88, 99, 109, 116, 123, 131, 139, 147, 153, 159, 165, 175, 184, 194, 210, 233, 244, 250, 261, 271, 280, 293, 307, 321, 335, 351, 362, 375, 388, 402, 416, 430, 445, 459, 473, 484, 498, 513, 530, 548, 569, 581, 599, 618, 637, 657, 677, 687, 700, 714, 730, 747, 760, 772, 783, 796, 807, 819, 829}
> -+var _RelocType_index = [...]uint16{0, 6, 17, 28, 38, 47, 53, 59, 68, 79, 88, 99, 109, 116, 123, 131, 139, 147, 153, 159, 165, 175, 184, 194, 210, 233, 244, 250, 261, 271, 280, 293, 307, 321, 335, 351, 362, 375, 388, 402, 416, 430, 445, 459, 473, 484, 498, 513, 530, 548, 569, 581, 599, 618, 637, 657, 677, 687, 700, 714, 730, 747, 760, 772, 783, 796, 813, 830, 843, 854, 865, 877, 887}
> ++var _RelocType_index = [...]uint16{0, 6, 17, 28, 38, 47, 53, 59, 68, 79, 88, 99, 109, 116, 123, 131, 139, 147, 153, 159, 165, 175, 184, 194, 210, 233, 244, 250, 261, 271, 280, 293, 307, 321, 335, 351, 362, 375, 388, 402, 416, 430, 445, 459, 473, 484, 498, 513, 530, 548, 569, 581, 599, 618, 637, 651, 665, 681, 697, 715, 735, 755, 769, 787, 803, 813, 826, 840, 856, 873, 886, 898, 909, 922, 939, 956, 969, 980, 991, 1003, 1013}
>
> func (i RelocType) String() string {
> i -= 1
> Index: patches/patch-src_cmd_link_internal_amd64_asm_go
> ===================================================================
> RCS file: patches/patch-src_cmd_link_internal_amd64_asm_go
> diff -N patches/patch-src_cmd_link_internal_amd64_asm_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_link_internal_amd64_asm_go 18 Sep 2022 07:51:23 -0000
> @@ -0,0 +1,12 @@
> +Index: src/cmd/link/internal/amd64/asm.go
> +--- src/cmd/link/internal/amd64/asm.go.orig
> ++++ src/cmd/link/internal/amd64/asm.go
> +@@ -551,7 +551,7 @@ func archrelocvariant(*ld.Target, *loader.Loader, load
> + return -1
> + }
> +
> +-func elfsetupplt(ctxt *ld.Link, plt, got *loader.SymbolBuilder, dynamic loader.Sym) {
> ++func elfsetupplt(ctxt *ld.Link, ldr *loader.Loader, plt, got *loader.SymbolBuilder, dynamic loader.Sym) {
> + if plt.Size() == 0 {
> + // pushq got+8(IP)
> + plt.AddUint8(0xff)
> Index: patches/patch-src_cmd_link_internal_arm64_asm_go
> ===================================================================
> RCS file: patches/patch-src_cmd_link_internal_arm64_asm_go
> diff -N patches/patch-src_cmd_link_internal_arm64_asm_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_link_internal_arm64_asm_go 18 Sep 2022 07:51:23 -0000
> @@ -0,0 +1,12 @@
> +Index: src/cmd/link/internal/arm64/asm.go
> +--- src/cmd/link/internal/arm64/asm.go.orig
> ++++ src/cmd/link/internal/arm64/asm.go
> +@@ -969,7 +969,7 @@ func extreloc(target *ld.Target, ldr *loader.Loader, r
> + return loader.ExtReloc{}, false
> + }
> +
> +-func elfsetupplt(ctxt *ld.Link, plt, gotplt *loader.SymbolBuilder, dynamic loader.Sym) {
> ++func elfsetupplt(ctxt *ld.Link, ldr *loader.Loader, plt, gotplt *loader.SymbolBuilder, dynamic loader.Sym) {
> + if plt.Size() == 0 {
> + // stp x16, x30, [sp, #-16]!
> + // identifying information
> Index: patches/patch-src_cmd_link_internal_arm_asm_go
> ===================================================================
> RCS file: patches/patch-src_cmd_link_internal_arm_asm_go
> diff -N patches/patch-src_cmd_link_internal_arm_asm_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_link_internal_arm_asm_go 18 Sep 2022 07:51:23 -0000
> @@ -0,0 +1,12 @@
> +Index: src/cmd/link/internal/arm/asm.go
> +--- src/cmd/link/internal/arm/asm.go.orig
> ++++ src/cmd/link/internal/arm/asm.go
> +@@ -304,7 +304,7 @@ func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loa
> + return true
> + }
> +
> +-func elfsetupplt(ctxt *ld.Link, plt, got *loader.SymbolBuilder, dynamic loader.Sym) {
> ++func elfsetupplt(ctxt *ld.Link, ldr *loader.Loader, plt, got *loader.SymbolBuilder, dynamic loader.Sym) {
> + if plt.Size() == 0 {
> + // str lr, [sp, #-4]!
> + plt.AddUint32(ctxt.Arch, 0xe52de004)
> Index: patches/patch-src_cmd_link_internal_ld_config_go
> ===================================================================
> RCS file: patches/patch-src_cmd_link_internal_ld_config_go
> diff -N patches/patch-src_cmd_link_internal_ld_config_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_link_internal_ld_config_go 18 Sep 2022 07:51:23 -0000
> @@ -0,0 +1,12 @@
> +Index: src/cmd/link/internal/ld/config.go
> +--- src/cmd/link/internal/ld/config.go.orig
> ++++ src/cmd/link/internal/ld/config.go
> +@@ -199,7 +199,7 @@ func mustLinkExternal(ctxt *Link) (res bool, reason st
> +
> + // Internally linking cgo is incomplete on some architectures.
> + // https://golang.org/issue/14449
> +- if iscgo && ctxt.Arch.InFamily(sys.Loong64, sys.MIPS64, sys.MIPS, sys.RISCV64) {
> ++ if iscgo && ctxt.Arch.InFamily(sys.Loong64, sys.MIPS64, sys.MIPS) {
> + return true, buildcfg.GOARCH + " does not support internal cgo"
> + }
> + if iscgo && (buildcfg.GOOS == "android" || buildcfg.GOOS == "dragonfly") {
> Index: patches/patch-src_cmd_link_internal_ld_data_go
> ===================================================================
> RCS file: patches/patch-src_cmd_link_internal_ld_data_go
> diff -N patches/patch-src_cmd_link_internal_ld_data_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_link_internal_ld_data_go 18 Sep 2022 07:51:23 -0000
> @@ -0,0 +1,40 @@
> +Index: src/cmd/link/internal/ld/data.go
> +--- src/cmd/link/internal/ld/data.go.orig
> ++++ src/cmd/link/internal/ld/data.go
> +@@ -269,6 +269,7 @@ func (st *relocSymState) relocsym(s loader.Sym, P []by
> + }
> +
> + var o int64
> ++ var archReloc bool
> + switch rt {
> + default:
> + switch siz {
> +@@ -283,6 +284,7 @@ func (st *relocSymState) relocsym(s loader.Sym, P []by
> + case 8:
> + o = int64(target.Arch.ByteOrder.Uint64(P[off:]))
> + }
> ++ archReloc = true
> + out, n, ok := thearch.Archreloc(target, ldr, syms, r, s, o)
> + if target.IsExternal() {
> + nExtReloc += n
> +@@ -562,17 +564,17 @@ func (st *relocSymState) relocsym(s loader.Sym, P []by
> + case 1:
> + P[off] = byte(int8(o))
> + case 2:
> +- if o != int64(int16(o)) {
> ++ if !archReloc && o != int64(int16(o)) {
> + st.err.Errorf(s, "relocation address for %s is too big: %#x", ldr.SymName(rs), o)
> + }
> + target.Arch.ByteOrder.PutUint16(P[off:], uint16(o))
> + case 4:
> + if rt == objabi.R_PCREL || rt == objabi.R_CALL {
> +- if o != int64(int32(o)) {
> ++ if !archReloc && o != int64(int32(o)) {
> + st.err.Errorf(s, "pc-relative relocation address for %s is too big: %#x", ldr.SymName(rs), o)
> + }
> + } else {
> +- if o != int64(int32(o)) && o != int64(uint32(o)) {
> ++ if !archReloc && o != int64(int32(o)) && o != int64(uint32(o)) {
> + st.err.Errorf(s, "non-pc-relative relocation address for %s is too big: %#x", ldr.SymName(rs), uint64(o))
> + }
> + }
> Index: patches/patch-src_cmd_link_internal_ld_elf_go
> ===================================================================
> RCS file: /cvs/ports/lang/go/patches/patch-src_cmd_link_internal_ld_elf_go,v
> retrieving revision 1.7
> diff -u -p -r1.7 patch-src_cmd_link_internal_ld_elf_go
> --- patches/patch-src_cmd_link_internal_ld_elf_go 28 Aug 2022 08:58:10 -0000 1.7
> +++ patches/patch-src_cmd_link_internal_ld_elf_go 18 Sep 2022 07:51:23 -0000
> @@ -1,7 +1,7 @@
> Index: src/cmd/link/internal/ld/elf.go
> --- src/cmd/link/internal/ld/elf.go.orig
> +++ src/cmd/link/internal/ld/elf.go
> -@@ -1475,6 +1475,15 @@ func (ctxt *Link) doelf() {
> +@@ -1475,11 +1475,20 @@ func (ctxt *Link) doelf() {
> dynamic := ldr.CreateSymForUpdate(".dynamic", 0)
> dynamic.SetType(sym.SELFSECT) // writable
>
> @@ -17,6 +17,12 @@ Index: src/cmd/link/internal/ld/elf.go
> if ctxt.IsS390X() {
> // S390X uses .got instead of .got.plt
> gotplt = got
> + }
> +- thearch.Elfsetupplt(ctxt, plt, gotplt, dynamic.Sym())
> ++ thearch.Elfsetupplt(ctxt, ctxt.loader, plt, gotplt, dynamic.Sym())
> +
> + /*
> + * .dynamic table
> @@ -1524,6 +1533,7 @@ func (ctxt *Link) doelf() {
> // DT_JMPREL is emitted so we have to defer generation of elf.DT_PLTREL,
> // DT_PLTRELSZ, and elf.DT_JMPREL dynamic entries until after we know the
> Index: patches/patch-src_cmd_link_internal_ld_lib_go
> ===================================================================
> RCS file: /cvs/ports/lang/go/patches/patch-src_cmd_link_internal_ld_lib_go,v
> retrieving revision 1.14
> diff -u -p -r1.14 patch-src_cmd_link_internal_ld_lib_go
> --- patches/patch-src_cmd_link_internal_ld_lib_go 28 Aug 2022 08:58:10 -0000 1.14
> +++ patches/patch-src_cmd_link_internal_ld_lib_go 18 Sep 2022 07:51:23 -0000
> @@ -1,7 +1,15 @@
> Index: src/cmd/link/internal/ld/lib.go
> --- src/cmd/link/internal/ld/lib.go.orig
> +++ src/cmd/link/internal/ld/lib.go
> -@@ -252,8 +252,11 @@ type Arch struct {
> +@@ -245,15 +245,18 @@ type Arch struct {
> +
> + Elfreloc1 func(*Link, *OutBuf, *loader.Loader, loader.Sym, loader.ExtReloc, int, int64) bool
> + ElfrelocSize uint32 // size of an ELF relocation record, must match Elfreloc1.
> +- Elfsetupplt func(ctxt *Link, plt, gotplt *loader.SymbolBuilder, dynamic loader.Sym)
> ++ Elfsetupplt func(ctxt *Link, ldr *loader.Loader, plt, gotplt *loader.SymbolBuilder, dynamic loader.Sym)
> + Gentext func(*Link, *loader.Loader) // Generate text before addressing has been performed.
> + Machoreloc1 func(*sys.Arch, *OutBuf, *loader.Loader, loader.Sym, loader.ExtReloc, int64) bool
> + MachorelocSize uint32 // size of an Mach-O relocation record, must match Machoreloc1.
> PEreloc1 func(*sys.Arch, *OutBuf, *loader.Loader, loader.Sym, loader.ExtReloc, int64) bool
> Xcoffreloc1 func(*sys.Arch, *OutBuf, *loader.Loader, loader.Sym, loader.ExtReloc, int64) bool
>
> Index: patches/patch-src_cmd_link_internal_ld_pcln_go
> ===================================================================
> RCS file: patches/patch-src_cmd_link_internal_ld_pcln_go
> diff -N patches/patch-src_cmd_link_internal_ld_pcln_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_link_internal_ld_pcln_go 18 Sep 2022 07:51:23 -0000
> @@ -0,0 +1,17 @@
> +Index: src/cmd/link/internal/ld/pcln.go
> +--- src/cmd/link/internal/ld/pcln.go.orig
> ++++ src/cmd/link/internal/ld/pcln.go
> +@@ -99,6 +99,13 @@ func makePclntab(ctxt *Link, container loader.Bitmap)
> + }
> +
> + func emitPcln(ctxt *Link, s loader.Sym, container loader.Bitmap) bool {
> ++ if ctxt.Target.IsRISCV64() {
> ++ symName := ctxt.loader.SymName(s)
> ++ if symName == "" || strings.HasPrefix(symName, ".L") {
> ++ return false
> ++ }
> ++ }
> ++
> + // We want to generate func table entries only for the "lowest
> + // level" symbols, not containers of subsymbols.
> + return !container.Has(s)
> Index: patches/patch-src_cmd_link_internal_loadelf_ldelf_go
> ===================================================================
> RCS file: patches/patch-src_cmd_link_internal_loadelf_ldelf_go
> diff -N patches/patch-src_cmd_link_internal_loadelf_ldelf_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_link_internal_loadelf_ldelf_go 18 Sep 2022 07:51:23 -0000
> @@ -0,0 +1,87 @@
> +Index: src/cmd/link/internal/loadelf/ldelf.go
> +--- src/cmd/link/internal/loadelf/ldelf.go.orig
> ++++ src/cmd/link/internal/loadelf/ldelf.go
> +@@ -583,27 +583,41 @@ func Load(l *loader.Loader, arch *sys.Arch, localSymVe
> + }
> + sect = &elfobj.sect[elfsym.shndx]
> + if sect.sym == 0 {
> +- if strings.HasPrefix(elfsym.name, ".Linfo_string") { // clang does this
> +- continue
> +- }
> ++ if elfsym.type_ == 0 {
> ++ if strings.HasPrefix(sect.name, ".debug_") && elfsym.name == "" {
> ++ // clang on arm and riscv64.
> ++ // This reportedly happens with clang 3.7 on ARM.
> ++ // See issue 13139.
> ++ continue
> ++ }
> ++ if strings.HasPrefix(elfsym.name, ".Ldebug_") || elfsym.name == ".L0 " {
> ++ // gcc on riscv64.
> ++ continue
> ++ }
> ++ if elfsym.name == ".Lline_table_start0" {
> ++ // clang on riscv64.
> ++ continue
> ++ }
> +
> +- if elfsym.name == "" && elfsym.type_ == 0 && sect.name == ".debug_str" {
> +- // This reportedly happens with clang 3.7 on ARM.
> +- // See issue 13139.
> +- continue
> ++ if strings.HasPrefix(elfsym.name, "$d") && sect.name == ".debug_frame" {
> ++ // "$d" is a marker, not a real symbol.
> ++ // This happens with gcc on ARM64.
> ++ // See https://sourceware.org/bugzilla/show_bug.cgi?id=21809
> ++ continue
> ++ }
> + }
> +
> +- if strings.HasPrefix(elfsym.name, "$d") && elfsym.type_ == 0 && sect.name == ".debug_frame" {
> +- // "$d" is a marker, not a real symbol.
> +- // This happens with gcc on ARM64.
> +- // See https://sourceware.org/bugzilla/show_bug.cgi?id=21809
> ++ if strings.HasPrefix(elfsym.name, ".Linfo_string") {
> ++ // clang does this
> + continue
> + }
> +
> +- if strings.HasPrefix(elfsym.name, ".LASF") { // gcc on s390x does this
> ++ if strings.HasPrefix(elfsym.name, ".LASF") || strings.HasPrefix(elfsym.name, ".LLST") {
> ++ // gcc on s390x and riscv64 does this.
> + continue
> + }
> +- return errorf("%v: sym#%d (%s): ignoring symbol in section %d (type %d)", elfsym.sym, i, elfsym.name, elfsym.shndx, elfsym.type_)
> ++
> ++ return errorf("%v: sym#%d (%q): ignoring symbol in section %d (%q) (type %d)", elfsym.sym, i, elfsym.name, elfsym.shndx, sect.name, elfsym.type_)
> + }
> +
> + s := elfsym.sym
> +@@ -1079,8 +1093,16 @@ func relSize(arch *sys.Arch, pn string, elftype uint32
> + S390X | uint32(elf.R_390_PLT64)<<16:
> + return 8, 8, nil
> +
> ++ case RISCV64 | uint32(elf.R_RISCV_SET6)<<16,
> ++ RISCV64 | uint32(elf.R_RISCV_SUB6)<<16,
> ++ RISCV64 | uint32(elf.R_RISCV_SET8)<<16,
> ++ RISCV64 | uint32(elf.R_RISCV_SUB8)<<16:
> ++ return 1, 1, nil
> ++
> + case RISCV64 | uint32(elf.R_RISCV_RVC_BRANCH)<<16,
> +- RISCV64 | uint32(elf.R_RISCV_RVC_JUMP)<<16:
> ++ RISCV64 | uint32(elf.R_RISCV_RVC_JUMP)<<16,
> ++ RISCV64 | uint32(elf.R_RISCV_SET16)<<16,
> ++ RISCV64 | uint32(elf.R_RISCV_SUB16)<<16:
> + return 2, 2, nil
> +
> + case RISCV64 | uint32(elf.R_RISCV_32)<<16,
> +@@ -1092,6 +1114,10 @@ func relSize(arch *sys.Arch, pn string, elftype uint32
> + RISCV64 | uint32(elf.R_RISCV_PCREL_HI20)<<16,
> + RISCV64 | uint32(elf.R_RISCV_PCREL_LO12_I)<<16,
> + RISCV64 | uint32(elf.R_RISCV_PCREL_LO12_S)<<16,
> ++ RISCV64 | uint32(elf.R_RISCV_ADD32)<<16,
> ++ RISCV64 | uint32(elf.R_RISCV_SET32)<<16,
> ++ RISCV64 | uint32(elf.R_RISCV_SUB32)<<16,
> ++ RISCV64 | uint32(elf.R_RISCV_32_PCREL)<<16,
> + RISCV64 | uint32(elf.R_RISCV_RELAX)<<16:
> + return 4, 4, nil
> +
> Index: patches/patch-src_cmd_link_internal_loong64_asm_go
> ===================================================================
> RCS file: patches/patch-src_cmd_link_internal_loong64_asm_go
> diff -N patches/patch-src_cmd_link_internal_loong64_asm_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_link_internal_loong64_asm_go 18 Sep 2022 07:51:23 -0000
> @@ -0,0 +1,12 @@
> +Index: src/cmd/link/internal/loong64/asm.go
> +--- src/cmd/link/internal/loong64/asm.go.orig
> ++++ src/cmd/link/internal/loong64/asm.go
> +@@ -145,7 +145,7 @@ func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loa
> + return true
> + }
> +
> +-func elfsetupplt(ctxt *ld.Link, plt, gotplt *loader.SymbolBuilder, dynamic loader.Sym) {
> ++func elfsetupplt(ctxt *ld.Link, ldr *loader.Loader, plt, gotplt *loader.SymbolBuilder, dynamic loader.Sym) {
> + return
> + }
> +
> Index: patches/patch-src_cmd_link_internal_mips64_asm_go
> ===================================================================
> RCS file: /cvs/ports/lang/go/patches/patch-src_cmd_link_internal_mips64_asm_go,v
> retrieving revision 1.6
> diff -u -p -r1.6 patch-src_cmd_link_internal_mips64_asm_go
> --- patches/patch-src_cmd_link_internal_mips64_asm_go 28 Aug 2022 08:58:10 -0000 1.6
> +++ patches/patch-src_cmd_link_internal_mips64_asm_go 18 Sep 2022 07:51:23 -0000
> @@ -134,7 +134,7 @@ Index: src/cmd/link/internal/mips64/asm.
> return false
> case objabi.R_ADDR, objabi.R_DWARFSECREF:
> switch r.Size {
> -@@ -85,9 +193,16 @@ func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loa
> +@@ -85,23 +193,193 @@ func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loa
> // via the external linker.
> addend += 0x7000
> }
> @@ -153,11 +153,12 @@ Index: src/cmd/link/internal/mips64/asm.
> }
> out.Write64(uint64(addend))
>
> -@@ -95,13 +210,176 @@ func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loa
> + return true
> }
>
> - func elfsetupplt(ctxt *ld.Link, plt, gotplt *loader.SymbolBuilder, dynamic loader.Sym) {
> +-func elfsetupplt(ctxt *ld.Link, plt, gotplt *loader.SymbolBuilder, dynamic loader.Sym) {
> - return
> ++func elfsetupplt(ctxt *ld.Link, ldr *loader.Loader, plt, gotplt *loader.SymbolBuilder, dynamic loader.Sym) {
> + if plt.Size() != 0 {
> + return
> + }
> Index: patches/patch-src_cmd_link_internal_mips_asm_go
> ===================================================================
> RCS file: patches/patch-src_cmd_link_internal_mips_asm_go
> diff -N patches/patch-src_cmd_link_internal_mips_asm_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_link_internal_mips_asm_go 18 Sep 2022 07:51:23 -0000
> @@ -0,0 +1,12 @@
> +Index: src/cmd/link/internal/mips/asm.go
> +--- src/cmd/link/internal/mips/asm.go.orig
> ++++ src/cmd/link/internal/mips/asm.go
> +@@ -68,7 +68,7 @@ func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loa
> + return true
> + }
> +
> +-func elfsetupplt(ctxt *ld.Link, plt, gotplt *loader.SymbolBuilder, dynamic loader.Sym) {
> ++func elfsetupplt(ctxt *ld.Link, ldr *loader.Loader, plt, gotplt *loader.SymbolBuilder, dynamic loader.Sym) {
> + return
> + }
> +
> Index: patches/patch-src_cmd_link_internal_ppc64_asm_go
> ===================================================================
> RCS file: patches/patch-src_cmd_link_internal_ppc64_asm_go
> diff -N patches/patch-src_cmd_link_internal_ppc64_asm_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_link_internal_ppc64_asm_go 18 Sep 2022 07:51:23 -0000
> @@ -0,0 +1,12 @@
> +Index: src/cmd/link/internal/ppc64/asm.go
> +--- src/cmd/link/internal/ppc64/asm.go.orig
> ++++ src/cmd/link/internal/ppc64/asm.go
> +@@ -689,7 +689,7 @@ func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loa
> + return true
> + }
> +
> +-func elfsetupplt(ctxt *ld.Link, plt, got *loader.SymbolBuilder, dynamic loader.Sym) {
> ++func elfsetupplt(ctxt *ld.Link, ldr *loader.Loader, plt, got *loader.SymbolBuilder, dynamic loader.Sym) {
> + if plt.Size() == 0 {
> + // The dynamic linker stores the address of the
> + // dynamic resolver and the DSO identifier in the two
> Index: patches/patch-src_cmd_link_internal_riscv64_asm_go
> ===================================================================
> RCS file: patches/patch-src_cmd_link_internal_riscv64_asm_go
> diff -N patches/patch-src_cmd_link_internal_riscv64_asm_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_link_internal_riscv64_asm_go 18 Sep 2022 07:51:24 -0000
> @@ -0,0 +1,500 @@
> +Index: src/cmd/link/internal/riscv64/asm.go
> +--- src/cmd/link/internal/riscv64/asm.go.orig
> ++++ src/cmd/link/internal/riscv64/asm.go
> +@@ -20,9 +20,146 @@ import (
> + // fakeLabelName matches the RISCV_FAKE_LABEL_NAME from binutils.
> + const fakeLabelName = ".L0 "
> +
> +-func gentext(ctxt *ld.Link, ldr *loader.Loader) {
> ++func gentext(ctxt *ld.Link, ldr *loader.Loader) {}
> ++
> ++func findHI20Reloc(ldr *loader.Loader, s loader.Sym, val int64) *loader.Reloc {
> ++ outer := ldr.OuterSym(s)
> ++ if outer == 0 {
> ++ return nil
> ++ }
> ++ relocs := ldr.Relocs(outer)
> ++ start := sort.Search(relocs.Count(), func(i int) bool { return ldr.SymValue(outer)+int64(relocs.At(i).Off()) >= val })
> ++ for idx := start; idx < relocs.Count(); idx++ {
> ++ r := relocs.At(idx)
> ++ if ldr.SymValue(outer)+int64(r.Off()) != val {
> ++ break
> ++ }
> ++ if r.Type() == objabi.R_RISCV_GOT_HI20 || r.Type() == objabi.R_RISCV_PCREL_HI20 {
> ++ return &r
> ++ }
> ++ }
> ++ return nil
> + }
> +
> ++func adddynrel(target *ld.Target, ldr *loader.Loader, syms *ld.ArchSyms, s loader.Sym, r loader.Reloc, rIdx int) bool {
> ++ targ := r.Sym()
> ++
> ++ var targType sym.SymKind
> ++ if targ != 0 {
> ++ targType = ldr.SymType(targ)
> ++ }
> ++
> ++ switch r.Type() {
> ++ case objabi.ElfRelocOffset + objabi.RelocType(elf.R_RISCV_CALL),
> ++ objabi.ElfRelocOffset + objabi.RelocType(elf.R_RISCV_CALL_PLT):
> ++
> ++ if targType == sym.SDYNIMPORT {
> ++ addpltsym(target, ldr, syms, targ)
> ++ su := ldr.MakeSymbolUpdater(s)
> ++ su.SetRelocSym(rIdx, syms.PLT)
> ++ su.SetRelocAdd(rIdx, r.Add()+int64(ldr.SymPlt(targ)))
> ++ }
> ++ if (targType == 0 || targType == sym.SXREF) && !ldr.AttrVisibilityHidden(targ) {
> ++ ldr.Errorf(s, "unknown symbol %s in RISCV call", ldr.SymName(targ))
> ++ }
> ++ su := ldr.MakeSymbolUpdater(s)
> ++ su.SetRelocType(rIdx, objabi.R_RISCV_PCREL_ITYPE)
> ++ return true
> ++
> ++ case objabi.ElfRelocOffset + objabi.RelocType(elf.R_RISCV_GOT_HI20):
> ++ if targType != sym.SDYNIMPORT {
> ++ // TODO(jsing): Could convert to non-GOT reference.
> ++ }
> ++
> ++ ld.AddGotSym(target, ldr, syms, targ, uint32(elf.R_RISCV_64))
> ++ su := ldr.MakeSymbolUpdater(s)
> ++ su.SetRelocType(rIdx, objabi.R_RISCV_GOT_HI20)
> ++ su.SetRelocSym(rIdx, syms.GOT)
> ++ su.SetRelocAdd(rIdx, r.Add()+int64(ldr.SymGot(targ)))
> ++ return true
> ++
> ++ case objabi.ElfRelocOffset + objabi.RelocType(elf.R_RISCV_PCREL_HI20):
> ++ su := ldr.MakeSymbolUpdater(s)
> ++ su.SetRelocType(rIdx, objabi.R_RISCV_PCREL_HI20)
> ++ return true
> ++
> ++ case objabi.ElfRelocOffset + objabi.RelocType(elf.R_RISCV_PCREL_LO12_I):
> ++ if r.Add() != 0 {
> ++ ldr.Errorf(s, "R_RISCV_PCREL_LO12_I with non-zero addend")
> ++ }
> ++ su := ldr.MakeSymbolUpdater(s)
> ++ su.SetRelocType(rIdx, objabi.R_RISCV_PCREL_LO12_I)
> ++ return true
> ++
> ++ case objabi.ElfRelocOffset + objabi.RelocType(elf.R_RISCV_PCREL_LO12_S):
> ++ if r.Add() != 0 {
> ++ ldr.Errorf(s, "R_RISCV_PCREL_LO12_S with non-zero addend")
> ++ }
> ++ su := ldr.MakeSymbolUpdater(s)
> ++ su.SetRelocType(rIdx, objabi.R_RISCV_PCREL_LO12_S)
> ++ return true
> ++
> ++ case objabi.ElfRelocOffset + objabi.RelocType(elf.R_RISCV_32_PCREL):
> ++ su := ldr.MakeSymbolUpdater(s)
> ++ su.SetRelocType(rIdx, objabi.R_RISCV_PCREL_32)
> ++ return true
> ++
> ++ case objabi.ElfRelocOffset + objabi.RelocType(elf.R_RISCV_RVC_BRANCH):
> ++ su := ldr.MakeSymbolUpdater(s)
> ++ su.SetRelocType(rIdx, objabi.R_RISCV_RVC_BRANCH)
> ++ return true
> ++
> ++ case objabi.ElfRelocOffset + objabi.RelocType(elf.R_RISCV_RVC_JUMP):
> ++ su := ldr.MakeSymbolUpdater(s)
> ++ su.SetRelocType(rIdx, objabi.R_RISCV_RVC_JUMP)
> ++ return true
> ++
> ++ case objabi.ElfRelocOffset + objabi.RelocType(elf.R_RISCV_BRANCH):
> ++ su := ldr.MakeSymbolUpdater(s)
> ++ su.SetRelocType(rIdx, objabi.R_RISCV_BRANCH)
> ++ return true
> ++
> ++ case objabi.ElfRelocOffset + objabi.RelocType(elf.R_RISCV_RELAX):
> ++ // Ignore relaxations, at least for now.
> ++ return true
> ++
> ++ default:
> ++ if r.Type() >= objabi.ElfRelocOffset {
> ++ ldr.Errorf(s, "unexpected relocation type %d (%s)", r.Type(), sym.RelocName(target.Arch, r.Type()))
> ++ return false
> ++ }
> ++ }
> ++
> ++ // Reread the reloc to incorporate any changes in type above.
> ++ relocs := ldr.Relocs(s)
> ++ r = relocs.At(rIdx)
> ++
> ++ switch r.Type() {
> ++ case objabi.R_RISCV_PCREL_ITYPE:
> ++ if targType != sym.SDYNIMPORT {
> ++ // nothing to do, the relocation will be laid out in reloc
> ++ return true
> ++ }
> ++ if target.IsExternal() {
> ++ // External linker will do this relocation.
> ++ return true
> ++ }
> ++ // Internal linking.
> ++ if r.Add() != 0 {
> ++ ldr.Errorf(s, "PLT reference with non-zero addend (%v)", r.Add())
> ++ }
> ++ // Build a PLT entry and change the relocation target to that entry.
> ++ addpltsym(target, ldr, syms, targ)
> ++ su := ldr.MakeSymbolUpdater(s)
> ++ su.SetRelocSym(rIdx, syms.PLT)
> ++ su.SetRelocAdd(rIdx, int64(ldr.SymPlt(targ)))
> ++
> ++ return true
> ++ }
> ++
> ++ return false
> ++}
> ++
> + func genSymsLate(ctxt *ld.Link, ldr *loader.Loader) {
> + if ctxt.LinkMode != ld.LinkExternal {
> + return
> +@@ -39,7 +176,7 @@ func genSymsLate(ctxt *ld.Link, ldr *loader.Loader) {
> + for ri := 0; ri < relocs.Count(); ri++ {
> + r := relocs.At(ri)
> + if r.Type() != objabi.R_RISCV_PCREL_ITYPE && r.Type() != objabi.R_RISCV_PCREL_STYPE &&
> +- r.Type() != objabi.R_RISCV_TLS_IE_ITYPE && r.Type() != objabi.R_RISCV_TLS_IE_STYPE {
> ++ r.Type() != objabi.R_RISCV_TLS_IE {
> + continue
> + }
> + if r.Off() == 0 && ldr.SymType(s) == sym.STEXT {
> +@@ -101,7 +238,7 @@ func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loa
> + out.Write64(uint64(elf.R_RISCV_JAL) | uint64(elfsym)<<32)
> + out.Write64(uint64(r.Xadd))
> +
> +- case objabi.R_RISCV_PCREL_ITYPE, objabi.R_RISCV_PCREL_STYPE, objabi.R_RISCV_TLS_IE_ITYPE, objabi.R_RISCV_TLS_IE_STYPE:
> ++ case objabi.R_RISCV_PCREL_ITYPE, objabi.R_RISCV_PCREL_STYPE, objabi.R_RISCV_TLS_IE:
> + // Find the text symbol for the AUIPC instruction targeted
> + // by this relocation.
> + relocs := ldr.Relocs(s)
> +@@ -127,10 +264,8 @@ func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loa
> + hiRel, loRel = elf.R_RISCV_PCREL_HI20, elf.R_RISCV_PCREL_LO12_I
> + case objabi.R_RISCV_PCREL_STYPE:
> + hiRel, loRel = elf.R_RISCV_PCREL_HI20, elf.R_RISCV_PCREL_LO12_S
> +- case objabi.R_RISCV_TLS_IE_ITYPE:
> ++ case objabi.R_RISCV_TLS_IE:
> + hiRel, loRel = elf.R_RISCV_TLS_GOT_HI20, elf.R_RISCV_PCREL_LO12_I
> +- case objabi.R_RISCV_TLS_IE_STYPE:
> +- hiRel, loRel = elf.R_RISCV_TLS_GOT_HI20, elf.R_RISCV_PCREL_LO12_S
> + }
> + out.Write64(uint64(sectoff))
> + out.Write64(uint64(hiRel) | uint64(elfsym)<<32)
> +@@ -139,6 +274,17 @@ func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loa
> + out.Write64(uint64(loRel) | uint64(hi20ElfSym)<<32)
> + out.Write64(uint64(0))
> +
> ++ case objabi.R_RISCV_TLS_LE:
> ++ out.Write64(uint64(sectoff))
> ++ out.Write64(uint64(elf.R_RISCV_TPREL_HI20) | uint64(elfsym)<<32)
> ++ out.Write64(uint64(r.Xadd))
> ++ out.Write64(uint64(sectoff + 4))
> ++ out.Write64(uint64(elf.R_RISCV_TPREL_LO12_I) | uint64(elfsym)<<32)
> ++ out.Write64(uint64(r.Xadd))
> ++ out.Write64(uint64(sectoff + 8))
> ++ out.Write64(uint64(elf.R_RISCV_TPREL_ADD) | uint64(elfsym)<<32)
> ++ out.Write64(uint64(0))
> ++
> + default:
> + return false
> + }
> +@@ -146,10 +292,104 @@ func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loa
> + return true
> + }
> +
> +-func elfsetupplt(ctxt *ld.Link, plt, gotplt *loader.SymbolBuilder, dynamic loader.Sym) {
> +- log.Fatalf("elfsetupplt")
> ++func elfsetupplt(ctxt *ld.Link, ldr *loader.Loader, plt, gotplt *loader.SymbolBuilder, dynamic loader.Sym) {
> ++ if plt.Size() != 0 {
> ++ return
> ++ }
> ++ if gotplt.Size() != 0 {
> ++ ctxt.Errorf(gotplt.Sym(), "got.plt is not empty")
> ++ }
> ++
> ++ // https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#program-linkage-table
> ++ //
> ++ // 1: auipc t2, %pcrel_hi(.got.plt)
> ++ // sub t1, t1, t3 # shifted .got.plt offset + hdr size + 12
> ++ // l[w|d] t3, %pcrel_lo(1b)(t2) # _dl_runtime_resolve
> ++ // addi t1, t1, -(hdr size + 12) # shifted .got.plt offset
> ++ // addi t0, t2, %pcrel_lo(1b) # &.got.plt
> ++ // srli t1, t1, log2(16/PTRSIZE) # .got.plt offset
> ++ // l[w|d] t0, PTRSIZE(t0) # link map
> ++ // jr t3
> ++
> ++ plt.AddSymRef(ctxt.Arch, gotplt.Sym(), 0, objabi.R_RISCV_PCREL_HI20, 4)
> ++ plt.SetUint32(ctxt.Arch, plt.Size()-4, 0x00000397) // auipc t2,0x0
> ++
> ++ sb := ldr.MakeSymbolBuilder(fakeLabelName)
> ++ sb.SetType(sym.STEXT)
> ++ sb.SetValue(ldr.SymValue(plt.Sym()) + plt.Size() - 4)
> ++ sb.SetLocal(true)
> ++ sb.SetReachable(true)
> ++ sb.SetVisibilityHidden(true)
> ++ plt.AddInteriorSym(sb.Sym())
> ++
> ++ plt.AddUint32(ctxt.Arch, 0x41c30333) // sub t1,t1,t3
> ++
> ++ plt.AddSymRef(ctxt.Arch, sb.Sym(), 0, objabi.R_RISCV_PCREL_LO12_I, 4)
> ++ plt.SetUint32(ctxt.Arch, plt.Size()-4, 0x0003be03) // ld t3,0(t2)
> ++
> ++ plt.AddUint32(ctxt.Arch, 0xfd430313) // addi t1,t1,-44
> ++
> ++ plt.AddSymRef(ctxt.Arch, sb.Sym(), 0, objabi.R_RISCV_PCREL_LO12_I, 4)
> ++ plt.SetUint32(ctxt.Arch, plt.Size()-4, 0x00038293) // addi t0,t2,0
> ++
> ++ plt.AddUint32(ctxt.Arch, 0x00135313) // srli t1,t1,0x1
> ++ plt.AddUint32(ctxt.Arch, 0x0082b283) // ld t0,8(t0)
> ++ plt.AddUint32(ctxt.Arch, 0x00008e02) // jr t3
> ++
> ++ gotplt.AddAddrPlus(ctxt.Arch, dynamic, 0) // got.plt[0] = _dl_runtime_resolve
> ++ gotplt.AddUint64(ctxt.Arch, 0) // got.plt[1] = link map
> + }
> +
> ++func addpltsym(target *ld.Target, ldr *loader.Loader, syms *ld.ArchSyms, s loader.Sym) {
> ++ if ldr.SymPlt(s) >= 0 {
> ++ return
> ++ }
> ++
> ++ ld.Adddynsym(ldr, target, syms, s)
> ++
> ++ plt := ldr.MakeSymbolUpdater(syms.PLT)
> ++ gotplt := ldr.MakeSymbolUpdater(syms.GOTPLT)
> ++ rela := ldr.MakeSymbolUpdater(syms.RelaPLT)
> ++ if plt.Size() == 0 {
> ++ panic("plt is not set up")
> ++ }
> ++
> ++ // https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#program-linkage-table
> ++ //
> ++ // 1: auipc t3, %pcrel_hi(function@.got.plt)
> ++ // l[w|d] t3, %pcrel_lo(1b)(t3)
> ++ // jalr t1, t3
> ++ // nop
> ++
> ++ plt.AddSymRef(target.Arch, gotplt.Sym(), gotplt.Size(), objabi.R_RISCV_PCREL_HI20, 4)
> ++ plt.SetUint32(target.Arch, plt.Size()-4, 0x00000e17) // auipc t3,0x0
> ++
> ++ sb := ldr.MakeSymbolBuilder(fakeLabelName)
> ++ sb.SetType(sym.STEXT)
> ++ sb.SetValue(ldr.SymValue(plt.Sym()) + plt.Size() - 4)
> ++ sb.SetLocal(true)
> ++ sb.SetReachable(true)
> ++ sb.SetVisibilityHidden(true)
> ++ plt.AddInteriorSym(sb.Sym())
> ++
> ++ plt.AddSymRef(target.Arch, sb.Sym(), 0, objabi.R_RISCV_PCREL_LO12_I, 4)
> ++ plt.SetUint32(target.Arch, plt.Size()-4, 0x000e3e03) // ld t3,0(t3)
> ++ plt.AddUint32(target.Arch, 0x000e0367) // jalr t1,t3
> ++ plt.AddUint32(target.Arch, 0x00000001) // nop
> ++
> ++ ldr.SetPlt(s, int32(plt.Size()-16))
> ++
> ++ // add to got.plt: pointer to plt[0]
> ++ gotplt.AddAddrPlus(target.Arch, plt.Sym(), 0)
> ++
> ++ // rela
> ++ rela.AddAddrPlus(target.Arch, gotplt.Sym(), gotplt.Size()-8)
> ++ sDynid := ldr.SymDynid(s)
> ++
> ++ rela.AddUint64(target.Arch, elf.R_INFO(uint32(sDynid), uint32(elf.R_RISCV_JUMP_SLOT)))
> ++ rela.AddUint64(target.Arch, 0)
> ++}
> ++
> + func machoreloc1(*sys.Arch, *ld.OutBuf, *loader.Loader, loader.Sym, loader.ExtReloc, int64) bool {
> + log.Fatalf("machoreloc1 not implemented")
> + return false
> +@@ -189,8 +429,11 @@ func archreloc(target *ld.Target, ldr *loader.Loader,
> + case objabi.R_RISCV_CALL, objabi.R_RISCV_CALL_TRAMP:
> + return val, 1, true
> +
> +- case objabi.R_RISCV_PCREL_ITYPE, objabi.R_RISCV_PCREL_STYPE, objabi.R_RISCV_TLS_IE_ITYPE, objabi.R_RISCV_TLS_IE_STYPE:
> ++ case objabi.R_RISCV_PCREL_ITYPE, objabi.R_RISCV_PCREL_STYPE, objabi.R_RISCV_TLS_IE:
> + return val, 2, true
> ++
> ++ case objabi.R_RISCV_TLS_LE:
> ++ return val, 3, true
> + }
> +
> + return val, 0, false
> +@@ -211,16 +454,132 @@ func archreloc(target *ld.Target, ldr *loader.Loader,
> +
> + return val, 0, true
> +
> +- case objabi.R_RISCV_TLS_IE_ITYPE, objabi.R_RISCV_TLS_IE_STYPE:
> +- // TLS relocations are not currently handled for internal linking.
> +- // For now, TLS is only used when cgo is in use and cgo currently
> +- // requires external linking. However, we need to accept these
> +- // relocations so that code containing TLS variables will link,
> +- // even when they're not being used. For now, replace these
> +- // instructions with EBREAK to detect accidental use.
> +- const ebreakIns = 0x00100073
> +- return ebreakIns<<32 | ebreakIns, 0, true
> ++ case objabi.R_RISCV_TLS_IE:
> ++ log.Fatalf("cannot handle R_RISCV_TLS_IE (sym %s) when linking internally", ldr.SymName(s))
> ++ return val, 0, false
> +
> ++ case objabi.R_RISCV_TLS_LE:
> ++ // Generate LUI and ADDIW instruction immediates.
> ++ off := r.Add()
> ++
> ++ low, high, err := riscv.Split32BitImmediate(off)
> ++ if err != nil {
> ++ ldr.Errorf(s, "relocation does not fit in 32-bits: %d", off)
> ++ }
> ++
> ++ luiImm, err := riscv.EncodeUImmediate(high)
> ++ if err != nil {
> ++ ldr.Errorf(s, "cannot encode R_RISCV_TLS_LE LUI relocation offset for %s: %v", ldr.SymName(rs), err)
> ++ }
> ++
> ++ addiwImm, err := riscv.EncodeIImmediate(low)
> ++ if err != nil {
> ++ ldr.Errorf(s, "cannot encode R_RISCV_TLS_LE I-type instruction relocation offset for %s: %v", ldr.SymName(rs), err)
> ++ }
> ++
> ++ lui := int64(uint32(val))
> ++ addiw := int64(uint32(val >> 32))
> ++
> ++ lui = (lui &^ riscv.UTypeImmMask) | int64(uint32(luiImm))
> ++ addiw = (addiw &^ riscv.ITypeImmMask) | int64(uint32(addiwImm))
> ++
> ++ return addiw<<32 | lui, 0, true
> ++
> ++ case objabi.R_RISCV_BRANCH:
> ++ pc := ldr.SymValue(s) + int64(r.Off())
> ++ off := ldr.SymValue(rs) + r.Add() - pc
> ++
> ++ imm, err := riscv.EncodeBImmediate(off)
> ++ if err != nil {
> ++ ldr.Errorf(s, "cannot encode B-type instruction relocation offset for %s: %v", ldr.SymName(rs), err)
> ++ }
> ++ ins := (int64(uint32(val)) &^ riscv.BTypeImmMask) | int64(uint32(imm))
> ++
> ++ return ins, 0, true
> ++
> ++ case objabi.R_RISCV_RVC_BRANCH, objabi.R_RISCV_RVC_JUMP:
> ++ pc := ldr.SymValue(s) + int64(r.Off())
> ++ off := ldr.SymValue(rs) + r.Add() - pc
> ++
> ++ var err error
> ++ var imm, immMask int64
> ++ switch r.Type() {
> ++ case objabi.R_RISCV_RVC_BRANCH:
> ++ immMask = riscv.CBTypeImmMask
> ++ imm, err = riscv.EncodeCBImmediate(off)
> ++ if err != nil {
> ++ ldr.Errorf(s, "cannot encode CB-type instruction relocation offset for %s: %v", ldr.SymName(rs), err)
> ++ }
> ++ case objabi.R_RISCV_RVC_JUMP:
> ++ immMask = riscv.CJTypeImmMask
> ++ imm, err = riscv.EncodeCJImmediate(off)
> ++ if err != nil {
> ++ ldr.Errorf(s, "cannot encode CJ-type instruction relocation offset for %s: %v", ldr.SymName(rs), err)
> ++ }
> ++ default:
> ++ panic(fmt.Sprintf("unknown relocation type: %v", r.Type()))
> ++ }
> ++
> ++ ins := (int64(uint16(val)) &^ immMask) | int64(uint16(imm))
> ++
> ++ return ins, 0, true
> ++
> ++ case objabi.R_RISCV_GOT_HI20, objabi.R_RISCV_PCREL_HI20:
> ++ pc := ldr.SymValue(s) + int64(r.Off())
> ++ off := ldr.SymValue(rs) + r.Add() - pc
> ++
> ++ // Generate AUIPC immediates.
> ++ _, high, err := riscv.Split32BitImmediate(off)
> ++ if err != nil {
> ++ ldr.Errorf(s, "relocation does not fit in 32-bits: %d", off)
> ++ }
> ++
> ++ auipcImm, err := riscv.EncodeUImmediate(high)
> ++ if err != nil {
> ++ ldr.Errorf(s, "cannot encode R_RISCV_PCREL_ AUIPC relocation offset for %s: %v", ldr.SymName(rs), err)
> ++ }
> ++
> ++ auipc := int64(uint32(val))
> ++ auipc = (auipc &^ riscv.UTypeImmMask) | int64(uint32(auipcImm))
> ++
> ++ return auipc, 0, true
> ++
> ++ case objabi.R_RISCV_PCREL_LO12_I, objabi.R_RISCV_PCREL_LO12_S:
> ++ hi20Reloc := findHI20Reloc(ldr, rs, ldr.SymValue(rs))
> ++ if hi20Reloc == nil {
> ++ ldr.Errorf(s, "missing HI20 relocation for LO12 relocation with %s (%d)", ldr.SymName(rs), rs)
> ++ }
> ++
> ++ pc := ldr.SymValue(s) + int64(hi20Reloc.Off())
> ++ off := ldr.SymValue(hi20Reloc.Sym()) + hi20Reloc.Add() - pc
> ++
> ++ low, _, err := riscv.Split32BitImmediate(off)
> ++ if err != nil {
> ++ ldr.Errorf(s, "relocation does not fit in 32-bits: %d", off)
> ++ }
> ++
> ++ var imm, immMask int64
> ++ switch r.Type() {
> ++ case objabi.R_RISCV_PCREL_LO12_I:
> ++ immMask = riscv.ITypeImmMask
> ++ imm, err = riscv.EncodeIImmediate(low)
> ++ if err != nil {
> ++ ldr.Errorf(s, "cannot encode objabi.R_RISCV_PCREL_LO12_I I-type instruction relocation offset for %s: %v", ldr.SymName(rs), err)
> ++ }
> ++ case objabi.R_RISCV_PCREL_LO12_S:
> ++ immMask = riscv.STypeImmMask
> ++ imm, err = riscv.EncodeSImmediate(low)
> ++ if err != nil {
> ++ ldr.Errorf(s, "cannot encode R_RISCV_PCREL_LO12_S S-type instruction relocation offset for %s: %v", ldr.SymName(rs), err)
> ++ }
> ++ default:
> ++ panic(fmt.Sprintf("unknown relocation type: %v", r.Type()))
> ++ }
> ++
> ++ second := int64(uint32(val))
> ++ second = (second &^ immMask) | int64(uint32(imm))
> ++ return second, 0, true
> ++
> + case objabi.R_RISCV_PCREL_ITYPE, objabi.R_RISCV_PCREL_STYPE:
> + // Generate AUIPC and second instruction immediates.
> + low, high, err := riscv.Split32BitImmediate(off)
> +@@ -248,7 +607,7 @@ func archreloc(target *ld.Target, ldr *loader.Loader,
> + ldr.Errorf(s, "cannot encode R_RISCV_PCREL_STYPE S-type instruction relocation offset for %s: %v", ldr.SymName(rs), err)
> + }
> + default:
> +- panic(fmt.Sprintf("Unknown relocation type: %v", r.Type()))
> ++ panic(fmt.Sprintf("unknown relocation type: %v", r.Type()))
> + }
> +
> + auipc := int64(uint32(val))
> +@@ -258,6 +617,11 @@ func archreloc(target *ld.Target, ldr *loader.Loader,
> + second = (second &^ secondImmMask) | int64(uint32(secondImm))
> +
> + return second<<32 | auipc, 0, true
> ++
> ++ case objabi.R_RISCV_PCREL_32:
> ++ pc := ldr.SymValue(s) + int64(r.Off())
> ++ off := ldr.SymValue(rs) + r.Add() - pc
> ++ return off, 0, true
> + }
> +
> + return val, 0, false
> +@@ -273,7 +637,7 @@ func extreloc(target *ld.Target, ldr *loader.Loader, r
> + case objabi.R_RISCV_CALL, objabi.R_RISCV_CALL_TRAMP:
> + return ld.ExtrelocSimple(ldr, r), true
> +
> +- case objabi.R_RISCV_PCREL_ITYPE, objabi.R_RISCV_PCREL_STYPE, objabi.R_RISCV_TLS_IE_ITYPE, objabi.R_RISCV_TLS_IE_STYPE:
> ++ case objabi.R_RISCV_PCREL_ITYPE, objabi.R_RISCV_PCREL_STYPE, objabi.R_RISCV_TLS_IE, objabi.R_RISCV_TLS_LE:
> + return ld.ExtrelocViaOuterSym(ldr, r, s), true
> + }
> + return loader.ExtReloc{}, false
> +@@ -352,7 +716,7 @@ func trampoline(ctxt *ld.Link, ldr *loader.Loader, ri
> +
> + func genCallTramp(arch *sys.Arch, linkmode ld.LinkMode, ldr *loader.Loader, tramp *loader.SymbolBuilder, target loader.Sym, offset int64) {
> + tramp.AddUint32(arch, 0x00000f97) // AUIPC $0, X31
> +- tramp.AddUint32(arch, 0x000f8067) // JALR X0, (X31)
> ++ tramp.AddUint32(arch, 0x000f8067) // JALR X0, (X31)
> +
> + r, _ := tramp.AddRel(objabi.R_RISCV_PCREL_ITYPE)
> + r.SetSiz(8)
> Index: patches/patch-src_cmd_link_internal_riscv64_obj_go
> ===================================================================
> RCS file: patches/patch-src_cmd_link_internal_riscv64_obj_go
> diff -N patches/patch-src_cmd_link_internal_riscv64_obj_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_link_internal_riscv64_obj_go 18 Sep 2022 07:51:24 -0000
> @@ -0,0 +1,33 @@
> +Index: src/cmd/link/internal/riscv64/obj.go
> +--- src/cmd/link/internal/riscv64/obj.go.orig
> ++++ src/cmd/link/internal/riscv64/obj.go
> +@@ -20,6 +20,7 @@ func Init() (*sys.Arch, ld.Arch) {
> + Dwarfregsp: dwarfRegSP,
> + Dwarfreglr: dwarfRegLR,
> +
> ++ Adddynrel: adddynrel,
> + Archinit: archinit,
> + Archreloc: archreloc,
> + Archrelocvariant: archrelocvariant,
> +@@ -41,10 +42,10 @@ func Init() (*sys.Arch, ld.Arch) {
> +
> + Linuxdynld: "/lib/ld.so.1",
> +
> ++ Dragonflydynld: "XXX",
> + Freebsddynld: "XXX",
> + Netbsddynld: "XXX",
> +- Openbsddynld: "XXX",
> +- Dragonflydynld: "XXX",
> ++ Openbsddynld: "/usr/libexec/ld.so",
> + Solarisdynld: "XXX",
> + }
> +
> +@@ -53,7 +54,7 @@ func Init() (*sys.Arch, ld.Arch) {
> +
> + func archinit(ctxt *ld.Link) {
> + switch ctxt.HeadType {
> +- case objabi.Hlinux:
> ++ case objabi.Hlinux, objabi.Hopenbsd:
> + ld.Elfinit(ctxt)
> + ld.HEADR = ld.ELFRESERVE
> + if *ld.FlagTextAddr == -1 {
> Index: patches/patch-src_cmd_link_internal_s390x_asm_go
> ===================================================================
> RCS file: patches/patch-src_cmd_link_internal_s390x_asm_go
> diff -N patches/patch-src_cmd_link_internal_s390x_asm_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_link_internal_s390x_asm_go 18 Sep 2022 07:51:24 -0000
> @@ -0,0 +1,12 @@
> +Index: src/cmd/link/internal/s390x/asm.go
> +--- src/cmd/link/internal/s390x/asm.go.orig
> ++++ src/cmd/link/internal/s390x/asm.go
> +@@ -313,7 +313,7 @@ func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loa
> + return true
> + }
> +
> +-func elfsetupplt(ctxt *ld.Link, plt, got *loader.SymbolBuilder, dynamic loader.Sym) {
> ++func elfsetupplt(ctxt *ld.Link, ldr *loader.Loader, plt, got *loader.SymbolBuilder, dynamic loader.Sym) {
> + if plt.Size() == 0 {
> + // stg %r1,56(%r15)
> + plt.AddUint8(0xe3)
> Index: patches/patch-src_cmd_link_internal_sym_reloc_go
> ===================================================================
> RCS file: patches/patch-src_cmd_link_internal_sym_reloc_go
> diff -N patches/patch-src_cmd_link_internal_sym_reloc_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_link_internal_sym_reloc_go 18 Sep 2022 07:51:24 -0000
> @@ -0,0 +1,12 @@
> +Index: src/cmd/link/internal/sym/reloc.go
> +--- src/cmd/link/internal/sym/reloc.go.orig
> ++++ src/cmd/link/internal/sym/reloc.go
> +@@ -67,6 +67,8 @@ func RelocName(arch *sys.Arch, r objabi.RelocType) str
> + return elf.R_PPC64(nr).String()
> + case sys.S390X:
> + return elf.R_390(nr).String()
> ++ case sys.RISCV64:
> ++ return elf.R_RISCV(nr).String()
> + default:
> + panic("unreachable")
> + }
> Index: patches/patch-src_cmd_link_internal_x86_asm_go
> ===================================================================
> RCS file: patches/patch-src_cmd_link_internal_x86_asm_go
> diff -N patches/patch-src_cmd_link_internal_x86_asm_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_link_internal_x86_asm_go 18 Sep 2022 07:51:24 -0000
> @@ -0,0 +1,12 @@
> +Index: src/cmd/link/internal/x86/asm.go
> +--- src/cmd/link/internal/x86/asm.go.orig
> ++++ src/cmd/link/internal/x86/asm.go
> +@@ -418,7 +418,7 @@ func archrelocvariant(*ld.Target, *loader.Loader, load
> + return -1
> + }
> +
> +-func elfsetupplt(ctxt *ld.Link, plt, got *loader.SymbolBuilder, dynamic loader.Sym) {
> ++func elfsetupplt(ctxt *ld.Link, ldr *loader.Loader, plt, got *loader.SymbolBuilder, dynamic loader.Sym) {
> + if plt.Size() == 0 {
> + // pushl got+4
> + plt.AddUint8(0xff)
> Index: patches/patch-src_cmd_vendor_golang_org_x_sys_unix_asm_openbsd_riscv64_s
> ===================================================================
> RCS file: patches/patch-src_cmd_vendor_golang_org_x_sys_unix_asm_openbsd_riscv64_s
> diff -N patches/patch-src_cmd_vendor_golang_org_x_sys_unix_asm_openbsd_riscv64_s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_vendor_golang_org_x_sys_unix_asm_openbsd_riscv64_s 18 Sep 2022 07:51:24 -0000
> @@ -0,0 +1,34 @@
> +Index: src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_riscv64.s
> +--- src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_riscv64.s.orig
> ++++ src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_riscv64.s
> +@@ -0,0 +1,30 @@
> ++// Copyright 2019 The Go Authors. All rights reserved.
> ++// Use of this source code is governed by a BSD-style
> ++// license that can be found in the LICENSE file.
> ++
> ++//go:build gc
> ++// +build gc
> ++
> ++#include "textflag.h"
> ++
> ++//
> ++// System call support for riscv64, OpenBSD
> ++//
> ++
> ++// Just jump to package syscall's implementation for all these functions.
> ++// The runtime may know about them.
> ++
> ++TEXT ·Syscall(SB),NOSPLIT,$0-56
> ++ JMP syscall·Syscall(SB)
> ++
> ++TEXT ·Syscall6(SB),NOSPLIT,$0-80
> ++ JMP syscall·Syscall6(SB)
> ++
> ++TEXT ·Syscall9(SB),NOSPLIT,$0-104
> ++ JMP syscall·Syscall9(SB)
> ++
> ++TEXT ·RawSyscall(SB),NOSPLIT,$0-56
> ++ JMP syscall·RawSyscall(SB)
> ++
> ++TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
> ++ JMP syscall·RawSyscall6(SB)
> Index: patches/patch-src_cmd_vendor_golang_org_x_sys_unix_syscall_openbsd_riscv64_go
> ===================================================================
> RCS file: patches/patch-src_cmd_vendor_golang_org_x_sys_unix_syscall_openbsd_riscv64_go
> diff -N patches/patch-src_cmd_vendor_golang_org_x_sys_unix_syscall_openbsd_riscv64_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_vendor_golang_org_x_sys_unix_syscall_openbsd_riscv64_go 18 Sep 2022 07:51:24 -0000
> @@ -0,0 +1,46 @@
> +Index: src/cmd/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go
> +--- src/cmd/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go.orig
> ++++ src/cmd/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go
> +@@ -0,0 +1,42 @@
> ++// Copyright 2019 The Go Authors. All rights reserved.
> ++// Use of this source code is governed by a BSD-style
> ++// license that can be found in the LICENSE file.
> ++
> ++//go:build riscv64 && openbsd
> ++// +build riscv64,openbsd
> ++
> ++package unix
> ++
> ++func setTimespec(sec, nsec int64) Timespec {
> ++ return Timespec{Sec: sec, Nsec: nsec}
> ++}
> ++
> ++func setTimeval(sec, usec int64) Timeval {
> ++ return Timeval{Sec: sec, Usec: usec}
> ++}
> ++
> ++func SetKevent(k *Kevent_t, fd, mode, flags int) {
> ++ k.Ident = uint64(fd)
> ++ k.Filter = int16(mode)
> ++ k.Flags = uint16(flags)
> ++}
> ++
> ++func (iov *Iovec) SetLen(length int) {
> ++ iov.Len = uint64(length)
> ++}
> ++
> ++func (msghdr *Msghdr) SetControllen(length int) {
> ++ msghdr.Controllen = uint32(length)
> ++}
> ++
> ++func (msghdr *Msghdr) SetIovlen(length int) {
> ++ msghdr.Iovlen = uint32(length)
> ++}
> ++
> ++func (cmsg *Cmsghdr) SetLen(length int) {
> ++ cmsg.Len = uint32(length)
> ++}
> ++
> ++// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
> ++// of openbsd/amd64 the syscall is called sysctl instead of __sysctl.
> ++const SYS___SYSCTL = SYS_SYSCTL
> Index: patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zerrors_openbsd_riscv64_go
> ===================================================================
> RCS file: patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zerrors_openbsd_riscv64_go
> diff -N patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zerrors_openbsd_riscv64_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zerrors_openbsd_riscv64_go 18 Sep 2022 07:51:25 -0000
> @@ -0,0 +1,1802 @@
> +Index: src/cmd/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go
> +--- src/cmd/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go.orig
> ++++ src/cmd/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go
> +@@ -0,0 +1,1798 @@
> ++// mkerrors.sh -m64
> ++// Code generated by the command above; see README.md. DO NOT EDIT.
> ++
> ++//go:build riscv64 && openbsd
> ++// +build riscv64,openbsd
> ++
> ++// Code generated by cmd/cgo -godefs; DO NOT EDIT.
> ++// cgo -godefs -- -m64 _const.go
> ++
> ++package unix
> ++
> ++import "syscall"
> ++
> ++const (
> ++ AF_APPLETALK = 0x10
> ++ AF_BLUETOOTH = 0x20
> ++ AF_CCITT = 0xa
> ++ AF_CHAOS = 0x5
> ++ AF_CNT = 0x15
> ++ AF_COIP = 0x14
> ++ AF_DATAKIT = 0x9
> ++ AF_DECnet = 0xc
> ++ AF_DLI = 0xd
> ++ AF_E164 = 0x1a
> ++ AF_ECMA = 0x8
> ++ AF_ENCAP = 0x1c
> ++ AF_HYLINK = 0xf
> ++ AF_IMPLINK = 0x3
> ++ AF_INET = 0x2
> ++ AF_INET6 = 0x18
> ++ AF_IPX = 0x17
> ++ AF_ISDN = 0x1a
> ++ AF_ISO = 0x7
> ++ AF_KEY = 0x1e
> ++ AF_LAT = 0xe
> ++ AF_LINK = 0x12
> ++ AF_LOCAL = 0x1
> ++ AF_MAX = 0x24
> ++ AF_MPLS = 0x21
> ++ AF_NATM = 0x1b
> ++ AF_NS = 0x6
> ++ AF_OSI = 0x7
> ++ AF_PUP = 0x4
> ++ AF_ROUTE = 0x11
> ++ AF_SIP = 0x1d
> ++ AF_SNA = 0xb
> ++ AF_UNIX = 0x1
> ++ AF_UNSPEC = 0x0
> ++ ALTWERASE = 0x200
> ++ ARPHRD_ETHER = 0x1
> ++ ARPHRD_FRELAY = 0xf
> ++ ARPHRD_IEEE1394 = 0x18
> ++ ARPHRD_IEEE802 = 0x6
> ++ B0 = 0x0
> ++ B110 = 0x6e
> ++ B115200 = 0x1c200
> ++ B1200 = 0x4b0
> ++ B134 = 0x86
> ++ B14400 = 0x3840
> ++ B150 = 0x96
> ++ B1800 = 0x708
> ++ B19200 = 0x4b00
> ++ B200 = 0xc8
> ++ B230400 = 0x38400
> ++ B2400 = 0x960
> ++ B28800 = 0x7080
> ++ B300 = 0x12c
> ++ B38400 = 0x9600
> ++ B4800 = 0x12c0
> ++ B50 = 0x32
> ++ B57600 = 0xe100
> ++ B600 = 0x258
> ++ B7200 = 0x1c20
> ++ B75 = 0x4b
> ++ B76800 = 0x12c00
> ++ B9600 = 0x2580
> ++ BIOCFLUSH = 0x20004268
> ++ BIOCGBLEN = 0x40044266
> ++ BIOCGDIRFILT = 0x4004427c
> ++ BIOCGDLT = 0x4004426a
> ++ BIOCGDLTLIST = 0xc010427b
> ++ BIOCGETIF = 0x4020426b
> ++ BIOCGFILDROP = 0x40044278
> ++ BIOCGHDRCMPLT = 0x40044274
> ++ BIOCGRSIG = 0x40044273
> ++ BIOCGRTIMEOUT = 0x4010426e
> ++ BIOCGSTATS = 0x4008426f
> ++ BIOCIMMEDIATE = 0x80044270
> ++ BIOCLOCK = 0x20004276
> ++ BIOCPROMISC = 0x20004269
> ++ BIOCSBLEN = 0xc0044266
> ++ BIOCSDIRFILT = 0x8004427d
> ++ BIOCSDLT = 0x8004427a
> ++ BIOCSETF = 0x80104267
> ++ BIOCSETIF = 0x8020426c
> ++ BIOCSETWF = 0x80104277
> ++ BIOCSFILDROP = 0x80044279
> ++ BIOCSHDRCMPLT = 0x80044275
> ++ BIOCSRSIG = 0x80044272
> ++ BIOCSRTIMEOUT = 0x8010426d
> ++ BIOCVERSION = 0x40044271
> ++ BPF_A = 0x10
> ++ BPF_ABS = 0x20
> ++ BPF_ADD = 0x0
> ++ BPF_ALIGNMENT = 0x4
> ++ BPF_ALU = 0x4
> ++ BPF_AND = 0x50
> ++ BPF_B = 0x10
> ++ BPF_DIRECTION_IN = 0x1
> ++ BPF_DIRECTION_OUT = 0x2
> ++ BPF_DIV = 0x30
> ++ BPF_FILDROP_CAPTURE = 0x1
> ++ BPF_FILDROP_DROP = 0x2
> ++ BPF_FILDROP_PASS = 0x0
> ++ BPF_H = 0x8
> ++ BPF_IMM = 0x0
> ++ BPF_IND = 0x40
> ++ BPF_JA = 0x0
> ++ BPF_JEQ = 0x10
> ++ BPF_JGE = 0x30
> ++ BPF_JGT = 0x20
> ++ BPF_JMP = 0x5
> ++ BPF_JSET = 0x40
> ++ BPF_K = 0x0
> ++ BPF_LD = 0x0
> ++ BPF_LDX = 0x1
> ++ BPF_LEN = 0x80
> ++ BPF_LSH = 0x60
> ++ BPF_MAJOR_VERSION = 0x1
> ++ BPF_MAXBUFSIZE = 0x200000
> ++ BPF_MAXINSNS = 0x200
> ++ BPF_MEM = 0x60
> ++ BPF_MEMWORDS = 0x10
> ++ BPF_MINBUFSIZE = 0x20
> ++ BPF_MINOR_VERSION = 0x1
> ++ BPF_MISC = 0x7
> ++ BPF_MSH = 0xa0
> ++ BPF_MUL = 0x20
> ++ BPF_NEG = 0x80
> ++ BPF_OR = 0x40
> ++ BPF_RELEASE = 0x30bb6
> ++ BPF_RET = 0x6
> ++ BPF_RSH = 0x70
> ++ BPF_ST = 0x2
> ++ BPF_STX = 0x3
> ++ BPF_SUB = 0x10
> ++ BPF_TAX = 0x0
> ++ BPF_TXA = 0x80
> ++ BPF_W = 0x0
> ++ BPF_X = 0x8
> ++ BRKINT = 0x2
> ++ CFLUSH = 0xf
> ++ CLOCAL = 0x8000
> ++ CLOCK_BOOTTIME = 0x6
> ++ CLOCK_MONOTONIC = 0x3
> ++ CLOCK_PROCESS_CPUTIME_ID = 0x2
> ++ CLOCK_REALTIME = 0x0
> ++ CLOCK_THREAD_CPUTIME_ID = 0x4
> ++ CLOCK_UPTIME = 0x5
> ++ CPUSTATES = 0x6
> ++ CP_IDLE = 0x5
> ++ CP_INTR = 0x4
> ++ CP_NICE = 0x1
> ++ CP_SPIN = 0x3
> ++ CP_SYS = 0x2
> ++ CP_USER = 0x0
> ++ CREAD = 0x800
> ++ CRTSCTS = 0x10000
> ++ CS5 = 0x0
> ++ CS6 = 0x100
> ++ CS7 = 0x200
> ++ CS8 = 0x300
> ++ CSIZE = 0x300
> ++ CSTART = 0x11
> ++ CSTATUS = 0xff
> ++ CSTOP = 0x13
> ++ CSTOPB = 0x400
> ++ CSUSP = 0x1a
> ++ CTL_HW = 0x6
> ++ CTL_KERN = 0x1
> ++ CTL_MAXNAME = 0xc
> ++ CTL_NET = 0x4
> ++ DIOCOSFPFLUSH = 0x2000444e
> ++ DLT_ARCNET = 0x7
> ++ DLT_ATM_RFC1483 = 0xb
> ++ DLT_AX25 = 0x3
> ++ DLT_CHAOS = 0x5
> ++ DLT_C_HDLC = 0x68
> ++ DLT_EN10MB = 0x1
> ++ DLT_EN3MB = 0x2
> ++ DLT_ENC = 0xd
> ++ DLT_FDDI = 0xa
> ++ DLT_IEEE802 = 0x6
> ++ DLT_IEEE802_11 = 0x69
> ++ DLT_IEEE802_11_RADIO = 0x7f
> ++ DLT_LOOP = 0xc
> ++ DLT_MPLS = 0xdb
> ++ DLT_NULL = 0x0
> ++ DLT_OPENFLOW = 0x10b
> ++ DLT_PFLOG = 0x75
> ++ DLT_PFSYNC = 0x12
> ++ DLT_PPP = 0x9
> ++ DLT_PPP_BSDOS = 0x10
> ++ DLT_PPP_ETHER = 0x33
> ++ DLT_PPP_SERIAL = 0x32
> ++ DLT_PRONET = 0x4
> ++ DLT_RAW = 0xe
> ++ DLT_SLIP = 0x8
> ++ DLT_SLIP_BSDOS = 0xf
> ++ DLT_USBPCAP = 0xf9
> ++ DLT_USER0 = 0x93
> ++ DLT_USER1 = 0x94
> ++ DLT_USER10 = 0x9d
> ++ DLT_USER11 = 0x9e
> ++ DLT_USER12 = 0x9f
> ++ DLT_USER13 = 0xa0
> ++ DLT_USER14 = 0xa1
> ++ DLT_USER15 = 0xa2
> ++ DLT_USER2 = 0x95
> ++ DLT_USER3 = 0x96
> ++ DLT_USER4 = 0x97
> ++ DLT_USER5 = 0x98
> ++ DLT_USER6 = 0x99
> ++ DLT_USER7 = 0x9a
> ++ DLT_USER8 = 0x9b
> ++ DLT_USER9 = 0x9c
> ++ DT_BLK = 0x6
> ++ DT_CHR = 0x2
> ++ DT_DIR = 0x4
> ++ DT_FIFO = 0x1
> ++ DT_LNK = 0xa
> ++ DT_REG = 0x8
> ++ DT_SOCK = 0xc
> ++ DT_UNKNOWN = 0x0
> ++ ECHO = 0x8
> ++ ECHOCTL = 0x40
> ++ ECHOE = 0x2
> ++ ECHOK = 0x4
> ++ ECHOKE = 0x1
> ++ ECHONL = 0x10
> ++ ECHOPRT = 0x20
> ++ EMT_TAGOVF = 0x1
> ++ EMUL_ENABLED = 0x1
> ++ EMUL_NATIVE = 0x2
> ++ ENDRUNDISC = 0x9
> ++ ETHERMIN = 0x2e
> ++ ETHERMTU = 0x5dc
> ++ ETHERTYPE_8023 = 0x4
> ++ ETHERTYPE_AARP = 0x80f3
> ++ ETHERTYPE_ACCTON = 0x8390
> ++ ETHERTYPE_AEONIC = 0x8036
> ++ ETHERTYPE_ALPHA = 0x814a
> ++ ETHERTYPE_AMBER = 0x6008
> ++ ETHERTYPE_AMOEBA = 0x8145
> ++ ETHERTYPE_AOE = 0x88a2
> ++ ETHERTYPE_APOLLO = 0x80f7
> ++ ETHERTYPE_APOLLODOMAIN = 0x8019
> ++ ETHERTYPE_APPLETALK = 0x809b
> ++ ETHERTYPE_APPLITEK = 0x80c7
> ++ ETHERTYPE_ARGONAUT = 0x803a
> ++ ETHERTYPE_ARP = 0x806
> ++ ETHERTYPE_AT = 0x809b
> ++ ETHERTYPE_ATALK = 0x809b
> ++ ETHERTYPE_ATOMIC = 0x86df
> ++ ETHERTYPE_ATT = 0x8069
> ++ ETHERTYPE_ATTSTANFORD = 0x8008
> ++ ETHERTYPE_AUTOPHON = 0x806a
> ++ ETHERTYPE_AXIS = 0x8856
> ++ ETHERTYPE_BCLOOP = 0x9003
> ++ ETHERTYPE_BOFL = 0x8102
> ++ ETHERTYPE_CABLETRON = 0x7034
> ++ ETHERTYPE_CHAOS = 0x804
> ++ ETHERTYPE_COMDESIGN = 0x806c
> ++ ETHERTYPE_COMPUGRAPHIC = 0x806d
> ++ ETHERTYPE_COUNTERPOINT = 0x8062
> ++ ETHERTYPE_CRONUS = 0x8004
> ++ ETHERTYPE_CRONUSVLN = 0x8003
> ++ ETHERTYPE_DCA = 0x1234
> ++ ETHERTYPE_DDE = 0x807b
> ++ ETHERTYPE_DEBNI = 0xaaaa
> ++ ETHERTYPE_DECAM = 0x8048
> ++ ETHERTYPE_DECCUST = 0x6006
> ++ ETHERTYPE_DECDIAG = 0x6005
> ++ ETHERTYPE_DECDNS = 0x803c
> ++ ETHERTYPE_DECDTS = 0x803e
> ++ ETHERTYPE_DECEXPER = 0x6000
> ++ ETHERTYPE_DECLAST = 0x8041
> ++ ETHERTYPE_DECLTM = 0x803f
> ++ ETHERTYPE_DECMUMPS = 0x6009
> ++ ETHERTYPE_DECNETBIOS = 0x8040
> ++ ETHERTYPE_DELTACON = 0x86de
> ++ ETHERTYPE_DIDDLE = 0x4321
> ++ ETHERTYPE_DLOG1 = 0x660
> ++ ETHERTYPE_DLOG2 = 0x661
> ++ ETHERTYPE_DN = 0x6003
> ++ ETHERTYPE_DOGFIGHT = 0x1989
> ++ ETHERTYPE_DSMD = 0x8039
> ++ ETHERTYPE_ECMA = 0x803
> ++ ETHERTYPE_ENCRYPT = 0x803d
> ++ ETHERTYPE_ES = 0x805d
> ++ ETHERTYPE_EXCELAN = 0x8010
> ++ ETHERTYPE_EXPERDATA = 0x8049
> ++ ETHERTYPE_FLIP = 0x8146
> ++ ETHERTYPE_FLOWCONTROL = 0x8808
> ++ ETHERTYPE_FRARP = 0x808
> ++ ETHERTYPE_GENDYN = 0x8068
> ++ ETHERTYPE_HAYES = 0x8130
> ++ ETHERTYPE_HIPPI_FP = 0x8180
> ++ ETHERTYPE_HITACHI = 0x8820
> ++ ETHERTYPE_HP = 0x8005
> ++ ETHERTYPE_IEEEPUP = 0xa00
> ++ ETHERTYPE_IEEEPUPAT = 0xa01
> ++ ETHERTYPE_IMLBL = 0x4c42
> ++ ETHERTYPE_IMLBLDIAG = 0x424c
> ++ ETHERTYPE_IP = 0x800
> ++ ETHERTYPE_IPAS = 0x876c
> ++ ETHERTYPE_IPV6 = 0x86dd
> ++ ETHERTYPE_IPX = 0x8137
> ++ ETHERTYPE_IPXNEW = 0x8037
> ++ ETHERTYPE_KALPANA = 0x8582
> ++ ETHERTYPE_LANBRIDGE = 0x8038
> ++ ETHERTYPE_LANPROBE = 0x8888
> ++ ETHERTYPE_LAT = 0x6004
> ++ ETHERTYPE_LBACK = 0x9000
> ++ ETHERTYPE_LITTLE = 0x8060
> ++ ETHERTYPE_LLDP = 0x88cc
> ++ ETHERTYPE_LOGICRAFT = 0x8148
> ++ ETHERTYPE_LOOPBACK = 0x9000
> ++ ETHERTYPE_MATRA = 0x807a
> ++ ETHERTYPE_MAX = 0xffff
> ++ ETHERTYPE_MERIT = 0x807c
> ++ ETHERTYPE_MICP = 0x873a
> ++ ETHERTYPE_MOPDL = 0x6001
> ++ ETHERTYPE_MOPRC = 0x6002
> ++ ETHERTYPE_MOTOROLA = 0x818d
> ++ ETHERTYPE_MPLS = 0x8847
> ++ ETHERTYPE_MPLS_MCAST = 0x8848
> ++ ETHERTYPE_MUMPS = 0x813f
> ++ ETHERTYPE_NBPCC = 0x3c04
> ++ ETHERTYPE_NBPCLAIM = 0x3c09
> ++ ETHERTYPE_NBPCLREQ = 0x3c05
> ++ ETHERTYPE_NBPCLRSP = 0x3c06
> ++ ETHERTYPE_NBPCREQ = 0x3c02
> ++ ETHERTYPE_NBPCRSP = 0x3c03
> ++ ETHERTYPE_NBPDG = 0x3c07
> ++ ETHERTYPE_NBPDGB = 0x3c08
> ++ ETHERTYPE_NBPDLTE = 0x3c0a
> ++ ETHERTYPE_NBPRAR = 0x3c0c
> ++ ETHERTYPE_NBPRAS = 0x3c0b
> ++ ETHERTYPE_NBPRST = 0x3c0d
> ++ ETHERTYPE_NBPSCD = 0x3c01
> ++ ETHERTYPE_NBPVCD = 0x3c00
> ++ ETHERTYPE_NBS = 0x802
> ++ ETHERTYPE_NCD = 0x8149
> ++ ETHERTYPE_NESTAR = 0x8006
> ++ ETHERTYPE_NETBEUI = 0x8191
> ++ ETHERTYPE_NOVELL = 0x8138
> ++ ETHERTYPE_NS = 0x600
> ++ ETHERTYPE_NSAT = 0x601
> ++ ETHERTYPE_NSCOMPAT = 0x807
> ++ ETHERTYPE_NTRAILER = 0x10
> ++ ETHERTYPE_OS9 = 0x7007
> ++ ETHERTYPE_OS9NET = 0x7009
> ++ ETHERTYPE_PACER = 0x80c6
> ++ ETHERTYPE_PAE = 0x888e
> ++ ETHERTYPE_PBB = 0x88e7
> ++ ETHERTYPE_PCS = 0x4242
> ++ ETHERTYPE_PLANNING = 0x8044
> ++ ETHERTYPE_PPP = 0x880b
> ++ ETHERTYPE_PPPOE = 0x8864
> ++ ETHERTYPE_PPPOEDISC = 0x8863
> ++ ETHERTYPE_PRIMENTS = 0x7031
> ++ ETHERTYPE_PUP = 0x200
> ++ ETHERTYPE_PUPAT = 0x200
> ++ ETHERTYPE_QINQ = 0x88a8
> ++ ETHERTYPE_RACAL = 0x7030
> ++ ETHERTYPE_RATIONAL = 0x8150
> ++ ETHERTYPE_RAWFR = 0x6559
> ++ ETHERTYPE_RCL = 0x1995
> ++ ETHERTYPE_RDP = 0x8739
> ++ ETHERTYPE_RETIX = 0x80f2
> ++ ETHERTYPE_REVARP = 0x8035
> ++ ETHERTYPE_SCA = 0x6007
> ++ ETHERTYPE_SECTRA = 0x86db
> ++ ETHERTYPE_SECUREDATA = 0x876d
> ++ ETHERTYPE_SGITW = 0x817e
> ++ ETHERTYPE_SG_BOUNCE = 0x8016
> ++ ETHERTYPE_SG_DIAG = 0x8013
> ++ ETHERTYPE_SG_NETGAMES = 0x8014
> ++ ETHERTYPE_SG_RESV = 0x8015
> ++ ETHERTYPE_SIMNET = 0x5208
> ++ ETHERTYPE_SLOW = 0x8809
> ++ ETHERTYPE_SNA = 0x80d5
> ++ ETHERTYPE_SNMP = 0x814c
> ++ ETHERTYPE_SONIX = 0xfaf5
> ++ ETHERTYPE_SPIDER = 0x809f
> ++ ETHERTYPE_SPRITE = 0x500
> ++ ETHERTYPE_STP = 0x8181
> ++ ETHERTYPE_TALARIS = 0x812b
> ++ ETHERTYPE_TALARISMC = 0x852b
> ++ ETHERTYPE_TCPCOMP = 0x876b
> ++ ETHERTYPE_TCPSM = 0x9002
> ++ ETHERTYPE_TEC = 0x814f
> ++ ETHERTYPE_TIGAN = 0x802f
> ++ ETHERTYPE_TRAIL = 0x1000
> ++ ETHERTYPE_TRANSETHER = 0x6558
> ++ ETHERTYPE_TYMSHARE = 0x802e
> ++ ETHERTYPE_UBBST = 0x7005
> ++ ETHERTYPE_UBDEBUG = 0x900
> ++ ETHERTYPE_UBDIAGLOOP = 0x7002
> ++ ETHERTYPE_UBDL = 0x7000
> ++ ETHERTYPE_UBNIU = 0x7001
> ++ ETHERTYPE_UBNMC = 0x7003
> ++ ETHERTYPE_VALID = 0x1600
> ++ ETHERTYPE_VARIAN = 0x80dd
> ++ ETHERTYPE_VAXELN = 0x803b
> ++ ETHERTYPE_VEECO = 0x8067
> ++ ETHERTYPE_VEXP = 0x805b
> ++ ETHERTYPE_VGLAB = 0x8131
> ++ ETHERTYPE_VINES = 0xbad
> ++ ETHERTYPE_VINESECHO = 0xbaf
> ++ ETHERTYPE_VINESLOOP = 0xbae
> ++ ETHERTYPE_VITAL = 0xff00
> ++ ETHERTYPE_VLAN = 0x8100
> ++ ETHERTYPE_VLTLMAN = 0x8080
> ++ ETHERTYPE_VPROD = 0x805c
> ++ ETHERTYPE_VURESERVED = 0x8147
> ++ ETHERTYPE_WATERLOO = 0x8130
> ++ ETHERTYPE_WELLFLEET = 0x8103
> ++ ETHERTYPE_X25 = 0x805
> ++ ETHERTYPE_X75 = 0x801
> ++ ETHERTYPE_XNSSM = 0x9001
> ++ ETHERTYPE_XTP = 0x817d
> ++ ETHER_ADDR_LEN = 0x6
> ++ ETHER_ALIGN = 0x2
> ++ ETHER_CRC_LEN = 0x4
> ++ ETHER_CRC_POLY_BE = 0x4c11db6
> ++ ETHER_CRC_POLY_LE = 0xedb88320
> ++ ETHER_HDR_LEN = 0xe
> ++ ETHER_MAX_DIX_LEN = 0x600
> ++ ETHER_MAX_HARDMTU_LEN = 0xff9b
> ++ ETHER_MAX_LEN = 0x5ee
> ++ ETHER_MIN_LEN = 0x40
> ++ ETHER_TYPE_LEN = 0x2
> ++ ETHER_VLAN_ENCAP_LEN = 0x4
> ++ EVFILT_AIO = -0x3
> ++ EVFILT_DEVICE = -0x8
> ++ EVFILT_PROC = -0x5
> ++ EVFILT_READ = -0x1
> ++ EVFILT_SIGNAL = -0x6
> ++ EVFILT_SYSCOUNT = 0x8
> ++ EVFILT_TIMER = -0x7
> ++ EVFILT_VNODE = -0x4
> ++ EVFILT_WRITE = -0x2
> ++ EVL_ENCAPLEN = 0x4
> ++ EVL_PRIO_BITS = 0xd
> ++ EVL_PRIO_MAX = 0x7
> ++ EVL_VLID_MASK = 0xfff
> ++ EVL_VLID_MAX = 0xffe
> ++ EVL_VLID_MIN = 0x1
> ++ EVL_VLID_NULL = 0x0
> ++ EV_ADD = 0x1
> ++ EV_CLEAR = 0x20
> ++ EV_DELETE = 0x2
> ++ EV_DISABLE = 0x8
> ++ EV_DISPATCH = 0x80
> ++ EV_ENABLE = 0x4
> ++ EV_EOF = 0x8000
> ++ EV_ERROR = 0x4000
> ++ EV_FLAG1 = 0x2000
> ++ EV_ONESHOT = 0x10
> ++ EV_RECEIPT = 0x40
> ++ EV_SYSFLAGS = 0xf000
> ++ EXTA = 0x4b00
> ++ EXTB = 0x9600
> ++ EXTPROC = 0x800
> ++ FD_CLOEXEC = 0x1
> ++ FD_SETSIZE = 0x400
> ++ FLUSHO = 0x800000
> ++ F_DUPFD = 0x0
> ++ F_DUPFD_CLOEXEC = 0xa
> ++ F_GETFD = 0x1
> ++ F_GETFL = 0x3
> ++ F_GETLK = 0x7
> ++ F_GETOWN = 0x5
> ++ F_ISATTY = 0xb
> ++ F_OK = 0x0
> ++ F_RDLCK = 0x1
> ++ F_SETFD = 0x2
> ++ F_SETFL = 0x4
> ++ F_SETLK = 0x8
> ++ F_SETLKW = 0x9
> ++ F_SETOWN = 0x6
> ++ F_UNLCK = 0x2
> ++ F_WRLCK = 0x3
> ++ HUPCL = 0x4000
> ++ HW_MACHINE = 0x1
> ++ ICANON = 0x100
> ++ ICMP6_FILTER = 0x12
> ++ ICRNL = 0x100
> ++ IEXTEN = 0x400
> ++ IFAN_ARRIVAL = 0x0
> ++ IFAN_DEPARTURE = 0x1
> ++ IFF_ALLMULTI = 0x200
> ++ IFF_BROADCAST = 0x2
> ++ IFF_CANTCHANGE = 0x8e52
> ++ IFF_DEBUG = 0x4
> ++ IFF_LINK0 = 0x1000
> ++ IFF_LINK1 = 0x2000
> ++ IFF_LINK2 = 0x4000
> ++ IFF_LOOPBACK = 0x8
> ++ IFF_MULTICAST = 0x8000
> ++ IFF_NOARP = 0x80
> ++ IFF_OACTIVE = 0x400
> ++ IFF_POINTOPOINT = 0x10
> ++ IFF_PROMISC = 0x100
> ++ IFF_RUNNING = 0x40
> ++ IFF_SIMPLEX = 0x800
> ++ IFF_STATICARP = 0x20
> ++ IFF_UP = 0x1
> ++ IFNAMSIZ = 0x10
> ++ IFT_1822 = 0x2
> ++ IFT_A12MPPSWITCH = 0x82
> ++ IFT_AAL2 = 0xbb
> ++ IFT_AAL5 = 0x31
> ++ IFT_ADSL = 0x5e
> ++ IFT_AFLANE8023 = 0x3b
> ++ IFT_AFLANE8025 = 0x3c
> ++ IFT_ARAP = 0x58
> ++ IFT_ARCNET = 0x23
> ++ IFT_ARCNETPLUS = 0x24
> ++ IFT_ASYNC = 0x54
> ++ IFT_ATM = 0x25
> ++ IFT_ATMDXI = 0x69
> ++ IFT_ATMFUNI = 0x6a
> ++ IFT_ATMIMA = 0x6b
> ++ IFT_ATMLOGICAL = 0x50
> ++ IFT_ATMRADIO = 0xbd
> ++ IFT_ATMSUBINTERFACE = 0x86
> ++ IFT_ATMVCIENDPT = 0xc2
> ++ IFT_ATMVIRTUAL = 0x95
> ++ IFT_BGPPOLICYACCOUNTING = 0xa2
> ++ IFT_BLUETOOTH = 0xf8
> ++ IFT_BRIDGE = 0xd1
> ++ IFT_BSC = 0x53
> ++ IFT_CARP = 0xf7
> ++ IFT_CCTEMUL = 0x3d
> ++ IFT_CEPT = 0x13
> ++ IFT_CES = 0x85
> ++ IFT_CHANNEL = 0x46
> ++ IFT_CNR = 0x55
> ++ IFT_COFFEE = 0x84
> ++ IFT_COMPOSITELINK = 0x9b
> ++ IFT_DCN = 0x8d
> ++ IFT_DIGITALPOWERLINE = 0x8a
> ++ IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
> ++ IFT_DLSW = 0x4a
> ++ IFT_DOCSCABLEDOWNSTREAM = 0x80
> ++ IFT_DOCSCABLEMACLAYER = 0x7f
> ++ IFT_DOCSCABLEUPSTREAM = 0x81
> ++ IFT_DOCSCABLEUPSTREAMCHANNEL = 0xcd
> ++ IFT_DS0 = 0x51
> ++ IFT_DS0BUNDLE = 0x52
> ++ IFT_DS1FDL = 0xaa
> ++ IFT_DS3 = 0x1e
> ++ IFT_DTM = 0x8c
> ++ IFT_DUMMY = 0xf1
> ++ IFT_DVBASILN = 0xac
> ++ IFT_DVBASIOUT = 0xad
> ++ IFT_DVBRCCDOWNSTREAM = 0x93
> ++ IFT_DVBRCCMACLAYER = 0x92
> ++ IFT_DVBRCCUPSTREAM = 0x94
> ++ IFT_ECONET = 0xce
> ++ IFT_ENC = 0xf4
> ++ IFT_EON = 0x19
> ++ IFT_EPLRS = 0x57
> ++ IFT_ESCON = 0x49
> ++ IFT_ETHER = 0x6
> ++ IFT_FAITH = 0xf3
> ++ IFT_FAST = 0x7d
> ++ IFT_FASTETHER = 0x3e
> ++ IFT_FASTETHERFX = 0x45
> ++ IFT_FDDI = 0xf
> ++ IFT_FIBRECHANNEL = 0x38
> ++ IFT_FRAMERELAYINTERCONNECT = 0x3a
> ++ IFT_FRAMERELAYMPI = 0x5c
> ++ IFT_FRDLCIENDPT = 0xc1
> ++ IFT_FRELAY = 0x20
> ++ IFT_FRELAYDCE = 0x2c
> ++ IFT_FRF16MFRBUNDLE = 0xa3
> ++ IFT_FRFORWARD = 0x9e
> ++ IFT_G703AT2MB = 0x43
> ++ IFT_G703AT64K = 0x42
> ++ IFT_GIF = 0xf0
> ++ IFT_GIGABITETHERNET = 0x75
> ++ IFT_GR303IDT = 0xb2
> ++ IFT_GR303RDT = 0xb1
> ++ IFT_H323GATEKEEPER = 0xa4
> ++ IFT_H323PROXY = 0xa5
> ++ IFT_HDH1822 = 0x3
> ++ IFT_HDLC = 0x76
> ++ IFT_HDSL2 = 0xa8
> ++ IFT_HIPERLAN2 = 0xb7
> ++ IFT_HIPPI = 0x2f
> ++ IFT_HIPPIINTERFACE = 0x39
> ++ IFT_HOSTPAD = 0x5a
> ++ IFT_HSSI = 0x2e
> ++ IFT_HY = 0xe
> ++ IFT_IBM370PARCHAN = 0x48
> ++ IFT_IDSL = 0x9a
> ++ IFT_IEEE1394 = 0x90
> ++ IFT_IEEE80211 = 0x47
> ++ IFT_IEEE80212 = 0x37
> ++ IFT_IEEE8023ADLAG = 0xa1
> ++ IFT_IFGSN = 0x91
> ++ IFT_IMT = 0xbe
> ++ IFT_INFINIBAND = 0xc7
> ++ IFT_INTERLEAVE = 0x7c
> ++ IFT_IP = 0x7e
> ++ IFT_IPFORWARD = 0x8e
> ++ IFT_IPOVERATM = 0x72
> ++ IFT_IPOVERCDLC = 0x6d
> ++ IFT_IPOVERCLAW = 0x6e
> ++ IFT_IPSWITCH = 0x4e
> ++ IFT_ISDN = 0x3f
> ++ IFT_ISDNBASIC = 0x14
> ++ IFT_ISDNPRIMARY = 0x15
> ++ IFT_ISDNS = 0x4b
> ++ IFT_ISDNU = 0x4c
> ++ IFT_ISO88022LLC = 0x29
> ++ IFT_ISO88023 = 0x7
> ++ IFT_ISO88024 = 0x8
> ++ IFT_ISO88025 = 0x9
> ++ IFT_ISO88025CRFPINT = 0x62
> ++ IFT_ISO88025DTR = 0x56
> ++ IFT_ISO88025FIBER = 0x73
> ++ IFT_ISO88026 = 0xa
> ++ IFT_ISUP = 0xb3
> ++ IFT_L2VLAN = 0x87
> ++ IFT_L3IPVLAN = 0x88
> ++ IFT_L3IPXVLAN = 0x89
> ++ IFT_LAPB = 0x10
> ++ IFT_LAPD = 0x4d
> ++ IFT_LAPF = 0x77
> ++ IFT_LINEGROUP = 0xd2
> ++ IFT_LOCALTALK = 0x2a
> ++ IFT_LOOP = 0x18
> ++ IFT_MBIM = 0xfa
> ++ IFT_MEDIAMAILOVERIP = 0x8b
> ++ IFT_MFSIGLINK = 0xa7
> ++ IFT_MIOX25 = 0x26
> ++ IFT_MODEM = 0x30
> ++ IFT_MPC = 0x71
> ++ IFT_MPLS = 0xa6
> ++ IFT_MPLSTUNNEL = 0x96
> ++ IFT_MSDSL = 0x8f
> ++ IFT_MVL = 0xbf
> ++ IFT_MYRINET = 0x63
> ++ IFT_NFAS = 0xaf
> ++ IFT_NSIP = 0x1b
> ++ IFT_OPTICALCHANNEL = 0xc3
> ++ IFT_OPTICALTRANSPORT = 0xc4
> ++ IFT_OTHER = 0x1
> ++ IFT_P10 = 0xc
> ++ IFT_P80 = 0xd
> ++ IFT_PARA = 0x22
> ++ IFT_PFLOG = 0xf5
> ++ IFT_PFLOW = 0xf9
> ++ IFT_PFSYNC = 0xf6
> ++ IFT_PLC = 0xae
> ++ IFT_PON155 = 0xcf
> ++ IFT_PON622 = 0xd0
> ++ IFT_POS = 0xab
> ++ IFT_PPP = 0x17
> ++ IFT_PPPMULTILINKBUNDLE = 0x6c
> ++ IFT_PROPATM = 0xc5
> ++ IFT_PROPBWAP2MP = 0xb8
> ++ IFT_PROPCNLS = 0x59
> ++ IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
> ++ IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
> ++ IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
> ++ IFT_PROPMUX = 0x36
> ++ IFT_PROPVIRTUAL = 0x35
> ++ IFT_PROPWIRELESSP2P = 0x9d
> ++ IFT_PTPSERIAL = 0x16
> ++ IFT_PVC = 0xf2
> ++ IFT_Q2931 = 0xc9
> ++ IFT_QLLC = 0x44
> ++ IFT_RADIOMAC = 0xbc
> ++ IFT_RADSL = 0x5f
> ++ IFT_REACHDSL = 0xc0
> ++ IFT_RFC1483 = 0x9f
> ++ IFT_RS232 = 0x21
> ++ IFT_RSRB = 0x4f
> ++ IFT_SDLC = 0x11
> ++ IFT_SDSL = 0x60
> ++ IFT_SHDSL = 0xa9
> ++ IFT_SIP = 0x1f
> ++ IFT_SIPSIG = 0xcc
> ++ IFT_SIPTG = 0xcb
> ++ IFT_SLIP = 0x1c
> ++ IFT_SMDSDXI = 0x2b
> ++ IFT_SMDSICIP = 0x34
> ++ IFT_SONET = 0x27
> ++ IFT_SONETOVERHEADCHANNEL = 0xb9
> ++ IFT_SONETPATH = 0x32
> ++ IFT_SONETVT = 0x33
> ++ IFT_SRP = 0x97
> ++ IFT_SS7SIGLINK = 0x9c
> ++ IFT_STACKTOSTACK = 0x6f
> ++ IFT_STARLAN = 0xb
> ++ IFT_T1 = 0x12
> ++ IFT_TDLC = 0x74
> ++ IFT_TELINK = 0xc8
> ++ IFT_TERMPAD = 0x5b
> ++ IFT_TR008 = 0xb0
> ++ IFT_TRANSPHDLC = 0x7b
> ++ IFT_TUNNEL = 0x83
> ++ IFT_ULTRA = 0x1d
> ++ IFT_USB = 0xa0
> ++ IFT_V11 = 0x40
> ++ IFT_V35 = 0x2d
> ++ IFT_V36 = 0x41
> ++ IFT_V37 = 0x78
> ++ IFT_VDSL = 0x61
> ++ IFT_VIRTUALIPADDRESS = 0x70
> ++ IFT_VIRTUALTG = 0xca
> ++ IFT_VOICEDID = 0xd5
> ++ IFT_VOICEEM = 0x64
> ++ IFT_VOICEEMFGD = 0xd3
> ++ IFT_VOICEENCAP = 0x67
> ++ IFT_VOICEFGDEANA = 0xd4
> ++ IFT_VOICEFXO = 0x65
> ++ IFT_VOICEFXS = 0x66
> ++ IFT_VOICEOVERATM = 0x98
> ++ IFT_VOICEOVERCABLE = 0xc6
> ++ IFT_VOICEOVERFRAMERELAY = 0x99
> ++ IFT_VOICEOVERIP = 0x68
> ++ IFT_X213 = 0x5d
> ++ IFT_X25 = 0x5
> ++ IFT_X25DDN = 0x4
> ++ IFT_X25HUNTGROUP = 0x7a
> ++ IFT_X25MLP = 0x79
> ++ IFT_X25PLE = 0x28
> ++ IFT_XETHER = 0x1a
> ++ IGNBRK = 0x1
> ++ IGNCR = 0x80
> ++ IGNPAR = 0x4
> ++ IMAXBEL = 0x2000
> ++ INLCR = 0x40
> ++ INPCK = 0x10
> ++ IN_CLASSA_HOST = 0xffffff
> ++ IN_CLASSA_MAX = 0x80
> ++ IN_CLASSA_NET = 0xff000000
> ++ IN_CLASSA_NSHIFT = 0x18
> ++ IN_CLASSB_HOST = 0xffff
> ++ IN_CLASSB_MAX = 0x10000
> ++ IN_CLASSB_NET = 0xffff0000
> ++ IN_CLASSB_NSHIFT = 0x10
> ++ IN_CLASSC_HOST = 0xff
> ++ IN_CLASSC_NET = 0xffffff00
> ++ IN_CLASSC_NSHIFT = 0x8
> ++ IN_CLASSD_HOST = 0xfffffff
> ++ IN_CLASSD_NET = 0xf0000000
> ++ IN_CLASSD_NSHIFT = 0x1c
> ++ IN_LOOPBACKNET = 0x7f
> ++ IN_RFC3021_HOST = 0x1
> ++ IN_RFC3021_NET = 0xfffffffe
> ++ IN_RFC3021_NSHIFT = 0x1f
> ++ IPPROTO_AH = 0x33
> ++ IPPROTO_CARP = 0x70
> ++ IPPROTO_DIVERT = 0x102
> ++ IPPROTO_DONE = 0x101
> ++ IPPROTO_DSTOPTS = 0x3c
> ++ IPPROTO_EGP = 0x8
> ++ IPPROTO_ENCAP = 0x62
> ++ IPPROTO_EON = 0x50
> ++ IPPROTO_ESP = 0x32
> ++ IPPROTO_ETHERIP = 0x61
> ++ IPPROTO_FRAGMENT = 0x2c
> ++ IPPROTO_GGP = 0x3
> ++ IPPROTO_GRE = 0x2f
> ++ IPPROTO_HOPOPTS = 0x0
> ++ IPPROTO_ICMP = 0x1
> ++ IPPROTO_ICMPV6 = 0x3a
> ++ IPPROTO_IDP = 0x16
> ++ IPPROTO_IGMP = 0x2
> ++ IPPROTO_IP = 0x0
> ++ IPPROTO_IPCOMP = 0x6c
> ++ IPPROTO_IPIP = 0x4
> ++ IPPROTO_IPV4 = 0x4
> ++ IPPROTO_IPV6 = 0x29
> ++ IPPROTO_MAX = 0x100
> ++ IPPROTO_MAXID = 0x103
> ++ IPPROTO_MOBILE = 0x37
> ++ IPPROTO_MPLS = 0x89
> ++ IPPROTO_NONE = 0x3b
> ++ IPPROTO_PFSYNC = 0xf0
> ++ IPPROTO_PIM = 0x67
> ++ IPPROTO_PUP = 0xc
> ++ IPPROTO_RAW = 0xff
> ++ IPPROTO_ROUTING = 0x2b
> ++ IPPROTO_RSVP = 0x2e
> ++ IPPROTO_TCP = 0x6
> ++ IPPROTO_TP = 0x1d
> ++ IPPROTO_UDP = 0x11
> ++ IPV6_AUTH_LEVEL = 0x35
> ++ IPV6_AUTOFLOWLABEL = 0x3b
> ++ IPV6_CHECKSUM = 0x1a
> ++ IPV6_DEFAULT_MULTICAST_HOPS = 0x1
> ++ IPV6_DEFAULT_MULTICAST_LOOP = 0x1
> ++ IPV6_DEFHLIM = 0x40
> ++ IPV6_DONTFRAG = 0x3e
> ++ IPV6_DSTOPTS = 0x32
> ++ IPV6_ESP_NETWORK_LEVEL = 0x37
> ++ IPV6_ESP_TRANS_LEVEL = 0x36
> ++ IPV6_FAITH = 0x1d
> ++ IPV6_FLOWINFO_MASK = 0xffffff0f
> ++ IPV6_FLOWLABEL_MASK = 0xffff0f00
> ++ IPV6_FRAGTTL = 0x78
> ++ IPV6_HLIMDEC = 0x1
> ++ IPV6_HOPLIMIT = 0x2f
> ++ IPV6_HOPOPTS = 0x31
> ++ IPV6_IPCOMP_LEVEL = 0x3c
> ++ IPV6_JOIN_GROUP = 0xc
> ++ IPV6_LEAVE_GROUP = 0xd
> ++ IPV6_MAXHLIM = 0xff
> ++ IPV6_MAXPACKET = 0xffff
> ++ IPV6_MINHOPCOUNT = 0x41
> ++ IPV6_MMTU = 0x500
> ++ IPV6_MULTICAST_HOPS = 0xa
> ++ IPV6_MULTICAST_IF = 0x9
> ++ IPV6_MULTICAST_LOOP = 0xb
> ++ IPV6_NEXTHOP = 0x30
> ++ IPV6_OPTIONS = 0x1
> ++ IPV6_PATHMTU = 0x2c
> ++ IPV6_PIPEX = 0x3f
> ++ IPV6_PKTINFO = 0x2e
> ++ IPV6_PORTRANGE = 0xe
> ++ IPV6_PORTRANGE_DEFAULT = 0x0
> ++ IPV6_PORTRANGE_HIGH = 0x1
> ++ IPV6_PORTRANGE_LOW = 0x2
> ++ IPV6_RECVDSTOPTS = 0x28
> ++ IPV6_RECVDSTPORT = 0x40
> ++ IPV6_RECVHOPLIMIT = 0x25
> ++ IPV6_RECVHOPOPTS = 0x27
> ++ IPV6_RECVPATHMTU = 0x2b
> ++ IPV6_RECVPKTINFO = 0x24
> ++ IPV6_RECVRTHDR = 0x26
> ++ IPV6_RECVTCLASS = 0x39
> ++ IPV6_RTABLE = 0x1021
> ++ IPV6_RTHDR = 0x33
> ++ IPV6_RTHDRDSTOPTS = 0x23
> ++ IPV6_RTHDR_LOOSE = 0x0
> ++ IPV6_RTHDR_STRICT = 0x1
> ++ IPV6_RTHDR_TYPE_0 = 0x0
> ++ IPV6_SOCKOPT_RESERVED1 = 0x3
> ++ IPV6_TCLASS = 0x3d
> ++ IPV6_UNICAST_HOPS = 0x4
> ++ IPV6_USE_MIN_MTU = 0x2a
> ++ IPV6_V6ONLY = 0x1b
> ++ IPV6_VERSION = 0x60
> ++ IPV6_VERSION_MASK = 0xf0
> ++ IP_ADD_MEMBERSHIP = 0xc
> ++ IP_AUTH_LEVEL = 0x14
> ++ IP_DEFAULT_MULTICAST_LOOP = 0x1
> ++ IP_DEFAULT_MULTICAST_TTL = 0x1
> ++ IP_DF = 0x4000
> ++ IP_DROP_MEMBERSHIP = 0xd
> ++ IP_ESP_NETWORK_LEVEL = 0x16
> ++ IP_ESP_TRANS_LEVEL = 0x15
> ++ IP_HDRINCL = 0x2
> ++ IP_IPCOMP_LEVEL = 0x1d
> ++ IP_IPDEFTTL = 0x25
> ++ IP_IPSECFLOWINFO = 0x24
> ++ IP_IPSEC_LOCAL_AUTH = 0x1b
> ++ IP_IPSEC_LOCAL_CRED = 0x19
> ++ IP_IPSEC_LOCAL_ID = 0x17
> ++ IP_IPSEC_REMOTE_AUTH = 0x1c
> ++ IP_IPSEC_REMOTE_CRED = 0x1a
> ++ IP_IPSEC_REMOTE_ID = 0x18
> ++ IP_MAXPACKET = 0xffff
> ++ IP_MAX_MEMBERSHIPS = 0xfff
> ++ IP_MF = 0x2000
> ++ IP_MINTTL = 0x20
> ++ IP_MIN_MEMBERSHIPS = 0xf
> ++ IP_MSS = 0x240
> ++ IP_MULTICAST_IF = 0x9
> ++ IP_MULTICAST_LOOP = 0xb
> ++ IP_MULTICAST_TTL = 0xa
> ++ IP_OFFMASK = 0x1fff
> ++ IP_OPTIONS = 0x1
> ++ IP_PIPEX = 0x22
> ++ IP_PORTRANGE = 0x13
> ++ IP_PORTRANGE_DEFAULT = 0x0
> ++ IP_PORTRANGE_HIGH = 0x1
> ++ IP_PORTRANGE_LOW = 0x2
> ++ IP_RECVDSTADDR = 0x7
> ++ IP_RECVDSTPORT = 0x21
> ++ IP_RECVIF = 0x1e
> ++ IP_RECVOPTS = 0x5
> ++ IP_RECVRETOPTS = 0x6
> ++ IP_RECVRTABLE = 0x23
> ++ IP_RECVTTL = 0x1f
> ++ IP_RETOPTS = 0x8
> ++ IP_RF = 0x8000
> ++ IP_RTABLE = 0x1021
> ++ IP_SENDSRCADDR = 0x7
> ++ IP_TOS = 0x3
> ++ IP_TTL = 0x4
> ++ ISIG = 0x80
> ++ ISTRIP = 0x20
> ++ IUCLC = 0x1000
> ++ IXANY = 0x800
> ++ IXOFF = 0x400
> ++ IXON = 0x200
> ++ KERN_HOSTNAME = 0xa
> ++ KERN_OSRELEASE = 0x2
> ++ KERN_OSTYPE = 0x1
> ++ KERN_VERSION = 0x4
> ++ LCNT_OVERLOAD_FLUSH = 0x6
> ++ LOCK_EX = 0x2
> ++ LOCK_NB = 0x4
> ++ LOCK_SH = 0x1
> ++ LOCK_UN = 0x8
> ++ MADV_DONTNEED = 0x4
> ++ MADV_FREE = 0x6
> ++ MADV_NORMAL = 0x0
> ++ MADV_RANDOM = 0x1
> ++ MADV_SEQUENTIAL = 0x2
> ++ MADV_SPACEAVAIL = 0x5
> ++ MADV_WILLNEED = 0x3
> ++ MAP_ANON = 0x1000
> ++ MAP_ANONYMOUS = 0x1000
> ++ MAP_CONCEAL = 0x8000
> ++ MAP_COPY = 0x2
> ++ MAP_FILE = 0x0
> ++ MAP_FIXED = 0x10
> ++ MAP_FLAGMASK = 0xfff7
> ++ MAP_HASSEMAPHORE = 0x0
> ++ MAP_INHERIT = 0x0
> ++ MAP_INHERIT_COPY = 0x1
> ++ MAP_INHERIT_NONE = 0x2
> ++ MAP_INHERIT_SHARE = 0x0
> ++ MAP_INHERIT_ZERO = 0x3
> ++ MAP_NOEXTEND = 0x0
> ++ MAP_NORESERVE = 0x0
> ++ MAP_PRIVATE = 0x2
> ++ MAP_RENAME = 0x0
> ++ MAP_SHARED = 0x1
> ++ MAP_STACK = 0x4000
> ++ MAP_TRYFIXED = 0x0
> ++ MCL_CURRENT = 0x1
> ++ MCL_FUTURE = 0x2
> ++ MNT_ASYNC = 0x40
> ++ MNT_DEFEXPORTED = 0x200
> ++ MNT_DELEXPORT = 0x20000
> ++ MNT_DOOMED = 0x8000000
> ++ MNT_EXPORTANON = 0x400
> ++ MNT_EXPORTED = 0x100
> ++ MNT_EXRDONLY = 0x80
> ++ MNT_FORCE = 0x80000
> ++ MNT_LAZY = 0x3
> ++ MNT_LOCAL = 0x1000
> ++ MNT_NOATIME = 0x8000
> ++ MNT_NODEV = 0x10
> ++ MNT_NOEXEC = 0x4
> ++ MNT_NOPERM = 0x20
> ++ MNT_NOSUID = 0x8
> ++ MNT_NOWAIT = 0x2
> ++ MNT_QUOTA = 0x2000
> ++ MNT_RDONLY = 0x1
> ++ MNT_RELOAD = 0x40000
> ++ MNT_ROOTFS = 0x4000
> ++ MNT_SOFTDEP = 0x4000000
> ++ MNT_STALLED = 0x100000
> ++ MNT_SWAPPABLE = 0x200000
> ++ MNT_SYNCHRONOUS = 0x2
> ++ MNT_UPDATE = 0x10000
> ++ MNT_VISFLAGMASK = 0x400ffff
> ++ MNT_WAIT = 0x1
> ++ MNT_WANTRDWR = 0x2000000
> ++ MNT_WXALLOWED = 0x800
> ++ MSG_BCAST = 0x100
> ++ MSG_CMSG_CLOEXEC = 0x800
> ++ MSG_CTRUNC = 0x20
> ++ MSG_DONTROUTE = 0x4
> ++ MSG_DONTWAIT = 0x80
> ++ MSG_EOR = 0x8
> ++ MSG_MCAST = 0x200
> ++ MSG_NOSIGNAL = 0x400
> ++ MSG_OOB = 0x1
> ++ MSG_PEEK = 0x2
> ++ MSG_TRUNC = 0x10
> ++ MSG_WAITALL = 0x40
> ++ MS_ASYNC = 0x1
> ++ MS_INVALIDATE = 0x4
> ++ MS_SYNC = 0x2
> ++ NAME_MAX = 0xff
> ++ NET_RT_DUMP = 0x1
> ++ NET_RT_FLAGS = 0x2
> ++ NET_RT_IFLIST = 0x3
> ++ NET_RT_IFNAMES = 0x6
> ++ NET_RT_MAXID = 0x7
> ++ NET_RT_STATS = 0x4
> ++ NET_RT_TABLE = 0x5
> ++ NFDBITS = 0x20
> ++ NOFLSH = 0x80000000
> ++ NOKERNINFO = 0x2000000
> ++ NOTE_ATTRIB = 0x8
> ++ NOTE_CHANGE = 0x1
> ++ NOTE_CHILD = 0x4
> ++ NOTE_DELETE = 0x1
> ++ NOTE_EOF = 0x2
> ++ NOTE_EXEC = 0x20000000
> ++ NOTE_EXIT = 0x80000000
> ++ NOTE_EXTEND = 0x4
> ++ NOTE_FORK = 0x40000000
> ++ NOTE_LINK = 0x10
> ++ NOTE_LOWAT = 0x1
> ++ NOTE_PCTRLMASK = 0xf0000000
> ++ NOTE_PDATAMASK = 0xfffff
> ++ NOTE_RENAME = 0x20
> ++ NOTE_REVOKE = 0x40
> ++ NOTE_TRACK = 0x1
> ++ NOTE_TRACKERR = 0x2
> ++ NOTE_TRUNCATE = 0x80
> ++ NOTE_WRITE = 0x2
> ++ OCRNL = 0x10
> ++ OLCUC = 0x20
> ++ ONLCR = 0x2
> ++ ONLRET = 0x80
> ++ ONOCR = 0x40
> ++ ONOEOT = 0x8
> ++ OPOST = 0x1
> ++ OXTABS = 0x4
> ++ O_ACCMODE = 0x3
> ++ O_APPEND = 0x8
> ++ O_ASYNC = 0x40
> ++ O_CLOEXEC = 0x10000
> ++ O_CREAT = 0x200
> ++ O_DIRECTORY = 0x20000
> ++ O_DSYNC = 0x80
> ++ O_EXCL = 0x800
> ++ O_EXLOCK = 0x20
> ++ O_FSYNC = 0x80
> ++ O_NDELAY = 0x4
> ++ O_NOCTTY = 0x8000
> ++ O_NOFOLLOW = 0x100
> ++ O_NONBLOCK = 0x4
> ++ O_RDONLY = 0x0
> ++ O_RDWR = 0x2
> ++ O_RSYNC = 0x80
> ++ O_SHLOCK = 0x10
> ++ O_SYNC = 0x80
> ++ O_TRUNC = 0x400
> ++ O_WRONLY = 0x1
> ++ PARENB = 0x1000
> ++ PARMRK = 0x8
> ++ PARODD = 0x2000
> ++ PENDIN = 0x20000000
> ++ PF_FLUSH = 0x1
> ++ PRIO_PGRP = 0x1
> ++ PRIO_PROCESS = 0x0
> ++ PRIO_USER = 0x2
> ++ PROT_EXEC = 0x4
> ++ PROT_NONE = 0x0
> ++ PROT_READ = 0x1
> ++ PROT_WRITE = 0x2
> ++ RLIMIT_CORE = 0x4
> ++ RLIMIT_CPU = 0x0
> ++ RLIMIT_DATA = 0x2
> ++ RLIMIT_FSIZE = 0x1
> ++ RLIMIT_MEMLOCK = 0x6
> ++ RLIMIT_NOFILE = 0x8
> ++ RLIMIT_NPROC = 0x7
> ++ RLIMIT_RSS = 0x5
> ++ RLIMIT_STACK = 0x3
> ++ RLIM_INFINITY = 0x7fffffffffffffff
> ++ RTAX_AUTHOR = 0x6
> ++ RTAX_BFD = 0xb
> ++ RTAX_BRD = 0x7
> ++ RTAX_DNS = 0xc
> ++ RTAX_DST = 0x0
> ++ RTAX_GATEWAY = 0x1
> ++ RTAX_GENMASK = 0x3
> ++ RTAX_IFA = 0x5
> ++ RTAX_IFP = 0x4
> ++ RTAX_LABEL = 0xa
> ++ RTAX_MAX = 0xf
> ++ RTAX_NETMASK = 0x2
> ++ RTAX_SEARCH = 0xe
> ++ RTAX_SRC = 0x8
> ++ RTAX_SRCMASK = 0x9
> ++ RTAX_STATIC = 0xd
> ++ RTA_AUTHOR = 0x40
> ++ RTA_BFD = 0x800
> ++ RTA_BRD = 0x80
> ++ RTA_DNS = 0x1000
> ++ RTA_DST = 0x1
> ++ RTA_GATEWAY = 0x2
> ++ RTA_GENMASK = 0x8
> ++ RTA_IFA = 0x20
> ++ RTA_IFP = 0x10
> ++ RTA_LABEL = 0x400
> ++ RTA_NETMASK = 0x4
> ++ RTA_SEARCH = 0x4000
> ++ RTA_SRC = 0x100
> ++ RTA_SRCMASK = 0x200
> ++ RTA_STATIC = 0x2000
> ++ RTF_ANNOUNCE = 0x4000
> ++ RTF_BFD = 0x1000000
> ++ RTF_BLACKHOLE = 0x1000
> ++ RTF_BROADCAST = 0x400000
> ++ RTF_CACHED = 0x20000
> ++ RTF_CLONED = 0x10000
> ++ RTF_CLONING = 0x100
> ++ RTF_CONNECTED = 0x800000
> ++ RTF_DONE = 0x40
> ++ RTF_DYNAMIC = 0x10
> ++ RTF_FMASK = 0x110fc08
> ++ RTF_GATEWAY = 0x2
> ++ RTF_HOST = 0x4
> ++ RTF_LLINFO = 0x400
> ++ RTF_LOCAL = 0x200000
> ++ RTF_MODIFIED = 0x20
> ++ RTF_MPATH = 0x40000
> ++ RTF_MPLS = 0x100000
> ++ RTF_MULTICAST = 0x200
> ++ RTF_PERMANENT_ARP = 0x2000
> ++ RTF_PROTO1 = 0x8000
> ++ RTF_PROTO2 = 0x4000
> ++ RTF_PROTO3 = 0x2000
> ++ RTF_REJECT = 0x8
> ++ RTF_STATIC = 0x800
> ++ RTF_UP = 0x1
> ++ RTF_USETRAILERS = 0x8000
> ++ RTM_80211INFO = 0x15
> ++ RTM_ADD = 0x1
> ++ RTM_BFD = 0x12
> ++ RTM_CHANGE = 0x3
> ++ RTM_CHGADDRATTR = 0x14
> ++ RTM_DELADDR = 0xd
> ++ RTM_DELETE = 0x2
> ++ RTM_DESYNC = 0x10
> ++ RTM_GET = 0x4
> ++ RTM_IFANNOUNCE = 0xf
> ++ RTM_IFINFO = 0xe
> ++ RTM_INVALIDATE = 0x11
> ++ RTM_LOSING = 0x5
> ++ RTM_MAXSIZE = 0x800
> ++ RTM_MISS = 0x7
> ++ RTM_NEWADDR = 0xc
> ++ RTM_PROPOSAL = 0x13
> ++ RTM_REDIRECT = 0x6
> ++ RTM_RESOLVE = 0xb
> ++ RTM_RTTUNIT = 0xf4240
> ++ RTM_VERSION = 0x5
> ++ RTV_EXPIRE = 0x4
> ++ RTV_HOPCOUNT = 0x2
> ++ RTV_MTU = 0x1
> ++ RTV_RPIPE = 0x8
> ++ RTV_RTT = 0x40
> ++ RTV_RTTVAR = 0x80
> ++ RTV_SPIPE = 0x10
> ++ RTV_SSTHRESH = 0x20
> ++ RT_TABLEID_BITS = 0x8
> ++ RT_TABLEID_MASK = 0xff
> ++ RT_TABLEID_MAX = 0xff
> ++ RUSAGE_CHILDREN = -0x1
> ++ RUSAGE_SELF = 0x0
> ++ RUSAGE_THREAD = 0x1
> ++ SCM_RIGHTS = 0x1
> ++ SCM_TIMESTAMP = 0x4
> ++ SHUT_RD = 0x0
> ++ SHUT_RDWR = 0x2
> ++ SHUT_WR = 0x1
> ++ SIOCADDMULTI = 0x80206931
> ++ SIOCAIFADDR = 0x8040691a
> ++ SIOCAIFGROUP = 0x80286987
> ++ SIOCATMARK = 0x40047307
> ++ SIOCBRDGADD = 0x8060693c
> ++ SIOCBRDGADDL = 0x80606949
> ++ SIOCBRDGADDS = 0x80606941
> ++ SIOCBRDGARL = 0x808c694d
> ++ SIOCBRDGDADDR = 0x81286947
> ++ SIOCBRDGDEL = 0x8060693d
> ++ SIOCBRDGDELS = 0x80606942
> ++ SIOCBRDGFLUSH = 0x80606948
> ++ SIOCBRDGFRL = 0x808c694e
> ++ SIOCBRDGGCACHE = 0xc0186941
> ++ SIOCBRDGGFD = 0xc0186952
> ++ SIOCBRDGGHT = 0xc0186951
> ++ SIOCBRDGGIFFLGS = 0xc060693e
> ++ SIOCBRDGGMA = 0xc0186953
> ++ SIOCBRDGGPARAM = 0xc0406958
> ++ SIOCBRDGGPRI = 0xc0186950
> ++ SIOCBRDGGRL = 0xc030694f
> ++ SIOCBRDGGTO = 0xc0186946
> ++ SIOCBRDGIFS = 0xc0606942
> ++ SIOCBRDGRTS = 0xc0206943
> ++ SIOCBRDGSADDR = 0xc1286944
> ++ SIOCBRDGSCACHE = 0x80186940
> ++ SIOCBRDGSFD = 0x80186952
> ++ SIOCBRDGSHT = 0x80186951
> ++ SIOCBRDGSIFCOST = 0x80606955
> ++ SIOCBRDGSIFFLGS = 0x8060693f
> ++ SIOCBRDGSIFPRIO = 0x80606954
> ++ SIOCBRDGSIFPROT = 0x8060694a
> ++ SIOCBRDGSMA = 0x80186953
> ++ SIOCBRDGSPRI = 0x80186950
> ++ SIOCBRDGSPROTO = 0x8018695a
> ++ SIOCBRDGSTO = 0x80186945
> ++ SIOCBRDGSTXHC = 0x80186959
> ++ SIOCDELLABEL = 0x80206997
> ++ SIOCDELMULTI = 0x80206932
> ++ SIOCDIFADDR = 0x80206919
> ++ SIOCDIFGROUP = 0x80286989
> ++ SIOCDIFPARENT = 0x802069b4
> ++ SIOCDIFPHYADDR = 0x80206949
> ++ SIOCDPWE3NEIGHBOR = 0x802069de
> ++ SIOCDVNETID = 0x802069af
> ++ SIOCGETKALIVE = 0xc01869a4
> ++ SIOCGETLABEL = 0x8020699a
> ++ SIOCGETMPWCFG = 0xc02069ae
> ++ SIOCGETPFLOW = 0xc02069fe
> ++ SIOCGETPFSYNC = 0xc02069f8
> ++ SIOCGETSGCNT = 0xc0207534
> ++ SIOCGETVIFCNT = 0xc0287533
> ++ SIOCGETVLAN = 0xc0206990
> ++ SIOCGIFADDR = 0xc0206921
> ++ SIOCGIFBRDADDR = 0xc0206923
> ++ SIOCGIFCONF = 0xc0106924
> ++ SIOCGIFDATA = 0xc020691b
> ++ SIOCGIFDESCR = 0xc0206981
> ++ SIOCGIFDSTADDR = 0xc0206922
> ++ SIOCGIFFLAGS = 0xc0206911
> ++ SIOCGIFGATTR = 0xc028698b
> ++ SIOCGIFGENERIC = 0xc020693a
> ++ SIOCGIFGLIST = 0xc028698d
> ++ SIOCGIFGMEMB = 0xc028698a
> ++ SIOCGIFGROUP = 0xc0286988
> ++ SIOCGIFHARDMTU = 0xc02069a5
> ++ SIOCGIFLLPRIO = 0xc02069b6
> ++ SIOCGIFMEDIA = 0xc0406938
> ++ SIOCGIFMETRIC = 0xc0206917
> ++ SIOCGIFMTU = 0xc020697e
> ++ SIOCGIFNETMASK = 0xc0206925
> ++ SIOCGIFPAIR = 0xc02069b1
> ++ SIOCGIFPARENT = 0xc02069b3
> ++ SIOCGIFPRIORITY = 0xc020699c
> ++ SIOCGIFRDOMAIN = 0xc02069a0
> ++ SIOCGIFRTLABEL = 0xc0206983
> ++ SIOCGIFRXR = 0x802069aa
> ++ SIOCGIFSFFPAGE = 0xc1126939
> ++ SIOCGIFXFLAGS = 0xc020699e
> ++ SIOCGLIFPHYADDR = 0xc218694b
> ++ SIOCGLIFPHYDF = 0xc02069c2
> ++ SIOCGLIFPHYECN = 0xc02069c8
> ++ SIOCGLIFPHYRTABLE = 0xc02069a2
> ++ SIOCGLIFPHYTTL = 0xc02069a9
> ++ SIOCGPGRP = 0x40047309
> ++ SIOCGPWE3 = 0xc0206998
> ++ SIOCGPWE3CTRLWORD = 0xc02069dc
> ++ SIOCGPWE3FAT = 0xc02069dd
> ++ SIOCGPWE3NEIGHBOR = 0xc21869de
> ++ SIOCGSPPPPARAMS = 0xc0206994
> ++ SIOCGTXHPRIO = 0xc02069c6
> ++ SIOCGUMBINFO = 0xc02069be
> ++ SIOCGUMBPARAM = 0xc02069c0
> ++ SIOCGVH = 0xc02069f6
> ++ SIOCGVNETFLOWID = 0xc02069c4
> ++ SIOCGVNETID = 0xc02069a7
> ++ SIOCIFAFATTACH = 0x801169ab
> ++ SIOCIFAFDETACH = 0x801169ac
> ++ SIOCIFCREATE = 0x8020697a
> ++ SIOCIFDESTROY = 0x80206979
> ++ SIOCIFGCLONERS = 0xc0106978
> ++ SIOCSETKALIVE = 0x801869a3
> ++ SIOCSETLABEL = 0x80206999
> ++ SIOCSETMPWCFG = 0x802069ad
> ++ SIOCSETPFLOW = 0x802069fd
> ++ SIOCSETPFSYNC = 0x802069f7
> ++ SIOCSETVLAN = 0x8020698f
> ++ SIOCSIFADDR = 0x8020690c
> ++ SIOCSIFBRDADDR = 0x80206913
> ++ SIOCSIFDESCR = 0x80206980
> ++ SIOCSIFDSTADDR = 0x8020690e
> ++ SIOCSIFFLAGS = 0x80206910
> ++ SIOCSIFGATTR = 0x8028698c
> ++ SIOCSIFGENERIC = 0x80206939
> ++ SIOCSIFLLADDR = 0x8020691f
> ++ SIOCSIFLLPRIO = 0x802069b5
> ++ SIOCSIFMEDIA = 0xc0206937
> ++ SIOCSIFMETRIC = 0x80206918
> ++ SIOCSIFMTU = 0x8020697f
> ++ SIOCSIFNETMASK = 0x80206916
> ++ SIOCSIFPAIR = 0x802069b0
> ++ SIOCSIFPARENT = 0x802069b2
> ++ SIOCSIFPRIORITY = 0x8020699b
> ++ SIOCSIFRDOMAIN = 0x8020699f
> ++ SIOCSIFRTLABEL = 0x80206982
> ++ SIOCSIFXFLAGS = 0x8020699d
> ++ SIOCSLIFPHYADDR = 0x8218694a
> ++ SIOCSLIFPHYDF = 0x802069c1
> ++ SIOCSLIFPHYECN = 0x802069c7
> ++ SIOCSLIFPHYRTABLE = 0x802069a1
> ++ SIOCSLIFPHYTTL = 0x802069a8
> ++ SIOCSPGRP = 0x80047308
> ++ SIOCSPWE3CTRLWORD = 0x802069dc
> ++ SIOCSPWE3FAT = 0x802069dd
> ++ SIOCSPWE3NEIGHBOR = 0x821869de
> ++ SIOCSSPPPPARAMS = 0x80206993
> ++ SIOCSTXHPRIO = 0x802069c5
> ++ SIOCSUMBPARAM = 0x802069bf
> ++ SIOCSVH = 0xc02069f5
> ++ SIOCSVNETFLOWID = 0x802069c3
> ++ SIOCSVNETID = 0x802069a6
> ++ SIOCSWGDPID = 0xc018695b
> ++ SIOCSWGMAXFLOW = 0xc0186960
> ++ SIOCSWGMAXGROUP = 0xc018695d
> ++ SIOCSWSDPID = 0x8018695c
> ++ SIOCSWSPORTNO = 0xc060695f
> ++ SOCK_CLOEXEC = 0x8000
> ++ SOCK_DGRAM = 0x2
> ++ SOCK_DNS = 0x1000
> ++ SOCK_NONBLOCK = 0x4000
> ++ SOCK_RAW = 0x3
> ++ SOCK_RDM = 0x4
> ++ SOCK_SEQPACKET = 0x5
> ++ SOCK_STREAM = 0x1
> ++ SOL_SOCKET = 0xffff
> ++ SOMAXCONN = 0x80
> ++ SO_ACCEPTCONN = 0x2
> ++ SO_BINDANY = 0x1000
> ++ SO_BROADCAST = 0x20
> ++ SO_DEBUG = 0x1
> ++ SO_DONTROUTE = 0x10
> ++ SO_ERROR = 0x1007
> ++ SO_KEEPALIVE = 0x8
> ++ SO_LINGER = 0x80
> ++ SO_NETPROC = 0x1020
> ++ SO_OOBINLINE = 0x100
> ++ SO_PEERCRED = 0x1022
> ++ SO_RCVBUF = 0x1002
> ++ SO_RCVLOWAT = 0x1004
> ++ SO_RCVTIMEO = 0x1006
> ++ SO_REUSEADDR = 0x4
> ++ SO_REUSEPORT = 0x200
> ++ SO_RTABLE = 0x1021
> ++ SO_SNDBUF = 0x1001
> ++ SO_SNDLOWAT = 0x1003
> ++ SO_SNDTIMEO = 0x1005
> ++ SO_SPLICE = 0x1023
> ++ SO_TIMESTAMP = 0x800
> ++ SO_TYPE = 0x1008
> ++ SO_USELOOPBACK = 0x40
> ++ SO_ZEROIZE = 0x2000
> ++ S_BLKSIZE = 0x200
> ++ S_IEXEC = 0x40
> ++ S_IFBLK = 0x6000
> ++ S_IFCHR = 0x2000
> ++ S_IFDIR = 0x4000
> ++ S_IFIFO = 0x1000
> ++ S_IFLNK = 0xa000
> ++ S_IFMT = 0xf000
> ++ S_IFREG = 0x8000
> ++ S_IFSOCK = 0xc000
> ++ S_IREAD = 0x100
> ++ S_IRGRP = 0x20
> ++ S_IROTH = 0x4
> ++ S_IRUSR = 0x100
> ++ S_IRWXG = 0x38
> ++ S_IRWXO = 0x7
> ++ S_IRWXU = 0x1c0
> ++ S_ISGID = 0x400
> ++ S_ISTXT = 0x200
> ++ S_ISUID = 0x800
> ++ S_ISVTX = 0x200
> ++ S_IWGRP = 0x10
> ++ S_IWOTH = 0x2
> ++ S_IWRITE = 0x80
> ++ S_IWUSR = 0x80
> ++ S_IXGRP = 0x8
> ++ S_IXOTH = 0x1
> ++ S_IXUSR = 0x40
> ++ TCIFLUSH = 0x1
> ++ TCIOFF = 0x3
> ++ TCIOFLUSH = 0x3
> ++ TCION = 0x4
> ++ TCOFLUSH = 0x2
> ++ TCOOFF = 0x1
> ++ TCOON = 0x2
> ++ TCP_MAXBURST = 0x4
> ++ TCP_MAXSEG = 0x2
> ++ TCP_MAXWIN = 0xffff
> ++ TCP_MAX_SACK = 0x3
> ++ TCP_MAX_WINSHIFT = 0xe
> ++ TCP_MD5SIG = 0x4
> ++ TCP_MSS = 0x200
> ++ TCP_NODELAY = 0x1
> ++ TCP_NOPUSH = 0x10
> ++ TCP_SACK_ENABLE = 0x8
> ++ TCSAFLUSH = 0x2
> ++ TIMER_ABSTIME = 0x1
> ++ TIMER_RELTIME = 0x0
> ++ TIOCCBRK = 0x2000747a
> ++ TIOCCDTR = 0x20007478
> ++ TIOCCHKVERAUTH = 0x2000741e
> ++ TIOCCLRVERAUTH = 0x2000741d
> ++ TIOCCONS = 0x80047462
> ++ TIOCDRAIN = 0x2000745e
> ++ TIOCEXCL = 0x2000740d
> ++ TIOCEXT = 0x80047460
> ++ TIOCFLAG_CLOCAL = 0x2
> ++ TIOCFLAG_CRTSCTS = 0x4
> ++ TIOCFLAG_MDMBUF = 0x8
> ++ TIOCFLAG_PPS = 0x10
> ++ TIOCFLAG_SOFTCAR = 0x1
> ++ TIOCFLUSH = 0x80047410
> ++ TIOCGETA = 0x402c7413
> ++ TIOCGETD = 0x4004741a
> ++ TIOCGFLAGS = 0x4004745d
> ++ TIOCGPGRP = 0x40047477
> ++ TIOCGSID = 0x40047463
> ++ TIOCGTSTAMP = 0x4010745b
> ++ TIOCGWINSZ = 0x40087468
> ++ TIOCMBIC = 0x8004746b
> ++ TIOCMBIS = 0x8004746c
> ++ TIOCMGET = 0x4004746a
> ++ TIOCMODG = 0x4004746a
> ++ TIOCMODS = 0x8004746d
> ++ TIOCMSET = 0x8004746d
> ++ TIOCM_CAR = 0x40
> ++ TIOCM_CD = 0x40
> ++ TIOCM_CTS = 0x20
> ++ TIOCM_DSR = 0x100
> ++ TIOCM_DTR = 0x2
> ++ TIOCM_LE = 0x1
> ++ TIOCM_RI = 0x80
> ++ TIOCM_RNG = 0x80
> ++ TIOCM_RTS = 0x4
> ++ TIOCM_SR = 0x10
> ++ TIOCM_ST = 0x8
> ++ TIOCNOTTY = 0x20007471
> ++ TIOCNXCL = 0x2000740e
> ++ TIOCOUTQ = 0x40047473
> ++ TIOCPKT = 0x80047470
> ++ TIOCPKT_DATA = 0x0
> ++ TIOCPKT_DOSTOP = 0x20
> ++ TIOCPKT_FLUSHREAD = 0x1
> ++ TIOCPKT_FLUSHWRITE = 0x2
> ++ TIOCPKT_IOCTL = 0x40
> ++ TIOCPKT_NOSTOP = 0x10
> ++ TIOCPKT_START = 0x8
> ++ TIOCPKT_STOP = 0x4
> ++ TIOCREMOTE = 0x80047469
> ++ TIOCSBRK = 0x2000747b
> ++ TIOCSCTTY = 0x20007461
> ++ TIOCSDTR = 0x20007479
> ++ TIOCSETA = 0x802c7414
> ++ TIOCSETAF = 0x802c7416
> ++ TIOCSETAW = 0x802c7415
> ++ TIOCSETD = 0x8004741b
> ++ TIOCSETVERAUTH = 0x8004741c
> ++ TIOCSFLAGS = 0x8004745c
> ++ TIOCSIG = 0x8004745f
> ++ TIOCSPGRP = 0x80047476
> ++ TIOCSTART = 0x2000746e
> ++ TIOCSTAT = 0x20007465
> ++ TIOCSTOP = 0x2000746f
> ++ TIOCSTSTAMP = 0x8008745a
> ++ TIOCSWINSZ = 0x80087467
> ++ TIOCUCNTL = 0x80047466
> ++ TIOCUCNTL_CBRK = 0x7a
> ++ TIOCUCNTL_SBRK = 0x7b
> ++ TOSTOP = 0x400000
> ++ UTIME_NOW = -0x2
> ++ UTIME_OMIT = -0x1
> ++ VDISCARD = 0xf
> ++ VDSUSP = 0xb
> ++ VEOF = 0x0
> ++ VEOL = 0x1
> ++ VEOL2 = 0x2
> ++ VERASE = 0x3
> ++ VINTR = 0x8
> ++ VKILL = 0x5
> ++ VLNEXT = 0xe
> ++ VMIN = 0x10
> ++ VM_ANONMIN = 0x7
> ++ VM_LOADAVG = 0x2
> ++ VM_MALLOC_CONF = 0xc
> ++ VM_MAXID = 0xd
> ++ VM_MAXSLP = 0xa
> ++ VM_METER = 0x1
> ++ VM_NKMEMPAGES = 0x6
> ++ VM_PSSTRINGS = 0x3
> ++ VM_SWAPENCRYPT = 0x5
> ++ VM_USPACE = 0xb
> ++ VM_UVMEXP = 0x4
> ++ VM_VNODEMIN = 0x9
> ++ VM_VTEXTMIN = 0x8
> ++ VQUIT = 0x9
> ++ VREPRINT = 0x6
> ++ VSTART = 0xc
> ++ VSTATUS = 0x12
> ++ VSTOP = 0xd
> ++ VSUSP = 0xa
> ++ VTIME = 0x11
> ++ VWERASE = 0x4
> ++ WALTSIG = 0x4
> ++ WCONTINUED = 0x8
> ++ WCOREFLAG = 0x80
> ++ WNOHANG = 0x1
> ++ WUNTRACED = 0x2
> ++ XCASE = 0x1000000
> ++)
> ++
> ++// Errors
> ++const (
> ++ E2BIG = syscall.Errno(0x7)
> ++ EACCES = syscall.Errno(0xd)
> ++ EADDRINUSE = syscall.Errno(0x30)
> ++ EADDRNOTAVAIL = syscall.Errno(0x31)
> ++ EAFNOSUPPORT = syscall.Errno(0x2f)
> ++ EAGAIN = syscall.Errno(0x23)
> ++ EALREADY = syscall.Errno(0x25)
> ++ EAUTH = syscall.Errno(0x50)
> ++ EBADF = syscall.Errno(0x9)
> ++ EBADMSG = syscall.Errno(0x5c)
> ++ EBADRPC = syscall.Errno(0x48)
> ++ EBUSY = syscall.Errno(0x10)
> ++ ECANCELED = syscall.Errno(0x58)
> ++ ECHILD = syscall.Errno(0xa)
> ++ ECONNABORTED = syscall.Errno(0x35)
> ++ ECONNREFUSED = syscall.Errno(0x3d)
> ++ ECONNRESET = syscall.Errno(0x36)
> ++ EDEADLK = syscall.Errno(0xb)
> ++ EDESTADDRREQ = syscall.Errno(0x27)
> ++ EDOM = syscall.Errno(0x21)
> ++ EDQUOT = syscall.Errno(0x45)
> ++ EEXIST = syscall.Errno(0x11)
> ++ EFAULT = syscall.Errno(0xe)
> ++ EFBIG = syscall.Errno(0x1b)
> ++ EFTYPE = syscall.Errno(0x4f)
> ++ EHOSTDOWN = syscall.Errno(0x40)
> ++ EHOSTUNREACH = syscall.Errno(0x41)
> ++ EIDRM = syscall.Errno(0x59)
> ++ EILSEQ = syscall.Errno(0x54)
> ++ EINPROGRESS = syscall.Errno(0x24)
> ++ EINTR = syscall.Errno(0x4)
> ++ EINVAL = syscall.Errno(0x16)
> ++ EIO = syscall.Errno(0x5)
> ++ EIPSEC = syscall.Errno(0x52)
> ++ EISCONN = syscall.Errno(0x38)
> ++ EISDIR = syscall.Errno(0x15)
> ++ ELAST = syscall.Errno(0x5f)
> ++ ELOOP = syscall.Errno(0x3e)
> ++ EMEDIUMTYPE = syscall.Errno(0x56)
> ++ EMFILE = syscall.Errno(0x18)
> ++ EMLINK = syscall.Errno(0x1f)
> ++ EMSGSIZE = syscall.Errno(0x28)
> ++ ENAMETOOLONG = syscall.Errno(0x3f)
> ++ ENEEDAUTH = syscall.Errno(0x51)
> ++ ENETDOWN = syscall.Errno(0x32)
> ++ ENETRESET = syscall.Errno(0x34)
> ++ ENETUNREACH = syscall.Errno(0x33)
> ++ ENFILE = syscall.Errno(0x17)
> ++ ENOATTR = syscall.Errno(0x53)
> ++ ENOBUFS = syscall.Errno(0x37)
> ++ ENODEV = syscall.Errno(0x13)
> ++ ENOENT = syscall.Errno(0x2)
> ++ ENOEXEC = syscall.Errno(0x8)
> ++ ENOLCK = syscall.Errno(0x4d)
> ++ ENOMEDIUM = syscall.Errno(0x55)
> ++ ENOMEM = syscall.Errno(0xc)
> ++ ENOMSG = syscall.Errno(0x5a)
> ++ ENOPROTOOPT = syscall.Errno(0x2a)
> ++ ENOSPC = syscall.Errno(0x1c)
> ++ ENOSYS = syscall.Errno(0x4e)
> ++ ENOTBLK = syscall.Errno(0xf)
> ++ ENOTCONN = syscall.Errno(0x39)
> ++ ENOTDIR = syscall.Errno(0x14)
> ++ ENOTEMPTY = syscall.Errno(0x42)
> ++ ENOTRECOVERABLE = syscall.Errno(0x5d)
> ++ ENOTSOCK = syscall.Errno(0x26)
> ++ ENOTSUP = syscall.Errno(0x5b)
> ++ ENOTTY = syscall.Errno(0x19)
> ++ ENXIO = syscall.Errno(0x6)
> ++ EOPNOTSUPP = syscall.Errno(0x2d)
> ++ EOVERFLOW = syscall.Errno(0x57)
> ++ EOWNERDEAD = syscall.Errno(0x5e)
> ++ EPERM = syscall.Errno(0x1)
> ++ EPFNOSUPPORT = syscall.Errno(0x2e)
> ++ EPIPE = syscall.Errno(0x20)
> ++ EPROCLIM = syscall.Errno(0x43)
> ++ EPROCUNAVAIL = syscall.Errno(0x4c)
> ++ EPROGMISMATCH = syscall.Errno(0x4b)
> ++ EPROGUNAVAIL = syscall.Errno(0x4a)
> ++ EPROTO = syscall.Errno(0x5f)
> ++ EPROTONOSUPPORT = syscall.Errno(0x2b)
> ++ EPROTOTYPE = syscall.Errno(0x29)
> ++ ERANGE = syscall.Errno(0x22)
> ++ EREMOTE = syscall.Errno(0x47)
> ++ EROFS = syscall.Errno(0x1e)
> ++ ERPCMISMATCH = syscall.Errno(0x49)
> ++ ESHUTDOWN = syscall.Errno(0x3a)
> ++ ESOCKTNOSUPPORT = syscall.Errno(0x2c)
> ++ ESPIPE = syscall.Errno(0x1d)
> ++ ESRCH = syscall.Errno(0x3)
> ++ ESTALE = syscall.Errno(0x46)
> ++ ETIMEDOUT = syscall.Errno(0x3c)
> ++ ETOOMANYREFS = syscall.Errno(0x3b)
> ++ ETXTBSY = syscall.Errno(0x1a)
> ++ EUSERS = syscall.Errno(0x44)
> ++ EWOULDBLOCK = syscall.Errno(0x23)
> ++ EXDEV = syscall.Errno(0x12)
> ++)
> ++
> ++// Signals
> ++const (
> ++ SIGABRT = syscall.Signal(0x6)
> ++ SIGALRM = syscall.Signal(0xe)
> ++ SIGBUS = syscall.Signal(0xa)
> ++ SIGCHLD = syscall.Signal(0x14)
> ++ SIGCONT = syscall.Signal(0x13)
> ++ SIGEMT = syscall.Signal(0x7)
> ++ SIGFPE = syscall.Signal(0x8)
> ++ SIGHUP = syscall.Signal(0x1)
> ++ SIGILL = syscall.Signal(0x4)
> ++ SIGINFO = syscall.Signal(0x1d)
> ++ SIGINT = syscall.Signal(0x2)
> ++ SIGIO = syscall.Signal(0x17)
> ++ SIGIOT = syscall.Signal(0x6)
> ++ SIGKILL = syscall.Signal(0x9)
> ++ SIGPIPE = syscall.Signal(0xd)
> ++ SIGPROF = syscall.Signal(0x1b)
> ++ SIGQUIT = syscall.Signal(0x3)
> ++ SIGSEGV = syscall.Signal(0xb)
> ++ SIGSTOP = syscall.Signal(0x11)
> ++ SIGSYS = syscall.Signal(0xc)
> ++ SIGTERM = syscall.Signal(0xf)
> ++ SIGTHR = syscall.Signal(0x20)
> ++ SIGTRAP = syscall.Signal(0x5)
> ++ SIGTSTP = syscall.Signal(0x12)
> ++ SIGTTIN = syscall.Signal(0x15)
> ++ SIGTTOU = syscall.Signal(0x16)
> ++ SIGURG = syscall.Signal(0x10)
> ++ SIGUSR1 = syscall.Signal(0x1e)
> ++ SIGUSR2 = syscall.Signal(0x1f)
> ++ SIGVTALRM = syscall.Signal(0x1a)
> ++ SIGWINCH = syscall.Signal(0x1c)
> ++ SIGXCPU = syscall.Signal(0x18)
> ++ SIGXFSZ = syscall.Signal(0x19)
> ++)
> ++
> ++// Error table
> ++var errorList = [...]struct {
> ++ num syscall.Errno
> ++ name string
> ++ desc string
> ++}{
> ++ {1, "EPERM", "operation not permitted"},
> ++ {2, "ENOENT", "no such file or directory"},
> ++ {3, "ESRCH", "no such process"},
> ++ {4, "EINTR", "interrupted system call"},
> ++ {5, "EIO", "input/output error"},
> ++ {6, "ENXIO", "device not configured"},
> ++ {7, "E2BIG", "argument list too long"},
> ++ {8, "ENOEXEC", "exec format error"},
> ++ {9, "EBADF", "bad file descriptor"},
> ++ {10, "ECHILD", "no child processes"},
> ++ {11, "EDEADLK", "resource deadlock avoided"},
> ++ {12, "ENOMEM", "cannot allocate memory"},
> ++ {13, "EACCES", "permission denied"},
> ++ {14, "EFAULT", "bad address"},
> ++ {15, "ENOTBLK", "block device required"},
> ++ {16, "EBUSY", "device busy"},
> ++ {17, "EEXIST", "file exists"},
> ++ {18, "EXDEV", "cross-device link"},
> ++ {19, "ENODEV", "operation not supported by device"},
> ++ {20, "ENOTDIR", "not a directory"},
> ++ {21, "EISDIR", "is a directory"},
> ++ {22, "EINVAL", "invalid argument"},
> ++ {23, "ENFILE", "too many open files in system"},
> ++ {24, "EMFILE", "too many open files"},
> ++ {25, "ENOTTY", "inappropriate ioctl for device"},
> ++ {26, "ETXTBSY", "text file busy"},
> ++ {27, "EFBIG", "file too large"},
> ++ {28, "ENOSPC", "no space left on device"},
> ++ {29, "ESPIPE", "illegal seek"},
> ++ {30, "EROFS", "read-only file system"},
> ++ {31, "EMLINK", "too many links"},
> ++ {32, "EPIPE", "broken pipe"},
> ++ {33, "EDOM", "numerical argument out of domain"},
> ++ {34, "ERANGE", "result too large"},
> ++ {35, "EAGAIN", "resource temporarily unavailable"},
> ++ {36, "EINPROGRESS", "operation now in progress"},
> ++ {37, "EALREADY", "operation already in progress"},
> ++ {38, "ENOTSOCK", "socket operation on non-socket"},
> ++ {39, "EDESTADDRREQ", "destination address required"},
> ++ {40, "EMSGSIZE", "message too long"},
> ++ {41, "EPROTOTYPE", "protocol wrong type for socket"},
> ++ {42, "ENOPROTOOPT", "protocol not available"},
> ++ {43, "EPROTONOSUPPORT", "protocol not supported"},
> ++ {44, "ESOCKTNOSUPPORT", "socket type not supported"},
> ++ {45, "EOPNOTSUPP", "operation not supported"},
> ++ {46, "EPFNOSUPPORT", "protocol family not supported"},
> ++ {47, "EAFNOSUPPORT", "address family not supported by protocol family"},
> ++ {48, "EADDRINUSE", "address already in use"},
> ++ {49, "EADDRNOTAVAIL", "can't assign requested address"},
> ++ {50, "ENETDOWN", "network is down"},
> ++ {51, "ENETUNREACH", "network is unreachable"},
> ++ {52, "ENETRESET", "network dropped connection on reset"},
> ++ {53, "ECONNABORTED", "software caused connection abort"},
> ++ {54, "ECONNRESET", "connection reset by peer"},
> ++ {55, "ENOBUFS", "no buffer space available"},
> ++ {56, "EISCONN", "socket is already connected"},
> ++ {57, "ENOTCONN", "socket is not connected"},
> ++ {58, "ESHUTDOWN", "can't send after socket shutdown"},
> ++ {59, "ETOOMANYREFS", "too many references: can't splice"},
> ++ {60, "ETIMEDOUT", "operation timed out"},
> ++ {61, "ECONNREFUSED", "connection refused"},
> ++ {62, "ELOOP", "too many levels of symbolic links"},
> ++ {63, "ENAMETOOLONG", "file name too long"},
> ++ {64, "EHOSTDOWN", "host is down"},
> ++ {65, "EHOSTUNREACH", "no route to host"},
> ++ {66, "ENOTEMPTY", "directory not empty"},
> ++ {67, "EPROCLIM", "too many processes"},
> ++ {68, "EUSERS", "too many users"},
> ++ {69, "EDQUOT", "disk quota exceeded"},
> ++ {70, "ESTALE", "stale NFS file handle"},
> ++ {71, "EREMOTE", "too many levels of remote in path"},
> ++ {72, "EBADRPC", "RPC struct is bad"},
> ++ {73, "ERPCMISMATCH", "RPC version wrong"},
> ++ {74, "EPROGUNAVAIL", "RPC program not available"},
> ++ {75, "EPROGMISMATCH", "program version wrong"},
> ++ {76, "EPROCUNAVAIL", "bad procedure for program"},
> ++ {77, "ENOLCK", "no locks available"},
> ++ {78, "ENOSYS", "function not implemented"},
> ++ {79, "EFTYPE", "inappropriate file type or format"},
> ++ {80, "EAUTH", "authentication error"},
> ++ {81, "ENEEDAUTH", "need authenticator"},
> ++ {82, "EIPSEC", "IPsec processing failure"},
> ++ {83, "ENOATTR", "attribute not found"},
> ++ {84, "EILSEQ", "illegal byte sequence"},
> ++ {85, "ENOMEDIUM", "no medium found"},
> ++ {86, "EMEDIUMTYPE", "wrong medium type"},
> ++ {87, "EOVERFLOW", "value too large to be stored in data type"},
> ++ {88, "ECANCELED", "operation canceled"},
> ++ {89, "EIDRM", "identifier removed"},
> ++ {90, "ENOMSG", "no message of desired type"},
> ++ {91, "ENOTSUP", "not supported"},
> ++ {92, "EBADMSG", "bad message"},
> ++ {93, "ENOTRECOVERABLE", "state not recoverable"},
> ++ {94, "EOWNERDEAD", "previous owner died"},
> ++ {95, "ELAST", "protocol error"},
> ++}
> ++
> ++// Signal table
> ++var signalList = [...]struct {
> ++ num syscall.Signal
> ++ name string
> ++ desc string
> ++}{
> ++ {1, "SIGHUP", "hangup"},
> ++ {2, "SIGINT", "interrupt"},
> ++ {3, "SIGQUIT", "quit"},
> ++ {4, "SIGILL", "illegal instruction"},
> ++ {5, "SIGTRAP", "trace/BPT trap"},
> ++ {6, "SIGABRT", "abort trap"},
> ++ {7, "SIGEMT", "EMT trap"},
> ++ {8, "SIGFPE", "floating point exception"},
> ++ {9, "SIGKILL", "killed"},
> ++ {10, "SIGBUS", "bus error"},
> ++ {11, "SIGSEGV", "segmentation fault"},
> ++ {12, "SIGSYS", "bad system call"},
> ++ {13, "SIGPIPE", "broken pipe"},
> ++ {14, "SIGALRM", "alarm clock"},
> ++ {15, "SIGTERM", "terminated"},
> ++ {16, "SIGURG", "urgent I/O condition"},
> ++ {17, "SIGSTOP", "suspended (signal)"},
> ++ {18, "SIGTSTP", "suspended"},
> ++ {19, "SIGCONT", "continued"},
> ++ {20, "SIGCHLD", "child exited"},
> ++ {21, "SIGTTIN", "stopped (tty input)"},
> ++ {22, "SIGTTOU", "stopped (tty output)"},
> ++ {23, "SIGIO", "I/O possible"},
> ++ {24, "SIGXCPU", "cputime limit exceeded"},
> ++ {25, "SIGXFSZ", "filesize limit exceeded"},
> ++ {26, "SIGVTALRM", "virtual timer expired"},
> ++ {27, "SIGPROF", "profiling timer expired"},
> ++ {28, "SIGWINCH", "window size changes"},
> ++ {29, "SIGINFO", "information request"},
> ++ {30, "SIGUSR1", "user defined signal 1"},
> ++ {31, "SIGUSR2", "user defined signal 2"},
> ++ {32, "SIGTHR", "thread AST"},
> ++}
> Index: patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zsyscall_openbsd_riscv64_go
> ===================================================================
> RCS file: patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zsyscall_openbsd_riscv64_go
> diff -N patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zsyscall_openbsd_riscv64_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zsyscall_openbsd_riscv64_go 18 Sep 2022 07:51:25 -0000
> @@ -0,0 +1,1697 @@
> +Index: src/cmd/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go
> +--- src/cmd/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go.orig
> ++++ src/cmd/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go
> +@@ -0,0 +1,1693 @@
> ++// go run mksyscall.go -openbsd -tags openbsd,riscv64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_riscv64.go
> ++// Code generated by the command above; see README.md. DO NOT EDIT.
> ++
> ++//go:build openbsd && riscv64
> ++// +build openbsd,riscv64
> ++
> ++package unix
> ++
> ++import (
> ++ "syscall"
> ++ "unsafe"
> ++)
> ++
> ++var _ syscall.Errno
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func getgroups(ngid int, gid *_Gid_t) (n int, err error) {
> ++ r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0)
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func setgroups(ngid int, gid *_Gid_t) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) {
> ++ r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0)
> ++ wpid = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
> ++ r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
> ++ fd = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
> ++ _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
> ++ _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func socket(domain int, typ int, proto int) (fd int, err error) {
> ++ r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto))
> ++ fd = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
> ++ _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
> ++ _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Shutdown(s int, how int) (err error) {
> ++ _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
> ++ _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) {
> ++ var _p0 unsafe.Pointer
> ++ if len(p) > 0 {
> ++ _p0 = unsafe.Pointer(&p[0])
> ++ } else {
> ++ _p0 = unsafe.Pointer(&_zero)
> ++ }
> ++ r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) {
> ++ var _p0 unsafe.Pointer
> ++ if len(buf) > 0 {
> ++ _p0 = unsafe.Pointer(&buf[0])
> ++ } else {
> ++ _p0 = unsafe.Pointer(&_zero)
> ++ }
> ++ _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
> ++ r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
> ++ r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) {
> ++ r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout)))
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func utimes(path string, timeval *[2]Timeval) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func futimes(fd int, timeval *[2]Timeval) (err error) {
> ++ _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
> ++ r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Madvise(b []byte, behav int) (err error) {
> ++ var _p0 unsafe.Pointer
> ++ if len(b) > 0 {
> ++ _p0 = unsafe.Pointer(&b[0])
> ++ } else {
> ++ _p0 = unsafe.Pointer(&_zero)
> ++ }
> ++ _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Mlock(b []byte) (err error) {
> ++ var _p0 unsafe.Pointer
> ++ if len(b) > 0 {
> ++ _p0 = unsafe.Pointer(&b[0])
> ++ } else {
> ++ _p0 = unsafe.Pointer(&_zero)
> ++ }
> ++ _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Mlockall(flags int) (err error) {
> ++ _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Mprotect(b []byte, prot int) (err error) {
> ++ var _p0 unsafe.Pointer
> ++ if len(b) > 0 {
> ++ _p0 = unsafe.Pointer(&b[0])
> ++ } else {
> ++ _p0 = unsafe.Pointer(&_zero)
> ++ }
> ++ _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Msync(b []byte, flags int) (err error) {
> ++ var _p0 unsafe.Pointer
> ++ if len(b) > 0 {
> ++ _p0 = unsafe.Pointer(&b[0])
> ++ } else {
> ++ _p0 = unsafe.Pointer(&_zero)
> ++ }
> ++ _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Munlock(b []byte) (err error) {
> ++ var _p0 unsafe.Pointer
> ++ if len(b) > 0 {
> ++ _p0 = unsafe.Pointer(&b[0])
> ++ } else {
> ++ _p0 = unsafe.Pointer(&_zero)
> ++ }
> ++ _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Munlockall() (err error) {
> ++ _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func pipe2(p *[2]_C_int, flags int) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Getdents(fd int, buf []byte) (n int, err error) {
> ++ var _p0 unsafe.Pointer
> ++ if len(buf) > 0 {
> ++ _p0 = unsafe.Pointer(&buf[0])
> ++ } else {
> ++ _p0 = unsafe.Pointer(&_zero)
> ++ }
> ++ r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Getcwd(buf []byte) (n int, err error) {
> ++ var _p0 unsafe.Pointer
> ++ if len(buf) > 0 {
> ++ _p0 = unsafe.Pointer(&buf[0])
> ++ } else {
> ++ _p0 = unsafe.Pointer(&_zero)
> ++ }
> ++ r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0)
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func ioctl(fd int, req uint, arg uintptr) (err error) {
> ++ _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
> ++ var _p0 unsafe.Pointer
> ++ if len(mib) > 0 {
> ++ _p0 = unsafe.Pointer(&mib[0])
> ++ } else {
> ++ _p0 = unsafe.Pointer(&_zero)
> ++ }
> ++ _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
> ++ r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Access(path string, mode uint32) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Adjtime(delta *Timeval, olddelta *Timeval) (err error) {
> ++ _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Chdir(path string) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Chflags(path string, flags int) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Chmod(path string, mode uint32) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Chown(path string, uid int, gid int) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Chroot(path string) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Close(fd int) (err error) {
> ++ _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Dup(fd int) (nfd int, err error) {
> ++ r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0)
> ++ nfd = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Dup2(from int, to int) (err error) {
> ++ _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Dup3(from int, to int, flags int) (err error) {
> ++ _, _, e1 := Syscall(SYS_DUP3, uintptr(from), uintptr(to), uintptr(flags))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Exit(code int) {
> ++ Syscall(SYS_EXIT, uintptr(code), 0, 0)
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Fchdir(fd int) (err error) {
> ++ _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Fchflags(fd int, flags int) (err error) {
> ++ _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Fchmod(fd int, mode uint32) (err error) {
> ++ _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Fchown(fd int, uid int, gid int) (err error) {
> ++ _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Flock(fd int, how int) (err error) {
> ++ _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Fpathconf(fd int, name int) (val int, err error) {
> ++ r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0)
> ++ val = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Fstat(fd int, stat *Stat_t) (err error) {
> ++ _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Fstatfs(fd int, stat *Statfs_t) (err error) {
> ++ _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Fsync(fd int) (err error) {
> ++ _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Ftruncate(fd int, length int64) (err error) {
> ++ _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Getegid() (egid int) {
> ++ r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0)
> ++ egid = int(r0)
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Geteuid() (uid int) {
> ++ r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0)
> ++ uid = int(r0)
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Getgid() (gid int) {
> ++ r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0)
> ++ gid = int(r0)
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Getpgid(pid int) (pgid int, err error) {
> ++ r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0)
> ++ pgid = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Getpgrp() (pgrp int) {
> ++ r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0)
> ++ pgrp = int(r0)
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Getpid() (pid int) {
> ++ r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0)
> ++ pid = int(r0)
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Getppid() (ppid int) {
> ++ r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0)
> ++ ppid = int(r0)
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Getpriority(which int, who int) (prio int, err error) {
> ++ r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0)
> ++ prio = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Getrlimit(which int, lim *Rlimit) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Getrtable() (rtable int, err error) {
> ++ r0, _, e1 := RawSyscall(SYS_GETRTABLE, 0, 0, 0)
> ++ rtable = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Getrusage(who int, rusage *Rusage) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Getsid(pid int) (sid int, err error) {
> ++ r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0)
> ++ sid = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Gettimeofday(tv *Timeval) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Getuid() (uid int) {
> ++ r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0)
> ++ uid = int(r0)
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Issetugid() (tainted bool) {
> ++ r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0)
> ++ tainted = bool(r0 != 0)
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Kill(pid int, signum syscall.Signal) (err error) {
> ++ _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Kqueue() (fd int, err error) {
> ++ r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0)
> ++ fd = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Lchown(path string, uid int, gid int) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Link(path string, link string) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ var _p1 *byte
> ++ _p1, err = BytePtrFromString(link)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ var _p1 *byte
> ++ _p1, err = BytePtrFromString(link)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Listen(s int, backlog int) (err error) {
> ++ _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Lstat(path string, stat *Stat_t) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Mkdir(path string, mode uint32) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Mkdirat(dirfd int, path string, mode uint32) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Mkfifo(path string, mode uint32) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Mkfifoat(dirfd int, path string, mode uint32) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Mknod(path string, mode uint32, dev int) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Nanosleep(time *Timespec, leftover *Timespec) (err error) {
> ++ _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Open(path string, mode int, perm uint32) (fd int, err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
> ++ fd = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0)
> ++ fd = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Pathconf(path string, name int) (val int, err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
> ++ val = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func pread(fd int, p []byte, offset int64) (n int, err error) {
> ++ var _p0 unsafe.Pointer
> ++ if len(p) > 0 {
> ++ _p0 = unsafe.Pointer(&p[0])
> ++ } else {
> ++ _p0 = unsafe.Pointer(&_zero)
> ++ }
> ++ r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0)
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func pwrite(fd int, p []byte, offset int64) (n int, err error) {
> ++ var _p0 unsafe.Pointer
> ++ if len(p) > 0 {
> ++ _p0 = unsafe.Pointer(&p[0])
> ++ } else {
> ++ _p0 = unsafe.Pointer(&_zero)
> ++ }
> ++ r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0)
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func read(fd int, p []byte) (n int, err error) {
> ++ var _p0 unsafe.Pointer
> ++ if len(p) > 0 {
> ++ _p0 = unsafe.Pointer(&p[0])
> ++ } else {
> ++ _p0 = unsafe.Pointer(&_zero)
> ++ }
> ++ r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p)))
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Readlink(path string, buf []byte) (n int, err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ var _p1 unsafe.Pointer
> ++ if len(buf) > 0 {
> ++ _p1 = unsafe.Pointer(&buf[0])
> ++ } else {
> ++ _p1 = unsafe.Pointer(&_zero)
> ++ }
> ++ r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ var _p1 unsafe.Pointer
> ++ if len(buf) > 0 {
> ++ _p1 = unsafe.Pointer(&buf[0])
> ++ } else {
> ++ _p1 = unsafe.Pointer(&_zero)
> ++ }
> ++ r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Rename(from string, to string) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(from)
> ++ if err != nil {
> ++ return
> ++ }
> ++ var _p1 *byte
> ++ _p1, err = BytePtrFromString(to)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Renameat(fromfd int, from string, tofd int, to string) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(from)
> ++ if err != nil {
> ++ return
> ++ }
> ++ var _p1 *byte
> ++ _p1, err = BytePtrFromString(to)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Revoke(path string) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Rmdir(path string) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
> ++ r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0)
> ++ newoffset = int64(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
> ++ r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0)
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Setegid(egid int) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Seteuid(euid int) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Setgid(gid int) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Setlogin(name string) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(name)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Setpgid(pid int, pgid int) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Setpriority(which int, who int, prio int) (err error) {
> ++ _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Setregid(rgid int, egid int) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Setreuid(ruid int, euid int) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Setresgid(rgid int, egid int, sgid int) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Setresuid(ruid int, euid int, suid int) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Setrlimit(which int, lim *Rlimit) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Setrtable(rtable int) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_SETRTABLE, uintptr(rtable), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Setsid() (pid int, err error) {
> ++ r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
> ++ pid = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Settimeofday(tp *Timeval) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Setuid(uid int) (err error) {
> ++ _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Stat(path string, stat *Stat_t) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Statfs(path string, stat *Statfs_t) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Symlink(path string, link string) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ var _p1 *byte
> ++ _p1, err = BytePtrFromString(link)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(oldpath)
> ++ if err != nil {
> ++ return
> ++ }
> ++ var _p1 *byte
> ++ _p1, err = BytePtrFromString(newpath)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Sync() (err error) {
> ++ _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Truncate(path string, length int64) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Umask(newmask int) (oldmask int) {
> ++ r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0)
> ++ oldmask = int(r0)
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Unlink(path string) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Unlinkat(dirfd int, path string, flags int) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func Unmount(path string, flags int) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func write(fd int, p []byte) (n int, err error) {
> ++ var _p0 unsafe.Pointer
> ++ if len(p) > 0 {
> ++ _p0 = unsafe.Pointer(&p[0])
> ++ } else {
> ++ _p0 = unsafe.Pointer(&_zero)
> ++ }
> ++ r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)))
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
> ++ r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0)
> ++ ret = uintptr(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func munmap(addr uintptr, length uintptr) (err error) {
> ++ _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
> ++ r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
> ++ r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
> ++ n = int(r0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> ++
> ++// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
> ++
> ++func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) {
> ++ var _p0 *byte
> ++ _p0, err = BytePtrFromString(path)
> ++ if err != nil {
> ++ return
> ++ }
> ++ _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
> ++ if e1 != 0 {
> ++ err = errnoErr(e1)
> ++ }
> ++ return
> ++}
> Index: patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zsysctl_openbsd_riscv64_go
> ===================================================================
> RCS file: patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zsysctl_openbsd_riscv64_go
> diff -N patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zsysctl_openbsd_riscv64_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zsysctl_openbsd_riscv64_go 18 Sep 2022 07:51:25 -0000
> @@ -0,0 +1,280 @@
> +Index: src/cmd/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go
> +--- src/cmd/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go.orig
> ++++ src/cmd/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go
> +@@ -0,0 +1,276 @@
> ++// go run mksysctl_openbsd.go
> ++// Code generated by the command above; DO NOT EDIT.
> ++
> ++//go:build riscv64 && openbsd
> ++// +build riscv64,openbsd
> ++
> ++package unix
> ++
> ++type mibentry struct {
> ++ ctlname string
> ++ ctloid []_C_int
> ++}
> ++
> ++var sysctlMib = []mibentry{
> ++ {"ddb.console", []_C_int{9, 6}},
> ++ {"ddb.log", []_C_int{9, 7}},
> ++ {"ddb.max_line", []_C_int{9, 3}},
> ++ {"ddb.max_width", []_C_int{9, 2}},
> ++ {"ddb.panic", []_C_int{9, 5}},
> ++ {"ddb.profile", []_C_int{9, 9}},
> ++ {"ddb.radix", []_C_int{9, 1}},
> ++ {"ddb.tab_stop_width", []_C_int{9, 4}},
> ++ {"ddb.trigger", []_C_int{9, 8}},
> ++ {"fs.posix.setuid", []_C_int{3, 1, 1}},
> ++ {"hw.allowpowerdown", []_C_int{6, 22}},
> ++ {"hw.byteorder", []_C_int{6, 4}},
> ++ {"hw.cpuspeed", []_C_int{6, 12}},
> ++ {"hw.diskcount", []_C_int{6, 10}},
> ++ {"hw.disknames", []_C_int{6, 8}},
> ++ {"hw.diskstats", []_C_int{6, 9}},
> ++ {"hw.machine", []_C_int{6, 1}},
> ++ {"hw.model", []_C_int{6, 2}},
> ++ {"hw.ncpu", []_C_int{6, 3}},
> ++ {"hw.ncpufound", []_C_int{6, 21}},
> ++ {"hw.ncpuonline", []_C_int{6, 25}},
> ++ {"hw.pagesize", []_C_int{6, 7}},
> ++ {"hw.perfpolicy", []_C_int{6, 23}},
> ++ {"hw.physmem", []_C_int{6, 19}},
> ++ {"hw.product", []_C_int{6, 15}},
> ++ {"hw.serialno", []_C_int{6, 17}},
> ++ {"hw.setperf", []_C_int{6, 13}},
> ++ {"hw.smt", []_C_int{6, 24}},
> ++ {"hw.usermem", []_C_int{6, 20}},
> ++ {"hw.uuid", []_C_int{6, 18}},
> ++ {"hw.vendor", []_C_int{6, 14}},
> ++ {"hw.version", []_C_int{6, 16}},
> ++ {"kern.allowkmem", []_C_int{1, 52}},
> ++ {"kern.argmax", []_C_int{1, 8}},
> ++ {"kern.audio", []_C_int{1, 84}},
> ++ {"kern.boottime", []_C_int{1, 21}},
> ++ {"kern.bufcachepercent", []_C_int{1, 72}},
> ++ {"kern.ccpu", []_C_int{1, 45}},
> ++ {"kern.clockrate", []_C_int{1, 12}},
> ++ {"kern.consdev", []_C_int{1, 75}},
> ++ {"kern.cp_time", []_C_int{1, 40}},
> ++ {"kern.cp_time2", []_C_int{1, 71}},
> ++ {"kern.cpustats", []_C_int{1, 85}},
> ++ {"kern.domainname", []_C_int{1, 22}},
> ++ {"kern.file", []_C_int{1, 73}},
> ++ {"kern.forkstat", []_C_int{1, 42}},
> ++ {"kern.fscale", []_C_int{1, 46}},
> ++ {"kern.fsync", []_C_int{1, 33}},
> ++ {"kern.global_ptrace", []_C_int{1, 81}},
> ++ {"kern.hostid", []_C_int{1, 11}},
> ++ {"kern.hostname", []_C_int{1, 10}},
> ++ {"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}},
> ++ {"kern.job_control", []_C_int{1, 19}},
> ++ {"kern.malloc.buckets", []_C_int{1, 39, 1}},
> ++ {"kern.malloc.kmemnames", []_C_int{1, 39, 3}},
> ++ {"kern.maxclusters", []_C_int{1, 67}},
> ++ {"kern.maxfiles", []_C_int{1, 7}},
> ++ {"kern.maxlocksperuid", []_C_int{1, 70}},
> ++ {"kern.maxpartitions", []_C_int{1, 23}},
> ++ {"kern.maxproc", []_C_int{1, 6}},
> ++ {"kern.maxthread", []_C_int{1, 25}},
> ++ {"kern.maxvnodes", []_C_int{1, 5}},
> ++ {"kern.mbstat", []_C_int{1, 59}},
> ++ {"kern.msgbuf", []_C_int{1, 48}},
> ++ {"kern.msgbufsize", []_C_int{1, 38}},
> ++ {"kern.nchstats", []_C_int{1, 41}},
> ++ {"kern.netlivelocks", []_C_int{1, 76}},
> ++ {"kern.nfiles", []_C_int{1, 56}},
> ++ {"kern.ngroups", []_C_int{1, 18}},
> ++ {"kern.nosuidcoredump", []_C_int{1, 32}},
> ++ {"kern.nprocs", []_C_int{1, 47}},
> ++ {"kern.nselcoll", []_C_int{1, 43}},
> ++ {"kern.nthreads", []_C_int{1, 26}},
> ++ {"kern.numvnodes", []_C_int{1, 58}},
> ++ {"kern.osrelease", []_C_int{1, 2}},
> ++ {"kern.osrevision", []_C_int{1, 3}},
> ++ {"kern.ostype", []_C_int{1, 1}},
> ++ {"kern.osversion", []_C_int{1, 27}},
> ++ {"kern.pool_debug", []_C_int{1, 77}},
> ++ {"kern.posix1version", []_C_int{1, 17}},
> ++ {"kern.proc", []_C_int{1, 66}},
> ++ {"kern.rawpartition", []_C_int{1, 24}},
> ++ {"kern.saved_ids", []_C_int{1, 20}},
> ++ {"kern.securelevel", []_C_int{1, 9}},
> ++ {"kern.seminfo", []_C_int{1, 61}},
> ++ {"kern.shminfo", []_C_int{1, 62}},
> ++ {"kern.somaxconn", []_C_int{1, 28}},
> ++ {"kern.sominconn", []_C_int{1, 29}},
> ++ {"kern.splassert", []_C_int{1, 54}},
> ++ {"kern.stackgap_random", []_C_int{1, 50}},
> ++ {"kern.sysvipc_info", []_C_int{1, 51}},
> ++ {"kern.sysvmsg", []_C_int{1, 34}},
> ++ {"kern.sysvsem", []_C_int{1, 35}},
> ++ {"kern.sysvshm", []_C_int{1, 36}},
> ++ {"kern.timecounter.choice", []_C_int{1, 69, 4}},
> ++ {"kern.timecounter.hardware", []_C_int{1, 69, 3}},
> ++ {"kern.timecounter.tick", []_C_int{1, 69, 1}},
> ++ {"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}},
> ++ {"kern.tty.tk_cancc", []_C_int{1, 44, 4}},
> ++ {"kern.tty.tk_nin", []_C_int{1, 44, 1}},
> ++ {"kern.tty.tk_nout", []_C_int{1, 44, 2}},
> ++ {"kern.tty.tk_rawcc", []_C_int{1, 44, 3}},
> ++ {"kern.tty.ttyinfo", []_C_int{1, 44, 5}},
> ++ {"kern.ttycount", []_C_int{1, 57}},
> ++ {"kern.version", []_C_int{1, 4}},
> ++ {"kern.watchdog.auto", []_C_int{1, 64, 2}},
> ++ {"kern.watchdog.period", []_C_int{1, 64, 1}},
> ++ {"kern.witnesswatch", []_C_int{1, 53}},
> ++ {"kern.wxabort", []_C_int{1, 74}},
> ++ {"net.bpf.bufsize", []_C_int{4, 31, 1}},
> ++ {"net.bpf.maxbufsize", []_C_int{4, 31, 2}},
> ++ {"net.inet.ah.enable", []_C_int{4, 2, 51, 1}},
> ++ {"net.inet.ah.stats", []_C_int{4, 2, 51, 2}},
> ++ {"net.inet.carp.allow", []_C_int{4, 2, 112, 1}},
> ++ {"net.inet.carp.log", []_C_int{4, 2, 112, 3}},
> ++ {"net.inet.carp.preempt", []_C_int{4, 2, 112, 2}},
> ++ {"net.inet.carp.stats", []_C_int{4, 2, 112, 4}},
> ++ {"net.inet.divert.recvspace", []_C_int{4, 2, 258, 1}},
> ++ {"net.inet.divert.sendspace", []_C_int{4, 2, 258, 2}},
> ++ {"net.inet.divert.stats", []_C_int{4, 2, 258, 3}},
> ++ {"net.inet.esp.enable", []_C_int{4, 2, 50, 1}},
> ++ {"net.inet.esp.stats", []_C_int{4, 2, 50, 4}},
> ++ {"net.inet.esp.udpencap", []_C_int{4, 2, 50, 2}},
> ++ {"net.inet.esp.udpencap_port", []_C_int{4, 2, 50, 3}},
> ++ {"net.inet.etherip.allow", []_C_int{4, 2, 97, 1}},
> ++ {"net.inet.etherip.stats", []_C_int{4, 2, 97, 2}},
> ++ {"net.inet.gre.allow", []_C_int{4, 2, 47, 1}},
> ++ {"net.inet.gre.wccp", []_C_int{4, 2, 47, 2}},
> ++ {"net.inet.icmp.bmcastecho", []_C_int{4, 2, 1, 2}},
> ++ {"net.inet.icmp.errppslimit", []_C_int{4, 2, 1, 3}},
> ++ {"net.inet.icmp.maskrepl", []_C_int{4, 2, 1, 1}},
> ++ {"net.inet.icmp.rediraccept", []_C_int{4, 2, 1, 4}},
> ++ {"net.inet.icmp.redirtimeout", []_C_int{4, 2, 1, 5}},
> ++ {"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}},
> ++ {"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}},
> ++ {"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}},
> ++ {"net.inet.ip.arpdown", []_C_int{4, 2, 0, 40}},
> ++ {"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}},
> ++ {"net.inet.ip.arptimeout", []_C_int{4, 2, 0, 39}},
> ++ {"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}},
> ++ {"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}},
> ++ {"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}},
> ++ {"net.inet.ip.ifq.drops", []_C_int{4, 2, 0, 30, 3}},
> ++ {"net.inet.ip.ifq.len", []_C_int{4, 2, 0, 30, 1}},
> ++ {"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}},
> ++ {"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}},
> ++ {"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}},
> ++ {"net.inet.ip.mrtmfc", []_C_int{4, 2, 0, 37}},
> ++ {"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}},
> ++ {"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}},
> ++ {"net.inet.ip.mrtvif", []_C_int{4, 2, 0, 38}},
> ++ {"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}},
> ++ {"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}},
> ++ {"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}},
> ++ {"net.inet.ip.multipath", []_C_int{4, 2, 0, 32}},
> ++ {"net.inet.ip.portfirst", []_C_int{4, 2, 0, 7}},
> ++ {"net.inet.ip.porthifirst", []_C_int{4, 2, 0, 9}},
> ++ {"net.inet.ip.porthilast", []_C_int{4, 2, 0, 10}},
> ++ {"net.inet.ip.portlast", []_C_int{4, 2, 0, 8}},
> ++ {"net.inet.ip.redirect", []_C_int{4, 2, 0, 2}},
> ++ {"net.inet.ip.sourceroute", []_C_int{4, 2, 0, 5}},
> ++ {"net.inet.ip.stats", []_C_int{4, 2, 0, 33}},
> ++ {"net.inet.ip.ttl", []_C_int{4, 2, 0, 3}},
> ++ {"net.inet.ipcomp.enable", []_C_int{4, 2, 108, 1}},
> ++ {"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}},
> ++ {"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}},
> ++ {"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}},
> ++ {"net.inet.mobileip.allow", []_C_int{4, 2, 55, 1}},
> ++ {"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}},
> ++ {"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}},
> ++ {"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}},
> ++ {"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}},
> ++ {"net.inet.tcp.drop", []_C_int{4, 2, 6, 19}},
> ++ {"net.inet.tcp.ecn", []_C_int{4, 2, 6, 14}},
> ++ {"net.inet.tcp.ident", []_C_int{4, 2, 6, 9}},
> ++ {"net.inet.tcp.keepidle", []_C_int{4, 2, 6, 3}},
> ++ {"net.inet.tcp.keepinittime", []_C_int{4, 2, 6, 2}},
> ++ {"net.inet.tcp.keepintvl", []_C_int{4, 2, 6, 4}},
> ++ {"net.inet.tcp.mssdflt", []_C_int{4, 2, 6, 11}},
> ++ {"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}},
> ++ {"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}},
> ++ {"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}},
> ++ {"net.inet.tcp.rootonly", []_C_int{4, 2, 6, 24}},
> ++ {"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}},
> ++ {"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}},
> ++ {"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}},
> ++ {"net.inet.tcp.slowhz", []_C_int{4, 2, 6, 5}},
> ++ {"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}},
> ++ {"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}},
> ++ {"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}},
> ++ {"net.inet.tcp.synhashsize", []_C_int{4, 2, 6, 25}},
> ++ {"net.inet.tcp.synuselimit", []_C_int{4, 2, 6, 23}},
> ++ {"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}},
> ++ {"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}},
> ++ {"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}},
> ++ {"net.inet.udp.rootonly", []_C_int{4, 2, 17, 6}},
> ++ {"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}},
> ++ {"net.inet.udp.stats", []_C_int{4, 2, 17, 5}},
> ++ {"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}},
> ++ {"net.inet6.divert.sendspace", []_C_int{4, 24, 86, 2}},
> ++ {"net.inet6.divert.stats", []_C_int{4, 24, 86, 3}},
> ++ {"net.inet6.icmp6.errppslimit", []_C_int{4, 24, 30, 14}},
> ++ {"net.inet6.icmp6.mtudisc_hiwat", []_C_int{4, 24, 30, 16}},
> ++ {"net.inet6.icmp6.mtudisc_lowat", []_C_int{4, 24, 30, 17}},
> ++ {"net.inet6.icmp6.nd6_debug", []_C_int{4, 24, 30, 18}},
> ++ {"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}},
> ++ {"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}},
> ++ {"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}},
> ++ {"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}},
> ++ {"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}},
> ++ {"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}},
> ++ {"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}},
> ++ {"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}},
> ++ {"net.inet6.ip6.defmcasthlim", []_C_int{4, 24, 17, 18}},
> ++ {"net.inet6.ip6.forwarding", []_C_int{4, 24, 17, 1}},
> ++ {"net.inet6.ip6.forwsrcrt", []_C_int{4, 24, 17, 5}},
> ++ {"net.inet6.ip6.hdrnestlimit", []_C_int{4, 24, 17, 15}},
> ++ {"net.inet6.ip6.hlim", []_C_int{4, 24, 17, 3}},
> ++ {"net.inet6.ip6.log_interval", []_C_int{4, 24, 17, 14}},
> ++ {"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}},
> ++ {"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}},
> ++ {"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}},
> ++ {"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}},
> ++ {"net.inet6.ip6.mrtmfc", []_C_int{4, 24, 17, 53}},
> ++ {"net.inet6.ip6.mrtmif", []_C_int{4, 24, 17, 52}},
> ++ {"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}},
> ++ {"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}},
> ++ {"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}},
> ++ {"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}},
> ++ {"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}},
> ++ {"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}},
> ++ {"net.inet6.ip6.soiikey", []_C_int{4, 24, 17, 54}},
> ++ {"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}},
> ++ {"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}},
> ++ {"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}},
> ++ {"net.key.sadb_dump", []_C_int{4, 30, 1}},
> ++ {"net.key.spd_dump", []_C_int{4, 30, 2}},
> ++ {"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}},
> ++ {"net.mpls.ifq.drops", []_C_int{4, 33, 3, 3}},
> ++ {"net.mpls.ifq.len", []_C_int{4, 33, 3, 1}},
> ++ {"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}},
> ++ {"net.mpls.mapttl_ip", []_C_int{4, 33, 5}},
> ++ {"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}},
> ++ {"net.mpls.maxloop_inkernel", []_C_int{4, 33, 4}},
> ++ {"net.mpls.ttl", []_C_int{4, 33, 2}},
> ++ {"net.pflow.stats", []_C_int{4, 34, 1}},
> ++ {"net.pipex.enable", []_C_int{4, 35, 1}},
> ++ {"vm.anonmin", []_C_int{2, 7}},
> ++ {"vm.loadavg", []_C_int{2, 2}},
> ++ {"vm.malloc_conf", []_C_int{2, 12}},
> ++ {"vm.maxslp", []_C_int{2, 10}},
> ++ {"vm.nkmempages", []_C_int{2, 6}},
> ++ {"vm.psstrings", []_C_int{2, 3}},
> ++ {"vm.swapencrypt.enable", []_C_int{2, 5, 0}},
> ++ {"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}},
> ++ {"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}},
> ++ {"vm.uspace", []_C_int{2, 11}},
> ++ {"vm.uvmexp", []_C_int{2, 4}},
> ++ {"vm.vmmeter", []_C_int{2, 1}},
> ++ {"vm.vnodemin", []_C_int{2, 9}},
> ++ {"vm.vtextmin", []_C_int{2, 8}},
> ++}
> Index: patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zsysnum_openbsd_riscv64_go
> ===================================================================
> RCS file: patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zsysnum_openbsd_riscv64_go
> diff -N patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zsysnum_openbsd_riscv64_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_vendor_golang_org_x_sys_unix_zsysnum_openbsd_riscv64_go 18 Sep 2022 07:51:25 -0000
> @@ -0,0 +1,222 @@
> +Index: src/cmd/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go
> +--- src/cmd/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go.orig
> ++++ src/cmd/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go
> +@@ -0,0 +1,218 @@
> ++// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master
> ++// Code generated by the command above; see README.md. DO NOT EDIT.
> ++
> ++//go:build riscv64 && openbsd
> ++// +build riscv64,openbsd
> ++
> ++package unix
> ++
> ++const (
> ++ SYS_EXIT = 1 // { void sys_exit(int rval); }
> ++ SYS_FORK = 2 // { int sys_fork(void); }
> ++ SYS_READ = 3 // { ssize_t sys_read(int fd, void *buf, size_t nbyte); }
> ++ SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, size_t nbyte); }
> ++ SYS_OPEN = 5 // { int sys_open(const char *path, int flags, ... mode_t mode); }
> ++ SYS_CLOSE = 6 // { int sys_close(int fd); }
> ++ SYS_GETENTROPY = 7 // { int sys_getentropy(void *buf, size_t nbyte); }
> ++ SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, size_t psize); }
> ++ SYS_LINK = 9 // { int sys_link(const char *path, const char *link); }
> ++ SYS_UNLINK = 10 // { int sys_unlink(const char *path); }
> ++ SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage); }
> ++ SYS_CHDIR = 12 // { int sys_chdir(const char *path); }
> ++ SYS_FCHDIR = 13 // { int sys_fchdir(int fd); }
> ++ SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, dev_t dev); }
> ++ SYS_CHMOD = 15 // { int sys_chmod(const char *path, mode_t mode); }
> ++ SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, gid_t gid); }
> ++ SYS_OBREAK = 17 // { int sys_obreak(char *nsize); } break
> ++ SYS_GETDTABLECOUNT = 18 // { int sys_getdtablecount(void); }
> ++ SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, struct rusage *rusage); }
> ++ SYS_GETPID = 20 // { pid_t sys_getpid(void); }
> ++ SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, int flags, void *data); }
> ++ SYS_UNMOUNT = 22 // { int sys_unmount(const char *path, int flags); }
> ++ SYS_SETUID = 23 // { int sys_setuid(uid_t uid); }
> ++ SYS_GETUID = 24 // { uid_t sys_getuid(void); }
> ++ SYS_GETEUID = 25 // { uid_t sys_geteuid(void); }
> ++ SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, int data); }
> ++ SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, int flags); }
> ++ SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, const struct msghdr *msg, int flags); }
> ++ SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); }
> ++ SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, socklen_t *anamelen); }
> ++ SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); }
> ++ SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); }
> ++ SYS_ACCESS = 33 // { int sys_access(const char *path, int amode); }
> ++ SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); }
> ++ SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); }
> ++ SYS_SYNC = 36 // { void sys_sync(void); }
> ++ SYS_STAT = 38 // { int sys_stat(const char *path, struct stat *ub); }
> ++ SYS_GETPPID = 39 // { pid_t sys_getppid(void); }
> ++ SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); }
> ++ SYS_DUP = 41 // { int sys_dup(int fd); }
> ++ SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, struct stat *buf, int flag); }
> ++ SYS_GETEGID = 43 // { gid_t sys_getegid(void); }
> ++ SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, u_long offset, u_int scale); }
> ++ SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, int facs, pid_t pid); }
> ++ SYS_SIGACTION = 46 // { int sys_sigaction(int signum, const struct sigaction *nsa, struct sigaction *osa); }
> ++ SYS_GETGID = 47 // { gid_t sys_getgid(void); }
> ++ SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); }
> ++ SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); }
> ++ SYS_ACCT = 51 // { int sys_acct(const char *path); }
> ++ SYS_SIGPENDING = 52 // { int sys_sigpending(void); }
> ++ SYS_FSTAT = 53 // { int sys_fstat(int fd, struct stat *sb); }
> ++ SYS_IOCTL = 54 // { int sys_ioctl(int fd, u_long com, ... void *data); }
> ++ SYS_REBOOT = 55 // { int sys_reboot(int opt); }
> ++ SYS_REVOKE = 56 // { int sys_revoke(const char *path); }
> ++ SYS_SYMLINK = 57 // { int sys_symlink(const char *path, const char *link); }
> ++ SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, char *buf, size_t count); }
> ++ SYS_EXECVE = 59 // { int sys_execve(const char *path, char * const *argp, char * const *envp); }
> ++ SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); }
> ++ SYS_CHROOT = 61 // { int sys_chroot(const char *path); }
> ++ SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, int flags); }
> ++ SYS_STATFS = 63 // { int sys_statfs(const char *path, struct statfs *buf); }
> ++ SYS_FSTATFS = 64 // { int sys_fstatfs(int fd, struct statfs *buf); }
> ++ SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, struct statfs *buf); }
> ++ SYS_VFORK = 66 // { int sys_vfork(void); }
> ++ SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, struct timezone *tzp); }
> ++ SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp); }
> ++ SYS_SETITIMER = 69 // { int sys_setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); }
> ++ SYS_GETITIMER = 70 // { int sys_getitimer(int which, struct itimerval *itv); }
> ++ SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); }
> ++ SYS_KEVENT = 72 // { int sys_kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); }
> ++ SYS_MUNMAP = 73 // { int sys_munmap(void *addr, size_t len); }
> ++ SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, int prot); }
> ++ SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, int behav); }
> ++ SYS_UTIMES = 76 // { int sys_utimes(const char *path, const struct timeval *tptr); }
> ++ SYS_FUTIMES = 77 // { int sys_futimes(int fd, const struct timeval *tptr); }
> ++ SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, gid_t *gidset); }
> ++ SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, const gid_t *gidset); }
> ++ SYS_GETPGRP = 81 // { int sys_getpgrp(void); }
> ++ SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, pid_t pgid); }
> ++ SYS_FUTEX = 83 // { int sys_futex(uint32_t *f, int op, int val, const struct timespec *timeout, uint32_t *g); }
> ++ SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, const struct timespec *times, int flag); }
> ++ SYS_FUTIMENS = 85 // { int sys_futimens(int fd, const struct timespec *times); }
> ++ SYS_KBIND = 86 // { int sys_kbind(const struct __kbind *param, size_t psize, int64_t proc_cookie); }
> ++ SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, struct timespec *tp); }
> ++ SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, const struct timespec *tp); }
> ++ SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, struct timespec *tp); }
> ++ SYS_DUP2 = 90 // { int sys_dup2(int from, int to); }
> ++ SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp); }
> ++ SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); }
> ++ SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, socklen_t *anamelen, int flags); }
> ++ SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, clockid_t clock_id, const struct timespec *tp, void *lock, const int *abort); }
> ++ SYS_FSYNC = 95 // { int sys_fsync(int fd); }
> ++ SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); }
> ++ SYS_SOCKET = 97 // { int sys_socket(int domain, int type, int protocol); }
> ++ SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, socklen_t namelen); }
> ++ SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); }
> ++ SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); }
> ++ SYS_PIPE2 = 101 // { int sys_pipe2(int *fdp, int flags); }
> ++ SYS_DUP3 = 102 // { int sys_dup3(int from, int to, int flags); }
> ++ SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); }
> ++ SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, socklen_t namelen); }
> ++ SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, const void *val, socklen_t valsize); }
> ++ SYS_LISTEN = 106 // { int sys_listen(int s, int backlog); }
> ++ SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, u_int flags, int atflags); }
> ++ SYS_PLEDGE = 108 // { int sys_pledge(const char *promises, const char *execpromises); }
> ++ SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); }
> ++ SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); }
> ++ SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); }
> ++ SYS_SENDSYSLOG = 112 // { int sys_sendsyslog(const char *buf, size_t nbyte, int flags); }
> ++ SYS_UNVEIL = 114 // { int sys_unveil(const char *path, const char *permissions); }
> ++ SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); }
> ++ SYS_THRKILL = 119 // { int sys_thrkill(pid_t tid, int signum, void *tcb); }
> ++ SYS_READV = 120 // { ssize_t sys_readv(int fd, const struct iovec *iovp, int iovcnt); }
> ++ SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, const struct iovec *iovp, int iovcnt); }
> ++ SYS_KILL = 122 // { int sys_kill(int pid, int signum); }
> ++ SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); }
> ++ SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); }
> ++ SYS_SETREUID = 126 // { int sys_setreuid(uid_t ruid, uid_t euid); }
> ++ SYS_SETREGID = 127 // { int sys_setregid(gid_t rgid, gid_t egid); }
> ++ SYS_RENAME = 128 // { int sys_rename(const char *from, const char *to); }
> ++ SYS_FLOCK = 131 // { int sys_flock(int fd, int how); }
> ++ SYS_MKFIFO = 132 // { int sys_mkfifo(const char *path, mode_t mode); }
> ++ SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); }
> ++ SYS_SHUTDOWN = 134 // { int sys_shutdown(int s, int how); }
> ++ SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, int protocol, int *rsv); }
> ++ SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); }
> ++ SYS_RMDIR = 137 // { int sys_rmdir(const char *path); }
> ++ SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, struct timeval *olddelta); }
> ++ SYS_GETLOGIN_R = 141 // { int sys_getlogin_r(char *namebuf, u_int namelen); }
> ++ SYS_SETSID = 147 // { int sys_setsid(void); }
> ++ SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, int uid, char *arg); }
> ++ SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); }
> ++ SYS_GETFH = 161 // { int sys_getfh(const char *fname, fhandle_t *fhp); }
> ++ SYS_SYSARCH = 165 // { int sys_sysarch(int op, void *parms); }
> ++ SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); }
> ++ SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); }
> ++ SYS_SETGID = 181 // { int sys_setgid(gid_t gid); }
> ++ SYS_SETEGID = 182 // { int sys_setegid(gid_t egid); }
> ++ SYS_SETEUID = 183 // { int sys_seteuid(uid_t euid); }
> ++ SYS_PATHCONF = 191 // { long sys_pathconf(const char *path, int name); }
> ++ SYS_FPATHCONF = 192 // { long sys_fpathconf(int fd, int name); }
> ++ SYS_SWAPCTL = 193 // { int sys_swapctl(int cmd, const void *arg, int misc); }
> ++ SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, struct rlimit *rlp); }
> ++ SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, const struct rlimit *rlp); }
> ++ SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); }
> ++ SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, int whence); }
> ++ SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, off_t length); }
> ++ SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); }
> ++ SYS_SYSCTL = 202 // { int sys_sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); }
> ++ SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); }
> ++ SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); }
> ++ SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); }
> ++ SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, size_t len); }
> ++ SYS_SEMGET = 221 // { int sys_semget(key_t key, int nsems, int semflg); }
> ++ SYS_MSGGET = 225 // { int sys_msgget(key_t key, int msgflg); }
> ++ SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); }
> ++ SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); }
> ++ SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, int shmflg); }
> ++ SYS_SHMDT = 230 // { int sys_shmdt(const void *shmaddr); }
> ++ SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, int inherit); }
> ++ SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, u_int nfds, int timeout); }
> ++ SYS_ISSETUGID = 253 // { int sys_issetugid(void); }
> ++ SYS_LCHOWN = 254 // { int sys_lchown(const char *path, uid_t uid, gid_t gid); }
> ++ SYS_GETSID = 255 // { pid_t sys_getsid(pid_t pid); }
> ++ SYS_MSYNC = 256 // { int sys_msync(void *addr, size_t len, int flags); }
> ++ SYS_PIPE = 263 // { int sys_pipe(int *fdp); }
> ++ SYS_FHOPEN = 264 // { int sys_fhopen(const fhandle_t *fhp, int flags); }
> ++ SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); }
> ++ SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); }
> ++ SYS_KQUEUE = 269 // { int sys_kqueue(void); }
> ++ SYS_MLOCKALL = 271 // { int sys_mlockall(int flags); }
> ++ SYS_MUNLOCKALL = 272 // { int sys_munlockall(void); }
> ++ SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); }
> ++ SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); }
> ++ SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); }
> ++ SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); }
> ++ SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); }
> ++ SYS_CLOSEFROM = 287 // { int sys_closefrom(int fd); }
> ++ SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, struct sigaltstack *oss); }
> ++ SYS_SHMGET = 289 // { int sys_shmget(key_t key, size_t size, int shmflg); }
> ++ SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, size_t nsops); }
> ++ SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, struct stat *sb); }
> ++ SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, union semun *arg); }
> ++ SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, struct shmid_ds *buf); }
> ++ SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, struct msqid_ds *buf); }
> ++ SYS_SCHED_YIELD = 298 // { int sys_sched_yield(void); }
> ++ SYS_GETTHRID = 299 // { pid_t sys_getthrid(void); }
> ++ SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, int n); }
> ++ SYS___THREXIT = 302 // { void sys___threxit(pid_t *notdead); }
> ++ SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, siginfo_t *info, const struct timespec *timeout); }
> ++ SYS___GETCWD = 304 // { int sys___getcwd(char *buf, size_t len); }
> ++ SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, int64_t *oldfreq); }
> ++ SYS_SETRTABLE = 310 // { int sys_setrtable(int rtableid); }
> ++ SYS_GETRTABLE = 311 // { int sys_getrtable(void); }
> ++ SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, int amode, int flag); }
> ++ SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, mode_t mode, int flag); }
> ++ SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag); }
> ++ SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, const char *path2, int flag); }
> ++ SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, mode_t mode); }
> ++ SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, mode_t mode); }
> ++ SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, mode_t mode, dev_t dev); }
> ++ SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, ... mode_t mode); }
> ++ SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, char *buf, size_t count); }
> ++ SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, int tofd, const char *to); }
> ++ SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, const char *link); }
> ++ SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, int flag); }
> ++ SYS___SET_TCB = 329 // { void sys___set_tcb(void *tcb); }
> ++ SYS___GET_TCB = 330 // { void *sys___get_tcb(void); }
> ++)
> Index: patches/patch-src_cmd_vendor_golang_org_x_sys_unix_ztypes_openbsd_riscv64_go
> ===================================================================
> RCS file: patches/patch-src_cmd_vendor_golang_org_x_sys_unix_ztypes_openbsd_riscv64_go
> diff -N patches/patch-src_cmd_vendor_golang_org_x_sys_unix_ztypes_openbsd_riscv64_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cmd_vendor_golang_org_x_sys_unix_ztypes_openbsd_riscv64_go 18 Sep 2022 07:51:25 -0000
> @@ -0,0 +1,572 @@
> +Index: src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go
> +--- src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go.orig
> ++++ src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go
> +@@ -0,0 +1,568 @@
> ++// cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go
> ++// Code generated by the command above; see README.md. DO NOT EDIT.
> ++
> ++//go:build riscv64 && openbsd
> ++// +build riscv64,openbsd
> ++
> ++package unix
> ++
> ++const (
> ++ SizeofPtr = 0x8
> ++ SizeofShort = 0x2
> ++ SizeofInt = 0x4
> ++ SizeofLong = 0x8
> ++ SizeofLongLong = 0x8
> ++)
> ++
> ++type (
> ++ _C_short int16
> ++ _C_int int32
> ++ _C_long int64
> ++ _C_long_long int64
> ++)
> ++
> ++type Timespec struct {
> ++ Sec int64
> ++ Nsec int64
> ++}
> ++
> ++type Timeval struct {
> ++ Sec int64
> ++ Usec int64
> ++}
> ++
> ++type Rusage struct {
> ++ Utime Timeval
> ++ Stime Timeval
> ++ Maxrss int64
> ++ Ixrss int64
> ++ Idrss int64
> ++ Isrss int64
> ++ Minflt int64
> ++ Majflt int64
> ++ Nswap int64
> ++ Inblock int64
> ++ Oublock int64
> ++ Msgsnd int64
> ++ Msgrcv int64
> ++ Nsignals int64
> ++ Nvcsw int64
> ++ Nivcsw int64
> ++}
> ++
> ++type Rlimit struct {
> ++ Cur uint64
> ++ Max uint64
> ++}
> ++
> ++type _Gid_t uint32
> ++
> ++type Stat_t struct {
> ++ Mode uint32
> ++ Dev int32
> ++ Ino uint64
> ++ Nlink uint32
> ++ Uid uint32
> ++ Gid uint32
> ++ Rdev int32
> ++ Atim Timespec
> ++ Mtim Timespec
> ++ Ctim Timespec
> ++ Size int64
> ++ Blocks int64
> ++ Blksize int32
> ++ Flags uint32
> ++ Gen uint32
> ++ _ Timespec
> ++}
> ++
> ++type Statfs_t struct {
> ++ F_flags uint32
> ++ F_bsize uint32
> ++ F_iosize uint32
> ++ F_blocks uint64
> ++ F_bfree uint64
> ++ F_bavail int64
> ++ F_files uint64
> ++ F_ffree uint64
> ++ F_favail int64
> ++ F_syncwrites uint64
> ++ F_syncreads uint64
> ++ F_asyncwrites uint64
> ++ F_asyncreads uint64
> ++ F_fsid Fsid
> ++ F_namemax uint32
> ++ F_owner uint32
> ++ F_ctime uint64
> ++ F_fstypename [16]byte
> ++ F_mntonname [90]byte
> ++ F_mntfromname [90]byte
> ++ F_mntfromspec [90]byte
> ++ _ [2]byte
> ++ Mount_info [160]byte
> ++}
> ++
> ++type Flock_t struct {
> ++ Start int64
> ++ Len int64
> ++ Pid int32
> ++ Type int16
> ++ Whence int16
> ++}
> ++
> ++type Dirent struct {
> ++ Fileno uint64
> ++ Off int64
> ++ Reclen uint16
> ++ Type uint8
> ++ Namlen uint8
> ++ _ [4]uint8
> ++ Name [256]int8
> ++}
> ++
> ++type Fsid struct {
> ++ Val [2]int32
> ++}
> ++
> ++const (
> ++ PathMax = 0x400
> ++)
> ++
> ++type RawSockaddrInet4 struct {
> ++ Len uint8
> ++ Family uint8
> ++ Port uint16
> ++ Addr [4]byte /* in_addr */
> ++ Zero [8]int8
> ++}
> ++
> ++type RawSockaddrInet6 struct {
> ++ Len uint8
> ++ Family uint8
> ++ Port uint16
> ++ Flowinfo uint32
> ++ Addr [16]byte /* in6_addr */
> ++ Scope_id uint32
> ++}
> ++
> ++type RawSockaddrUnix struct {
> ++ Len uint8
> ++ Family uint8
> ++ Path [104]int8
> ++}
> ++
> ++type RawSockaddrDatalink struct {
> ++ Len uint8
> ++ Family uint8
> ++ Index uint16
> ++ Type uint8
> ++ Nlen uint8
> ++ Alen uint8
> ++ Slen uint8
> ++ Data [24]int8
> ++}
> ++
> ++type RawSockaddr struct {
> ++ Len uint8
> ++ Family uint8
> ++ Data [14]int8
> ++}
> ++
> ++type RawSockaddrAny struct {
> ++ Addr RawSockaddr
> ++ Pad [92]int8
> ++}
> ++
> ++type _Socklen uint32
> ++
> ++type Linger struct {
> ++ Onoff int32
> ++ Linger int32
> ++}
> ++
> ++type Iovec struct {
> ++ Base *byte
> ++ Len uint64
> ++}
> ++
> ++type IPMreq struct {
> ++ Multiaddr [4]byte /* in_addr */
> ++ Interface [4]byte /* in_addr */
> ++}
> ++
> ++type IPv6Mreq struct {
> ++ Multiaddr [16]byte /* in6_addr */
> ++ Interface uint32
> ++}
> ++
> ++type Msghdr struct {
> ++ Name *byte
> ++ Namelen uint32
> ++ Iov *Iovec
> ++ Iovlen uint32
> ++ Control *byte
> ++ Controllen uint32
> ++ Flags int32
> ++}
> ++
> ++type Cmsghdr struct {
> ++ Len uint32
> ++ Level int32
> ++ Type int32
> ++}
> ++
> ++type Inet6Pktinfo struct {
> ++ Addr [16]byte /* in6_addr */
> ++ Ifindex uint32
> ++}
> ++
> ++type IPv6MTUInfo struct {
> ++ Addr RawSockaddrInet6
> ++ Mtu uint32
> ++}
> ++
> ++type ICMPv6Filter struct {
> ++ Filt [8]uint32
> ++}
> ++
> ++const (
> ++ SizeofSockaddrInet4 = 0x10
> ++ SizeofSockaddrInet6 = 0x1c
> ++ SizeofSockaddrAny = 0x6c
> ++ SizeofSockaddrUnix = 0x6a
> ++ SizeofSockaddrDatalink = 0x20
> ++ SizeofLinger = 0x8
> ++ SizeofIovec = 0x10
> ++ SizeofIPMreq = 0x8
> ++ SizeofIPv6Mreq = 0x14
> ++ SizeofMsghdr = 0x30
> ++ SizeofCmsghdr = 0xc
> ++ SizeofInet6Pktinfo = 0x14
> ++ SizeofIPv6MTUInfo = 0x20
> ++ SizeofICMPv6Filter = 0x20
> ++)
> ++
> ++const (
> ++ PTRACE_TRACEME = 0x0
> ++ PTRACE_CONT = 0x7
> ++ PTRACE_KILL = 0x8
> ++)
> ++
> ++type Kevent_t struct {
> ++ Ident uint64
> ++ Filter int16
> ++ Flags uint16
> ++ Fflags uint32
> ++ Data int64
> ++ Udata *byte
> ++}
> ++
> ++type FdSet struct {
> ++ Bits [32]uint32
> ++}
> ++
> ++const (
> ++ SizeofIfMsghdr = 0xa8
> ++ SizeofIfData = 0x90
> ++ SizeofIfaMsghdr = 0x18
> ++ SizeofIfAnnounceMsghdr = 0x1a
> ++ SizeofRtMsghdr = 0x60
> ++ SizeofRtMetrics = 0x38
> ++)
> ++
> ++type IfMsghdr struct {
> ++ Msglen uint16
> ++ Version uint8
> ++ Type uint8
> ++ Hdrlen uint16
> ++ Index uint16
> ++ Tableid uint16
> ++ Pad1 uint8
> ++ Pad2 uint8
> ++ Addrs int32
> ++ Flags int32
> ++ Xflags int32
> ++ Data IfData
> ++}
> ++
> ++type IfData struct {
> ++ Type uint8
> ++ Addrlen uint8
> ++ Hdrlen uint8
> ++ Link_state uint8
> ++ Mtu uint32
> ++ Metric uint32
> ++ Rdomain uint32
> ++ Baudrate uint64
> ++ Ipackets uint64
> ++ Ierrors uint64
> ++ Opackets uint64
> ++ Oerrors uint64
> ++ Collisions uint64
> ++ Ibytes uint64
> ++ Obytes uint64
> ++ Imcasts uint64
> ++ Omcasts uint64
> ++ Iqdrops uint64
> ++ Oqdrops uint64
> ++ Noproto uint64
> ++ Capabilities uint32
> ++ Lastchange Timeval
> ++}
> ++
> ++type IfaMsghdr struct {
> ++ Msglen uint16
> ++ Version uint8
> ++ Type uint8
> ++ Hdrlen uint16
> ++ Index uint16
> ++ Tableid uint16
> ++ Pad1 uint8
> ++ Pad2 uint8
> ++ Addrs int32
> ++ Flags int32
> ++ Metric int32
> ++}
> ++
> ++type IfAnnounceMsghdr struct {
> ++ Msglen uint16
> ++ Version uint8
> ++ Type uint8
> ++ Hdrlen uint16
> ++ Index uint16
> ++ What uint16
> ++ Name [16]int8
> ++}
> ++
> ++type RtMsghdr struct {
> ++ Msglen uint16
> ++ Version uint8
> ++ Type uint8
> ++ Hdrlen uint16
> ++ Index uint16
> ++ Tableid uint16
> ++ Priority uint8
> ++ Mpls uint8
> ++ Addrs int32
> ++ Flags int32
> ++ Fmask int32
> ++ Pid int32
> ++ Seq int32
> ++ Errno int32
> ++ Inits uint32
> ++ Rmx RtMetrics
> ++}
> ++
> ++type RtMetrics struct {
> ++ Pksent uint64
> ++ Expire int64
> ++ Locks uint32
> ++ Mtu uint32
> ++ Refcnt uint32
> ++ Hopcount uint32
> ++ Recvpipe uint32
> ++ Sendpipe uint32
> ++ Ssthresh uint32
> ++ Rtt uint32
> ++ Rttvar uint32
> ++ Pad uint32
> ++}
> ++
> ++type Mclpool struct{}
> ++
> ++const (
> ++ SizeofBpfVersion = 0x4
> ++ SizeofBpfStat = 0x8
> ++ SizeofBpfProgram = 0x10
> ++ SizeofBpfInsn = 0x8
> ++ SizeofBpfHdr = 0x14
> ++)
> ++
> ++type BpfVersion struct {
> ++ Major uint16
> ++ Minor uint16
> ++}
> ++
> ++type BpfStat struct {
> ++ Recv uint32
> ++ Drop uint32
> ++}
> ++
> ++type BpfProgram struct {
> ++ Len uint32
> ++ Insns *BpfInsn
> ++}
> ++
> ++type BpfInsn struct {
> ++ Code uint16
> ++ Jt uint8
> ++ Jf uint8
> ++ K uint32
> ++}
> ++
> ++type BpfHdr struct {
> ++ Tstamp BpfTimeval
> ++ Caplen uint32
> ++ Datalen uint32
> ++ Hdrlen uint16
> ++ _ [2]byte
> ++}
> ++
> ++type BpfTimeval struct {
> ++ Sec uint32
> ++ Usec uint32
> ++}
> ++
> ++type Termios struct {
> ++ Iflag uint32
> ++ Oflag uint32
> ++ Cflag uint32
> ++ Lflag uint32
> ++ Cc [20]uint8
> ++ Ispeed int32
> ++ Ospeed int32
> ++}
> ++
> ++type Winsize struct {
> ++ Row uint16
> ++ Col uint16
> ++ Xpixel uint16
> ++ Ypixel uint16
> ++}
> ++
> ++const (
> ++ AT_FDCWD = -0x64
> ++ AT_EACCESS = 0x1
> ++ AT_SYMLINK_NOFOLLOW = 0x2
> ++ AT_SYMLINK_FOLLOW = 0x4
> ++ AT_REMOVEDIR = 0x8
> ++)
> ++
> ++type PollFd struct {
> ++ Fd int32
> ++ Events int16
> ++ Revents int16
> ++}
> ++
> ++const (
> ++ POLLERR = 0x8
> ++ POLLHUP = 0x10
> ++ POLLIN = 0x1
> ++ POLLNVAL = 0x20
> ++ POLLOUT = 0x4
> ++ POLLPRI = 0x2
> ++ POLLRDBAND = 0x80
> ++ POLLRDNORM = 0x40
> ++ POLLWRBAND = 0x100
> ++ POLLWRNORM = 0x4
> ++)
> ++
> ++type Sigset_t uint32
> ++
> ++type Utsname struct {
> ++ Sysname [256]byte
> ++ Nodename [256]byte
> ++ Release [256]byte
> ++ Version [256]byte
> ++ Machine [256]byte
> ++}
> ++
> ++const SizeofUvmexp = 0x158
> ++
> ++type Uvmexp struct {
> ++ Pagesize int32
> ++ Pagemask int32
> ++ Pageshift int32
> ++ Npages int32
> ++ Free int32
> ++ Active int32
> ++ Inactive int32
> ++ Paging int32
> ++ Wired int32
> ++ Zeropages int32
> ++ Reserve_pagedaemon int32
> ++ Reserve_kernel int32
> ++ Unused01 int32
> ++ Vnodepages int32
> ++ Vtextpages int32
> ++ Freemin int32
> ++ Freetarg int32
> ++ Inactarg int32
> ++ Wiredmax int32
> ++ Anonmin int32
> ++ Vtextmin int32
> ++ Vnodemin int32
> ++ Anonminpct int32
> ++ Vtextminpct int32
> ++ Vnodeminpct int32
> ++ Nswapdev int32
> ++ Swpages int32
> ++ Swpginuse int32
> ++ Swpgonly int32
> ++ Nswget int32
> ++ Nanon int32
> ++ Unused05 int32
> ++ Unused06 int32
> ++ Faults int32
> ++ Traps int32
> ++ Intrs int32
> ++ Swtch int32
> ++ Softs int32
> ++ Syscalls int32
> ++ Pageins int32
> ++ Unused07 int32
> ++ Unused08 int32
> ++ Pgswapin int32
> ++ Pgswapout int32
> ++ Forks int32
> ++ Forks_ppwait int32
> ++ Forks_sharevm int32
> ++ Pga_zerohit int32
> ++ Pga_zeromiss int32
> ++ Unused09 int32
> ++ Fltnoram int32
> ++ Fltnoanon int32
> ++ Fltnoamap int32
> ++ Fltpgwait int32
> ++ Fltpgrele int32
> ++ Fltrelck int32
> ++ Fltrelckok int32
> ++ Fltanget int32
> ++ Fltanretry int32
> ++ Fltamcopy int32
> ++ Fltnamap int32
> ++ Fltnomap int32
> ++ Fltlget int32
> ++ Fltget int32
> ++ Flt_anon int32
> ++ Flt_acow int32
> ++ Flt_obj int32
> ++ Flt_prcopy int32
> ++ Flt_przero int32
> ++ Pdwoke int32
> ++ Pdrevs int32
> ++ Pdswout int32
> ++ Pdfreed int32
> ++ Pdscans int32
> ++ Pdanscan int32
> ++ Pdobscan int32
> ++ Pdreact int32
> ++ Pdbusy int32
> ++ Pdpageouts int32
> ++ Pdpending int32
> ++ Pddeact int32
> ++ Unused11 int32
> ++ Unused12 int32
> ++ Unused13 int32
> ++ Fpswtch int32
> ++ Kmapent int32
> ++}
> ++
> ++const SizeofClockinfo = 0x10
> ++
> ++type Clockinfo struct {
> ++ Hz int32
> ++ Tick int32
> ++ Stathz int32
> ++ Profhz int32
> ++}
> Index: patches/patch-src_runtime_asm_mips64x_s
> ===================================================================
> RCS file: /cvs/ports/lang/go/patches/patch-src_runtime_asm_mips64x_s,v
> retrieving revision 1.4
> diff -u -p -r1.4 patch-src_runtime_asm_mips64x_s
> --- patches/patch-src_runtime_asm_mips64x_s 24 Apr 2022 13:16:01 -0000 1.4
> +++ patches/patch-src_runtime_asm_mips64x_s 18 Sep 2022 07:51:25 -0000
> @@ -1,7 +1,7 @@
> Index: src/runtime/asm_mips64x.s
> --- src/runtime/asm_mips64x.s.orig
> +++ src/runtime/asm_mips64x.s
> -@@ -463,9 +463,12 @@ TEXT ·cgocallback(SB),NOSPLIT,$24-24
> +@@ -470,9 +470,12 @@ TEXT ·cgocallback(SB),NOSPLIT,$24-24
> NO_LOCAL_POINTERS
>
> // Load m and g from thread-local storage.
> Index: patches/patch-src_runtime_asm_riscv64_s
> ===================================================================
> RCS file: patches/patch-src_runtime_asm_riscv64_s
> diff -N patches/patch-src_runtime_asm_riscv64_s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_runtime_asm_riscv64_s 18 Sep 2022 07:51:25 -0000
> @@ -0,0 +1,19 @@
> +Index: src/runtime/asm_riscv64.s
> +--- src/runtime/asm_riscv64.s.orig
> ++++ src/runtime/asm_riscv64.s
> +@@ -313,6 +313,15 @@ TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$
> + CALL runtime·abort(SB)
> + RET
> +
> ++// func asmcgocall_no_g(fn, arg unsafe.Pointer)
> ++// Call fn(arg) aligned appropriately for the gcc ABI.
> ++// Called on a system stack, and there may be no g yet (during needm).
> ++TEXT ·asmcgocall_no_g(SB),NOSPLIT,$0-16
> ++ MOV fn+0(FP), X5
> ++ MOV arg+8(FP), X10
> ++ JALR RA, (X5)
> ++ RET
> ++
> + // func asmcgocall(fn, arg unsafe.Pointer) int32
> + // Call fn(arg) on the scheduler stack,
> + // aligned appropriately for the gcc ABI.
> Index: patches/patch-src_runtime_cgo_gcc_openbsd_riscv64_c
> ===================================================================
> RCS file: patches/patch-src_runtime_cgo_gcc_openbsd_riscv64_c
> diff -N patches/patch-src_runtime_cgo_gcc_openbsd_riscv64_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_runtime_cgo_gcc_openbsd_riscv64_c 18 Sep 2022 07:51:25 -0000
> @@ -0,0 +1,71 @@
> +Index: src/runtime/cgo/gcc_openbsd_riscv64.c
> +--- src/runtime/cgo/gcc_openbsd_riscv64.c.orig
> ++++ src/runtime/cgo/gcc_openbsd_riscv64.c
> +@@ -0,0 +1,67 @@
> ++// Copyright 2019 The Go Authors. All rights reserved.
> ++// Use of this source code is governed by a BSD-style
> ++// license that can be found in the LICENSE file.
> ++
> ++#include <sys/types.h>
> ++#include <pthread.h>
> ++#include <signal.h>
> ++#include <string.h>
> ++#include "libcgo.h"
> ++#include "libcgo_unix.h"
> ++
> ++static void* threadentry(void*);
> ++static void (*setg_gcc)(void*);
> ++
> ++void
> ++x_cgo_init(G *g, void (*setg)(void*))
> ++{
> ++ pthread_attr_t attr;
> ++ size_t size;
> ++
> ++ setg_gcc = setg;
> ++ pthread_attr_init(&attr);
> ++ pthread_attr_getstacksize(&attr, &size);
> ++ g->stacklo = (uintptr)&attr - size + 4096;
> ++ pthread_attr_destroy(&attr);
> ++}
> ++
> ++void
> ++_cgo_sys_thread_start(ThreadStart *ts)
> ++{
> ++ pthread_attr_t attr;
> ++ sigset_t ign, oset;
> ++ pthread_t p;
> ++ size_t size;
> ++ int err;
> ++
> ++ sigfillset(&ign);
> ++ pthread_sigmask(SIG_SETMASK, &ign, &oset);
> ++
> ++ pthread_attr_init(&attr);
> ++ pthread_attr_getstacksize(&attr, &size);
> ++
> ++ // Leave stacklo=0 and set stackhi=size; mstart will do the rest.
> ++ ts->g->stackhi = size;
> ++ err = _cgo_try_pthread_create(&p, &attr, threadentry, ts);
> ++
> ++ pthread_sigmask(SIG_SETMASK, &oset, nil);
> ++
> ++ if (err != 0) {
> ++ fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
> ++ abort();
> ++ }
> ++}
> ++
> ++extern void crosscall1(void (*fn)(void), void (*setg_gcc)(void*), void *g);
> ++
> ++static void*
> ++threadentry(void *v)
> ++{
> ++ ThreadStart ts;
> ++
> ++ ts = *(ThreadStart*)v;
> ++ free(v);
> ++
> ++ crosscall1(ts.fn, setg_gcc, (void*)ts.g);
> ++ return nil;
> ++}
> Index: patches/patch-src_runtime_defs_openbsd_riscv64_go
> ===================================================================
> RCS file: patches/patch-src_runtime_defs_openbsd_riscv64_go
> diff -N patches/patch-src_runtime_defs_openbsd_riscv64_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_runtime_defs_openbsd_riscv64_go 18 Sep 2022 07:51:25 -0000
> @@ -0,0 +1,182 @@
> +Index: src/runtime/defs_openbsd_riscv64.go
> +--- src/runtime/defs_openbsd_riscv64.go.orig
> ++++ src/runtime/defs_openbsd_riscv64.go
> +@@ -0,0 +1,178 @@
> ++// Copyright 2022 The Go Authors. All rights reserved.
> ++// Use of this source code is governed by a BSD-style
> ++// license that can be found in the LICENSE file.
> ++
> ++package runtime
> ++
> ++import "unsafe"
> ++
> ++const (
> ++ _EINTR = 0x4
> ++ _EFAULT = 0xe
> ++ _EAGAIN = 0x23
> ++ _ENOSYS = 0x4e
> ++
> ++ _O_NONBLOCK = 0x4
> ++ _O_CLOEXEC = 0x10000
> ++
> ++ _PROT_NONE = 0x0
> ++ _PROT_READ = 0x1
> ++ _PROT_WRITE = 0x2
> ++ _PROT_EXEC = 0x4
> ++
> ++ _MAP_ANON = 0x1000
> ++ _MAP_PRIVATE = 0x2
> ++ _MAP_FIXED = 0x10
> ++ _MAP_STACK = 0x4000
> ++
> ++ _MADV_FREE = 0x6
> ++
> ++ _SA_SIGINFO = 0x40
> ++ _SA_RESTART = 0x2
> ++ _SA_ONSTACK = 0x1
> ++
> ++ _PTHREAD_CREATE_DETACHED = 0x1
> ++
> ++ _F_SETFD = 0x2
> ++ _F_GETFL = 0x3
> ++ _F_SETFL = 0x4
> ++ _FD_CLOEXEC = 0x1
> ++
> ++ _SIGHUP = 0x1
> ++ _SIGINT = 0x2
> ++ _SIGQUIT = 0x3
> ++ _SIGILL = 0x4
> ++ _SIGTRAP = 0x5
> ++ _SIGABRT = 0x6
> ++ _SIGEMT = 0x7
> ++ _SIGFPE = 0x8
> ++ _SIGKILL = 0x9
> ++ _SIGBUS = 0xa
> ++ _SIGSEGV = 0xb
> ++ _SIGSYS = 0xc
> ++ _SIGPIPE = 0xd
> ++ _SIGALRM = 0xe
> ++ _SIGTERM = 0xf
> ++ _SIGURG = 0x10
> ++ _SIGSTOP = 0x11
> ++ _SIGTSTP = 0x12
> ++ _SIGCONT = 0x13
> ++ _SIGCHLD = 0x14
> ++ _SIGTTIN = 0x15
> ++ _SIGTTOU = 0x16
> ++ _SIGIO = 0x17
> ++ _SIGXCPU = 0x18
> ++ _SIGXFSZ = 0x19
> ++ _SIGVTALRM = 0x1a
> ++ _SIGPROF = 0x1b
> ++ _SIGWINCH = 0x1c
> ++ _SIGINFO = 0x1d
> ++ _SIGUSR1 = 0x1e
> ++ _SIGUSR2 = 0x1f
> ++
> ++ _FPE_INTDIV = 0x1
> ++ _FPE_INTOVF = 0x2
> ++ _FPE_FLTDIV = 0x3
> ++ _FPE_FLTOVF = 0x4
> ++ _FPE_FLTUND = 0x5
> ++ _FPE_FLTRES = 0x6
> ++ _FPE_FLTINV = 0x7
> ++ _FPE_FLTSUB = 0x8
> ++
> ++ _BUS_ADRALN = 0x1
> ++ _BUS_ADRERR = 0x2
> ++ _BUS_OBJERR = 0x3
> ++
> ++ _SEGV_MAPERR = 0x1
> ++ _SEGV_ACCERR = 0x2
> ++
> ++ _ITIMER_REAL = 0x0
> ++ _ITIMER_VIRTUAL = 0x1
> ++ _ITIMER_PROF = 0x2
> ++
> ++ _EV_ADD = 0x1
> ++ _EV_DELETE = 0x2
> ++ _EV_CLEAR = 0x20
> ++ _EV_ERROR = 0x4000
> ++ _EV_EOF = 0x8000
> ++ _EVFILT_READ = -0x1
> ++ _EVFILT_WRITE = -0x2
> ++)
> ++
> ++type tforkt struct {
> ++ tf_tcb unsafe.Pointer
> ++ tf_tid *int32
> ++ tf_stack uintptr
> ++}
> ++
> ++type sigcontext struct {
> ++ __sc_unused int32
> ++ sc_mask int32
> ++ sc_ra uintptr
> ++ sc_sp uintptr
> ++ sc_gp uintptr
> ++ sc_tp uintptr
> ++ sc_t [7]uintptr
> ++ sc_s [12]uintptr
> ++ sc_a [8]uintptr
> ++ sc_sepc uintptr
> ++ sc_f [32]uintptr
> ++ sc_fcsr uintptr
> ++ sc_cookie int64
> ++}
> ++
> ++type siginfo struct {
> ++ si_signo int32
> ++ si_code int32
> ++ si_errno int32
> ++ pad_cgo_0 [4]byte
> ++ _data [120]byte
> ++}
> ++
> ++type stackt struct {
> ++ ss_sp uintptr
> ++ ss_size uintptr
> ++ ss_flags int32
> ++ pad_cgo_0 [4]byte
> ++}
> ++
> ++type timespec struct {
> ++ tv_sec int64
> ++ tv_nsec int64
> ++}
> ++
> ++//go:nosplit
> ++func (ts *timespec) setNsec(ns int64) {
> ++ ts.tv_sec = ns / 1e9
> ++ ts.tv_nsec = ns % 1e9
> ++}
> ++
> ++type timeval struct {
> ++ tv_sec int64
> ++ tv_usec int64
> ++}
> ++
> ++func (tv *timeval) set_usec(x int32) {
> ++ tv.tv_usec = int64(x)
> ++}
> ++
> ++type itimerval struct {
> ++ it_interval timeval
> ++ it_value timeval
> ++}
> ++
> ++type keventt struct {
> ++ ident uint64
> ++ filter int16
> ++ flags uint16
> ++ fflags uint32
> ++ data int64
> ++ udata *byte
> ++}
> ++
> ++type pthread uintptr
> ++type pthreadattr uintptr
> ++type pthreadcond uintptr
> ++type pthreadcondattr uintptr
> ++type pthreadmutex uintptr
> ++type pthreadmutexattr uintptr
> Index: patches/patch-src_runtime_rt0_openbsd_riscv64_s
> ===================================================================
> RCS file: patches/patch-src_runtime_rt0_openbsd_riscv64_s
> diff -N patches/patch-src_runtime_rt0_openbsd_riscv64_s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_runtime_rt0_openbsd_riscv64_s 18 Sep 2022 07:51:25 -0000
> @@ -0,0 +1,18 @@
> +Index: src/runtime/rt0_openbsd_riscv64.s
> +--- src/runtime/rt0_openbsd_riscv64.s.orig
> ++++ src/runtime/rt0_openbsd_riscv64.s
> +@@ -0,0 +1,14 @@
> ++// Copyright 2022 The Go Authors. All rights reserved.
> ++// Use of this source code is governed by a BSD-style
> ++// license that can be found in the LICENSE file.
> ++
> ++#include "textflag.h"
> ++
> ++TEXT _rt0_riscv64_openbsd(SB),NOSPLIT|NOFRAME,$0
> ++ MOV 0(X2), A0 // argc
> ++ ADD $8, X2, A1 // argv
> ++ JMP main(SB)
> ++
> ++TEXT main(SB),NOSPLIT|NOFRAME,$0
> ++ MOV $runtime·rt0_go(SB), T0
> ++ JALR ZERO, T0
> Index: patches/patch-src_runtime_signal_openbsd_riscv64_go
> ===================================================================
> RCS file: patches/patch-src_runtime_signal_openbsd_riscv64_go
> diff -N patches/patch-src_runtime_signal_openbsd_riscv64_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_runtime_signal_openbsd_riscv64_go 18 Sep 2022 07:51:26 -0000
> @@ -0,0 +1,76 @@
> +Index: src/runtime/signal_openbsd_riscv64.go
> +--- src/runtime/signal_openbsd_riscv64.go.orig
> ++++ src/runtime/signal_openbsd_riscv64.go
> +@@ -0,0 +1,72 @@
> ++// Copyright 2022 The Go Authors. All rights reserved.
> ++// Use of this source code is governed by a BSD-style
> ++// license that can be found in the LICENSE file.
> ++
> ++package runtime
> ++
> ++import (
> ++ "internal/goarch"
> ++ "unsafe"
> ++)
> ++
> ++type sigctxt struct {
> ++ info *siginfo
> ++ ctxt unsafe.Pointer
> ++}
> ++
> ++//go:nosplit
> ++//go:nowritebarrierrec
> ++func (c *sigctxt) regs() *sigcontext {
> ++ return (*sigcontext)(c.ctxt)
> ++}
> ++
> ++func (c *sigctxt) ra() uint64 { return uint64(c.regs().sc_ra) }
> ++func (c *sigctxt) sp() uint64 { return uint64(c.regs().sc_sp) }
> ++func (c *sigctxt) gp() uint64 { return uint64(c.regs().sc_gp) }
> ++func (c *sigctxt) tp() uint64 { return uint64(c.regs().sc_tp) }
> ++func (c *sigctxt) t0() uint64 { return uint64(c.regs().sc_t[0]) }
> ++func (c *sigctxt) t1() uint64 { return uint64(c.regs().sc_t[1]) }
> ++func (c *sigctxt) t2() uint64 { return uint64(c.regs().sc_t[2]) }
> ++func (c *sigctxt) s0() uint64 { return uint64(c.regs().sc_s[0]) }
> ++func (c *sigctxt) s1() uint64 { return uint64(c.regs().sc_s[1]) }
> ++func (c *sigctxt) a0() uint64 { return uint64(c.regs().sc_a[0]) }
> ++func (c *sigctxt) a1() uint64 { return uint64(c.regs().sc_a[1]) }
> ++func (c *sigctxt) a2() uint64 { return uint64(c.regs().sc_a[2]) }
> ++func (c *sigctxt) a3() uint64 { return uint64(c.regs().sc_a[3]) }
> ++func (c *sigctxt) a4() uint64 { return uint64(c.regs().sc_a[4]) }
> ++func (c *sigctxt) a5() uint64 { return uint64(c.regs().sc_a[5]) }
> ++func (c *sigctxt) a6() uint64 { return uint64(c.regs().sc_a[6]) }
> ++func (c *sigctxt) a7() uint64 { return uint64(c.regs().sc_a[7]) }
> ++func (c *sigctxt) s2() uint64 { return uint64(c.regs().sc_s[2]) }
> ++func (c *sigctxt) s3() uint64 { return uint64(c.regs().sc_s[3]) }
> ++func (c *sigctxt) s4() uint64 { return uint64(c.regs().sc_s[4]) }
> ++func (c *sigctxt) s5() uint64 { return uint64(c.regs().sc_s[5]) }
> ++func (c *sigctxt) s6() uint64 { return uint64(c.regs().sc_s[6]) }
> ++func (c *sigctxt) s7() uint64 { return uint64(c.regs().sc_s[7]) }
> ++func (c *sigctxt) s8() uint64 { return uint64(c.regs().sc_s[8]) }
> ++func (c *sigctxt) s9() uint64 { return uint64(c.regs().sc_s[9]) }
> ++func (c *sigctxt) s10() uint64 { return uint64(c.regs().sc_s[10]) }
> ++func (c *sigctxt) s11() uint64 { return uint64(c.regs().sc_s[11]) }
> ++func (c *sigctxt) t3() uint64 { return uint64(c.regs().sc_t[3]) }
> ++func (c *sigctxt) t4() uint64 { return uint64(c.regs().sc_t[4]) }
> ++func (c *sigctxt) t5() uint64 { return uint64(c.regs().sc_t[5]) }
> ++func (c *sigctxt) t6() uint64 { return uint64(c.regs().sc_t[6]) }
> ++
> ++//go:nosplit
> ++//go:nowritebarrierrec
> ++func (c *sigctxt) pc() uint64 { return uint64(c.regs().sc_sepc) }
> ++
> ++func (c *sigctxt) sigcode() uint64 { return uint64(c.info.si_code) }
> ++func (c *sigctxt) sigaddr() uint64 {
> ++ return *(*uint64)(add(unsafe.Pointer(c.info), 2*goarch.PtrSize))
> ++}
> ++
> ++func (c *sigctxt) set_pc(x uint64) { c.regs().sc_sepc = uintptr(x) }
> ++func (c *sigctxt) set_ra(x uint64) { c.regs().sc_ra = uintptr(x) }
> ++func (c *sigctxt) set_sp(x uint64) { c.regs().sc_sp = uintptr(x) }
> ++func (c *sigctxt) set_gp(x uint64) { c.regs().sc_gp = uintptr(x) }
> ++
> ++func (c *sigctxt) set_sigcode(x uint32) { c.info.si_code = int32(x) }
> ++func (c *sigctxt) set_sigaddr(x uint64) {
> ++ *(*uintptr)(add(unsafe.Pointer(c.info), 2*goarch.PtrSize)) = uintptr(x)
> ++}
> Index: patches/patch-src_runtime_signal_riscv64_go
> ===================================================================
> RCS file: patches/patch-src_runtime_signal_riscv64_go
> diff -N patches/patch-src_runtime_signal_riscv64_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_runtime_signal_riscv64_go 18 Sep 2022 07:51:26 -0000
> @@ -0,0 +1,12 @@
> +Index: src/runtime/signal_riscv64.go
> +--- src/runtime/signal_riscv64.go.orig
> ++++ src/runtime/signal_riscv64.go
> +@@ -2,7 +2,7 @@
> + // Use of this source code is governed by a BSD-style
> + // license that can be found in the LICENSE file.
> +
> +-//go:build linux && riscv64
> ++//go:build linux || openbsd
> +
> + package runtime
> +
> Index: patches/patch-src_runtime_stubs_riscv64_go
> ===================================================================
> RCS file: patches/patch-src_runtime_stubs_riscv64_go
> diff -N patches/patch-src_runtime_stubs_riscv64_go
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_runtime_stubs_riscv64_go 18 Sep 2022 07:51:26 -0000
> @@ -0,0 +1,18 @@
> +Index: src/runtime/stubs_riscv64.go
> +--- src/runtime/stubs_riscv64.go.orig
> ++++ src/runtime/stubs_riscv64.go
> +@@ -4,9 +4,14 @@
> +
> + package runtime
> +
> ++import "unsafe"
> ++
> + // Called from assembly only; declared for go vet.
> + func load_g()
> + func save_g()
> ++
> ++//go:noescape
> ++func asmcgocall_no_g(fn, arg unsafe.Pointer)
> +
> + // Used by reflectcall and the reflect package.
> + //
> Index: patches/patch-src_runtime_sys_openbsd_riscv64_s
> ===================================================================
> RCS file: patches/patch-src_runtime_sys_openbsd_riscv64_s
> diff -N patches/patch-src_runtime_sys_openbsd_riscv64_s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_runtime_sys_openbsd_riscv64_s 18 Sep 2022 07:51:26 -0000
> @@ -0,0 +1,734 @@
> +Index: src/runtime/sys_openbsd_riscv64.s
> +--- src/runtime/sys_openbsd_riscv64.s.orig
> ++++ src/runtime/sys_openbsd_riscv64.s
> +@@ -0,0 +1,730 @@
> ++// Copyright 2020 The Go Authors. All rights reserved.
> ++// Use of this source code is governed by a BSD-style
> ++// license that can be found in the LICENSE file.
> ++//
> ++// System calls and other sys.stuff for mips64, OpenBSD
> ++// System calls are implemented in libc/libpthread, this file
> ++// contains trampolines that convert from Go to C calling convention.
> ++// Some direct system call implementations currently remain.
> ++//
> ++
> ++#include "go_asm.h"
> ++#include "go_tls.h"
> ++#include "textflag.h"
> ++
> ++#define CLOCK_REALTIME $0
> ++#define CLOCK_MONOTONIC $3
> ++
> ++// mstart_stub is the first function executed on a new thread started by pthread_create.
> ++// It just does some low-level setup and then calls mstart.
> ++// Note: called with the C calling convention.
> ++TEXT runtime·mstart_stub(SB),NOSPLIT,$200
> ++ // X10 points to the m.
> ++ // We are already on m's g0 stack.
> ++
> ++ // Save callee-save registers (X8, X9, X18..X27, F8, F9, F18..F27)
> ++ MOV X8, (1*8)(X2)
> ++ MOV X9, (2*8)(X2)
> ++ MOV X18, (3*8)(X2)
> ++ MOV X19, (4*8)(X2)
> ++ MOV X20, (5*8)(X2)
> ++ MOV X21, (6*8)(X2)
> ++ MOV X22, (7*8)(X2)
> ++ MOV X23, (8*8)(X2)
> ++ MOV X24, (9*8)(X2)
> ++ MOV X25, (10*8)(X2)
> ++ MOV X26, (11*8)(X2)
> ++ MOV g, (12*8)(X2)
> ++ MOVF F8, (13*8)(X2)
> ++ MOVF F9, (14*8)(X2)
> ++ MOVF F18, (15*8)(X2)
> ++ MOVF F19, (16*8)(X2)
> ++ MOVF F20, (17*8)(X2)
> ++ MOVF F21, (18*8)(X2)
> ++ MOVF F22, (19*8)(X2)
> ++ MOVF F23, (20*8)(X2)
> ++ MOVF F24, (21*8)(X2)
> ++ MOVF F25, (22*8)(X2)
> ++ MOVF F26, (23*8)(X2)
> ++ MOVF F27, (24*8)(X2)
> ++
> ++ MOV m_g0(X10), g
> ++ CALL runtime·save_g(SB)
> ++
> ++ CALL runtime·mstart(SB)
> ++
> ++ // Restore callee-save registers.
> ++ MOV (1*8)(X2), X8
> ++ MOV (2*8)(X2), X9
> ++ MOV (3*8)(X2), X18
> ++ MOV (4*8)(X2), X19
> ++ MOV (5*8)(X2), X20
> ++ MOV (6*8)(X2), X21
> ++ MOV (7*8)(X2), X22
> ++ MOV (8*8)(X2), X23
> ++ MOV (9*8)(X2), X24
> ++ MOV (10*8)(X2), X25
> ++ MOV (11*8)(X2), X26
> ++ MOV (12*8)(X2), g
> ++ MOVF (13*8)(X2), F8
> ++ MOVF (14*8)(X2), F9
> ++ MOVF (15*8)(X2), F18
> ++ MOVF (16*8)(X2), F19
> ++ MOVF (17*8)(X2), F20
> ++ MOVF (18*8)(X2), F21
> ++ MOVF (19*8)(X2), F22
> ++ MOVF (20*8)(X2), F23
> ++ MOVF (21*8)(X2), F24
> ++ MOVF (22*8)(X2), F25
> ++ MOVF (23*8)(X2), F26
> ++ MOVF (24*8)(X2), F27
> ++
> ++ // Go is all done with this OS thread.
> ++ // Tell pthread everything is ok (we never join with this thread, so
> ++ // the value here doesn't really matter).
> ++ MOV $0, X10
> ++
> ++ RET
> ++
> ++TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
> ++ MOVW sig+8(FP), X10
> ++ MOV info+16(FP), X11
> ++ MOV ctx+24(FP), X12
> ++ MOV fn+0(FP), X5
> ++ JALR X1, X5
> ++ RET
> ++
> ++TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$224
> ++ // Save callee-save registers (X8, X9, X18..X27, F8, F9, F18..F27)
> ++ MOV X8, (4*8)(X2)
> ++ MOV X9, (5*8)(X2)
> ++ MOV X18, (6*8)(X2)
> ++ MOV X19, (7*8)(X2)
> ++ MOV X20, (8*8)(X2)
> ++ MOV X21, (9*8)(X2)
> ++ MOV X22, (10*8)(X2)
> ++ MOV X23, (11*8)(X2)
> ++ MOV X24, (12*8)(X2)
> ++ MOV X25, (13*8)(X2)
> ++ MOV X26, (14*8)(X2)
> ++ MOV g, (15*8)(X2)
> ++ MOVF F8, (16*8)(X2)
> ++ MOVF F9, (17*8)(X2)
> ++ MOVF F18, (18*8)(X2)
> ++ MOVF F19, (19*8)(X2)
> ++ MOVF F20, (20*8)(X2)
> ++ MOVF F21, (21*8)(X2)
> ++ MOVF F22, (22*8)(X2)
> ++ MOVF F23, (23*8)(X2)
> ++ MOVF F24, (24*8)(X2)
> ++ MOVF F25, (25*8)(X2)
> ++ MOVF F26, (26*8)(X2)
> ++ MOVF F27, (27*8)(X2)
> ++
> ++ // this might be called in external code context,
> ++ // where g is not set.
> ++ CALL runtime·load_g(SB)
> ++
> ++ MOVW X10, 8(X2)
> ++ MOV X11, 16(X2)
> ++ MOV X12, 24(X2)
> ++ MOV $runtime·sigtrampgo(SB), X5
> ++ JALR X1, X5
> ++
> ++ // Restore callee-save registers.
> ++ MOV (4*8)(X2), X8
> ++ MOV (5*8)(X2), X9
> ++ MOV (6*8)(X2), X18
> ++ MOV (7*8)(X2), X19
> ++ MOV (8*8)(X2), X20
> ++ MOV (9*8)(X2), X21
> ++ MOV (10*8)(X2), X22
> ++ MOV (11*8)(X2), X23
> ++ MOV (12*8)(X2), X24
> ++ MOV (13*8)(X2), X25
> ++ MOV (14*8)(X2), X26
> ++ MOV (15*8)(X2), g
> ++ MOVF (16*8)(X2), F8
> ++ MOVF (17*8)(X2), F9
> ++ MOVF (18*8)(X2), F18
> ++ MOVF (19*8)(X2), F19
> ++ MOVF (20*8)(X2), F20
> ++ MOVF (21*8)(X2), F21
> ++ MOVF (22*8)(X2), F22
> ++ MOVF (23*8)(X2), F23
> ++ MOVF (24*8)(X2), F24
> ++ MOVF (25*8)(X2), F25
> ++ MOVF (26*8)(X2), F26
> ++ MOVF (27*8)(X2), F27
> ++
> ++ RET
> ++
> ++//
> ++// These trampolines help convert from Go calling convention to C calling convention.
> ++// They should be called with asmcgocall.
> ++// A pointer to the arguments is passed in R0.
> ++// A single int32 result is returned in R0.
> ++// (For more results, make an args/results structure.)
> ++TEXT runtime·pthread_attr_init_trampoline(SB),NOSPLIT,$8
> ++ MOV 0(X10), X10 // arg 1 - attr
> ++ CALL libc_pthread_attr_init(SB)
> ++ RET
> ++
> ++TEXT runtime·pthread_attr_destroy_trampoline(SB),NOSPLIT,$8
> ++ MOV 0(X10), X10 // arg 1 - attr
> ++ CALL libc_pthread_attr_destroy(SB)
> ++ RET
> ++
> ++TEXT runtime·pthread_attr_getstacksize_trampoline(SB),NOSPLIT,$8
> ++ MOV 8(X10), X11 // arg 2 - size
> ++ MOV 0(X10), X10 // arg 1 - attr
> ++ CALL libc_pthread_attr_getstacksize(SB)
> ++ RET
> ++
> ++TEXT runtime·pthread_attr_setdetachstate_trampoline(SB),NOSPLIT,$8
> ++ MOV 8(X10), X11 // arg 2 - state
> ++ MOV 0(X10), X10 // arg 1 - attr
> ++ CALL libc_pthread_attr_setdetachstate(SB)
> ++ RET
> ++
> ++TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$8
> ++ MOV 0(X10), X11 // arg 2 - attr
> ++ MOV 8(X10), X12 // arg 3 - start
> ++ MOV 16(X10), X13 // arg 4 - arg
> ++ ADD $-16, X2
> ++ MOV X2, X10 // arg 1 - &threadid (discard)
> ++ CALL libc_pthread_create(SB)
> ++ ADD $16, X2
> ++ RET
> ++
> ++TEXT runtime·thrkill_trampoline(SB),NOSPLIT,$8
> ++ MOV 8(X10), X11 // arg 2 - signal
> ++ MOV $0, X12 // arg 3 - tcb
> ++ MOVW 0(X10), X10 // arg 1 - tid
> ++ CALL libc_thrkill(SB)
> ++ RET
> ++
> ++TEXT runtime·thrsleep_trampoline(SB),NOSPLIT,$8
> ++ MOVW 8(X10), X11 // arg 2 - clock_id
> ++ MOV 16(X10), X12 // arg 3 - abstime
> ++ MOV 24(X10), X13 // arg 4 - lock
> ++ MOV 32(X10), X14 // arg 5 - abort
> ++ MOV 0(X10), X10 // arg 1 - id
> ++ CALL libc_thrsleep(SB)
> ++ RET
> ++
> ++TEXT runtime·thrwakeup_trampoline(SB),NOSPLIT,$8
> ++ MOVW 8(X10), X11 // arg 2 - count
> ++ MOV 0(X10), X10 // arg 1 - id
> ++ CALL libc_thrwakeup(SB)
> ++ RET
> ++
> ++TEXT runtime·exit_trampoline(SB),NOSPLIT,$8
> ++ MOVW 0(X10), X10 // arg 1 - status
> ++ CALL libc_exit(SB)
> ++ MOV $0, X5 // crash on failure
> ++ MOV X5, (X5)
> ++ RET
> ++
> ++TEXT runtime·getthrid_trampoline(SB),NOSPLIT,$8
> ++ MOV X10, X9 // pointer to args
> ++ CALL libc_getthrid(SB)
> ++ MOVW X10, 0(X9) // return value
> ++ RET
> ++
> ++TEXT runtime·raiseproc_trampoline(SB),NOSPLIT,$8
> ++ MOV X10, X9 // pointer to args
> ++ CALL libc_getpid(SB) // arg 1 - pid (result in X10)
> ++ MOVW 0(X9), X11 // arg 2 - signal
> ++ CALL libc_kill(SB)
> ++ RET
> ++
> ++TEXT runtime·sched_yield_trampoline(SB),NOSPLIT,$8
> ++ CALL libc_sched_yield(SB)
> ++ RET
> ++
> ++TEXT runtime·mmap_trampoline(SB),NOSPLIT,$8
> ++ MOV X10, X9 // pointer to args
> ++ MOV 0(X9), X10 // arg 1 - addr
> ++ MOV 8(X9), X11 // arg 2 - len
> ++ MOVW 16(X9), X12 // arg 3 - prot
> ++ MOVW 20(X9), X13 // arg 4 - flags
> ++ MOVW 24(X9), X14 // arg 5 - fid
> ++ MOVW 28(X9), X15 // arg 6 - offset
> ++ CALL libc_mmap(SB)
> ++ MOV $0, X5
> ++ MOV $-1, X6
> ++ BNE X6, X10, noerr
> ++ CALL libc_errno(SB)
> ++ MOVW (X10), X5 // errno
> ++ MOV $0, X10
> ++noerr:
> ++ MOV X10, 32(X9)
> ++ MOV X5, 40(X9)
> ++ RET
> ++
> ++TEXT runtime·munmap_trampoline(SB),NOSPLIT,$8
> ++ MOV 8(X10), X11 // arg 2 - len
> ++ MOV 0(X10), X10 // arg 1 - addr
> ++ CALL libc_munmap(SB)
> ++ MOV $-1, X5
> ++ BNE X5, X10, 3(PC)
> ++ MOV $0, X5 // crash on failure
> ++ MOV X5, (X5)
> ++ RET
> ++
> ++TEXT runtime·madvise_trampoline(SB),NOSPLIT,$8
> ++ MOV 8(X10), X11 // arg 2 - len
> ++ MOVW 16(X10), X12 // arg 3 - advice
> ++ MOV 0(X10), X10 // arg 1 - addr
> ++ CALL libc_madvise(SB)
> ++ // ignore failure - maybe pages are locked
> ++ RET
> ++
> ++TEXT runtime·open_trampoline(SB),NOSPLIT,$8
> ++ MOVW 8(X10), X11 // arg 2 - flags
> ++ MOVW 12(X10), X12 // arg 3 - mode
> ++ MOV 0(X10), X10 // arg 1 - path
> ++ MOV $0, X13 // varargs
> ++ CALL libc_open(SB)
> ++ RET
> ++
> ++TEXT runtime·close_trampoline(SB),NOSPLIT,$8
> ++ MOVW 0(X10), X10 // arg 1 - fd
> ++ CALL libc_close(SB)
> ++ RET
> ++
> ++TEXT runtime·read_trampoline(SB),NOSPLIT,$8
> ++ MOV 8(X10), X11 // arg 2 - buf
> ++ MOVW 16(X10), X12 // arg 3 - count
> ++ MOVW 0(X10), X10 // arg 1 - fd (int32 from read)
> ++ CALL libc_read(SB)
> ++ MOV $-1, X5
> ++ BNE X5, X10, noerr
> ++ CALL libc_errno(SB)
> ++ MOVW (X10), X10 // errno
> ++ NEG X10 // caller expects negative errno
> ++noerr:
> ++ RET
> ++
> ++TEXT runtime·write_trampoline(SB),NOSPLIT,$8
> ++ MOV 8(X10), X11 // arg 2 - buf
> ++ MOVW 16(X10), X12 // arg 3 - count
> ++ MOV 0(X10), X10 // arg 1 - fd (uintptr from write1)
> ++ CALL libc_write(SB)
> ++ MOV $-1, X5
> ++ BNE X5, X10, noerr
> ++ CALL libc_errno(SB)
> ++ MOVW (X10), X10 // errno
> ++ NEG X10 // caller expects negative errno
> ++noerr:
> ++ RET
> ++
> ++TEXT runtime·pipe2_trampoline(SB),NOSPLIT,$8
> ++ MOVW 8(X10), X11 // arg 2 - flags
> ++ MOV 0(X10), X10 // arg 1 - filedes
> ++ CALL libc_pipe2(SB)
> ++ MOV $-1, X5
> ++ BNE X5, X10, noerr
> ++ CALL libc_errno(SB)
> ++ MOVW (X10), X10 // errno
> ++ NEG X10 // caller expects negative errno
> ++noerr:
> ++ RET
> ++
> ++TEXT runtime·setitimer_trampoline(SB),NOSPLIT,$8
> ++ MOV 8(X10), X11 // arg 2 - new
> ++ MOV 16(X10), X12 // arg 3 - old
> ++ MOVW 0(X10), X10 // arg 1 - which
> ++ CALL libc_setitimer(SB)
> ++ RET
> ++
> ++TEXT runtime·usleep_trampoline(SB),NOSPLIT,$8
> ++ MOVW 0(X10), X10 // arg 1 - usec
> ++ CALL libc_usleep(SB)
> ++ RET
> ++
> ++TEXT runtime·sysctl_trampoline(SB),NOSPLIT,$8
> ++ MOVW 8(X10), X11 // arg 2 - miblen
> ++ MOV 16(X10), X12 // arg 3 - out
> ++ MOV 24(X10), X13 // arg 4 - size
> ++ MOV 32(X10), X14 // arg 5 - dst
> ++ MOV 40(X10), X15 // arg 6 - ndst
> ++ MOV 0(X10), X10 // arg 1 - mib
> ++ CALL libc_sysctl(SB)
> ++ RET
> ++
> ++TEXT runtime·kqueue_trampoline(SB),NOSPLIT,$8
> ++ CALL libc_kqueue(SB)
> ++ RET
> ++
> ++TEXT runtime·kevent_trampoline(SB),NOSPLIT,$8
> ++ MOV 8(X10), X11 // arg 2 - keventt
> ++ MOVW 16(X10), X12 // arg 3 - nch
> ++ MOV 24(X10), X13 // arg 4 - ev
> ++ MOVW 32(X10), X14 // arg 5 - nev
> ++ MOV 40(X10), X15 // arg 6 - ts
> ++ MOVW 0(X10), X10 // arg 1 - kq
> ++ CALL libc_kevent(SB)
> ++ MOV $-1, X5
> ++ BNE X5, X10, noerr
> ++ CALL libc_errno(SB)
> ++ MOVW (X10), X10 // errno
> ++ NEG X10 // caller expects negative errno
> ++noerr:
> ++ RET
> ++
> ++TEXT runtime·clock_gettime_trampoline(SB),NOSPLIT,$8
> ++ MOV 8(X10), X11 // arg 2 - tp
> ++ MOVW 0(X10), X10 // arg 1 - clock_id
> ++ CALL libc_clock_gettime(SB)
> ++ MOV $-1, X5
> ++ BNE X5, X10, 3(PC)
> ++ MOV $0, X5 // crash on failure
> ++ MOV X5, (X5)
> ++ RET
> ++
> ++TEXT runtime·fcntl_trampoline(SB),NOSPLIT,$8
> ++ MOVW 4(X10), X11 // arg 2 - cmd
> ++ MOVW 8(X10), X12 // arg 3 - arg
> ++ MOVW 0(X10), X10 // arg 1 - fd
> ++ MOV $0, X13 // vararg
> ++ CALL libc_fcntl(SB)
> ++ RET
> ++
> ++TEXT runtime·sigaction_trampoline(SB),NOSPLIT,$8
> ++ MOV 8(X10), X11 // arg 2 - new
> ++ MOV 16(X10), X12 // arg 3 - old
> ++ MOVW 0(X10), X10 // arg 1 - sig
> ++ CALL libc_sigaction(SB)
> ++ MOV $-1, X5
> ++ BNE X5, X10, 3(PC)
> ++ MOV $0, X5 // crash on failure
> ++ MOV X5, (X5)
> ++ RET
> ++
> ++TEXT runtime·sigprocmask_trampoline(SB),NOSPLIT,$8
> ++ MOV 8(X10), X11 // arg 2 - new
> ++ MOV 16(X10), X12 // arg 3 - old
> ++ MOVW 0(X10), X10 // arg 1 - how
> ++ CALL libc_pthread_sigmask(SB)
> ++ MOV $-1, X5
> ++ BNE X5, X10, 3(PC)
> ++ MOV $0, X5 // crash on failure
> ++ MOV X5, (X5)
> ++ RET
> ++
> ++TEXT runtime·sigaltstack_trampoline(SB),NOSPLIT,$8
> ++ MOV 8(X10), X11 // arg 2 - old
> ++ MOV 0(X10), X10 // arg 1 - new
> ++ CALL libc_sigaltstack(SB)
> ++ MOV $-1, X5
> ++ BNE X5, X10, 3(PC)
> ++ MOV $0, X5 // crash on failure
> ++ MOV X5, (X5)
> ++ RET
> ++
> ++// syscall calls a function in libc on behalf of the syscall package.
> ++// syscall takes a pointer to a struct like:
> ++// struct {
> ++// fn uintptr
> ++// a1 uintptr
> ++// a2 uintptr
> ++// a3 uintptr
> ++// r1 uintptr
> ++// r2 uintptr
> ++// err uintptr
> ++// }
> ++// syscall must be called on the g0 stack with the
> ++// C calling convention (use libcCall).
> ++//
> ++// syscall expects a 32-bit result and tests for 32-bit -1
> ++// to decide there was an error.
> ++TEXT runtime·syscall(SB),NOSPLIT,$8
> ++ MOV X10, X9 // pointer to args
> ++
> ++ MOV (0*8)(X9), X5 // fn
> ++ MOV (1*8)(X9), X10 // a1
> ++ MOV (2*8)(X9), X11 // a2
> ++ MOV (3*8)(X9), X12 // a3
> ++ MOV $0, X13 // vararg
> ++
> ++ JALR X1, X5
> ++
> ++ MOV X10, (4*8)(X9) // r1
> ++ MOV X11, (5*8)(X9) // r2
> ++
> ++ // Standard libc functions return -1 on error
> ++ // and set errno.
> ++ MOV $-1, X5
> ++ BNE X5, X10, ok
> ++
> ++ // Get error code from libc.
> ++ CALL libc_errno(SB)
> ++ MOVW (X10), X10
> ++ MOV X10, (6*8)(X9) // err
> ++
> ++ok:
> ++ RET
> ++
> ++// syscallX calls a function in libc on behalf of the syscall package.
> ++// syscallX takes a pointer to a struct like:
> ++// struct {
> ++// fn uintptr
> ++// a1 uintptr
> ++// a2 uintptr
> ++// a3 uintptr
> ++// r1 uintptr
> ++// r2 uintptr
> ++// err uintptr
> ++// }
> ++// syscallX must be called on the g0 stack with the
> ++// C calling convention (use libcCall).
> ++//
> ++// syscallX is like syscall but expects a 64-bit result
> ++// and tests for 64-bit -1 to decide there was an error.
> ++TEXT runtime·syscallX(SB),NOSPLIT,$8
> ++ MOV X10, X9 // pointer to args
> ++
> ++ MOV (0*8)(X9), X5 // fn
> ++ MOV (1*8)(X9), X10 // a1
> ++ MOV (2*8)(X9), X11 // a2
> ++ MOV (3*8)(X9), X12 // a3
> ++ MOV $0, X13 // vararg
> ++
> ++ JALR X1, X5
> ++
> ++ MOV X10, (4*8)(X9) // r1
> ++ MOV X11, (5*8)(X9) // r2
> ++
> ++ // Standard libc functions return -1 on error
> ++ // and set errno.
> ++ MOV $-1, X5
> ++ BNE X5, X10, ok
> ++
> ++ // Get error code from libc.
> ++ CALL libc_errno(SB)
> ++ MOVW (X10), X10
> ++ MOV X10, (6*8)(X9) // err
> ++
> ++ok:
> ++ RET
> ++
> ++// syscall6 calls a function in libc on behalf of the syscall package.
> ++// syscall6 takes a pointer to a struct like:
> ++// struct {
> ++// fn uintptr
> ++// a1 uintptr
> ++// a2 uintptr
> ++// a3 uintptr
> ++// a4 uintptr
> ++// a5 uintptr
> ++// a6 uintptr
> ++// r1 uintptr
> ++// r2 uintptr
> ++// err uintptr
> ++// }
> ++// syscall6 must be called on the g0 stack with the
> ++// C calling convention (use libcCall).
> ++//
> ++// syscall6 expects a 32-bit result and tests for 32-bit -1
> ++// to decide there was an error.
> ++TEXT runtime·syscall6(SB),NOSPLIT,$8
> ++ MOV X10, X9 // pointer to args
> ++
> ++ MOV (0*8)(X9), X5 // fn
> ++ MOV (1*8)(X9), X10 // a1
> ++ MOV (2*8)(X9), X11 // a2
> ++ MOV (3*8)(X9), X12 // a3
> ++ MOV (4*8)(X9), X13 // a4
> ++ MOV (5*8)(X9), X14 // a5
> ++ MOV (6*8)(X9), X15 // a6
> ++ MOV $0, X16 // vararg
> ++
> ++ JALR X1, X5
> ++
> ++ MOV X10, (7*8)(X9) // r1
> ++ MOV X11, (8*8)(X9) // r2
> ++
> ++ // Standard libc functions return -1 on error
> ++ // and set errno.
> ++ MOV $-1, X5
> ++ BNE X5, X10, ok
> ++
> ++ // Get error code from libc.
> ++ CALL libc_errno(SB)
> ++ MOVW (X10), X10
> ++ MOV X10, (9*8)(X9) // err
> ++
> ++ok:
> ++ RET
> ++
> ++// syscall6X calls a function in libc on behalf of the syscall package.
> ++// syscall6X takes a pointer to a struct like:
> ++// struct {
> ++// fn uintptr
> ++// a1 uintptr
> ++// a2 uintptr
> ++// a3 uintptr
> ++// a4 uintptr
> ++// a5 uintptr
> ++// a6 uintptr
> ++// r1 uintptr
> ++// r2 uintptr
> ++// err uintptr
> ++// }
> ++// syscall6X must be called on the g0 stack with the
> ++// C calling convention (use libcCall).
> ++//
> ++// syscall6X is like syscall6 but expects a 64-bit result
> ++// and tests for 64-bit -1 to decide there was an error.
> ++TEXT runtime·syscall6X(SB),NOSPLIT,$8
> ++ MOV X10, X9 // pointer to args
> ++
> ++ MOV (0*8)(X9), X5 // fn
> ++ MOV (1*8)(X9), X10 // a1
> ++ MOV (2*8)(X9), X11 // a2
> ++ MOV (3*8)(X9), X12 // a3
> ++ MOV (4*8)(X9), X13 // a4
> ++ MOV (5*8)(X9), X14 // a5
> ++ MOV (6*8)(X9), X15 // a6
> ++ MOV $0, X16 // vararg
> ++
> ++ JALR X1, X5
> ++
> ++ MOV X10, (7*8)(X9) // r1
> ++ MOV X11, (8*8)(X9) // r2
> ++
> ++ // Standard libc functions return -1 on error
> ++ // and set errno.
> ++ MOV $-1, X5
> ++ BNE X5, X10, ok
> ++
> ++ // Get error code from libc.
> ++ CALL libc_errno(SB)
> ++ MOVW (X10), X10
> ++ MOV X10, (9*8)(X9) // err
> ++
> ++ok:
> ++ RET
> ++
> ++// syscall10 calls a function in libc on behalf of the syscall package.
> ++// syscall10 takes a pointer to a struct like:
> ++// struct {
> ++// fn uintptr
> ++// a1 uintptr
> ++// a2 uintptr
> ++// a3 uintptr
> ++// a4 uintptr
> ++// a5 uintptr
> ++// a6 uintptr
> ++// a7 uintptr
> ++// a8 uintptr
> ++// a9 uintptr
> ++// a10 uintptr
> ++// r1 uintptr
> ++// r2 uintptr
> ++// err uintptr
> ++// }
> ++// syscall10 must be called on the g0 stack with the
> ++// C calling convention (use libcCall).
> ++//
> ++// The openbsd/mips64 kernel only accepts eight syscall arguments, except
> ++// for SYS_syscall, where an additional argument can be passed on the stack.
> ++TEXT runtime·syscall10(SB),NOSPLIT,$8
> ++ MOV X10, X9 // pointer to args
> ++
> ++ ADD $-16, X2
> ++
> ++ MOV (0*8)(X9), X5 // fn
> ++ MOV (1*8)(X9), X10 // a1
> ++ MOV (2*8)(X9), X11 // a2
> ++ MOV (3*8)(X9), X12 // a3
> ++ MOV (4*8)(X9), X13 // a4
> ++ MOV (5*8)(X9), X14 // a5
> ++ MOV (6*8)(X9), X15 // a6
> ++ MOV (7*8)(X9), X16 // a7
> ++ MOV (8*8)(X9), X17 // a8
> ++ MOV (9*8)(X9), X18
> ++ MOV X18, 0(X2) // a9
> ++
> ++ JALR X1, X5
> ++
> ++ MOV X10, (11*8)(X9) // r1
> ++ MOV X11, (12*8)(X9) // r2
> ++
> ++ // Standard libc functions return -1 on error
> ++ // and set errno.
> ++ MOV $-1, X5
> ++ BNE X5, X10, ok
> ++
> ++ // Get error code from libc.
> ++ CALL libc_errno(SB)
> ++ MOVW (X10), X10
> ++ MOV X10, (13*8)(X9) // err
> ++
> ++ok:
> ++ ADD $16, X2
> ++ RET
> ++
> ++// syscall10X calls a function in libc on behalf of the syscall package.
> ++// syscall10X takes a pointer to a struct like:
> ++// struct {
> ++// fn uintptr
> ++// a1 uintptr
> ++// a2 uintptr
> ++// a3 uintptr
> ++// a4 uintptr
> ++// a5 uintptr
> ++// a6 uintptr
> ++// a7 uintptr
> ++// a8 uintptr
> ++// a9 uintptr
> ++// a10 uintptr
> ++// r1 uintptr
> ++// r2 uintptr
> ++// err uintptr
> ++// }
> ++// syscall10X must be called on the g0 stack with the
> ++// C calling convention (use libcCall).
> ++//
> ++// syscall10X is like syscall10 but expects a 64-bit result
> ++// and tests for 64-bit -1 to decide there was an error.
> ++//
> ++// The openbsd/mips64 kernel only accepts eight syscall arguments, except
> ++// for SYS_syscall, where an additional argument can be passed on the stack.
> ++TEXT runtime·syscall10X(SB),NOSPLIT,$8
> ++ MOV X10, X9 // pointer to args
> ++
> ++ ADD $-16, X2
> ++
> ++ MOV (0*8)(X9), X5 // fn
> ++ MOV (1*8)(X9), X10 // a1
> ++ MOV (2*8)(X9), X11 // a2
> ++ MOV (3*8)(X9), X12 // a3
> ++ MOV (4*8)(X9), X13 // a4
> ++ MOV (5*8)(X9), X14 // a5
> ++ MOV (6*8)(X9), X15 // a6
> ++ MOV (7*8)(X9), X16 // a7
> ++ MOV (8*8)(X9), X17 // a8
> ++ MOV (9*8)(X9), X18
> ++ MOV X18, 0(X2) // a9
> ++
> ++ JALR X1, X5
> ++
> ++ MOV X10, (11*8)(X9) // r1
> ++ MOV X11, (12*8)(X9) // r2
> ++
> ++ // Standard libc functions return -1 on error
> ++ // and set errno.
> ++ MOV $-1, X5
> ++ BNE X5, X10, ok
> ++
> ++ // Get error code from libc.
> ++ CALL libc_errno(SB)
> ++ MOVW (X10), X10
> ++ MOV X10, (13*8)(X9) // err
> ++
> ++ok:
> ++ ADD $16, X2
> ++ RET
> Index: patches/patch-src_runtime_tls_riscv64_s
> ===================================================================
> RCS file: patches/patch-src_runtime_tls_riscv64_s
> diff -N patches/patch-src_runtime_tls_riscv64_s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_runtime_tls_riscv64_s 18 Sep 2022 07:51:26 -0000
> @@ -0,0 +1,29 @@
> +Index: src/runtime/tls_riscv64.s
> +--- src/runtime/tls_riscv64.s.orig
> ++++ src/runtime/tls_riscv64.s
> +@@ -11,20 +11,16 @@
> + //
> + // NOTE: mcall() assumes this clobbers only X31 (REG_TMP).
> + TEXT runtime·save_g(SB),NOSPLIT|NOFRAME,$0-0
> ++#ifndef GOOS_openbsd
> + MOVB runtime·iscgo(SB), X31
> +- BEQ X0, X31, nocgo
> +-
> +- MOV runtime·tls_g(SB), X31
> +- ADD TP, X31 // add offset to thread pointer (X4)
> +- MOV g, (X31)
> +-
> ++ BEQZ X31, nocgo
> ++
No comments:
Post a Comment