Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option parsing: btf_features=default is not the default? #52

Open
martinetd opened this issue Jun 12, 2024 · 0 comments
Open

Option parsing: btf_features=default is not the default? #52

martinetd opened this issue Jun 12, 2024 · 0 comments

Comments

@martinetd
Copy link

This might be a feature but I'm surprised, the output with --btf_features=default and without any --btf_features seem different:

for opt in "" --btf_features=default; do
   cp .tmp_vmlinux.orig .tmp_vmlinux.btf
   LLVM_OBJCOPY=objcopy pahole -J --btf_gen_floats --lang_exclude=rust --skip_encoding_btf_inconsistent_proto --btf_gen_optimized .tmp_vmlinux.btf $opt
  echo -n "$opt: "
  sha1sum .tmp_vmlinux.btf
done

: 58fcc73788cc9700d4e5ee136334e51b6b9ad601  .tmp_vmlinux.btf
--btf_features=default: 926851f26c73a3014220764f7a1299598afeb11f  .tmp_vmlinux.btf
(ran twice to confirm it's reproducible: there's no threading enabled in the above command)

Looking at the code it's because init_btf_features() is only called when the option is actively parsed; so the default values as per btf_features defaults aren't set unless the option is called.

This also has the side effect that --reproducible_build is unset by a following --btf_features option, e.g. --reproducible_build --btf_features=default will have reproducible build unset, but --btf_features=default --reproducible_build has it set.
(If the delayed init is on purpose, this could be resolved by making the default value an enum true/false/don't-touch, but I'd rather ask first)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant