VirtualBox

Changeset 70161 in vbox


Ignore:
Timestamp:
Dec 15, 2017 5:03:56 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
119723
Message:

Linux drivers: check for unresolved symbols at build time.
bugref:4567: Linux kernel driver maintenance
This change breaks the build if test builds of Linux kernel drivers contain
unresolved symbols. It saves the symbols produced during the vboxdrv and
vboxguest builds and makes them available during the host modules and
vboxsf builds respectively to prevent the IPRT symbols from coming up as
missing. It is not particularly elegant, in particular it uses the tst*.run
test build targets for saving symbols, but seems to do the job.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config.kmk

    r70122 r70161  
    42274227 # Using the extra expansion to replace $(module) before eval, thus everything
    42284228 # else needs escaped dollars.
     4229 #
     4230 # Since Linux KBuild will not abort due to undefined symbols when building
     4231 # external modules we need to grep the error output ourselves.  Since vboxdrv
     4232 # and vboxguest respectively provide symbols that other modules use, we use
     4233 # the rule target (tst*.run) to save those symbols so that KBuild can do its
     4234 # checking.  Note in this context the (unescaped) variables $(save_symvers)
     4235 # and $(use_symvers).
    42294236 define VBOX_LINUX_GENERATE_KMOD_TEST
    42304237  VBOX_TARGET_$(module) = $$(PATH_TARGET)/tst$(module)$(subst /,_,$(KERN_DIR))_mod.run
     4238  symvers_$(module)_dep = $$(if $(use_symvers),$$(if $$(eq $(use_symvers),$(module)),,\
     4239$$(PATH_TARGET)/tst$(use_symvers)$(subst /,_,$(KERN_DIR))_mod.run))
    42314240  TESTING      += $$(VBOX_TARGET_$(module))
    42324241  OTHERS       += $$(VBOX_TARGET_$(module))
    42334242  OTHERS_CLEAN += $$(VBOX_TARGET_$(module))
    4234   $$(VBOX_TARGET_$(module)): $$$$($(module)_2_STAGE_TARGETS)
     4243  $$(VBOX_TARGET_$(module)): $$$$($(module)_2_STAGE_TARGETS) $$(symvers_$(module)_dep)
    42354244        $(QUIET)$$(call MSG_L1,Doing a test build of the $(module) kernel module)
    42364245        $(QUIET)$$(RM) -f -- "$$@"
     
    42404249        $(QUIET)$$(CP) -R -- "$$(PATH_STAGE_BIN)/../$$($(module)_INST)" "$$(PATH_TARGET)/tst$(module)_mod/"
    42414250        + $(QUIET)make KBUILD_VERBOSE=$(KBUILD_VERBOSE) KERN_DIR=$(KERN_DIR) -C $$(PATH_TARGET)/tst$(module)_mod clean
    4242         + $(QUIET)make KBUILD_VERBOSE=$(KBUILD_VERBOSE) KERN_DIR=$(KERN_DIR) $(if-expr $(KMK_OPTS_JOBS) != 1,JOBS=$(KMK_OPTS_JOBS),) -C $$(PATH_TARGET)/tst$(module)_mod
     4251        $(QUIET)$$(if $$(eq $$(symvers_$(module)_dep),),,\
     4252$$(CP) $$(symvers_$(module)_dep) "$$(PATH_TARGET)/tst$(module)_mod/Module.symvers")
     4253        + $(QUIET)make KBUILD_VERBOSE=$(KBUILD_VERBOSE) KERN_DIR=$(KERN_DIR) $(if-expr $(KMK_OPTS_JOBS) != 1,JOBS=$(KMK_OPTS_JOBS),) -C $$(PATH_TARGET)/tst$(module)_mod \
     4254                2> "$$(PATH_TARGET)/tst$(module)_mod/make.err"
     4255        $(QUIET)! grep "^WARNING: .* undefined!$$$$" "$$(PATH_TARGET)/tst$(module)_mod/make.err"
    42434256  if1of ($(USERNAME), bird)
    42444257        - nm -u "$$(PATH_TARGET)/tst$(module)_mod/"*.ko | sort
    42454258  endif
     4259        $(QUIET)$$(if $$(eq $(save_symvers),$(module)),\
     4260$$(CP) "$$(PATH_TARGET)/tst$(module)_mod/Module.symvers" "$$@",\
     4261$(QUIET)$$(APPEND) -t "$$@" "done")
    42464262        $(QUIET)$$(RM) -Rf -- $$(PATH_TARGET)/tst$(module)_mod
    4247         $(QUIET)$$(APPEND) -t "$$@" "done"
    42484263 endef
    42494264endif
  • trunk/src/VBox/Additions/common/VBoxGuest/Makefile.kmk

    r70146 r70161  
    236236  && "$(KBUILD_HOST_ARCH)" == "$(KBUILD_TARGET_ARCH)"
    237237  ifneq ($(KERN_DIR),)
     238   save_symvers = vboxguest-src
    238239   $(foreach module, vboxguest-src, $(evalcall2 VBOX_LINUX_GENERATE_KMOD_TEST))
    239240  endif
  • trunk/src/VBox/Additions/linux/Makefile.kmk

    r70084 r70161  
    364364 && "$(KBUILD_HOST_ARCH)" == "$(KBUILD_TARGET_ARCH)"
    365365 ifneq ($(KERN_DIR),)
    366   $(foreach module, vboxsf-src vboxvideo-src, $(evalcall2 VBOX_LINUX_GENERATE_KMOD_TEST))
     366  use_symvers = vboxguest-src
     367  module      = vboxsf-src
     368  $(evalcall2 VBOX_LINUX_GENERATE_KMOD_TEST)
     369  use_symvers =
     370  module      = vboxvideo-src
     371  $(evalcall2 VBOX_LINUX_GENERATE_KMOD_TEST)
    367372 endif
    368373endif
  • trunk/src/VBox/HostDrivers/Makefile.kmk

    r69534 r70161  
    7878
    7979 ifneq ($(KERN_DIR),)
     80  save_symvers = vboxdrv-src
     81  use_symvers  = vboxdrv-src
    8082  $(foreach module, vboxdrv-src $(if $(VBOX_WITH_NETFLT),VBoxNetFlt-src) \
    8183   $(if $(VBOX_WITH_NETADP),VBoxNetAdp-src) $(if $(VBOX_WITH_PCI_PASSTHROUGH),VBoxPci-src), \
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette