@@ -1892,7 +1892,8 @@ struct btf *btf_encoder__btf(struct btf_encoder *encoder)
void dwarves__set_btf_kind_max(struct conf_load *conf_load, int btf_kind_max)
{
- if (btf_kind_max < 0 || btf_kind_max >= BTF_KIND_MAX)
+ if (conf_load->skip_autodetect_btf_kind_max ||
+ btf_kind_max < 0 || btf_kind_max >= BTF_KIND_MAX)
return;
if (btf_kind_max < BTF_KIND_DECL_TAG)
conf_load->skip_encoding_btf_decl_tag = true;
@@ -68,6 +68,7 @@ struct conf_load {
bool skip_encoding_btf_enum64;
bool btf_gen_optimized;
bool skip_encoding_btf_inconsistent_proto;
+ bool skip_autodetect_btf_kind_max;
uint8_t hashtable_bits;
uint8_t max_hashtable_bits;
uint16_t kabi_prefix_len;
@@ -233,6 +233,10 @@ Do not encode type tags in BTF.
.B \-\-skip_encoding_btf_inconsistent_proto
Do not encode functions with multiple inconsistent prototypes or unexpected register use for their parameters, where the registers used do not match calling conventions.
+.TP
+.B \-\-skip_autodetect_btf_kind_max
+Do not scan DWARF to find out which BTF kinds are supported by the underlying object.
+
.TP
.B \-j, \-\-jobs=N
Run N jobs in parallel. Defaults to number of online processors + 10% (like
@@ -1232,6 +1232,7 @@ ARGP_PROGRAM_VERSION_HOOK_DEF = dwarves_print_version;
#define ARGP_skip_emitting_atomic_typedefs 338
#define ARGP_btf_gen_optimized 339
#define ARGP_skip_encoding_btf_inconsistent_proto 340
+#define ARGP_skip_autodetect_btf_kind_max 341
static const struct argp_option pahole__options[] = {
{
@@ -1654,6 +1655,11 @@ static const struct argp_option pahole__options[] = {
.key = ARGP_skip_encoding_btf_inconsistent_proto,
.doc = "Skip functions that have multiple inconsistent function prototypes sharing the same name, or that use unexpected registers for parameter values."
},
+ {
+ .name = "skip_autodetect_btf_kind_max",
+ .key = ARGP_skip_autodetect_btf_kind_max,
+ .doc = "Skip auto-detection of maximum BTF kind supported."
+ },
{
.name = NULL,
}
@@ -1829,6 +1835,8 @@ static error_t pahole__options_parser(int key, char *arg,
conf_load.btf_gen_optimized = true; break;
case ARGP_skip_encoding_btf_inconsistent_proto:
conf_load.skip_encoding_btf_inconsistent_proto = true; break;
+ case ARGP_skip_autodetect_btf_kind_max:
+ conf_load.skip_autodetect_btf_kind_max = true; break;
default:
return ARGP_ERR_UNKNOWN;
}
Autodetection of BTF kinds supported may not be wanted or may be broken at some point; it is prudent to provide a way to switch it off. Suggested-by: Jiri Olsa <olsajiri@gmail.com> Signed-off-by: Alan Maguire <alan.maguire@oracle.com> --- btf_encoder.c | 3 ++- dwarves.h | 1 + man-pages/pahole.1 | 4 ++++ pahole.c | 8 ++++++++ 4 files changed, 15 insertions(+), 1 deletion(-)