diff options
author | Nick Clifton <nickc@redhat.com> | 1999-08-23 09:13:56 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 1999-08-23 09:13:56 +0000 |
commit | 093505ad6138b9e165876765ecd667c90fc921ae (patch) | |
tree | 1195c88c7950bbd5f4ccd4c18d4aa9ddd04d8c77 /ld | |
parent | 3b108066c923292f1cb23589a897f663dd48884e (diff) | |
download | gdb-093505ad6138b9e165876765ecd667c90fc921ae.zip gdb-093505ad6138b9e165876765ecd667c90fc921ae.tar.gz gdb-093505ad6138b9e165876765ecd667c90fc921ae.tar.bz2 |
Implement --base-file command line switch.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 3 | ||||
-rw-r--r-- | ld/emulparams/elf32mcore.sh | 65 |
2 files changed, 68 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 7eb00ef..e26eb46 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -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. diff --git a/ld/emulparams/elf32mcore.sh b/ld/emulparams/elf32mcore.sh index bd1fdae..f3a67ca 100644 --- a/ld/emulparams/elf32mcore.sh +++ b/ld/emulparams/elf32mcore.sh @@ -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; +} + +' |