Closed eh-steve closed 2 years ago
@eh-steve , i already merge code for support Apple silicon, and fix bugs introduced due to separate code segment and data segment.
In your todo list, case 1 and case 2, could you give me a test case? thanks
I think you might have missed a few things in your picking of code. Since data and code mmaps are independent, they aren't guaranteed to be contiguous in memory, there are no guarantees about which one will have the lower address, and so module.end
might have an address before the start, or very far away (arm64 darwin ASLR can give some very big addresses). That's why there was a check for max()
.
This PR was still WIP, as I was investigating a way to potentially Mmap a single contiguous chunk of memory as non-executable data, then syscall.Mprotect
the code segment of the mapping to make it JIT executable (padding/rounding up to a page boundary), then using everything after that page boundary for data. This would at least provide guarantees that PC-relative jumps won't overflow a uint32
, which the current implementation doesn't (since the code and data might be very far apart).
Also this commit is probably a good security feature for other architectures we might want to consider.
For point 2:
TestStackSplit
and TestJitPanicRecoveryStackTrace
in #66 already test for this (it's the same problem).
Finally, as an example of point 1, the type assertion in ./examples/http/http.go
, (inter.(http.Hander)
) would:
panic: interface conversion: http.Handler: missing method ServeHTTP
Upon further debugging, it seems that the call to runtime.assertE2I
has the address in both R1
and R0
pointing to the same type (type.net/http.Handler
), rather than R0
containing type.net/http.Handler
and R1
containing the concrete *_type
of *SimpleHanle
. This doesn't seem to be caused by the caller, as unpacking the eface of inter
before the assertion shows the correct type.
main.(*SimpleHanle).ServeHTTP STEXT size=192 args=0x20 locals=0x28 funcid=0x0 align=0x0
0x0000 00000 (examples/http/http.go:9) TEXT main.(*SimpleHanle).ServeHTTP(SB), ABIInternal, $48-32
0x0000 00000 (examples/http/http.go:9) MOVD 16(g), R16
0x0004 00004 (examples/http/http.go:9) PCDATA $0, $-2
0x0004 00004 (examples/http/http.go:9) CMP R16, RSP
0x0008 00008 (examples/http/http.go:9) BLS 140
0x000c 00012 (examples/http/http.go:9) PCDATA $0, $-1
0x000c 00012 (examples/http/http.go:9) MOVD.W R30, -48(RSP)
0x0010 00016 (examples/http/http.go:9) MOVD R29, -8(RSP)
0x0014 00020 (examples/http/http.go:9) SUB $8, RSP, R29
0x0018 00024 (examples/http/http.go:9) FUNCDATA ZR, gclocals·HsBOfeQRs6ViAUHo3cKJzQ==(SB)
0x0018 00024 (examples/http/http.go:9) FUNCDATA $1, gclocals·J5F+7Qw7O7ve2QcWC7DpeQ==(SB)
0x0018 00024 (examples/http/http.go:9) FUNCDATA $5, main.(*SimpleHanle).ServeHTTP.arginfo1(SB)
0x0018 00024 (examples/http/http.go:9) FUNCDATA $6, main.(*SimpleHanle).ServeHTTP.argliveinfo(SB)
0x0018 00024 (examples/http/http.go:9) PCDATA $3, $1
0x0018 00024 (examples/http/http.go:11) MOVD R1, main.w+8(FP)
0x001c 00028 (examples/http/http.go:11) MOVD R2, main.w+16(FP)
0x0020 00032 (examples/http/http.go:11) PCDATA $3, $2
0x0020 00032 (examples/http/http.go:11) MOVD $type.[15]uint8(SB), R0
0x0028 00040 (examples/http/http.go:11) PCDATA $1, ZR
0x0028 00040 (examples/http/http.go:11) CALL runtime.newobject(SB)
0x002c 00044 (examples/http/http.go:11) MOVD $8027420523743700296, R1
0x003c 00060 (examples/http/http.go:11) MOVD R1, (R0)
0x0040 00064 (examples/http/http.go:11) MOVD $1684107116, R1
0x0048 00072 (examples/http/http.go:11) MOVW R1, 8(R0)
0x004c 00076 (examples/http/http.go:11) MOVD $29285, R1
0x0050 00080 (examples/http/http.go:11) MOVH R1, 12(R0)
0x0054 00084 (examples/http/http.go:11) MOVD $33, R1
0x0058 00088 (examples/http/http.go:11) MOVB R1, 14(R0)
0x005c 00092 (examples/http/http.go:11) MOVD main.w+8(FP), R1
0x0060 00096 (examples/http/http.go:11) MOVD 32(R1), R1
0x0064 00100 (examples/http/http.go:11) MOVD $15, R2
0x0068 00104 (examples/http/http.go:11) MOVD R2, R3
0x006c 00108 (examples/http/http.go:11) MOVD R0, R4
0x0070 00112 (examples/http/http.go:11) MOVD main.w+16(FP), R0
0x0074 00116 (examples/http/http.go:11) MOVD R1, R5
0x0078 00120 (examples/http/http.go:11) MOVD R4, R1
0x007c 00124 (examples/http/http.go:11) PCDATA $1, $1
0x007c 00124 (examples/http/http.go:11) CALL (R5)
0x0080 00128 (examples/http/http.go:12) LDP -8(RSP), (R29, R30)
0x0084 00132 (examples/http/http.go:12) ADD $48, RSP
0x0088 00136 (examples/http/http.go:12) RET (R30)
0x008c 00140 (examples/http/http.go:12) NOP
0x008c 00140 (examples/http/http.go:9) PCDATA $1, $-1
0x008c 00140 (examples/http/http.go:9) PCDATA $0, $-2
0x008c 00140 (examples/http/http.go:9) MOVD R0, 8(RSP)
0x0090 00144 (examples/http/http.go:9) MOVD R1, 16(RSP)
0x0094 00148 (examples/http/http.go:9) MOVD R2, 24(RSP)
0x0098 00152 (examples/http/http.go:9) MOVD R3, 32(RSP)
0x009c 00156 (examples/http/http.go:9) MOVD R30, R3
0x00a0 00160 (examples/http/http.go:9) CALL runtime.morestack_noctxt(SB)
0x00a4 00164 (examples/http/http.go:9) MOVD 8(RSP), R0
0x00a8 00168 (examples/http/http.go:9) MOVD 16(RSP), R1
0x00ac 00172 (examples/http/http.go:9) MOVD 24(RSP), R2
0x00b0 00176 (examples/http/http.go:9) MOVD 32(RSP), R3
0x00b4 00180 (examples/http/http.go:9) PCDATA $0, $-1
0x00b4 00180 (examples/http/http.go:9) JMP 0
0x0000 90 0b 40 f9 ff 63 30 eb 29 04 00 54 fe 0f 1d f8 ..@..c0.)..T....
0x0010 fd 83 1f f8 fd 23 00 d1 e1 23 00 f9 e2 27 00 f9 .....#...#...'..
0x0020 00 00 00 90 00 00 00 91 00 00 00 94 01 a9 8c d2 ................
0x0030 81 8d ad f2 e1 0d c4 f2 e1 ec ed f2 01 00 00 f9 ................
0x0040 81 ed 8d d2 21 8c ac f2 01 08 00 b9 a1 4c 8e d2 ....!........L..
0x0050 01 18 00 79 21 04 80 d2 01 38 00 39 e1 23 40 f9 ...y!....8.9.#@.
0x0060 21 10 40 f9 e2 0f 40 b2 e3 03 02 aa e4 03 00 aa !.@...@.........
0x0070 e0 27 40 f9 e5 03 01 aa e1 03 04 aa a0 00 3f d6 .'@...........?.
0x0080 fd fb 7f a9 ff c3 00 91 c0 03 5f d6 e0 07 00 f9 .........._.....
0x0090 e1 0b 00 f9 e2 0f 00 f9 e3 13 00 f9 e3 03 1e aa ................
0x00a0 00 00 00 94 e0 07 40 f9 e1 0b 40 f9 e2 0f 40 f9 ......@...@...@.
0x00b0 e3 13 40 f9 d3 ff ff 17 00 00 00 00 00 00 00 00 ..@.............
rel 0+0 t=24 type.net/http.ResponseWriter+104
rel 32+8 t=3 type.[15]uint8+0
rel 40+4 t=9 runtime.newobject+0
rel 124+0 t=10 +0
rel 160+4 t=9 runtime.morestack_noctxt+0
main.main.func1 STEXT size=176 args=0x0 locals=0x28 funcid=0x0 align=0x0
0x0000 00000 (examples/http/http.go:20) TEXT main.main.func1(SB), ABIInternal, $48-0
0x0000 00000 (examples/http/http.go:20) MOVD 16(g), R16
0x0004 00004 (examples/http/http.go:20) PCDATA $0, $-2
0x0004 00004 (examples/http/http.go:20) CMP R16, RSP
0x0008 00008 (examples/http/http.go:20) BLS 164
0x000c 00012 (examples/http/http.go:20) PCDATA $0, $-1
0x000c 00012 (examples/http/http.go:20) MOVD.W R30, -48(RSP)
0x0010 00016 (examples/http/http.go:20) MOVD R29, -8(RSP)
0x0014 00020 (examples/http/http.go:20) SUB $8, RSP, R29
0x0018 00024 (examples/http/http.go:20) FUNCDATA ZR, gclocals·J5F+7Qw7O7ve2QcWC7DpeQ==(SB)
0x0018 00024 (examples/http/http.go:20) FUNCDATA $1, gclocals·CnDyI2HjYXFz19SsOj98tw==(SB)
0x0018 00024 (<unknown line number>) NOP
0x0018 00024 (examples/http/http.go:21) MOVD $type.net/http.fileHandler(SB), R0
0x0020 00032 ($GOROOT/src/net/http/fs.go:841) PCDATA $1, ZR
0x0020 00032 ($GOROOT/src/net/http/fs.go:841) CALL runtime.newobject(SB)
0x0024 00036 ($GOROOT/src/net/http/fs.go:841) MOVD R0, main..autotmp_20-8(SP)
0x0028 00040 ($GOROOT/src/net/http/fs.go:841) MOVD $go.itab.net/http.Dir,net/http.FileSystem(SB), R1
0x0030 00048 ($GOROOT/src/net/http/fs.go:841) MOVD R1, (R0)
0x0034 00052 ($GOROOT/src/net/http/fs.go:841) MOVD $main..stmp_0(SB), R1
0x003c 00060 ($GOROOT/src/net/http/fs.go:841) MOVD R1, 8(R0)
0x0040 00064 (<unknown line number>) NOP
0x0040 00064 ($GOROOT/src/net/http/server.go:3254) MOVD $type.net/http.Server(SB), R0
0x0048 00072 ($GOROOT/src/net/http/server.go:3254) PCDATA $1, $1
0x0048 00072 ($GOROOT/src/net/http/server.go:3254) CALL runtime.newobject(SB)
0x004c 00076 ($GOROOT/src/net/http/server.go:3254) MOVD $5, R1
0x0050 00080 ($GOROOT/src/net/http/server.go:3254) MOVD R1, 8(R0)
0x0054 00084 ($GOROOT/src/net/http/server.go:3254) MOVD $go.string.":2300"(SB), R1
0x005c 00092 ($GOROOT/src/net/http/server.go:3254) MOVD R1, (R0)
0x0060 00096 ($GOROOT/src/net/http/server.go:3254) MOVD $go.itab.*net/http.fileHandler,net/http.Handler(SB), R1
0x0068 00104 ($GOROOT/src/net/http/server.go:3254) MOVD R1, 16(R0)
0x006c 00108 ($GOROOT/src/net/http/server.go:3254) PCDATA ZR, $-2
0x006c 00108 ($GOROOT/src/net/http/server.go:3254) MOVWU runtime.writeBarrier(SB), R1
0x0078 00120 ($GOROOT/src/net/http/server.go:3254) CBNZW R1, 148
0x007c 00124 ($GOROOT/src/net/http/server.go:3254) MOVD main..autotmp_20-8(SP), R1
0x0080 00128 ($GOROOT/src/net/http/server.go:3254) MOVD R1, 24(R0)
0x0084 00132 ($GOROOT/src/net/http/server.go:3255) PCDATA ZR, $-1
0x0084 00132 ($GOROOT/src/net/http/server.go:3255) PCDATA $1, ZR
0x0084 00132 ($GOROOT/src/net/http/server.go:3255) CALL net/http.(*Server).ListenAndServe(SB)
0x0088 00136 (examples/http/http.go:21) CBZ R0, 144
0x008c 00140 (examples/http/http.go:21) MOVD 8(R0), R0
0x0090 00144 (examples/http/http.go:21) CALL runtime.gopanic(SB)
0x0094 00148 ($GOROOT/src/net/http/server.go:3254) PCDATA ZR, $-2
0x0094 00148 ($GOROOT/src/net/http/server.go:3254) ADD $24, R0, R2
0x0098 00152 ($GOROOT/src/net/http/server.go:3254) MOVD main..autotmp_20-8(SP), R3
0x009c 00156 ($GOROOT/src/net/http/server.go:3254) CALL runtime.gcWriteBarrier(SB)
0x00a0 00160 ($GOROOT/src/net/http/server.go:3254) JMP 132
0x00a4 00164 ($GOROOT/src/net/http/server.go:3254) NOP
0x00a4 00164 (examples/http/http.go:20) PCDATA $1, $-1
0x00a4 00164 (examples/http/http.go:20) PCDATA $0, $-2
0x00a4 00164 (examples/http/http.go:20) MOVD R30, R3
0x00a8 00168 (examples/http/http.go:20) CALL runtime.morestack_noctxt(SB)
0x00ac 00172 (examples/http/http.go:20) PCDATA $0, $-1
0x00ac 00172 (examples/http/http.go:20) JMP 0
0x0000 90 0b 40 f9 ff 63 30 eb e9 04 00 54 fe 0f 1d f8 ..@..c0....T....
0x0010 fd 83 1f f8 fd 23 00 d1 00 00 00 90 00 00 00 91 .....#..........
0x0020 00 00 00 94 e0 13 00 f9 01 00 00 90 21 00 00 91 ............!...
0x0030 01 00 00 f9 01 00 00 90 21 00 00 91 01 04 00 f9 ........!.......
0x0040 00 00 00 90 00 00 00 91 00 00 00 94 a1 00 80 d2 ................
0x0050 01 04 00 f9 01 00 00 90 21 00 00 91 01 00 00 f9 ........!.......
0x0060 01 00 00 90 21 00 00 91 01 08 00 f9 1b 00 00 90 ....!...........
0x0070 7b 03 00 91 61 03 40 b9 e1 00 00 35 e1 13 40 f9 {...a.@....5..@.
0x0080 01 0c 00 f9 00 00 00 94 40 00 00 b4 00 04 40 f9 ........@.....@.
0x0090 00 00 00 94 02 60 00 91 e3 13 40 f9 00 00 00 94 .....`....@.....
0x00a0 f9 ff ff 17 e3 03 1e aa 00 00 00 94 d5 ff ff 17 ................
rel 0+0 t=23 type.net/http.Dir+0
rel 0+0 t=23 type.*net/http.fileHandler+0
rel 24+8 t=3 type.net/http.fileHandler+0
rel 32+4 t=9 runtime.newobject+0
rel 40+8 t=3 go.itab.net/http.Dir,net/http.FileSystem+0
rel 52+8 t=3 main..stmp_0+0
rel 64+8 t=3 type.net/http.Server+0
rel 72+4 t=9 runtime.newobject+0
rel 84+8 t=3 go.string.":2300"+0
rel 96+8 t=3 go.itab.*net/http.fileHandler,net/http.Handler+0
rel 108+8 t=3 runtime.writeBarrier+0
rel 132+4 t=9 net/http.(*Server).ListenAndServe+0
rel 144+4 t=9 runtime.gopanic+0
rel 156+4 t=9 runtime.gcWriteBarrier+0
rel 168+4 t=9 runtime.morestack_noctxt+0
main.main STEXT size=96 args=0x0 locals=0x18 funcid=0x0 align=0x0
0x0000 00000 (examples/http/http.go:19) TEXT main.main(SB), ABIInternal, $32-0
0x0000 00000 (examples/http/http.go:19) MOVD 16(g), R16
0x0004 00004 (examples/http/http.go:19) PCDATA $0, $-2
0x0004 00004 (examples/http/http.go:19) CMP R16, RSP
0x0008 00008 (examples/http/http.go:19) BLS 72
0x000c 00012 (examples/http/http.go:19) PCDATA $0, $-1
0x000c 00012 (examples/http/http.go:19) MOVD.W R30, -32(RSP)
0x0010 00016 (examples/http/http.go:19) MOVD R29, -8(RSP)
0x0014 00020 (examples/http/http.go:19) SUB $8, RSP, R29
0x0018 00024 (examples/http/http.go:19) FUNCDATA ZR, gclocals·g2BeySu+wFnoycgXfElmcg==(SB)
0x0018 00024 (examples/http/http.go:19) FUNCDATA $1, gclocals·g2BeySu+wFnoycgXfElmcg==(SB)
0x0018 00024 (examples/http/http.go:20) MOVD $main.main.func1·f(SB), R0
0x0020 00032 (examples/http/http.go:20) PCDATA $1, ZR
0x0020 00032 (examples/http/http.go:20) CALL runtime.newproc(SB)
0x0024 00036 (examples/http/http.go:20) PCDATA $0, $-3
0x0024 00036 (examples/http/http.go:25) MOVD go.itab.*main.SimpleHanle,net/http.Handler+8(SB), R0
0x0030 00048 (examples/http/http.go:25) PCDATA $0, $-1
0x0030 00048 (examples/http/http.go:25) MOVD $runtime.zerobase(SB), R1
0x0038 00056 (examples/http/http.go:25) CALL main.listen(SB)
0x003c 00060 (examples/http/http.go:26) LDP -8(RSP), (R29, R30)
0x0040 00064 (examples/http/http.go:26) ADD $32, RSP
0x0044 00068 (examples/http/http.go:26) RET (R30)
0x0048 00072 (examples/http/http.go:26) NOP
0x0048 00072 (examples/http/http.go:19) PCDATA $1, $-1
0x0048 00072 (examples/http/http.go:19) PCDATA $0, $-2
0x0048 00072 (examples/http/http.go:19) MOVD R30, R3
0x004c 00076 (examples/http/http.go:19) CALL runtime.morestack_noctxt(SB)
0x0050 00080 (examples/http/http.go:19) PCDATA $0, $-1
0x0050 00080 (examples/http/http.go:19) JMP 0
0x0000 90 0b 40 f9 ff 63 30 eb 09 02 00 54 fe 0f 1e f8 ..@..c0....T....
0x0010 fd 83 1f f8 fd 23 00 d1 00 00 00 90 00 00 00 91 .....#..........
0x0020 00 00 00 94 1b 00 00 90 7b 03 00 91 60 03 40 f9 ........{...`.@.
0x0030 01 00 00 90 21 00 00 91 00 00 00 94 fd fb 7f a9 ....!...........
0x0040 ff 83 00 91 c0 03 5f d6 e3 03 1e aa 00 00 00 94 ......_.........
0x0050 ec ff ff 17 00 00 00 00 00 00 00 00 00 00 00 00 ................
rel 0+0 t=23 type.*main.SimpleHanle+0
rel 24+8 t=3 main.main.func1·f+0
rel 32+4 t=9 runtime.newproc+0
rel 36+8 t=3 go.itab.*main.SimpleHanle,net/http.Handler+8
rel 48+8 t=3 runtime.zerobase+0
rel 56+4 t=9 main.listen+0
rel 76+4 t=9 runtime.morestack_noctxt+0
main.listen STEXT size=224 args=0x10 locals=0x48 funcid=0x0 align=0x0
0x0000 00000 (examples/http/http.go:28) TEXT main.listen(SB), ABIInternal, $80-16
0x0000 00000 (examples/http/http.go:28) MOVD 16(g), R16
0x0004 00004 (examples/http/http.go:28) PCDATA $0, $-2
0x0004 00004 (examples/http/http.go:28) CMP R16, RSP
0x0008 00008 (examples/http/http.go:28) BLS 196
0x000c 00012 (examples/http/http.go:28) PCDATA $0, $-1
0x000c 00012 (examples/http/http.go:28) MOVD.W R30, -80(RSP)
0x0010 00016 (examples/http/http.go:28) MOVD R29, -8(RSP)
0x0014 00020 (examples/http/http.go:28) SUB $8, RSP, R29
0x0018 00024 (examples/http/http.go:28) MOVD R0, main.inter(FP)
0x001c 00028 (examples/http/http.go:28) FUNCDATA ZR, gclocals·KE3Apbfec44QtuQWTV4HUA==(SB)
0x001c 00028 (examples/http/http.go:28) FUNCDATA $1, gclocals·5nuQxcrE+jGk86EA6ZGt9w==(SB)
0x001c 00028 (examples/http/http.go:28) FUNCDATA $5, main.listen.arginfo1(SB)
0x001c 00028 (examples/http/http.go:28) FUNCDATA $6, main.listen.argliveinfo(SB)
0x001c 00028 (examples/http/http.go:28) PCDATA $3, $1
0x001c 00028 (examples/http/http.go:33) MOVD R1, main.inter+8(FP)
0x0020 00032 (examples/http/http.go:33) PCDATA $3, $2
0x0020 00032 (examples/http/http.go:33) MOVD R0, main..autotmp_17-8(SP)
0x0024 00036 (<unknown line number>) NOP
0x0024 00036 (examples/http/http.go:29) MOVD $type.net/http.ServeMux(SB), R0
0x002c 00044 ($GOROOT/src/net/http/server.go:2306) PCDATA $1, $1
0x002c 00044 ($GOROOT/src/net/http/server.go:2306) CALL runtime.newobject(SB)
0x0030 00048 ($GOROOT/src/net/http/server.go:2306) MOVD R0, main.~R0-16(SP)
0x0034 00052 (examples/http/http.go:33) MOVD main..autotmp_17-8(SP), R1
0x0038 00056 (examples/http/http.go:33) MOVD $type.net/http.Handler(SB), R0
0x0040 00064 (examples/http/http.go:33) PCDATA $1, $2
0x0040 00064 (examples/http/http.go:33) CALL runtime.assertE2I(SB)
0x0044 00068 (examples/http/http.go:33) MOVD $go.string."/"(SB), R1
0x004c 00076 (examples/http/http.go:33) MOVD $1, R2
0x0050 00080 (examples/http/http.go:33) MOVD R0, R3
0x0054 00084 (examples/http/http.go:33) MOVD main.inter+8(FP), R4
0x0058 00088 (examples/http/http.go:33) MOVD main.~R0-16(SP), R0
0x005c 00092 (examples/http/http.go:33) PCDATA $1, $3
0x005c 00092 (examples/http/http.go:33) CALL net/http.(*ServeMux).Handle(SB)
0x0060 00096 (<unknown line number>) NOP
0x0060 00096 ($GOROOT/src/net/http/server.go:3254) MOVD $type.net/http.Server(SB), R0
0x0068 00104 ($GOROOT/src/net/http/server.go:3254) CALL runtime.newobject(SB)
0x006c 00108 ($GOROOT/src/net/http/server.go:3254) MOVD $5, R1
0x0070 00112 ($GOROOT/src/net/http/server.go:3254) MOVD R1, 8(R0)
0x0074 00116 ($GOROOT/src/net/http/server.go:3254) MOVD $go.string.":9091"(SB), R1
0x007c 00124 ($GOROOT/src/net/http/server.go:3254) MOVD R1, (R0)
0x0080 00128 ($GOROOT/src/net/http/server.go:3254) MOVD $go.itab.*net/http.ServeMux,net/http.Handler(SB), R1
0x0088 00136 ($GOROOT/src/net/http/server.go:3254) MOVD R1, 16(R0)
0x008c 00140 ($GOROOT/src/net/http/server.go:3254) PCDATA ZR, $-2
0x008c 00140 ($GOROOT/src/net/http/server.go:3254) MOVWU runtime.writeBarrier(SB), R1
0x0098 00152 ($GOROOT/src/net/http/server.go:3254) CBNZW R1, 180
0x009c 00156 ($GOROOT/src/net/http/server.go:3254) MOVD main.~R0-16(SP), R1
0x00a0 00160 ($GOROOT/src/net/http/server.go:3254) MOVD R1, 24(R0)
0x00a4 00164 ($GOROOT/src/net/http/server.go:3255) PCDATA ZR, $-1
0x00a4 00164 ($GOROOT/src/net/http/server.go:3255) PCDATA $1, $4
0x00a4 00164 ($GOROOT/src/net/http/server.go:3255) CALL net/http.(*Server).ListenAndServe(SB)
0x00a8 00168 (examples/http/http.go:35) CBZ R0, 176
0x00ac 00172 (examples/http/http.go:35) MOVD 8(R0), R0
0x00b0 00176 (examples/http/http.go:35) CALL runtime.gopanic(SB)
0x00b4 00180 ($GOROOT/src/net/http/server.go:3254) PCDATA ZR, $-2
0x00b4 00180 ($GOROOT/src/net/http/server.go:3254) ADD $24, R0, R2
0x00b8 00184 ($GOROOT/src/net/http/server.go:3254) MOVD main.~R0-16(SP), R3
0x00bc 00188 ($GOROOT/src/net/http/server.go:3254) CALL runtime.gcWriteBarrier(SB)
0x00c0 00192 ($GOROOT/src/net/http/server.go:3254) JMP 164
0x00c4 00196 ($GOROOT/src/net/http/server.go:3254) NOP
0x00c4 00196 (examples/http/http.go:28) PCDATA $1, $-1
0x00c4 00196 (examples/http/http.go:28) PCDATA $0, $-2
0x00c4 00196 (examples/http/http.go:28) MOVD R0, 8(RSP)
0x00c8 00200 (examples/http/http.go:28) MOVD R1, 16(RSP)
0x00cc 00204 (examples/http/http.go:28) MOVD R30, R3
0x00d0 00208 (examples/http/http.go:28) CALL runtime.morestack_noctxt(SB)
0x00d4 00212 (examples/http/http.go:28) MOVD 8(RSP), R0
0x00d8 00216 (examples/http/http.go:28) MOVD 16(RSP), R1
0x00dc 00220 (examples/http/http.go:28) PCDATA $0, $-1
0x00dc 00220 (examples/http/http.go:28) JMP 0
0x0000 90 0b 40 f9 ff 63 30 eb e9 05 00 54 fe 0f 1b f8 ..@..c0....T....
0x0010 fd 83 1f f8 fd 23 00 d1 e0 2f 00 f9 e1 33 00 f9 .....#.../...3..
0x0020 e0 23 00 f9 00 00 00 90 00 00 00 91 00 00 00 94 .#..............
0x0030 e0 1f 00 f9 e1 23 40 f9 00 00 00 90 00 00 00 91 .....#@.........
0x0040 00 00 00 94 01 00 00 90 21 00 00 91 e2 03 40 b2 ........!.....@.
0x0050 e3 03 00 aa e4 33 40 f9 e0 1f 40 f9 00 00 00 94 .....3@...@.....
0x0060 00 00 00 90 00 00 00 91 00 00 00 94 a1 00 80 d2 ................
0x0070 01 04 00 f9 01 00 00 90 21 00 00 91 01 00 00 f9 ........!.......
0x0080 01 00 00 90 21 00 00 91 01 08 00 f9 1b 00 00 90 ....!...........
0x0090 7b 03 00 91 61 03 40 b9 e1 00 00 35 e1 1f 40 f9 {...a.@....5..@.
0x00a0 01 0c 00 f9 00 00 00 94 40 00 00 b4 00 04 40 f9 ........@.....@.
0x00b0 00 00 00 94 02 60 00 91 e3 1f 40 f9 00 00 00 94 .....`....@.....
0x00c0 f9 ff ff 17 e0 07 00 f9 e1 0b 00 f9 e3 03 1e aa ................
0x00d0 00 00 00 94 e0 07 40 f9 e1 0b 40 f9 c9 ff ff 17 ......@...@.....
rel 0+0 t=23 type.*net/http.ServeMux+0
rel 36+8 t=3 type.net/http.ServeMux+0
rel 44+4 t=9 runtime.newobject+0
rel 56+8 t=3 type.net/http.Handler+0
rel 64+4 t=9 runtime.assertE2I+0
rel 68+8 t=3 go.string."/"+0
rel 92+4 t=9 net/http.(*ServeMux).Handle+0
rel 96+8 t=3 type.net/http.Server+0
rel 104+4 t=9 runtime.newobject+0
rel 116+8 t=3 go.string.":9091"+0
rel 128+8 t=3 go.itab.*net/http.ServeMux,net/http.Handler+0
rel 140+8 t=3 runtime.writeBarrier+0
rel 164+4 t=9 net/http.(*Server).ListenAndServe+0
rel 176+4 t=9 runtime.gopanic+0
rel 188+4 t=9 runtime.gcWriteBarrier+0
rel 208+4 t=9 runtime.morestack_noctxt+0
go.cuinfo.producer.<unlinkable> SDWARFCUINFO dupok size=0
0x0000 72 65 67 61 62 69 regabi
go.cuinfo.packagename.main SDWARFCUINFO dupok size=0
0x0000 6d 61 69 6e main
go.info.net/http.NewServeMux$abstract SDWARFABSFCN dupok size=25
0x0000 05 6e 65 74 2f 68 74 74 70 2e 4e 65 77 53 65 72 .net/http.NewSer
0x0010 76 65 4d 75 78 00 01 01 00 veMux....
rel 0+0 t=22 type.*net/http.ServeMux+0
go.info.net/http.ListenAndServe$abstract SDWARFABSFCN dupok size=67
0x0000 05 6e 65 74 2f 68 74 74 70 2e 4c 69 73 74 65 6e .net/http.Listen
0x0010 41 6e 64 53 65 72 76 65 00 01 01 13 61 64 64 72 AndServe....addr
0x0020 00 00 00 00 00 00 13 68 61 6e 64 6c 65 72 00 00 .......handler..
0x0030 00 00 00 00 0e 73 65 72 76 65 72 00 b6 19 00 00 .....server.....
0x0040 00 00 00 ...
rel 0+0 t=22 type.*net/http.Server+0
rel 0+0 t=22 type.error+0
rel 0+0 t=22 type.net/http.Handler+0
rel 0+0 t=22 type.string+0
rel 34+4 t=31 go.info.string+0
rel 48+4 t=31 go.info.net/http.Handler+0
rel 62+4 t=31 go.info.*net/http.Server+0
go.info.net/http.FileServer$abstract SDWARFABSFCN dupok size=35
0x0000 05 6e 65 74 2f 68 74 74 70 2e 46 69 6c 65 53 65 .net/http.FileSe
0x0010 72 76 65 72 00 01 01 13 72 6f 6f 74 00 00 00 00 rver....root....
0x0020 00 00 00 ...
rel 0+0 t=22 type.net/http.FileSystem+0
rel 0+0 t=22 type.net/http.Handler+0
rel 30+4 t=31 go.info.net/http.FileSystem+0
main..inittask SNOPTRDATA size=32
0x0000 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................
0x0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
rel 24+8 t=1 net/http..inittask+0
go.string."Hello goloader!" SRODATA dupok size=15
0x0000 48 65 6c 6c 6f 20 67 6f 6c 6f 61 64 65 72 21 Hello goloader!
go.string."." SRODATA dupok size=1
0x0000 2e .
go.itab.net/http.Dir,net/http.FileSystem SRODATA dupok size=32
0x0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0010 4a 0e 2f 49 00 00 00 00 00 00 00 00 00 00 00 00 J./I............
rel 0+8 t=1 type.net/http.FileSystem+0
rel 8+8 t=1 type.net/http.Dir+0
rel 24+8 t=-32767 net/http.(*Dir).Open+0
go.itab.*net/http.fileHandler,net/http.Handler SRODATA dupok size=32
0x0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0010 df 00 a2 d4 00 00 00 00 00 00 00 00 00 00 00 00 ................
rel 0+8 t=1 type.net/http.Handler+0
rel 8+8 t=1 type.*net/http.fileHandler+0
rel 24+8 t=-32767 net/http.(*fileHandler).ServeHTTP+0
go.string.":2300" SRODATA dupok size=5
0x0000 3a 32 33 30 30 :2300
runtime.memequal0·f SRODATA dupok size=8
0x0000 00 00 00 00 00 00 00 00 ........
rel 0+8 t=1 runtime.memequal0+0
runtime.gcbits. SRODATA dupok size=0
type..namedata.*main.SimpleHanle. SRODATA dupok size=19
0x0000 01 11 2a 6d 61 69 6e 2e 53 69 6d 70 6c 65 48 61 ..*main.SimpleHa
0x0010 6e 6c 65 nle
type..importpath.main. SRODATA dupok size=6
0x0000 00 04 6d 61 69 6e ..main
type.main.SimpleHanle SRODATA size=96
0x0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0010 00 1b 57 5c 0f 01 01 19 00 00 00 00 00 00 00 00 ..W\............
0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0050 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 ................
rel 24+8 t=1 runtime.memequal0·f+0
rel 32+8 t=1 runtime.gcbits.+0
rel 40+4 t=5 type..namedata.*main.SimpleHanle.+0
rel 44+4 t=5 type.*main.SimpleHanle+0
rel 56+8 t=1 type.main.SimpleHanle+96
rel 80+4 t=5 type..importpath.main.+0
runtime.memequal64·f SRODATA dupok size=8
0x0000 00 00 00 00 00 00 00 00 ........
rel 0+8 t=1 runtime.memequal64+0
runtime.gcbits.01 SRODATA dupok size=1
0x0000 01 .
type..namedata.*func(*main.SimpleHanle, http.ResponseWriter, *http.Request)- SRODATA dupok size=62
0x0000 00 3c 2a 66 75 6e 63 28 2a 6d 61 69 6e 2e 53 69 .<*func(*main.Si
0x0010 6d 70 6c 65 48 61 6e 6c 65 2c 20 68 74 74 70 2e mpleHanle, http.
0x0020 52 65 73 70 6f 6e 73 65 57 72 69 74 65 72 2c 20 ResponseWriter,
0x0030 2a 68 74 74 70 2e 52 65 71 75 65 73 74 29 *http.Request)
type.*func(*main.SimpleHanle, net/http.ResponseWriter, *net/http.Request) SRODATA dupok size=56
0x0000 08 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 ................
0x0010 d0 7f b1 ce 08 08 08 36 00 00 00 00 00 00 00 00 .......6........
0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0030 00 00 00 00 00 00 00 00 ........
rel 24+8 t=1 runtime.memequal64·f+0
rel 32+8 t=1 runtime.gcbits.01+0
rel 40+4 t=5 type..namedata.*func(*main.SimpleHanle, http.ResponseWriter, *http.Request)-+0
rel 48+8 t=1 type.func(*main.SimpleHanle, net/http.ResponseWriter, *net/http.Request)+0
type.func(*main.SimpleHanle, net/http.ResponseWriter, *net/http.Request) SRODATA dupok size=80
0x0000 08 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 ................
0x0010 30 54 a7 0e 02 08 08 33 00 00 00 00 00 00 00 00 0T.....3........
0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0030 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
rel 32+8 t=1 runtime.gcbits.01+0
rel 40+4 t=5 type..namedata.*func(*main.SimpleHanle, http.ResponseWriter, *http.Request)-+0
rel 44+4 t=-32763 type.*func(*main.SimpleHanle, net/http.ResponseWriter, *net/http.Request)+0
rel 56+8 t=1 type.*main.SimpleHanle+0
rel 64+8 t=1 type.net/http.ResponseWriter+0
rel 72+8 t=1 type.*net/http.Request+0
type..namedata.ServeHTTP. SRODATA dupok size=11
0x0000 01 09 53 65 72 76 65 48 54 54 50 ..ServeHTTP
type..namedata.*func(http.ResponseWriter, *http.Request)- SRODATA dupok size=43
0x0000 00 29 2a 66 75 6e 63 28 68 74 74 70 2e 52 65 73 .)*func(http.Res
0x0010 70 6f 6e 73 65 57 72 69 74 65 72 2c 20 2a 68 74 ponseWriter, *ht
0x0020 74 70 2e 52 65 71 75 65 73 74 29 tp.Request)
type.*func(net/http.ResponseWriter, *net/http.Request) SRODATA dupok size=56
0x0000 08 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 ................
0x0010 1c 67 9a 63 08 08 08 36 00 00 00 00 00 00 00 00 .g.c...6........
0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0030 00 00 00 00 00 00 00 00 ........
rel 24+8 t=1 runtime.memequal64·f+0
rel 32+8 t=1 runtime.gcbits.01+0
rel 40+4 t=5 type..namedata.*func(http.ResponseWriter, *http.Request)-+0
rel 48+8 t=1 type.func(net/http.ResponseWriter, *net/http.Request)+0
type.func(net/http.ResponseWriter, *net/http.Request) SRODATA dupok size=72
0x0000 08 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 ................
0x0010 79 4d d0 84 02 08 08 33 00 00 00 00 00 00 00 00 yM.....3........
0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0030 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0040 00 00 00 00 00 00 00 00 ........
rel 32+8 t=1 runtime.gcbits.01+0
rel 40+4 t=5 type..namedata.*func(http.ResponseWriter, *http.Request)-+0
rel 44+4 t=-32763 type.*func(net/http.ResponseWriter, *net/http.Request)+0
rel 56+8 t=1 type.net/http.ResponseWriter+0
rel 64+8 t=1 type.*net/http.Request+0
type.*main.SimpleHanle SRODATA size=88
0x0000 08 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 ................
0x0010 49 4b ec 43 09 08 08 36 00 00 00 00 00 00 00 00 IK.C...6........
0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0030 00 00 00 00 00 00 00 00 00 00 00 00 01 00 01 00 ................
0x0040 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0050 00 00 00 00 00 00 00 00 ........
rel 24+8 t=1 runtime.memequal64·f+0
rel 32+8 t=1 runtime.gcbits.01+0
rel 40+4 t=5 type..namedata.*main.SimpleHanle.+0
rel 48+8 t=1 type.main.SimpleHanle+0
rel 56+4 t=5 type..importpath.main.+0
rel 72+4 t=5 type..namedata.ServeHTTP.+0
rel 76+4 t=26 type.func(net/http.ResponseWriter, *net/http.Request)+0
rel 80+4 t=26 main.(*SimpleHanle).ServeHTTP+0
rel 84+4 t=26 main.(*SimpleHanle).ServeHTTP+0
go.itab.*main.SimpleHanle,net/http.Handler SRODATA dupok size=32
0x0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0010 49 4b ec 43 00 00 00 00 00 00 00 00 00 00 00 00 IK.C............
rel 0+8 t=1 type.net/http.Handler+0
rel 8+8 t=1 type.*main.SimpleHanle+0
rel 24+8 t=-32767 main.(*SimpleHanle).ServeHTTP+0
go.string."/" SRODATA dupok size=1
0x0000 2f /
go.string.":9091" SRODATA dupok size=5
0x0000 3a 39 30 39 31 :9091
go.itab.*net/http.ServeMux,net/http.Handler SRODATA dupok size=32
0x0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0010 47 81 bd 9c 00 00 00 00 00 00 00 00 00 00 00 00 G...............
rel 0+8 t=1 type.net/http.Handler+0
rel 8+8 t=1 type.*net/http.ServeMux+0
rel 24+8 t=-32767 net/http.(*ServeMux).ServeHTTP+0
main..stmp_0 SRODATA static size=16
0x0000 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................
rel 0+8 t=1 go.string."."+0
type..namedata.*[]uint8- SRODATA dupok size=10
0x0000 00 08 2a 5b 5d 75 69 6e 74 38 ..*[]uint8
type.*[]uint8 SRODATA dupok size=56
0x0000 08 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 ................
0x0010 1f bb cf 43 08 08 08 36 00 00 00 00 00 00 00 00 ...C...6........
0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0030 00 00 00 00 00 00 00 00 ........
rel 24+8 t=1 runtime.memequal64·f+0
rel 32+8 t=1 runtime.gcbits.01+0
rel 40+4 t=5 type..namedata.*[]uint8-+0
rel 48+8 t=1 type.[]uint8+0
type.[]uint8 SRODATA dupok size=56
0x0000 18 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 ................
0x0010 65 40 04 81 02 08 08 17 00 00 00 00 00 00 00 00 e@..............
0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0030 00 00 00 00 00 00 00 00 ........
rel 32+8 t=1 runtime.gcbits.01+0
rel 40+4 t=5 type..namedata.*[]uint8-+0
rel 44+4 t=-32763 type.*[]uint8+0
rel 48+8 t=1 type.uint8+0
type..eqfunc15 SRODATA dupok size=16
0x0000 00 00 00 00 00 00 00 00 0f 00 00 00 00 00 00 00 ................
rel 0+8 t=1 runtime.memequal_varlen+0
type..namedata.*[15]uint8- SRODATA dupok size=12
0x0000 00 0a 2a 5b 31 35 5d 75 69 6e 74 38 ..*[15]uint8
type.*[15]uint8 SRODATA dupok size=56
0x0000 08 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 ................
0x0010 93 5c e8 a0 08 08 08 36 00 00 00 00 00 00 00 00 .\.....6........
0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0030 00 00 00 00 00 00 00 00 ........
rel 24+8 t=1 runtime.memequal64·f+0
rel 32+8 t=1 runtime.gcbits.01+0
rel 40+4 t=5 type..namedata.*[15]uint8-+0
rel 48+8 t=1 type.[15]uint8+0
type.[15]uint8 SRODATA dupok size=72
0x0000 0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0010 79 c8 8f a6 0a 01 01 11 00 00 00 00 00 00 00 00 y...............
0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0040 0f 00 00 00 00 00 00 00 ........
rel 24+8 t=1 type..eqfunc15+0
rel 32+8 t=1 runtime.gcbits.+0
rel 40+4 t=5 type..namedata.*[15]uint8-+0
rel 44+4 t=-32763 type.*[15]uint8+0
rel 48+8 t=1 type.uint8+0
rel 56+8 t=1 type.[]uint8+0
runtime.nilinterequal·f SRODATA dupok size=8
0x0000 00 00 00 00 00 00 00 00 ........
rel 0+8 t=1 runtime.nilinterequal+0
type..namedata.*interface {}- SRODATA dupok size=15
0x0000 00 0d 2a 69 6e 74 65 72 66 61 63 65 20 7b 7d ..*interface {}
type.*interface {} SRODATA dupok size=56
0x0000 08 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 ................
0x0010 3b fc f8 8f 08 08 08 36 00 00 00 00 00 00 00 00 ;......6........
0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0030 00 00 00 00 00 00 00 00 ........
rel 24+8 t=1 runtime.memequal64·f+0
rel 32+8 t=1 runtime.gcbits.01+0
rel 40+4 t=5 type..namedata.*interface {}-+0
rel 48+8 t=1 type.interface {}+0
runtime.gcbits.02 SRODATA dupok size=1
0x0000 02 .
type.interface {} SRODATA dupok size=80
0x0000 10 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 ................
0x0010 39 7a 09 0f 02 08 08 14 00 00 00 00 00 00 00 00 9z..............
0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
rel 24+8 t=1 runtime.nilinterequal·f+0
rel 32+8 t=1 runtime.gcbits.02+0
rel 40+4 t=5 type..namedata.*interface {}-+0
rel 44+4 t=-32763 type.*interface {}+0
rel 56+8 t=1 type.interface {}+80
type..importpath.net/http. SRODATA dupok size=10
0x0000 00 08 6e 65 74 2f 68 74 74 70 ..net/http
main.main.func1·f SRODATA dupok size=8
0x0000 00 00 00 00 00 00 00 00 ........
rel 0+8 t=1 main.main.func1+0
gclocals·HsBOfeQRs6ViAUHo3cKJzQ== SRODATA dupok size=10
0x0000 02 00 00 00 04 00 00 00 04 00 ..........
gclocals·J5F+7Qw7O7ve2QcWC7DpeQ== SRODATA dupok size=8
0x0000 02 00 00 00 00 00 00 00 ........
main.(*SimpleHanle).ServeHTTP.arginfo1 SRODATA static dupok size=11
0x0000 00 08 fe 08 08 10 08 fd 18 08 ff ...........
main.(*SimpleHanle).ServeHTTP.argliveinfo SRODATA static dupok size=3
0x0000 08 00 03 ...
gclocals·CnDyI2HjYXFz19SsOj98tw== SRODATA dupok size=10
0x0000 02 00 00 00 01 00 00 00 00 01 ..........
gclocals·g2BeySu+wFnoycgXfElmcg== SRODATA dupok size=8
0x0000 01 00 00 00 00 00 00 00 ........
gclocals·KE3Apbfec44QtuQWTV4HUA== SRODATA dupok size=13
0x0000 05 00 00 00 02 00 00 00 02 02 02 00 00 .............
gclocals·5nuQxcrE+jGk86EA6ZGt9w== SRODATA dupok size=13
0x0000 05 00 00 00 02 00 00 00 00 02 01 01 00 .............
main.listen.arginfo1 SRODATA static dupok size=7
0x0000 fe 00 08 08 08 fd ff .......
main.listen.argliveinfo SRODATA static dupok size=3
0x0000 00 00 02 ...
@eh-steve , I know the system maybe gives a lower address for dataByte. so change module.types and module.etypes in data segment, they are set with codeStart and codeStart+offset before commit https://github.com/pkujhd/goloader/commit/58633ce2516bba6ef0ca487c0a6182bb8832a746.
now set module.end = module.enoptrbss, I read the golang source code, module.end only use to compare with module.types and module.data. I guess module.end only related data segment, because module struct hasn't start field
when relocate R_METHODOFF, before commit https://github.com/pkujhd/goloader/commit/58633ce2516bba6ef0ca487c0a6182bb8832a746. it is relocated offset with codeStart. now only reloc.sym.Kind == STEXT, relocate offset with codeStart, other relocate offset with dataStart. It fix the error "panic: interface conversion: http.Handler: missing method ServeHTTP".
when relocate R_METHODOFF, before commit https://github.com/pkujhd/goloader/commit/58633ce2516bba6ef0ca487c0a6182bb8832a746. it is relocated offset with codeStart. now only reloc.sym.Kind == STEXT, relocated offset with codeStart, other relocated offset with dataStart.
Ah good catch! Can confirm it's fixed and working now, thanks!
If runtime
only uses module.end
for checking types and data, then we should be good. My concern was originally around runtime.stkobjinit()
which uses it, but I now see that gofunc points at module.noptrdata
so it's good 👍🏼
[WIP] Split code and data and mmap separately to support Apple M1 arm64's execution protection. As per https://developer.apple.com/documentation/apple-silicon/porting-just-in-time-compilers-to-apple-silicon?language=objc
TODO:
runtime.assertE2I
be called with the same type in both registers