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
|
From 674381b650bdfefd46ea9e887a7ed28410938a0c Mon Sep 17 00:00:00 2001
From: Jiri Benc <jbenc@redhat.com>
Date: Wed, 19 Feb 2020 11:52:21 +0100
Subject: [PATCH] redhat: rh_kabi: deduplication friendly structs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Acked-by: Bruno Meneguele <bmeneg@redhat.com>
RH-Acked-by: Jesper Brouer <brouer@redhat.com>
RH-Acked-by: Prarit Bhargava <prarit@redhat.com>
RH-Acked-by: Jiri Olsa <jolsa@redhat.com>
RH-Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Upstream status: RHEL only
We don't really need the field names to be globally unique, it is enough
when they are unique in the given struct. Since structs do not generally
span mutliple files, using the line number is enough to ensure an unique
identifier. It means that we can't use two RH_KABI_RENAME macros on the same
line but that's not happening anyway.
This allows pahole to deduplicate the type info of structs using kABI
macros, lowering the size of vmlinuz from 26M to 8.5M.
Upstream Status: RHEL only
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
include/linux/rh_kabi.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/linux/rh_kabi.h b/include/linux/rh_kabi.h
index b90601e8a657..ea9c136bf884 100644
--- a/include/linux/rh_kabi.h
+++ b/include/linux/rh_kabi.h
@@ -163,6 +163,8 @@
# define __RH_KABI_CHECK_SIZE(_item, _size)
#endif
+#define RH_KABI_UNIQUE_ID __PASTE(rh_kabi_hidden_, __LINE__)
+
# define _RH_KABI_DEPRECATE(_type, _orig) _type rh_reserved_##_orig
# define _RH_KABI_DEPRECATE_FN(_type, _orig, _args...) \
_type (* rh_reserved_##_orig)(_args)
@@ -171,7 +173,7 @@
_new; \
struct { \
_orig; \
- } __UNIQUE_ID(rh_kabi_hide); \
+ } RH_KABI_UNIQUE_ID; \
__RH_KABI_CHECK_SIZE_ALIGN(_orig, _new); \
}
# define _RH_KABI_REPLACE_UNSAFE(_orig, _new) _new
@@ -218,7 +220,7 @@
#define RH_KABI_EXTEND_WITH_SIZE(_new, _size) \
RH_KABI_EXTEND(union { \
_new; \
- unsigned long __UNIQUE_ID(rh_kabi_reserved)[_size]; \
+ unsigned long RH_KABI_UNIQUE_ID[_size]; \
__RH_KABI_CHECK_SIZE(_new, 8 * (_size)); \
})
--
2.26.2
|