summaryrefslogtreecommitdiff
path: root/scripts/gendwarfksyms/dwarf.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gendwarfksyms/dwarf.c')
-rw-r--r--scripts/gendwarfksyms/dwarf.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/scripts/gendwarfksyms/dwarf.c b/scripts/gendwarfksyms/dwarf.c
index bdf899d60707..17f7e6b9a7ff 100644
--- a/scripts/gendwarfksyms/dwarf.c
+++ b/scripts/gendwarfksyms/dwarf.c
@@ -120,13 +120,16 @@ static bool is_definition_private(Dwarf_Die *die)
return !!res;
}
-static bool is_kabi_definition(Dwarf_Die *die)
+static bool is_kabi_definition(struct die *cache, Dwarf_Die *die)
{
bool value;
if (get_flag_attr(die, DW_AT_declaration, &value) && value)
return false;
+ if (kabi_is_declonly(cache->fqn))
+ return false;
+
return !is_definition_private(die);
}
@@ -515,9 +518,10 @@ static void __process_structure_type(struct state *state, struct die *cache,
process(cache, " {");
process_linebreak(cache, 1);
- expand = state->expand.expand && is_kabi_definition(die);
+ expand = state->expand.expand && is_kabi_definition(cache, die);
if (expand) {
+ state->expand.current_fqn = cache->fqn;
check(process_die_container(state, cache, die, process_func,
match_func));
}
@@ -548,13 +552,26 @@ DEFINE_PROCESS_STRUCTURE_TYPE(union)
static void process_enumerator_type(struct state *state, struct die *cache,
Dwarf_Die *die)
{
+ bool overridden = false;
Dwarf_Word value;
+ if (stable) {
+ /* Get the fqn before we process anything */
+ update_fqn(cache, die);
+
+ if (kabi_is_enumerator_ignored(state->expand.current_fqn,
+ cache->fqn))
+ return;
+
+ overridden = kabi_get_enumerator_value(
+ state->expand.current_fqn, cache->fqn, &value);
+ }
+
process_list_comma(state, cache);
process(cache, "enumerator");
process_fqn(cache, die);
- if (get_udata_attr(die, DW_AT_const_value, &value)) {
+ if (overridden || get_udata_attr(die, DW_AT_const_value, &value)) {
process(cache, " = ");
process_fmt(cache, "%" PRIu64, value);
}
@@ -620,6 +637,7 @@ static void process_cached(struct state *state, struct die *cache,
static void state_init(struct state *state)
{
state->expand.expand = true;
+ state->expand.current_fqn = NULL;
cache_init(&state->expansion_cache);
}
@@ -627,6 +645,7 @@ static void expansion_state_restore(struct expansion_state *state,
struct expansion_state *saved)
{
state->expand = saved->expand;
+ state->current_fqn = saved->current_fqn;
}
static void expansion_state_save(struct expansion_state *state,