public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [genksyms patch 0/4] Checksum tracking and tweaking
@ 2008-07-21  2:28 Andreas Gruenbacher
  2008-07-21  2:28 ` [genksyms patch 1/4] parser: fix the __attribute__ rule Andreas Gruenbacher
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Andreas Gruenbacher @ 2008-07-21  2:28 UTC (permalink / raw)
  To: linux-kernel, Sam Ravnborg

Sam and all,

we are having two kinds of problems with genksyms today: fake checksum changes
without actual ABI changes, and changes which we would rather like to ignore
(such as an additional field at the end of a structure that modules are not
supposed to touch, for example).

I have thought about ways to improve genksyms and compute checksums differently
to avoid those problems, but in the end I don't see a fundamentally better way.
So here are some genksyms patches for at least making the checksums more easily
manageable, if we cannot fully fix them.

In addition to the bugfixes (the first two patches), this allows genksyms to track
checksum changes and report why a checksum changed (third patch), and to
selectively ignore changes (fourth patch).

Any thoughts?

Thanks,
Andreas


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [genksyms patch 1/4] parser: fix the __attribute__ rule
  2008-07-21  2:28 [genksyms patch 0/4] Checksum tracking and tweaking Andreas Gruenbacher
@ 2008-07-21  2:28 ` Andreas Gruenbacher
  2008-07-30 20:43   ` Sam Ravnborg
  2008-07-21  2:28 ` [genksyms patch 2/4] Include extern information in dumps Andreas Gruenbacher
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Andreas Gruenbacher @ 2008-07-21  2:28 UTC (permalink / raw)
  To: linux-kernel, Sam Ravnborg

[-- Attachment #1: patches.suse/genksyms-syntax.diff --]
[-- Type: text/plain, Size: 719 bytes --]

Gcc __attribute__ definitions may occur repeatedly, e.g.,

	static int foo __attribute__((__used__))
		       __attribute__((aligned (16)));

The genksyms parser does not understand this, and generates a syntax error.
Fix this case.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>

---
 scripts/genksyms/parse.y |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/scripts/genksyms/parse.y
===================================================================
--- a/scripts/genksyms/parse.y
+++ b/scripts/genksyms/parse.y
@@ -446,7 +446,7 @@ member_bitfield_declarator:
 
 attribute_opt:
 	/* empty */					{ $$ = NULL; }
-	| ATTRIBUTE_PHRASE
+	| attribute_opt ATTRIBUTE_PHRASE
 	;
 
 asm_definition:



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [genksyms patch 2/4] Include extern information in dumps
  2008-07-21  2:28 [genksyms patch 0/4] Checksum tracking and tweaking Andreas Gruenbacher
  2008-07-21  2:28 ` [genksyms patch 1/4] parser: fix the __attribute__ rule Andreas Gruenbacher
@ 2008-07-21  2:28 ` Andreas Gruenbacher
  2008-07-31 21:18   ` Sam Ravnborg
  2008-07-21  2:28 ` [genksyms patch 3/4] Track symbol checksum changes Andreas Gruenbacher
  2008-07-21  2:28 ` [genksyms patch 4/4] Allow to ignore " Andreas Gruenbacher
  3 siblings, 1 reply; 11+ messages in thread
From: Andreas Gruenbacher @ 2008-07-21  2:28 UTC (permalink / raw)
  To: linux-kernel, Sam Ravnborg

[-- Attachment #1: patches.suse/genksyms-dump.diff --]
[-- Type: text/plain, Size: 671 bytes --]

The extern flag currently is not included in type dump files
(genksyms --dump-types). Include that flag there for completeness.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>

---
 scripts/genksyms/genksyms.c |    2 ++
 1 file changed, 2 insertions(+)

Index: b/scripts/genksyms/genksyms.c
===================================================================
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -546,6 +546,8 @@ int main(int argc, char **argv)
 			}
 			fputs(sym->name, dumpfile);
 			putc(' ', dumpfile);
+			if (sym->is_extern)
+				fputs("extern ", dumpfile);
 			print_list(dumpfile, sym->defn);
 			putc('\n', dumpfile);
 



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [genksyms patch 3/4] Track symbol checksum changes
  2008-07-21  2:28 [genksyms patch 0/4] Checksum tracking and tweaking Andreas Gruenbacher
  2008-07-21  2:28 ` [genksyms patch 1/4] parser: fix the __attribute__ rule Andreas Gruenbacher
  2008-07-21  2:28 ` [genksyms patch 2/4] Include extern information in dumps Andreas Gruenbacher
@ 2008-07-21  2:28 ` Andreas Gruenbacher
  2008-09-03  5:02   ` Andrew Morton
  2008-07-21  2:28 ` [genksyms patch 4/4] Allow to ignore " Andreas Gruenbacher
  3 siblings, 1 reply; 11+ messages in thread
From: Andreas Gruenbacher @ 2008-07-21  2:28 UTC (permalink / raw)
  To: linux-kernel, Sam Ravnborg

[-- Attachment #1: patches.suse/genksyms-reference.diff --]
[-- Type: text/plain, Size: 14435 bytes --]

Sometimes it is preferable to avoid changes of exported symbol checksums (to
avoid breaking externally provided modules).  When a checksum change occurs, it
can be hard to figure out what caused this change: underlying types may have
changed, or additional type information may simply have become available at the
point where a symbol is exported.

Add a new --reference option to genksyms which allows it to report why
checksums change, based on the type information dumps it creates with
the --dump-types flag.  Genksyms will read in such a dump from a previous run,
and report which symbols have changed (and why).

The behavior can be controlled for an entire build as follows: If
KBUILD_SYMTYPES is set, genksyms uses --dump-types to produce *.symtypes dump
files.  If any *.symref files exist, those will be used as the reference to
check against.  If KBUILD_PRESERVE is set, checksum changes will fail the
build.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>

---
 scripts/Makefile.build      |   16 ++
 scripts/genksyms/genksyms.c |  236 +++++++++++++++++++++++++++++++++++++++++---
 scripts/genksyms/genksyms.h |    6 +
 3 files changed, 239 insertions(+), 19 deletions(-)

Index: b/scripts/genksyms/genksyms.c
===================================================================
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -42,7 +42,8 @@ static FILE *debugfile;
 int cur_line = 1;
 char *cur_filename;
 
-static int flag_debug, flag_dump_defs, flag_dump_types, flag_warnings;
+static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types,
+	   flag_preserve, flag_warnings;
 static const char *arch = "";
 static const char *mod_prefix = "";
 
@@ -58,6 +59,8 @@ static const char *const symbol_type_nam
 
 static int equal_list(struct string_list *a, struct string_list *b);
 static void print_list(FILE * f, struct string_list *list);
+static void print_location(void);
+static void print_type_name(enum symbol_type type, const char *name);
 
 /*----------------------------------------------------------------------*/
 
@@ -151,25 +154,66 @@ struct symbol *find_symbol(const char *n
 
 	for (sym = symtab[h]; sym; sym = sym->hash_next)
 		if (map_to_ns(sym->type) == map_to_ns(ns) &&
-		    strcmp(name, sym->name) == 0)
+		    strcmp(name, sym->name) == 0 &&
+		    sym->is_declared)
 			break;
 
 	return sym;
 }
 
-struct symbol *add_symbol(const char *name, enum symbol_type type,
-			  struct string_list *defn, int is_extern)
+static int is_unknown_symbol(struct symbol *sym)
+{
+	struct string_list *defn;
+
+	return ((sym->type == SYM_STRUCT ||
+		 sym->type == SYM_UNION ||
+		 sym->type == SYM_ENUM) &&
+		(defn = sym->defn)  && defn->tag == SYM_NORMAL &&
+			strcmp(defn->string, "}") == 0 &&
+		(defn = defn->next) && defn->tag == SYM_NORMAL &&
+	    		strcmp(defn->string, "UNKNOWN") == 0 &&
+		(defn = defn->next) && defn->tag == SYM_NORMAL &&
+			strcmp(defn->string, "{") == 0);
+}
+
+struct symbol *__add_symbol(const char *name, enum symbol_type type,
+			    struct string_list *defn, int is_extern,
+			    int is_reference)
 {
 	unsigned long h = crc32(name) % HASH_BUCKETS;
 	struct symbol *sym;
+	enum symbol_status status = STATUS_UNCHANGED;
 
 	for (sym = symtab[h]; sym; sym = sym->hash_next) {
-		if (map_to_ns(sym->type) == map_to_ns(type)
-		    && strcmp(name, sym->name) == 0) {
-			if (!equal_list(sym->defn, defn))
+		if (map_to_ns(sym->type) == map_to_ns(type) &&
+		    strcmp(name, sym->name) == 0) {
+			if (is_reference)
+				/* fall through */ ;
+			else if (sym->type == type &&
+				 equal_list(sym->defn, defn)) {
+				sym->is_declared = 1;
+				return sym;
+			} else if (!sym->is_declared) {
+				status = is_unknown_symbol(sym) ?
+					STATUS_DEFINED : STATUS_MODIFIED;
+			} else {
 				error_with_pos("redefinition of %s", name);
-			return sym;
+				return sym;
+			}
+			break;
+		}
+	}
+
+	if (sym) {
+		struct symbol **psym;
+
+		for (psym = &symtab[h]; *psym; psym = &(*psym)->hash_next) {
+			if (*psym == sym) {
+				*psym = sym->hash_next;
+				break;
+			}
 		}
+		--nsyms;
 	}
 
 	sym = xmalloc(sizeof(*sym));
@@ -183,6 +227,9 @@ struct symbol *add_symbol(const char *na
 	sym->hash_next = symtab[h];
 	symtab[h] = sym;
 
+	sym->is_declared = !is_reference;
+	sym->status = status;
+
 	if (flag_debug) {
 		fprintf(debugfile, "Defn for %s %s == <",
 			symbol_type_name[type], name);
@@ -196,6 +243,18 @@ struct symbol *add_symbol(const char *na
 	return sym;
 }
 
+struct symbol *add_symbol(const char *name, enum symbol_type type,
+			  struct string_list *defn, int is_extern)
+{
+	return __add_symbol(name, type, defn, is_extern, 0);
+}
+
+struct symbol *add_reference_symbol(const char *name, enum symbol_type type,
+				    struct string_list *defn, int is_extern)
+{
+	return __add_symbol(name, type, defn, is_extern, 1);
+}
+
 /*----------------------------------------------------------------------*/
 
 void free_node(struct string_list *node)
@@ -236,6 +295,82 @@ static int equal_list(struct string_list
 	return !a && !b;
 }
 
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+struct string_list *read_node(FILE *f)
+{
+	char buffer[256];
+	struct string_list node = {
+		.string = buffer,
+		.tag = SYM_NORMAL };
+	int c;
+
+	while ((c = fgetc(f)) != EOF) {
+		if (c == ' ') {
+			if (node.string == buffer)
+				continue;
+			break;
+		} else if (c == '\n') {
+			if (node.string == buffer)
+				return NULL;
+			ungetc(c, f);
+			break;
+		}
+		if (node.string >= buffer + sizeof(buffer) - 1) {
+			fprintf(stderr, "Token too long\n");
+			exit(1);
+		}
+		*node.string++ = c;
+	}
+	if (node.string == buffer)
+		return NULL;
+	*node.string = 0;
+	node.string = buffer;
+
+	if (node.string[1] == '#') {
+		int n;
+
+		for (n = 0; n < ARRAY_SIZE(symbol_type_name); n++) {
+			if (node.string[0] == symbol_type_name[n][0]) {
+				node.tag = n;
+				node.string += 2;
+				return copy_node(&node);
+			}
+		}
+		fprintf(stderr, "Unknown type %c\n", node.string[0]);
+		exit(1);
+	}
+	return copy_node(&node);
+}
+
+static void read_reference(FILE *f)
+{
+	while (!feof(f)) {
+		struct string_list *defn = NULL;
+		struct string_list *sym, *def;
+		int is_extern = 0;
+
+		sym = read_node(f);
+		if (!sym)
+			continue;
+		def = read_node(f);
+		if (def && def->tag == SYM_NORMAL &&
+		    !strcmp(def->string, "extern")) {
+			is_extern = 1;
+			free_node(def);
+			def = read_node(f);
+		}
+		while (def) {
+			def->next = defn;
+			defn = def;
+			def = read_node(f);
+		}
+		add_reference_symbol(xstrdup(sym->string), sym->tag,
+					      defn, is_extern);
+		free_node(sym);
+	}
+}
+
 static void print_node(FILE * f, struct string_list *list)
 {
 	if (list->tag != SYM_NORMAL) {
@@ -311,6 +446,7 @@ static unsigned long expand_and_crc_sym(
 
 		case SYM_TYPEDEF:
 			subsym = find_symbol(cur->string, cur->tag);
+			/* FIXME: Bad reference files can segfault here. */
 			if (subsym->expansion_trail) {
 				if (flag_dump_defs)
 					fprintf(debugfile, "%s ", cur->string);
@@ -347,9 +483,22 @@ static unsigned long expand_and_crc_sym(
 				t = n;
 
 				n = xmalloc(sizeof(*n));
-				n->string = xstrdup("{ UNKNOWN }");
+				n->string = xstrdup("{");
+				n->tag = SYM_NORMAL;
+				n->next = t;
+				t = n;
+
+				n = xmalloc(sizeof(*n));
+				n->string = xstrdup("UNKNOWN");
+				n->tag = SYM_NORMAL;
+				n->next = t;
+				t = n;
+
+				n = xmalloc(sizeof(*n));
+				n->string = xstrdup("}");
 				n->tag = SYM_NORMAL;
 				n->next = t;
+				t = n;
 
 				subsym =
 				    add_symbol(cur->string, cur->tag, n, 0);
@@ -397,20 +546,42 @@ void export_symbol(const char *name)
 		error_with_pos("export undefined symbol %s", name);
 	else {
 		unsigned long crc;
+		int has_changed = 0;
 
 		if (flag_dump_defs)
 			fprintf(debugfile, "Export %s == <", name);
 
 		expansion_trail = (struct symbol *)-1L;
 
+		sym->expansion_trail = expansion_trail;
+		expansion_trail = sym;
 		crc = expand_and_crc_sym(sym, 0xffffffff) ^ 0xffffffff;
 
 		sym = expansion_trail;
 		while (sym != (struct symbol *)-1L) {
 			struct symbol *n = sym->expansion_trail;
+
+			if (sym->status != STATUS_UNCHANGED) {
+				if (!has_changed) {
+					print_location();
+					fprintf(stderr, "%s: %s: modversion "
+						"changed because of changes "
+						"in ", flag_preserve ? "error" :
+						       "warning", name);
+				} else
+					fprintf(stderr, ", ");
+				print_type_name(sym->type, sym->name);
+				if (sym->status == STATUS_DEFINED)
+					fprintf(stderr, " (became defined)");
+				has_changed = 1;
+				if (flag_preserve)
+					errors++;
+			}
 			sym->expansion_trail = 0;
 			sym = n;
 		}
+		if (has_changed)
+			fprintf(stderr, "\n");
 
 		if (flag_dump_defs)
 			fputs(">\n", debugfile);
@@ -421,13 +592,26 @@ void export_symbol(const char *name)
 }
 
 /*----------------------------------------------------------------------*/
+
+static void print_location(void)
+{
+	fprintf(stderr, "%s:%d: ", cur_filename ? : "<stdin>", cur_line);
+}
+
+static void print_type_name(enum symbol_type type, const char *name)
+{
+	if (type != SYM_NORMAL)
+		fprintf(stderr, "%s %s", symbol_type_name[type], name);
+	else
+		fprintf(stderr, "%s", name);
+}
+
 void error_with_pos(const char *fmt, ...)
 {
 	va_list args;
 
 	if (flag_warnings) {
-		fprintf(stderr, "%s:%d: ", cur_filename ? : "<stdin>",
-			cur_line);
+		print_location();
 
 		va_start(args, fmt);
 		vfprintf(stderr, fmt, args);
@@ -445,7 +629,9 @@ static void genksyms_usage(void)
 	      "  -a, --arch            Select architecture\n"
 	      "  -d, --debug           Increment the debug level (repeatable)\n"
 	      "  -D, --dump            Dump expanded symbol defs (for debugging only)\n"
-	      "  -T, --dump-types file Dump expanded types into file (for debugging only)\n"
+	      "  -r, --reference file  Read reference symbols from a file\n"
+	      "  -T, --dump-types file Dump expanded types into file\n"
+	      "  -p, --preserve        Preserve reference modversions or fail\n"
 	      "  -w, --warnings        Enable warnings\n"
 	      "  -q, --quiet           Disable warnings (default)\n"
 	      "  -h, --help            Print this message\n"
@@ -454,7 +640,9 @@ static void genksyms_usage(void)
 	      "  -a                    Select architecture\n"
 	      "  -d                    Increment the debug level (repeatable)\n"
 	      "  -D                    Dump expanded symbol defs (for debugging only)\n"
-	      "  -T file               Dump expanded types into file (for debugging only)\n"
+	      "  -r file               Read reference symbols from a file\n"
+	      "  -T file               Dump expanded types into file\n"
+	      "  -p                    Preserve reference modversions or fail\n"
 	      "  -w                    Enable warnings\n"
 	      "  -q                    Disable warnings (default)\n"
 	      "  -h                    Print this message\n"
@@ -465,7 +653,7 @@ static void genksyms_usage(void)
 
 int main(int argc, char **argv)
 {
-	FILE *dumpfile = NULL;
+	FILE *dumpfile = NULL, *ref_file = NULL;
 	int o;
 
 #ifdef __GNU_LIBRARY__
@@ -475,16 +663,18 @@ int main(int argc, char **argv)
 		{"warnings", 0, 0, 'w'},
 		{"quiet", 0, 0, 'q'},
 		{"dump", 0, 0, 'D'},
+		{"reference", 1, 0, 'r'},
 		{"dump-types", 1, 0, 'T'},
+		{"preserve", 0, 0, 'p'},
 		{"version", 0, 0, 'V'},
 		{"help", 0, 0, 'h'},
 		{0, 0, 0, 0}
 	};
 
-	while ((o = getopt_long(argc, argv, "a:dwqVDT:h",
+	while ((o = getopt_long(argc, argv, "a:dwqVDr:T:ph",
 				&long_opts[0], NULL)) != EOF)
 #else				/* __GNU_LIBRARY__ */
-	while ((o = getopt(argc, argv, "a:dwqVDT:h")) != EOF)
+	while ((o = getopt(argc, argv, "a:dwqVDr:T:ph")) != EOF)
 #endif				/* __GNU_LIBRARY__ */
 		switch (o) {
 		case 'a':
@@ -505,6 +695,14 @@ int main(int argc, char **argv)
 		case 'D':
 			flag_dump_defs = 1;
 			break;
+		case 'r':
+			flag_reference = 1;
+			ref_file = fopen(optarg, "r");
+			if (!ref_file) {
+				perror(optarg);
+				return 1;
+			}
+			break;
 		case 'T':
 			flag_dump_types = 1;
 			dumpfile = fopen(optarg, "w");
@@ -513,6 +711,9 @@ int main(int argc, char **argv)
 				return 1;
 			}
 			break;
+		case 'p':
+			flag_preserve = 1;
+			break;
 		case 'h':
 			genksyms_usage();
 			return 0;
@@ -534,6 +735,9 @@ int main(int argc, char **argv)
 		/* setlinebuf(debugfile); */
 	}
 
+	if (flag_reference)
+		read_reference(ref_file);
+
 	yyparse();
 
 	if (flag_dump_types && visited_symbols) {
Index: b/scripts/genksyms/genksyms.h
===================================================================
--- a/scripts/genksyms/genksyms.h
+++ b/scripts/genksyms/genksyms.h
@@ -29,6 +29,10 @@ enum symbol_type {
 	SYM_NORMAL, SYM_TYPEDEF, SYM_ENUM, SYM_STRUCT, SYM_UNION
 };
 
+enum symbol_status {
+	STATUS_UNCHANGED, STATUS_DEFINED, STATUS_MODIFIED
+};
+
 struct string_list {
 	struct string_list *next;
 	enum symbol_type tag;
@@ -43,6 +47,8 @@ struct symbol {
 	struct symbol *expansion_trail;
 	struct symbol *visited;
 	int is_extern;
+	int is_declared;
+	enum symbol_status status;
 };
 
 typedef struct string_list **yystype;
Index: b/scripts/Makefile.build
===================================================================
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -153,12 +153,18 @@ $(obj)/%.i: $(src)/%.c FORCE
 
 quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
 cmd_cc_symtypes_c	   = \
+		set -e;							\
 		$(CPP) -D__GENKSYMS__ $(c_flags) $<			\
-		| $(GENKSYMS) -T $@ >/dev/null;				\
+		| $(GENKSYMS) -T $@					\
+			      -r $(firstword $(wildcard			\
+			      	     $(@:.symtypes=.symref) /dev/null))	\
+			      $(if $(KBUILD_PRESERVE),-p)		\
+			      -a $(ARCH)				\
+		  >/dev/null;						\
 		test -s $@ || rm -f $@
 
 $(obj)/%.symtypes : $(src)/%.c FORCE
-	$(call if_changed_dep,cc_symtypes_c)
+	$(call cmd,cc_symtypes_c)
 
 # C (.c) files
 # The C file is compiled and updated dependency information is generated.
@@ -187,7 +193,11 @@ cmd_modversions =							\
 	if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then	\
 		$(CPP) -D__GENKSYMS__ $(c_flags) $<			\
 		| $(GENKSYMS) $(if $(KBUILD_SYMTYPES),			\
-			      -T $(@D)/$(@F:.o=.symtypes)) -a $(ARCH)	\
+			           -T $(@:.o=.symtypes))		\
+			      -r $(firstword $(wildcard			\
+			      	     $(@:.o=.symref) /dev/null))	\
+			      $(if $(KBUILD_PRESERVE),-p)		\
+			      -a $(ARCH)				\
 		> $(@D)/.tmp_$(@F:.o=.ver);				\
 									\
 		$(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) 		\



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [genksyms patch 4/4] Allow to ignore symbol checksum changes
  2008-07-21  2:28 [genksyms patch 0/4] Checksum tracking and tweaking Andreas Gruenbacher
                   ` (2 preceding siblings ...)
  2008-07-21  2:28 ` [genksyms patch 3/4] Track symbol checksum changes Andreas Gruenbacher
@ 2008-07-21  2:28 ` Andreas Gruenbacher
  3 siblings, 0 replies; 11+ messages in thread
From: Andreas Gruenbacher @ 2008-07-21  2:28 UTC (permalink / raw)
  To: linux-kernel, Sam Ravnborg

[-- Attachment #1: patches.suse/genksyms-override.diff --]
[-- Type: text/plain, Size: 3666 bytes --]

This adds an "override" keyword for use in *.symvers / *.symref files.  When a
symbol is overridden, the symbol's old definition will be used for computing
checksums instead of the new one, preserving the previous checksum.  (Genksyms
will still warn about the change.)

This is meant to allow distributions to hide minor actual as well as fake ABI
changes. (For example, when extra type information becomes available because
additional headers are included, this may change checksums even though none of
the types used have actully changed.)

This approach also allows to get rid of "#ifdef __GENKSYMS__" hacks in the code,
which are currently used in some vendor kernels to work around checksum changes.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>

---
 scripts/genksyms/genksyms.c |   34 ++++++++++++++++++++++++++++++----
 scripts/genksyms/genksyms.h |    1 +
 2 files changed, 31 insertions(+), 4 deletions(-)

Index: b/scripts/genksyms/genksyms.c
===================================================================
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -191,11 +191,26 @@ struct symbol *__add_symbol(const char *
 				/* fall through */ ;
 			else if (sym->type == type &&
 				 equal_list(sym->defn, defn)) {
+				if (!sym->is_declared && sym->is_override) {
+					print_location();
+					print_type_name(type, name);
+					fprintf(stderr, " modversion is "
+						"unchanged\n");
+				}
 				sym->is_declared = 1;
 				return sym;
 			} else if (!sym->is_declared) {
-				status = is_unknown_symbol(sym) ?
-					STATUS_DEFINED : STATUS_MODIFIED;
+				if (sym->is_override && flag_preserve) {
+					print_location();
+					fprintf(stderr, "ignoring ");
+					print_type_name(type, name);
+					fprintf(stderr, " modversion change\n");
+					sym->is_declared = 1;
+					return sym;
+				} else {
+					status = is_unknown_symbol(sym) ?
+						STATUS_DEFINED : STATUS_MODIFIED;
+				}
 			} else {
 				error_with_pos("redefinition of %s", name);
 				return sym;
@@ -229,6 +244,7 @@ struct symbol *__add_symbol(const char *
 
 	sym->is_declared = !is_reference;
 	sym->status = status;
+	sym->is_override = 0;
 
 	if (flag_debug) {
 		fprintf(debugfile, "Defn for %s %s == <",
@@ -348,9 +364,16 @@ static void read_reference(FILE *f)
 	while (!feof(f)) {
 		struct string_list *defn = NULL;
 		struct string_list *sym, *def;
-		int is_extern = 0;
+		int is_extern = 0, is_override = 0;
+		struct symbol *subsym;
 
 		sym = read_node(f);
+		if (sym && sym->tag == SYM_NORMAL &&
+		    !strcmp(sym->string, "override")) {
+			is_override = 1;
+			free_node(sym);
+			sym = read_node(f);
+		}
 		if (!sym)
 			continue;
 		def = read_node(f);
@@ -365,8 +388,9 @@ static void read_reference(FILE *f)
 			defn = def;
 			def = read_node(f);
 		}
-		add_reference_symbol(xstrdup(sym->string), sym->tag,
+		subsym = add_reference_symbol(xstrdup(sym->string), sym->tag,
 					      defn, is_extern);
+		subsym->is_override = is_override;
 		free_node(sym);
 	}
 }
@@ -744,6 +768,8 @@ int main(int argc, char **argv)
 		while (visited_symbols != (struct symbol *)-1L) {
 			struct symbol *sym = visited_symbols;
 
+			if (sym->is_override)
+				fputs("override ", dumpfile);
 			if (sym->type != SYM_NORMAL) {
 				putc(symbol_type_name[sym->type][0], dumpfile);
 				putc('#', dumpfile);
Index: b/scripts/genksyms/genksyms.h
===================================================================
--- a/scripts/genksyms/genksyms.h
+++ b/scripts/genksyms/genksyms.h
@@ -49,6 +49,7 @@ struct symbol {
 	int is_extern;
 	int is_declared;
 	enum symbol_status status;
+	int is_override;
 };
 
 typedef struct string_list **yystype;



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [genksyms patch 1/4] parser: fix the __attribute__ rule
  2008-07-21  2:28 ` [genksyms patch 1/4] parser: fix the __attribute__ rule Andreas Gruenbacher
@ 2008-07-30 20:43   ` Sam Ravnborg
  2008-07-30 22:03     ` Andreas Gruenbacher
  0 siblings, 1 reply; 11+ messages in thread
From: Sam Ravnborg @ 2008-07-30 20:43 UTC (permalink / raw)
  To: Andreas Gruenbacher; +Cc: linux-kernel

On Mon, Jul 21, 2008 at 04:28:24AM +0200, Andreas Gruenbacher wrote:
> Gcc __attribute__ definitions may occur repeatedly, e.g.,
> 
> 	static int foo __attribute__((__used__))
> 		       __attribute__((aligned (16)));
> 
> The genksyms parser does not understand this, and generates a syntax error.
> Fix this case.
> 
> Signed-off-by: Andreas Gruenbacher <agruen@suse.de>

Can I ask you to update the _shipped files and resend the patch.
I have only bison 2.1 available on my box and
I do not want to downgrade when regenerating the bison files.

To do it just do a:
make clean
make allmodconfig
make GENERATE_PARSER=1 modules

Drop the other _shipped files that are not relevant
(keywords.c and lex.c).

	Sam

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [genksyms patch 1/4] parser: fix the __attribute__ rule
  2008-07-30 20:43   ` Sam Ravnborg
@ 2008-07-30 22:03     ` Andreas Gruenbacher
  2008-07-31 21:17       ` Sam Ravnborg
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Gruenbacher @ 2008-07-30 22:03 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-kernel, randy.dunlap, akpm

On Wednesday 30 July 2008 10:43:11 pm Sam Ravnborg wrote:
> Can I ask you to update the _shipped files and resend the patch.

Sure, here is the version from Andrew's tree, with parse.c_shipped added.

Thanks,
Andreas

---------------------------

From: Andreas Gruenbacher <agruen@suse.de>

We are having two kinds of problems with genksyms today: fake checksum
changes without actual ABI changes, and changes which we would rather like
to ignore (such as an additional field at the end of a structure that
modules are not supposed to touch, for example).

I have thought about ways to improve genksyms and compute checksums
differently to avoid those problems, but in the end I don't see a
fundamentally better way.  So here are some genksyms patches for at least
making the checksums more easily manageable, if we cannot fully fix them.

In addition to the bugfixes (the first two patches), this allows genksyms
to track checksum changes and report why a checksum changed (third patch),
and to selectively ignore changes (fourth patch).


This patch:

Gcc __attribute__ definitions may occur repeatedly, e.g.,

	static int foo __attribute__((__used__))
		       __attribute__((aligned (16)));

The genksyms parser does not understand this, and generates a syntax error.
Fix this case.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 scripts/genksyms/parse.c_shipped |  144 +++++++++++++++++++--------------------
 scripts/genksyms/parse.y         |    2 
 2 files changed, 73 insertions(+), 73 deletions(-)

Index: b/scripts/genksyms/parse.y
===================================================================
--- a/scripts/genksyms/parse.y
+++ b/scripts/genksyms/parse.y
@@ -446,7 +446,7 @@ member_bitfield_declarator:
 
 attribute_opt:
 	/* empty */					{ $$ = NULL; }
-	| ATTRIBUTE_PHRASE
+	| attribute_opt ATTRIBUTE_PHRASE
 	;
 
 asm_definition:
Index: b/scripts/genksyms/parse.c_shipped
===================================================================
--- a/scripts/genksyms/parse.c_shipped
+++ b/scripts/genksyms/parse.c_shipped
@@ -504,7 +504,7 @@ static const yytype_uint16 yyprhs[] =
      239,   242,   245,   247,   248,   250,   252,   257,   262,   265,
      269,   273,   277,   278,   280,   283,   287,   291,   292,   294,
      296,   299,   303,   306,   307,   309,   311,   315,   318,   321,
-     323,   326,   327,   329,   332,   333,   335
+     323,   326,   327,   330,   333,   334,   336
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
@@ -542,9 +542,9 @@ static const yytype_int8 yyrhs[] =
       -1,    -1,    89,    -1,    90,    -1,    89,    90,    -1,    64,
       91,    44,    -1,     1,    44,    -1,    -1,    92,    -1,    93,
       -1,    92,    46,    93,    -1,    76,    95,    -1,    37,    94,
-      -1,    94,    -1,    52,    34,    -1,    -1,    31,    -1,    30,
-      44,    -1,    -1,    30,    -1,    29,    47,    37,    49,    44,
-      -1
+      -1,    94,    -1,    52,    34,    -1,    -1,    95,    31,    -1,
+      30,    44,    -1,    -1,    30,    -1,    29,    47,    37,    49,
+      44,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
@@ -647,7 +647,7 @@ static const yytype_uint8 yyr2[] =
        2,     2,     1,     0,     1,     1,     4,     4,     2,     3,
        3,     3,     0,     1,     2,     3,     3,     0,     1,     1,
        2,     3,     2,     0,     1,     1,     3,     2,     2,     1,
-       2,     0,     1,     2,     0,     1,     5
+       2,     0,     2,     2,     0,     1,     5
 };
 
 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -667,9 +667,9 @@ static const yytype_uint8 yydefact[] =
        0,    66,   125,   101,   121,    71,     0,     7,   112,   106,
       76,    77,     0,     0,     0,   121,    75,     0,   114,   115,
      119,   105,     0,   110,   124,     0,    36,     0,    73,    72,
-      61,    20,   122,   102,     0,    93,     0,    84,    87,    88,
-     118,     0,    76,     0,   120,    74,   117,    80,     0,   111,
-       0,    35,   126,     0,    21,   103,    70,    94,    56,     0,
+      61,    20,   102,     0,    93,     0,    84,    87,    88,   118,
+       0,    76,     0,   120,    74,   117,    80,     0,   111,     0,
+      35,   126,   122,     0,    21,   103,    70,    94,    56,     0,
       93,    90,    92,    69,    83,     0,    82,    81,     0,     0,
      116,   104,     0,    95,     0,    91,    98,     0,    85,    89,
       79,    78,   100,    99,     0,     0,    97,    96
@@ -680,44 +680,44 @@ static const yytype_int16 yydefgoto[] =
 {
       -1,     1,     2,     3,    35,    72,    55,    36,    64,    65,
       66,    75,    38,    39,    40,    41,    42,    67,    86,    87,
-      43,   114,    69,   105,   106,   126,   127,   128,   129,   151,
+      43,   114,    69,   105,   106,   125,   126,   127,   128,   151,
      152,    44,   144,   145,    54,    76,    77,    78,   107,   108,
-     109,   110,   123,    45,    94,    46
+     109,   110,   122,    45,    94,    46
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -135
+#define YYPACT_NINF -134
 static const yytype_int16 yypact[] =
 {
-    -135,    11,  -135,   312,  -135,  -135,    24,  -135,  -135,  -135,
-    -135,  -135,   -23,  -135,    -2,  -135,  -135,  -135,  -135,  -135,
-    -135,  -135,  -135,  -135,   -17,  -135,   -11,  -135,  -135,  -135,
-      -3,    16,    26,  -135,  -135,  -135,  -135,    34,   482,  -135,
-    -135,  -135,  -135,  -135,  -135,  -135,  -135,  -135,  -135,  -135,
-      -8,  -135,    22,    97,  -135,   482,    22,  -135,   482,    56,
-    -135,  -135,    12,    10,    50,    49,  -135,    34,   -13,    15,
-    -135,  -135,   482,  -135,    47,   -25,    51,   145,  -135,  -135,
-      34,  -135,   356,    52,    71,    77,  -135,    10,  -135,  -135,
-      34,  -135,  -135,  -135,    68,  -135,   193,  -135,  -135,  -135,
-      48,  -135,     6,    93,    37,    68,    18,    85,    84,  -135,
-    -135,  -135,    87,  -135,   102,    86,  -135,    89,  -135,  -135,
-    -135,  -135,  -135,    90,    88,   401,    94,   100,   101,  -135,
-    -135,    99,  -135,   108,  -135,  -135,  -135,  -135,   230,  -135,
-     -25,  -135,  -135,   105,  -135,  -135,  -135,  -135,  -135,     9,
-      42,  -135,    28,  -135,  -135,   445,  -135,  -135,   119,   125,
-    -135,  -135,   126,  -135,   128,  -135,  -135,   267,  -135,  -135,
-    -135,  -135,  -135,  -135,   129,   130,  -135,  -135
+    -134,    16,  -134,   312,  -134,  -134,    20,  -134,  -134,  -134,
+    -134,  -134,   -18,  -134,    -3,  -134,  -134,  -134,  -134,  -134,
+    -134,  -134,  -134,  -134,   -26,  -134,   -25,  -134,  -134,  -134,
+      -7,     5,    27,  -134,  -134,  -134,  -134,    46,   482,  -134,
+    -134,  -134,  -134,  -134,  -134,  -134,  -134,  -134,  -134,  -134,
+      -8,  -134,    30,    97,  -134,   482,    30,  -134,   482,     7,
+    -134,  -134,    12,    10,    42,    55,  -134,    46,   -15,    15,
+    -134,  -134,   482,  -134,    25,    26,    47,   145,  -134,  -134,
+      46,  -134,   356,    39,    71,    77,  -134,    10,  -134,  -134,
+      46,  -134,  -134,  -134,  -134,  -134,   193,  -134,  -134,  -134,
+      75,  -134,     6,    95,    43,  -134,    28,    86,    85,  -134,
+    -134,  -134,    88,  -134,   103,    87,  -134,    91,  -134,  -134,
+    -134,  -134,   -23,    90,   401,    94,   101,   102,  -134,  -134,
+      98,  -134,   108,  -134,  -134,   109,  -134,   230,  -134,    26,
+    -134,  -134,  -134,   134,  -134,  -134,  -134,  -134,  -134,     9,
+      48,  -134,    35,  -134,  -134,   445,  -134,  -134,   125,   126,
+    -134,  -134,   128,  -134,   129,  -134,  -134,   267,  -134,  -134,
+    -134,  -134,  -134,  -134,   130,   131,  -134,  -134
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -135,  -135,   179,  -135,  -135,  -135,  -135,   -47,  -135,  -135,
-      91,     0,   -58,   -37,  -135,  -135,  -135,   -73,  -135,  -135,
-     -48,   -32,  -135,   -38,  -135,  -134,  -135,  -135,    29,   -63,
-    -135,  -135,  -135,  -135,   -20,  -135,  -135,   106,  -135,  -135,
-      45,    95,    82,  -135,  -135,  -135
+    -134,  -134,   180,  -134,  -134,  -134,  -134,   -33,  -134,  -134,
+      93,     0,   -58,   -37,  -134,  -134,  -134,   -73,  -134,  -134,
+     -54,   -32,  -134,   -81,  -134,  -133,  -134,  -134,    29,   -50,
+    -134,  -134,  -134,  -134,   -20,  -134,  -134,   110,  -134,  -134,
+      49,    96,    80,  -134,  -134,  -134
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
@@ -727,26 +727,26 @@ static const yytype_int16 yypgoto[] =
 #define YYTABLE_NINF -109
 static const yytype_int16 yytable[] =
 {
-      82,    70,   104,    37,   159,    68,    57,   131,    79,    49,
-     162,     4,   100,    84,    50,    88,   101,    92,    10,    93,
-      52,    51,   102,    63,    71,    97,    56,   103,    20,   104,
-      85,   104,    73,   175,    53,    91,    81,    29,   125,   120,
-      53,    33,   -93,   132,    58,    70,   147,   101,    95,    61,
-     163,   137,   150,   102,    63,    80,   149,    63,   -93,    62,
-      63,   166,    96,    59,   133,   138,   135,   104,    47,    48,
-      60,    61,    80,    53,   132,   167,   150,   150,   101,   147,
-     125,    62,    63,   163,   102,    63,   164,   165,    70,   149,
-      63,    98,    99,    83,    89,    90,   111,   125,    74,   122,
-     103,   117,     7,     8,     9,    10,    11,    12,    13,   125,
+      82,    70,   104,    37,   159,    68,    57,   130,   142,    88,
+     162,    52,    56,    84,    49,    92,     4,    93,    10,    50,
+      51,   132,    79,   134,    71,    53,    53,   143,    20,   104,
+      85,   104,    73,   120,   175,    91,    81,    29,   124,    97,
+      58,    33,   -93,   131,    83,    70,   147,   101,    95,    61,
+     163,   150,    59,   102,    63,    80,   149,    63,   -93,    62,
+      63,   136,    96,   100,    47,    48,   104,   101,   166,    98,
+      99,    60,    80,   102,    63,   137,   150,   150,   103,   124,
+     131,    53,   167,    61,   101,   147,    89,    70,   117,   163,
+     102,    63,   111,    62,    63,   149,    63,   124,    74,   164,
+     165,    90,     7,     8,     9,    10,    11,    12,    13,   124,
       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-     118,    26,    27,    28,    29,    30,   119,   134,    33,   139,
-     140,    98,    92,   142,   -22,   141,   154,   146,    34,   161,
-     143,   -22,  -107,   153,   -22,   -22,   112,   155,   156,   -22,
+     118,    26,    27,    28,    29,    30,   119,   103,    33,   133,
+     138,   139,    98,    92,   -22,   141,   140,   154,    34,   146,
+     142,   -22,  -107,   153,   -22,   -22,   112,   156,   155,   -22,
        7,     8,     9,    10,    11,    12,    13,   157,    15,    16,
-      17,    18,    19,    20,    21,    22,    23,    24,   170,    26,
-      27,    28,    29,    30,   171,   172,    33,   173,   176,   177,
-       5,   121,   -22,   113,   169,   160,    34,   136,     0,   -22,
-    -108,     0,   -22,   -22,   124,   130,     0,   -22,     7,     8,
+      17,    18,    19,    20,    21,    22,    23,    24,   161,    26,
+      27,    28,    29,    30,   170,   171,    33,   172,   173,   176,
+     177,     5,   -22,   121,   169,   135,    34,   113,   160,   -22,
+    -108,     0,   -22,   -22,   123,     0,   129,   -22,     7,     8,
        9,    10,    11,    12,    13,     0,    15,    16,    17,    18,
       19,    20,    21,    22,    23,    24,     0,    26,    27,    28,
       29,    30,     0,     0,    33,     0,     0,     0,     0,   -86,
@@ -784,26 +784,26 @@ static const yytype_int16 yytable[] =
 
 static const yytype_int16 yycheck[] =
 {
-      58,    38,    75,     3,   138,    37,    26,     1,    55,    32,
-       1,     0,    37,     1,    37,    63,    41,    30,     8,    32,
-      37,    23,    47,    48,    32,    72,    37,    52,    18,   102,
-      62,   104,    52,   167,    51,    67,    56,    27,    96,    87,
-      51,    31,    33,    37,    47,    82,    37,    41,    33,    37,
-      41,    33,   125,    47,    48,    55,    47,    48,    49,    47,
-      48,    33,    47,    47,   102,    47,   104,   140,    44,    45,
-      44,    37,    72,    51,    37,    47,   149,   150,    41,    37,
-     138,    47,    48,    41,    47,    48,   149,   150,   125,    47,
-      48,    44,    45,    37,    44,    46,    45,   155,     1,    31,
-      52,    49,     5,     6,     7,     8,     9,    10,    11,   167,
+      58,    38,    75,     3,   137,    37,    26,     1,    31,    63,
+       1,    37,    37,     1,    32,    30,     0,    32,     8,    37,
+      23,   102,    55,   104,    32,    51,    51,    50,    18,   102,
+      62,   104,    52,    87,   167,    67,    56,    27,    96,    72,
+      47,    31,    33,    37,    37,    82,    37,    41,    33,    37,
+      41,   124,    47,    47,    48,    55,    47,    48,    49,    47,
+      48,    33,    47,    37,    44,    45,   139,    41,    33,    44,
+      45,    44,    72,    47,    48,    47,   149,   150,    52,   137,
+      37,    51,    47,    37,    41,    37,    44,   124,    49,    41,
+      47,    48,    45,    47,    48,    47,    48,   155,     1,   149,
+     150,    46,     5,     6,     7,     8,     9,    10,    11,   167,
       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
-      49,    24,    25,    26,    27,    28,    49,    34,    31,    44,
-      46,    44,    30,    44,    37,    49,    36,    49,    41,    34,
-      50,    44,    45,    49,    47,    48,     1,    46,    49,    52,
+      49,    24,    25,    26,    27,    28,    49,    52,    31,    34,
+      44,    46,    44,    30,    37,    44,    49,    36,    41,    49,
+      31,    44,    45,    49,    47,    48,     1,    49,    46,    52,
        5,     6,     7,     8,     9,    10,    11,    49,    13,    14,
-      15,    16,    17,    18,    19,    20,    21,    22,    49,    24,
+      15,    16,    17,    18,    19,    20,    21,    22,    34,    24,
       25,    26,    27,    28,    49,    49,    31,    49,    49,    49,
-       1,    90,    37,    77,   155,   140,    41,   105,    -1,    44,
-      45,    -1,    47,    48,     1,   100,    -1,    52,     5,     6,
+      49,     1,    37,    90,   155,   105,    41,    77,   139,    44,
+      45,    -1,    47,    48,     1,    -1,   100,    52,     5,     6,
        7,     8,     9,    10,    11,    -1,    13,    14,    15,    16,
       17,    18,    19,    20,    21,    22,    -1,    24,    25,    26,
       27,    28,    -1,    -1,    31,    -1,    -1,    -1,    -1,    36,
@@ -855,9 +855,9 @@ static const yytype_uint8 yystos[] =
       46,    74,    30,    32,    97,    33,    47,    60,    44,    45,
       37,    41,    47,    52,    70,    76,    77,    91,    92,    93,
       94,    45,     1,    90,    74,    48,    49,    49,    49,    49,
-      73,    63,    31,    95,     1,    65,    78,    79,    80,    81,
-      94,     1,    37,    76,    34,    76,    95,    33,    47,    44,
-      46,    49,    44,    50,    85,    86,    49,    37,    41,    47,
+      73,    63,    95,     1,    65,    78,    79,    80,    81,    94,
+       1,    37,    76,    34,    76,    95,    33,    47,    44,    46,
+      49,    44,    31,    50,    85,    86,    49,    37,    41,    47,
       70,    82,    83,    49,    36,    46,    49,    49,     1,    78,
       93,    34,     1,    41,    82,    82,    33,    47,    36,    81,
       49,    49,    49,    49,     1,    78,    49,    49
_

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [genksyms patch 1/4] parser: fix the __attribute__ rule
  2008-07-30 22:03     ` Andreas Gruenbacher
@ 2008-07-31 21:17       ` Sam Ravnborg
  0 siblings, 0 replies; 11+ messages in thread
From: Sam Ravnborg @ 2008-07-31 21:17 UTC (permalink / raw)
  To: Andreas Gruenbacher; +Cc: linux-kernel, randy.dunlap, akpm

On Thu, Jul 31, 2008 at 12:03:49AM +0200, Andreas Gruenbacher wrote:
> On Wednesday 30 July 2008 10:43:11 pm Sam Ravnborg wrote:
> > Can I ask you to update the _shipped files and resend the patch.
> 
> Sure, here is the version from Andrew's tree, with parse.c_shipped added.

Applied to kbuild-fixes.

	Sam

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [genksyms patch 2/4] Include extern information in dumps
  2008-07-21  2:28 ` [genksyms patch 2/4] Include extern information in dumps Andreas Gruenbacher
@ 2008-07-31 21:18   ` Sam Ravnborg
  0 siblings, 0 replies; 11+ messages in thread
From: Sam Ravnborg @ 2008-07-31 21:18 UTC (permalink / raw)
  To: Andreas Gruenbacher; +Cc: linux-kernel

On Mon, Jul 21, 2008 at 04:28:25AM +0200, Andreas Gruenbacher wrote:
> The extern flag currently is not included in type dump files
> (genksyms --dump-types). Include that flag there for completeness.
> 
> Signed-off-by: Andreas Gruenbacher <agruen@suse.de>

Applied to kbuild-fixes.

The reamining two patches will wait until I get a closer look
at them.

	Sam

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [genksyms patch 3/4] Track symbol checksum changes
  2008-07-21  2:28 ` [genksyms patch 3/4] Track symbol checksum changes Andreas Gruenbacher
@ 2008-09-03  5:02   ` Andrew Morton
  2008-09-03  8:13     ` Andreas Gruenbacher
  0 siblings, 1 reply; 11+ messages in thread
From: Andrew Morton @ 2008-09-03  5:02 UTC (permalink / raw)
  To: Andreas Gruenbacher; +Cc: linux-kernel, Sam Ravnborg

On Mon, 21 Jul 2008 04:28:26 +0200 Andreas Gruenbacher <agruen@suse.de> wrote:

> Sometimes it is preferable to avoid changes of exported symbol checksums (to
> avoid breaking externally provided modules).  When a checksum change occurs, it
> can be hard to figure out what caused this change: underlying types may have
> changed, or additional type information may simply have become available at the
> point where a symbol is exported.
> 
> Add a new --reference option to genksyms which allows it to report why
> checksums change, based on the type information dumps it creates with
> the --dump-types flag.  Genksyms will read in such a dump from a previous run,
> and report which symbols have changed (and why).
> 
> The behavior can be controlled for an entire build as follows: If
> KBUILD_SYMTYPES is set, genksyms uses --dump-types to produce *.symtypes dump
> files.  If any *.symref files exist, those will be used as the reference to
> check against.  If KBUILD_PRESERVE is set, checksum changes will fail the
> build.

This breaks `make M=...'

With i386 allmodconfig,


akpm2:/usr/src/25> make M=drivers/rtc               

  WARNING: Symbol version dump /usr/src/devel/Module.symvers
           is missing; modules will have no dependencies and modversions.

  LD      drivers/rtc/built-in.o
  CC [M]  drivers/rtc/rtc-lib.o
scripts/genksyms/genksyms: invalid option -- r
Usage:
genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver

  -a, --arch            Select architecture
  -d, --debug           Increment the debug level (repeatable)
  -D, --dump            Dump expanded symbol defs (for debugging only)
  -T, --dump-types file Dump expanded types into file (for debugging only)
  -w, --warnings        Enable warnings
  -q, --quiet           Disable warnings (default)
  -h, --help            Print this message
  -V, --version         Print the release version
make[1]: *** [drivers/rtc/rtc-lib.o] Error 1
make: *** [_module_drivers/rtc] Error 2

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [genksyms patch 3/4] Track symbol checksum changes
  2008-09-03  5:02   ` Andrew Morton
@ 2008-09-03  8:13     ` Andreas Gruenbacher
  0 siblings, 0 replies; 11+ messages in thread
From: Andreas Gruenbacher @ 2008-09-03  8:13 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Sam Ravnborg

On Wednesday 03 September 2008 07:02:31 Andrew Morton wrote:
> On Mon, 21 Jul 2008 04:28:26 +0200 Andreas Gruenbacher <agruen@suse.de> 
wrote:
> > Sometimes it is preferable to avoid changes of exported symbol checksums
> > (to avoid breaking externally provided modules).  When a checksum change
> > occurs, it can be hard to figure out what caused this change: underlying
> > types may have changed, or additional type information may simply have
> > become available at the point where a symbol is exported.
> >
> > Add a new --reference option to genksyms which allows it to report why
> > checksums change, based on the type information dumps it creates with
> > the --dump-types flag.  Genksyms will read in such a dump from a previous
> > run, and report which symbols have changed (and why).
> >
> > The behavior can be controlled for an entire build as follows: If
> > KBUILD_SYMTYPES is set, genksyms uses --dump-types to produce *.symtypes
> > dump files.  If any *.symref files exist, those will be used as the
> > reference to check against.  If KBUILD_PRESERVE is set, checksum changes
> > will fail the build.
>
> This breaks `make M=...'
>
> With i386 allmodconfig,
>
>
> akpm2:/usr/src/25> make M=drivers/rtc
>
>   WARNING: Symbol version dump /usr/src/devel/Module.symvers
>            is missing; modules will have no dependencies and modversions.
>
>   LD      drivers/rtc/built-in.o
>   CC [M]  drivers/rtc/rtc-lib.o
> scripts/genksyms/genksyms: invalid option -- r
> Usage:
> genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver
>
>   -a, --arch            Select architecture
>   -d, --debug           Increment the debug level (repeatable)
>   -D, --dump            Dump expanded symbol defs (for debugging only)
>   -T, --dump-types file Dump expanded types into file (for debugging only)
>   -w, --warnings        Enable warnings
>   -q, --quiet           Disable warnings (default)
>   -h, --help            Print this message
>   -V, --version         Print the release version
> make[1]: *** [drivers/rtc/rtc-lib.o] Error 1
> make: *** [_module_drivers/rtc] Error 2

The usage information above is from an unpatched genksyms; a "make scripts" is 
needed. On a clean tree, this works for me:

	make allmodconfig prepare scripts
	make M=drivers/rtc

When compiling out-of-tree modules with M=, the O= tree is not rebuilt 
automatically; it may even be read-only (as when building an external module 
as a user using the distro kernel packages).

Thanks,
Andreas

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-09-03  8:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-21  2:28 [genksyms patch 0/4] Checksum tracking and tweaking Andreas Gruenbacher
2008-07-21  2:28 ` [genksyms patch 1/4] parser: fix the __attribute__ rule Andreas Gruenbacher
2008-07-30 20:43   ` Sam Ravnborg
2008-07-30 22:03     ` Andreas Gruenbacher
2008-07-31 21:17       ` Sam Ravnborg
2008-07-21  2:28 ` [genksyms patch 2/4] Include extern information in dumps Andreas Gruenbacher
2008-07-31 21:18   ` Sam Ravnborg
2008-07-21  2:28 ` [genksyms patch 3/4] Track symbol checksum changes Andreas Gruenbacher
2008-09-03  5:02   ` Andrew Morton
2008-09-03  8:13     ` Andreas Gruenbacher
2008-07-21  2:28 ` [genksyms patch 4/4] Allow to ignore " Andreas Gruenbacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox