dingjian / rpms / kernel-rt

Forked from rpms/kernel-rt 4 years ago
Clone

Blame SOURCES/avoid-debuginfo-hash-collision-scripts.patch

54527e
commit 32b38093cfb4ef1811db76415ffc7c17bc9418c6
54527e
Author: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
54527e
Date:   Tue Jun 2 17:26:05 2015 -0300
54527e
54527e
    scripts: avoid debuginfo hash collisions on scripts/
54527e
    
54527e
    Bugzilla: 1209952
54527e
    
54527e
    Add a macro containing $KERNELRELEASE to these scripts, making them
54527e
    unique to each version and kernel variant.
54527e
    
54527e
    Signed-off-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
54527e
54527e
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
54527e
index 1f3eb19..b3478cf 100644
54527e
--- a/arch/x86/vdso/Makefile
54527e
+++ b/arch/x86/vdso/Makefile
54527e
@@ -2,6 +2,9 @@
54527e
 # Building vDSO images for x86.
54527e
 #
54527e
 
54527e
+KBUILD_CFLAGS += -DDBGNFO=\"$(KERNELRELEASE)\"
54527e
+KBUILD_AFLAGS += -DDBGNFO=\"$(KERNELRELEASE)\"
54527e
+
54527e
 VDSO64-$(CONFIG_X86_64)		:= y
54527e
 VDSOX32-$(CONFIG_X86_X32_ABI)	:= y
54527e
 VDSO32-$(CONFIG_X86_32)		:= y
54527e
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
54527e
index c74436e..603e538 100644
54527e
--- a/arch/x86/vdso/vclock_gettime.c
54527e
+++ b/arch/x86/vdso/vclock_gettime.c
54527e
@@ -26,6 +26,8 @@
54527e
 
54527e
 #define gtod (&VVAR(vsyscall_gtod_data))
54527e
 
54527e
+const char * dbgnfo = DBGNFO;
54527e
+
54527e
 notrace static cycle_t vread_tsc(void)
54527e
 {
54527e
 	cycle_t ret;
54527e
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
54527e
index 0faad64..f57656b 100644
54527e
--- a/arch/x86/vdso/vdso32-setup.c
54527e
+++ b/arch/x86/vdso/vdso32-setup.c
54527e
@@ -76,6 +76,8 @@ __setup_param("vdso=", vdso32_setup, vdso_setup, 0);
54527e
 EXPORT_SYMBOL_GPL(vdso_enabled);
54527e
 #endif
54527e
 
54527e
+const char * dbgnfo = DBGNFO;
54527e
+
54527e
 static __init void reloc_symtab(Elf32_Ehdr *ehdr,
54527e
 				unsigned offset, unsigned size)
54527e
 {
54527e
diff --git a/arch/x86/vdso/vdso32/note.S b/arch/x86/vdso/vdso32/note.S
54527e
index c83f257..6e25bcc 100644
54527e
--- a/arch/x86/vdso/vdso32/note.S
54527e
+++ b/arch/x86/vdso/vdso32/note.S
54527e
@@ -11,6 +11,7 @@
54527e
    kernel's name. */
54527e
 ELFNOTE_START(Linux, 0, "a")
54527e
 	.long LINUX_VERSION_CODE
54527e
+	.string DBGNFO
54527e
 ELFNOTE_END
54527e
 
54527e
 #ifdef CONFIG_XEN
54527e
diff --git a/scripts/Makefile b/scripts/Makefile
54527e
index 62e6cc2..befe20a 100644
54527e
--- a/scripts/Makefile
54527e
+++ b/scripts/Makefile
54527e
@@ -8,7 +8,7 @@
54527e
 # conmakehash:	 Create arrays for initializing the kernel console tables
54527e
 # docproc:       Used in Documentation/DocBook
54527e
 
54527e
-HOST_EXTRACFLAGS += -I$(srctree)/tools/include
54527e
+HOST_EXTRACFLAGS += -I$(srctree)/tools/include -DDBGNFO=\"$(KERNELRELEASE)\"
54527e
 
54527e
 hostprogs-$(CONFIG_KALLSYMS)     += kallsyms
54527e
 hostprogs-$(CONFIG_LOGO)         += pnmtologo
54527e
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
54527e
index d5d859c..9931699 100644
54527e
--- a/scripts/Makefile.build
54527e
+++ b/scripts/Makefile.build
54527e
@@ -19,7 +19,7 @@ targets :=
54527e
 subdir-y :=
54527e
 subdir-m :=
54527e
 EXTRA_AFLAGS   :=
54527e
-EXTRA_CFLAGS   :=
54527e
+EXTRA_CFLAGS   := -DDBGNFO=\"$(KernelVer)\"
54527e
 EXTRA_CPPFLAGS :=
54527e
 EXTRA_LDFLAGS  :=
54527e
 asflags-y  :=
54527e
diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c
54527e
index 91c4117..9956e77 100644
54527e
--- a/scripts/asn1_compiler.c
54527e
+++ b/scripts/asn1_compiler.c
54527e
@@ -20,6 +20,8 @@
54527e
 #include <sys/stat.h>
54527e
 #include <linux/asn1_ber_bytecode.h>
54527e
 
54527e
+const char * dbgnfo = DBGNFO;
54527e
+
54527e
 enum token_type {
54527e
 	DIRECTIVE_ABSENT,
54527e
 	DIRECTIVE_ALL,
54527e
diff --git a/scripts/basic/Makefile b/scripts/basic/Makefile
54527e
index ec10d93..c3092e0 100644
54527e
--- a/scripts/basic/Makefile
54527e
+++ b/scripts/basic/Makefile
54527e
@@ -8,6 +8,7 @@
54527e
 # ---------------------------------------------------------------------------
54527e
 # fixdep: 	 Used to generate dependency information during build process
54527e
 
54527e
+HOST_EXTRACFLAGS += -DDBGNFO=\"$(KERNELRELEASE)\"
54527e
 hostprogs-y	:= fixdep
54527e
 hostprogs-$(CONFIG_BUILD_BIN2C)     += bin2c
54527e
 always		:= $(hostprogs-y)
54527e
diff --git a/scripts/basic/bin2c.c b/scripts/basic/bin2c.c
54527e
index af187e6..24ee6e4 100644
54527e
--- a/scripts/basic/bin2c.c
54527e
+++ b/scripts/basic/bin2c.c
54527e
@@ -9,6 +9,8 @@
54527e
 
54527e
 #include <stdio.h>
54527e
 
54527e
+const char * dbgnfo = DBGNFO;
54527e
+
54527e
 int main(int argc, char *argv[])
54527e
 {
54527e
 	int ch, total = 0;
54527e
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
54527e
index 078fe1d..d8a993d 100644
54527e
--- a/scripts/basic/fixdep.c
54527e
+++ b/scripts/basic/fixdep.c
54527e
@@ -120,6 +120,8 @@
54527e
 #define INT_NFIG ntohl(0x4e464947)
54527e
 #define INT_FIG_ ntohl(0x4649475f)
54527e
 
54527e
+const char * dbgnfo = DBGNFO;
54527e
+
54527e
 char *target;
54527e
 char *depfile;
54527e
 char *cmdline;
54527e
diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile
54527e
index aca33b9..fe64439 100644
54527e
--- a/scripts/genksyms/Makefile
54527e
+++ b/scripts/genksyms/Makefile
54527e
@@ -1,4 +1,5 @@
54527e
 
54527e
+HOST_EXTRACFLAGS += -DDBGNFO=\"$(KERNELRELEASE)\"
54527e
 hostprogs-y	:= genksyms
54527e
 always		:= $(hostprogs-y)
54527e
 
54527e
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
54527e
index 88632df..a89629b 100644
54527e
--- a/scripts/genksyms/genksyms.c
54527e
+++ b/scripts/genksyms/genksyms.c
54527e
@@ -36,6 +36,8 @@
54527e
 
54527e
 #define HASH_BUCKETS  4096
54527e
 
54527e
+const char * dbgnfo = DBGNFO;
54527e
+
54527e
 static struct symbol *symtab[HASH_BUCKETS];
54527e
 static FILE *debugfile;
54527e
 
54527e
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
54527e
index 9a11f9f..1d54453 100644
54527e
--- a/scripts/kallsyms.c
54527e
+++ b/scripts/kallsyms.c
54527e
@@ -29,6 +29,8 @@
54527e
 
54527e
 #define KSYM_NAME_LEN		128
54527e
 
54527e
+const char * dbgnfo = DBGNFO;
54527e
+
54527e
 struct sym_entry {
54527e
 	unsigned long long addr;
54527e
 	unsigned int len;
54527e
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
54527e
index 844bc9d..65a1b02 100644
54527e
--- a/scripts/kconfig/Makefile
54527e
+++ b/scripts/kconfig/Makefile
54527e
@@ -2,6 +2,9 @@
54527e
 # Kernel configuration targets
54527e
 # These targets are used from top-level makefile
54527e
 
54527e
+HOST_EXTRACFLAGS += -DDBGNFO=\"$(KernelVer)\"
54527e
+KBUILD_CFLAGS += -DDBGNFO=\"$(KernelVer)\"
54527e
+
54527e
 PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \
54527e
 	localmodconfig localyesconfig
54527e
 
54527e
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
54527e
index bde5b95..f8328c3 100644
54527e
--- a/scripts/kconfig/conf.c
54527e
+++ b/scripts/kconfig/conf.c
54527e
@@ -17,6 +17,8 @@
54527e
 
54527e
 #include "lkc.h"
54527e
 
54527e
+const char * dbgnfo = DBGNFO;
54527e
+
54527e
 static void conf(struct menu *menu);
54527e
 static void check_conf(struct menu *menu);
54527e
 static void xfgets(char *str, int size, FILE *in);
54527e
diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile
54527e
index 75d59fc..ddc3339 100644
54527e
--- a/scripts/mod/Makefile
54527e
+++ b/scripts/mod/Makefile
54527e
@@ -1,3 +1,4 @@
54527e
+HOST_EXTRACFLAGS += -DDBGNFO=\"$(KERNELRELEASE)\"
54527e
 hostprogs-y	:= modpost mk_elfconfig
54527e
 always		:= $(hostprogs-y) empty.o
54527e
 
54527e
diff --git a/scripts/mod/mk_elfconfig.c b/scripts/mod/mk_elfconfig.c
54527e
index 639bca7..9babae4 100644
54527e
--- a/scripts/mod/mk_elfconfig.c
54527e
+++ b/scripts/mod/mk_elfconfig.c
54527e
@@ -3,6 +3,8 @@
54527e
 #include <string.h>
54527e
 #include <elf.h>
54527e
 
54527e
+const char * dbgnfo = DBGNFO;
54527e
+
54527e
 int
54527e
 main(int argc, char **argv)
54527e
 {
54527e
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
54527e
index fcd78ca..c2416b3 100644
54527e
--- a/scripts/mod/modpost.c
54527e
+++ b/scripts/mod/modpost.c
54527e
@@ -23,6 +23,8 @@
54527e
 #include "../../include/generated/uapi/linux/version.h"
54527e
 #include "../../include/linux/export.h"
54527e
 
54527e
+const char * dbgnfo = DBGNFO;
54527e
+
54527e
 /* Are we using CONFIG_MODVERSIONS? */
54527e
 int modversions = 0;
54527e
 /* Warn about undefined symbols? (do so if we have vmlinux) */
54527e
diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
54527e
index 9c22317..52bfb47 100644
54527e
--- a/scripts/recordmcount.c
54527e
+++ b/scripts/recordmcount.c
54527e
@@ -40,6 +40,8 @@
54527e
 #define R_METAG_NONE                     3
54527e
 #endif
54527e
 
54527e
+const char * dbgnfo = DBGNFO;
54527e
+
54527e
 static int fd_map;	/* File descriptor for file being modified. */
54527e
 static int mmap_failed; /* Boolean flag. */
54527e
 static void *ehdr_curr; /* current ElfXX_Ehdr *  for resource cleanup */
54527e
diff --git a/scripts/selinux/genheaders/Makefile b/scripts/selinux/genheaders/Makefile
54527e
index 417b165..4ca9250 100644
54527e
--- a/scripts/selinux/genheaders/Makefile
54527e
+++ b/scripts/selinux/genheaders/Makefile
54527e
@@ -1,5 +1,5 @@
54527e
 hostprogs-y	:= genheaders
54527e
-HOST_EXTRACFLAGS += -Isecurity/selinux/include
54527e
+HOST_EXTRACFLAGS += -Isecurity/selinux/include -DDBGNFO=\"$(KERNELRELEASE)\"
54527e
 
54527e
 always		:= $(hostprogs-y)
54527e
 clean-files	:= $(hostprogs-y)
54527e
diff --git a/scripts/selinux/genheaders/genheaders.c b/scripts/selinux/genheaders/genheaders.c
54527e
index 539855f..c107add 100644
54527e
--- a/scripts/selinux/genheaders/genheaders.c
54527e
+++ b/scripts/selinux/genheaders/genheaders.c
54527e
@@ -15,6 +15,7 @@ struct security_class_mapping {
54527e
 
54527e
 #define max(x, y) (((int)(x) > (int)(y)) ? x : y)
54527e
 
54527e
+const char * dbgnfo = DBGNFO;
54527e
 const char *progname;
54527e
 
54527e
 static void usage(void)
54527e
diff --git a/scripts/selinux/mdp/Makefile b/scripts/selinux/mdp/Makefile
54527e
index eb365b3..96052f2 100644
54527e
--- a/scripts/selinux/mdp/Makefile
54527e
+++ b/scripts/selinux/mdp/Makefile
54527e
@@ -1,5 +1,5 @@
54527e
 hostprogs-y	:= mdp
54527e
-HOST_EXTRACFLAGS += -Isecurity/selinux/include
54527e
+HOST_EXTRACFLAGS += -Isecurity/selinux/include -DDBGNFO=\"$(KERNELRELEASE)\"
54527e
 
54527e
 always		:= $(hostprogs-y)
54527e
 clean-files	:= $(hostprogs-y) policy.* file_contexts
54527e
diff --git a/scripts/selinux/mdp/mdp.c b/scripts/selinux/mdp/mdp.c
54527e
index 62b34ce..8a50fc6 100644
54527e
--- a/scripts/selinux/mdp/mdp.c
54527e
+++ b/scripts/selinux/mdp/mdp.c
54527e
@@ -29,6 +29,8 @@
54527e
 #include <unistd.h>
54527e
 #include <string.h>
54527e
 
54527e
+const char * dbgnfo = DBGNFO;
54527e
+
54527e
 static void usage(char *name)
54527e
 {
54527e
 	printf("usage: %s [-m] policy_file context_file\n", name);
54527e
diff --git a/scripts/sortextable.c b/scripts/sortextable.c
54527e
index 1f10e89..2aff6ba 100644
54527e
--- a/scripts/sortextable.c
54527e
+++ b/scripts/sortextable.c
54527e
@@ -31,6 +31,8 @@
54527e
 #include <tools/be_byteshift.h>
54527e
 #include <tools/le_byteshift.h>
54527e
 
54527e
+const char * dbgnfo = DBGNFO;
54527e
+
54527e
 static int fd_map;	/* File descriptor for file being modified. */
54527e
 static int mmap_failed; /* Boolean flag. */
54527e
 static void *ehdr_curr; /* current ElfXX_Ehdr *  for resource cleanup */
54527e
diff --git a/scripts/unifdef.c b/scripts/unifdef.c
54527e
index 7493c0e..8fd20de 100644
54527e
--- a/scripts/unifdef.c
54527e
+++ b/scripts/unifdef.c
54527e
@@ -56,6 +56,8 @@
54527e
 #include <string.h>
54527e
 #include <unistd.h>
54527e
 
54527e
+const char * dbgnfo = DBGNFO;
54527e
+
54527e
 const char copyright[] =
54527e
     "@(#) $Version: unifdef-2.5 $\n"
54527e
     "@(#) $Author: Tony Finch (dot@dotat.at) $\n"