<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Tinygo on Miek Gieben</title>
    <link>https://miek.nl/tags/tinygo/</link>
    <description>Recent content in Tinygo on Miek Gieben</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <copyright>© Copyright 2007-2024 Miek Gieben</copyright>
    <lastBuildDate>Mon, 28 Oct 2024 15:47:08 +0200</lastBuildDate>
    <atom:link href="https://miek.nl/tags/tinygo/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>eBPF from Go - IV - Code generation</title>
      <link>https://miek.nl/2024/october/28/ebpf-from-go-iv-code-generation/</link>
      <pubDate>Mon, 28 Oct 2024 15:47:08 +0200</pubDate>
      <guid>https://miek.nl/2024/october/28/ebpf-from-go-iv-code-generation/</guid>
      <description>&lt;p&gt;Played more with TinyGo, but it always generates code for (minimal) reflection - i.e. the &lt;code&gt;reflect&lt;/code&gt;&#xA;package, because it requires that for its &lt;code&gt;map&lt;/code&gt; implementation. I could skip or not generate that,&#xA;but then that would mean using a map would be &amp;hellip; weird? Anyhow it looked that even TinyGo does too&#xA;much for eBPF. So plan D: generate eBPF code (and Go code) using Go. Cilium has done a lot of work&#xA;in this regard.&lt;/p&gt;</description>
    </item>
    <item>
      <title>eBPF from Go - III - Reducing the SSA</title>
      <link>https://miek.nl/2024/september/30/ebpf-from-go-iii-reducing-the-ssa/</link>
      <pubDate>Mon, 30 Sep 2024 15:47:08 +0200</pubDate>
      <guid>https://miek.nl/2024/september/30/ebpf-from-go-iii-reducing-the-ssa/</guid>
      <description>&lt;p&gt;Again some progress. I&amp;rsquo;m mostly focussing on removing code from the SSA representation&#xA;(&lt;code&gt;-internal-dumpssa&lt;/code&gt;), so that I can work with a clean slate. As BPF is so limited almost none of&#xA;the features from Go make sense, although in some far fetched future it would be super cool to have&#xA;channels and goroutines to something in BPF - but not today. First need to get to &amp;ldquo;Hello World&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;m building this code:&lt;/p&gt;</description>
    </item>
    <item>
      <title>eBPF from Go - II</title>
      <link>https://miek.nl/2024/august/30/ebpf-from-go-ii/</link>
      <pubDate>Fri, 30 Aug 2024 15:47:08 +0200</pubDate>
      <guid>https://miek.nl/2024/august/30/ebpf-from-go-ii/</guid>
      <description>&lt;p&gt;Following up from the previous blog post&amp;hellip; I&amp;rsquo;ve got a JSON file with the string &amp;lsquo;bpf&amp;rsquo; in the&#xA;correct place. Let&amp;rsquo;s see what tinygo thinks of that:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;% ./build/tinygo build -o miekg/main.bpf -target bpf ./miekg/main.go&#xA;No available targets are compatible with triple &amp;quot;bpf-unknown-unknown&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;code&gt;clang&lt;/code&gt; indeed does not list bpf as a valid target, so this needs to be added.&lt;/p&gt;&#xA;&lt;p&gt;The llvm build is configured from the main&#xA;&lt;a href=&#34;https://github.com/tinygo-org/tinygo/blob/release/GNUmakefile&#34;&gt;GNUMakefile&lt;/a&gt;, with&#xA;&lt;code&gt;-DLLVM_TARGETS_TO_BUILD...&lt;/code&gt;. Using grep and find I found the &amp;ldquo;llvm/test/CodeGen&amp;rdquo; directory, which,&#xA;in addition to all listed targets also has a BPF directory. Let&amp;rsquo;s add BPF to that list and recompile.&lt;/p&gt;</description>
    </item>
    <item>
      <title>eBPF from Go; First Steps</title>
      <link>https://miek.nl/2024/august/29/ebpf-from-go-first-steps/</link>
      <pubDate>Thu, 29 Aug 2024 20:04:35 +0200</pubDate>
      <guid>https://miek.nl/2024/august/29/ebpf-from-go-first-steps/</guid>
      <description>&lt;p&gt;So I had this itch that I wanted to make a Go program compile to eBPF and be able to load that&#xA;program in the Linux kernel by use of &lt;code&gt;bpftool&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As I &lt;a href=&#34;https://github.com/miekg/ebpf/blob/main/README.md&#34;&gt;say in github.com/miekg/ebpf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;eBPF in C? What am I, a farmer?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;After much reading about eBPF and thinking about how that would work from Go, I figured that would&#xA;involve writing a Go compiler.&lt;/p&gt;&#xA;&lt;p&gt;So I could:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;hack the official Go compiler and (try to) add a eBPF target (which would probably never&#xA;be added as an official target because of all the constraints eBPF has).&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
