Recognize --hash-bucket-empty-fraction.

This commit is contained in:
Ian Lance Taylor 2008-03-07 07:00:48 +00:00
parent fb57e4dc7b
commit c18476e7f1
2 changed files with 32 additions and 1 deletions

View File

@ -171,6 +171,17 @@ parse_uint64(const char* option_name, const char* arg, uint64_t *retval)
option_name, arg);
}
void
parse_double(const char* option_name, const char* arg, double* retval)
{
char* endptr;
*retval = strtod(arg, &endptr);
if (*endptr != '\0')
gold_fatal(_("%s: invalid option value "
"(expected a floating point number): %s"),
option_name, arg);
}
void
parse_string(const char* option_name, const char* arg, const char** retval)
{
@ -661,6 +672,13 @@ General_options::finalize()
&& (this->shared() || this->relocatable()))
gold_fatal(_("binary output format not compatible with -shared or -r"));
if (this->user_set_hash_bucket_empty_fraction()
&& (this->hash_bucket_empty_fraction() < 0.0
|| this->hash_bucket_empty_fraction() >= 1.0))
gold_fatal(_("--hash-bucket-empty-fraction value %g out of range "
"[0.0, 1.0)"),
this->hash_bucket_empty_fraction());
// FIXME: we can/should be doing a lot more sanity checking here.
}

View File

@ -71,7 +71,10 @@ extern void
parse_uint(const char* option_name, const char* arg, int* retval);
extern void
parse_uint64(const char* option_name, const char* arg, uint64_t *retval);
parse_uint64(const char* option_name, const char* arg, uint64_t* retval);
extern void
parse_double(const char* option_name, const char* arg, double* retval);
extern void
parse_string(const char* option_name, const char* arg, const char** retval);
@ -281,6 +284,12 @@ struct Struct_special : public Struct_var
#default_value__, helpstring__, helparg__, \
uint64_t, uint64_t, options::parse_uint64)
#define DEFINE_double(varname__, dashes__, shortname__, default_value__, \
helpstring__, helparg__) \
DEFINE_var(varname__, dashes__, shortname__, default_value__, \
#default_value__, helpstring__, helparg__, \
double, double, options::parse_double)
#define DEFINE_string(varname__, dashes__, shortname__, default_value__, \
helpstring__, helparg__) \
DEFINE_var(varname__, dashes__, shortname__, default_value__, \
@ -466,6 +475,10 @@ class General_options
DEFINE_string(soname, options::ONE_DASH, 'h', NULL,
N_("Set shared library name"), N_("FILENAME"));
DEFINE_double(hash_bucket_empty_fraction, options::TWO_DASHES, '\0', 0.0,
N_("Min fraction of empty buckets in dynamic hash"),
N_("FRACTION"));
DEFINE_enum(hash_style, options::TWO_DASHES, '\0', "sysv",
N_("Dynamic hash style"), N_("[sysv,gnu,both]"),
{"sysv", "gnu", "both"});