util: Introduce HAVE_BUILD_ID for build id utils
Build utilities to retrieve the build id are now exposed through the new HAVE_BUILD_ID instead of HAVE_DL_ITERATE_PHDR since this will allow adding support for platforms that do not support HAVE_DL_ITERATE_PHDR Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38420>
This commit is contained in:
@@ -904,7 +904,7 @@ static void virgl_disk_cache_create(struct virgl_screen *screen)
|
||||
struct mesa_sha1 sha1_ctx;
|
||||
_mesa_sha1_init(&sha1_ctx);
|
||||
|
||||
#ifdef HAVE_DL_ITERATE_PHDR
|
||||
#ifdef HAVE_BUILD_ID
|
||||
const struct build_id_note *note =
|
||||
build_id_find_nhdr_for_addr(virgl_disk_cache_create);
|
||||
assert(note);
|
||||
|
||||
@@ -303,7 +303,7 @@ disk_cache_init(struct zink_screen *screen)
|
||||
struct mesa_blake3 ctx;
|
||||
_mesa_blake3_init(&ctx);
|
||||
|
||||
#ifdef HAVE_DL_ITERATE_PHDR
|
||||
#ifdef HAVE_BUILD_ID
|
||||
/* Hash in the zink driver build. */
|
||||
const struct build_id_note *note =
|
||||
build_id_find_nhdr_for_addr(disk_cache_init);
|
||||
|
||||
@@ -21,13 +21,14 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DL_ITERATE_PHDR
|
||||
#include "build_id.h"
|
||||
|
||||
#if HAVE_BUILD_ID
|
||||
#include <dlfcn.h>
|
||||
#include <link.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "build_id.h"
|
||||
#include "macros.h"
|
||||
|
||||
#ifndef NT_GNU_BUILD_ID
|
||||
|
||||
@@ -24,11 +24,17 @@
|
||||
#ifndef BUILD_ID_H
|
||||
#define BUILD_ID_H
|
||||
|
||||
#if defined(HAVE_DL_ITERATE_PHDR)
|
||||
#define HAVE_BUILD_ID 1
|
||||
#else
|
||||
#define HAVE_BUILD_ID 0
|
||||
#endif /* defined(HAVE_DL_ITERATE_PHDR) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DL_ITERATE_PHDR
|
||||
#if HAVE_BUILD_ID
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ disk_cache_get_function_identifier(void *ptr, struct mesa_sha1 *ctx)
|
||||
{
|
||||
uint32_t timestamp;
|
||||
|
||||
#ifdef HAVE_DL_ITERATE_PHDR
|
||||
#ifdef HAVE_BUILD_ID
|
||||
const struct build_id_note *note = NULL;
|
||||
if ((note = build_id_find_nhdr_for_addr(ptr))) {
|
||||
_mesa_sha1_update(ctx, build_id_data(note), build_id_length(note));
|
||||
|
||||
Reference in New Issue
Block a user