This is the mail archive of the
mailing list for the binutils project.
Method for accessing GNU build-id at runtime
- From: Matt Turner <mattst88 at gmail dot com>
- To: binutils at sourceware dot org
- Date: Mon, 12 Dec 2016 12:21:44 -0800
- Subject: Method for accessing GNU build-id at runtime
- Authentication-results: sourceware.org; auth=none
In Intel's open source Vulkan driver (part of Mesa), we want to
uniquely identify ourselves at runtime in order to find our on-disk
cache of shader programs.
Various unsavory solutions have been proposed that I would like to
avoid. I am aware of ld's --build-id option, and given the ability to
read that build-id at runtime, I think would solve our problem
I have written a linker script that inserts start and end symbols
around the .notes.gnu.build-id section, which allows me to read the
hash. See  for the code.
I know that this will not work with ld.gold since it does not use
linker scripts, and in general the ability to access one's own
build-id seems useful. Others  have wanted the feature.
Is this approach sane? Is this something that should be implemented in binutils?
(I would also be curious to know why my initial commit in  did not
work for the shared-object case "LD_LIBRARY_PATH=. ./so-build-id")