Mehdi Akiki

Posts tagged "linker"

  • Published on
    When the same Rust code breaks on another target or another machine, I ask four questions in order. Here is the tree, with real outputs from rustc 1.99.1 for ten targets and from runs on my laptop and in three Linux containers.
  • Published on
    mold 3.0 is the first Rust version of mold. I linked the same ripgrep object files with it, mold 2, GNU ld, gold, LLD and wild. With one thread, LLD, mold and wild were equal, the Rust mold was a bit slower with 16, and all outputs were the same program.
  • Published on

    Investigation · Part 19 of 20 · From source to a running process

    How Each Thread Gets Its Own Copy of a Variable: Thread-Local Storage

    One _Thread_local variable, four threads, four copies at four addresses, and one instruction to reach each of them. I followed the fs register, the TLS segment, the access models of the ELF TLS document, their cost, and Rust's thread_local! in the disassembly.
  • Published on

    Investigation · Part 9 of 20 · From source to a running process

    How LD_PRELOAD Replaces a Function Without Recompiling

    I wrote a small library that counts malloc calls and preloaded it into C, Rust and ls. The famous dlsym trap did not appear with glibc 2.43, but ls hid my output in a way I did not expect, and the static binary ignored the library completely.