-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkabitools-pegas-kernel-make.patch
121 lines (109 loc) · 4.07 KB
/
kabitools-pegas-kernel-make.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
diff --git a/.gitignore b/.gitignore
index c2ed4ec..5206c9d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -114,3 +114,5 @@ all.config
# Kdevelop4
*.kdev4
+*.kbg
+*.list
diff --git a/Makefile b/Makefile
index 414f84a..5bb203f 100644
--- a/Makefile
+++ b/Makefile
@@ -99,6 +99,16 @@ endif
export quiet Q KBUILD_VERBOSE
+# Call the kabiparser to create a graph for each c file in the build.
+# Use 'make K=1' to invoke the kabiparser during the build.
+
+ifeq ("$(origin K)", "command line")
+ KBUILD_KABIPARSER = $(K)
+endif
+ifndef KBUILD_KABIPARSER
+ KBUILD_KABIPARSER = 0
+endif
+
# kbuild supports saving output files in a separate directory.
# To locate output files in a separate directory two syntaxes are supported.
# In both cases the working directory must be the root of the kernel src.
@@ -340,7 +350,7 @@ ifeq ($(MAKECMDGOALS),)
endif
export KBUILD_MODULES KBUILD_BUILTIN
-export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
+export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD KBUILD_KABIPARSER
# We need some generic definitions (do not try to remake the file).
scripts/Kbuild.include: ;
@@ -363,6 +373,7 @@ DEPMOD = /sbin/depmod
PERL = perl
PYTHON = python
CHECK = sparse
+KABIPARSER = $(shell [ -x "/usr/sbin/kabi-parser" ] && echo kabi-parser)
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
-Wbitwise -Wno-return-void $(CF)
@@ -431,7 +442,7 @@ KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(S
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
export CPP AR NM STRIP OBJCOPY OBJDUMP
-export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE
+export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE KABIPARSER
export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
@@ -1327,6 +1338,7 @@ distclean: mrproper
@find $(srctree) $(RCS_FIND_IGNORE) \
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
+ -o -name '*.i' -o -name '*.kbg' -o -name 'kabi-datafiles.*' \
-o -name '.*.rej' -o -name '*%' -o -name 'core' \) \
-type f -print | xargs rm -f
@@ -1436,6 +1448,7 @@ help:
@echo ' 2: warnings which occur quite often but may still be relevant'
@echo ' 3: more obscure warnings, can most likely be ignored'
@echo ' Multiple levels can be combined with W=12 or W=123'
+ @echo ' make K=1 [targets] Build kabitools database.'
@echo ''
@echo 'Execute "make" or "make all" to build all targets marked with [*] '
@echo 'For further info see the ./README file'
diff --git a/redhat/.gitignore b/redhat/.gitignore
index b8b692c..c71c341 100644
--- a/redhat/.gitignore
+++ b/redhat/.gitignore
@@ -9,3 +9,4 @@ kabi/Module.kabi_x86_64
kabi/kabi-current
kabi/kabi-rhel7?
kabi/kabi-rhel7?/*
+kabi/kabi-datafiles.list
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index d883116..5ab6bf7 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -30,6 +30,9 @@ ldflags-y :=
subdir-asflags-y :=
subdir-ccflags-y :=
+KABIDATADIR = redhat/kabi
+KABIDATAFILE = $(KABIDATADIR)/kabi-datafiles.list
+
# Read auto.conf if it exists, otherwise ignore
-include include/config/auto.conf
@@ -201,11 +204,24 @@ else
cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $<
+ifeq ($(KBUILD_KABIPARSER),1)
+cmd_kabiparser = \
+ $(CPP) $(c_flags) -o $(1) $<; \
+ $(KABIPARSER) -xo $(2) -f $(1) -S -Wall_off; \
+ test -e $(2) && echo $(2) >> $(KABIDATAFILE); \
+ rm -f $(1);
+else
+cmd_kabiparser = echo -n
+endif
+
cmd_modversions_c = \
if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \
$(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
> $(@D)/.tmp_$(@F:.o=.ver); \
\
+ [ "$(KABIPARSER)" ] && \
+ $(call cmd_kabiparser,$(@:.o=.i),$(@:.o=.kbg)) \
+ \
$(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
-T $(@D)/.tmp_$(@F:.o=.ver); \
rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \