Commit d70f82acf32affa78ae4957caa0fb2a550d2c6ea

Authored by James Hogan
Committed by Rusty Russell
1 parent a4b6a77b77

genksyms: pass symbol-prefix instead of arch

Pass symbol-prefix to genksyms instead of arch, so that the decision
what symbol prefix to use is kept in one place.

Basically genksyms used to take a -a $ARCH argument and it used that to
determine whether to add an underscore symbol prefix. It's now changed
to take a -s $SYMBOL_PREFIX argument so that the caller decides whether
a symbol prefix is required. The build system then uses
CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX to determine whether to pass the
argument.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Showing 2 changed files with 9 additions and 12 deletions Side-by-side Diff

scripts/Makefile.build
... ... @@ -211,7 +211,8 @@
211 211  
212 212 cmd_gensymtypes = \
213 213 $(CPP) -D__GENKSYMS__ $(c_flags) $< | \
214   - $(GENKSYMS) $(if $(1), -T $(2)) -a $(ARCH) \
  214 + $(GENKSYMS) $(if $(1), -T $(2)) \
  215 + $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX)) \
215 216 $(if $(KBUILD_PRESERVE),-p) \
216 217 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
217 218  
scripts/genksyms/genksyms.c
... ... @@ -45,7 +45,6 @@
45 45  
46 46 static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types,
47 47 flag_preserve, flag_warnings;
48   -static const char *arch = "";
49 48 static const char *mod_prefix = "";
50 49  
51 50 static int errors;
... ... @@ -731,7 +730,7 @@
731 730 {
732 731 fputs("Usage:\n" "genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver\n" "\n"
733 732 #ifdef __GNU_LIBRARY__
734   - " -a, --arch Select architecture\n"
  733 + " -s, --symbol-prefix Select symbol prefix\n"
735 734 " -d, --debug Increment the debug level (repeatable)\n"
736 735 " -D, --dump Dump expanded symbol defs (for debugging only)\n"
737 736 " -r, --reference file Read reference symbols from a file\n"
... ... @@ -742,7 +741,7 @@
742 741 " -h, --help Print this message\n"
743 742 " -V, --version Print the release version\n"
744 743 #else /* __GNU_LIBRARY__ */
745   - " -a Select architecture\n"
  744 + " -s Select symbol prefix\n"
746 745 " -d Increment the debug level (repeatable)\n"
747 746 " -D Dump expanded symbol defs (for debugging only)\n"
748 747 " -r file Read reference symbols from a file\n"
... ... @@ -763,7 +762,7 @@
763 762  
764 763 #ifdef __GNU_LIBRARY__
765 764 struct option long_opts[] = {
766   - {"arch", 1, 0, 'a'},
  765 + {"symbol-prefix", 1, 0, 's'},
767 766 {"debug", 0, 0, 'd'},
768 767 {"warnings", 0, 0, 'w'},
769 768 {"quiet", 0, 0, 'q'},
770 769  
771 770  
... ... @@ -776,14 +775,14 @@
776 775 {0, 0, 0, 0}
777 776 };
778 777  
779   - while ((o = getopt_long(argc, argv, "a:dwqVDr:T:ph",
  778 + while ((o = getopt_long(argc, argv, "s:dwqVDr:T:ph",
780 779 &long_opts[0], NULL)) != EOF)
781 780 #else /* __GNU_LIBRARY__ */
782   - while ((o = getopt(argc, argv, "a:dwqVDr:T:ph")) != EOF)
  781 + while ((o = getopt(argc, argv, "s:dwqVDr:T:ph")) != EOF)
783 782 #endif /* __GNU_LIBRARY__ */
784 783 switch (o) {
785   - case 'a':
786   - arch = optarg;
  784 + case 's':
  785 + mod_prefix = optarg;
787 786 break;
788 787 case 'd':
789 788 flag_debug++;
... ... @@ -826,9 +825,6 @@
826 825 genksyms_usage();
827 826 return 1;
828 827 }
829   - if ((strcmp(arch, "h8300") == 0) || (strcmp(arch, "blackfin") == 0) ||
830   - (strcmp(arch, "metag") == 0))
831   - mod_prefix = "_";
832 828 {
833 829 extern int yydebug;
834 830 extern int yy_flex_debug;