dingjian / rpms / kernel-rt

Forked from rpms/kernel-rt 4 years ago
Clone
Blob Blame History Raw
From d6c9ac2154fa4f4f71ea3c2072922e954b73f3e1 Mon Sep 17 00:00:00 2001
From: Clark Williams <williams@redhat.com>
Date: Wed, 20 Jul 2016 10:50:33 -0500
Subject: [PATCH] avoid debuginfo hash collision scripts

Signed-off-by: Clark Williams <williams@redhat.com>
---
 arch/x86/vdso/Makefile                  | 3 +++
 arch/x86/vdso/vclock_gettime.c          | 2 ++
 arch/x86/vdso/vdso32-setup.c            | 2 ++
 arch/x86/vdso/vdso32/note.S             | 1 +
 scripts/Makefile                        | 2 +-
 scripts/Makefile.build                  | 2 +-
 scripts/asn1_compiler.c                 | 2 ++
 scripts/basic/Makefile                  | 1 +
 scripts/basic/bin2c.c                   | 2 ++
 scripts/basic/fixdep.c                  | 2 ++
 scripts/genksyms/Makefile               | 1 +
 scripts/genksyms/genksyms.c             | 2 ++
 scripts/kallsyms.c                      | 2 ++
 scripts/kconfig/Makefile                | 3 +++
 scripts/kconfig/conf.c                  | 2 ++
 scripts/mod/Makefile                    | 1 +
 scripts/mod/mk_elfconfig.c              | 2 ++
 scripts/mod/modpost.c                   | 2 ++
 scripts/recordmcount.c                  | 2 ++
 scripts/selinux/genheaders/Makefile     | 2 +-
 scripts/selinux/genheaders/genheaders.c | 1 +
 scripts/selinux/mdp/Makefile            | 2 +-
 scripts/selinux/mdp/mdp.c               | 2 ++
 scripts/sortextable.c                   | 2 ++
 scripts/unifdef.c                       | 2 ++
 25 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index 10596e431f0e..26e6cf48ff0e 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -4,6 +4,9 @@
 #
 OBJECT_FILES_NON_STANDARD	:= y
 
+KBUILD_CFLAGS += -DDBGNFO=\"$(KERNELRELEASE)\"
+KBUILD_AFLAGS += -DDBGNFO=\"$(KERNELRELEASE)\"
+
 VDSO64-$(CONFIG_X86_64)		:= y
 VDSOX32-$(CONFIG_X86_X32_ABI)	:= y
 VDSO32-$(CONFIG_X86_32)		:= y
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index fe52205d9263..92be9cdbae49 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -27,6 +27,8 @@
 
 #define gtod (&VVAR(vsyscall_gtod_data))
 
+const char * dbgnfo = DBGNFO;
+
 notrace static cycle_t vread_tsc(void)
 {
 	cycle_t ret = (cycle_t)rdtsc_ordered();
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 0faad646f5fd..f57656b9e60b 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -76,6 +76,8 @@ __setup_param("vdso=", vdso32_setup, vdso_setup, 0);
 EXPORT_SYMBOL_GPL(vdso_enabled);
 #endif
 
+const char * dbgnfo = DBGNFO;
+
 static __init void reloc_symtab(Elf32_Ehdr *ehdr,
 				unsigned offset, unsigned size)
 {
diff --git a/arch/x86/vdso/vdso32/note.S b/arch/x86/vdso/vdso32/note.S
index c83f25734696..6e25bcc8a40f 100644
--- a/arch/x86/vdso/vdso32/note.S
+++ b/arch/x86/vdso/vdso32/note.S
@@ -11,6 +11,7 @@
    kernel's name. */
 ELFNOTE_START(Linux, 0, "a")
 	.long LINUX_VERSION_CODE
+	.string DBGNFO
 ELFNOTE_END
 
 #ifdef CONFIG_XEN
diff --git a/scripts/Makefile b/scripts/Makefile
index 62e6cc222fb0..befe20a87dd8 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -8,7 +8,7 @@
 # conmakehash:	 Create arrays for initializing the kernel console tables
 # docproc:       Used in Documentation/DocBook
 
-HOST_EXTRACFLAGS += -I$(srctree)/tools/include
+HOST_EXTRACFLAGS += -I$(srctree)/tools/include -DDBGNFO=\"$(KERNELRELEASE)\"
 
 hostprogs-$(CONFIG_KALLSYMS)     += kallsyms
 hostprogs-$(CONFIG_LOGO)         += pnmtologo
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 61527b09ac66..63a8316fe46c 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -19,7 +19,7 @@ targets :=
 subdir-y :=
 subdir-m :=
 EXTRA_AFLAGS   :=
-EXTRA_CFLAGS   :=
+EXTRA_CFLAGS   := -DDBGNFO=\"$(KernelVer)\"
 EXTRA_CPPFLAGS :=
 EXTRA_LDFLAGS  :=
 asflags-y  :=
diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c
index ec2ed45e20f6..58c8f6a21307 100644
--- a/scripts/asn1_compiler.c
+++ b/scripts/asn1_compiler.c
@@ -20,6 +20,8 @@
 #include <sys/stat.h>
 #include <linux/asn1_ber_bytecode.h>
 
+const char * dbgnfo = DBGNFO;
+
 enum token_type {
 	DIRECTIVE_ABSENT,
 	DIRECTIVE_ALL,
diff --git a/scripts/basic/Makefile b/scripts/basic/Makefile
index ec10d9345bc2..c3092e084a39 100644
--- a/scripts/basic/Makefile
+++ b/scripts/basic/Makefile
@@ -8,6 +8,7 @@
 # ---------------------------------------------------------------------------
 # fixdep: 	 Used to generate dependency information during build process
 
+HOST_EXTRACFLAGS += -DDBGNFO=\"$(KERNELRELEASE)\"
 hostprogs-y	:= fixdep
 hostprogs-$(CONFIG_BUILD_BIN2C)     += bin2c
 always		:= $(hostprogs-y)
diff --git a/scripts/basic/bin2c.c b/scripts/basic/bin2c.c
index af187e695345..24ee6e493fcf 100644
--- a/scripts/basic/bin2c.c
+++ b/scripts/basic/bin2c.c
@@ -9,6 +9,8 @@
 
 #include <stdio.h>
 
+const char * dbgnfo = DBGNFO;
+
 int main(int argc, char *argv[])
 {
 	int ch, total = 0;
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 078fe1d64e7d..d8a993d5b22f 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -120,6 +120,8 @@
 #define INT_NFIG ntohl(0x4e464947)
 #define INT_FIG_ ntohl(0x4649475f)
 
+const char * dbgnfo = DBGNFO;
+
 char *target;
 char *depfile;
 char *cmdline;
diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile
index aca33b98bf63..fe64439746c7 100644
--- a/scripts/genksyms/Makefile
+++ b/scripts/genksyms/Makefile
@@ -1,4 +1,5 @@
 
+HOST_EXTRACFLAGS += -DDBGNFO=\"$(KERNELRELEASE)\"
 hostprogs-y	:= genksyms
 always		:= $(hostprogs-y)
 
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
index 88632df4381b..a89629b8acd7 100644
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -36,6 +36,8 @@
 
 #define HASH_BUCKETS  4096
 
+const char * dbgnfo = DBGNFO;
+
 static struct symbol *symtab[HASH_BUCKETS];
 static FILE *debugfile;
 
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 9a11f9f799f4..1d544535f8de 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -29,6 +29,8 @@
 
 #define KSYM_NAME_LEN		128
 
+const char * dbgnfo = DBGNFO;
+
 struct sym_entry {
 	unsigned long long addr;
 	unsigned int len;
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 844bc9da08da..65a1b02c4d9c 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -2,6 +2,9 @@
 # Kernel configuration targets
 # These targets are used from top-level makefile
 
+HOST_EXTRACFLAGS += -DDBGNFO=\"$(KernelVer)\"
+KBUILD_CFLAGS += -DDBGNFO=\"$(KernelVer)\"
+
 PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \
 	localmodconfig localyesconfig
 
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index bde5b95c8c19..f8328c349294 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -17,6 +17,8 @@
 
 #include "lkc.h"
 
+const char * dbgnfo = DBGNFO;
+
 static void conf(struct menu *menu);
 static void check_conf(struct menu *menu);
 static void xfgets(char *str, int size, FILE *in);
diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile
index d36fbfc859bd..7034c0800401 100644
--- a/scripts/mod/Makefile
+++ b/scripts/mod/Makefile
@@ -1,5 +1,6 @@
 OBJECT_FILES_NON_STANDARD := y
 
+HOST_EXTRACFLAGS += -DDBGNFO=\"$(KERNELRELEASE)\"
 hostprogs-y	:= modpost mk_elfconfig
 always		:= $(hostprogs-y) empty.o
 
diff --git a/scripts/mod/mk_elfconfig.c b/scripts/mod/mk_elfconfig.c
index 639bca7ba559..9babae46c4f2 100644
--- a/scripts/mod/mk_elfconfig.c
+++ b/scripts/mod/mk_elfconfig.c
@@ -3,6 +3,8 @@
 #include <string.h>
 #include <elf.h>
 
+const char * dbgnfo = DBGNFO;
+
 int
 main(int argc, char **argv)
 {
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 2b64dcd22b32..bc0991ccf07e 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -23,6 +23,8 @@
 #include "../../include/generated/uapi/linux/version.h"
 #include "../../include/linux/export.h"
 
+const char * dbgnfo = DBGNFO;
+
 /* Are we using CONFIG_MODVERSIONS? */
 int modversions = 0;
 /* Warn about undefined symbols? (do so if we have vmlinux) */
diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
index 9c22317778eb..52bfb472c90e 100644
--- a/scripts/recordmcount.c
+++ b/scripts/recordmcount.c
@@ -40,6 +40,8 @@
 #define R_METAG_NONE                     3
 #endif
 
+const char * dbgnfo = DBGNFO;
+
 static int fd_map;	/* File descriptor for file being modified. */
 static int mmap_failed; /* Boolean flag. */
 static void *ehdr_curr; /* current ElfXX_Ehdr *  for resource cleanup */
diff --git a/scripts/selinux/genheaders/Makefile b/scripts/selinux/genheaders/Makefile
index 417b165008ee..4ca9250ea655 100644
--- a/scripts/selinux/genheaders/Makefile
+++ b/scripts/selinux/genheaders/Makefile
@@ -1,5 +1,5 @@
 hostprogs-y	:= genheaders
-HOST_EXTRACFLAGS += -Isecurity/selinux/include
+HOST_EXTRACFLAGS += -Isecurity/selinux/include -DDBGNFO=\"$(KERNELRELEASE)\"
 
 always		:= $(hostprogs-y)
 clean-files	:= $(hostprogs-y)
diff --git a/scripts/selinux/genheaders/genheaders.c b/scripts/selinux/genheaders/genheaders.c
index 539855ff31f9..c107add8fe33 100644
--- a/scripts/selinux/genheaders/genheaders.c
+++ b/scripts/selinux/genheaders/genheaders.c
@@ -15,6 +15,7 @@ struct security_class_mapping {
 
 #define max(x, y) (((int)(x) > (int)(y)) ? x : y)
 
+const char * dbgnfo = DBGNFO;
 const char *progname;
 
 static void usage(void)
diff --git a/scripts/selinux/mdp/Makefile b/scripts/selinux/mdp/Makefile
index eb365b333441..96052f20cda6 100644
--- a/scripts/selinux/mdp/Makefile
+++ b/scripts/selinux/mdp/Makefile
@@ -1,5 +1,5 @@
 hostprogs-y	:= mdp
-HOST_EXTRACFLAGS += -Isecurity/selinux/include
+HOST_EXTRACFLAGS += -Isecurity/selinux/include -DDBGNFO=\"$(KERNELRELEASE)\"
 
 always		:= $(hostprogs-y)
 clean-files	:= $(hostprogs-y) policy.* file_contexts
diff --git a/scripts/selinux/mdp/mdp.c b/scripts/selinux/mdp/mdp.c
index 62b34ce1f50d..8a50fc60989c 100644
--- a/scripts/selinux/mdp/mdp.c
+++ b/scripts/selinux/mdp/mdp.c
@@ -29,6 +29,8 @@
 #include <unistd.h>
 #include <string.h>
 
+const char * dbgnfo = DBGNFO;
+
 static void usage(char *name)
 {
 	printf("usage: %s [-m] policy_file context_file\n", name);
diff --git a/scripts/sortextable.c b/scripts/sortextable.c
index 1f10e89d15b4..2aff6ba8e5e8 100644
--- a/scripts/sortextable.c
+++ b/scripts/sortextable.c
@@ -31,6 +31,8 @@
 #include <tools/be_byteshift.h>
 #include <tools/le_byteshift.h>
 
+const char * dbgnfo = DBGNFO;
+
 static int fd_map;	/* File descriptor for file being modified. */
 static int mmap_failed; /* Boolean flag. */
 static void *ehdr_curr; /* current ElfXX_Ehdr *  for resource cleanup */
diff --git a/scripts/unifdef.c b/scripts/unifdef.c
index 7493c0ee51cc..8fd20debd864 100644
--- a/scripts/unifdef.c
+++ b/scripts/unifdef.c
@@ -56,6 +56,8 @@
 #include <string.h>
 #include <unistd.h>
 
+const char * dbgnfo = DBGNFO;
+
 const char copyright[] =
     "@(#) $Version: unifdef-2.5 $\n"
     "@(#) $Author: Tony Finch (dot@dotat.at) $\n"
-- 
2.7.4