dwarves/0003-btf_encoder-Store-the-CU-being-processed-to-avoid-ch.patch
Jan Engelhardt 5a86729946 Accepting request 1066397 from home:marxin:branches:devel:tools
- Add 0001-pahole-Support-lang-lang_exclude-asm.patch,
  0002-btf_encoder-Add-extra-debug-info-for-unsupported-DWA.patch,
  0003-btf_encoder-Store-the-CU-being-processed-to-avoid-ch.patch,
  0004-core-Add-DW_TAG_unspecified_type-to-tag__is_tag_type.patch,
  0005-core-Record-if-a-CU-has-a-DW_TAG_unspecified_type.patch,
  0006-btf_encoder-Encode-DW_TAG_unspecified_type-returning.patch,
  0007-dwarves-Zero-initialize-struct-cu-in-cu__new-to-prev.patch
  as in order to support DW_TAG_unspecified_type that is newly
  emitted by binutils 2.40+.

OBS-URL: https://build.opensuse.org/request/show/1066397
OBS-URL: https://build.opensuse.org/package/show/devel:tools/dwarves?expand=0&rev=89
2023-02-17 17:03:26 +00:00

66 lines
1.9 KiB
Diff

From 79f560f1418f7cacb50746c33a116f8ab5396a2d Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Mon, 10 Oct 2022 09:34:53 -0300
Subject: [PATCH 3/7] btf_encoder: Store the CU being processed to avoid
changing many functions
Having it as encoder->cu will make it available to nested function
without requiring changing all the functions leading to them.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
btf_encoder.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/btf_encoder.c b/btf_encoder.c
index babeefa0dc51e62b..e74862cfc0a3a802 100644
--- a/btf_encoder.c
+++ b/btf_encoder.c
@@ -44,9 +44,13 @@ struct var_info {
uint32_t sz;
};
+/*
+ * cu: cu being processed.
+ */
struct btf_encoder {
struct list_head node;
struct btf *btf;
+ struct cu *cu;
struct gobuffer percpu_secinfo;
const char *filename;
struct elf_symtab *symtab;
@@ -1232,8 +1236,9 @@ static bool ftype__has_arg_names(const struct ftype *ftype)
return true;
}
-static int btf_encoder__encode_cu_variables(struct btf_encoder *encoder, struct cu *cu, uint32_t type_id_off)
+static int btf_encoder__encode_cu_variables(struct btf_encoder *encoder, uint32_t type_id_off)
{
+ struct cu *cu = encoder->cu;
uint32_t core_id;
struct tag *pos;
int err = -1;
@@ -1465,6 +1470,7 @@ int btf_encoder__encode_cu(struct btf_encoder *encoder, struct cu *cu, struct co
struct tag *pos;
int err = 0;
+ encoder->cu = cu;
if (!encoder->has_index_type) {
/* cu__find_base_type_by_name() takes "type_id_t *id" */
@@ -1580,8 +1586,9 @@ int btf_encoder__encode_cu(struct btf_encoder *encoder, struct cu *cu, struct co
}
if (!encoder->skip_encoding_vars)
- err = btf_encoder__encode_cu_variables(encoder, cu, type_id_off);
+ err = btf_encoder__encode_cu_variables(encoder, type_id_off);
out:
+ encoder->cu = NULL;
return err;
}
--
2.39.1