kernel compile fails if device bpf is not enabled

2023-02-07 Thread Gary Jennejohn
I just saw this error today because I didn't have device bpf enabled in
my kernel configuration file:

--
>>> stage 3.1: building everything
--
linking kernel.full
ld: error: undefined symbol: bpf_mtap_if
>>> referenced by if.c:4724 (/usr/src/sys/net/if.c:4724)
>>>   if.o:(if_bpfmtap)
>>> referenced by if_tuntap.c:1717 (/usr/src/sys/net/if_tuntap.c:1717)
>>>   if_tuntap.o:(tunread)
>>> referenced by if_vlan.c:1292 (/usr/src/sys/net/if_vlan.c:1292)
>>>   if_vlan.o:(vlan_transmit)

ld: error: undefined symbol: bpf_mtap2_if
>>> referenced by if_gif.c:323 (/usr/src/sys/net/if_gif.c:323)
>>>   if_gif.o:(gif_transmit)
>>> referenced by if_tuntap.c:1816 (/usr/src/sys/net/if_tuntap.c:1816)
>>>   if_tuntap.o:(tunwrite)
--- kernel.full ---
*** [kernel.full] Error code 1

This happens because a dummy bpf_mtap_if() (called a NOP stub in bpf.c)
isn't being defined if bpf is not enabled.

--
Gary Jennejohn



buildkernel avoidably building modules specified in the config

2023-02-07 Thread Mateusz Guzik
... then a lot of the code ends up being compiled twice for no good reason.

This popped up again as clang 15 emits a ton of warnings vs K&R funcs.

I don't know how this works internally, is it really a big problem to sort out?
I figured config(8) could generate a bunch of WITHOUT_ of similar, but I guess
sys/modules/Makefile will have to be patched to support it, which it
only does for some modules at the moment.

I don't have any interest in working on it, so just bringing this up
for interested.
-- 
Mateusz Guzik 



Re: buildkernel avoidably building modules specified in the config

2023-02-07 Thread Warner Losh
On Tue, Feb 7, 2023, 5:20 PM Mateusz Guzik  wrote:

> ... then a lot of the code ends up being compiled twice for no good reason.
>
> This popped up again as clang 15 emits a ton of warnings vs K&R funcs.
>
> I don't know how this works internally, is it really a big problem to sort
> out?
> I figured config(8) could generate a bunch of WITHOUT_ of similar, but I
> guess
> sys/modules/Makefile will have to be patched to support it, which it
> only does for some modules at the moment.
>
> I don't have any interest in working on it, so just bringing this up
> for interested.
>

Yea... it's on the list that config.ng would do... At one point modules and
kernel .o files were built differently which precluded a number of Makefile
hacks.

Warner

Warner

>


Re: kernel compile fails if device bpf is not enabled

2023-02-07 Thread Zhenlei Huang
Hi Gary,

Thanks for the report! Post the fix to Phabricator 
https://reviews.freebsd.org/D38432  .

Best regards,
Zhenlei

> On Feb 7, 2023, at 5:08 PM, Gary Jennejohn  wrote:
> 
> I just saw this error today because I didn't have device bpf enabled in
> my kernel configuration file:
> 
> --
 stage 3.1: building everything
> --
> linking kernel.full
> ld: error: undefined symbol: bpf_mtap_if
 referenced by if.c:4724 (/usr/src/sys/net/if.c:4724)
  if.o:(if_bpfmtap)
 referenced by if_tuntap.c:1717 (/usr/src/sys/net/if_tuntap.c:1717)
  if_tuntap.o:(tunread)
 referenced by if_vlan.c:1292 (/usr/src/sys/net/if_vlan.c:1292)
  if_vlan.o:(vlan_transmit)
> 
> ld: error: undefined symbol: bpf_mtap2_if
 referenced by if_gif.c:323 (/usr/src/sys/net/if_gif.c:323)
  if_gif.o:(gif_transmit)
 referenced by if_tuntap.c:1816 (/usr/src/sys/net/if_tuntap.c:1816)
  if_tuntap.o:(tunwrite)
> --- kernel.full ---
> *** [kernel.full] Error code 1
> 
> This happens because a dummy bpf_mtap_if() (called a NOP stub in bpf.c)
> isn't being defined if bpf is not enabled.
> 
> --
> Gary Jennejohn
> 





Re: kernel compile fails if device bpf is not enabled

2023-02-07 Thread Gary Jennejohn
On Wed, 8 Feb 2023 12:49:46 +0800
Zhenlei Huang  wrote:

Hi Zhenlei,

> Thanks for the report! Post the fix to Phabricator 
> https://reviews.freebsd.org/D38432  .
>
> Best regards,
> Zhenlei
>

Thanks!  I see it's been accepted.

> > On Feb 7, 2023, at 5:08 PM, Gary Jennejohn  wrote:
> >
> > I just saw this error today because I didn't have device bpf enabled in
> > my kernel configuration file:
> >
> > --
>  stage 3.1: building everything
> > --
> > linking kernel.full
> > ld: error: undefined symbol: bpf_mtap_if
>  referenced by if.c:4724 (/usr/src/sys/net/if.c:4724)
>   if.o:(if_bpfmtap)
>  referenced by if_tuntap.c:1717 (/usr/src/sys/net/if_tuntap.c:1717)
>   if_tuntap.o:(tunread)
>  referenced by if_vlan.c:1292 (/usr/src/sys/net/if_vlan.c:1292)
>   if_vlan.o:(vlan_transmit)
> >
> > ld: error: undefined symbol: bpf_mtap2_if
>  referenced by if_gif.c:323 (/usr/src/sys/net/if_gif.c:323)
>   if_gif.o:(gif_transmit)
>  referenced by if_tuntap.c:1816 (/usr/src/sys/net/if_tuntap.c:1816)
>   if_tuntap.o:(tunwrite)
> > --- kernel.full ---
> > *** [kernel.full] Error code 1
> >
> > This happens because a dummy bpf_mtap_if() (called a NOP stub in bpf.c)
> > isn't being defined if bpf is not enabled.
> >
> > --
> > Gary Jennejohn
> >

--
Gary Jennejohn