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

elf: better error message for non-static global variables #196

Closed
wants to merge 1 commit into from

Conversation

lmb
Copy link
Collaborator

@lmb lmb commented Jan 20, 2021

It's easy to forget a static qualifier on a global variable:

volatile int FOO;

Trying to load a program that references FOO fails like so:

program filter: missing map FOO

This is due to how the library figures out whether you're tring to
do a direct load or are referencing a map. In any case, the error
is pretty confusing. Try to give a hint to our users.

It's easy to forget a static qualifier on a global variable:

    volatile int FOO;

Trying to load a program that references FOO fails like so:

    program filter: missing map FOO

This is due to how the library figures out whether you're tring to
do a direct load or are referencing a map. In any case, the error
is pretty confusing. Try to give a hint to our users.
Copy link
Contributor

@florianl florianl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works fine for me 👍

@lmb
Copy link
Collaborator Author

lmb commented Jan 21, 2021

CI fails due to the following in selftests:

const char tcp_mem_name[] = "net/ipv4/tcp_mem/very_very_very_very_long_pointless_string_to_stress_byte_loop";
static __attribute__((noinline)) int is_tcp_mem(struct bpf_sysctl *ctx)
{

Since this is the only such case in selftests it might be a bug in libbpf. I'll try and test against the newest kernel selftests and see whether we get more errors. Otherwise I'll send an email to bpf@

@lmb
Copy link
Collaborator Author

lmb commented Jan 21, 2021

These declarations seem to have proliferated, so this needs a proper fix :(

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

Successfully merging this pull request may close these issues.

None yet

2 participants