-
Notifications
You must be signed in to change notification settings - Fork 0
/
kabitools-rhel8-kernel-make.patch
145 lines (129 loc) · 4.55 KB
/
kabitools-rhel8-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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
From caa2804453ec33973497a0a76a95298de9987f24 Mon Sep 17 00:00:00 2001
From: Tony Camuso <[email protected]>
Date: Tue, 15 Aug 2023 14:26:48 -0400
Subject: [PATCH] RHEL-8 changes for kabitools
modified: .gitignore
modified: Makefile
modified: redhat/.gitignore
modified: scripts/Makefile.build
Signed-off-by: Tony Camuso <[email protected]>
---
.gitignore | 2 ++
Makefile | 17 +++++++++++++++--
redhat/.gitignore | 1 +
scripts/Makefile.build | 16 ++++++++++++++++
4 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index 6beb06795ee4..d1bd9c52e111 100644
+++ b/.gitignore
@@ -114,6 +114,8 @@ GTAGS
# id-utils files
ID
+*.kbg
+*.list
*.orig
*~
\#*#
diff --git a/Makefile b/Makefile
index 3f2dbbe8da24..1f899fb79966 100644
--- a/Makefile
+++ b/Makefile
@@ -108,6 +108,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.
@@ -211,7 +221,7 @@ else
endif
endif
-export KBUILD_CHECKSRC KBUILD_EXTMOD KBUILD_SRC
+export KBUILD_CHECKSRC KBUILD_EXTMOD KBUILD_SRC KBUILD_KABIPARSER
objtree := .
src := $(srctree)
@@ -402,6 +412,7 @@ PYTHON = python
PYTHON2 = python2
PYTHON3 = python3
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 -Wno-unknown-attribute $(CF)
@@ -451,7 +462,7 @@ export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
export CPP AR NM STRIP OBJCOPY OBJDUMP PAHOLE RESOLVE_BTFIDS KBUILD_HOSTLDFLAGS
export KBUILD_HOSTLDLIBS
export MAKE LEX YACC AWK INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE
-export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
+export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS KABIPARSER
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
@@ -1442,6 +1453,7 @@ distclean: mrproper
@find $(srctree) $(RCS_FIND_IGNORE) \
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '*%' \
+ -o -name '*.i' -o -name '*.kbg' -o -name 'kabi-datafiles.*' \
-o -name 'core' \) \
-type f -print | xargs rm -f
@@ -1556,6 +1568,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 902056f4ed1a..8546cf046d01 100644
--- a/redhat/.gitignore
+++ b/redhat/.gitignore
@@ -6,4 +6,5 @@ kabi/Module.kabi_*
kabi/kabi-current
kabi/kabi-rhel8?
kabi/kabi-rhel8?/*
+kabi/kabi-datafiles.list
mock.cfg
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index c295c322c05c..d87550ef1a31 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -31,6 +31,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
@@ -192,11 +195,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) ; \
+ 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); \
--
2.27.0