Skip to contentSkip to conversation

Makefile: export-symbol

RFC PATCH New Nishanth Aravamudan 1 participant 1 message Apr 14, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/2 Makefile: export-symbol

Not sure if everyone on the list follows LKML, but the report mentioned below (depending on the discussion that might occur on LKML) may be a useful tool for a janitorial task. Lots of exports that are unused (similar to what Adrian Bunk's been doing). Maybe a find, verify with maintainer kind of thing (ideally, the subsystem maintainers would do that themselves, but they are busy people :)

Thanks,
Nish

----- Forwarded message from Ram Pai <[email protected]> -----

Date: Thu, 13 Apr 2006 05:38:26 -0700 (PDT)
From: Ram Pai <[email protected]>
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected],
[email protected]
Subject: [RFC PATCH 1/2] Makefile: export-symbol usage report generator.

I ran a report to extract export-symbol usage by kernel modules. The results are at http://www.sudhaa.com/~ram/misc/export_report.txt

The report lists:
1. All the exported symbols and their usage counts by in-kernel modules.
2. for each in-kernel module, lists the modules and the exported symbols from those modules, that it depends on.

Highlights:
On x86 architecture
(1) 880 exported symbols not used by any in-kernel modules.
(2) 1792 exported symbols used only once.

I hope this report/tool shall help all inkernel modules to revisit their usage of kernel interfaces.

This patch integrates the report-generator into the kernel build process. After applying this patch, invoke 'make export_report' and it creates the report in Documentation/export_report.txt

Signed-off-by Ram Pai ([email protected])

 Makefile                 |   12 ++++
 scripts/Makefile.modpost |    7 ++
 scripts/export_report.pl    |  135 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 154 insertions(+)
scripts/Makefile.modpost +7 -0
Index: 2617rc1/scripts/Makefile.modpost
===================================================================
@@ -60,9 +60,16 @@
 	$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
 	$(filter-out FORCE,$^)
 
+quiet_cmd_importfile = IMPORT_EXTRACT
+      cmd_importfile =  perl $(objtree)/scripts/export_report.pl  \
+	-k $(kernelsymfile) \
+	-o $(objtree)/Documentation/export_report.txt	\
+	$(patsubst %.o,%.mod.c,$(filter-out vmlinux FORCE, $^))
+
 PHONY += __modpost
 __modpost: $(wildcard vmlinux) $(modules:.ko=.o) FORCE
 	$(call cmd,modpost)
+	$(if $(KBUILD_EXPORT_REPORT), $(call cmd,importfile))
 
 # Declare generated files as targets for modpost
 $(symverfile):         __modpost ;
scripts/export_report.pl new file +134 -0

134 lines not on this page · raw message

Makefile +13 -1
Index: 2617rc1/Makefile
===================================================================
@@ -363,7 +363,7 @@
 # Detect when mixed targets is specified, and make a second invocation
 # of make so .config is not included in this case either (for *config).
 
-no-dot-config-targets := clean mrproper distclean \
+no-dot-config-targets := clean mrproper distclean export_report\
 			 cscope TAGS tags help %docs check%
 
 config-targets := 0
@@ -433,6 +433,16 @@
 core-y		:= usr/
 endif # KBUILD_EXTMOD
 
+ifeq ($(MAKECMDGOALS), export_report)
+  	KBUILD_EXPORT_REPORT := 1
+	export KBUILD_EXPORT_REPORT
+endif
+
+PHONY += export_report
+export_report: FORCE
+	$(Q)$(MAKE) allmodconfig 
+	$(Q)$(MAKE) vmlinux modules
+
 ifeq ($(dot-config),1)
 # In this section, we need .config
 
@@ -1029,6 +1039,8 @@
 	@echo  '  cscope	  - Generate cscope index'
 	@echo  '  kernelrelease	  - Output the release version string'
 	@echo  '  kernelversion	  - Output the version stored in Makefile'
+	@echo  '  export_report	  - Output the export symbol usage '
+	@echo  '		 	in Documentation/export_symbol.txt'
 	@echo  ''
 	@echo  'Static analysers'
 	@echo  '  checkstack      - Generate a list of stack hogs'

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

----- End forwarded message -----

Signature · 2 lines
Nishanth Aravamudan <[email protected]>
IBM Linux Technology Center

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors