Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: crosscompiled to AIX/ppc64 not working in IBMi PASE (AIX7.2) due to "not in usable address space" #45017

Open
rfx77 opened this issue Mar 15, 2021 · 85 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@rfx77
Copy link

rfx77 commented Mar 15, 2021

I want to crosscompile a simple Hello-World example to IBM-i PASE environment. This is a AIX 7.2 subsystem on the IBMi (AS400). Normally AIX compiled code should work in this environment.

But when i want to run the test application i get the following error:

runtime: memory allocated by OS [0x700000028000000, 0x70000002c000000) not in usable address space: base outside usable address space
fatal error: memory reservation exceeds address space limit

runtime stack:
runtime.throw(0x1000d9f06, 0x2e)
        /usr/lib/go-1.14/src/runtime/panic.go:1116 +0x68 fp=0xffffffffffff590 sp=0xffffffffffff550 pc=0x100032e08
runtime.(*mheap).sysAlloc(0x180037440, 0x400000, 0x100062a18, 0x9001000a01a1450)
        /usr/lib/go-1.14/src/runtime/malloc.go:706 +0x838 fp=0xffffffffffff660 sp=0xffffffffffff590 pc=0x10000a9a8
runtime.(*mheap).grow(0x180037440, 0x1, 0x0)
        /usr/lib/go-1.14/src/runtime/mheap.go:1286 +0x18c fp=0xffffffffffff6f0 sp=0xffffffffffff660 pc=0x10002586c
runtime.(*mheap).allocSpan(0x180037440, 0x1, 0x2a000100062a18, 0x18004d8e8, 0x900000000332200)
        /usr/lib/go-1.14/src/runtime/mheap.go:1124 +0x748 fp=0xffffffffffff780 sp=0xffffffffffff6f0 pc=0x100025578
runtime.(*mheap).alloc.func1()
        /usr/lib/go-1.14/src/runtime/mheap.go:871 +0x7c fp=0xffffffffffff7e8 sp=0xffffffffffff780 pc=0x10005e26c
runtime.systemstack(0xffffffffffff840)
        /usr/lib/go-1.14/src/runtime/asm_ppc64x.s:295 +0xd0 fp=0xffffffffffff808 sp=0xffffffffffff7e8 pc=0x1000604c0

...

Is this a problem which can be solved easily? How can i fix this?

This is the go code i compiled

package main

import "fmt"

func main() {
   fmt.Println("hello world22e")

}

i tried the crosscompile from windows and linux with the same result.

greetings,
Franz

@AlexRouSg
Copy link
Contributor

1.14 is out of support, please test with 1.16

@rfx77
Copy link
Author

rfx77 commented Mar 15, 2021

same problem


runtime: memory allocated by OS [0x700000028000000, 0x70000002c000000) not in usable address space: base outside usable address space
fatal error: memory reservation exceeds address space limit

runtime stack:
runtime.throw(0x1000ce532, 0x2e)
        C:/develop/tools/go/go1.16.2/src/runtime/panic.go:1117 +0x68 fp=0xffffffffffff548 sp=0xffffffffffff508 pc=0x100034f78
runtime.(*mheap).sysAlloc(0x1800376a0, 0x400000, 0x9001000a01a0e50, 0x9001000a01a0e68)
        C:/develop/tools/go/go1.16.2/src/runtime/malloc.go:720 +0x840 fp=0xffffffffffff618 sp=0xffffffffffff548 pc=0x10000b290
runtime.(*mheap).grow(0x1800376a0, 0x1, 0x0)
        C:/develop/tools/go/go1.16.2/src/runtime/mheap.go:1346 +0xa8 fp=0xffffffffffff6a8 sp=0xffffffffffff618 pc=0x1000269c8
runtime.(*mheap).allocSpan(0x1800376a0, 0x1, 0x2c000180058c78, 0x9001000a00908e8)
        C:/develop/tools/go/go1.16.2/src/runtime/mheap.go:1173 +0x624 fp=0xffffffffffff730 sp=0xffffffffffff6a8 pc=0x1000267d4
runtime.(*mheap).alloc.func1()
        C:/develop/tools/go/go1.16.2/src/runtime/mheap.go:910 +0x6c fp=0xffffffffffff790 sp=0xffffffffffff730 pc=0x1000608ac
runtime.systemstack(0xffffffffffff7e8)
        C:/develop/tools/go/go1.16.2/src/runtime/asm_ppc64x.s:295 +0xd0 fp=0xffffffffffff7b0 sp=0xffffffffffff790 pc=0x100065010
runtime.(*mheap).alloc(0x1800376a0, 0x1, 0x2c01000000000000, 0x0)
        C:/develop/tools/go/go1.16.2/src/runtime/mheap.go:904 +0x70 fp=0xffffffffffff810 sp=0xffffffffffff7b0 pc=0x100025ce0


@AlexRouSg
Copy link
Contributor

ping @trex58

@trex58
Copy link

trex58 commented Mar 15, 2021

ping @Helflym

@Helflym
Copy link
Contributor

Helflym commented Mar 15, 2021

@rfx77 This is normal. On AIX 7.2, the pointers allocated by mmap are between 0x0A00000000000000-0x0AFFFFFFFFFFFFFF. On AIX 7.1 and I guess on IBMi (which as far as I remember is based on AIX 7.1), the default is 0x0700000000000000-0x07FFFFFFFFFFFFFF.
I know that on AIX 7.2, it's possible to switch thanks to an environment variable. But I don't know if IBMi have such thing. The relevant doc was https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performance/1TB_segment_aliasing.html for AIX, if I remember correctly.
If it's not then a patch is needed. Among the things to do:

There are some issues related to this #38966 #35451 as along as some commits (check the history of malloc.go they should be listed there).

However, that might not be the only issue regarding IBMi. I don't know.

@rfx77
Copy link
Author

rfx77 commented Mar 15, 2021

On IBM-i 7.4 the Pase Runtime is derived from AIX 7.2, Technology Level 2.
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzalf/rzalfwhatsnew.htm

@Helflym
Copy link
Contributor

Helflym commented Mar 15, 2021

Strange maybe that AIX feature is there on IBMi or it's set up to the other segment. You can try the VMO tunable which controls that on AIX. It should be something like VMM_CNTRL=ESID_ALLOCATOR=0 according to the documentation.

@cherrymui cherrymui changed the title Crosscompiled to AIX/ppc64 not working in IBMi PASE (AIX7.2) due to "not in usable address space" runtime: crosscompiled to AIX/ppc64 not working in IBMi PASE (AIX7.2) due to "not in usable address space" Mar 15, 2021
@cherrymui cherrymui added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 15, 2021
@cherrymui cherrymui added this to the Go1.17 milestone Mar 15, 2021
@rfx77
Copy link
Author

rfx77 commented Mar 15, 2021

The ENV Variable VMM_CNTRL has no effect.

I checked the sourcecode but i am not deep enough in the go source to check what the problem is. can someone guide me to the point where i can change the memory allocation and what to change?

Or can i help someone who knows more with my testing. We have a IBMi 7.4 TR3 running so i could help.

@Helflym
Copy link
Contributor

Helflym commented Mar 16, 2021

The ENV Variable VMM_CNTRL has no effect.

Maybe there is another way to change the default mmap segment. If as you said, IBMi 7.4 is based on AIX 7.2, then the IBMi devs should have said something about that.

I checked the sourcecode but i am not deep enough in the go source to check what the problem is. can someone guide me to the point where i can change the memory allocation and what to change?

I've listed the main things to do above. The AIX comments in malloc.go normally explained what's going on. You "just" need to replace 0x0A00000000000000 by 0x0700000000000000

@rfx77
Copy link
Author

rfx77 commented Mar 16, 2021

I did what you suggested and it works. The simple Hello World example runs on IBMi

i also tried a simple rest-webserver. works also

How can we proceed and what should we test to check if it stable?

@Helflym
Copy link
Contributor

Helflym commented Mar 16, 2021

Alright good news! You should be able to bootstrap Go for IBMi with src/bootstrap.bash. After that, you should be able to rebuild and test golang directly on IBMi with src/all.bash.

@rfx77
Copy link
Author

rfx77 commented Mar 16, 2021

Ok. I compiled the bootstrap and it runs on IBM-i. But make.bash does not.

here is the output:


GOROOT_BOOTSTRAP=/develop/go-aix-ppc64-bootstrap/ ./make.bash

Building Go cmd/dist using /develop/go-aix-ppc64-bootstrap/. (devel +120b9eb1c3 Tue Mar 16 13:06:17 2021 +0000 aix/ppc64)
runtime: lfstack.push invalid packing: node=0x70000002839e580 cnt=0x1 packed=0x800000141cf2c001 -> node=0xb0000002839e580
runtime: lfstack.push invalid packing: node=0x700000028408380 cnt=0x1 packed=0x800000142041c001 -> node=0xb00000028408380
fatal error: lfstack.push
runtime: lfstack.push invalid packing: node=0x70000002808e500 cnt=0x1 packed=0x8000001404728001 -> node=0xb0000002808e500
fatal error: lfstack.push
runtime: lfstack.push invalid packing: node=0x7000000280289e0 cnt=0x1 packed=0x800000140144f001 -> node=0xb000000280289e0
fatal error: lfstack.push
runtime: lfstack.push invalid packing: node=0x7000000282a4840 cnt=0x1 packed=0x8000001415242001 -> node=0xb000000282a4840
fatal error: lfstack.push
runtime: lfstack.push invalid packing: node=0x7000000284982c0 cnt=0x1 packed=0x8000001424c16001 -> node=0xb000000284982c0
fatal error: lfstack.push
fatal error: lfstack.push
runtime: lfstack.push invalid packing: node=0x700000028304660 cnt=0x1 packed=0x8000001418233001 -> node=0xb00000028304660
fatal error: lfstack.push

runtime stack:
runtime.throw(0x1005cb8bb, 0xc)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/panic.go:1126 +0x68
runtime.(*lfstack).push(0x1800a6250, 0x700000028408380)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/lfstack.go:30 +0x180
runtime.gcBgMarkWorker.func1(0x700000028185e00, 0x700000028408380, 0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/mgc.go:1936 +0x8c
runtime.park_m(0x700000028185e00)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/proc.go:3298 +0x108
runtime.mcall(0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/asm_ppc64x.s:192 +0x54

goroutine 1 [select]:
cmd/go/internal/load.(*preload).preloadImports(0x700000028189200, 0x7000000281d8c60, 0x16, 0x16, 0x7000000281ba800)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:982 +0x188
cmd/go/internal/load.loadImport(0x10069efc0, 0x7000000280220a0, 0x700000028189200, 0x70000002818c610, 0xa, 0x70000002802a01c, 0xf, 0x0, 0x700000028115b80, 0x0, ...)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:670 +0x130
cmd/go/internal/load.PackagesAndErrors(0x10069efc0, 0x7000000280220a0, 0x700000028196040, 0x1, 0x1, 0x0, 0x0, 0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:2415 +0x6bc
cmd/go/internal/work.runBuild(0x10069efc0, 0x7000000280220a0, 0x180042fc0, 0x700000028196040, 0x1, 0x1)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/work/build.go:375 +0x74
main.main()
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/main.go:195 +0xbbc

goroutine 19 [select]:
cmd/go/internal/load.(*preload).preloadImports(0x700000028189200, 0x70000002832c320, 0x5, 0x5, 0x7000000280a4000)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:982 +0x188
cmd/go/internal/load.(*preload).preloadImports.func1(0x7000000281ba800, 0x1, 0x700000028189200, 0x70000002818cb57, 0x5)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:990 +0x120
created by cmd/go/internal/load.(*preload).preloadImports
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:986 +0x1d4

goroutine 20 [select]:
cmd/go/internal/load.(*preload).preloadImports(0x700000028189200, 0x700000028294460, 0x5, 0x5, 0x70000002813a000)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:982 +0x188
cmd/go/internal/load.(*preload).preloadImports.func1(0x7000000281ba800, 0x1, 0x700000028189200, 0x70000002818c8d7, 0x5)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:990 +0x120
created by cmd/go/internal/load.(*preload).preloadImports
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:986 +0x1d4

goroutine 21 [runnable]:
go/scanner.(*Scanner).scanComment(0x700000028237220, 0x10000000a, 0x25b)
        /opt/go/go-aix-ppc64-bootstrap/src/go/scanner/scanner.go:221 +0x2b0
go/scanner.(*Scanner).Scan(0x700000028237220, 0x100543d20, 0x10018b838, 0x700000000000010, 0x700000026c93ca8)
        /opt/go/go-aix-ppc64-bootstrap/src/go/scanner/scanner.go:888 +0x174
go/parser.(*parser).next0(0x700000028237200)
        /opt/go/go-aix-ppc64-bootstrap/src/go/parser/parser.go:257 +0x1e4
go/parser.(*parser).next(0x700000028237200)
        /opt/go/go-aix-ppc64-bootstrap/src/go/parser/parser.go:320 +0x84
go/parser.(*parser).expectSemi(0x700000028237200)
        /opt/go/go-aix-ppc64-bootstrap/src/go/parser/parser.go:436 +0xc8
go/parser.(*parser).parseGenDecl(0x700000028237200, 0x4b, 0x7000000281110f8, 0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/go/parser/parser.go:2749 +0x470
go/parser.(*parser).parseFile(0x700000028237200, 0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/go/parser/parser.go:2889 +0x820
go/parser.ParseFile(0x700000028484140, 0x700000028489ac0, 0x3c, 0x10050f500, 0x7000000281c3188, 0x6, 0x0, 0x0, 0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/go/parser/interface.go:124 +0x140
go/build.readGoInfo(0x100693d40, 0x7000000280a0218, 0x70000002848a870, 0x100693d40, 0x7000000280a0218)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/read.go:409 +0x3f4
go/build.(*Context).matchFile(0x180070f40, 0x7000000281ad900, 0x31, 0x7000000283a8772, 0xa, 0x7000000284827e0, 0x70000002829e4e0, 0x700000028484140, 0x700000028316a20, 0x0, ...)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/build.go:1411 +0x9b4
go/build.(*Context).Import(0x180070f40, 0x70000002818c8e1, 0xd, 0x7000000281fc380, 0x18, 0x4, 0x700000028296060, 0x1005310a0, 0x70000002807c570)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/build.go:830 +0x1eb0
cmd/go/internal/load.loadPackageData.func2(0x1800702e0, 0x100514b20)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:855 +0x324
cmd/go/internal/par.(*Cache).Do(0x1800702e0, 0x100514b20, 0x700000028298060, 0x700000028293e80, 0x10056b8a0, 0x70000002829c030)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/par/work.go:128 +0x168
cmd/go/internal/load.loadPackageData(0x70000002818c8e1, 0xd, 0x7000000281fc360, 0x19, 0x7000000281fc380, 0x18, 0x0, 0x0, 0x0, 0x1, ...)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:829 +0x354
cmd/go/internal/load.(*preload).preloadImports.func1(0x7000000281ba800, 0x1, 0x700000028189200, 0x70000002818c8e1, 0xd)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:987 +0x88
created by cmd/go/internal/load.(*preload).preloadImports
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:986 +0x1d4

goroutine 29 [semacquire]:
sync.runtime_SemacquireMutex(0x70000002838e028, 0x100560720, 0x1)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/sema.go:71 +0x44
sync.(*Mutex).lockSlow(0x70000002838e024)
        /opt/go/go-aix-ppc64-bootstrap/src/sync/mutex.go:138 +0x1a8
sync.(*Mutex).Lock(...)
        /opt/go/go-aix-ppc64-bootstrap/src/sync/mutex.go:81
cmd/go/internal/par.(*Cache).Do(0x1800702e0, 0x100514b20, 0x7000000283904d0, 0x700000028253e80, 0x10056b8a0, 0x700000028396d50)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/par/work.go:126 +0x124
cmd/go/internal/load.loadPackageData(0x70000002839a1d1, 0x3, 0x70000002818c8f1, 0x4, 0x70000002840e000, 0x28, 0x700000028024007, 0x1f, 0x100000000000000, 0x1, ...)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:829 +0x354
cmd/go/internal/load.(*preload).preloadImports.func1(0x7000000281bb000, 0x100000000000001, 0x700000028189200, 0x70000002839a1d1, 0x3)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:987 +0x88
created by cmd/go/internal/load.(*preload).preloadImports
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:986 +0x1d4

goroutine 23 [select]:
cmd/go/internal/load.(*preload).preloadImports(0x700000028189200, 0x7000000282e2360, 0x9, 0x9, 0x7000000281bb000)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:982 +0x188
cmd/go/internal/load.(*preload).preloadImports.func1(0x7000000281ba800, 0x1, 0x700000028189200, 0x70000002818c8f1, 0x4)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:990 +0x120
created by cmd/go/internal/load.(*preload).preloadImports
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:986 +0x1d4

goroutine 24 [semacquire]:
bufio.NewReaderSize(...)
        /opt/go/go-aix-ppc64-bootstrap/src/bufio/bufio.go:57
bufio.NewReader(...)
        /opt/go/go-aix-ppc64-bootstrap/src/bufio/bufio.go:63
go/build.newImportReader(...)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/read.go:33
go/build.readGoInfo(0x100693d40, 0x70000002829a348, 0x7000000282e2750, 0x100693d40, 0x70000002829a348)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/read.go:366 +0xb8
go/build.(*Context).matchFile(0x180070f40, 0x7000000280ae060, 0x27, 0x700000028250028, 0x9, 0x70000002807d440, 0x7000000283980e0, 0x70000002802e840, 0x70000002848a7e0, 0x0, ...)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/build.go:1411 +0x9b4
go/build.(*Context).Import(0x180070f40, 0x70000002818c8f7, 0x3, 0x7000000281fc380, 0x18, 0x4, 0x70000002838e020, 0x1005310a0, 0x70000002807c570)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/build.go:830 +0x1eb0
cmd/go/internal/load.loadPackageData.func2(0x1800702e0, 0x100514b20)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:855 +0x324
cmd/go/internal/par.(*Cache).Do(0x1800702e0, 0x100514b20, 0x700000028390010, 0x70000002828de80, 0x10056b8a0, 0x700000028396000)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/par/work.go:128 +0x168
cmd/go/internal/load.loadPackageData(0x70000002818c8f7, 0x3, 0x7000000281fc360, 0x19, 0x7000000281fc380, 0x18, 0x0, 0x0, 0x0, 0x1, ...)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:829 +0x354
cmd/go/internal/load.(*preload).preloadImports.func1(0x7000000281ba800, 0x1, 0x700000028189200, 0x70000002818c8f7, 0x3)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:987 +0x88
created by cmd/go/internal/load.(*preload).preloadImports
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:986 +0x1d4

goroutine 26 [select]:
cmd/go/internal/load.(*preload).preloadImports(0x700000028189200, 0x700000028223440, 0x4, 0x4, 0x7000000281bac00)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:982 +0x188
cmd/go/internal/load.(*preload).preloadImports.func1(0x7000000281ba800, 0x1, 0x700000028189200, 0x70000002818c901, 0x9)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:990 +0x120
created by cmd/go/internal/load.(*preload).preloadImports
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:986 +0x1d4

goroutine 27 [select]:
cmd/go/internal/load.(*preload).preloadImports(0x700000028189200, 0x700000028183020, 0x6, 0x6, 0x7000000281bb800)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:982 +0x188
cmd/go/internal/load.(*preload).preloadImports.func1(0x7000000281ba800, 0x1, 0x700000028189200, 0x70000002818c8fc, 0x3)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:990 +0x120
created by cmd/go/internal/load.(*preload).preloadImports
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:986 +0x1d4

goroutine 33 [select]:
cmd/go/internal/load.(*preload).preloadImports(0x700000028189200, 0x70000002829dad0, 0x3, 0x3, 0x7000000284d2000)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:982 +0x188
cmd/go/internal/load.(*preload).preloadImports.func1(0x70000002829e000, 0x100000000000001, 0x700000028189200, 0x70000002839c049, 0x14)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:990 +0x120
created by cmd/go/internal/load.(*preload).preloadImports
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:986 +0x1d4

goroutine 37 [runnable]:
bufio.NewReaderSize(...)
        /opt/go/go-aix-ppc64-bootstrap/src/bufio/bufio.go:57
bufio.NewReader(...)
        /opt/go/go-aix-ppc64-bootstrap/src/bufio/bufio.go:63
go/build.newImportReader(...)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/read.go:33
go/build.readGoInfo(0x100693d40, 0x70000002842e118, 0x7000000282e26c0, 0x100693d40, 0x70000002842e118)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/read.go:366 +0xb8
go/build.(*Context).matchFile(0x180070f40, 0x7000000282d4660, 0x2b, 0x70000002840756c, 0x7, 0x70000002840cc00, 0x70000002829e8e0, 0x700000028418540, 0x700000028316900, 0x0, ...)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/build.go:1411 +0x9b4
go/build.(*Context).Import(0x180070f40, 0x70000002818c915, 0x7, 0x7000000281fc380, 0x18, 0x4, 0x700000028297020, 0x1005310a0, 0x70000002807dce0)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/build.go:830 +0x1eb0
cmd/go/internal/load.loadPackageData.func2(0x1800702e0, 0x100514b20)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:855 +0x324
cmd/go/internal/par.(*Cache).Do(0x1800702e0, 0x100514b20, 0x700000028298a40, 0x7000000284c7e80, 0x10056b8a0, 0x70000002829d3e0)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/par/work.go:128 +0x168
cmd/go/internal/load.loadPackageData(0x70000002818c915, 0x7, 0x7000000281fc360, 0x19, 0x7000000281fc380, 0x18, 0x0, 0x0, 0x0, 0x1, ...)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:829 +0x354
cmd/go/internal/load.(*preload).preloadImports.func1(0x7000000281ba800, 0x1, 0x700000028189200, 0x70000002818c915, 0x7)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:987 +0x88
created by cmd/go/internal/load.(*preload).preloadImports
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:986 +0x1d4

goroutine 65 [runnable]:
syscall.Lstat(0x7000000280ae2a0, 0x2b, 0x7000000280e2f38, 0x2, 0x7000000280ae2a0)
        /opt/go/go-aix-ppc64-bootstrap/src/syscall/zsyscall_aix_ppc64.go:988 +0x11c
os.lstatNolog.func1(...)
        /opt/go/go-aix-ppc64-bootstrap/src/os/stat_unix.go:46
os.ignoringEINTR(...)
        /opt/go/go-aix-ppc64-bootstrap/src/os/file_posix.go:246
os.lstatNolog(0x7000000280ae2a0, 0x2b, 0x3, 0x3, 0x7000000280ae2a0, 0x2b)
        /opt/go/go-aix-ppc64-bootstrap/src/os/stat_unix.go:45 +0x64
os.Lstat(0x7000000280ae2a0, 0x2b, 0x26, 0x1005c52ea, 0x1, 0x70000002843eb6c)
        /opt/go/go-aix-ppc64-bootstrap/src/os/stat.go:22 +0x48
os.(*File).readdir(0x70000002842e038, 0xffffffffffffffff, 0x2, 0x1001757c0, 0x18009de00, 0x1001bcd00, 0x10000c27c, 0x70000002840e240, 0x26, 0x0, ...)
        /opt/go/go-aix-ppc64-bootstrap/src/os/dir_unix.go:116 +0x68c
os.(*File).Readdir(0x70000002842e038, 0xffffffffffffffff, 0x0, 0x55550, 0x70000002842e038, 0x0, 0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/os/dir.go:41 +0x48
io/ioutil.ReadDir(0x70000002840e240, 0x26, 0x70000002840e240, 0x26, 0x7000000284c30d8, 0x2802a528, 0x100059ed8)
        /opt/go/go-aix-ppc64-bootstrap/src/io/ioutil/ioutil.go:63 +0x6c
cmd/go/internal/fsys.readDir(0x70000002840e240, 0x26, 0x70000002840e240, 0x26, 0x1800a7d20, 0xd, 0x7000000000021d8)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/fsys/fsys.go:246 +0x34
cmd/go/internal/fsys.ReadDir(0x70000002840e240, 0x26, 0x700000028071960, 0x2, 0x2, 0x700000028158380, 0x32)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/fsys/fsys.go:270 +0x2f4
go/build.(*Context).readDir(0x180070f40, 0x70000002840e240, 0x26, 0x2, 0x700000028158380, 0x32, 0x4, 0x1006938a0)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/build.go:189 +0x58
go/build.(*Context).Import(0x180070f40, 0x70000002818c911, 0x2, 0x7000000281fc380, 0x18, 0x4, 0x700000028312780, 0x1005310a0, 0x70000002807c570)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/build.go:793 +0x13f0
cmd/go/internal/load.loadPackageData.func2(0x1800702e0, 0x100514b20)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:855 +0x324
cmd/go/internal/par.(*Cache).Do(0x1800702e0, 0x100514b20, 0x70000002830e280, 0x7000000284c3e80, 0x10056b8a0, 0x7000000283089f0)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/par/work.go:128 +0x168
cmd/go/internal/load.loadPackageData(0x70000002818c911, 0x2, 0x7000000281fc360, 0x19, 0x7000000281fc380, 0x18, 0x0, 0x0, 0x0, 0x1, ...)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:829 +0x354
cmd/go/internal/load.(*preload).preloadImports.func1(0x7000000281ba800, 0x1, 0x700000028189200, 0x70000002818c911, 0x2)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:987 +0x88
created by cmd/go/internal/load.(*preload).preloadImports
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:986 +0x1d4

goroutine 36 [semacquire]:
bufio.NewReaderSize(...)
        /opt/go/go-aix-ppc64-bootstrap/src/bufio/bufio.go:57
bufio.NewReader(...)
        /opt/go/go-aix-ppc64-bootstrap/src/bufio/bufio.go:63
go/build.newImportReader(...)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/read.go:33
go/build.readGoInfo(0x100693d40, 0x700000028392250, 0x7000000283aa750, 0x100693d40, 0x700000028392250)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/read.go:366 +0xb8
go/build.(*Context).matchFile(0x180070f40, 0x70000002840e3f0, 0x29, 0x7000000282d47da, 0x6, 0x70000002829d740, 0x70000002813a4e0, 0x7000000282bea40, 0x700000028316990, 0x0, ...)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/build.go:1411 +0x9b4
go/build.(*Context).Import(0x180070f40, 0x7000000280227a1, 0x5, 0x700000028024c00, 0x2d, 0x4, 0x700000028071820, 0x1005310a0, 0x70000002807dce0)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/build.go:830 +0x1eb0
cmd/go/internal/load.loadPackageData.func2(0x1800702e0, 0x100514b20)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:855 +0x324
cmd/go/internal/par.(*Cache).Do(0x1800702e0, 0x100514b20, 0x70000002805e8a0, 0x700000028255e80, 0x10056b8a0, 0x70000002807dcb0)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/par/work.go:128 +0x168
cmd/go/internal/load.loadPackageData(0x7000000280227a1, 0x5, 0x70000002818c901, 0x9, 0x700000028024c00, 0x2d, 0x700000028024007, 0x1f, 0x100000000000000, 0x1, ...)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:829 +0x354
cmd/go/internal/load.(*preload).preloadImports.func1(0x7000000281bac00, 0x100000000000001, 0x700000028189200, 0x7000000280227a1, 0x5)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:987 +0x88
created by cmd/go/internal/load.(*preload).preloadImports
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:986 +0x1d4

goroutine 81 [semacquire]:
strings.(*Builder).grow(...)
        /opt/go/go-aix-ppc64-bootstrap/src/strings/builder.go:68
strings.(*Builder).Grow(...)
        /opt/go/go-aix-ppc64-bootstrap/src/strings/builder.go:82
strings.Join(0x700000028095470, 0x7, 0xa, 0x100687688, 0x1, 0x0, 0x7000000284804d0)
        /opt/go/go-aix-ppc64-bootstrap/src/strings/strings.go:434 +0x114
go/ast.(*CommentGroup).Text(0x7000000284006a8, 0x7000000283064a8, 0x4)
        /opt/go/go-aix-ppc64-bootstrap/src/go/ast/ast.go:159 +0x338
go/build.(*Context).Import(0x180070f40, 0x70000002839a0e1, 0x4, 0x700000028024ea0, 0x26, 0x4, 0x70000002840a280, 0x1005310a0, 0x70000002807dce0)
        /opt/go/go-aix-ppc64-bootstrap/src/go/build/build.go:894 +0x2850
cmd/go/internal/load.loadPackageData.func2(0x1800702e0, 0x100514b20)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:855 +0x324
cmd/go/internal/par.(*Cache).Do(0x1800702e0, 0x100514b20, 0x700000028412100, 0x700000028095e80, 0x10056b8a0, 0x70000002840c390)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/par/work.go:128 +0x168
cmd/go/internal/load.loadPackageData(0x70000002839a0e1, 0x4, 0x70000002818cb71, 0x2, 0x700000028024ea0, 0x26, 0x700000028024007, 0x1f, 0x100000000000000, 0x1, ...)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:829 +0x354
cmd/go/internal/load.(*preload).preloadImports.func1(0x7000000281bb400, 0x100000000000001, 0x700000028189200, 0x70000002839a0e1, 0x4)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:987 +0x88
created by cmd/go/internal/load.(*preload).preloadImports
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:986 +0x1d4

goroutine 39 [semacquire]:
sync.runtime_SemacquireMutex(0x700000028312788, 0x100560720, 0x1)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/sema.go:71 +0x44
sync.(*Mutex).lockSlow(0x700000028312784)
        /opt/go/go-aix-ppc64-bootstrap/src/sync/mutex.go:138 +0x1a8
sync.(*Mutex).Lock(...)
        /opt/go/go-aix-ppc64-bootstrap/src/sync/mutex.go:81
cmd/go/internal/par.(*Cache).Do(0x1800702e0, 0x100514b20, 0x700000028390720, 0x70000002858be80, 0x10056b8a0, 0x700000028397560)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/par/work.go:126 +0x124
cmd/go/internal/load.loadPackageData(0x7000000280227a9, 0x2, 0x70000002818c901, 0x9, 0x700000028024c00, 0x2d, 0x700000028024007, 0x1f, 0x100000000000000, 0x1, ...)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:829 +0x354
cmd/go/internal/load.(*preload).preloadImports.func1(0x7000000281bac00, 0x100000000000001, 0x700000028189200, 0x7000000280227a9, 0x2)
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:987 +0x88
created by cmd/go/internal/load.(*preload).preloadImports
        /opt/go/go-aix-ppc64-bootstrap/src/cmd/go/internal/load/pkg.go:986 +0x1d4

runtime stack:
runtime.throw(0x1005cb8bb, 0xc)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/panic.go:1126 +0x68
runtime.(*lfstack).push(0x1800a6250, 0x700000028304660)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/lfstack.go:30 +0x180
runtime.gcBgMarkWorker.func1(0x700000028323c80, 0x700000028304660, 0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/mgc.go:1936 +0x8c
runtime.park_m(0x700000028323c80)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/proc.go:3298 +0x108
runtime.mcall(0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/asm_ppc64x.s:192 +0x54

runtime stack:
runtime.throw(0x1005cb8bb, 0xc)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/panic.go:1126 +0x68
runtime.(*lfstack).push(0x1800a6250, 0x70000002839e580)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/lfstack.go:30 +0x180
runtime.gcBgMarkWorker.func1(0x700000028383e00, 0x70000002839e580, 0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/mgc.go:1936 +0x8c
runtime.park_m(0x700000028383e00)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/proc.go:3298 +0x108
runtime.mcall(0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/asm_ppc64x.s:192 +0x54

runtime stack:
runtime.throw(0x1005cb8bb, 0xc)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/panic.go:1126 +0x68
runtime.(*lfstack).push(0x1800a6250, 0x7000000284982c0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/lfstack.go:30 +0x180
runtime.gcBgMarkWorker.func1(0x7000000284a0f00, 0x7000000284982c0, 0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/mgc.go:1936 +0x8c
runtime.park_m(0x7000000284a0f00)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/proc.go:3298 +0x108
runtime.mcall(0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/asm_ppc64x.s:192 +0x54

runtime stack:
runtime.throw(0x1005cb8bb, 0xc)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/panic.go:1126 +0x68
runtime.(*lfstack).push(0x1800a6250, 0x7000000282a4840)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/lfstack.go:30 +0x180
runtime.gcBgMarkWorker.func1(0x700000028083980, 0x7000000282a4840, 0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/mgc.go:1936 +0x8c
runtime.park_m(0x700000028083980)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/proc.go:3298 +0x108
runtime.mcall(0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/asm_ppc64x.s:192 +0x54

runtime stack:
runtime.throw(0x1005cb8bb, 0xc)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/panic.go:1126 +0x68
runtime.(*lfstack).push(0x1800a6250, 0x7000000280289e0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/lfstack.go:30 +0x180
runtime.gcBgMarkWorker.func1(0x70000002815a180, 0x7000000280289e0, 0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/mgc.go:1936 +0x8c
runtime.park_m(0x70000002815a180)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/proc.go:3298 +0x108
runtime.mcall(0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/asm_ppc64x.s:192 +0x54

runtime stack:
runtime.throw(0x1005cb8bb, 0xc)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/panic.go:1126 +0x68
runtime.(*lfstack).push(0x1800a6250, 0x70000002808e500)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/lfstack.go:30 +0x180
runtime.gcBgMarkWorker.func1(0x700000028184300, 0x70000002808e500, 0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/mgc.go:1936 +0x8c
runtime.park_m(0x700000028184300)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/proc.go:3298 +0x108
runtime.mcall(0x0)
        /opt/go/go-aix-ppc64-bootstrap/src/runtime/asm_ppc64x.s:192 +0x54

@Helflym
Copy link
Contributor

Helflym commented Mar 16, 2021

It looks like some more part in the runtime needs to be changed. But I don't know where. I don't remember having such issues.
@aclements @mknyszek maybe you'll have a better idea about what's wrong here.

@rfx77
Copy link
Author

rfx77 commented Mar 16, 2021

Okay. i also edited malloc at another position and lfstack_64.go. now my webserver seems stable. i will build another bootstrap and give you feedback

@rfx77
Copy link
Author

rfx77 commented Mar 16, 2021

Now i get an error when with make.bash

GOROOT_BOOTSTRAP=/develop/go-aix-ppc64-bootstrap/ ./make.bash

Building Go cmd/dist using /develop/go-aix-ppc64-bootstrap/. (devel +120b9eb1c3 Tue Mar 16 13:06:17 2021 +0000 aix/ppc64)
# runtime/internal/atomic
Could not load program /develop/go-aix-ppc64-bootstrap/pkg/tool/aix_ppc64/asm:
System error - error data is: -1 9 (64002005)
# internal/bytealg
Could not load program /develop/go-aix-ppc64-bootstrap/pkg/tool/aix_ppc64/asm:
System error - error data is: -1 9 (64002005)
go: failed to remove work dir: unlinkat /tmp/go-build3976199215: invalid argument

with more verbosity

GOROOT_BOOTSTRAP=/develop/go-aix-ppc64-bootstrap/ ./make.bash -a -d -v


Building Go cmd/dist using /develop/go-aix-ppc64-bootstrap/. (devel +120b9eb1c3 Tue Mar 16 13:06:17 2021 +0000 aix/ppc64)
go: failed to remove work dir: unlinkat /tmp/go-build1123863472: invalid argument
Building Go toolchain1 using /develop/go-aix-ppc64-bootstrap/.
runtime/internal/sys
internal/abi
internal/race
unicode
internal/unsafeheader
go tool compile: exit status 255
Could not load program /develop/go-aix-ppc64-bootstrap/pkg/tool/aix_ppc64/compile:
System error - error data is: -1 9 (64002005)
go: failed to remove work dir: unlinkat /tmp/go-build282961040: invalid argument
runtime/internal/math
go tool dist: FAILED: /develop/go-aix-ppc64-bootstrap/bin/go install -gcflags=-l -tags=math_big_pure_go compiler_bootstrap -v bootstrap/cmd/...: exit status 1


@rfx77
Copy link
Author

rfx77 commented Mar 16, 2021

I did some testing an i cannot get the compiler to work on the ibmi. but all my crosscompiled projets work without a problem.
i even tried a simple mongodb client and it runs flawless.

for me it would be sufficient when i can develop on my pc and crosscompile to ibmi. Developing directly on ibmi is not necessary - and no real fun ;-)

would it be possible to add a new cross-compile os like (ibmi or aix-pase). i only changed three lines of code but this kills the aix compatibility and i have no aix to test.


diff --git a/src/runtime/lfstack_64bit.go b/src/runtime/lfstack_64bit.go
index 4812dd1156..bce6450689 100644
--- a/src/runtime/lfstack_64bit.go
+++ b/src/runtime/lfstack_64bit.go
@@ -53,7 +53,7 @@ func lfstackUnpack(val uint64) *lfnode {
                return (*lfnode)(unsafe.Pointer(uintptr(int64(val) >> cntBits << 3)))
        }
        if GOARCH == "ppc64" && GOOS == "aix" {
-               return (*lfnode)(unsafe.Pointer(uintptr((val >> aixCntBits << 3) | 0xa<<56)))
+               return (*lfnode)(unsafe.Pointer(uintptr((val >> aixCntBits << 3) | 0x7<<56)))
        }
        return (*lfnode)(unsafe.Pointer(uintptr(val >> cntBits << 3)))
 }
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index 8435f96532..e3d98382b8 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -302,7 +302,7 @@ const (
        //
        // On other platforms, the user address space is contiguous
        // and starts at 0, so no offset is necessary.
-       arenaBaseOffset = 0xffff800000000000*sys.GoarchAmd64 + 0x0a00000000000000*sys.GoosAix
+       arenaBaseOffset = 0xffff800000000000*sys.GoarchAmd64 + 0x0700000000000000*sys.GoosAix
        // A typed version of this constant that will make it into DWARF (for viewcore).
        arenaBaseOffsetUintptr = uintptr(arenaBaseOffset)

@@ -539,7 +539,7 @@ func mallocinit() {
                                        // to avoid collisions with others mmaps done by non-go programs.
                                        continue
                                }
-                               p = uintptr(i)<<40 | uintptrMask&(0xa0<<52)
+                               p = uintptr(i)<<40 | uintptrMask&(0x70<<52)
                        default:
                                p = uintptr(i)<<40 | uintptrMask&(0x00c0<<32)

@Helflym
Copy link
Contributor

Helflym commented Mar 16, 2021

Well, until anyone managed to get a full bootstrap on IBMi, I guess patches related to IBMi won't be accepted in the source code.
Moreover, AFAIK any new OS needs a VM in the build farm. I don't know how the Solaris/Illumos separation started but this is kind of the same here.

@rfx77
Copy link
Author

rfx77 commented Mar 17, 2021

Since IBM has a good Open-Source strategy with IBM-i maybe someone from IBM could help. Are there any active contributors from them?

@holterandreasb
Copy link

@ThePrez maybe you can jump in at this point? Are there any plans for go support on IBM i and besides that also for providing IBM i VMs for open source development?

@rfx77
Copy link
Author

rfx77 commented Mar 19, 2021

When i use the bootstrap version of go as GOROOT i can compile a simple "Hello World" on IBMi

GOROOT=/develop/go-aix-ppc64-bootstrap/ go build test.go && ./test

But it seems to me that the cgo integration is the problem. When i try to compile a net/http server example i get the following error:

# runtime/cgo
/tmp/go-build1628516446/b085/_cgo_import.go:14:3: usage: //go:cgo_import_dynamic local [remote ["lib.a/object.o"]]

The content of the file is:

package cgo
//go:cgo_import_dynamic errno errno "libc.a/shr_64.o"
//go:cgo_import_dynamic __mod_init __mod_init "libc.a/shr_64.o"
//go:cgo_import_dynamic calloc calloc "libc.a/shr_64.o"
//go:cgo_import_dynamic exit exit "libc.a/shr_64.o"
//go:cgo_import_dynamic __assert __assert "libc.a/shr_64.o"
//go:cgo_import_dynamic __crt0v __crt0v "libc.a/shr_64.o"
//go:cgo_import_dynamic __malloc_user_defined_name __malloc_user_defined_name "libc.a/shr_64.o"
//go:cgo_import_dynamic __n_pthreads __n_pthreads "libpthreads.a/shr_xpg5_64.o"
//go:cgo_import_dynamic __pth_init __pth_init "libpthreads.a/shr_xpg5_64.o"
//go:cgo_import_dynamic __pthread __pthread "libpthreads.a/shr_xpg5_64.o"
//go:cgo_import_dynamic _ _ "libpthreads.a/shr_xpg5_64.o"
//go:cgo_import_dynamic _ _ "libc.a/shr_64.o"
//go:cgo_import_dynamic _ _ "../"

Has anybody seen this and can help me what the problem might be.

Greetings,
Franz

Update:

Problem seems to be the last line which fails in lex.go because the split with / returns only one element.

@rfx77
Copy link
Author

rfx77 commented Mar 19, 2021

Hacked around the problem but now i am back where i was when trying to compile with the bootstrap version:

GOROOT=/develop/go-aix-ppc64-bootstrap/ go build test.go
# vendor/golang.org/x/crypto/curve25519
Could not load program /develop/go-aix-ppc64-bootstrap/pkg/tool/aix_ppc64/compile:
System error - error data is: -1 9 (64002005)
# net/http/internal
Could not load program /develop/go-aix-ppc64-bootstrap/pkg/tool/aix_ppc64/compile:
System error - error data is: -1 9 (64002005)
# vendor/golang.org/x/text/secure/bidirule
Could not load program /develop/go-aix-ppc64-bootstrap/pkg/tool/aix_ppc64/compile:
System error - error data is: -1 9 (64002005)
# runtime/cgo
Could not load program /QOpenSys/usr/bin/sh:
System error - error data is: -1 9 (2005)
go: failed to remove work dir: unlinkat /tmp/go-build2796491330: invalid argument

@ThePrez
Copy link

ThePrez commented Mar 19, 2021

We unfortunately don't have any concrete dates for golang yet. IBM should probably implement those *at functions properly in PASE and likely will at some point. One could conceivably implement those in runtime code (in this case a relatively simple wrapper around unlink), but we haven't gotten to that task yet. I'll bounce this thread off some other dev folks

@kadler
Copy link

kadler commented Mar 19, 2021

Hi, IBMer here working on IBM i.

While the IBM i PASE runtime (ie userspace layer) is based on AIX, the kernel is distinct. In the case of 1TB Segment Aliasing, that is not a feature that is implemented in the IBM i kernel, so it does not work and we'll need to use the standard mmap region as has been mentioned previously in this thread. (I've been meaning to bring this up with our kernel folks).

I have played around with some Golang stuff a bit on IBM i and have some branches and issues here: https://github.com/kadler/go including https://github.com/kadler/go/tree/pase-go1.15.3. IIRC, this is enough to get some basic Golang programs built in a cross compile manner, but I have not had much luck running the compiler on IBM i itself due to the loader errors System error - error data is: -1 9 (64002005). I have not had time to investigate much further in to these, though Golang cross-compilation is so easy to use I don't find it much of a hindrance to me at this time (not to say it wouldn't be for others, though).

@rfx77 you seem pretty gung-ho on go/IBM i. Maybe we can collaborate to move this forward.

@rfx77
Copy link
Author

rfx77 commented Mar 19, 2021

@kadler: i have fixed the 64002005. They all come from concurrency problems with the ifs. i have disabled all parallel work and this is solved but thats not the only problem ;-) i will post in the next minutes my findings with a compile output as summary for all interested.

@rfx77
Copy link
Author

rfx77 commented Mar 19, 2021

So a short summary: Good News and bad news now.

With some work i managed to get to the point where i can build toolchain1, go_bootstrap, toolchain2 and toolchain3 on the ibmi

The compiler compiles much of the libraries but i have a problem with cgo. it seems to require dwarf debug symbols which are not supported with gcc on ibmi. (gcc -gdwarf)

is there any way around this when i want to build golang on the platform.

Here is my output (i removed some verbosity):


Building Go cmd/dist using /develop/go-bs/. (devel +120b9eb1c3 Tue Mar 16 13:06:17 2021 +0000 aix/ppc64)
Building Go toolchain1 using /develop/go-bs/.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for aix/ppc64.
os/user
# os/user
cgo: cannot load DWARF output from $WORK/b038//_cgo_.o: decoding dwarf section info at offset 0x0: too short
net
# net
cgo: cannot load DWARF output from $WORK/b088//_cgo_.o: decoding dwarf section info at offset 0x0: too short
os/signal/internal/pty
# os/signal/internal/pty
cgo: cannot load DWARF output from $WORK/b201//_cgo_.o: decoding dwarf section info at offset 0x0: too short
go tool dist: FAILED: /develop/go/pkg/tool/aix_ppc64/go_bootstrap install -gcflags=all= -ldflags=all= -v -p=1 std cmd: exit status 2

@kadler
Copy link

kadler commented Mar 19, 2021

You are running on IBM i 7.4? AFAIK, that's the earliest version where DWARF support might be available (I don't recall if it was out of the box in AIX 7.2). Regardless, you'll need a newer version of GCC which understands DWARF support in AIX as well. While we are working on building a newer GCC version, it is not ready for release yet.

@rfx77
Copy link
Author

rfx77 commented Mar 19, 2021

Yes 7.4. Where can i get this gcc version?

@Neo4jvv
Copy link

Neo4jvv commented Jan 24, 2024

Hello, to cross-compile the aix executable on windows, I use go version 1.16 and 1.19, Compiling command GOOS=aix GOARCH=ppc64 CGO_ENABLED=0 go build The compiled file cannot be executed on aix with oslevel=7.2.0.0. Illegal instruction(coredump) is returned. Is there a solution

@randall77
Copy link
Contributor

@Neo4jvv Have you tried a more recent release, like 1.21 or 1.22rc1?

@Neo4jvv
Copy link

Neo4jvv commented Jan 24, 2024

Yes, I followed up with 1.13, 1.15, 1.21.6,but nothing worked @randall77

@onlysumitg
Copy link

Cross compile from windows wont work for AIX on power system. You have to compile on Power system.

I added a link to github repo in this thread, check the readme there. That might help you.

@randall77
Copy link
Contributor

@onlysumitg : I think @Neo4jvv 's issue is different, as they are trying to compile with CGO_ENABLED=0.
That should generate the same target binary regardless of the host build system.

@Neo4jvv Does cross-compiling work for you from another OS, like linux?

I can get the same binary compiling from amd64/linux and arm64/darwin:

hello.go:

package main

import "fmt"

func main() {
	fmt.Printf("hello world\n")
}

arm64/darwin:

% GOARCH=ppc64 GOOS=linux CGO_ENABLED=0 ~/go1.21.6/bin/go build -trimpath hello.go
% md5 hello
MD5 (hello) = 5b9b78ab0f9b40ed15514e0645726feb

amd64/linux:

$ GOARCH=ppc64 GOOS=linux CGO_ENABLED=0 ~/go1.21.6/bin/go build -trimpath hello.go 
$ md5sum hello
5b9b78ab0f9b40ed15514e0645726feb  hello

@onlysumitg
Copy link

onlysumitg commented Jan 24, 2024

Sorry, Missed the cgo_enabled flag. Yes it should work. But you need to make some changes in go runtime/code as recommended by @rfx77

@Neo4jvv
Copy link

Neo4jvv commented Jan 24, 2024

@randall77 I can compile linux/amd64, linux/arm64 files from windows and execute normally, but aix/ppc64 compiled files will fail to execute

@randall77
Copy link
Contributor

That is strange.
Do your cross-compiled and native-compiled binaries have the same md5? If not, can you tell what is different about them? (objdump them, strings them, ...)

@onlysumitg
Copy link

Download the go lang code from repo i mentioned on windows and cross compile using that. It will work.

@Neo4jvv
Copy link

Neo4jvv commented Jan 24, 2024

@onlysumitg Where do I get the link you uploaded, this is the first time I asked on github, I don't know how to operate, can you post the link here

@onlysumitg
Copy link

Try this one https://github.com/onlysumitg/ibmigo.

I have to find the link that explain how to compile go from the source code.

@Neo4jvv
Copy link

Neo4jvv commented Jan 24, 2024

@onlysumitg Is your approach to compile go code on an aix host? But my development environment is windows, if I do not have an aix host is not able to implement this method

@onlysumitg
Copy link

@Neo4jvv dont worry about the readme. I wrote that considering the need to cgo.

I belive you can use this golang code. Compile it on windows and use that version to cross compile for aix/ppc.

I can try to write down exact step for windows in few days.

@Neo4jvv
Copy link

Neo4jvv commented Jan 24, 2024

@onlysumitg Okay, I'll try it now. Thank you

@Neo4jvv
Copy link

Neo4jvv commented Jan 24, 2024

@onlysumitg Please try to write the operation steps of windows,Please ,Please ,Please ,thank u, thank u,thank u

@Neo4jvv
Copy link

Neo4jvv commented Jan 24, 2024

@onlysumitg GOROOT=D:\ibmigo-main\go cannot be set directly after cloning this DIRECTORY locally, and the go file in the bin directory is not an exe file

@onlysumitg
Copy link

@Neo4jvv the ibmigo is for AIX PPC64 not for windows.

for windows please give a try to following:

https://github.com/onlysumitg/win_ibmigo

@JasonTashtego
Copy link

I needed 1.22 support so I've consolidated the mods mentioned above and put them under the control of a GOEXPERIMENT flag.
It is bootstrap-able with a Go 1.22 build from a supported platform. Details in the repo readme here:

https://github.com/JasonTashtego/go

Hopefully someone besides me can get some use out of it.

@stormalf
Copy link

I needed 1.22 support so I've consolidated the mods mentioned above and put them under the control of a GOEXPERIMENT flag. It is bootstrap-able with a Go 1.22 build from a supported platform. Details in the repo readme here:

https://github.com/JasonTashtego/go

Hopefully someone besides me can get some use out of it.

Hello, thanks all for your work on it. Based on your repo https://github.com/JasonTashtego succesfully compiled go on ibmi. Only one small remark, the tagptr_64bit.go should be updated too, to replace 0xa by 0x7 to work well without any memory issue. To avoid issue with unlinkat, I used //go build: !unix && !aix in removeall_at.go. Some issue with downloading go dependencies when trying to compile a go project with timeout on proxy.golang.org... Awesome and great community work!

@stormalf
Copy link

stormalf commented Dec 3, 2024

Hello, I tried to use go1.24 on IBMi but it fails with issue during garbage collector. As a workaround I can disable the garbage collector using export GOGC=off, at least I can compile the hello world example.
Does anyone know how to solve the segmenation issue on IBMi ?
Here the full log of the issue :

Building Go cmd/dist using /home/stormalf/go1.24. (devel go1.24-585f995 Sat Nov 30 13:09:43 2024 +0100 X:iseriesaix aix/ppc64)

internal/abi

SIGSEGV: segmentation violation
PC=0x100080044 m=3 sigcode=50 addr=0x2011b9a20

goroutine 0 gp=0x7000000483828c0 m=3 mp=0x700000048051008 [idle]:
runtime.getGCMaskOnDemand(0x100a59b80)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/type.go:108 +0x24 fp=0x18049c538 sp=0x18049c4d8 pc=0x100080044
runtime.getGCMask(...)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/type.go:86
runtime.(*mspan).typePointersOfUnchecked(0x70000004803b250?, 0x700000048c5cd40?)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mbitmap.go:200 +0x17c fp=0x18049c570 sp=0x18049c538 pc=0x1000142dc
runtime.scanobject(0x700000048100000, 0x70000004803b250)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mgcmark.go:1426 +0x9b4 fp=0x18049c648 sp=0x18049c570 pc=0x100025fd4
runtime.gcDrainN(0x70000004803b250, 0x10000)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mgcmark.go:1317 +0x220 fp=0x18049c688 sp=0x18049c648 pc=0x1000250f0
runtime.gcAssistAlloc1(0x7000000480021c0, 0x10000)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mgcmark.go:670 +0x194 fp=0x18049c6f0 sp=0x18049c688 pc=0x100023124
runtime.gcAssistAlloc.func2()
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mgcmark.go:561 +0x2c fp=0x18049c720 sp=0x18049c6f0 pc=0x100022f0c
runtime.systemstack(0x0)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/asm_ppc64x.s:256 +0x68 fp=0x18049c740 sp=0x18049c720 pc=0x10008e3b8

goroutine 1 gp=0x7000000480021c0 m=3 mp=0x700000048051008 [GC assist marking]:
runtime.systemstack_switch()
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/asm_ppc64x.s:213 +0x10 fp=0x700000048450fd0 sp=0x700000048450fb0 pc=0x10008e330
runtime.gcAssistAlloc(0x7000000480021c0)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mgcmark.go:560 +0x40c fp=0x700000048451068 sp=0x700000048450fd0 pc=0x100022acc
runtime.deductAssistCredit(0x70000004a684ec0?)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/malloc.go:1680 +0x64 fp=0x700000048451090 sp=0x700000048451068 pc=0x100012f94
runtime.mallocgc(...)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/malloc.go:1045
runtime.newobject(0x100aca180)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/malloc.go:1715 +0xa8 fp=0x7000000484510d8 sp=0x700000048451090 pc=0x100013108
cmd/compile/internal/noder.(*linker).relocCommon(0x70000004a5bb680, 0x7000000484221c0, 0x70000004a68d500, 0x6, 0x71)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/cmd/compile/internal/noder/linker.go:256 +0x6c fp=0x700000048451180 sp=0x7000000484510d8 pc=0x10098b7ec
cmd/compile/internal/noder.(*linker).relocObj(...)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/cmd/compile/internal/noder/linker.go:171
cmd/compile/internal/noder.(*linker).relocIdx(0x70000004a5bb680, 0x7000000484221c0, 0x6, 0x71)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/cmd/compile/internal/noder/linker.go:77 +0xbf8 fp=0x700000048451368 sp=0x700000048451180 pc=0x100989b78
cmd/compile/internal/noder.writeUnifiedExport({0x100c985d8, 0x70000004a5dfe00})
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/cmd/compile/internal/noder/unified.go:511 +0x5ec fp=0x700000048451808 sp=0x700000048451368 pc=0x1009aec3c
cmd/compile/internal/noder.WriteExports(0x70000004a5b9390)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/cmd/compile/internal/noder/export.go:20 +0x58 fp=0x700000048451890 sp=0x700000048451808 pc=0x100982698
cmd/compile/internal/gc.dumpCompilerObj(0x70000004a5b9390)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/cmd/compile/internal/gc/obj.go:109 +0x38 fp=0x7000000484518b8 sp=0x700000048451890 pc=0x1009e7238
cmd/compile/internal/gc.dumpobj1({0xffffffffffff53a, 0x2f}, 0x3)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/cmd/compile/internal/gc/obj.go:65 +0x154 fp=0x700000048451978 sp=0x7000000484518b8 pc=0x1009e6d04
cmd/compile/internal/gc.dumpobj()
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/cmd/compile/internal/gc/obj.go:46 +0x44 fp=0x7000000484519b0 sp=0x700000048451978 pc=0x1009e6b64
cmd/compile/internal/gc.Main(0x100b4c658)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/cmd/compile/internal/gc/main.go:354 +0x1904 fp=0x700000048451ec8 sp=0x7000000484519b0 pc=0x1009e65e4
main.main()
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/cmd/compile/main.go:57 +0x144 fp=0x700000048451f38 sp=0x700000048451ec8 pc=0x100a0f814
runtime.main()
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/proc.go:283 +0x328 fp=0x700000048451fc0 sp=0x700000048451f38 pc=0x10004a198
runtime.goexit({})
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/asm_ppc64x.s:1022 +0x4 fp=0x700000048451fc0 sp=0x700000048451fc0 pc=0x100090d94

goroutine 2 gp=0x700000048002700 m=nil [force gc (idle)]:
runtime.gopark(0x18012b900?, 0x18000bf40?, 0x0?, 0x0?, 0x0?)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/proc.go:435 +0x144 fp=0x70000004804c778 sp=0x70000004804c748 pc=0x100088f14
runtime.goparkunlock(...)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/proc.go:441
runtime.forcegchelper()
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/proc.go:348 +0xf0 fp=0x70000004804c7c0 sp=0x70000004804c778 pc=0x10004a5b0
runtime.goexit({})
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/asm_ppc64x.s:1022 +0x4 fp=0x70000004804c7c0 sp=0x70000004804c7c0 pc=0x100090d94
created by runtime.init.6 in goroutine 1
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/proc.go:336 +0x2c

goroutine 3 gp=0x7000000480028c0 m=nil [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/proc.go:435 +0x144 fp=0x700000048060f10 sp=0x700000048060ee0 pc=0x100088f14
runtime.goparkunlock(...)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/proc.go:441
runtime.bgsweep(0x700000048062000)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mgcsweep.go:276 +0xcc fp=0x700000048060f98 sp=0x700000048060f10 pc=0x10002c1dc
runtime.gcenable.gowrap1()
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mgc.go:204 +0x4c fp=0x700000048060fc0 sp=0x700000048060f98 pc=0x10001ca8c
runtime.goexit({})
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/asm_ppc64x.s:1022 +0x4 fp=0x700000048060fc0 sp=0x700000048060fc0 pc=0x100090d94
created by runtime.gcenable in goroutine 1
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mgc.go:204 +0x7c

goroutine 4 gp=0x700000048002e00 m=nil [runnable]:
runtime.gopark(0x700000048062000?, 0x100c93250?, 0x1?, 0x0?, 0x700000048002e00?)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/proc.go:435 +0x144 fp=0x70000004805ff28 sp=0x70000004805fef8 pc=0x100088f14
runtime.goparkunlock(...)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/proc.go:441
runtime.(*scavengerState).park(0x180129140)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mgcscavenge.go:425 +0x78 fp=0x70000004805ff68 sp=0x70000004805ff28 pc=0x1000292b8
runtime.bgscavenge(0x700000048062000)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mgcscavenge.go:653 +0x54 fp=0x70000004805ff98 sp=0x70000004805ff68 pc=0x1000298e4
runtime.gcenable.gowrap2()
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mgc.go:205 +0x4c fp=0x70000004805ffc0 sp=0x70000004805ff98 pc=0x10001ca2c
runtime.goexit({})
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/asm_ppc64x.s:1022 +0x4 fp=0x70000004805ffc0 sp=0x70000004805ffc0 pc=0x100090d94
created by runtime.gcenable in goroutine 1
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mgc.go:205 +0xc4

goroutine 5 gp=0x700000048002fc0 m=nil [finalizer wait]:
runtime.gopark(0x1500000000000000?, 0x70000000000bc90?, 0x0?, 0x0?, 0x98?)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/proc.go:435 +0x144 fp=0x70000004805ede0 sp=0x70000004805edb0 pc=0x100088f14
runtime.runfinq()
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mfinal.go:196 +0x124 fp=0x70000004805efc0 sp=0x70000004805ede0 pc=0x10001b834
runtime.goexit({})
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/asm_ppc64x.s:1022 +0x4 fp=0x70000004805efc0 sp=0x70000004805efc0 pc=0x100090d94
created by runtime.createfing in goroutine 1
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mfinal.go:166 +0x84

goroutine 22 gp=0x7000000480036c0 m=nil [GC worker (idle)]:
runtime.gopark(0x100ab44e0?, 0x2c?, 0x7?, 0x0?, 0xffffffffffff96a?)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/proc.go:435 +0x144 fp=0x70000004805dee0 sp=0x70000004805deb0 pc=0x100088f14
runtime.gcBgMarkWorker(0x700000049effce0)
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mgc.go:1423 +0x11c fp=0x70000004805df98 sp=0x70000004805dee0 pc=0x10001f63c
runtime.gcBgMarkStartWorkers.gowrap1()
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mgc.go:1339 +0x4c fp=0x70000004805dfc0 sp=0x70000004805df98 pc=0x10001f50c
runtime.goexit({})
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/asm_ppc64x.s:1022 +0x4 fp=0x70000004805dfc0 sp=0x70000004805dfc0 pc=0x100090d94
created by runtime.gcBgMarkStartWorkers in goroutine 1
/home/stormalf/go_ibmi/go-aix-ppc64-bootstrap/src/runtime/mgc.go:1339 +0x198

r0 0x0 r1 0x18049c4d8
r2 0x1800f8810 r3 0x100a59b80
r4 0x700000048100000 r5 0x20000
r6 0x2011b9a20 r7 0x100a59b80
r8 0x10 r9 0xf900000000000000
r10 0x70000000000a390 r11 0x400000
r12 0x18015d858 r13 0x1804a4800
r14 0x1ea000 r15 0x0
r16 0x20000 r17 0x400000
r18 0x180167000 r19 0x1
r20 0x70000004697063d r21 0x40
r22 0x18039ce30 r23 0x18049c5f0
r24 0x1 r25 0x85f5fdb3f
r26 0x83a73bf5a r27 0x145f6c22
r28 0x5b7c84e1 r29 0x70000004803b9d8
r30 0x7000000483828c0 r31 0x1000142dc
pc 0x100080044 ctr 0x0
link 0x1000142dc xer 0x20040000
ccr 0x44420004 trap 0x0
Do you have an idea @rfx77 ?

@mknyszek
Copy link
Contributor

mknyszek commented Dec 3, 2024

@stormalf that's a different issue, see #70483.

@stormalf
Copy link

stormalf commented Dec 3, 2024

@stormalf that's a different issue, see #70483.

Many thanks!

@JasonTashtego
Copy link

Hello, thanks all for your work on it. Based on your repo https://github.com/JasonTashtego succesfully compiled go on ibmi. >Only one small remark, the tagptr_64bit.go should be updated too, to replace 0xa by 0x7 to work well without any memory issue. >To avoid issue with unlinkat, I used //go build: !unix && !aix in removeall_at.go. Some issue with downloading go dependencies >when trying to compile a go project with timeout on proxy.golang.org... Awesome and great community work!

@stormalf -- Good to see someone else using it! I believe the tagptr_64bit.go change is in the first commit to the branch.
https://github.com/JasonTashtego/go/tree/release-branch.go1.22
da3e9e0

Did you find another change necessary in that file ?

@stormalf
Copy link

Hello @JasonTashtego you're right, it was the change that I was looking for. Thanks. About the issue with go dependencies, I found that it was caused by /etc/resolv.conf that should be created. Not sure why, but go dependencies failed until I created the /etc/resolv.conf and specifying the nameserver field. The go version 1.24 is working fine on IBMi (by disabling for now the garbage collector). I will try to compile some go projects to check if we can have it running also on IBMi like grafana...

@vmlemon
Copy link

vmlemon commented Dec 21, 2024

Looks like I can try to build this, on Linux (technically, Ubuntu/WSL2), and it gets as far as starting to build the tests, but if I actually try to use the built toolchain, it bails out, with go: unknown GOEXPERIMENT iseriesaix. I guess I've done something wrong, since I've never tried to build a GoLang toolchain, from source, before?

@stormalf
Copy link

stormalf commented Dec 22, 2024

Hello @vmlemon, did you follow the instructions I detailed here : https://github.com/stormalf/go_ibmi ? I remembered having the same issue due to missing changes in files in ../goexperiment folder. Let me know if it helps.

@vmlemon
Copy link

vmlemon commented Dec 22, 2024

Hello @vmlemon, did you follow the instructions I detailed here : https://github.com/stormalf/go_ibmi ? I remembered having the same issue due to missing changes in files in ../goexperiment folder. Let me know if it helps.

Thanks, I'll have a look, and let you know. I thought it was due to being on the wrong branch, but I still received it, even on release-branch.go1.22.

@stormalf
Copy link

I think I had the same issue on my first tries with branch release 1.22, that's why I tried to include all changes in the repo (not 100% the same as Jason probably 95%) and detail each step. It will be interesting to see if you will succeed by following the steps provided. Good luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: Triage Backlog
Development

No branches or pull requests