Implement --base-file command line switch.
This commit is contained in:
parent
3b108066c9
commit
093505ad61
2 changed files with 68 additions and 0 deletions
|
@ -1,5 +1,8 @@
|
|||
1999-08-23 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* emulparams/elf32mcore.sh (PARSE_AND_LIST_ARGS): Define.
|
||||
Implement --base-file command line switch.
|
||||
|
||||
* emultempl/elf32.em: Add ability for individual targets to have
|
||||
their own command line switches by defining PARSE_AND_LIST_ARGS.
|
||||
|
||||
|
|
|
@ -30,3 +30,68 @@ OTHER_RELOCATING_SECTIONS='.stack 0x80000 : { _stack = .; *(.stack) }'
|
|||
|
||||
TEMPLATE_NAME=elf32
|
||||
GENERATE_SHLIB_SCRIPT=yes
|
||||
|
||||
# This code gets inserted into the generic elf32.sc linker script
|
||||
# and allows us to define our own command line switches.
|
||||
PARSE_AND_LIST_ARGS='
|
||||
|
||||
#define OPTION_BASE_FILE 300
|
||||
|
||||
static struct option longopts[] =
|
||||
{
|
||||
{"base-file", required_argument, NULL, OPTION_BASE_FILE},
|
||||
{NULL, no_argument, NULL, 0}
|
||||
};
|
||||
|
||||
static void
|
||||
gld_elf32mcore_list_options (file)
|
||||
FILE * file;
|
||||
{
|
||||
fprintf (file, _(" --base_file <basefile> Generate a base file for relocatable DLLs\n"));
|
||||
}
|
||||
|
||||
static int
|
||||
gld_elf32mcore_parse_args (argc, argv)
|
||||
int argc;
|
||||
char ** argv;
|
||||
{
|
||||
int longind;
|
||||
int optc;
|
||||
int prevoptind = optind;
|
||||
int prevopterr = opterr;
|
||||
int wanterror;
|
||||
static int lastoptind = -1;
|
||||
|
||||
if (lastoptind != optind)
|
||||
opterr = 0;
|
||||
|
||||
wanterror = opterr;
|
||||
lastoptind = optind;
|
||||
|
||||
optc = getopt_long_only (argc, argv, "-", longopts, & longind);
|
||||
opterr = prevopterr;
|
||||
|
||||
switch (optc)
|
||||
{
|
||||
default:
|
||||
if (wanterror)
|
||||
xexit (1);
|
||||
optind = prevoptind;
|
||||
return 0;
|
||||
|
||||
case OPTION_BASE_FILE:
|
||||
link_info.base_file = (PTR) fopen (optarg, FOPEN_WB);
|
||||
if (link_info.base_file == NULL)
|
||||
{
|
||||
/* xgettext:c-format */
|
||||
fprintf (stderr, _("%s: Cannot open base file %s\n"),
|
||||
program_name, optarg);
|
||||
xexit (1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
'
|
||||
|
|
Loading…
Reference in a new issue