From a4bf12a8b906911172897f14d62b3f43cc4066ad Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 28 Oct 2019 20:54:35 +0100 Subject: [PATCH] libdw: Use dynamicsizehash_concurrent for Dwarf_Sig8_Hash. Dwarf_Sig8_Hash is used as part of a Dwarf object to quickly find a type unit based on the type signature. Use the concurrent variant of the dynamic size hash to make it thread-safe to use. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 8 ++++++++ libdw/dwarf_formref_die.c | 2 +- libdw/dwarf_sig8_hash.c | 2 +- libdw/dwarf_sig8_hash.h | 9 +++++++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 28563b4d..61231e5c 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,11 @@ +2019-10-28 Mark Wielaard + + * dwarf_sig8_hash.h: Include libdw.h. Remove COMPARE. Include + dynamicsizehash_concurrent.h. + * dwarf_sig8_hash.c: Include dynamicsizehash_concurrent.c. + * dwarf_formref_die.c (dwarf_formref_die): Drop NULL argument to + Dwarf_Sig8_Hash_find. + 2019-08-26 Srđan Milaković * dwarf_abbrev_hash.{c,h}: Use the *_concurrent hash table. diff --git a/libdw/dwarf_formref_die.c b/libdw/dwarf_formref_die.c index f196331a..48ba8194 100644 --- a/libdw/dwarf_formref_die.c +++ b/libdw/dwarf_formref_die.c @@ -83,7 +83,7 @@ dwarf_formref_die (Dwarf_Attribute *attr, Dwarf_Die *result) have to match in the type unit headers. */ uint64_t sig = read_8ubyte_unaligned (cu->dbg, attr->valp); - cu = Dwarf_Sig8_Hash_find (&cu->dbg->sig8_hash, sig, NULL); + cu = Dwarf_Sig8_Hash_find (&cu->dbg->sig8_hash, sig); if (cu == NULL) { /* Not seen before. We have to scan through the type units. diff --git a/libdw/dwarf_sig8_hash.c b/libdw/dwarf_sig8_hash.c index 043cac78..777f9ebc 100644 --- a/libdw/dwarf_sig8_hash.c +++ b/libdw/dwarf_sig8_hash.c @@ -38,4 +38,4 @@ #define next_prime __libdwarf_next_prime extern size_t next_prime (size_t) attribute_hidden; -#include +#include diff --git a/libdw/dwarf_sig8_hash.h b/libdw/dwarf_sig8_hash.h index 705ffbcd..c399919a 100644 --- a/libdw/dwarf_sig8_hash.h +++ b/libdw/dwarf_sig8_hash.h @@ -29,10 +29,15 @@ #ifndef _DWARF_SIG8_HASH_H #define _DWARF_SIG8_HASH_H 1 +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "libdw.h" + #define NAME Dwarf_Sig8_Hash #define TYPE struct Dwarf_CU * -#define COMPARE(a, b) (0) -#include +#include #endif /* dwarf_sig8_hash.h */ -- 2.18.1