]>
Commit | Line | Data |
---|---|---|
4d1e5b62 AF |
1 | From: Andreas Gruenbacher <agruen@suse.de> |
2 | Subject: genksyms: allow to ignore symbol checksum changes | |
3 | ||
4 | This adds an "override" keyword for use in *.symvers / *.symref files. When a | |
5 | symbol is overridden, the symbol's old definition will be used for computing | |
6 | checksums instead of the new one, preserving the previous checksum. (Genksyms | |
7 | will still warn about the change.) | |
8 | ||
9 | This is meant to allow distributions to hide minor actual as well as fake ABI | |
10 | changes. (For example, when extra type information becomes available because | |
11 | additional headers are included, this may change checksums even though none of | |
12 | the types used have actully changed.) | |
13 | ||
14 | This approach also allows to get rid of "#ifdef __GENKSYMS__" hacks in the code, | |
15 | which are currently used in some vendor kernels to work around checksum changes. | |
16 | ||
17 | Signed-off-by: Andreas Gruenbacher <agruen@suse.de> | |
18 | ||
19 | --- | |
20 | scripts/genksyms/genksyms.c | 34 ++++++++++++++++++++++++++++++---- | |
21 | scripts/genksyms/genksyms.h | 1 + | |
22 | 2 files changed, 31 insertions(+), 4 deletions(-) | |
23 | ||
24 | --- a/scripts/genksyms/genksyms.c | |
25 | +++ b/scripts/genksyms/genksyms.c | |
26 | @@ -191,11 +191,26 @@ struct symbol *__add_symbol(const char * | |
27 | /* fall through */ ; | |
28 | else if (sym->type == type && | |
29 | equal_list(sym->defn, defn)) { | |
30 | + if (!sym->is_declared && sym->is_override) { | |
31 | + print_location(); | |
32 | + print_type_name(type, name); | |
33 | + fprintf(stderr, " modversion is " | |
34 | + "unchanged\n"); | |
35 | + } | |
36 | sym->is_declared = 1; | |
37 | return sym; | |
38 | } else if (!sym->is_declared) { | |
39 | - status = is_unknown_symbol(sym) ? | |
40 | - STATUS_DEFINED : STATUS_MODIFIED; | |
41 | + if (sym->is_override && flag_preserve) { | |
42 | + print_location(); | |
43 | + fprintf(stderr, "ignoring "); | |
44 | + print_type_name(type, name); | |
45 | + fprintf(stderr, " modversion change\n"); | |
46 | + sym->is_declared = 1; | |
47 | + return sym; | |
48 | + } else { | |
49 | + status = is_unknown_symbol(sym) ? | |
50 | + STATUS_DEFINED : STATUS_MODIFIED; | |
51 | + } | |
52 | } else { | |
53 | error_with_pos("redefinition of %s", name); | |
54 | return sym; | |
55 | @@ -229,6 +244,7 @@ struct symbol *__add_symbol(const char * | |
56 | ||
57 | sym->is_declared = !is_reference; | |
58 | sym->status = status; | |
59 | + sym->is_override = 0; | |
60 | ||
61 | if (flag_debug) { | |
62 | fprintf(debugfile, "Defn for %s %s == <", | |
63 | @@ -348,9 +364,16 @@ static void read_reference(FILE *f) | |
64 | while (!feof(f)) { | |
65 | struct string_list *defn = NULL; | |
66 | struct string_list *sym, *def; | |
67 | - int is_extern = 0; | |
68 | + int is_extern = 0, is_override = 0; | |
69 | + struct symbol *subsym; | |
70 | ||
71 | sym = read_node(f); | |
72 | + if (sym && sym->tag == SYM_NORMAL && | |
73 | + !strcmp(sym->string, "override")) { | |
74 | + is_override = 1; | |
75 | + free_node(sym); | |
76 | + sym = read_node(f); | |
77 | + } | |
78 | if (!sym) | |
79 | continue; | |
80 | def = read_node(f); | |
81 | @@ -365,8 +388,9 @@ static void read_reference(FILE *f) | |
82 | defn = def; | |
83 | def = read_node(f); | |
84 | } | |
85 | - add_reference_symbol(xstrdup(sym->string), sym->tag, | |
86 | + subsym = add_reference_symbol(xstrdup(sym->string), sym->tag, | |
87 | defn, is_extern); | |
88 | + subsym->is_override = is_override; | |
89 | free_node(sym); | |
90 | } | |
91 | } | |
92 | @@ -743,6 +767,8 @@ int main(int argc, char **argv) | |
93 | while (visited_symbols != (struct symbol *)-1L) { | |
94 | struct symbol *sym = visited_symbols; | |
95 | ||
96 | + if (sym->is_override) | |
97 | + fputs("override ", dumpfile); | |
98 | if (sym->type != SYM_NORMAL) { | |
99 | putc(symbol_type_name[sym->type][0], dumpfile); | |
100 | putc('#', dumpfile); | |
101 | --- a/scripts/genksyms/genksyms.h | |
102 | +++ b/scripts/genksyms/genksyms.h | |
103 | @@ -49,6 +49,7 @@ struct symbol { | |
104 | int is_extern; | |
105 | int is_declared; | |
106 | enum symbol_status status; | |
107 | + int is_override; | |
108 | }; | |
109 | ||
110 | typedef struct string_list **yystype; |