summaryrefslogtreecommitdiff
path: root/ld/lexsup.c
diff options
context:
space:
mode:
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r--ld/lexsup.c67
1 files changed, 36 insertions, 31 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 95a0403915..d3d6e56983 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -172,6 +172,25 @@ enum option_values
/* The long options. This structure is used for both the option
parsing and the help text. */
+enum control_enum {
+ /* Use one dash before long option name. */
+ ONE_DASH,
+ /* Use two dashes before long option name. */
+ TWO_DASHES,
+ /* Only accept two dashes before the long option name.
+ This is an overloading of the use of this enum, since originally it
+ was only intended to tell the --help display function how to display
+ the long option name. This feature was added in order to resolve
+ the confusion about the -omagic command line switch. Is it setting
+ the output file name to "magic" or is it setting the NMAGIC flag on
+ the output ? It has been decided that it is setting the output file
+ name, and that if you want to set the NMAGIC flag you should use -N
+ or --omagic. */
+ EXACTLY_TWO_DASHES,
+ /* Don't mention this option in --help output. */
+ NO_HELP
+};
+
struct ld_option
{
/* The long option information. */
@@ -183,24 +202,7 @@ struct ld_option
/* The documentation string. If this is NULL, this is a synonym for
the previous option. */
const char *doc;
- enum {
- /* Use one dash before long option name. */
- ONE_DASH,
- /* Use two dashes before long option name. */
- TWO_DASHES,
- /* Only accept two dashes before the long option name.
- This is an overloading of the use of this enum, since originally it
- was only intended to tell the --help display function how to display
- the long option name. This feature was added in order to resolve
- the confusion about the -omagic command line switch. Is it setting
- the output file name to "magic" or is it setting the NMAGIC flag on
- the output ? It has been decided that it is setting the output file
- name, and that if you want to set the NMAGIC flag you should use -N
- or --omagic. */
- EXACTLY_TWO_DASHES,
- /* Don't mention this option in --help output. */
- NO_HELP
- } control;
+ enum control_enum control;
};
static const struct ld_option ld_options[] =
@@ -590,9 +592,11 @@ parse_args (unsigned argc, char **argv)
int last_optind;
enum report_method how_to_report_unresolved_symbols = RM_GENERATE_ERROR;
- shortopts = xmalloc (OPTION_COUNT * 3 + 2);
- longopts = xmalloc (sizeof (*longopts) * (OPTION_COUNT + 1));
- really_longopts = xmalloc (sizeof (*really_longopts) * (OPTION_COUNT + 1));
+ shortopts = (char *) xmalloc (OPTION_COUNT * 3 + 2);
+ longopts = (struct option *)
+ xmalloc (sizeof (*longopts) * (OPTION_COUNT + 1));
+ really_longopts = (struct option *)
+ malloc (sizeof (*really_longopts) * (OPTION_COUNT + 1));
/* Starting the short option string with '-' is for programs that
expect options and other ARGV-elements in any order and that care about
@@ -677,7 +681,7 @@ parse_args (unsigned argc, char **argv)
{
char *n;
- n = xmalloc (strlen (argv[i]) + 20);
+ n = (char *) xmalloc (strlen (argv[i]) + 20);
sprintf (n, "--library=%s", argv[i] + 2);
argv[i] = n;
}
@@ -833,7 +837,8 @@ parse_args (unsigned argc, char **argv)
case 'f':
if (command_line.auxiliary_filters == NULL)
{
- command_line.auxiliary_filters = xmalloc (2 * sizeof (char *));
+ command_line.auxiliary_filters = (char **)
+ xmalloc (2 * sizeof (char *));
command_line.auxiliary_filters[0] = optarg;
command_line.auxiliary_filters[1] = NULL;
}
@@ -845,8 +850,8 @@ parse_args (unsigned argc, char **argv)
c = 0;
for (p = command_line.auxiliary_filters; *p != NULL; p++)
++c;
- command_line.auxiliary_filters
- = xrealloc (command_line.auxiliary_filters,
+ command_line.auxiliary_filters = (char **)
+ xrealloc (command_line.auxiliary_filters,
(c + 2) * sizeof (char *));
command_line.auxiliary_filters[c] = optarg;
command_line.auxiliary_filters[c + 1] = NULL;
@@ -1092,7 +1097,7 @@ parse_args (unsigned argc, char **argv)
if (cp == NULL)
{
- buf = xmalloc (rpath_len + optarg_len + 2);
+ buf = (char *) xmalloc (rpath_len + optarg_len + 2);
sprintf (buf, "%s%c%s", command_line.rpath,
config.rpath_separator, optarg);
free (command_line.rpath);
@@ -1107,9 +1112,9 @@ parse_args (unsigned argc, char **argv)
{
char *buf;
- buf = xmalloc (strlen (command_line.rpath_link)
- + strlen (optarg)
- + 2);
+ buf = (char *) xmalloc (strlen (command_line.rpath_link)
+ + strlen (optarg)
+ + 2);
sprintf (buf, "%s%c%s", command_line.rpath_link,
config.rpath_separator, optarg);
free (command_line.rpath_link);
@@ -1224,7 +1229,7 @@ parse_args (unsigned argc, char **argv)
/* We must copy the section name as set_section_start
doesn't do it for us. */
len = optarg2 - optarg;
- sec_name = xmalloc (len);
+ sec_name = (char *) xmalloc (len);
memcpy (sec_name, optarg, len - 1);
sec_name[len - 1] = 0;
@@ -1549,7 +1554,7 @@ set_segment_start (const char *section, char *valstr)
}
/* There was no existing value so we must create a new segment
entry. */
- seg = stat_alloc (sizeof (*seg));
+ seg = (segment_type *) stat_alloc (sizeof (*seg));
seg->name = name;
seg->value = val;
seg->used = FALSE;