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

BTF flattens n-dym arrays #3082

Open
ttreyer opened this issue Mar 21, 2024 · 1 comment
Open

BTF flattens n-dym arrays #3082

ttreyer opened this issue Mar 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ttreyer
Copy link
Contributor

ttreyer commented Mar 21, 2024

BTF flattens multi-dimensional arrays into 1-D array.

The tests field_analyser_btf.btf_types and clang_parser_btf.btf had to be modified as follow:

  • We can't test each dimension of the array properly
  • The number of element for Foo1.d was set to 12 instead of the correct number 3

What reproduces the bug? Provide code if possible.

Modify field_analyser_btf.btf_types and clang_parser_btf.btf so they use the commented code for the field Foo1.d.

@ttreyer ttreyer added the bug Something isn't working label Mar 21, 2024
@ajor
Copy link
Member

ajor commented Mar 21, 2024

I think this is a problem with pahole's DWARF -> BTF translator: https://git.kernel.org/pub/scm/devel/pahole/pahole.git/tree/btf_encoder.c#n1199

We use it to generate our test BTF data here:

add_custom_command(
OUTPUT ${DATA_SOURCE_O}
COMMAND gcc -g -o ${DATA_SOURCE_O} ${DATA_SOURCE_C}
# pahole uses LLVM_OBJCOPY env var.
# We must hack it like this b/c cmake does not support setting env vars at build time
COMMAND bash -c "LLVM_OBJCOPY=${LLVM_OBJCOPY} pahole -J ${DATA_SOURCE_O}"
DEPENDS ${DATA_SOURCE_C})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants