core: Allow sizing the loader hash table

For now this will only apply to the dwarf loader, for experimenting as
time passes and kernels grow bigger or with more symbols.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2021-07-21 17:44:05 -03:00
parent 3068ff36b7
commit ff7bd7083f
2 changed files with 17 additions and 0 deletions

View File

@ -3042,6 +3042,21 @@ static int dwarf__load_file(struct cus *cus, struct conf_load *conf,
{
int fd, err;
if (conf->max_hashtable_bits != 0) {
if (conf->max_hashtable_bits > 31)
return -E2BIG;
max_hashtags__bits = conf->max_hashtable_bits;
}
if (conf->hashtable_bits != 0) {
if (conf->hashtable_bits > max_hashtags__bits)
return -E2BIG;
hashtags__bits = conf->hashtable_bits;
} else if (hashtags__bits > max_hashtags__bits)
return -EINVAL;
elf_version(EV_CURRENT);
fd = open(filename, O_RDONLY);

View File

@ -56,6 +56,8 @@ struct conf_load {
bool ignore_alignment_attr;
bool ignore_inline_expansions;
bool ignore_labels;
uint8_t hashtable_bits;
uint8_t max_hashtable_bits;
uint16_t kabi_prefix_len;
const char *kabi_prefix;
struct btf *base_btf;