]> git.baikalelectronics.ru Git - kernel.git/commit
bpfilter: Allow to build bpfilter_umh as a module without static library
authorMasahiro Yamada <masahiroy@kernel.org>
Wed, 1 Jul 2020 09:26:44 +0000 (18:26 +0900)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 14 Jul 2020 19:37:06 +0000 (12:37 -0700)
commit7d0fd861bd3e63cd1d3aeff4b365084d05d65068
treeb608e7df549dc65400597477fc019153d3a8946b
parent1b368559f04798dd82ffcbf8162cf47efa251b9a
bpfilter: Allow to build bpfilter_umh as a module without static library

Originally, bpfilter_umh was linked with -static only when
CONFIG_BPFILTER_UMH=y.

Commit 7b71ced03b39 ("bpfilter: use 'userprogs' syntax to build
bpfilter_umh") silently, accidentally dropped the CONFIG_BPFILTER_UMH=y
test in the Makefile. Revive it in order to link it dynamically when
CONFIG_BPFILTER_UMH=m.

Since commit 9177d2ccd9e8 ("bpfilter: check if $(CC) can link static
libc in Kconfig"), the compiler must be capable of static linking to
enable CONFIG_BPFILTER_UMH, but it requires more than needed.

To loosen the compiler requirement, I changed the dependency as follows:

    depends on CC_CAN_LINK
    depends on m || CC_CAN_LINK_STATIC

If CONFIG_CC_CAN_LINK_STATIC in unset, CONFIG_BPFILTER_UMH is restricted
to 'm' or 'n'.

In theory, CONFIG_CC_CAN_LINK is not required for CONFIG_BPFILTER_UMH=y,
but I did not come up with a good way to describe it.

Fixes: 7b71ced03b39 ("bpfilter: use 'userprogs' syntax to build bpfilter_umh")
Reported-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Tested-by: Michal Kubecek <mkubecek@suse.cz>
Link: https://lore.kernel.org/bpf/20200701092644.762234-1-masahiroy@kernel.org
net/bpfilter/Kconfig
net/bpfilter/Makefile