History

genksyms: allow to ignore symbol checksum changes

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.

Andreas Gruenbacher committed 17 years ago

Commit 5dae9a51 parent 64e6c1e2 files · +31 −4Browse files

Showing the changes to scripts (2 of 2 files). Show all

Unified · Split

2 files
  1. scripts/genksyms/genksyms.c +30 −4
  2. scripts/genksyms/genksyms.h +1 −0
scripts/genksyms/genksyms.c+30−4
@@ -191,11 +191,26 @@ struct symbol *__add_symbol(const char *name, enum symbol_type type, · 190 unmodified lines
191191 /* fall through */ ;
192192 else if (sym->type == type &&
193193 equal_list(sym->defn, defn)) {
194+ if (!sym->is_declared && sym->is_override) {
195+ print_location();
196+ print_type_name(type, name);
197+ fprintf(stderr, " modversion is "
198+ "unchanged\n");
199+ }
194200 sym->is_declared = 1;
195201 return sym;
196202 } else if (!sym->is_declared) {
197− status = is_unknown_symbol(sym) ?
198− STATUS_DEFINED : STATUS_MODIFIED;
203+ if (sym->is_override && flag_preserve) {
204+ print_location();
205+ fprintf(stderr, "ignoring ");
206+ print_type_name(type, name);
207+ fprintf(stderr, " modversion change\n");
208+ sym->is_declared = 1;
209+ return sym;
210+ } else {
211+ status = is_unknown_symbol(sym) ?
212+ STATUS_DEFINED : STATUS_MODIFIED;
213+ }
199214 } else {
200215 error_with_pos("redefinition of %s", name);
201216 return sym;
@@ -229,6 +244,7 @@ struct symbol *__add_symbol(const char *name, enum symbol_type type, · 27 unmodified lines
229244
230245 sym->is_declared = !is_reference;
231246 sym->status = status;
247+ sym->is_override = 0;
232248
233249 if (flag_debug) {
234250 fprintf(debugfile, "Defn for %s %s == <",
@@ -348,9 +364,16 @@ static void read_reference(FILE *f) · 113 unmodified lines
348364 while (!feof(f)) {
349365 struct string_list *defn = NULL;
350366 struct string_list *sym, *def;
351− int is_extern = 0;
367+ int is_extern = 0, is_override = 0;
368+ struct symbol *subsym;
352369
353370 sym = read_node(f);
371+ if (sym && sym->tag == SYM_NORMAL &&
372+ !strcmp(sym->string, "override")) {
373+ is_override = 1;
374+ free_node(sym);
375+ sym = read_node(f);
376+ }
354377 if (!sym)
355378 continue;
356379 def = read_node(f);
@@ -365,8 +388,9 @@ static void read_reference(FILE *f) · 8 unmodified lines
365388 defn = def;
366389 def = read_node(f);
367390 }
368− add_reference_symbol(xstrdup(sym->string), sym->tag,
391+ subsym = add_reference_symbol(xstrdup(sym->string), sym->tag,
369392 defn, is_extern);
393+ subsym->is_override = is_override;
370394 free_node(sym);
371395 }
372396 }
@@ -743,6 +767,8 @@ int main(int argc, char **argv) · 370 unmodified lines
743767 while (visited_symbols != (struct symbol *)-1L) {
744768 struct symbol *sym = visited_symbols;
745769
770+ if (sym->is_override)
771+ fputs("override ", dumpfile);
746772 if (sym->type != SYM_NORMAL) {
747773 putc(symbol_type_name[sym->type][0], dumpfile);
748774 putc('#', dumpfile);
scripts/genksyms/genksyms.h+1−0
@@ -49,6 +49,7 @@ struct symbol { · 48 unmodified lines
4949 int is_extern;
5050 int is_declared;
5151 enum symbol_status status;
52+ int is_override;
5253 };
5354
5455 typedef struct string_list **yystype;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t