diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2001-08-24 13:55:55 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@redhat.com> | 2001-08-24 13:55:55 +0000 |
commit | 8c98ec7dcccbe45bed00b04e04c3d7cac8f7b744 (patch) | |
tree | 6fab1a026bc634bcc426f4296398d77f32957f30 /bfd/bfd.c | |
parent | 17ea634937fc598b248628b5e533323a6a9f4d82 (diff) | |
download | gdb-8c98ec7dcccbe45bed00b04e04c3d7cac8f7b744.zip gdb-8c98ec7dcccbe45bed00b04e04c3d7cac8f7b744.tar.gz gdb-8c98ec7dcccbe45bed00b04e04c3d7cac8f7b744.tar.bz2 |
* bfd.c (bfd_alt_mach_code): New function.
* bfd-in2.h: Rebuilt.
Diffstat (limited to 'bfd/bfd.c')
-rw-r--r-- | bfd/bfd.c | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -1288,3 +1288,58 @@ bfd_fprintf_vma (abfd, stream, value) else fprintf_vma ((FILE *) stream, value); } + +/* +FUNCTION + bfd_alt_mach_code + +SYNOPSIS + boolean bfd_alt_mach_code(bfd *abfd, int index); + +DESCRIPTION + + When more than one machine code number is available for the + same machine type, this function can be used to switch between + the preferred one (index == 0) and any others. Currently, + only ELF supports this feature, with up to two alternate + machine codes. +*/ + +boolean +bfd_alt_mach_code (abfd, index) + bfd *abfd; + int index; +{ + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) + { + int code; + + switch (index) + { + case 0: + code = get_elf_backend_data (abfd)->elf_machine_code; + break; + + case 1: + code = get_elf_backend_data (abfd)->elf_machine_alt1; + if (code == 0) + return false; + break; + + case 2: + code = get_elf_backend_data (abfd)->elf_machine_alt2; + if (code == 0) + return false; + break; + + default: + return false; + } + + elf_elfheader (abfd)->e_machine = code; + + return true; + } + + return false; +} |