that might disagree about consts. */
unsigned long strtoul ();
+static int is_num PARAMS ((const char *, int, int, int));
static void set_default_dirlist PARAMS ((char *dirlist_ptr));
static void set_section_start PARAMS ((char *sect, char *valstr));
static void help PARAMS ((void));
#define OPTION_NO_CHECK_SECTIONS (OPTION_CHECK_SECTIONS + 1)
#define OPTION_MPC860C0 (OPTION_NO_CHECK_SECTIONS + 1)
#define OPTION_NO_UNDEFINED (OPTION_MPC860C0 + 1)
+#define OPTION_INIT (OPTION_NO_UNDEFINED + 1)
+#define OPTION_FINI (OPTION_INIT + 1)
/* The long options. This structure is used for both the option
parsing and the help text. */
'\0', N_("PROGRAM"), N_("Set the dynamic linker to use"), TWO_DASHES },
{ {"embedded-relocs", no_argument, NULL, OPTION_EMBEDDED_RELOCS},
'\0', NULL, N_("Generate embedded relocs"), TWO_DASHES},
+ { {"fini", required_argument, NULL, OPTION_FINI},
+ '\0', N_("SYMBOL"), N_("Call SYMBOL at unload-time"), ONE_DASH },
{ {"force-exe-suffix", no_argument, NULL, OPTION_FORCE_EXE_SUFFIX},
'\0', NULL, N_("Force generation of file with .exe suffix"), TWO_DASHES},
{ {"gc-sections", no_argument, NULL, OPTION_GC_SECTIONS},
TWO_DASHES },
{ {"help", no_argument, NULL, OPTION_HELP},
'\0', NULL, N_("Print option help"), TWO_DASHES },
+ { {"init", required_argument, NULL, OPTION_INIT},
+ '\0', N_("SYMBOL"), N_("Call SYMBOL at load-time"), ONE_DASH },
{ {"Map", required_argument, NULL, OPTION_MAP},
'\0', N_("FILE"), N_("Write a map file"), ONE_DASH },
{ {"no-demangle", no_argument, NULL, OPTION_NO_DEMANGLE },
#define OPTION_COUNT ((int) (sizeof ld_options / sizeof ld_options[0]))
-/* Test "string" for containing a string of digits that form a number
-between "min" and "max". The return value is the number or "err". */
-static
-int is_num( char *string, int min, int max, int err)
+/* Test STRING for containing a string of digits that form a number
+ between MIN and MAX. The return value is the number or ERR. */
+
+static int
+is_num (string, min, max, err)
+ const char *string;
+ int min;
+ int max;
+ int err;
{
int result = 0;
- for ( ; *string; ++string)
- {
- if (!isdigit(*string))
+ for (; *string; ++string)
{
- result = err;
- break;
+ if (! isdigit (*string))
+ {
+ result = err;
+ break;
+ }
+ result = result * 10 + (*string - '0');
}
- result = result * 10 + (*string - '0');
- }
if (result < min || result > max)
result = err;
words = is_num (optarg, 1, 10, 0);
if (words == 0)
{
- fprintf (stderr, _("Invalid argument to option \"mpc860c0\"\n"));
+ fprintf (stderr,
+ _("%s: Invalid argument to option \"mpc860c0\"\n"),
+ program_name);
xexit (1);
}
link_info.mpc860c0 = words * 4; /* convert words to bytes */
}
command_line.relax = true;
break;
+
+ case OPTION_INIT:
+ link_info.init_function = optarg;
+ break;
+
+ case OPTION_FINI:
+ link_info.fini_function = optarg;
+ break;
}
}
}
}
+ /* Note: Various tools (such as libtool) depend upon the
+ format of the listings below - do not change them. */
/* xgettext:c-format */
- printf (_("%s: supported targets:\n "), program_name);
+ printf (_("%s: supported targets:"), program_name);
targets = bfd_target_list ();
for (pp = targets; *pp != NULL; pp++)
printf (" %s", *pp);
printf ("\n");
/* xgettext:c-format */
- printf (_("%s: supported emulations:\n "), program_name);
+ printf (_("%s: supported emulations: "), program_name);
ldemul_list_emulations (stdout);
printf ("\n");