From: Alan Maguire <alan.maguire@oracle.com>
To: dwarves@vger.kernel.org
Cc: andrii@kernel.org, eddyz87@gmail.com, ast@kernel.org,
daniel@iogearbox.net, martin.lau@linux.dev, acme@kernel.org,
ttreyer@meta.com, yonghong.song@linux.dev, song@kernel.org,
john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me,
haoluo@google.com, jolsa@kernel.org, qmo@kernel.org,
ihor.solodrai@linux.dev, david.faust@oracle.com,
jose.marchesi@oracle.com, bpf@vger.kernel.org,
Alan Maguire <alan.maguire@oracle.com>
Subject: [RFC dwarves 5/5] pahole: Support inline encoding with inline[.extra] BTF feature
Date: Fri, 24 Oct 2025 08:33:28 +0100 [thread overview]
Message-ID: <20251024073328.370457-6-alan.maguire@oracle.com> (raw)
In-Reply-To: <20251024073328.370457-1-alan.maguire@oracle.com>
The inline feature enables encoding of inlines in BTF. Adding the
.extra suffix ensures the encoding ends up in split BTF in a
.BTF.extra section.
Add support for extra features that optionally target the .BTF.extra
section and have the inline feature be the first consumer
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
pahole.c | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/pahole.c b/pahole.c
index ef01e58..7cf3fbf 100644
--- a/pahole.c
+++ b/pahole.c
@@ -1183,16 +1183,24 @@ ARGP_PROGRAM_VERSION_HOOK_DEF = dwarves_print_version;
* floats, etc. This ensures backwards compatibility.
*/
#define BTF_DEFAULT_FEATURE(name, alias, initial_value) \
- { #name, #alias, &conf_load.alias, initial_value, true, NULL }
+ { #name, #alias, &conf_load.alias, initial_value, true, NULL, NULL }
#define BTF_DEFAULT_FEATURE_CHECK(name, alias, initial_value, feature_check) \
- { #name, #alias, &conf_load.alias, initial_value, true, feature_check }
+ { #name, #alias, &conf_load.alias, initial_value, true, NULL, feature_check }
#define BTF_NON_DEFAULT_FEATURE(name, alias, initial_value) \
- { #name, #alias, &conf_load.alias, initial_value, false, NULL }
+ { #name, #alias, &conf_load.alias, initial_value, false, NULL, NULL }
#define BTF_NON_DEFAULT_FEATURE_CHECK(name, alias, initial_value, feature_check) \
- { #name, #alias, &conf_load.alias, initial_value, false, feature_check }
+ { #name, #alias, &conf_load.alias, initial_value, false, NULL, feature_check }
+
+#define BTF_NON_DEFAULT_EXTRA_FEATURE_CHECK(name, alias, initial_value, feature_check) \
+ { #name, #alias, &conf_load.alias, initial_value, false, &conf_load.alias##_extra, feature_check }
+
+/* If a feature supports it, using ".extra" as a suffix for the feature name
+ * targets .BTF.extra section with the resultant BTF data.
+ */
+#define BTF_EXTRA_FEATURE_SUFFIX ".extra"
static bool enum64_check(void)
{
@@ -1209,6 +1217,11 @@ static bool attributes_check(void)
return btf__add_type_attr != NULL;
}
+static bool locations_check(void)
+{
+ return btf__add_loc_proto != NULL;
+}
+
struct btf_feature {
const char *name;
const char *option_alias;
@@ -1217,6 +1230,7 @@ struct btf_feature {
bool default_enabled; /* some nonstandard features may not
* be enabled for --btf_features=default
*/
+ bool *extra; /* can store in .BTF.extra? */
bool (*feature_check)(void);
} btf_features[] = {
BTF_DEFAULT_FEATURE(encode_force, btf_encode_force, false),
@@ -1234,6 +1248,8 @@ struct btf_feature {
BTF_NON_DEFAULT_FEATURE(global_var, encode_btf_global_vars, false),
BTF_NON_DEFAULT_FEATURE_CHECK(attributes, btf_attributes, false,
attributes_check),
+ BTF_NON_DEFAULT_EXTRA_FEATURE_CHECK(inline, btf_gen_inlines, false,
+ locations_check),
};
#define BTF_MAX_FEATURE_STR 1024
@@ -1261,8 +1277,15 @@ static struct btf_feature *find_btf_feature(char *name)
int i;
for (i = 0; i < ARRAY_SIZE(btf_features); i++) {
- if (strcmp(name, btf_features[i].name) == 0)
+ if (strncmp(name, btf_features[i].name, strlen(btf_features[i].name)) == 0) {
+ /* Feature can optionally target .BTF.extra if it
+ * is supported and has the .extra suffix.
+ */
+ if (btf_features[i].extra)
+ *(btf_features[i].extra) = strstr(name, BTF_EXTRA_FEATURE_SUFFIX)
+ != NULL;
return &btf_features[i];
+ }
}
return NULL;
}
--
2.39.3
prev parent reply other threads:[~2025-10-24 7:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-24 7:33 [RFC dwarves 0/5] pahole: support BTF inline encoding Alan Maguire
2025-10-24 7:33 ` [RFC dwarves 1/5] dwarf_loader: Add parameters list to inlined expansion Alan Maguire
2025-10-24 7:33 ` [RFC dwarves 2/5] dwarf_loader: Add name to inline expansion Alan Maguire
2025-10-24 7:33 ` [RFC dwarves 3/5] dwarf_loader: Collect inline expansion location information Alan Maguire
2025-10-24 17:55 ` Eduard Zingerman
2025-10-29 17:40 ` Alan Maguire
2025-10-29 18:32 ` Eduard Zingerman
2025-10-29 18:46 ` Alan Maguire
2025-10-24 7:33 ` [RFC dwarves 4/5] btf_encoder: Support encoding of inline " Alan Maguire
2025-10-24 18:04 ` Eduard Zingerman
2025-10-24 7:33 ` Alan Maguire [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251024073328.370457-6-alan.maguire@oracle.com \
--to=alan.maguire@oracle.com \
--cc=acme@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=david.faust@oracle.com \
--cc=dwarves@vger.kernel.org \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=jose.marchesi@oracle.com \
--cc=kpsingh@kernel.org \
--cc=martin.lau@linux.dev \
--cc=qmo@kernel.org \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=ttreyer@meta.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox