Skip to content

Commit b1183b6

Browse files
committed
bpfilter: check if $(CC) can link static libc in Kconfig
On Fedora, linking static glibc 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> Acked-by: Alexei Starovoitov <ast@kernel.org>
1 parent 9371f86 commit b1183b6

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎init/Kconfig‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ config CC_CAN_LINK
4949
default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(m64-flag)) if 64BIT
5050
default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(m32-flag))
5151

52+
config CC_CAN_LINK_STATIC
53+
bool
54+
default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) -static $(m64-flag)) if 64BIT
55+
default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) -static $(m32-flag))
56+
5257
config CC_HAS_ASM_GOTO
5358
def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC))
5459

‎net/bpfilter/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ menuconfig BPFILTER
99
if BPFILTER
1010
config BPFILTER_UMH
1111
tristate "bpfilter kernel module with user mode helper"
12-
depends on CC_CAN_LINK
12+
depends on CC_CAN_LINK_STATIC
1313
default m
1414
help
1515
This builds bpfilter kernel module with embedded user mode helper

0 commit comments

Comments
 (0)