Skip to content

Commit

Permalink
bpfilter: check if $(CC) can link static libc in Kconfig
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
Acked-by: Alexei Starovoitov <[email protected]>
  • Loading branch information
masahir0y committed May 17, 2020
1 parent 9371f86 commit b1183b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
2 changes: 1 addition & 1 deletion net/bpfilter/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b1183b6

Please sign in to comment.