Commit 0d96fb20b7ed757fc936bb35e26c22251a75b734

Authored by Richard Hacker
Committed by Sam Ravnborg
1 parent 2d04b5ae1b

kbuild: Add new Kbuild variable KBUILD_EXTRA_SYMBOLS

This patch adds a new (Kbuild) Makefile variable KBUILD_EXTRA_SYMBOLS.
The space separated list of file names assigned to KBUILD_EXTRA_SYMBOLS
is used when calling scripts/mod/modpost during stage 2 of the Kbuild
process for non-kernel-tree modules.

Signed-off-by: Richard Hacker <lerichi@gmx.net>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

Showing 2 changed files with 16 additions and 1 deletions Side-by-side Diff

Documentation/kbuild/modules.txt
... ... @@ -486,7 +486,7 @@
486 486 Sometimes, an external module uses exported symbols from another
487 487 external module. Kbuild needs to have full knowledge on all symbols
488 488 to avoid spitting out warnings about undefined symbols.
489   - Two solutions exist to let kbuild know all symbols of more than
  489 + Three solutions exist to let kbuild know all symbols of more than
490 490 one external module.
491 491 The method with a top-level kbuild file is recommended but may be
492 492 impractical in certain situations.
... ... @@ -522,6 +522,13 @@
522 522 build is finished, a new Module.symvers file is created
523 523 containing the sum of all symbols defined and not part of the
524 524 kernel.
  525 +
  526 + Use make variable KBUILD_EXTRA_SYMBOLS in the Makefile
  527 + If it is impractical to copy Module.symvers from another
  528 + module, you can assign a space separated list of files to
  529 + KBUILD_EXTRA_SYMBOLS in your Makfile. These files will be
  530 + loaded by modpost during the initialisation of its symbol
  531 + tables.
525 532  
526 533 === 8. Tips & Tricks
527 534  
scripts/Makefile.modpost
... ... @@ -42,6 +42,13 @@
42 42  
43 43 include include/config/auto.conf
44 44 include scripts/Kbuild.include
  45 +
  46 +ifneq ($(KBUILD_EXTMOD),)
  47 +# Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS
  48 +include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \
  49 + $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile)
  50 +endif
  51 +
45 52 include scripts/Makefile.lib
46 53  
47 54 kernelsymfile := $(objtree)/Module.symvers
... ... @@ -69,6 +76,7 @@
69 76 $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \
70 77 $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
71 78 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
  79 + $(if $(iKBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(EXTRA_SYMBOLS))) \
72 80 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
73 81 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
74 82 $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \