Another weird LLVM mystery solved!

So, I was porting LDC to FreeBSD/aarch64, wondering why global constructors (you know, the before-main() code you can make in C using an __attribute__ thingy) aren't running… but only when the executable is linked with LLD. Turns out:

  • .init_array is the only supported way to do constructors on AArch64
  • and everything in general is moving towards .init_array — but the default in LLVM is still to emit .ctors
  • clang has code to enable .init_array when appropriate, ldc did not
  • and the reason it all worked fine with bfd and gold is that these linkers SILENTLY convert .ctors to .init_array. For PERFORMANCE REASONS.

It's almost 2019, so using a SATA SSD as the boot drive for your main development OS is not cool anymore… and I was running out of space on this 128gb one, so I bought an NVMe drive to replace it. Yay.

Because I don't have anything with two or more M.2 slots and I was too lazy to find/make a bootable FreeBSD USB drive, moving the system involved inserting the new drive into another machine (server) and using ZFS replication to copy the data. (And forgetting to set bootfs on the pool, of course.)

But the fun part was that my 10G network card stopped working. Moving the card into the middle slot (from the bottom one) fixed it. Reported a FreeBSD bug.

The weirdest discovery of the day though was that MSI mainboards persist the "above 4G" PCIe setting across CMOS clears. What in the actual heck. This is the setting that breaks display output on most GPUs (funnily enough, mine did display non-EFI things such as the network card's boot prompt and the glitchy way FreeBSD displays the console when booting on UEFI with the EFI framebuffer disabled). It's a setting you very much need to clear.

Finally got around to actually trying out ZeroTier. It's pretty awesome!

Okay, it has a couple downsides:

  • it's not automatically a mesh network, you have to designate a node as a "moon" to make it pass traffic between other nodes (that couldn't punch holes through NAT)
  • the Android client is not open source and doesn't have UI to tell it to orbit a moon

But other than that… the simplicity is lovely. No screwing around with config files, restarts and whatnot. Just a very small & easy set of admin commands. And automatic IP address assignment (especially 6PLANE) is amazing.

Scaleway's ARM64 VPS has been successfully depenguinated! :) Now you can run FreeBSD on four ThunderX cores, 2GB RAM and 50GB SSD for 3€/month. Awesome!

Also, in the process, I finally discovered the cause of GPT partitions sometimes disappearing on reboot. It was the size of the partition table. It's 128 by default, but sometimes it's not — e.g. on the FreeBSD installer memstick image, it's 2. Creating a third partition with gpart "succeeded", but the partition disappeared on reboot.

Building a reader on your website is not too hard when you already have webmention processing (so you have code to parse entries and whatnot). So I kinda have one now. There's even some Microsub support, but that's not complete yet.

There's a funny bug in my feed fetching though: OAuth for the open web is always on top of the feed (its published date gets set to feed fetch time every time) :D

Screenshot of htop with 96 CPU cores

For 0.5 dollars per hour (or currently 0.1/hr if you reserve for 24h?) on packet.net you can get access to a dedicated dual-socket Cavium ThunderX server with 128GB RAM and a 250GB SSD. I took it for a few hours and now lang/crystal, lang/mono and some other ports work on aarch64.

Ironically, these two builds have involved long single-threaded compile processes. In the mono case, parallelism had to be disabled for C# compilation to work around a concurrency bug.

At least building things like WebKitGTK+ (to test a one line patch) and Krita felt awesome :D

I was wondering why replies sent with the Omnibear Micropub browser extension ended up with the URL /replies/ instead of the auto generated slug. Turns out Omnibear sends mp-slug="" and my server happily accepted the empty slug :D

I rewrote micro-panel (the "admin panel" for this site) from scratch with LitElement and no material design components. It's really tiny now! The minified bundle is 57kb (and that still includes a code editor with syntax highlighting). The previous version was nearly 1mb.

Also, the new version is a bit simplified: no iframe mode, only cookie auth. And it doesn't wrap the whole page in an element, it's now more of a set of elements.

Check out this piece of code, by the way:

async close () {
  if ('animate' in this && 'finished' in Animation.prototype) {
    await this.animate({transform: ['none', 'translateY(100vh)']},
      {duration: 300, easing: 'ease-out'}).finished
  }
  this.hidden = true
}

I was wondering why a lot of Chinese spam was ending up in my inbox.

$ grep qq.com -lr . | uniq | xargs rspamc learn_spam

Turns out, because these spam mails don't really have bodies, most of them weren't learned as spam in rspamd's bayes classifier, and they weren't considered spammy enough:

HTTP error: 400, <...@qq.com> contains less tokens than required for bayes classifier: 2 < 11

BREAKING FreeBSD NEWS: AMDGPU DC works!

The 4.15 drm update apparently did not have amdgpu working yet... but I tried it anyway, since that's just an assertion failure.

Well... it does work. Even with DC (compat.linuxkpi.dc="1")! Weston didn't work at first, but commenting out its "Disable all the planes" section that was causing a kernel warning solved the problem.

So quite possibly we have Vega support?

lol, just as I set up Travis CI for a Swift project, swift.org went down and the CI script can't download the compiler binaries

Booted into FreeBSD, launched Epiphany (GNOME Web), noticed slowness. Opened htop: 800-1200% load in kernel! Ran dtrace to find hot kernel stacks: it's all ZFS write threads, trying to compress. WTF? I mean, my fault for choosing gzip (I have a tiny SSD for this system, want max compression), but I expect zero I/O right now?! Found a DTrace script to show file I/O.

Turns out Epiphany is constantly writing to and reading from ~/.config/epiphany/gsb-threats.db. Yeah, it was downloading the whole Google Safe Browsing database.

I guess that's the most privacy-friendly way to do Safe Browsing, but wow, that's a very surprising behavior. What if I had, like, a dial-up connection or something? :D

Wow, Lollypop is an excellent GTK+ music player. Album-oriented, just like I prefer. iTunes-inspired in some design elements. Nice. I just wish it was an MPD client.

Discovery of the day: Blender has an SDL2 backend, just build it with -DWITH_GHOST_SDL=ON. If you also have GLEW built for Wayland…

Blender will run on Wayland!

Well, "run" — the window is glitchy as hell. The best thing though is that these glitches showed Dungeon Crawl Stone Soup tiles to me (since I launched DCSS before to test SDL — for some reason I had to downgrade to 2.0.7 to run most apps on Wayland.)