aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-12-02 17:42:17 +0000
committerFelix Fietkau <nbd@openwrt.org>2012-12-02 17:42:17 +0000
commit230a9f2b783e107de4693a934bbb96d4447db027 (patch)
treecafdd6c491f8df158fdeacb49daa06072836a334 /include
parenta2cd55ec721f43628e94e9452f02fcdbd7b5d8b7 (diff)
downloadupstream-230a9f2b783e107de4693a934bbb96d4447db027.tar.gz
upstream-230a9f2b783e107de4693a934bbb96d4447db027.tar.bz2
upstream-230a9f2b783e107de4693a934bbb96d4447db027.zip
kernel: fix stripping symbol exports
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34458 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'include')
-rw-r--r--include/kernel-build.mk30
1 files changed, 23 insertions, 7 deletions
diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index cf8737c8ee..2ae80e54e2 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -67,24 +67,40 @@ define BuildKernel
$(Kernel/Prepare)
touch $$@
- $(KERNEL_BUILD_DIR)/symtab.txt: FORCE
+ $(KERNEL_BUILD_DIR)/symtab.h: FORCE
+ rm -f $(KERNEL_BUILD_DIR)/symtab.h
+ touch $(KERNEL_BUILD_DIR)/symtab.h
+ +$(MAKE) $(KERNEL_MAKEOPTS) vmlinux
find $(LINUX_DIR) $(STAGING_DIR_ROOT)/lib/modules -name \*.ko | \
xargs $(TARGET_CROSS)nm | \
awk '$$$$1 == "U" { print $$$$2 } ' | \
- sort -u > $$@
-
- $(KERNEL_BUILD_DIR)/symtab.h: $(KERNEL_BUILD_DIR)/symtab.txt
+ sort -u > $(KERNEL_BUILD_DIR)/mod_symtab.txt
+ $(TARGET_CROSS)nm -n $(LINUX_DIR)/vmlinux.o | grep ' r __ksymtab' | sed -e 's,........ r __ksymtab_,,' > $(KERNEL_BUILD_DIR)/kernel_symtab.txt
+ grep -f $(KERNEL_BUILD_DIR)/mod_symtab.txt $(KERNEL_BUILD_DIR)/kernel_symtab.txt > $(KERNEL_BUILD_DIR)/sym_include.txt
+ grep -vf $(KERNEL_BUILD_DIR)/mod_symtab.txt $(KERNEL_BUILD_DIR)/kernel_symtab.txt > $(KERNEL_BUILD_DIR)/sym_exclude.txt
( \
echo '#define SYMTAB_KEEP \'; \
- cat $(KERNEL_BUILD_DIR)/symtab.txt | \
+ cat $(KERNEL_BUILD_DIR)/sym_include.txt | \
awk '{print "*(__ksymtab." $$$$1 ") \\" }'; \
echo; \
echo '#define SYMTAB_KEEP_GPL \'; \
- cat $(KERNEL_BUILD_DIR)/symtab.txt | \
+ cat $(KERNEL_BUILD_DIR)/sym_include.txt | \
awk '{print "*(__ksymtab_gpl." $$$$1 ") \\" }'; \
echo; \
echo '#define SYMTAB_KEEP_STR \'; \
- cat $(KERNEL_BUILD_DIR)/symtab.txt | \
+ cat $(KERNEL_BUILD_DIR)/sym_include.txt | \
+ awk '{print "*(__ksymtab_strings." $$$$1 ") \\" }'; \
+ echo; \
+ echo '#define SYMTAB_DISCARD \'; \
+ cat $(KERNEL_BUILD_DIR)/sym_exclude.txt | \
+ awk '{print "*(__ksymtab." $$$$1 ") \\" }'; \
+ echo; \
+ echo '#define SYMTAB_DISCARD_GPL \'; \
+ cat $(KERNEL_BUILD_DIR)/sym_exclude.txt | \
+ awk '{print "*(__ksymtab_gpl." $$$$1 ") \\" }'; \
+ echo; \
+ echo '#define SYMTAB_DISCARD_STR \'; \
+ cat $(KERNEL_BUILD_DIR)/sym_exclude.txt | \
awk '{print "*(__ksymtab_strings." $$$$1 ") \\" }'; \
echo; \
) > $$@