[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <32195f48-8b45-1a78-1964-dfe7b5a4933f@iogearbox.net>
Date: Tue, 24 Jan 2023 17:21:18 +0100
From: Daniel Borkmann <daniel@...earbox.net>
To: "Daniel T. Lee" <danieltimlee@...il.com>,
Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii.nakryiko@...il.com>,
Andrii Nakryiko <andrii@...nel.org>,
Yonghong Song <yhs@...com>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Song Liu <song@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Mykola Lysenko <mykolal@...com>, Shuah Khan <shuah@...nel.org>,
Yosry Ahmed <yosryahmed@...gle.com>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH] selftests/bpf: fix vmtest static compilation error
On 1/21/23 7:41 AM, Daniel T. Lee wrote:
> As stated in README.rst, in order to resolve errors with linker errors,
> 'LDLIBS=-static' should be used. Most problems will be solved by this
> option, but in the case of urandom_read, this won't fix the problem. So
> the Makefile is currently implemented to strip the 'static' option when
> compiling the urandom_read. However, stripping this static option isn't
> configured properly on $(LDLIBS) correctly, which is now causing errors
> on static compilation.
>
> # LDLIBS=-static ./vmtest.sh
> ld.lld: error: attempted static link of dynamic object liburandom_read.so
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> make: *** [Makefile:190: /linux/tools/testing/selftests/bpf/urandom_read] Error 1
> make: *** Waiting for unfinished jobs....
>
> This commit fixes this problem by configuring the strip with $(LDLIBS).
>
> Fixes: 68084a136420 ("selftests/bpf: Fix building bpf selftests statically")
> Signed-off-by: Daniel T. Lee <danieltimlee@...il.com>
> ---
> tools/testing/selftests/bpf/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 22533a18705e..7bd1ce9c8d87 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -188,7 +188,7 @@ $(OUTPUT)/liburandom_read.so: urandom_read_lib1.c urandom_read_lib2.c
> $(OUTPUT)/urandom_read: urandom_read.c urandom_read_aux.c $(OUTPUT)/liburandom_read.so
> $(call msg,BINARY,,$@)
> $(Q)$(CLANG) $(filter-out -static,$(CFLAGS) $(LDFLAGS)) $(filter %.c,$^) \
> - liburandom_read.so $(LDLIBS) \
> + liburandom_read.so $(filter-out -static,$(LDLIBS)) \
Do we need the same also for liburandom_read.so target's $(LDLIBS) further above?
> -fuse-ld=$(LLD) -Wl,-znoseparate-code -Wl,--build-id=sha1 \
> -Wl,-rpath=. -o $@
>
>
Powered by blists - more mailing lists