commit 32b38093cfb4ef1811db76415ffc7c17bc9418c6
Author: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
Date: Tue Jun 2 17:26:05 2015 -0300
scripts: avoid debuginfo hash collisions on scripts/
Bugzilla: 1209952
Add a macro containing $KERNELRELEASE to these scripts, making them
unique to each version and kernel variant.
Signed-off-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index 1f3eb19..b3478cf 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -2,6 +2,9 @@
# Building vDSO images for x86.
#
+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 c74436e..603e538 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -26,6 +26,8 @@
#define gtod (&VVAR(vsyscall_gtod_data))
+const char * dbgnfo = DBGNFO;
+
notrace static cycle_t vread_tsc(void)
{
cycle_t ret;
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 0faad64..f57656b 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 c83f257..6e25bcc 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 62e6cc2..befe20a 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 d5d859c..9931699 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 91c4117..9956e77 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 ec10d93..c3092e0 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 af187e6..24ee6e4 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 078fe1d..d8a993d 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 aca33b9..fe64439 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 88632df..a89629b 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 9a11f9f..1d54453 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 844bc9d..65a1b02 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 bde5b95..f8328c3 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 75d59fc..ddc3339 100644
--- a/scripts/mod/Makefile
+++ b/scripts/mod/Makefile
@@ -1,3 +1,4 @@
+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 639bca7..9babae4 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 fcd78ca..c2416b3 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 9c22317..52bfb47 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 417b165..4ca9250 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 539855f..c107add 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 eb365b3..96052f2 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 62b34ce..8a50fc6 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 1f10e89..2aff6ba 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 7493c0e..8fd20de 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"