From 4c058cfbb7853618f2f17fb333f09799ab9d85c7 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 12 Apr 2005 08:42:41 +0000 Subject: * hash.c (DEFAULT_SIZE): Delete. Replace with: (gas_hash_table_size): New static variable. (set_gas_hash_table_size): New function: Records a requested size for the hash tables. (get_gas_hash_table_size): New function: Return a prime number near the requested size of the hash table. (hash_new): Use get_gas_hash_table_size. * hash.h: Add a prototype for set_gas_hash_table_size. * as.c (show_usage): Add description of new switches: --hash-size and --reduce-memory-overheads. (option_values): Add OPTION_HASH_TABLE_SIZE and OPTION_REDUCE_MEMORY_OVERHEADS. (std_longpopts): Add entries for the new options. (parse_args): Handle the new options. * Makefile.am: Add a dependency of as.c on hash.h. * Makefile.in: Regenerate. * doc/as.texinfo: Document the new switches. * NEWS: Mention the new switches. --- gas/as.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'gas/as.c') diff --git a/gas/as.c b/gas/as.c index 919025e378..da05a714c8 100644 --- a/gas/as.c +++ b/gas/as.c @@ -42,6 +42,7 @@ #include "macro.h" #include "dwarf2dbg.h" #include "dw2gencfi.h" +#include "hash.h" #ifdef BFD_ASSEMBLER #include "bfdver.h" @@ -292,6 +293,8 @@ Options:\n\ fprintf (stream, _("\ --gdwarf-2 generate DWARF2 debugging information\n")); fprintf (stream, _("\ + --hash-size= set the hash table size close to \n")); + fprintf (stream, _("\ --help show this message and exit\n")); fprintf (stream, _("\ --target-help show target specific options\n")); @@ -314,6 +317,10 @@ Options:\n\ fprintf (stream, _("\ -R fold data section into text section\n")); fprintf (stream, _("\ + --reduce-memory-overheads \n\ + prefer smaller memory use at the cost of longer\n\ + assembly times\n")); + fprintf (stream, _("\ --statistics print various measured statistics from execution\n")); fprintf (stream, _("\ --strip-local-absolute strip local absolute symbols\n")); @@ -426,6 +433,8 @@ parse_args (int * pargc, char *** pargv) OPTION_EXECSTACK, OPTION_NOEXECSTACK, OPTION_ALTERNATE, + OPTION_HASH_TABLE_SIZE, + OPTION_REDUCE_MEMORY_OVERHEADS, OPTION_WARN_FATAL /* When you add options here, check that they do not collide with OPTION_MD_BASE. See as.h. */ @@ -457,6 +466,7 @@ parse_args (int * pargc, char *** pargv) ,{"gen-debug", no_argument, NULL, 'g'} ,{"gstabs", no_argument, NULL, OPTION_GSTABS} ,{"gstabs+", no_argument, NULL, OPTION_GSTABS_PLUS} + ,{"hash-size", required_argument, NULL, OPTION_HASH_TABLE_SIZE} ,{"help", no_argument, NULL, OPTION_HELP} /* New option for extending instruction set (see also -t above). The "-t file" or "--itbl file" option extends the basic set of @@ -478,6 +488,7 @@ parse_args (int * pargc, char *** pargv) ,{"mri", no_argument, NULL, 'M'} ,{"nocpp", no_argument, NULL, OPTION_NOCPP} ,{"no-warn", no_argument, NULL, 'W'} + ,{"reduce-memory-overheads", no_argument, NULL, OPTION_REDUCE_MEMORY_OVERHEADS} ,{"statistics", no_argument, NULL, OPTION_STATISTICS} ,{"strip-local-absolute", no_argument, NULL, OPTION_STRIP_LOCAL_ABSOLUTE} ,{"version", no_argument, NULL, OPTION_VERSION} @@ -865,6 +876,24 @@ the GNU General Public License. This program has absolutely no warranty.\n")); case 'X': /* -X means treat warnings as errors. */ break; + + case OPTION_REDUCE_MEMORY_OVERHEADS: + /* The only change we make at the moment is to reduce + the size of the hash tables that we use. */ + set_gas_hash_table_size (4051); + break; + + case OPTION_HASH_TABLE_SIZE: + { + bfd_size_type new_size; + + new_size = strtoul (optarg, NULL, 0); + if (new_size) + set_gas_hash_table_size (new_size); + else + as_fatal (_("--hash-size needs a numeric argument")); + break; + } } } -- cgit v1.2.1