diff options
| author | Carlos Llamas <[email protected]> | 2025-03-30 21:13:23 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <[email protected]> | 2025-04-04 15:52:37 +0000 |
| commit | 75011ad69bc54396703867b5434f1622343a848e (patch) | |
| tree | b71d26d5e79a4cb70b8c5ad6a5de5e35dfef0c9b /tools/lib/bpf/linker.c | |
| parent | Merge tag 'v6.15rc-part2-ksmbd-server-fixes' of git://git.samba.org/ksmbd (diff) | |
| download | kernel-75011ad69bc54396703867b5434f1622343a848e.tar.gz kernel-75011ad69bc54396703867b5434f1622343a848e.zip | |
libbpf: Fix implicit memfd_create() for bionic
Since memfd_create() is not consistently available across different
bionic libc implementations, using memfd_create() directly can break
some Android builds:
tools/lib/bpf/linker.c:576:7: error: implicit declaration of function 'memfd_create' [-Werror,-Wimplicit-function-declaration]
576 | fd = memfd_create(filename, 0);
| ^
To fix this, relocate and inline the sys_memfd_create() helper so that
it can be used in "linker.c". Similar issues were previously fixed by
commit 9fa5e1a180aa ("libbpf: Call memfd_create() syscall directly").
Fixes: 6d5e5e5d7ce1 ("libbpf: Extend linker API to support in-memory ELF files")
Signed-off-by: Carlos Llamas <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/linker.c')
| -rw-r--r-- | tools/lib/bpf/linker.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c index 800e0ef09c37..56f5068e2eba 100644 --- a/tools/lib/bpf/linker.c +++ b/tools/lib/bpf/linker.c @@ -573,7 +573,7 @@ int bpf_linker__add_buf(struct bpf_linker *linker, void *buf, size_t buf_sz, snprintf(filename, sizeof(filename), "mem:%p+%zu", buf, buf_sz); - fd = memfd_create(filename, 0); + fd = sys_memfd_create(filename, 0); if (fd < 0) { ret = -errno; pr_warn("failed to create memfd '%s': %s\n", filename, errstr(ret)); |
