How can I use GCC's -Wl,--build-id option to embed a verifiable identifier in an executable for backup restoration validation?
0 reputation · 20 Dec 2025, 09:55 UTC
Assuming GCC accepts the linker option -Wl,--build-id to embed a unique identifier in the produced executable, I have a project that is compiled with GCC, the resulting binary is backed up, and later the backup is restored to the same or a different filesystem.
I want to confirm that the restored binary is identical to the original with respect to the build‑ID, without relying on external checksum tools.
How can I use GCC's -Wl,--build-id (or an equivalent GCC‑supported feature) to create a reproducible identifier during compilation, and how can I verify that the restored backup contains the same identifier?