Nick Desaulniers

The enemy's gate is down

Sep 5, 2017 - 2 minute read - Comments - clang gcc git llvm

GCC vs LLVM Q3 2017 Commit Rates and Active Developer Counts

A blog post from a few years ago that really stuck with me was Martin Olsson’s Browser Engines 2015: Commit Rates and Active Developer Counts, where he shows information about the number of authors and commits to popular web browsers. The graphs and analysis had interesting takeaways like showing the obvious split in blink and webkit, and relative number of contributors of the projects. Martin had data comparing gcc to llvm from Q4 2015, but I wanted to see what the data looked like now in Q3 2017 and wanted to share my findings; simply rerunning the numbers.

May 31, 2017 - 3 minute read - Comments - static analysis clang-tidy linux llvm

Running Clang-Tidy on the Linux Kernel

Clang-Tidy is a linter from the LLVM ecosystem. I wanted to try to run it on the Linux kernel to see what kind of bugs it would find. The false positive rate seems pretty high (a persistent bane to static analysis), but some patching in both the tooling and the source can likely help bring this rate down. The most straightforward way to invoke Clang-Tidy is with a compilation database, which is a json based file that for each translation unit records

May 16, 2017 - 6 minute read - Comments - linux patch email

Submitting Your First Patch to the Linux Kernel and Responding to Feedback

After working on the Linux kernel for Nexus and Pixel phones for nearly a year, and messing around with the excellent Eudyptula challenge, I finally wanted to take a crack at submitting patches upstream to the Linux kernel. This post is woefully inadequate compared to the existing documentation, which should be preferred. http://elixir.free-electrons.com/linux/latest/source/Documentation/process https://kernelnewbies.org/FirstKernelPatch I figure I’d document my workflow, now that I’ve gotten a few patches accepted (and so I can refer to this post rather than my shell history…).

Nov 20, 2016 - 12 minute read - Comments - C C++ library linkage

Static and Dynamic Libraries

This is the second post in a series on memory segmentation. It covers working with static and dynamic libraries in Linux and OSX. Make sure to check out the first on object files and symbols. Let’s say we wanted to reuse some of the code from our previous project in our next one. We could continue to copy around object files, but let’s say we have a bunch and it’s hard to keep track of all of them.

Aug 13, 2016 - 8 minute read - Comments - C C++ debugging

Object Files and Symbols

What was supposed to be one blog post about memory segmentation turned into what will be a series of posts. As the first in the series, we cover the extreme basics of object files and symbols. In follow up posts, I plan to talk about static libraries, dynamic libraries, dynamic linkage, memory segments, and finally memory usage accounting. I also cover command line tools for working with these notions, both in Linux and OSX.

Jul 1, 2016 - 3 minute read - Comments - ARM Android C C++ cross compile

Cross Compiling C/C++ for Android

Let’s say you want to build a hello world command line application in C or C++ and run it on your Android phone. How would you go about it? It’s not super practical; apps visible and distributable to end users must use the framework (AFAIK), but for folks looking to get into developing on ARM it’s likely they have an ARM device in their pocket. This post is for folks who typically invoke their compiler from the command line, either explicitly, from build scripts, or other forms of automation.

Jun 18, 2016 - 2 minute read - Comments - gmail mutt ubuntu

Setting up mutt with gmail on Ubuntu

I was looking to set up the mutt email client on my Ubuntu box to go through my gmail account. Since it took me a couple of hours to figure out, and I’ll probably forget by the time I need to know again, I figure I’d post my steps here. I’m on Ubuntu 16.04 LTS (lsb_release -a) Install mutt: $ sudo apt-get install mutt In gmail, allow other apps to access gmail:

May 30, 2016 - 6 minute read - Comments - C data model

Data Models and Word Size

This post is a follow up to my previous blog post about word size. Three C/C++ programmers walk into a bar. One argues that sizeof(void*) is equivalent to sizeof(long), one argues that sizeof(void*) is equivalent to sizeof(int), and the third argues it’s sizeof(long long). Simultaneously, they’re all right, but they’re also all wrong (and need a lesson about portable C code). What the hell is going on? One of the first few programs a programmer might write after hello world is something like this:

May 15, 2016 - 4 minute read - Comments - assembly data model x86

What's in a Word?

Recently, there some was some confusion between myself and a coworker over the definition of a “word.” I’m currently working on a blog post about data alignment and figured it would be good to clarify some things now, that we can refer to later. Having studied computer engineering and being quite fond of processor design, when I think of a “word,” I think of the number of bits wide a processor’s general purpose registers are (aka word size).

Jan 20, 2016 - 5 minute read - Comments - asm dtrace lldb osx x86

Intro to Debugging X86-64 Assembly

I’m hacking on an assembly project, and wanted to document some of the tricks I was using for figuring out what was going on. This post might seem a little basic for folks who spend all day heads down in gdb or who do this stuff professionally, but I just wanted to share a quick intro to some tools that others may find useful. ( oh god, I’m doing it)