btf-reader: Ignore BTF nodes that ought to be ignored

For now, the BTF nodes BTF_KIND_DECL_TAG, BTF_KIND_DATASEC, and
BTF_KIND_UNKN are ignored by libabigail, in practice.  We should thus
not abort when we encounter them.  Fixed thus.  Many thanks to Cestmir
Kalina for reporting this.

	* src/abg-btf-reader.cc (build_ir_node_from_btf_type): Ignore and
	return nil for node of kind BTF_KIND_DECL_TAG, BTF_KIND_DATASEC,
	and BTF_KIND_UNKN.  For all other nodes, abort.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>

	# Veuillez saisir le message de validation pour vos
	modifications. Les lignes # commençant par '#' seront ignorées, et
	un message vide abandonne la validation.  # # Sur la branche
	master # Votre branche est à jour avec 'origin/master'.  # #
	Modifications qui seront validées : # modifié :
	src/abg-btf-reader.cc # # Fichiers non suivis: #
	doc/api/libabigail.doxy.bak # patches/ # prtests/ # #
	------------------------ >8 ------------------------ # Ne touchez
	pas à la ligne ci-dessus.  # Tout ce qui suit sera éliminé.
diff --git a/src/abg-btf-reader.cc b/src/abg-btf-reader.cc
index f22e92bf..67206bb4 100644
--- a/src/abg-btf-reader.cc
+++ b/src/abg-btf-reader.cc
@@ -486,12 +486,16 @@ public:

 #ifdef WITH_BTF_KIND_TYPE_TAG
 	  case BTF_KIND_TYPE_TAG/* Type Tag */:
+	    break;
 #endif
 #ifdef WITH_BTF_KIND_DECL_TAG
 	  case BTF_KIND_DECL_TAG/* Decl Tag */:
+	    break;
 #endif
 	  case BTF_KIND_DATASEC/* Section */:
+	    break;
 	  case BTF_KIND_UNKN/* Unknown	*/:
+	    break;
 	  default:
 	    ABG_ASSERT_NOT_REACHED;
 	    break;

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2024-05-10 13:52:22 +02:00
parent 86967a1dbb
commit ca2319b973

View File

@ -486,12 +486,16 @@ public:
#ifdef WITH_BTF_KIND_TYPE_TAG
case BTF_KIND_TYPE_TAG/* Type Tag */:
break;
#endif
#ifdef WITH_BTF_KIND_DECL_TAG
case BTF_KIND_DECL_TAG/* Decl Tag */:
break;
#endif
case BTF_KIND_DATASEC/* Section */:
break;
case BTF_KIND_UNKN/* Unknown */:
break;
default:
ABG_ASSERT_NOT_REACHED;
break;