9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] Go: "exec header invalid"
@ 2022-03-13 19:40 sml
  2022-03-13 21:10 ` cinap_lenrek
  2022-03-13 23:59 ` ori
  0 siblings, 2 replies; 13+ messages in thread
From: sml @ 2022-03-13 19:40 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

Hi, 

I tried to build Go according to the instructions on https://9lab.org/plan9/go/ <https://9lab.org/plan9/go/>.

I’m running the pi3 image of 9front on a Raspberry 4 and try to bootstrap the Go source 1.17.8 with the binary "Go 1.17.6 on plan9/arm (ARMv7)“ from 9legacy.org <http://9legacy.org/>. 

When I try to run:

./make.rc

I get this message:

Building Go cmd/dist using /tmp/go-plan9-arm-bootstrap
/tmp/go-plan9-arm-bootstrap/bin/go: exec header invalid

Does anyone have any idea what I'm doing wrong?

Thank you very much and best regards, 
sml

[-- Attachment #2: Type: text/html, Size: 1272 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] Go: "exec header invalid"
  2022-03-13 19:40 [9front] Go: "exec header invalid" sml
@ 2022-03-13 21:10 ` cinap_lenrek
  2022-03-14  6:37   ` sml
  2022-03-13 23:59 ` ori
  1 sibling, 1 reply; 13+ messages in thread
From: cinap_lenrek @ 2022-03-13 21:10 UTC (permalink / raw)
  To: 9front

no surprise. the pi3 and pi4 kernels are arm64 (armv8).

--
cinap

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] Go: "exec header invalid"
  2022-03-13 19:40 [9front] Go: "exec header invalid" sml
  2022-03-13 21:10 ` cinap_lenrek
@ 2022-03-13 23:59 ` ori
  1 sibling, 0 replies; 13+ messages in thread
From: ori @ 2022-03-13 23:59 UTC (permalink / raw)
  To: 9front

Quoth sml <sml@firstpost.pub>:
> Hi, 
> 
> I tried to build Go according to the instructions on https://9lab.org/plan9/go/ <https://9lab.org/plan9/go/>.
> 
> I’m running the pi3 image of 9front on a Raspberry 4 and try to bootstrap the Go source 1.17.8 with the binary "Go 1.17.6 on plan9/arm (ARMv7)“ from 9legacy.org <http://9legacy.org/>. 
> 
> When I try to run:
> 
> ./make.rc
> 
> I get this message:
> 
> Building Go cmd/dist using /tmp/go-plan9-arm-bootstrap
> /tmp/go-plan9-arm-bootstrap/bin/go: exec header invalid
> 
> Does anyone have any idea what I'm doing wrong?
> 

At a guess, you're trying to run a 32 bit arm binary
on a 64 bit 9front. Go currently doesn't support arm64.

I expect that it won't be a huge effort to change that,
but nobody has done the work yet.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] Go: "exec header invalid"
  2022-03-13 21:10 ` cinap_lenrek
@ 2022-03-14  6:37   ` sml
  2022-03-14 10:47     ` sml
  2022-03-14 15:18     ` ori
  0 siblings, 2 replies; 13+ messages in thread
From: sml @ 2022-03-14  6:37 UTC (permalink / raw)
  To: 9front

thank you cinap and Ori. 

what steps would be required to add support to armv8? would this be a good beginner project? 

if this is not the case, would it be possible to add a bounty?

thank you and best regards, 
sml


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] Go: "exec header invalid"
  2022-03-14  6:37   ` sml
@ 2022-03-14 10:47     ` sml
  2022-03-14 15:18     ` ori
  1 sibling, 0 replies; 13+ messages in thread
From: sml @ 2022-03-14 10:47 UTC (permalink / raw)
  To: 9front

when trying to cross-compile a toolchain for plan9/arm64 i get the message:

cmd/go: unsupported GOOS/GOARCH pair plan9/arm64
go tool dist: FAILED: /usr/local/Cellar/go/1.17/go-plan9-arm64-bootstrap/pkg/tool/darwin_amd64/go_bootstrap install -gcflags=all= -ldflags=all= std cmd: exit status 2

but as Ori said, there is no support for plan9/arm64 listed on https://go.dev/doc/install/source.


> Am 14.03.2022 um 07:37 schrieb sml <sml@firstpost.pub>:
> 
> thank you cinap and Ori. 
> 
> what steps would be required to add support to armv8? would this be a good beginner project? 
> 
> if this is not the case, would it be possible to add a bounty?
> 
> thank you and best regards, 
> sml
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] Go: "exec header invalid"
  2022-03-14  6:37   ` sml
  2022-03-14 10:47     ` sml
@ 2022-03-14 15:18     ` ori
  2022-03-15  6:19       ` sml
  1 sibling, 1 reply; 13+ messages in thread
From: ori @ 2022-03-14 15:18 UTC (permalink / raw)
  To: 9front

Quoth sml <sml@firstpost.pub>:
> thank you cinap and Ori. 
> 
> what steps would be required to add support to armv8? would this be a good beginner project? 
> 
> if this is not the case, would it be possible to add a bounty?
> 
> thank you and best regards, 
> sml
> 

It wouldn't be particularly difficult -- arm64 support
already exists for unix; the bulk of the work would be
to add the plan 9 flavored assembly for doing system
calls.

Between a week for someone who's vaguely familiar with
the code to a month or two for someone learning about
the go internals as they go, at a guess.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] Go: "exec header invalid"
  2022-03-14 15:18     ` ori
@ 2022-03-15  6:19       ` sml
  2022-03-15 11:15         ` Philip Silva
  0 siblings, 1 reply; 13+ messages in thread
From: sml @ 2022-03-15  6:19 UTC (permalink / raw)
  To: 9front

Again, thank you very much Ori. 

This doesn't sound that simple to me, but it may be a good opportunity to understand both plan 9 and go a little better. If anyone knows of any helpful resources on this, I would appreciate a quick note. 

Thank you and best regards, 
sml


> Am 14.03.2022 um 16:18 schrieb ori@eigenstate.org:
> 
> Quoth sml <sml@firstpost.pub>:
>> thank you cinap and Ori. 
>> 
>> what steps would be required to add support to armv8? would this be a good beginner project? 
>> 
>> if this is not the case, would it be possible to add a bounty?
>> 
>> thank you and best regards, 
>> sml
>> 
> 
> It wouldn't be particularly difficult -- arm64 support
> already exists for unix; the bulk of the work would be
> to add the plan 9 flavored assembly for doing system
> calls.
> 
> Between a week for someone who's vaguely familiar with
> the code to a month or two for someone learning about
> the go internals as they go, at a guess.
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] Go: "exec header invalid"
  2022-03-15  6:19       ` sml
@ 2022-03-15 11:15         ` Philip Silva
  2022-03-15 16:32           ` Kurt H Maier
  2022-03-16  7:43           ` sml
  0 siblings, 2 replies; 13+ messages in thread
From: Philip Silva @ 2022-03-15 11:15 UTC (permalink / raw)
  To: 9front

Actually there's also a 500$ bounty for this

http://fqa.9front.org/appendixb.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] Go: "exec header invalid"
  2022-03-15 11:15         ` Philip Silva
@ 2022-03-15 16:32           ` Kurt H Maier
  2022-03-16  7:43           ` sml
  1 sibling, 0 replies; 13+ messages in thread
From: Kurt H Maier @ 2022-03-15 16:32 UTC (permalink / raw)
  To: 9front

On Tue, Mar 15, 2022 at 11:15:50AM +0000, Philip Silva wrote:
> Actually there's also a 500$ bounty for this
> 
> http://fqa.9front.org/appendixb.html

I wonder if all the contributors to that bounty are still interested.

khm

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] Go: "exec header invalid"
  2022-03-15 11:15         ` Philip Silva
  2022-03-15 16:32           ` Kurt H Maier
@ 2022-03-16  7:43           ` sml
  2022-03-16 15:16             ` ori
  2022-03-16 19:29             ` Steve Simon
  1 sibling, 2 replies; 13+ messages in thread
From: sml @ 2022-03-16  7:43 UTC (permalink / raw)
  To: 9front

> Am 15.03.2022 um 12:15 schrieb Philip Silva <philip.silva@protonmail.com>:
> 
> Actually there's also a 500$ bounty for this
> 
> http://fqa.9front.org/appendixb.html

I would like to add 50$ for this.


At the moment, I’m trying to understand how plan9/arm is implemented, to get an idea what needs to be done for plan9/arm64. 

As far as I understand,  /src/syscall/mksysnum_plan9.sh in go is used to get the information from /src/libc/9syscall/sys.h from plan9, using it in /src/syscall/zsysnum_plan9.go and at the beginning of /src/runtime/sys_plan9_arm.s.

/src/runtime/defs_plan9_arm.go is the information from /arm/include/ureg.h with getter and setter functions.

But there are files like:
	/src/runtime/os_plan9_arm.go
	/src/runtime/rt0_plan9_arm.s
	/src/runtime/sys_plan9_arm.s (the part below the sysnums)
	/src/syscall/asm_plan9_arm.s
	/src/syscall/syscall_plan9.go
	/src/syscall/zsyscall_plan9_arm.go
for which I cannot find the source in the plan9 code.

Is there documentation about the go code itself, regarding the machine dependent parts?

And do you know where I can find the plan9 counterparts to some of the files listed above?

Thank you very much in advance!

Best regards, 
sml


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] Go: "exec header invalid"
  2022-03-16  7:43           ` sml
@ 2022-03-16 15:16             ` ori
  2022-03-16 17:01               ` cinap_lenrek
  2022-03-16 19:29             ` Steve Simon
  1 sibling, 1 reply; 13+ messages in thread
From: ori @ 2022-03-16 15:16 UTC (permalink / raw)
  To: 9front

Quoth sml <sml@firstpost.pub>:
> > Am 15.03.2022 um 12:15 schrieb Philip Silva <philip.silva@protonmail.com>:
> > 
> > Actually there's also a 500$ bounty for this
> > 
> > http://fqa.9front.org/appendixb.html
> 
> I would like to add 50$ for this.
> 
> 
> At the moment, I’m trying to understand how plan9/arm is implemented, to get an idea what needs to be done for plan9/arm64. 
> 
> As far as I understand,  /src/syscall/mksysnum_plan9.sh in go is used to get the information from /src/libc/9syscall/sys.h from plan9, using it in /src/syscall/zsysnum_plan9.go and at the beginning of /src/runtime/sys_plan9_arm.s.
> 
> /src/runtime/defs_plan9_arm.go is the information from /arm/include/ureg.h with getter and setter functions.

There's no direct translation for most of them.
> 
> But there are files like:
> 	src/runtime/os_plan9_arm.go

	This just looks like it papers over the
	fact that arm32 has no cycle counter;
	not sure if arm64 has it -- if it does,
	we should use it, if not, we should keep
	this hack.

> 	src/runtime/rt0_plan9_arm.s

	This code jumps into the runtime, after
	setting up the arguments in a way that
	rt0_go expects. Roughly the equivalent
	of /sys/src/libcarm64/main9.s, though
	the work is split differently, and go
	does a lot more.

> 	/ src/runtime/sys_plan9_arm.s (the part below the sysnums)

	this is the glue that the go runtime uses to
	talk to the OS; a thin abstraction layer over
	the system calls.

> 	/src/syscall/asm_plan9_arm.s

	A generic wrapper to do syscalls. Plan 9
	has a wrapper per syscall, generated in
	/sys/src/libc/9syscall/mkfile, go has
	a generic 'Syscall(num, args...)' func.

> 	/src/syscall/syscall_plan9.go

	The actual syscall package -- it's not arm
	specific, so you shouldn't need to touch it.

> 	/src/syscall/zsyscall_plan9_arm.go

	Looks like generated code, don't see why it'd
	need to be adjusted, since our types are the
	same across all archs.

> for which I cannot find the source in the plan9 code.
> 
> Is there documentation about the go code itself, regarding the machine dependent parts?

Read the code, read the comments, ask quesstions. Not aware of
any good docs.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] Go: "exec header invalid"
  2022-03-16 15:16             ` ori
@ 2022-03-16 17:01               ` cinap_lenrek
  0 siblings, 0 replies; 13+ messages in thread
From: cinap_lenrek @ 2022-03-16 17:01 UTC (permalink / raw)
  To: 9front

use plan9 libc as a reference. it has the assembly for
reading the user accessible cycle counter for example.

--
cinap

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] Go: "exec header invalid"
  2022-03-16  7:43           ` sml
  2022-03-16 15:16             ` ori
@ 2022-03-16 19:29             ` Steve Simon
  1 sibling, 0 replies; 13+ messages in thread
From: Steve Simon @ 2022-03-16 19:29 UTC (permalink / raw)
  To: 9front


i would ask in gonuts google group, and ask richard miller who did the plan9 arm32 port i believe - they are likely to be able tobhelp.

-Steve




> On 16 Mar 2022, at 5:07 pm, sml <sml@firstpost.pub> wrote:
> 
> 
>> 
>> Am 15.03.2022 um 12:15 schrieb Philip Silva <philip.silva@protonmail.com>:
>> 
>> Actually there's also a 500$ bounty for this
>> 
>> http://fqa.9front.org/appendixb.html
> 
> I would like to add 50$ for this.
> 
> 
> At the moment, I’m trying to understand how plan9/arm is implemented, to get an idea what needs to be done for plan9/arm64. 
> 
> As far as I understand,  /src/syscall/mksysnum_plan9.sh in go is used to get the information from /src/libc/9syscall/sys.h from plan9, using it in /src/syscall/zsysnum_plan9.go and at the beginning of /src/runtime/sys_plan9_arm.s.
> 
> /src/runtime/defs_plan9_arm.go is the information from /arm/include/ureg.h with getter and setter functions.
> 
> But there are files like:
>    /src/runtime/os_plan9_arm.go
>    /src/runtime/rt0_plan9_arm.s
>    /src/runtime/sys_plan9_arm.s (the part below the sysnums)
>    /src/syscall/asm_plan9_arm.s
>    /src/syscall/syscall_plan9.go
>    /src/syscall/zsyscall_plan9_arm.go
> for which I cannot find the source in the plan9 code.
> 
> Is there documentation about the go code itself, regarding the machine dependent parts?
> 
> And do you know where I can find the plan9 counterparts to some of the files listed above?
> 
> Thank you very much in advance!
> 
> Best regards, 
> sml
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-03-17  9:08 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-13 19:40 [9front] Go: "exec header invalid" sml
2022-03-13 21:10 ` cinap_lenrek
2022-03-14  6:37   ` sml
2022-03-14 10:47     ` sml
2022-03-14 15:18     ` ori
2022-03-15  6:19       ` sml
2022-03-15 11:15         ` Philip Silva
2022-03-15 16:32           ` Kurt H Maier
2022-03-16  7:43           ` sml
2022-03-16 15:16             ` ori
2022-03-16 17:01               ` cinap_lenrek
2022-03-16 19:29             ` Steve Simon
2022-03-13 23:59 ` ori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).