aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2022-09-23 14:40:22 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2022-09-23 14:40:22 -0300
commit843fe9bfab4859b4c718b87dccfb27f45833321f (patch)
tree2fce144ceec63c1b95f27b00b031e4ee6b219f25
parentf5857bd34b220a64eb343a84e21f3c8e11cd9ec7 (diff)
downloadpahole-843fe9bfab4859b4c718b87dccfb27f45833321f.tar.gz
emit: Check if disambiguated struct/enum/union name was already emitted in a previous CU
When generating from DWARF we may find the same ambiguous enum/struct/union name ('struct foo' and 'union foo' on the same .c file), in multiple CUs, so we need to check again when disambiguating by adding a __N suffix. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--dwarves_emit.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/dwarves_emit.c b/dwarves_emit.c
index 910afb93..304d587d 100644
--- a/dwarves_emit.c
+++ b/dwarves_emit.c
@@ -357,6 +357,12 @@ int type__emit_definitions(struct tag *tag, struct cu *cu,
} else {
// Will be deleted in type__delete() on noticing ctype->suffix_disambiguation != 0
tag__namespace(tag)->name = disambiguated_name;
+
+ // Now look again if it was emitted in a previous CU with the disambiguated name
+ if (type_emissions__find_definition(emissions, tag->tag, type__name(ctype)) != NULL) {
+ ctype->definition_emitted = 1;
+ return 0;
+ }
}
}