Commit 2ea03891 authored by Sam Ravnborg's avatar Sam Ravnborg

Revert "kbuild: strip generated symbols from *.ko"

This reverts commit ad7a953c.

And commit: ("allow stripping of generated symbols under CONFIG_KALLSYMS_ALL")
            9bb48247

These stripping patches has caused a set of issues:

1) People have reported compatibility issues with binutils due to
   lack of support for `--strip-unneeded-symbols' with objcopy 2.15.92.0.2
   Reported by: Wenji
2) ccache and distcc no longer works as expeced
   Reported by: Ted, Roland, + others
3) The installed modules increased a lot in size
   Reported by: Ted, Davej + others
Reported-by: default avatarWenji Huang <wenji.huang@oracle.com>
Reported-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
Reported-by: default avatarDave Jones <davej@redhat.com>
Reported-by: default avatarRoland McGrath <roland@redhat.com>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent a6525042
...@@ -606,25 +606,20 @@ export INSTALL_PATH ?= /boot ...@@ -606,25 +606,20 @@ export INSTALL_PATH ?= /boot
MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
export MODLIB export MODLIB
strip-symbols := $(srctree)/scripts/strip-symbols \
$(wildcard $(srctree)/arch/$(ARCH)/scripts/strip-symbols)
# #
# INSTALL_MOD_STRIP, if defined, will cause modules to be stripped while # INSTALL_MOD_STRIP, if defined, will cause modules to be
# they get installed. If INSTALL_MOD_STRIP is '1', then the default # stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
# options (see below) will be used. Otherwise, INSTALL_MOD_STRIP will # the default option --strip-debug will be used. Otherwise,
# be used as the option(s) to the objcopy command. # INSTALL_MOD_STRIP will used as the options to the strip command.
ifdef INSTALL_MOD_STRIP ifdef INSTALL_MOD_STRIP
ifeq ($(INSTALL_MOD_STRIP),1) ifeq ($(INSTALL_MOD_STRIP),1)
mod_strip_cmd = $(OBJCOPY) --strip-debug mod_strip_cmd = $(STRIP) --strip-debug
ifeq ($(CONFIG_KALLSYMS_ALL),$(CONFIG_KALLSYMS_STRIP_GENERATED))
mod_strip_cmd += --wildcard $(addprefix --strip-symbols ,$(strip-symbols))
endif
else else
mod_strip_cmd = $(OBJCOPY) $(INSTALL_MOD_STRIP) mod_strip_cmd = $(STRIP) $(INSTALL_MOD_STRIP)
endif # INSTALL_MOD_STRIP=1 endif # INSTALL_MOD_STRIP=1
else else
mod_strip_cmd = false mod_strip_cmd = true
endif # INSTALL_MOD_STRIP endif # INSTALL_MOD_STRIP
export mod_strip_cmd export mod_strip_cmd
...@@ -754,7 +749,6 @@ last_kallsyms := 2 ...@@ -754,7 +749,6 @@ last_kallsyms := 2
endif endif
kallsyms.o := .tmp_kallsyms$(last_kallsyms).o kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
kallsyms.h := $(wildcard include/config/kallsyms/*.h) $(wildcard include/config/kallsyms/*/*.h)
define verify_kallsyms define verify_kallsyms
$(Q)$(if $($(quiet)cmd_sysmap), \ $(Q)$(if $($(quiet)cmd_sysmap), \
...@@ -779,41 +773,24 @@ endef ...@@ -779,41 +773,24 @@ endef
# Generate .S file with all kernel symbols # Generate .S file with all kernel symbols
quiet_cmd_kallsyms = KSYM $@ quiet_cmd_kallsyms = KSYM $@
cmd_kallsyms = { test $* -eq 0 || $(NM) -n $<; } \ cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) \
| $(KALLSYMS) $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) >$@ $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) > $@
quiet_cmd_kstrip = STRIP $@
cmd_kstrip = $(OBJCOPY) --wildcard $(addprefix --strip$(if $(CONFIG_RELOCATABLE),-unneeded)-symbols ,$(filter %/scripts/strip-symbols,$^)) $< $@
$(foreach n,0 1 2 3,.tmp_kallsyms$(n).o): KBUILD_AFLAGS += -Wa,--strip-local-absolute .tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE
$(foreach n,0 1 2 3,.tmp_kallsyms$(n).o): %.o: %.S scripts FORCE
$(call if_changed_dep,as_o_S) $(call if_changed_dep,as_o_S)
ifeq ($(CONFIG_KALLSYMS_STRIP_GENERATED),y) .tmp_kallsyms%.S: .tmp_vmlinux% $(KALLSYMS)
strip-ext := .stripped
endif
.tmp_kallsyms%.S: .tmp_vmlinux%$(strip-ext) $(KALLSYMS) $(kallsyms.h)
$(call cmd,kallsyms) $(call cmd,kallsyms)
# make -jN seems to have problems with intermediate files, see bug #3330.
.SECONDARY: $(foreach n,1 2 3,.tmp_vmlinux$(n).stripped)
.tmp_vmlinux%.stripped: .tmp_vmlinux% $(strip-symbols) $(kallsyms.h)
$(call cmd,kstrip)
ifneq ($(CONFIG_DEBUG_INFO),y)
.tmp_vmlinux%: LDFLAGS_vmlinux += -S
endif
# .tmp_vmlinux1 must be complete except kallsyms, so update vmlinux version # .tmp_vmlinux1 must be complete except kallsyms, so update vmlinux version
.tmp_vmlinux%: $(vmlinux-lds) $(vmlinux-all) FORCE .tmp_vmlinux1: $(vmlinux-lds) $(vmlinux-all) FORCE
$(if $(filter 1,$*),$(call if_changed_rule,ksym_ld),$(call if_changed,vmlinux__)) $(call if_changed_rule,ksym_ld)
.tmp_vmlinux0$(strip-ext): .tmp_vmlinux2: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms1.o FORCE
$(Q)echo "placeholder" >$@ $(call if_changed,vmlinux__)
.tmp_vmlinux1: .tmp_kallsyms0.o .tmp_vmlinux3: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms2.o FORCE
.tmp_vmlinux2: .tmp_kallsyms1.o $(call if_changed,vmlinux__)
.tmp_vmlinux3: .tmp_kallsyms2.o
# Needs to visit scripts/ before $(KALLSYMS) can be used. # Needs to visit scripts/ before $(KALLSYMS) can be used.
$(KALLSYMS): scripts ; $(KALLSYMS): scripts ;
......
__cpu_vendor_dev_X86_VENDOR_*
...@@ -626,13 +626,6 @@ config KALLSYMS_ALL ...@@ -626,13 +626,6 @@ config KALLSYMS_ALL
Say N. Say N.
config KALLSYMS_STRIP_GENERATED
bool "Strip machine generated symbols from kallsyms"
depends on KALLSYMS_ALL
default y
help
Say N if you want kallsyms to retain even machine generated symbols.
config KALLSYMS_EXTRA_PASS config KALLSYMS_EXTRA_PASS
bool "Do an extra kallsyms pass" bool "Do an extra kallsyms pass"
depends on KALLSYMS depends on KALLSYMS
......
...@@ -30,19 +30,20 @@ ...@@ -30,19 +30,20 @@
#define all_var 0 #define all_var 0
#endif #endif
extern const unsigned long kallsyms_addresses[]; /* These will be re-linked against their real values during the second link stage */
extern const u8 kallsyms_names[]; extern const unsigned long kallsyms_addresses[] __attribute__((weak));
extern const u8 kallsyms_names[] __attribute__((weak));
/* tell the compiler that the count isn't in the small data section if the arch /* tell the compiler that the count isn't in the small data section if the arch
* has one (eg: FRV) * has one (eg: FRV)
*/ */
extern const unsigned long kallsyms_num_syms extern const unsigned long kallsyms_num_syms
__attribute__((__section__(".rodata"))); __attribute__((weak, section(".rodata")));
extern const u8 kallsyms_token_table[]; extern const u8 kallsyms_token_table[] __attribute__((weak));
extern const u16 kallsyms_token_index[]; extern const u16 kallsyms_token_index[] __attribute__((weak));
extern const unsigned long kallsyms_markers[]; extern const unsigned long kallsyms_markers[] __attribute__((weak));
static inline int is_kernel_inittext(unsigned long addr) static inline int is_kernel_inittext(unsigned long addr)
{ {
...@@ -167,6 +168,9 @@ static unsigned long get_symbol_pos(unsigned long addr, ...@@ -167,6 +168,9 @@ static unsigned long get_symbol_pos(unsigned long addr,
unsigned long symbol_start = 0, symbol_end = 0; unsigned long symbol_start = 0, symbol_end = 0;
unsigned long i, low, high, mid; unsigned long i, low, high, mid;
/* This kernel should never had been booted. */
BUG_ON(!kallsyms_addresses);
/* do a binary search on the sorted kallsyms_addresses array */ /* do a binary search on the sorted kallsyms_addresses array */
low = 0; low = 0;
high = kallsyms_num_syms; high = kallsyms_num_syms;
......
...@@ -151,16 +151,16 @@ cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $< ...@@ -151,16 +151,16 @@ cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
$(obj)/%.i: $(src)/%.c FORCE $(obj)/%.i: $(src)/%.c FORCE
$(call if_changed_dep,cc_i_c) $(call if_changed_dep,cc_i_c)
cmd_genksyms = \ cmd_gensymtypes = \
$(CPP) -D__GENKSYMS__ $(c_flags) $< | \ $(CPP) -D__GENKSYMS__ $(c_flags) $< | \
$(GENKSYMS) -T $@ -A -a $(ARCH) \ $(GENKSYMS) -T $@ -a $(ARCH) \
$(if $(KBUILD_PRESERVE),-p) \ $(if $(KBUILD_PRESERVE),-p) \
$(if $(1),-r $(firstword $(wildcard $(@:.symtypes=.symref) /dev/null))) $(if $(1),-r $(firstword $(wildcard $(@:.symtypes=.symref) /dev/null)))
quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@ quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
cmd_cc_symtypes_c = \ cmd_cc_symtypes_c = \
set -e; \ set -e; \
$(call cmd_genksyms, true) >/dev/null; \ $(call cmd_gensymtypes, true) >/dev/null; \
test -s $@ || rm -f $@ test -s $@ || rm -f $@
$(obj)/%.symtypes : $(src)/%.c FORCE $(obj)/%.symtypes : $(src)/%.c FORCE
...@@ -177,38 +177,28 @@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< ...@@ -177,38 +177,28 @@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
else else
# When module versioning is enabled the following steps are executed: # When module versioning is enabled the following steps are executed:
# o compile a .tmp_<file>.s from <file>.c # o compile a .tmp_<file>.o from <file>.c
# o if .tmp_<file>.s doesn't contain a __ksymtab version, i.e. does # o if .tmp_<file>.o doesn't contain a __ksymtab version, i.e. does
# not export symbols, we just assemble .tmp_<file>.s to <file>.o and # not export symbols, we just rename .tmp_<file>.o to <file>.o and
# are done. # are done.
# o otherwise, we calculate symbol versions using the good old # o otherwise, we calculate symbol versions using the good old
# genksyms on the preprocessed source and postprocess them in a way # genksyms on the preprocessed source and postprocess them in a way
# that they are usable as assembly source # that they are usable as a linker script
# o assemble <file>.o from .tmp_<file>.s forcing inclusion of directives # o generate <file>.o from .tmp_<file>.o using the linker to
# defining the actual values of __crc_*, followed by objcopy-ing them # replace the unresolved symbols __crc_exported_symbol with
# to force these symbols to be local to permit stripping them later. # the actual value of the checksum generated by genksyms
s_file = $(@D)/.tmp_$(@F:.o=.s)
v_file = $(@D)/.tmp_$(@F:.o=.v)
tmp_o_file = $(@D)/.tmp_$(@F)
no_g_c_flags = $(filter-out -g%,$(c_flags))
cmd_cc_o_c = $(CC) $(c_flags) -S -o $(s_file) $<
cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $<
cmd_modversions = \ cmd_modversions = \
if grep -q __ksymtab $(s_file); then \ if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \
if $(call cmd_genksyms, $(KBUILD_SYMTYPES)) > $(v_file) \ $(call cmd_gensymtypes, $(KBUILD_SYMTYPES)) \
&& $(CC) $(no_g_c_flags) -c -Wa,$(v_file) \ > $(@D)/.tmp_$(@F:.o=.ver); \
-o $(tmp_o_file) $(s_file) \ \
&& $(OBJCOPY) -L '__crc_*' -L '___crc_*' -w \ $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
$(tmp_o_file) $@; \ -T $(@D)/.tmp_$(@F:.o=.ver); \
then \ rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
: ; \
else \
rm -f $@; exit 1; \
fi; \
else \ else \
rm -f $(v_file); \ mv -f $(@D)/.tmp_$(@F) $@; \
$(CC) $(no_g_c_flags) -c -o $@ $(s_file); \
fi; fi;
endif endif
...@@ -225,12 +215,7 @@ define rule_cc_o_c ...@@ -225,12 +215,7 @@ define rule_cc_o_c
$(cmd_record_mcount) \ $(cmd_record_mcount) \
scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \
$(dot-target).tmp; \ $(dot-target).tmp; \
if [ -r $(@D)/.tmp_$(@F:.o=.v) ]; then \ rm -f $(depfile); \
echo >> $(dot-target).tmp; \
echo '$@: $(GENKSYMS)' >> $(dot-target).tmp; \
echo '$(GENKSYMS):: ;' >> $(dot-target).tmp; \
fi; \
rm -f $(depfile) $(@D)/.tmp_$(@F:.o=.?); \
mv -f $(dot-target).tmp $(dot-target).cmd mv -f $(dot-target).tmp $(dot-target).cmd
endef endef
......
...@@ -17,8 +17,7 @@ __modinst: $(modules) ...@@ -17,8 +17,7 @@ __modinst: $(modules)
@: @:
quiet_cmd_modules_install = INSTALL $@ quiet_cmd_modules_install = INSTALL $@
cmd_modules_install = mkdir -p $(2); \ cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@)
$(mod_strip_cmd) $@ $(2)/$(notdir $@) || cp $@ $(2)
# Modules built outside the kernel source tree go into extra by default # Modules built outside the kernel source tree go into extra by default
INSTALL_MOD_DIR ?= extra INSTALL_MOD_DIR ?= extra
......
...@@ -43,7 +43,7 @@ int cur_line = 1; ...@@ -43,7 +43,7 @@ int cur_line = 1;
char *cur_filename; char *cur_filename;
static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types, static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types,
flag_preserve, flag_warnings, flag_asm; flag_preserve, flag_warnings;
static const char *arch = ""; static const char *arch = "";
static const char *mod_prefix = ""; static const char *mod_prefix = "";
...@@ -610,11 +610,8 @@ void export_symbol(const char *name) ...@@ -610,11 +610,8 @@ void export_symbol(const char *name)
if (flag_dump_defs) if (flag_dump_defs)
fputs(">\n", debugfile); fputs(">\n", debugfile);
/* Used as assembly source or a linker script. */ /* Used as a linker script. */
printf(flag_asm printf("%s__crc_%s = 0x%08lx ;\n", mod_prefix, name, crc);
? ".equiv %s__crc_%s, %#08lx\n"
: "%s__crc_%s = %#08lx ;\n",
mod_prefix, name, crc);
} }
} }
...@@ -651,10 +648,9 @@ void error_with_pos(const char *fmt, ...) ...@@ -651,10 +648,9 @@ void error_with_pos(const char *fmt, ...)
static void genksyms_usage(void) static void genksyms_usage(void)
{ {
fputs("Usage:\n" "genksyms [-aAdDTwqhV] > /path/to/.tmp_obj.ver\n" "\n" fputs("Usage:\n" "genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver\n" "\n"
#ifdef __GNU_LIBRARY__ #ifdef __GNU_LIBRARY__
" -a, --arch Select architecture\n" " -a, --arch Select architecture\n"
" -A, --asm Generate assembly rather than linker script\n"
" -d, --debug Increment the debug level (repeatable)\n" " -d, --debug Increment the debug level (repeatable)\n"
" -D, --dump Dump expanded symbol defs (for debugging only)\n" " -D, --dump Dump expanded symbol defs (for debugging only)\n"
" -r, --reference file Read reference symbols from a file\n" " -r, --reference file Read reference symbols from a file\n"
...@@ -666,7 +662,6 @@ static void genksyms_usage(void) ...@@ -666,7 +662,6 @@ static void genksyms_usage(void)
" -V, --version Print the release version\n" " -V, --version Print the release version\n"
#else /* __GNU_LIBRARY__ */ #else /* __GNU_LIBRARY__ */
" -a Select architecture\n" " -a Select architecture\n"
" -A Generate assembly rather than linker script\n"
" -d Increment the debug level (repeatable)\n" " -d Increment the debug level (repeatable)\n"
" -D Dump expanded symbol defs (for debugging only)\n" " -D Dump expanded symbol defs (for debugging only)\n"
" -r file Read reference symbols from a file\n" " -r file Read reference symbols from a file\n"
...@@ -688,7 +683,6 @@ int main(int argc, char **argv) ...@@ -688,7 +683,6 @@ int main(int argc, char **argv)
#ifdef __GNU_LIBRARY__ #ifdef __GNU_LIBRARY__
struct option long_opts[] = { struct option long_opts[] = {
{"arch", 1, 0, 'a'}, {"arch", 1, 0, 'a'},
{"asm", 0, 0, 'A'},
{"debug", 0, 0, 'd'}, {"debug", 0, 0, 'd'},
{"warnings", 0, 0, 'w'}, {"warnings", 0, 0, 'w'},
{"quiet", 0, 0, 'q'}, {"quiet", 0, 0, 'q'},
...@@ -701,10 +695,10 @@ int main(int argc, char **argv) ...@@ -701,10 +695,10 @@ int main(int argc, char **argv)
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
while ((o = getopt_long(argc, argv, "a:dwqVADr:T:ph", while ((o = getopt_long(argc, argv, "a:dwqVDr:T:ph",
&long_opts[0], NULL)) != EOF) &long_opts[0], NULL)) != EOF)
#else /* __GNU_LIBRARY__ */ #else /* __GNU_LIBRARY__ */
while ((o = getopt(argc, argv, "a:dwqVADr:T:ph")) != EOF) while ((o = getopt(argc, argv, "a:dwqVDr:T:ph")) != EOF)
#endif /* __GNU_LIBRARY__ */ #endif /* __GNU_LIBRARY__ */
switch (o) { switch (o) {
case 'a': case 'a':
...@@ -722,9 +716,6 @@ int main(int argc, char **argv) ...@@ -722,9 +716,6 @@ int main(int argc, char **argv)
case 'V': case 'V':
fputs("genksyms version 2.5.60\n", stderr); fputs("genksyms version 2.5.60\n", stderr);
break; break;
case 'A':
flag_asm = 1;
break;
case 'D': case 'D':
flag_dump_defs = 1; flag_dump_defs = 1;
break; break;
......
/* ANSI-C code produced by gperf version 3.0.1 */ /* ANSI-C code produced by gperf version 3.0.2 */
/* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */ /* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#line 3 "scripts/genksyms/keywords.gperf" #line 3 "scripts/genksyms/keywords.gperf"
struct resword { const char *name; int token; }; struct resword { const char *name; int token; };
/* maximum key range = 64, duplicates = 0 */ /* maximum key range = 62, duplicates = 0 */
#ifdef __GNUC__ #ifdef __GNUC__
__inline __inline
...@@ -46,32 +46,32 @@ is_reserved_hash (register const char *str, register unsigned int len) ...@@ -46,32 +46,32 @@ is_reserved_hash (register const char *str, register unsigned int len)
{ {
static const unsigned char asso_values[] = static const unsigned char asso_values[] =
{ {
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 5,
67, 67, 67, 67, 67, 67, 15, 67, 67, 67, 65, 65, 65, 65, 65, 65, 35, 65, 65, 65,
0, 67, 67, 67, 67, 67, 67, 67, 67, 67, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 0, 67, 0, 67, 5, 65, 65, 65, 65, 65, 0, 65, 0, 65, 5,
25, 20, 15, 30, 67, 15, 67, 67, 10, 0, 20, 15, 10, 30, 65, 15, 65, 65, 20, 0,
10, 40, 20, 67, 10, 5, 0, 10, 15, 67, 10, 35, 20, 65, 10, 5, 0, 10, 5, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
67, 67, 67, 67, 67, 67 65, 65, 65, 65, 65, 65
}; };
return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]]; return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]];
} }
...@@ -84,119 +84,116 @@ is_reserved_word (register const char *str, register unsigned int len) ...@@ -84,119 +84,116 @@ is_reserved_word (register const char *str, register unsigned int len)
{ {
enum enum
{ {
TOTAL_KEYWORDS = 45, TOTAL_KEYWORDS = 43,
MIN_WORD_LENGTH = 3, MIN_WORD_LENGTH = 3,
MAX_WORD_LENGTH = 24, MAX_WORD_LENGTH = 24,
MIN_HASH_VALUE = 3, MIN_HASH_VALUE = 3,
MAX_HASH_VALUE = 66 MAX_HASH_VALUE = 64
}; };
static const struct resword wordlist[] = static const struct resword wordlist[] =
{ {
{""}, {""}, {""}, {""}, {""}, {""},
#line 28 "scripts/genksyms/keywords.gperf" #line 26 "scripts/genksyms/keywords.gperf"
{"asm", ASM_KEYW}, {"asm", ASM_KEYW},
{""}, {""},
#line 10 "scripts/genksyms/keywords.gperf" #line 8 "scripts/genksyms/keywords.gperf"
{"__asm", ASM_KEYW}, {"__asm", ASM_KEYW},
{""}, {""},
#line 11 "scripts/genksyms/keywords.gperf" #line 9 "scripts/genksyms/keywords.gperf"
{"__asm__", ASM_KEYW}, {"__asm__", ASM_KEYW},
{""}, {""}, {""}, {""},
#line 54 "scripts/genksyms/keywords.gperf" #line 52 "scripts/genksyms/keywords.gperf"
{"__typeof__", TYPEOF_KEYW}, {"__typeof__", TYPEOF_KEYW},
{""}, {""},
#line 14 "scripts/genksyms/keywords.gperf" #line 12 "scripts/genksyms/keywords.gperf"
{"__const", CONST_KEYW}, {"__const", CONST_KEYW},
#line 13 "scripts/genksyms/keywords.gperf" #line 11 "scripts/genksyms/keywords.gperf"
{"__attribute__", ATTRIBUTE_KEYW}, {"__attribute__", ATTRIBUTE_KEYW},
#line 15 "scripts/genksyms/keywords.gperf" #line 13 "scripts/genksyms/keywords.gperf"
{"__const__", CONST_KEYW}, {"__const__", CONST_KEYW},
#line 20 "scripts/genksyms/keywords.gperf" #line 18 "scripts/genksyms/keywords.gperf"
{"__signed__", SIGNED_KEYW}, {"__signed__", SIGNED_KEYW},
#line 46 "scripts/genksyms/keywords.gperf" #line 44 "scripts/genksyms/keywords.gperf"
{"static", STATIC_KEYW}, {"static", STATIC_KEYW},
{""}, #line 20 "scripts/genksyms/keywords.gperf"
#line 41 "scripts/genksyms/keywords.gperf" {"__volatile__", VOLATILE_KEYW},
#line 39 "scripts/genksyms/keywords.gperf"
{"int", INT_KEYW}, {"int", INT_KEYW},
#line 34 "scripts/genksyms/keywords.gperf" #line 32 "scripts/genksyms/keywords.gperf"
{"char", CHAR_KEYW}, {"char", CHAR_KEYW},
#line 35 "scripts/genksyms/keywords.gperf" #line 33 "scripts/genksyms/keywords.gperf"
{"const", CONST_KEYW}, {"const", CONST_KEYW},
#line 47 "scripts/genksyms/keywords.gperf" #line 45 "scripts/genksyms/keywords.gperf"
{"struct", STRUCT_KEYW}, {"struct", STRUCT_KEYW},
#line 26 "scripts/genksyms/keywords.gperf" #line 24 "scripts/genksyms/keywords.gperf"
{"__restrict__", RESTRICT_KEYW}, {"__restrict__", RESTRICT_KEYW},
#line 27 "scripts/genksyms/keywords.gperf"
{"restrict", RESTRICT_KEYW},
#line 7 "scripts/genksyms/keywords.gperf"
{"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW},
#line 18 "scripts/genksyms/keywords.gperf"
{"__inline__", INLINE_KEYW},
{""},
#line 22 "scripts/genksyms/keywords.gperf"
{"__volatile__", VOLATILE_KEYW},
#line 5 "scripts/genksyms/keywords.gperf"
{"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW},
#line 25 "scripts/genksyms/keywords.gperf" #line 25 "scripts/genksyms/keywords.gperf"
{"restrict", RESTRICT_KEYW},
#line 23 "scripts/genksyms/keywords.gperf"
{"_restrict", RESTRICT_KEYW}, {"_restrict", RESTRICT_KEYW},
{""},
#line 12 "scripts/genksyms/keywords.gperf"
{"__attribute", ATTRIBUTE_KEYW},
#line 6 "scripts/genksyms/keywords.gperf"
{"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW},
#line 16 "scripts/genksyms/keywords.gperf" #line 16 "scripts/genksyms/keywords.gperf"
{"__inline__", INLINE_KEYW},
#line 10 "scripts/genksyms/keywords.gperf"
{"__attribute", ATTRIBUTE_KEYW},
{""},
#line 14 "scripts/genksyms/keywords.gperf"
{"__extension__", EXTENSION_KEYW}, {"__extension__", EXTENSION_KEYW},
#line 37 "scripts/genksyms/keywords.gperf" #line 35 "scripts/genksyms/keywords.gperf"
{"enum", ENUM_KEYW}, {"enum", ENUM_KEYW},
#line 8 "scripts/genksyms/keywords.gperf" #line 19 "scripts/genksyms/keywords.gperf"
{"EXPORT_UNUSED_SYMBOL", EXPORT_SYMBOL_KEYW}, {"__volatile", VOLATILE_KEYW},
#line 38 "scripts/genksyms/keywords.gperf" #line 36 "scripts/genksyms/keywords.gperf"
{"extern", EXTERN_KEYW}, {"extern", EXTERN_KEYW},
{""}, {""},
#line 19 "scripts/genksyms/keywords.gperf" #line 17 "scripts/genksyms/keywords.gperf"
{"__signed", SIGNED_KEYW}, {"__signed", SIGNED_KEYW},
#line 9 "scripts/genksyms/keywords.gperf" #line 7 "scripts/genksyms/keywords.gperf"
{"EXPORT_UNUSED_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW},
#line 49 "scripts/genksyms/keywords.gperf" {""},
{"union", UNION_KEYW}, #line 51 "scripts/genksyms/keywords.gperf"
#line 53 "scripts/genksyms/keywords.gperf"
{"typeof", TYPEOF_KEYW}, {"typeof", TYPEOF_KEYW},
#line 48 "scripts/genksyms/keywords.gperf" #line 46 "scripts/genksyms/keywords.gperf"
{"typedef", TYPEDEF_KEYW}, {"typedef", TYPEDEF_KEYW},
#line 17 "scripts/genksyms/keywords.gperf" #line 15 "scripts/genksyms/keywords.gperf"
{"__inline", INLINE_KEYW}, {"__inline", INLINE_KEYW},
#line 33 "scripts/genksyms/keywords.gperf" #line 31 "scripts/genksyms/keywords.gperf"
{"auto", AUTO_KEYW}, {"auto", AUTO_KEYW},
#line 21 "scripts/genksyms/keywords.gperf" #line 47 "scripts/genksyms/keywords.gperf"
{"__volatile", VOLATILE_KEYW}, {"union", UNION_KEYW},
{""}, {""}, {""}, {""},
#line 50 "scripts/genksyms/keywords.gperf" #line 48 "scripts/genksyms/keywords.gperf"
{"unsigned", UNSIGNED_KEYW}, {"unsigned", UNSIGNED_KEYW},
{""}, #line 49 "scripts/genksyms/keywords.gperf"
#line 44 "scripts/genksyms/keywords.gperf" {"void", VOID_KEYW},
#line 42 "scripts/genksyms/keywords.gperf"
{"short", SHORT_KEYW}, {"short", SHORT_KEYW},
#line 40 "scripts/genksyms/keywords.gperf" {""}, {""},
#line 50 "scripts/genksyms/keywords.gperf"
{"volatile", VOLATILE_KEYW},
{""},
#line 37 "scripts/genksyms/keywords.gperf"
{"float", FLOAT_KEYW},
#line 34 "scripts/genksyms/keywords.gperf"
{"double", DOUBLE_KEYW},
{""},
#line 5 "scripts/genksyms/keywords.gperf"
{"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW},
{""}, {""},
#line 38 "scripts/genksyms/keywords.gperf"
{"inline", INLINE_KEYW}, {"inline", INLINE_KEYW},
#line 6 "scripts/genksyms/keywords.gperf"
{"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW},
#line 41 "scripts/genksyms/keywords.gperf"
{"register", REGISTER_KEYW},
{""}, {""},
#line 52 "scripts/genksyms/keywords.gperf" #line 22 "scripts/genksyms/keywords.gperf"
{"volatile", VOLATILE_KEYW},
#line 42 "scripts/genksyms/keywords.gperf"
{"long", LONG_KEYW},
#line 24 "scripts/genksyms/keywords.gperf"
{"_Bool", BOOL_KEYW}, {"_Bool", BOOL_KEYW},
{""}, {""},
#line 43 "scripts/genksyms/keywords.gperf" #line 43 "scripts/genksyms/keywords.gperf"
{"register", REGISTER_KEYW}, {"signed", SIGNED_KEYW},
#line 51 "scripts/genksyms/keywords.gperf" {""}, {""},
{"void", VOID_KEYW}, #line 40 "scripts/genksyms/keywords.gperf"
#line 39 "scripts/genksyms/keywords.gperf" {"long", LONG_KEYW}
{"float", FLOAT_KEYW},
#line 36 "scripts/genksyms/keywords.gperf"
{"double", DOUBLE_KEYW},
{""}, {""}, {""}, {""},
#line 45 "scripts/genksyms/keywords.gperf"
{"signed", SIGNED_KEYW}
}; };
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
......
...@@ -5,8 +5,6 @@ struct resword { const char *name; int token; } ...@@ -5,8 +5,6 @@ struct resword { const char *name; int token; }
EXPORT_SYMBOL, EXPORT_SYMBOL_KEYW EXPORT_SYMBOL, EXPORT_SYMBOL_KEYW
EXPORT_SYMBOL_GPL, EXPORT_SYMBOL_KEYW EXPORT_SYMBOL_GPL, EXPORT_SYMBOL_KEYW
EXPORT_SYMBOL_GPL_FUTURE, EXPORT_SYMBOL_KEYW EXPORT_SYMBOL_GPL_FUTURE, EXPORT_SYMBOL_KEYW
EXPORT_UNUSED_SYMBOL, EXPORT_SYMBOL_KEYW
EXPORT_UNUSED_SYMBOL_GPL, EXPORT_SYMBOL_KEYW
__asm, ASM_KEYW __asm, ASM_KEYW
__asm__, ASM_KEYW __asm__, ASM_KEYW
__attribute, ATTRIBUTE_KEYW __attribute, ATTRIBUTE_KEYW
......
...@@ -130,9 +130,18 @@ static int read_symbol(FILE *in, struct sym_entry *s) ...@@ -130,9 +130,18 @@ static int read_symbol(FILE *in, struct sym_entry *s)
static int symbol_valid(struct sym_entry *s) static int symbol_valid(struct sym_entry *s)
{ {
/* Symbols which vary between passes. Passes 1 and 2 must have /* Symbols which vary between passes. Passes 1 and 2 must have
* identical symbol lists. * identical symbol lists. The kallsyms_* symbols below are only added
* after pass 1, they would be included in pass 2 when --all-symbols is
* specified so exclude them to get a stable symbol list.
*/ */
static char *special_symbols[] = { static char *special_symbols[] = {
"kallsyms_addresses",
"kallsyms_num_syms",
"kallsyms_names",
"kallsyms_markers",
"kallsyms_token_table",
"kallsyms_token_index",
/* Exclude linker generated symbols which vary between passes */ /* Exclude linker generated symbols which vary between passes */
"_SDA_BASE_", /* ppc */ "_SDA_BASE_", /* ppc */
"_SDA2_BASE_", /* ppc */ "_SDA2_BASE_", /* ppc */
...@@ -164,9 +173,7 @@ static int symbol_valid(struct sym_entry *s) ...@@ -164,9 +173,7 @@ static int symbol_valid(struct sym_entry *s)
} }
/* Exclude symbols which vary between passes. */ /* Exclude symbols which vary between passes. */
if (strstr((char *)s->sym + offset, "_compiled.") || if (strstr((char *)s->sym + offset, "_compiled."))
strncmp((char*)s->sym + offset, "__compound_literal.", 19) == 0 ||
strncmp((char*)s->sym + offset, "__compound_literal$", 19) == 0)
return 0; return 0;
for (i = 0; special_symbols[i]; i++) for (i = 0; special_symbols[i]; i++)
...@@ -543,10 +550,8 @@ int main(int argc, char **argv) ...@@ -543,10 +550,8 @@ int main(int argc, char **argv)
usage(); usage();
read_map(stdin); read_map(stdin);
if (table_cnt) { sort_symbols();
sort_symbols(); optimize_token_table();
optimize_token_table();
}
write_src(); write_src();
return 0; return 0;
......
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
# readprofile starts reading symbols when _stext is found, and # readprofile starts reading symbols when _stext is found, and
# continue until it finds a symbol which is not either of 'T', 't', # continue until it finds a symbol which is not either of 'T', 't',
# 'W' or 'w'. # 'W' or 'w'. __crc_ are 'A' and placed in the middle
# so we just ignore them to let readprofile continue to work.
# (At least sparc64 has __crc_ in the middle).
$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $2
$NM -n $1 | grep -v '\( [aNUw] \)\|\( \$[adt]\)' > $2
<*>
*.h
__compound_literal[$.][0-9]*
__crc_[a-zA-Z_]*
__exitcall_[a-zA-Z_]*
__func__[$.][0-9]*
__FUNCTION__[$.][0-9]*
gcc[0-9]_compiled[$.]
__initcall_[a-zA-Z_]*
__kcrctab_[a-zA-Z_]*
__kstrtab_[a-zA-Z_]*
__ksymtab_[a-zA-Z_]*
__mod_[a-zA-Z_]*[0-9]
__module_depends
__param_[a-zA-Z_]*
__pci_fixup_*PCI_ANY_IDPCI_ANY_ID*
__pci_fixup_*PCI_ANY_IDPCI_DEVICE_ID_*
__pci_fixup_*PCI_VENDOR_ID_*PCI_ANY_ID*
__pci_fixup_*PCI_VENDOR_ID_*PCI_DEVICE_ID_*
__PRETTY_FUNCTION__[$.][0-9]*
__setup_[a-zA-Z_]*
____versions
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment