summaryrefslogtreecommitdiffstats
path: root/0001-redhat-rh_kabi-deduplication-friendly-structs.patch
diff options
context:
space:
mode:
Diffstat (limited to '0001-redhat-rh_kabi-deduplication-friendly-structs.patch')
-rw-r--r--0001-redhat-rh_kabi-deduplication-friendly-structs.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/0001-redhat-rh_kabi-deduplication-friendly-structs.patch b/0001-redhat-rh_kabi-deduplication-friendly-structs.patch
new file mode 100644
index 000000000..1e1edd71e
--- /dev/null
+++ b/0001-redhat-rh_kabi-deduplication-friendly-structs.patch
@@ -0,0 +1,65 @@
+From 712d5caafb841524ec3a5e9499e5ab9f4818d9ca 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.0
+