go-llvm / llgo

LLVM-based compiler for Go
Other
1.25k stars 81 forks source link

Implement PPAPI for PNaCl #37

Open axw opened 11 years ago

axw commented 11 years ago

A while ago I did some work to show that llgo is capable of generating PNaCl modules. As a result of that, I began working on a PPAPI package for Go.

The blog post's instructions are no longer valid, and the PPAPI package no longer works with the go1.1 changes in llgo (chiefly due to function representation changes, and possibly due to breakage in runtime type information).

hzmangel commented 11 years ago

I have met missing function body error while doing go build under directory llgo/pkg/nacl/ppapi, and I have found one solution for this: https://codereview.appspot.com/7857044/patch/16001/3002

I think the code related to this error is http://golang.org/src/cmd/gc/pgen.c, at line 36, the error raised if compiling pure go function, so the empty.c is used to false this condition.

I am still a newbie of Go, and I am still learning. Hope this can give some help.

axw commented 11 years ago

Thanks. Yes, for pure-Go packages the standard Go compiler ensures that all function declarations have a corresponding definition.

Your solution is sound, but I've just been stubbing out the function; IIRC it was just one function, createModule. I'll probably be adding some C code to that package in the coming days anyway.

Ideally we wouldn't be relying on there being a binary version of the package at all, but it's necessary until a custom go/types importer is implemented.