diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2001-08-24 13:56:11 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@redhat.com> | 2001-08-24 13:56:11 +0000 |
commit | 1ae8b3d2a04d1064a403ce6adf997831e1a55300 (patch) | |
tree | ed4a8b91313b19370fe89dc88dde648e29abe49e /binutils/objcopy.c | |
parent | 8c98ec7dcccbe45bed00b04e04c3d7cac8f7b744 (diff) | |
download | gdb-1ae8b3d2a04d1064a403ce6adf997831e1a55300.zip gdb-1ae8b3d2a04d1064a403ce6adf997831e1a55300.tar.gz gdb-1ae8b3d2a04d1064a403ce6adf997831e1a55300.tar.bz2 |
* objcopy.c (use_alt_mach_code): New variable.
(OPTION_ALT_MACH_CODE): Define.
(copy_options): Added --alt-machine-code.
(copy_main): Handle it.
(copy_object): Switch to alternate machine code if requested.
* doc/binutils.texi: Document new option.
* NEWS: Likewise.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r-- | binutils/objcopy.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 9496ce5..160f28b 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -171,6 +171,9 @@ static bfd_byte gap_fill = 0; static boolean pad_to_set = false; static bfd_vma pad_to; +/* Use alternate machine code? */ +static int use_alt_mach_code = 0; + /* List of sections to add. */ struct section_add { @@ -240,6 +243,7 @@ static boolean weaken = false; #define OPTION_KEEPGLOBAL_SYMBOLS (OPTION_LOCALIZE_SYMBOLS + 1) #define OPTION_WEAKEN_SYMBOLS (OPTION_KEEPGLOBAL_SYMBOLS + 1) #define OPTION_RENAME_SECTION (OPTION_WEAKEN_SYMBOLS + 1) +#define OPTION_ALT_MACH_CODE (OPTION_RENAME_SECTION + 1) /* Options to handle if running as "strip". */ @@ -326,6 +330,7 @@ static struct option copy_options[] = {"keep-global-symbols", required_argument, 0, OPTION_KEEPGLOBAL_SYMBOLS}, {"localize-symbols", required_argument, 0, OPTION_LOCALIZE_SYMBOLS}, {"weaken-symbols", required_argument, 0, OPTION_WEAKEN_SYMBOLS}, + {"alt-machine-code", required_argument, 0, OPTION_ALT_MACH_CODE}, {0, no_argument, 0, 0} }; @@ -408,6 +413,7 @@ copy_usage (stream, exit_status) --localize-symbols <file> -L for all symbols listed in <file>\n\ --keep-global-symbols <file> -G for all symbols listed in <file>\n\ --weaken-symbols <file> -W for all symbols listed in <file>\n\ + --alt-machine-code <index> Use alternate machine code for output\n\ -v --verbose List all object files modified\n\ -V --version Display this program's version number\n\ -h --help Display this output\n\ @@ -1244,6 +1250,15 @@ copy_object (ibfd, obfd) status = 1; return; } + + /* Switch to the alternate machine code. We have to do this at the + very end, because we only initialize the header when we create + the first section. */ + if (use_alt_mach_code != 0) + { + if (!bfd_alt_mach_code (obfd, use_alt_mach_code)) + non_fatal (_("unknown alternate machine code, ignored")); + } } /* Read each archive element in turn from IBFD, copy the @@ -2462,6 +2477,12 @@ copy_main (argc, argv) add_specific_symbols (optarg, &weaken_specific_list); break; + case OPTION_ALT_MACH_CODE: + use_alt_mach_code = atoi (optarg); + if (use_alt_mach_code <= 0) + fatal (_("alternate machine code index must be positive")); + break; + case 0: break; /* we've been given a long option */ |