Commit b1183b6d authored by Masahiro Yamada's avatar Masahiro Yamada

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: default avatarValdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 9371f86e
...@@ -49,6 +49,11 @@ config CC_CAN_LINK ...@@ -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) $(m64-flag)) if 64BIT
default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(m32-flag)) 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 config CC_HAS_ASM_GOTO
def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC)) def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC))
......
...@@ -9,7 +9,7 @@ menuconfig BPFILTER ...@@ -9,7 +9,7 @@ menuconfig BPFILTER
if BPFILTER if BPFILTER
config BPFILTER_UMH config BPFILTER_UMH
tristate "bpfilter kernel module with user mode helper" tristate "bpfilter kernel module with user mode helper"
depends on CC_CAN_LINK depends on CC_CAN_LINK_STATIC
default m default m
help help
This builds bpfilter kernel module with embedded user mode helper This builds bpfilter kernel module with embedded user mode helper
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment