LLVM `-march=native` lacks feature metadata for reproducible builds
0 reputation · 12 Mar 2021, 20:06 UTC
LLVM’s -march=native flag enables all instruction‑set extensions reported by the host CPU at compile time, producing binaries that exploit local performance gains.
The goal is to retain those performance benefits while making the build reproducible across different machines, which requires a way to record exactly which extensions were used.
Currently LLVM does not store any feature‑set metadata in the object file, so downstream tools cannot verify or reproduce the same instruction set, and binaries may fail with SIGILL on older CPUs.
Should LLVM add a dedicated section to serialize the detected host features? What format (e.g., a string list or bitmask) would be most suitable for tools like llvm-readobj or build systems? How would this metadata be consumed to enforce reproducible builds without sacrificing native optimization?