genksyms: track symbol checksum changes
PATCH 1/8 genksyms: track symbol checksum changes
From: Andreas Gruenbacher <[email protected]>
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.
---
scripts/Makefile.build | 16 +- scripts/genksyms/genksyms.c | 236 +++++++++++++++++++++++++++++++--- scripts/genksyms/genksyms.h | 6 3 files changed, 239 insertions(+), 19 deletions(-)
scripts/Makefile.build renamed from scripts/Makefile.build~genksyms-track-symbol-checksum-changes +13 -3
@@ -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) \
scripts/genksyms/genksyms.c renamed from scripts/genksyms/genksyms.c~genksyms-track-symbol-checksum-changes +220 -16
379 lines not on this page · raw message
scripts/genksyms/genksyms.h renamed from scripts/genksyms/genksyms.h~genksyms-track-symbol-checksum-changes +6 -0
@@ -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 ;
_
Sam Ravnborg
AppliedQuoted 19 lines · On Mon, Dec 01, 2008 at 02:21:01PM -0800, [email protected] wrote:
From: Andreas Gruenbacher <[email protected]>
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_SYMTYPESis 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. IfKBUILD_PRESERVEis set, checksum changes will fail the build.
Quoted 4 lines
Signed-off-by Andreas Gruenbacher <[email protected]>Cc Sam Ravnborg <[email protected]>Cc Randy Dunlap <[email protected]>Signed-off-by Andrew Morton <[email protected]>
Applied.
Sam