* [PATCH] bpfilter: check if $(CC) can static link in Kconfig
@ 2020-05-09 7:39 Masahiro Yamada
2020-05-10 1:04 ` Alexei Starovoitov
0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2020-05-09 7:39 UTC (permalink / raw)
To: linux-kbuild
Cc: Valdis Kletnieks, linux-kernel, bpf, Masahiro Yamada,
Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
David S. Miller, Jakub Kicinski, John Fastabend, KP Singh,
Martin KaFai Lau, Song Liu, Yonghong Song, netdev
On Fedora, linking static libraries requires the glibc-static RPM
package, which is not part of the glibc-devel package.
CONFIG_CC_CAN_LINK does not check the capability of static linking,
so you can enable CONFIG_BPFILTER_UMH, then fail to build.
HOSTLD net/bpfilter/bpfilter_umh
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
Add CONFIG_CC_CAN_LINK_STATIC, and make CONFIG_BPFILTER_UMH depend
on it.
Reported-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
I will insert this after
https://patchwork.kernel.org/patch/11515997/
init/Kconfig | 5 +++++
net/bpfilter/Kconfig | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/init/Kconfig b/init/Kconfig
index 57562a8e2761..d0ff16e93794 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -49,6 +49,11 @@ config CC_CAN_LINK
default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(m64-flag)) if 64BIT
default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(m32-flag))
+config CC_CAN_LINK_STATIC
+ bool
+ default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) -static $(m64-flag)) if 64BIT
+ default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) -static $(m32-flag))
+
config CC_HAS_ASM_GOTO
def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC))
diff --git a/net/bpfilter/Kconfig b/net/bpfilter/Kconfig
index fed9290e3b41..045144d4a42c 100644
--- a/net/bpfilter/Kconfig
+++ b/net/bpfilter/Kconfig
@@ -9,7 +9,7 @@ menuconfig BPFILTER
if BPFILTER
config BPFILTER_UMH
tristate "bpfilter kernel module with user mode helper"
- depends on CC_CAN_LINK
+ depends on CC_CAN_LINK_STATIC
default m
help
This builds bpfilter kernel module with embedded user mode helper
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] bpfilter: check if $(CC) can static link in Kconfig
2020-05-09 7:39 [PATCH] bpfilter: check if $(CC) can static link in Kconfig Masahiro Yamada
@ 2020-05-10 1:04 ` Alexei Starovoitov
2020-05-12 4:32 ` Masahiro Yamada
0 siblings, 1 reply; 3+ messages in thread
From: Alexei Starovoitov @ 2020-05-10 1:04 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Linux Kbuild mailing list, Valdis Kletnieks, LKML, bpf,
Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
David S. Miller, Jakub Kicinski, John Fastabend, KP Singh,
Martin KaFai Lau, Song Liu, Yonghong Song, Network Development
On Sat, May 9, 2020 at 12:40 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Fedora, linking static libraries requires the glibc-static RPM
> package, which is not part of the glibc-devel package.
>
> CONFIG_CC_CAN_LINK does not check the capability of static linking,
> so you can enable CONFIG_BPFILTER_UMH, then fail to build.
>
> HOSTLD net/bpfilter/bpfilter_umh
> /usr/bin/ld: cannot find -lc
> collect2: error: ld returned 1 exit status
>
> Add CONFIG_CC_CAN_LINK_STATIC, and make CONFIG_BPFILTER_UMH depend
> on it.
>
> Reported-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Thanks!
Acked-by: Alexei Starovoitov <ast@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bpfilter: check if $(CC) can static link in Kconfig
2020-05-10 1:04 ` Alexei Starovoitov
@ 2020-05-12 4:32 ` Masahiro Yamada
0 siblings, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2020-05-12 4:32 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Linux Kbuild mailing list, Valdis Kletnieks, LKML, bpf,
Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
David S. Miller, Jakub Kicinski, John Fastabend, KP Singh,
Martin KaFai Lau, Song Liu, Yonghong Song, Network Development
On Sun, May 10, 2020 at 10:04 AM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Sat, May 9, 2020 at 12:40 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > On Fedora, linking static libraries requires the glibc-static RPM
> > package, which is not part of the glibc-devel package.
> >
> > CONFIG_CC_CAN_LINK does not check the capability of static linking,
> > so you can enable CONFIG_BPFILTER_UMH, then fail to build.
> >
> > HOSTLD net/bpfilter/bpfilter_umh
> > /usr/bin/ld: cannot find -lc
> > collect2: error: ld returned 1 exit status
> >
> > Add CONFIG_CC_CAN_LINK_STATIC, and make CONFIG_BPFILTER_UMH depend
> > on it.
> >
> > Reported-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
>
> Thanks!
> Acked-by: Alexei Starovoitov <ast@kernel.org>
Applied to linux-kbuild
with Alexei's Ack.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-12 4:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-09 7:39 [PATCH] bpfilter: check if $(CC) can static link in Kconfig Masahiro Yamada
2020-05-10 1:04 ` Alexei Starovoitov
2020-05-12 4:32 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).