genksyms: pass symbol-prefix instead of arch
authorJames Hogan <james.hogan@imgtec.com>
Mon, 18 Mar 2013 09:08:56 +0000 (19:38 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 20 Mar 2013 00:57:27 +0000 (11:27 +1030)
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>
scripts/Makefile.build
scripts/genksyms/genksyms.c

index 0e801c3cdaf8f4173ce5abbf9cee0554374bfbc7..d5d859c8072964014971b9b1401b96f83a183e5d 100644 (file)
@@ -211,7 +211,8 @@ $(obj)/%.i: $(src)/%.c FORCE
 
 cmd_gensymtypes =                                                           \
     $(CPP) -D__GENKSYMS__ $(c_flags) $< |                                   \
-    $(GENKSYMS) $(if $(1), -T $(2)) -a $(ARCH)                              \
+    $(GENKSYMS) $(if $(1), -T $(2))                                         \
+     $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX))             \
      $(if $(KBUILD_PRESERVE),-p)                                            \
      -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
 
index d25e4a118d3783f52d0bfbd3d74c347b7e1d7c08..88632df4381b933a95c91de0e62c5e8648c4f089 100644 (file)
@@ -45,7 +45,6 @@ int in_source_file;
 
 static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types,
           flag_preserve, flag_warnings;
-static const char *arch = "";
 static const char *mod_prefix = "";
 
 static int errors;
@@ -731,7 +730,7 @@ static void genksyms_usage(void)
 {
        fputs("Usage:\n" "genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver\n" "\n"
 #ifdef __GNU_LIBRARY__
-             "  -a, --arch            Select architecture\n"
+             "  -s, --symbol-prefix   Select symbol prefix\n"
              "  -d, --debug           Increment the debug level (repeatable)\n"
              "  -D, --dump            Dump expanded symbol defs (for debugging only)\n"
              "  -r, --reference file  Read reference symbols from a file\n"
@@ -742,7 +741,7 @@ static void genksyms_usage(void)
              "  -h, --help            Print this message\n"
              "  -V, --version         Print the release version\n"
 #else                          /* __GNU_LIBRARY__ */
-             "  -a                    Select architecture\n"
+             "  -s                    Select symbol prefix\n"
              "  -d                    Increment the debug level (repeatable)\n"
              "  -D                    Dump expanded symbol defs (for debugging only)\n"
              "  -r file               Read reference symbols from a file\n"
@@ -763,7 +762,7 @@ int main(int argc, char **argv)
 
 #ifdef __GNU_LIBRARY__
        struct option long_opts[] = {
-               {"arch", 1, 0, 'a'},
+               {"symbol-prefix", 1, 0, 's'},
                {"debug", 0, 0, 'd'},
                {"warnings", 0, 0, 'w'},
                {"quiet", 0, 0, 'q'},
@@ -776,14 +775,14 @@ int main(int argc, char **argv)
                {0, 0, 0, 0}
        };
 
-       while ((o = getopt_long(argc, argv, "a:dwqVDr:T:ph",
+       while ((o = getopt_long(argc, argv, "s:dwqVDr:T:ph",
                                &long_opts[0], NULL)) != EOF)
 #else                          /* __GNU_LIBRARY__ */
-       while ((o = getopt(argc, argv, "a:dwqVDr:T:ph")) != EOF)
+       while ((o = getopt(argc, argv, "s:dwqVDr:T:ph")) != EOF)
 #endif                         /* __GNU_LIBRARY__ */
                switch (o) {
-               case 'a':
-                       arch = optarg;
+               case 's':
+                       mod_prefix = optarg;
                        break;
                case 'd':
                        flag_debug++;
@@ -826,9 +825,6 @@ int main(int argc, char **argv)
                        genksyms_usage();
                        return 1;
                }
-       if ((strcmp(arch, "h8300") == 0) || (strcmp(arch, "blackfin") == 0) ||
-           (strcmp(arch, "metag") == 0))
-               mod_prefix = "_";
        {
                extern int yydebug;
                extern int yy_flex_debug;