mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-15 17:48:22 +02:00
anv: Use build-id for pipeline cache UUID.
The --build-id=... ld flag has been present since binutils-2.18, released 28 Aug 2007. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Chad Versace <chadversary@chromium.org>
This commit is contained in:
parent
d4fa083e11
commit
656e30b686
2 changed files with 9 additions and 22 deletions
|
|
@ -165,6 +165,7 @@ libvulkan_intel_la_LDFLAGS = \
|
||||||
-module \
|
-module \
|
||||||
-no-undefined \
|
-no-undefined \
|
||||||
-avoid-version \
|
-avoid-version \
|
||||||
|
-Wl,--build-id=sha1 \
|
||||||
$(BSYMBOLIC) \
|
$(BSYMBOLIC) \
|
||||||
$(GC_SECTIONS) \
|
$(GC_SECTIONS) \
|
||||||
$(LD_NO_UNDEFINED)
|
$(LD_NO_UNDEFINED)
|
||||||
|
|
|
||||||
|
|
@ -21,18 +21,17 @@
|
||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "anv_private.h"
|
#include "anv_private.h"
|
||||||
#include "util/strtod.h"
|
#include "util/strtod.h"
|
||||||
#include "util/debug.h"
|
#include "util/debug.h"
|
||||||
|
#include "util/build_id.h"
|
||||||
#include "util/vk_util.h"
|
#include "util/vk_util.h"
|
||||||
|
|
||||||
#include "genxml/gen7_pack.h"
|
#include "genxml/gen7_pack.h"
|
||||||
|
|
@ -55,31 +54,18 @@ compiler_perf_log(void *data, const char *fmt, ...)
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
|
||||||
anv_get_function_timestamp(void *ptr, uint32_t* timestamp)
|
|
||||||
{
|
|
||||||
Dl_info info;
|
|
||||||
struct stat st;
|
|
||||||
if (!dladdr(ptr, &info) || !info.dli_fname)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (stat(info.dli_fname, &st))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
*timestamp = st.st_mtim.tv_sec;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
anv_device_get_cache_uuid(void *uuid)
|
anv_device_get_cache_uuid(void *uuid)
|
||||||
{
|
{
|
||||||
uint32_t timestamp;
|
const struct build_id_note *note = build_id_find_nhdr("libvulkan_intel.so");
|
||||||
|
if (!note)
|
||||||
memset(uuid, 0, VK_UUID_SIZE);
|
|
||||||
if (!anv_get_function_timestamp(anv_device_get_cache_uuid, ×tamp))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
snprintf(uuid, VK_UUID_SIZE, "anv-%d", timestamp);
|
unsigned len = build_id_length(note);
|
||||||
|
if (len < VK_UUID_SIZE)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
build_id_read(note, uuid, VK_UUID_SIZE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue