<p>Did anyone tried to compile Go code to llvm bitcode and then to javascript?</p>
<p>I can't use gopherjs because my library uses CGO, and C code already supports emscripten (includes emscripten.h where necessary etc.).</p>
<p>I managed to compile emscripten fork of llvm/clang with latest llgo from svn (it is moved to llvm.org), and I can get bitcode like this <em>llgo -c -emit-llvm hello.go -o hello.bc</em></p>
<p>But <em>emcc hello.bc -o hello.js</em> then complains about different targets/triples , asmjs-unknown-emscripten vs x86_64-linux-unknown .</p>
<p>Is something like this possible? I only found some info about llvm that in theory it should be possible.</p>
<hr/>**评论:**<br/><br/>allowthere: <pre><p><a href="http://llvm.org/svn/llvm-project/llgo/trunk/README.TXT" rel="nofollow">http://llvm.org/svn/llvm-project/llgo/trunk/README.TXT</a></p>
<blockquote>
<p>llgo is currently only supported on the x86-64 Linux platform. Contributions
that add support for other platforms are welcome.</p>
</blockquote>
<p>There are two components which would need to be ported to new platforms: the
compiler and the runtime library. The compiler has little platform-specific
code; the most significant is in irgen/cabi.go. The main limiting factor
for new platforms is the runtime library in third_party/gofrontend/libgo,
which inherits some support for other platforms from the gc compiler's
runtime library, but this support tends to be incomplete.</p></pre>umpahblah: <pre><p>Thanks, I missed to read that README.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传