diff options
Diffstat (limited to 'contrib')
140 files changed, 0 insertions, 83285 deletions
diff --git a/contrib/binutils/bfd/VERSION b/contrib/binutils/bfd/VERSION deleted file mode 100644 index dbe590065479..000000000000 --- a/contrib/binutils/bfd/VERSION +++ /dev/null @@ -1 +0,0 @@ -2.8.1 diff --git a/contrib/binutils/bfd/acconfig.h b/contrib/binutils/bfd/acconfig.h deleted file mode 100644 index 1d5e819ec24e..000000000000 --- a/contrib/binutils/bfd/acconfig.h +++ /dev/null @@ -1,34 +0,0 @@ - -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION - -/* Whether strstr must be declared even if <string.h> is included. */ -#undef NEED_DECLARATION_STRSTR - -/* Whether malloc must be declared even if <stdlib.h> is included. */ -#undef NEED_DECLARATION_MALLOC - -/* Whether realloc must be declared even if <stdlib.h> is included. */ -#undef NEED_DECLARATION_REALLOC - -/* Whether free must be declared even if <stdlib.h> is included. */ -#undef NEED_DECLARATION_FREE - -/* Whether getenv must be declared even if <stdlib.h> is included. */ -#undef NEED_DECLARATION_GETENV -@TOP@ - -/* Do we need to use the b modifier when opening binary files? */ -#undef USE_BINARY_FOPEN - -/* Name of host specific header file to include in trad-core.c. */ -#undef TRAD_HEADER - -/* Define only if <sys/procfs.h> is available *and* it defines prstatus_t. */ -#undef HAVE_SYS_PROCFS_H - -/* Do we really want to use mmap if it's available? */ -#undef USE_MMAP diff --git a/contrib/binutils/bfd/aout-tic30.c b/contrib/binutils/bfd/aout-tic30.c deleted file mode 100644 index a3e977d7600b..000000000000 --- a/contrib/binutils/bfd/aout-tic30.c +++ /dev/null @@ -1,1064 +0,0 @@ -/* BFD back-end for TMS320C30 a.out binaries. - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. - Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) - - This file is part of BFD, the Binary File Descriptor library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#define TARGET_IS_BIG_ENDIAN_P -#define N_HEADER_IN_TEXT(x) 1 -#define BYTES_IN_WORD 4 -#define TEXT_START_ADDR 1024 -#define TARGET_PAGE_SIZE 128 -#define SEGMENT_SIZE TARGET_PAGE_SIZE -#define DEFAULT_ARCH bfd_arch_tic30 -#define ARCH_SIZE 32 - -#define MY(OP) CAT(tic30_aout_,OP) -#define TARGETNAME "a.out-tic30" -#define NAME(x,y) CAT3(tic30_aout,_32_,y) - -#include "bfd.h" -#include "sysdep.h" -#include "libaout.h" - -#include "aout/aout64.h" -#include "aout/stab_gnu.h" -#include "aout/ar.h" - -static bfd_reloc_status_type tic30_aout_fix_16 - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type tic30_aout_fix_32 - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type tic30_aout_fix_pcrel_16 - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static reloc_howto_type *tic30_aout_reloc_howto - PARAMS ((bfd *, struct reloc_std_external *, int *, int *, int *)); -static bfd_reloc_status_type tic30_aout_relocate_contents - PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *)); -static bfd_reloc_status_type tic30_aout_final_link_relocate - PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, bfd_vma, - bfd_vma, bfd_vma)); -static const bfd_target *tic30_aout_object_p PARAMS ((bfd *)); -static boolean tic30_aout_write_object_contents PARAMS ((bfd *)); -static boolean tic30_aout_set_sizes PARAMS ((bfd *)); - -#define MY_reloc_howto(BFD,REL,IN,EX,PC) tic30_aout_reloc_howto(BFD,REL,&IN,&EX,&PC) -#define MY_final_link_relocate tic30_aout_final_link_relocate -#define MY_object_p tic30_aout_object_p -#define MY_mkobject NAME(aout,mkobject) -#define MY_write_object_contents tic30_aout_write_object_contents -#define MY_set_sizes tic30_aout_set_sizes - -#ifndef MY_exec_hdr_flags -#define MY_exec_hdr_flags 1 -#endif - -#ifndef MY_backend_data - -#ifndef MY_zmagic_contiguous -#define MY_zmagic_contiguous 0 -#endif -#ifndef MY_text_includes_header -#define MY_text_includes_header 0 -#endif -#ifndef MY_entry_is_text_address -#define MY_entry_is_text_address 0 -#endif -#ifndef MY_exec_header_not_counted -#define MY_exec_header_not_counted 1 -#endif -#ifndef MY_add_dynamic_symbols -#define MY_add_dynamic_symbols 0 -#endif -#ifndef MY_add_one_symbol -#define MY_add_one_symbol 0 -#endif -#ifndef MY_link_dynamic_object -#define MY_link_dynamic_object 0 -#endif -#ifndef MY_write_dynamic_symbol -#define MY_write_dynamic_symbol 0 -#endif -#ifndef MY_check_dynamic_reloc -#define MY_check_dynamic_reloc 0 -#endif -#ifndef MY_finish_dynamic_link -#define MY_finish_dynamic_link 0 -#endif - -static CONST struct aout_backend_data tic30_aout_backend_data = -{ - MY_zmagic_contiguous, - MY_text_includes_header, - MY_entry_is_text_address, - MY_exec_hdr_flags, - 0, /* text vma? */ - MY_set_sizes, - MY_exec_header_not_counted, - MY_add_dynamic_symbols, - MY_add_one_symbol, - MY_link_dynamic_object, - MY_write_dynamic_symbol, - MY_check_dynamic_reloc, - MY_finish_dynamic_link -}; -#define MY_backend_data &tic30_aout_backend_data -#endif - -/* FIXME: This is wrong. aoutx.h should really only be included by - aout32.c. */ - -#include "aoutx.h" - -/* This table lists the relocation types for the TMS320C30. There are - only a few relocations required, and all must be divided by 4 (>> - 2) to get the 32-bit addresses in the format the TMS320C30 likes - it. */ -reloc_howto_type tic30_aout_howto_table[] = -{ - EMPTY_HOWTO (-1), - HOWTO (1, 2, 1, 16, false, 0, 0, tic30_aout_fix_16, - "16", false, 0x0000FFFF, 0x0000FFFF, false), - HOWTO (2, 2, 2, 24, false, 0, complain_overflow_bitfield, NULL, - "24", false, 0x00FFFFFF, 0x00FFFFFF, false), - HOWTO (3, 18, 3, 24, false, 0, complain_overflow_bitfield, NULL, - "LDP", false, 0x00FF0000, 0x000000FF, false), - HOWTO (4, 2, 4, 32, false, 0, complain_overflow_bitfield, tic30_aout_fix_32, - "32", false, 0xFFFFFFFF, 0xFFFFFFFF, false), - HOWTO (5, 2, 1, 16, true, 0, complain_overflow_signed, - tic30_aout_fix_pcrel_16, "PCREL", true, 0x0000FFFF, 0x0000FFFF, true), - EMPTY_HOWTO (-1), - EMPTY_HOWTO (-1), - EMPTY_HOWTO (-1), - EMPTY_HOWTO (-1), - EMPTY_HOWTO (-1) -}; - -extern reloc_howto_type *NAME (aout, reloc_type_lookup) (); - -reloc_howto_type * -tic30_aout_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; -{ - switch (code) - { - case BFD_RELOC_8: - case BFD_RELOC_TIC30_LDP: - return &tic30_aout_howto_table[3]; - case BFD_RELOC_16: - return &tic30_aout_howto_table[1]; - case BFD_RELOC_24: - return &tic30_aout_howto_table[2]; - case BFD_RELOC_16_PCREL: - return &tic30_aout_howto_table[5]; - case BFD_RELOC_32: - return &tic30_aout_howto_table[4]; - default: - return (reloc_howto_type *) NULL; - } -} - -static reloc_howto_type * -tic30_aout_reloc_howto (abfd, relocs, r_index, r_extern, r_pcrel) - bfd *abfd; - struct reloc_std_external *relocs; - int *r_index; - int *r_extern; - int *r_pcrel; -{ - unsigned int r_length; - unsigned int r_pcrel_done; - int index; - - *r_pcrel = 0; - if (bfd_header_big_endian (abfd)) - { - *r_index = ((relocs->r_index[0] << 16) | (relocs->r_index[1] << 8) | relocs->r_index[2]); - *r_extern = (0 != (relocs->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); - r_pcrel_done = (0 != (relocs->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); - r_length = ((relocs->r_type[0] & RELOC_STD_BITS_LENGTH_BIG) >> RELOC_STD_BITS_LENGTH_SH_BIG); - } - else - { - *r_index = ((relocs->r_index[2] << 16) | (relocs->r_index[1] << 8) | relocs->r_index[0]); - *r_extern = (0 != (relocs->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); - r_pcrel_done = (0 != (relocs->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); - r_length = ((relocs->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) >> RELOC_STD_BITS_LENGTH_SH_LITTLE); - } - index = r_length + 4 * r_pcrel_done; - return tic30_aout_howto_table + index; -} - -/* This function is used as a callback for 16-bit relocs. This is - required for relocations between segments. A line in aoutx.h - requires that any relocations for the data section should point to - the end of the aligned text section, plus an offset. By default, - this does not happen, therefore this function takes care of - that. */ - -static bfd_reloc_status_type -tic30_aout_fix_16 (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section ATTRIBUTE_UNUSED; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - bfd_vma relocation; - - /* Make sure that the symbol's section is defined. */ - if (symbol->section == &bfd_und_section && (symbol->flags & BSF_WEAK) == 0) - return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined; - /* Get the size of the input section and turn it into the TMS320C30 - 32-bit address format. */ - relocation = (symbol->section->vma >> 2); - relocation += bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, relocation, (bfd_byte *) data + reloc_entry->address); - return bfd_reloc_ok; -} - -/* This function does the same thing as tic30_aout_fix_16 except for 32 - bit relocations. */ - -static bfd_reloc_status_type -tic30_aout_fix_32 (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section ATTRIBUTE_UNUSED; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - bfd_vma relocation; - - /* Make sure that the symbol's section is defined. */ - if (symbol->section == &bfd_und_section && (symbol->flags & BSF_WEAK) == 0) - return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined; - /* Get the size of the input section and turn it into the TMS320C30 - 32-bit address format. */ - relocation = (symbol->section->vma >> 2); - relocation += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - bfd_put_32 (abfd, relocation, (bfd_byte *) data + reloc_entry->address); - return bfd_reloc_ok; -} - -/* This function is used to work out pc-relative offsets for the - TMS320C30. The data already placed by md_pcrel_from within gas is - useless for a relocation, so we just get the offset value and place - a version of this within the object code. - tic30_aout_final_link_relocate will then calculate the required - relocation to add on to the value in the object code. */ - -static bfd_reloc_status_type -tic30_aout_fix_pcrel_16 (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol ATTRIBUTE_UNUSED; - PTR data; - asection *input_section ATTRIBUTE_UNUSED; - bfd *output_bfd ATTRIBUTE_UNUSED; - char **error_message ATTRIBUTE_UNUSED; -{ - bfd_vma relocation = 1; - bfd_byte offset_data = bfd_get_8 (abfd, (bfd_byte *) data + reloc_entry->address - 1); - - /* The byte before the location of the fix contains bits 23-16 of - the pcrel instruction. Bit 21 is set for a delayed instruction - which requires on offset of 3 instead of 1. */ - if (offset_data & 0x20) - relocation -= 3; - else - relocation -= 1; - bfd_put_16 (abfd, relocation, (bfd_byte *) data + reloc_entry->address); - return bfd_reloc_ok; -} - -/* These macros will get 24-bit values from the bfd definition. - Big-endian only. */ -#define bfd_getb_24(BFD,ADDR) \ - (bfd_get_8 (BFD, ADDR ) << 16) | \ - (bfd_get_8 (BFD, ADDR + 1) << 8) | \ - (bfd_get_8 (BFD, ADDR + 2) ) - -#define bfd_putb_24(BFD,DATA,ADDR) \ - bfd_put_8 (BFD, (bfd_byte) ((DATA >> 16) & 0xFF), ADDR ); \ - bfd_put_8 (BFD, (bfd_byte) ((DATA >> 8) & 0xFF), ADDR + 1); \ - bfd_put_8 (BFD, (bfd_byte) ( DATA & 0xFF), ADDR + 2) - -/* Set parameters about this a.out file that are machine-dependent. - This routine is called from some_aout_object_p just before it returns. */ - -static const bfd_target * -tic30_aout_callback (abfd) - bfd *abfd; -{ - struct internal_exec *execp = exec_hdr (abfd); - unsigned int arch_align_power; - unsigned long arch_align; - - /* Calculate the file positions of the parts of a newly read aout header */ - obj_textsec (abfd)->_raw_size = N_TXTSIZE (*execp); - - /* The virtual memory addresses of the sections */ - obj_textsec (abfd)->vma = N_TXTADDR (*execp); - obj_datasec (abfd)->vma = N_DATADDR (*execp); - obj_bsssec (abfd)->vma = N_BSSADDR (*execp); - - obj_textsec (abfd)->lma = obj_textsec (abfd)->vma; - obj_datasec (abfd)->lma = obj_datasec (abfd)->vma; - obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; - - /* The file offsets of the sections */ - obj_textsec (abfd)->filepos = N_TXTOFF (*execp); - obj_datasec (abfd)->filepos = N_DATOFF (*execp); - - /* The file offsets of the relocation info */ - obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); - obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); - - /* The file offsets of the string table and symbol table. */ - obj_sym_filepos (abfd) = N_SYMOFF (*execp); - obj_str_filepos (abfd) = N_STROFF (*execp); - - /* Determine the architecture and machine type of the object file. */ -#ifdef SET_ARCH_MACH - SET_ARCH_MACH (abfd, *execp); -#else - bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0); -#endif - - /* Now that we know the architecture, set the alignments of the - sections. This is normally done by NAME(aout,new_section_hook), - but when the initial sections were created the architecture had - not yet been set. However, for backward compatibility, we don't - set the alignment power any higher than as required by the size - of the section. */ - arch_align_power = bfd_get_arch_info (abfd)->section_align_power; - arch_align = 1 << arch_align_power; - if ((BFD_ALIGN (obj_textsec (abfd)->_raw_size, arch_align) - == obj_textsec (abfd)->_raw_size) - && (BFD_ALIGN (obj_datasec (abfd)->_raw_size, arch_align) - == obj_datasec (abfd)->_raw_size) - && (BFD_ALIGN (obj_bsssec (abfd)->_raw_size, arch_align) - == obj_bsssec (abfd)->_raw_size)) - { - obj_textsec (abfd)->alignment_power = arch_align_power; - obj_datasec (abfd)->alignment_power = arch_align_power; - obj_bsssec (abfd)->alignment_power = arch_align_power; - } - return abfd->xvec; -} - -static bfd_reloc_status_type -tic30_aout_final_link_relocate (howto, input_bfd, input_section, contents, - address, value, addend) - reloc_howto_type *howto; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - bfd_vma address; - bfd_vma value; - bfd_vma addend; -{ - bfd_vma relocation; - - if (address > input_section->_raw_size) - return bfd_reloc_outofrange; - - relocation = value + addend; - if (howto->pc_relative) - { - relocation -= (input_section->output_section->vma + input_section->output_offset); - if (howto->pcrel_offset) - relocation -= address; - } - return tic30_aout_relocate_contents (howto, input_bfd, relocation, - contents + address); -} - -bfd_reloc_status_type -tic30_aout_relocate_contents (howto, input_bfd, relocation, location) - reloc_howto_type *howto; - bfd *input_bfd; - bfd_vma relocation; - bfd_byte *location; -{ - bfd_vma x; - boolean overflow; - - if (howto->size < 0) - relocation = -relocation; - - switch (howto->size) - { - default: - case 0: - abort (); - break; - case 1: - x = bfd_get_16 (input_bfd, location); - break; - case 2: - x = bfd_getb_24 (input_bfd, location); - break; - case 3: - x = bfd_get_8 (input_bfd, location); - break; - case 4: - x = bfd_get_32 (input_bfd, location); - break; - } - overflow = false; - if (howto->complain_on_overflow != complain_overflow_dont) - { - bfd_vma check; - bfd_signed_vma signed_check; - bfd_vma add; - bfd_signed_vma signed_add; - - if (howto->rightshift == 0) - { - check = relocation; - signed_check = (bfd_signed_vma) relocation; - } - else - { - check = relocation >> howto->rightshift; - if ((bfd_signed_vma) relocation >= 0) - signed_check = check; - else - signed_check = (check | ((bfd_vma) - 1 & ~((bfd_vma) - 1 >> howto->rightshift))); - } - add = x & howto->src_mask; - signed_add = add; - if ((add & (((~howto->src_mask) >> 1) & howto->src_mask)) != 0) - signed_add -= (((~howto->src_mask) >> 1) & howto->src_mask) << 1; - if (howto->bitpos == 0) - { - check += add; - signed_check += signed_add; - } - else - { - check += add >> howto->bitpos; - if (signed_add >= 0) - signed_check += add >> howto->bitpos; - else - signed_check += ((add >> howto->bitpos) | ((bfd_vma) - 1 & ~((bfd_vma) - 1 >> howto->bitpos))); - } - switch (howto->complain_on_overflow) - { - case complain_overflow_signed: - { - bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1; - bfd_signed_vma reloc_signed_min = ~reloc_signed_max; - if (signed_check > reloc_signed_max || signed_check < reloc_signed_min) - overflow = true; - } - break; - case complain_overflow_unsigned: - { - bfd_vma reloc_unsigned_max = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; - if (check > reloc_unsigned_max) - overflow = true; - } - break; - case complain_overflow_bitfield: - { - bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; - if ((check & ~reloc_bits) != 0 && (((bfd_vma) signed_check & ~reloc_bits) != (-1 & ~reloc_bits))) - overflow = true; - } - break; - default: - abort (); - } - } - relocation >>= (bfd_vma) howto->rightshift; - relocation <<= (bfd_vma) howto->bitpos; - x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask)); - switch (howto->size) - { - default: - case 0: - abort (); - break; - case 1: - bfd_put_16 (input_bfd, x, location); - break; - case 2: - bfd_putb_24 (input_bfd, x, location); - break; - case 3: - bfd_put_8 (input_bfd, x, location); - break; - case 4: - bfd_put_32 (input_bfd, x, location); - break; - } - return overflow ? bfd_reloc_overflow : bfd_reloc_ok; -} - -/* Finish up the reading of an a.out file header */ - -static const bfd_target * -tic30_aout_object_p (abfd) - bfd *abfd; -{ - struct external_exec exec_bytes; /* Raw exec header from file */ - struct internal_exec exec; /* Cleaned-up exec header */ - const bfd_target *target; - - if (bfd_read ((PTR) & exec_bytes, 1, EXEC_BYTES_SIZE, abfd) - != EXEC_BYTES_SIZE) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return 0; - } - -#ifdef SWAP_MAGIC - exec.a_info = SWAP_MAGIC (exec_bytes.e_info); -#else - exec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info); -#endif /* SWAP_MAGIC */ - - if (N_BADMAG (exec)) - return 0; -#ifdef MACHTYPE_OK - if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) - return 0; -#endif - - NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec); - -#ifdef SWAP_MAGIC - /* swap_exec_header_in read in a_info with the wrong byte order */ - exec.a_info = SWAP_MAGIC (exec_bytes.e_info); -#endif /* SWAP_MAGIC */ - - target = NAME (aout, some_aout_object_p) (abfd, &exec, tic30_aout_callback); - -#ifdef ENTRY_CAN_BE_ZERO - /* The NEWSOS3 entry-point is/was 0, which (amongst other lossage) - * means that it isn't obvious if EXEC_P should be set. - * All of the following must be true for an executable: - * There must be no relocations, the bfd can be neither an - * archive nor an archive element, and the file must be executable. */ - - if (exec.a_trsize + exec.a_drsize == 0 - && bfd_get_format (abfd) == bfd_object && abfd->my_archive == NULL) - { - struct stat buf; -#ifndef S_IXUSR -#define S_IXUSR 0100 /* Execute by owner. */ -#endif - if (stat (abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR)) - abfd->flags |= EXEC_P; - } -#endif /* ENTRY_CAN_BE_ZERO */ - - return target; -} - -/* Copy private section data. This actually does nothing with the - sections. It copies the subformat field. We copy it here, because - we need to know whether this is a QMAGIC file before we set the - section contents, and copy_private_bfd_data is not called until - after the section contents have been set. */ - -static boolean -MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec) - bfd *ibfd; - asection *isec ATTRIBUTE_UNUSED; - bfd *obfd; - asection *osec ATTRIBUTE_UNUSED; -{ - if (bfd_get_flavour (obfd) == bfd_target_aout_flavour) - obj_aout_subformat (obfd) = obj_aout_subformat (ibfd); - return true; -} - -/* Write an object file. - Section contents have already been written. We write the - file header, symbols, and relocation. */ - -static boolean -tic30_aout_write_object_contents (abfd) - bfd *abfd; -{ - struct external_exec exec_bytes; - struct internal_exec *execp = exec_hdr (abfd); - - obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; - - { - bfd_size_type text_size; /* dummy vars */ - file_ptr text_end; - if (adata (abfd).magic == undecided_magic) - NAME (aout, adjust_sizes_and_vmas) (abfd, &text_size, &text_end); - - execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; - execp->a_entry = bfd_get_start_address (abfd); - - execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * obj_reloc_entry_size (abfd)); - execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * obj_reloc_entry_size (abfd)); - NAME (aout, swap_exec_header_out) (abfd, execp, &exec_bytes); - - if (adata (abfd).exec_bytes_size > 0) - { - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) - return false; - if (bfd_write ((PTR) & exec_bytes, 1, adata (abfd).exec_bytes_size, abfd) != adata (abfd).exec_bytes_size) - return false; - } - /* Now write out reloc info, followed by syms and strings */ - - if (bfd_get_outsymbols (abfd) != (asymbol **) NULL - && bfd_get_symcount (abfd) != 0) - { - if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (*execp)), SEEK_SET) != 0) - return false; - - if (!NAME (aout, write_syms) (abfd)) - return false; - } - - if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*execp)), SEEK_SET) != 0) - return false; - if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) - return false; - - if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp)), SEEK_SET) != 0) - return false; - if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) - return false; - } - - return true; -} - -static boolean -tic30_aout_set_sizes (abfd) - bfd *abfd; -{ - adata (abfd).page_size = TARGET_PAGE_SIZE; - -#ifdef SEGMENT_SIZE - adata (abfd).segment_size = SEGMENT_SIZE; -#else - adata (abfd).segment_size = TARGET_PAGE_SIZE; -#endif - -#ifdef ZMAGIC_DISK_BLOCK_SIZE - adata (abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE; -#else - adata (abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE; -#endif - - adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE; - - return true; -} - -#ifndef MY_final_link_callback - -/* Callback for the final_link routine to set the section offsets. */ - -static void MY_final_link_callback - PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *)); - -static void -MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff) - bfd *abfd; - file_ptr *ptreloff; - file_ptr *pdreloff; - file_ptr *psymoff; -{ - struct internal_exec *execp = exec_hdr (abfd); - - *ptreloff = obj_datasec (abfd)->filepos + execp->a_data; - *pdreloff = *ptreloff + execp->a_trsize; - *psymoff = *pdreloff + execp->a_drsize;; -} - -#endif - -#ifndef MY_bfd_final_link - -/* Final link routine. We need to use a call back to get the correct - offsets in the output file. */ - -static boolean -MY_bfd_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - struct internal_exec *execp = exec_hdr (abfd); - file_ptr pos; - bfd_vma vma = 0; - int pad; - - /* Set the executable header size to 0, as we don't want one for an - output. */ - adata (abfd).exec_bytes_size = 0; - pos = adata (abfd).exec_bytes_size; - /* Text. */ - vma = info->create_object_symbols_section->vma; - pos += vma; - obj_textsec (abfd)->filepos = pos; - obj_textsec (abfd)->vma = vma; - obj_textsec (abfd)->user_set_vma = 1; - pos += obj_textsec (abfd)->_raw_size; - vma += obj_textsec (abfd)->_raw_size; - - /* Data. */ - if (abfd->flags & D_PAGED) - { - if (info->create_object_symbols_section->next->vma > 0) - obj_datasec (abfd)->vma = info->create_object_symbols_section->next->vma; - else - obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size); - } - else - { - obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4); - } - if (obj_datasec (abfd)->vma < vma) - { - obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4); - } - obj_datasec (abfd)->user_set_vma = 1; - vma = obj_datasec (abfd)->vma; - obj_datasec (abfd)->filepos = vma + adata (abfd).exec_bytes_size; - execp->a_text = vma - obj_textsec (abfd)->vma; - obj_textsec (abfd)->_raw_size = execp->a_text; - - /* Since BSS follows data immediately, see if it needs alignment. */ - vma += obj_datasec (abfd)->_raw_size; - pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma; - obj_datasec (abfd)->_raw_size += pad; - pos += obj_datasec (abfd)->_raw_size; - execp->a_data = obj_datasec (abfd)->_raw_size; - - /* BSS. */ - obj_bsssec (abfd)->vma = vma; - obj_bsssec (abfd)->user_set_vma = 1; - - /* We are fully resized, so don't readjust in final_link. */ - adata (abfd).magic = z_magic; - - return NAME (aout, final_link) (abfd, info, MY_final_link_callback); -} - -#endif - -enum machine_type -tic30_aout_machine_type (arch, machine, unknown) - enum bfd_architecture arch; - unsigned long machine ATTRIBUTE_UNUSED; - boolean *unknown; -{ - enum machine_type arch_flags; - - arch_flags = M_UNKNOWN; - *unknown = true; - - switch (arch) - { - case bfd_arch_tic30: - *unknown = false; - break; - default: - arch_flags = M_UNKNOWN; - } - if (arch_flags != M_UNKNOWN) - *unknown = false; - return arch_flags; -} - -boolean -tic30_aout_set_arch_mach (abfd, arch, machine) - bfd *abfd; - enum bfd_architecture arch; - unsigned long machine; -{ - if (!bfd_default_set_arch_mach (abfd, arch, machine)) - return false; - if (arch != bfd_arch_unknown) - { - boolean unknown; - tic30_aout_machine_type (arch, machine, &unknown); - if (unknown) - return false; - } - obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; - return (*aout_backend_info (abfd)->set_sizes) (abfd); -} - -/* We assume BFD generic archive files. */ -#ifndef MY_openr_next_archived_file -#define MY_openr_next_archived_file bfd_generic_openr_next_archived_file -#endif -#ifndef MY_get_elt_at_index -#define MY_get_elt_at_index _bfd_generic_get_elt_at_index -#endif -#ifndef MY_generic_stat_arch_elt -#define MY_generic_stat_arch_elt bfd_generic_stat_arch_elt -#endif -#ifndef MY_slurp_armap -#define MY_slurp_armap bfd_slurp_bsd_armap -#endif -#ifndef MY_slurp_extended_name_table -#define MY_slurp_extended_name_table _bfd_slurp_extended_name_table -#endif -#ifndef MY_construct_extended_name_table -#define MY_construct_extended_name_table \ - _bfd_archive_bsd_construct_extended_name_table -#endif -#ifndef MY_write_armap -#define MY_write_armap bsd_write_armap -#endif -#ifndef MY_read_ar_hdr -#define MY_read_ar_hdr _bfd_generic_read_ar_hdr -#endif -#ifndef MY_truncate_arname -#define MY_truncate_arname bfd_bsd_truncate_arname -#endif -#ifndef MY_update_armap_timestamp -#define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp -#endif - -/* No core file defined here -- configure in trad-core.c separately. */ -#ifndef MY_core_file_failing_command -#define MY_core_file_failing_command _bfd_nocore_core_file_failing_command -#endif -#ifndef MY_core_file_failing_signal -#define MY_core_file_failing_signal _bfd_nocore_core_file_failing_signal -#endif -#ifndef MY_core_file_matches_executable_p -#define MY_core_file_matches_executable_p \ - _bfd_nocore_core_file_matches_executable_p -#endif -#ifndef MY_core_file_p -#define MY_core_file_p _bfd_dummy_target -#endif - -#ifndef MY_bfd_debug_info_start -#define MY_bfd_debug_info_start bfd_void -#endif -#ifndef MY_bfd_debug_info_end -#define MY_bfd_debug_info_end bfd_void -#endif -#ifndef MY_bfd_debug_info_accumulate -#define MY_bfd_debug_info_accumulate \ - (void (*) PARAMS ((bfd*, struct sec *))) bfd_void -#endif - -#ifndef MY_core_file_failing_command -#define MY_core_file_failing_command NAME(aout,core_file_failing_command) -#endif -#ifndef MY_core_file_failing_signal -#define MY_core_file_failing_signal NAME(aout,core_file_failing_signal) -#endif -#ifndef MY_core_file_matches_executable_p -#define MY_core_file_matches_executable_p NAME(aout,core_file_matches_executable_p) -#endif -#ifndef MY_set_section_contents -#define MY_set_section_contents NAME(aout,set_section_contents) -#endif -#ifndef MY_get_section_contents -#define MY_get_section_contents aout_32_get_section_contents -#endif -#ifndef MY_get_section_contents_in_window -#define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window -#endif -#ifndef MY_new_section_hook -#define MY_new_section_hook NAME(aout,new_section_hook) -#endif -#ifndef MY_get_symtab_upper_bound -#define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound) -#endif -#ifndef MY_get_symtab -#define MY_get_symtab NAME(aout,get_symtab) -#endif -#ifndef MY_get_reloc_upper_bound -#define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound) -#endif -#ifndef MY_canonicalize_reloc -#define MY_canonicalize_reloc NAME(aout,canonicalize_reloc) -#endif -#ifndef MY_make_empty_symbol -#define MY_make_empty_symbol NAME(aout,make_empty_symbol) -#endif -#ifndef MY_print_symbol -#define MY_print_symbol NAME(aout,print_symbol) -#endif -#ifndef MY_get_symbol_info -#define MY_get_symbol_info NAME(aout,get_symbol_info) -#endif -#ifndef MY_get_lineno -#define MY_get_lineno NAME(aout,get_lineno) -#endif -#ifndef MY_set_arch_mach -#define MY_set_arch_mach tic30_aout_set_arch_mach -#endif -#ifndef MY_find_nearest_line -#define MY_find_nearest_line NAME(aout,find_nearest_line) -#endif -#ifndef MY_sizeof_headers -#define MY_sizeof_headers NAME(aout,sizeof_headers) -#endif -#ifndef MY_bfd_get_relocated_section_contents -#define MY_bfd_get_relocated_section_contents \ - bfd_generic_get_relocated_section_contents -#endif -#ifndef MY_bfd_relax_section -#define MY_bfd_relax_section bfd_generic_relax_section -#endif -#ifndef MY_bfd_gc_sections -#define MY_bfd_gc_sections bfd_generic_gc_sections -#endif -#ifndef MY_bfd_reloc_type_lookup -#define MY_bfd_reloc_type_lookup tic30_aout_reloc_type_lookup -#endif -#ifndef MY_bfd_make_debug_symbol -#define MY_bfd_make_debug_symbol 0 -#endif -#ifndef MY_read_minisymbols -#define MY_read_minisymbols NAME(aout,read_minisymbols) -#endif -#ifndef MY_minisymbol_to_symbol -#define MY_minisymbol_to_symbol NAME(aout,minisymbol_to_symbol) -#endif -#ifndef MY_bfd_link_hash_table_create -#define MY_bfd_link_hash_table_create NAME(aout,link_hash_table_create) -#endif -#ifndef MY_bfd_link_add_symbols -#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols) -#endif -#ifndef MY_bfd_link_split_section -#define MY_bfd_link_split_section _bfd_generic_link_split_section -#endif - -#ifndef MY_bfd_copy_private_bfd_data -#define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data -#endif - -#ifndef MY_bfd_merge_private_bfd_data -#define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data -#endif - -#ifndef MY_bfd_copy_private_symbol_data -#define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data -#endif - -#ifndef MY_bfd_print_private_bfd_data -#define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data -#endif - -#ifndef MY_bfd_set_private_flags -#define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags -#endif - -#ifndef MY_bfd_is_local_label_name -#define MY_bfd_is_local_label_name bfd_generic_is_local_label_name -#endif - -#ifndef MY_bfd_free_cached_info -#define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info) -#endif - -#ifndef MY_close_and_cleanup -#define MY_close_and_cleanup MY_bfd_free_cached_info -#endif - -#ifndef MY_get_dynamic_symtab_upper_bound -#define MY_get_dynamic_symtab_upper_bound \ - _bfd_nodynamic_get_dynamic_symtab_upper_bound -#endif -#ifndef MY_canonicalize_dynamic_symtab -#define MY_canonicalize_dynamic_symtab \ - _bfd_nodynamic_canonicalize_dynamic_symtab -#endif -#ifndef MY_get_dynamic_reloc_upper_bound -#define MY_get_dynamic_reloc_upper_bound \ - _bfd_nodynamic_get_dynamic_reloc_upper_bound -#endif -#ifndef MY_canonicalize_dynamic_reloc -#define MY_canonicalize_dynamic_reloc \ - _bfd_nodynamic_canonicalize_dynamic_reloc -#endif - -/* Aout symbols normally have leading underscores */ -#ifndef MY_symbol_leading_char -#define MY_symbol_leading_char '_' -#endif - -/* Aout archives normally use spaces for padding */ -#ifndef AR_PAD_CHAR -#define AR_PAD_CHAR ' ' -#endif - -#ifndef MY_BFD_TARGET -const bfd_target tic30_aout_vec = -{ - TARGETNAME, /* name */ - bfd_target_aout_flavour, - BFD_ENDIAN_BIG, /* target byte order (big) */ - BFD_ENDIAN_BIG, /* target headers byte order (big) */ - (HAS_RELOC | /* object flags */ - HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - MY_symbol_leading_char, - AR_PAD_CHAR, /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ - {_bfd_dummy_target, MY_object_p, /* bfd_check_format */ - bfd_generic_archive_p, MY_core_file_p}, - {bfd_false, MY_mkobject, /* bfd_set_format */ - _bfd_generic_mkarchive, bfd_false}, - {bfd_false, MY_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (MY), - BFD_JUMP_TABLE_COPY (MY), - BFD_JUMP_TABLE_CORE (MY), - BFD_JUMP_TABLE_ARCHIVE (MY), - BFD_JUMP_TABLE_SYMBOLS (MY), - BFD_JUMP_TABLE_RELOCS (MY), - BFD_JUMP_TABLE_WRITE (MY), - BFD_JUMP_TABLE_LINK (MY), - BFD_JUMP_TABLE_DYNAMIC (MY), - - NULL, - - (PTR) MY_backend_data -}; -#endif /* MY_BFD_TARGET */ diff --git a/contrib/binutils/bfd/coff-mips.c b/contrib/binutils/bfd/coff-mips.c deleted file mode 100644 index bb4b15e96c24..000000000000 --- a/contrib/binutils/bfd/coff-mips.c +++ /dev/null @@ -1,2735 +0,0 @@ -/* BFD back-end for MIPS Extended-Coff files. - Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999 - Free Software Foundation, Inc. - Original version by Per Bothner. - Full support added by Ian Lance Taylor, ian@cygnus.com. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" -#include "libbfd.h" -#include "coff/internal.h" -#include "coff/sym.h" -#include "coff/symconst.h" -#include "coff/ecoff.h" -#include "coff/mips.h" -#include "libcoff.h" -#include "libecoff.h" - -/* Prototypes for static functions. */ - -static boolean mips_ecoff_bad_format_hook PARAMS ((bfd *abfd, PTR filehdr)); -static void mips_ecoff_swap_reloc_in PARAMS ((bfd *, PTR, - struct internal_reloc *)); -static void mips_ecoff_swap_reloc_out PARAMS ((bfd *, - const struct internal_reloc *, - PTR)); -static void mips_adjust_reloc_in PARAMS ((bfd *, - const struct internal_reloc *, - arelent *)); -static void mips_adjust_reloc_out PARAMS ((bfd *, const arelent *, - struct internal_reloc *)); -static bfd_reloc_status_type mips_generic_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -static bfd_reloc_status_type mips_refhi_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -static bfd_reloc_status_type mips_reflo_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -static bfd_reloc_status_type mips_gprel_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -static bfd_reloc_status_type mips_relhi_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -static bfd_reloc_status_type mips_rello_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -static bfd_reloc_status_type mips_switch_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -static void mips_relocate_hi PARAMS ((struct internal_reloc *refhi, - struct internal_reloc *reflo, - bfd *input_bfd, - asection *input_section, - bfd_byte *contents, - size_t adjust, - bfd_vma relocation, - boolean pcrel)); -static boolean mips_relocate_section PARAMS ((bfd *, struct bfd_link_info *, - bfd *, asection *, - bfd_byte *, PTR)); -static boolean mips_read_relocs PARAMS ((bfd *, asection *)); -static boolean mips_relax_section PARAMS ((bfd *, asection *, - struct bfd_link_info *, - boolean *)); -static boolean mips_relax_pcrel16 PARAMS ((struct bfd_link_info *, bfd *, - asection *, - struct ecoff_link_hash_entry *, - bfd_byte *, bfd_vma)); -static reloc_howto_type *mips_bfd_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); - - -/* ECOFF has COFF sections, but the debugging information is stored in - a completely different format. ECOFF targets use some of the - swapping routines from coffswap.h, and some of the generic COFF - routines in coffgen.c, but, unlike the real COFF targets, do not - use coffcode.h itself. - - Get the generic COFF swapping routines, except for the reloc, - symbol, and lineno ones. Give them ECOFF names. */ -#define MIPSECOFF -#define NO_COFF_RELOCS -#define NO_COFF_SYMBOLS -#define NO_COFF_LINENOS -#define coff_swap_filehdr_in mips_ecoff_swap_filehdr_in -#define coff_swap_filehdr_out mips_ecoff_swap_filehdr_out -#define coff_swap_aouthdr_in mips_ecoff_swap_aouthdr_in -#define coff_swap_aouthdr_out mips_ecoff_swap_aouthdr_out -#define coff_swap_scnhdr_in mips_ecoff_swap_scnhdr_in -#define coff_swap_scnhdr_out mips_ecoff_swap_scnhdr_out -#include "coffswap.h" - -/* Get the ECOFF swapping routines. */ -#define ECOFF_32 -#include "ecoffswap.h" - -/* How to process the various relocs types. */ - -static reloc_howto_type mips_howto_table[] = -{ - /* Reloc type 0 is ignored. The reloc reading code ensures that - this is a reference to the .abs section, which will cause - bfd_perform_relocation to do nothing. */ - HOWTO (MIPS_R_IGNORE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - 0, /* special_function */ - "IGNORE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 16 bit reference to a symbol, normally from a data section. */ - HOWTO (MIPS_R_REFHALF, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - mips_generic_reloc, /* special_function */ - "REFHALF", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 32 bit reference to a symbol, normally from a data section. */ - HOWTO (MIPS_R_REFWORD, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - mips_generic_reloc, /* special_function */ - "REFWORD", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 26 bit absolute jump address. */ - HOWTO (MIPS_R_JMPADDR, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - /* This needs complex overflow - detection, because the upper four - bits must match the PC. */ - mips_generic_reloc, /* special_function */ - "JMPADDR", /* name */ - true, /* partial_inplace */ - 0x3ffffff, /* src_mask */ - 0x3ffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* The high 16 bits of a symbol value. Handled by the function - mips_refhi_reloc. */ - HOWTO (MIPS_R_REFHI, /* type */ - 16, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - mips_refhi_reloc, /* special_function */ - "REFHI", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* The low 16 bits of a symbol value. */ - HOWTO (MIPS_R_REFLO, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - mips_reflo_reloc, /* special_function */ - "REFLO", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A reference to an offset from the gp register. Handled by the - function mips_gprel_reloc. */ - HOWTO (MIPS_R_GPREL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - mips_gprel_reloc, /* special_function */ - "GPREL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A reference to a literal using an offset from the gp register. - Handled by the function mips_gprel_reloc. */ - HOWTO (MIPS_R_LITERAL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - mips_gprel_reloc, /* special_function */ - "LITERAL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - EMPTY_HOWTO (8), - EMPTY_HOWTO (9), - EMPTY_HOWTO (10), - EMPTY_HOWTO (11), - - /* This reloc is a Cygnus extension used when generating position - independent code for embedded systems. It represents a 16 bit PC - relative reloc rightshifted twice as used in the MIPS branch - instructions. */ - HOWTO (MIPS_R_PCREL16, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - mips_generic_reloc, /* special_function */ - "PCREL16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true), /* pcrel_offset */ - - /* This reloc is a Cygnus extension used when generating position - independent code for embedded systems. It represents the high 16 - bits of a PC relative reloc. The next reloc must be - MIPS_R_RELLO, and the addend is formed from the addends of the - two instructions, just as in MIPS_R_REFHI and MIPS_R_REFLO. The - final value is actually PC relative to the location of the - MIPS_R_RELLO reloc, not the MIPS_R_RELHI reloc. */ - HOWTO (MIPS_R_RELHI, /* type */ - 16, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - mips_relhi_reloc, /* special_function */ - "RELHI", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true), /* pcrel_offset */ - - /* This reloc is a Cygnus extension used when generating position - independent code for embedded systems. It represents the low 16 - bits of a PC relative reloc. */ - HOWTO (MIPS_R_RELLO, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - mips_rello_reloc, /* special_function */ - "RELLO", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true), /* pcrel_offset */ - - EMPTY_HOWTO (15), - EMPTY_HOWTO (16), - EMPTY_HOWTO (17), - EMPTY_HOWTO (18), - EMPTY_HOWTO (19), - EMPTY_HOWTO (20), - EMPTY_HOWTO (21), - - /* This reloc is a Cygnus extension used when generating position - independent code for embedded systems. It represents an entry in - a switch table, which is the difference between two symbols in - the .text section. The symndx is actually the offset from the - reloc address to the subtrahend. See include/coff/mips.h for - more details. */ - HOWTO (MIPS_R_SWITCH, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - mips_switch_reloc, /* special_function */ - "SWITCH", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - true) /* pcrel_offset */ -}; - -#define MIPS_HOWTO_COUNT \ - (sizeof mips_howto_table / sizeof mips_howto_table[0]) - -/* When the linker is doing relaxing, it may change a external PCREL16 - reloc. This typically represents an instruction like - bal foo - We change it to - .set noreorder - bal $L1 - lui $at,%hi(foo - $L1) - $L1: - addiu $at,%lo(foo - $L1) - addu $at,$at,$31 - jalr $at - PCREL16_EXPANSION_ADJUSTMENT is the number of bytes this changes the - instruction by. */ - -#define PCREL16_EXPANSION_ADJUSTMENT (4 * 4) - -/* See whether the magic number matches. */ - -static boolean -mips_ecoff_bad_format_hook (abfd, filehdr) - bfd *abfd; - PTR filehdr; -{ - struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; - - switch (internal_f->f_magic) - { - case MIPS_MAGIC_1: - /* I don't know what endianness this implies. */ - return true; - - case MIPS_MAGIC_BIG: - case MIPS_MAGIC_BIG2: - case MIPS_MAGIC_BIG3: - return bfd_big_endian (abfd); - - case MIPS_MAGIC_LITTLE: - case MIPS_MAGIC_LITTLE2: - case MIPS_MAGIC_LITTLE3: - return bfd_little_endian (abfd); - - default: - return false; - } -} - -/* Reloc handling. MIPS ECOFF relocs are packed into 8 bytes in - external form. They use a bit which indicates whether the symbol - is external. */ - -/* Swap a reloc in. */ - -static void -mips_ecoff_swap_reloc_in (abfd, ext_ptr, intern) - bfd *abfd; - PTR ext_ptr; - struct internal_reloc *intern; -{ - const RELOC *ext = (RELOC *) ext_ptr; - - intern->r_vaddr = bfd_h_get_32 (abfd, (bfd_byte *) ext->r_vaddr); - if (bfd_header_big_endian (abfd)) - { - intern->r_symndx = (((int) ext->r_bits[0] - << RELOC_BITS0_SYMNDX_SH_LEFT_BIG) - | ((int) ext->r_bits[1] - << RELOC_BITS1_SYMNDX_SH_LEFT_BIG) - | ((int) ext->r_bits[2] - << RELOC_BITS2_SYMNDX_SH_LEFT_BIG)); - intern->r_type = ((ext->r_bits[3] & RELOC_BITS3_TYPE_BIG) - >> RELOC_BITS3_TYPE_SH_BIG); - intern->r_extern = (ext->r_bits[3] & RELOC_BITS3_EXTERN_BIG) != 0; - } - else - { - intern->r_symndx = (((int) ext->r_bits[0] - << RELOC_BITS0_SYMNDX_SH_LEFT_LITTLE) - | ((int) ext->r_bits[1] - << RELOC_BITS1_SYMNDX_SH_LEFT_LITTLE) - | ((int) ext->r_bits[2] - << RELOC_BITS2_SYMNDX_SH_LEFT_LITTLE)); - intern->r_type = (((ext->r_bits[3] & RELOC_BITS3_TYPE_LITTLE) - >> RELOC_BITS3_TYPE_SH_LITTLE) - | ((ext->r_bits[3] & RELOC_BITS3_TYPEHI_LITTLE) - << RELOC_BITS3_TYPEHI_SH_LITTLE)); - intern->r_extern = (ext->r_bits[3] & RELOC_BITS3_EXTERN_LITTLE) != 0; - } - - /* If this is a MIPS_R_SWITCH reloc, or an internal MIPS_R_RELHI or - MIPS_R_RELLO reloc, r_symndx is actually the offset from the - reloc address to the base of the difference (see - include/coff/mips.h for more details). We copy symndx into the - r_offset field so as not to confuse ecoff_slurp_reloc_table in - ecoff.c. In adjust_reloc_in we then copy r_offset into the reloc - addend. */ - if (intern->r_type == MIPS_R_SWITCH - || (! intern->r_extern - && (intern->r_type == MIPS_R_RELLO - || intern->r_type == MIPS_R_RELHI))) - { - BFD_ASSERT (! intern->r_extern); - intern->r_offset = intern->r_symndx; - if (intern->r_offset & 0x800000) - intern->r_offset -= 0x1000000; - intern->r_symndx = RELOC_SECTION_TEXT; - } -} - -/* Swap a reloc out. */ - -static void -mips_ecoff_swap_reloc_out (abfd, intern, dst) - bfd *abfd; - const struct internal_reloc *intern; - PTR dst; -{ - RELOC *ext = (RELOC *) dst; - long r_symndx; - - BFD_ASSERT (intern->r_extern - || (intern->r_symndx >= 0 && intern->r_symndx <= 12)); - - /* If this is a MIPS_R_SWITCH reloc, or an internal MIPS_R_RELLO or - MIPS_R_RELHI reloc, we actually want to write the contents of - r_offset out as the symbol index. This undoes the change made by - mips_ecoff_swap_reloc_in. */ - if (intern->r_type != MIPS_R_SWITCH - && (intern->r_extern - || (intern->r_type != MIPS_R_RELHI - && intern->r_type != MIPS_R_RELLO))) - r_symndx = intern->r_symndx; - else - { - BFD_ASSERT (intern->r_symndx == RELOC_SECTION_TEXT); - r_symndx = intern->r_offset & 0xffffff; - } - - bfd_h_put_32 (abfd, intern->r_vaddr, (bfd_byte *) ext->r_vaddr); - if (bfd_header_big_endian (abfd)) - { - ext->r_bits[0] = r_symndx >> RELOC_BITS0_SYMNDX_SH_LEFT_BIG; - ext->r_bits[1] = r_symndx >> RELOC_BITS1_SYMNDX_SH_LEFT_BIG; - ext->r_bits[2] = r_symndx >> RELOC_BITS2_SYMNDX_SH_LEFT_BIG; - ext->r_bits[3] = (((intern->r_type << RELOC_BITS3_TYPE_SH_BIG) - & RELOC_BITS3_TYPE_BIG) - | (intern->r_extern ? RELOC_BITS3_EXTERN_BIG : 0)); - } - else - { - ext->r_bits[0] = r_symndx >> RELOC_BITS0_SYMNDX_SH_LEFT_LITTLE; - ext->r_bits[1] = r_symndx >> RELOC_BITS1_SYMNDX_SH_LEFT_LITTLE; - ext->r_bits[2] = r_symndx >> RELOC_BITS2_SYMNDX_SH_LEFT_LITTLE; - ext->r_bits[3] = (((intern->r_type << RELOC_BITS3_TYPE_SH_LITTLE) - & RELOC_BITS3_TYPE_LITTLE) - | ((intern->r_type >> RELOC_BITS3_TYPEHI_SH_LITTLE - & RELOC_BITS3_TYPEHI_LITTLE)) - | (intern->r_extern ? RELOC_BITS3_EXTERN_LITTLE : 0)); - } -} - -/* Finish canonicalizing a reloc. Part of this is generic to all - ECOFF targets, and that part is in ecoff.c. The rest is done in - this backend routine. It must fill in the howto field. */ - -static void -mips_adjust_reloc_in (abfd, intern, rptr) - bfd *abfd; - const struct internal_reloc *intern; - arelent *rptr; -{ - if (intern->r_type > MIPS_R_SWITCH) - abort (); - - if (! intern->r_extern - && (intern->r_type == MIPS_R_GPREL - || intern->r_type == MIPS_R_LITERAL)) - rptr->addend += ecoff_data (abfd)->gp; - - /* If the type is MIPS_R_IGNORE, make sure this is a reference to - the absolute section so that the reloc is ignored. */ - if (intern->r_type == MIPS_R_IGNORE) - rptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - - /* If this is a MIPS_R_SWITCH reloc, or an internal MIPS_R_RELHI or - MIPS_R_RELLO reloc, we want the addend field of the BFD relocto - hold the value which was originally in the symndx field of the - internal MIPS ECOFF reloc. This value was copied into - intern->r_offset by mips_swap_reloc_in, and here we copy it into - the addend field. */ - if (intern->r_type == MIPS_R_SWITCH - || (! intern->r_extern - && (intern->r_type == MIPS_R_RELHI - || intern->r_type == MIPS_R_RELLO))) - rptr->addend = intern->r_offset; - - rptr->howto = &mips_howto_table[intern->r_type]; -} - -/* Make any adjustments needed to a reloc before writing it out. None - are needed for MIPS. */ - -static void -mips_adjust_reloc_out (abfd, rel, intern) - bfd *abfd ATTRIBUTE_UNUSED; - const arelent *rel; - struct internal_reloc *intern; -{ - /* For a MIPS_R_SWITCH reloc, or an internal MIPS_R_RELHI or - MIPS_R_RELLO reloc, we must copy rel->addend into - intern->r_offset. This will then be written out as the symbol - index by mips_ecoff_swap_reloc_out. This operation parallels the - action of mips_adjust_reloc_in. */ - if (intern->r_type == MIPS_R_SWITCH - || (! intern->r_extern - && (intern->r_type == MIPS_R_RELHI - || intern->r_type == MIPS_R_RELLO))) - intern->r_offset = rel->addend; -} - -/* ECOFF relocs are either against external symbols, or against - sections. If we are producing relocateable output, and the reloc - is against an external symbol, and nothing has given us any - additional addend, the resulting reloc will also be against the - same symbol. In such a case, we don't want to change anything - about the way the reloc is handled, since it will all be done at - final link time. Rather than put special case code into - bfd_perform_relocation, all the reloc types use this howto - function. It just short circuits the reloc if producing - relocateable output against an external symbol. */ - -static bfd_reloc_status_type -mips_generic_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - return bfd_reloc_continue; -} - -/* Do a REFHI relocation. This has to be done in combination with a - REFLO reloc, because there is a carry from the REFLO to the REFHI. - Here we just save the information we need; we do the actual - relocation when we see the REFLO. MIPS ECOFF requires that the - REFLO immediately follow the REFHI. As a GNU extension, we permit - an arbitrary number of HI relocs to be associated with a single LO - reloc. This extension permits gcc to output the HI and LO relocs - itself. */ - -struct mips_hi -{ - struct mips_hi *next; - bfd_byte *addr; - bfd_vma addend; -}; - -/* FIXME: This should not be a static variable. */ - -static struct mips_hi *mips_refhi_list; - -static bfd_reloc_status_type -mips_refhi_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - bfd_reloc_status_type ret; - bfd_vma relocation; - struct mips_hi *n; - - /* If we're relocating, and this an external symbol, we don't want - to change anything. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - ret = bfd_reloc_ok; - if (bfd_is_und_section (symbol->section) - && output_bfd == (bfd *) NULL) - ret = bfd_reloc_undefined; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* Save the information, and let REFLO do the actual relocation. */ - n = (struct mips_hi *) bfd_malloc (sizeof *n); - if (n == NULL) - return bfd_reloc_outofrange; - n->addr = (bfd_byte *) data + reloc_entry->address; - n->addend = relocation; - n->next = mips_refhi_list; - mips_refhi_list = n; - - if (output_bfd != (bfd *) NULL) - reloc_entry->address += input_section->output_offset; - - return ret; -} - -/* Do a REFLO relocation. This is a straightforward 16 bit inplace - relocation; this function exists in order to do the REFHI - relocation described above. */ - -static bfd_reloc_status_type -mips_reflo_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - if (mips_refhi_list != NULL) - { - struct mips_hi *l; - - l = mips_refhi_list; - while (l != NULL) - { - unsigned long insn; - unsigned long val; - unsigned long vallo; - struct mips_hi *next; - - /* Do the REFHI relocation. Note that we actually don't - need to know anything about the REFLO itself, except - where to find the low 16 bits of the addend needed by the - REFHI. */ - insn = bfd_get_32 (abfd, l->addr); - vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address) - & 0xffff); - val = ((insn & 0xffff) << 16) + vallo; - val += l->addend; - - /* The low order 16 bits are always treated as a signed - value. Therefore, a negative value in the low order bits - requires an adjustment in the high order bits. We need - to make this adjustment in two ways: once for the bits we - took from the data, and once for the bits we are putting - back in to the data. */ - if ((vallo & 0x8000) != 0) - val -= 0x10000; - if ((val & 0x8000) != 0) - val += 0x10000; - - insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (abfd, insn, l->addr); - - next = l->next; - free (l); - l = next; - } - - mips_refhi_list = NULL; - } - - /* Now do the REFLO reloc in the usual way. */ - return mips_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); -} - -/* Do a GPREL relocation. This is a 16 bit value which must become - the offset from the gp register. */ - -static bfd_reloc_status_type -mips_gprel_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - boolean relocateable; - bfd_vma gp; - bfd_vma relocation; - unsigned long val; - unsigned long insn; - - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ECOFF - file. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (output_bfd != (bfd *) NULL) - relocateable = true; - else - { - relocateable = false; - output_bfd = symbol->section->output_section->owner; - } - - if (bfd_is_und_section (symbol->section) - && relocateable == false) - return bfd_reloc_undefined; - - /* We have to figure out the gp value, so that we can adjust the - symbol value correctly. We look up the symbol _gp in the output - BFD. If we can't find it, we're stuck. We cache it in the ECOFF - target data. We don't need to adjust the symbol value for an - external symbol if we are producing relocateable output. */ - gp = _bfd_get_gp_value (output_bfd); - if (gp == 0 - && (relocateable == false - || (symbol->flags & BSF_SECTION_SYM) != 0)) - { - if (relocateable != false) - { - /* Make up a value. */ - gp = symbol->section->output_section->vma + 0x4000; - _bfd_set_gp_value (output_bfd, gp); - } - else - { - unsigned int count; - asymbol **sym; - unsigned int i; - - count = bfd_get_symcount (output_bfd); - sym = bfd_get_outsymbols (output_bfd); - - if (sym == (asymbol **) NULL) - i = count; - else - { - for (i = 0; i < count; i++, sym++) - { - register CONST char *name; - - name = bfd_asymbol_name (*sym); - if (*name == '_' && strcmp (name, "_gp") == 0) - { - gp = bfd_asymbol_value (*sym); - _bfd_set_gp_value (output_bfd, gp); - break; - } - } - } - - if (i >= count) - { - /* Only get the error once. */ - gp = 4; - _bfd_set_gp_value (output_bfd, gp); - *error_message = - (char *) _("GP relative relocation when _gp not defined"); - return bfd_reloc_dangerous; - } - } - } - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - - /* Set val to the offset into the section or symbol. */ - val = ((insn & 0xffff) + reloc_entry->addend) & 0xffff; - if (val & 0x8000) - val -= 0x10000; - - /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for - an external symbol. */ - if (relocateable == false - || (symbol->flags & BSF_SECTION_SYM) != 0) - val += relocation - gp; - - insn = (insn &~ 0xffff) | (val & 0xffff); - bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); - - if (relocateable != false) - reloc_entry->address += input_section->output_offset; - - /* Make sure it fit in 16 bits. */ - if (val >= 0x8000 && val < 0xffff8000) - return bfd_reloc_overflow; - - return bfd_reloc_ok; -} - -/* Do a RELHI relocation. We do this in conjunction with a RELLO - reloc, just as REFHI and REFLO are done together. RELHI and RELLO - are Cygnus extensions used when generating position independent - code for embedded systems. */ - -/* FIXME: This should not be a static variable. */ - -static struct mips_hi *mips_relhi_list; - -static bfd_reloc_status_type -mips_relhi_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - bfd_reloc_status_type ret; - bfd_vma relocation; - struct mips_hi *n; - - /* If this is a reloc against a section symbol, then it is correct - in the object file. The only time we want to change this case is - when we are relaxing, and that is handled entirely by - mips_relocate_section and never calls this function. */ - if ((symbol->flags & BSF_SECTION_SYM) != 0) - { - if (output_bfd != (bfd *) NULL) - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* This is an external symbol. If we're relocating, we don't want - to change anything. */ - if (output_bfd != (bfd *) NULL) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - ret = bfd_reloc_ok; - if (bfd_is_und_section (symbol->section) - && output_bfd == (bfd *) NULL) - ret = bfd_reloc_undefined; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* Save the information, and let RELLO do the actual relocation. */ - n = (struct mips_hi *) bfd_malloc (sizeof *n); - if (n == NULL) - return bfd_reloc_outofrange; - n->addr = (bfd_byte *) data + reloc_entry->address; - n->addend = relocation; - n->next = mips_relhi_list; - mips_relhi_list = n; - - if (output_bfd != (bfd *) NULL) - reloc_entry->address += input_section->output_offset; - - return ret; -} - -/* Do a RELLO relocation. This is a straightforward 16 bit PC - relative relocation; this function exists in order to do the RELHI - relocation described above. */ - -static bfd_reloc_status_type -mips_rello_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - if (mips_relhi_list != NULL) - { - struct mips_hi *l; - - l = mips_relhi_list; - while (l != NULL) - { - unsigned long insn; - unsigned long val; - unsigned long vallo; - struct mips_hi *next; - - /* Do the RELHI relocation. Note that we actually don't - need to know anything about the RELLO itself, except - where to find the low 16 bits of the addend needed by the - RELHI. */ - insn = bfd_get_32 (abfd, l->addr); - vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address) - & 0xffff); - val = ((insn & 0xffff) << 16) + vallo; - val += l->addend; - - /* If the symbol is defined, make val PC relative. If the - symbol is not defined we don't want to do this, because - we don't want the value in the object file to incorporate - the address of the reloc. */ - if (! bfd_is_und_section (bfd_get_section (symbol)) - && ! bfd_is_com_section (bfd_get_section (symbol))) - val -= (input_section->output_section->vma - + input_section->output_offset - + reloc_entry->address); - - /* The low order 16 bits are always treated as a signed - value. Therefore, a negative value in the low order bits - requires an adjustment in the high order bits. We need - to make this adjustment in two ways: once for the bits we - took from the data, and once for the bits we are putting - back in to the data. */ - if ((vallo & 0x8000) != 0) - val -= 0x10000; - if ((val & 0x8000) != 0) - val += 0x10000; - - insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (abfd, insn, l->addr); - - next = l->next; - free (l); - l = next; - } - - mips_relhi_list = NULL; - } - - /* If this is a reloc against a section symbol, then it is correct - in the object file. The only time we want to change this case is - when we are relaxing, and that is handled entirely by - mips_relocate_section and never calls this function. */ - if ((symbol->flags & BSF_SECTION_SYM) != 0) - { - if (output_bfd != (bfd *) NULL) - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* bfd_perform_relocation does not handle pcrel_offset relocations - correctly when generating a relocateable file, so handle them - directly here. */ - if (output_bfd != (bfd *) NULL) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* Now do the RELLO reloc in the usual way. */ - return mips_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); -} - -/* This is the special function for the MIPS_R_SWITCH reloc. This - special reloc is normally correct in the object file, and only - requires special handling when relaxing. We don't want - bfd_perform_relocation to tamper with it at all. */ - -/*ARGSUSED*/ -static bfd_reloc_status_type -mips_switch_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry ATTRIBUTE_UNUSED; - asymbol *symbol ATTRIBUTE_UNUSED; - PTR data ATTRIBUTE_UNUSED; - asection *input_section ATTRIBUTE_UNUSED; - bfd *output_bfd ATTRIBUTE_UNUSED; - char **error_message ATTRIBUTE_UNUSED; -{ - return bfd_reloc_ok; -} - -/* Get the howto structure for a generic reloc type. */ - -static reloc_howto_type * -mips_bfd_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; -{ - int mips_type; - - switch (code) - { - case BFD_RELOC_16: - mips_type = MIPS_R_REFHALF; - break; - case BFD_RELOC_32: - case BFD_RELOC_CTOR: - mips_type = MIPS_R_REFWORD; - break; - case BFD_RELOC_MIPS_JMP: - mips_type = MIPS_R_JMPADDR; - break; - case BFD_RELOC_HI16_S: - mips_type = MIPS_R_REFHI; - break; - case BFD_RELOC_LO16: - mips_type = MIPS_R_REFLO; - break; - case BFD_RELOC_MIPS_GPREL: - mips_type = MIPS_R_GPREL; - break; - case BFD_RELOC_MIPS_LITERAL: - mips_type = MIPS_R_LITERAL; - break; - case BFD_RELOC_16_PCREL_S2: - mips_type = MIPS_R_PCREL16; - break; - case BFD_RELOC_PCREL_HI16_S: - mips_type = MIPS_R_RELHI; - break; - case BFD_RELOC_PCREL_LO16: - mips_type = MIPS_R_RELLO; - break; - case BFD_RELOC_GPREL32: - mips_type = MIPS_R_SWITCH; - break; - default: - return (reloc_howto_type *) NULL; - } - - return &mips_howto_table[mips_type]; -} - -/* A helper routine for mips_relocate_section which handles the REFHI - and RELHI relocations. The REFHI relocation must be followed by a - REFLO relocation (and RELHI by a RELLO), and the addend used is - formed from the addends of both instructions. */ - -static void -mips_relocate_hi (refhi, reflo, input_bfd, input_section, contents, adjust, - relocation, pcrel) - struct internal_reloc *refhi; - struct internal_reloc *reflo; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - size_t adjust; - bfd_vma relocation; - boolean pcrel; -{ - unsigned long insn; - unsigned long val; - unsigned long vallo; - - if (refhi == NULL) - return; - - insn = bfd_get_32 (input_bfd, - contents + adjust + refhi->r_vaddr - input_section->vma); - if (reflo == NULL) - vallo = 0; - else - vallo = (bfd_get_32 (input_bfd, - contents + adjust + reflo->r_vaddr - input_section->vma) - & 0xffff); - - val = ((insn & 0xffff) << 16) + vallo; - val += relocation; - - /* The low order 16 bits are always treated as a signed value. - Therefore, a negative value in the low order bits requires an - adjustment in the high order bits. We need to make this - adjustment in two ways: once for the bits we took from the data, - and once for the bits we are putting back in to the data. */ - if ((vallo & 0x8000) != 0) - val -= 0x10000; - - if (pcrel) - val -= (input_section->output_section->vma - + input_section->output_offset - + (reflo->r_vaddr - input_section->vma + adjust)); - - if ((val & 0x8000) != 0) - val += 0x10000; - - insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (input_bfd, (bfd_vma) insn, - contents + adjust + refhi->r_vaddr - input_section->vma); -} - -/* Relocate a section while linking a MIPS ECOFF file. */ - -static boolean -mips_relocate_section (output_bfd, info, input_bfd, input_section, - contents, external_relocs) - bfd *output_bfd; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - PTR external_relocs; -{ - asection **symndx_to_section; - struct ecoff_link_hash_entry **sym_hashes; - bfd_vma gp; - boolean gp_undefined; - size_t adjust; - long *offsets; - struct external_reloc *ext_rel; - struct external_reloc *ext_rel_end; - unsigned int i; - boolean got_lo; - struct internal_reloc lo_int_rel; - - BFD_ASSERT (input_bfd->xvec->byteorder - == output_bfd->xvec->byteorder); - - /* We keep a table mapping the symndx found in an internal reloc to - the appropriate section. This is faster than looking up the - section by name each time. */ - symndx_to_section = ecoff_data (input_bfd)->symndx_to_section; - if (symndx_to_section == (asection **) NULL) - { - symndx_to_section = ((asection **) - bfd_alloc (input_bfd, - (NUM_RELOC_SECTIONS - * sizeof (asection *)))); - if (!symndx_to_section) - return false; - - symndx_to_section[RELOC_SECTION_NONE] = NULL; - symndx_to_section[RELOC_SECTION_TEXT] = - bfd_get_section_by_name (input_bfd, ".text"); - symndx_to_section[RELOC_SECTION_RDATA] = - bfd_get_section_by_name (input_bfd, ".rdata"); - symndx_to_section[RELOC_SECTION_DATA] = - bfd_get_section_by_name (input_bfd, ".data"); - symndx_to_section[RELOC_SECTION_SDATA] = - bfd_get_section_by_name (input_bfd, ".sdata"); - symndx_to_section[RELOC_SECTION_SBSS] = - bfd_get_section_by_name (input_bfd, ".sbss"); - symndx_to_section[RELOC_SECTION_BSS] = - bfd_get_section_by_name (input_bfd, ".bss"); - symndx_to_section[RELOC_SECTION_INIT] = - bfd_get_section_by_name (input_bfd, ".init"); - symndx_to_section[RELOC_SECTION_LIT8] = - bfd_get_section_by_name (input_bfd, ".lit8"); - symndx_to_section[RELOC_SECTION_LIT4] = - bfd_get_section_by_name (input_bfd, ".lit4"); - symndx_to_section[RELOC_SECTION_XDATA] = NULL; - symndx_to_section[RELOC_SECTION_PDATA] = NULL; - symndx_to_section[RELOC_SECTION_FINI] = - bfd_get_section_by_name (input_bfd, ".fini"); - symndx_to_section[RELOC_SECTION_LITA] = NULL; - symndx_to_section[RELOC_SECTION_ABS] = NULL; - - ecoff_data (input_bfd)->symndx_to_section = symndx_to_section; - } - - sym_hashes = ecoff_data (input_bfd)->sym_hashes; - - gp = _bfd_get_gp_value (output_bfd); - if (gp == 0) - gp_undefined = true; - else - gp_undefined = false; - - got_lo = false; - - adjust = 0; - - if (ecoff_section_data (input_bfd, input_section) == NULL) - offsets = NULL; - else - offsets = ecoff_section_data (input_bfd, input_section)->offsets; - - ext_rel = (struct external_reloc *) external_relocs; - ext_rel_end = ext_rel + input_section->reloc_count; - for (i = 0; ext_rel < ext_rel_end; ext_rel++, i++) - { - struct internal_reloc int_rel; - boolean use_lo = false; - bfd_vma addend; - reloc_howto_type *howto; - struct ecoff_link_hash_entry *h = NULL; - asection *s = NULL; - bfd_vma relocation; - bfd_reloc_status_type r; - - if (! got_lo) - mips_ecoff_swap_reloc_in (input_bfd, (PTR) ext_rel, &int_rel); - else - { - int_rel = lo_int_rel; - got_lo = false; - } - - BFD_ASSERT (int_rel.r_type - < sizeof mips_howto_table / sizeof mips_howto_table[0]); - - /* The REFHI and RELHI relocs requires special handling. they - must be followed by a REFLO or RELLO reloc, respectively, and - the addend is formed from both relocs. */ - if (int_rel.r_type == MIPS_R_REFHI - || int_rel.r_type == MIPS_R_RELHI) - { - struct external_reloc *lo_ext_rel; - - /* As a GNU extension, permit an arbitrary number of REFHI - or RELHI relocs before the REFLO or RELLO reloc. This - permits gcc to emit the HI and LO relocs itself. */ - for (lo_ext_rel = ext_rel + 1; - lo_ext_rel < ext_rel_end; - lo_ext_rel++) - { - mips_ecoff_swap_reloc_in (input_bfd, (PTR) lo_ext_rel, - &lo_int_rel); - if (lo_int_rel.r_type != int_rel.r_type) - break; - } - - if (lo_ext_rel < ext_rel_end - && (lo_int_rel.r_type - == (int_rel.r_type == MIPS_R_REFHI - ? MIPS_R_REFLO - : MIPS_R_RELLO)) - && int_rel.r_extern == lo_int_rel.r_extern - && int_rel.r_symndx == lo_int_rel.r_symndx) - { - use_lo = true; - if (lo_ext_rel == ext_rel + 1) - got_lo = true; - } - } - - howto = &mips_howto_table[int_rel.r_type]; - - /* The SWITCH reloc must be handled specially. This reloc is - marks the location of a difference between two portions of an - object file. The symbol index does not reference a symbol, - but is actually the offset from the reloc to the subtrahend - of the difference. This reloc is correct in the object file, - and needs no further adjustment, unless we are relaxing. If - we are relaxing, we may have to add in an offset. Since no - symbols are involved in this reloc, we handle it completely - here. */ - if (int_rel.r_type == MIPS_R_SWITCH) - { - if (offsets != NULL - && offsets[i] != 0) - { - r = _bfd_relocate_contents (howto, input_bfd, - (bfd_vma) offsets[i], - (contents - + adjust - + int_rel.r_vaddr - - input_section->vma)); - BFD_ASSERT (r == bfd_reloc_ok); - } - - continue; - } - - if (int_rel.r_extern) - { - h = sym_hashes[int_rel.r_symndx]; - /* If h is NULL, that means that there is a reloc against an - external symbol which we thought was just a debugging - symbol. This should not happen. */ - if (h == (struct ecoff_link_hash_entry *) NULL) - abort (); - } - else - { - if (int_rel.r_symndx < 0 || int_rel.r_symndx >= NUM_RELOC_SECTIONS) - s = NULL; - else - s = symndx_to_section[int_rel.r_symndx]; - - if (s == (asection *) NULL) - abort (); - } - - /* The GPREL reloc uses an addend: the difference in the GP - values. */ - if (int_rel.r_type != MIPS_R_GPREL - && int_rel.r_type != MIPS_R_LITERAL) - addend = 0; - else - { - if (gp_undefined) - { - if (! ((*info->callbacks->reloc_dangerous) - (info, _("GP relative relocation when GP not defined"), - input_bfd, input_section, - int_rel.r_vaddr - input_section->vma))) - return false; - /* Only give the error once per link. */ - gp = 4; - _bfd_set_gp_value (output_bfd, gp); - gp_undefined = false; - } - if (! int_rel.r_extern) - { - /* This is a relocation against a section. The current - addend in the instruction is the difference between - INPUT_SECTION->vma and the GP value of INPUT_BFD. We - must change this to be the difference between the - final definition (which will end up in RELOCATION) - and the GP value of OUTPUT_BFD (which is in GP). */ - addend = ecoff_data (input_bfd)->gp - gp; - } - else if (! info->relocateable - || h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - /* This is a relocation against a defined symbol. The - current addend in the instruction is simply the - desired offset into the symbol (normally zero). We - are going to change this into a relocation against a - defined symbol, so we want the instruction to hold - the difference between the final definition of the - symbol (which will end up in RELOCATION) and the GP - value of OUTPUT_BFD (which is in GP). */ - addend = - gp; - } - else - { - /* This is a relocation against an undefined or common - symbol. The current addend in the instruction is - simply the desired offset into the symbol (normally - zero). We are generating relocateable output, and we - aren't going to define this symbol, so we just leave - the instruction alone. */ - addend = 0; - } - } - - /* If we are relaxing, mips_relax_section may have set - offsets[i] to some value. A value of 1 means we must expand - a PC relative branch into a multi-instruction of sequence, - and any other value is an addend. */ - if (offsets != NULL - && offsets[i] != 0) - { - BFD_ASSERT (! info->relocateable); - BFD_ASSERT (int_rel.r_type == MIPS_R_PCREL16 - || int_rel.r_type == MIPS_R_RELHI - || int_rel.r_type == MIPS_R_RELLO); - if (offsets[i] != 1) - addend += offsets[i]; - else - { - bfd_byte *here; - - BFD_ASSERT (int_rel.r_extern - && int_rel.r_type == MIPS_R_PCREL16); - - /* Move the rest of the instructions up. */ - here = (contents - + adjust - + int_rel.r_vaddr - - input_section->vma); - memmove (here + PCREL16_EXPANSION_ADJUSTMENT, here, - (size_t) (input_section->_raw_size - - (int_rel.r_vaddr - input_section->vma))); - - /* Generate the new instructions. */ - if (! mips_relax_pcrel16 (info, input_bfd, input_section, - h, here, - (input_section->output_section->vma - + input_section->output_offset - + (int_rel.r_vaddr - - input_section->vma) - + adjust))) - return false; - - /* We must adjust everything else up a notch. */ - adjust += PCREL16_EXPANSION_ADJUSTMENT; - - /* mips_relax_pcrel16 handles all the details of this - relocation. */ - continue; - } - } - - /* If we are relaxing, and this is a reloc against the .text - segment, we may need to adjust it if some branches have been - expanded. The reloc types which are likely to occur in the - .text section are handled efficiently by mips_relax_section, - and thus do not need to be handled here. */ - if (ecoff_data (input_bfd)->debug_info.adjust != NULL - && ! int_rel.r_extern - && int_rel.r_symndx == RELOC_SECTION_TEXT - && (strcmp (bfd_get_section_name (input_bfd, input_section), - ".text") != 0 - || (int_rel.r_type != MIPS_R_PCREL16 - && int_rel.r_type != MIPS_R_SWITCH - && int_rel.r_type != MIPS_R_RELHI - && int_rel.r_type != MIPS_R_RELLO))) - { - bfd_vma adr; - struct ecoff_value_adjust *a; - - /* We need to get the addend so that we know whether we need - to adjust the address. */ - BFD_ASSERT (int_rel.r_type == MIPS_R_REFWORD); - - adr = bfd_get_32 (input_bfd, - (contents - + adjust - + int_rel.r_vaddr - - input_section->vma)); - - for (a = ecoff_data (input_bfd)->debug_info.adjust; - a != (struct ecoff_value_adjust *) NULL; - a = a->next) - { - if (adr >= a->start && adr < a->end) - addend += a->adjust; - } - } - - if (info->relocateable) - { - /* We are generating relocateable output, and must convert - the existing reloc. */ - if (int_rel.r_extern) - { - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && ! bfd_is_abs_section (h->root.u.def.section)) - { - const char *name; - - /* This symbol is defined in the output. Convert - the reloc from being against the symbol to being - against the section. */ - - /* Clear the r_extern bit. */ - int_rel.r_extern = 0; - - /* Compute a new r_symndx value. */ - s = h->root.u.def.section; - name = bfd_get_section_name (output_bfd, - s->output_section); - - int_rel.r_symndx = -1; - switch (name[1]) - { - case 'b': - if (strcmp (name, ".bss") == 0) - int_rel.r_symndx = RELOC_SECTION_BSS; - break; - case 'd': - if (strcmp (name, ".data") == 0) - int_rel.r_symndx = RELOC_SECTION_DATA; - break; - case 'f': - if (strcmp (name, ".fini") == 0) - int_rel.r_symndx = RELOC_SECTION_FINI; - break; - case 'i': - if (strcmp (name, ".init") == 0) - int_rel.r_symndx = RELOC_SECTION_INIT; - break; - case 'l': - if (strcmp (name, ".lit8") == 0) - int_rel.r_symndx = RELOC_SECTION_LIT8; - else if (strcmp (name, ".lit4") == 0) - int_rel.r_symndx = RELOC_SECTION_LIT4; - break; - case 'r': - if (strcmp (name, ".rdata") == 0) - int_rel.r_symndx = RELOC_SECTION_RDATA; - break; - case 's': - if (strcmp (name, ".sdata") == 0) - int_rel.r_symndx = RELOC_SECTION_SDATA; - else if (strcmp (name, ".sbss") == 0) - int_rel.r_symndx = RELOC_SECTION_SBSS; - break; - case 't': - if (strcmp (name, ".text") == 0) - int_rel.r_symndx = RELOC_SECTION_TEXT; - break; - } - - if (int_rel.r_symndx == -1) - abort (); - - /* Add the section VMA and the symbol value. */ - relocation = (h->root.u.def.value - + s->output_section->vma - + s->output_offset); - - /* For a PC relative relocation, the object file - currently holds just the addend. We must adjust - by the address to get the right value. */ - if (howto->pc_relative) - { - relocation -= int_rel.r_vaddr - input_section->vma; - - /* If we are converting a RELHI or RELLO reloc - from being against an external symbol to - being against a section, we must put a - special value into the r_offset field. This - value is the old addend. The r_offset for - both the RELHI and RELLO relocs are the same, - and we set both when we see RELHI. */ - if (int_rel.r_type == MIPS_R_RELHI) - { - long addhi, addlo; - - addhi = bfd_get_32 (input_bfd, - (contents - + adjust - + int_rel.r_vaddr - - input_section->vma)); - addhi &= 0xffff; - if (addhi & 0x8000) - addhi -= 0x10000; - addhi <<= 16; - - if (! use_lo) - addlo = 0; - else - { - addlo = bfd_get_32 (input_bfd, - (contents - + adjust - + lo_int_rel.r_vaddr - - input_section->vma)); - addlo &= 0xffff; - if (addlo & 0x8000) - addlo -= 0x10000; - - lo_int_rel.r_offset = addhi + addlo; - } - - int_rel.r_offset = addhi + addlo; - } - } - - h = NULL; - } - else - { - /* Change the symndx value to the right one for the - output BFD. */ - int_rel.r_symndx = h->indx; - if (int_rel.r_symndx == -1) - { - /* This symbol is not being written out. */ - if (! ((*info->callbacks->unattached_reloc) - (info, h->root.root.string, input_bfd, - input_section, - int_rel.r_vaddr - input_section->vma))) - return false; - int_rel.r_symndx = 0; - } - relocation = 0; - } - } - else - { - /* This is a relocation against a section. Adjust the - value by the amount the section moved. */ - relocation = (s->output_section->vma - + s->output_offset - - s->vma); - } - - relocation += addend; - addend = 0; - - /* Adjust a PC relative relocation by removing the reference - to the original address in the section and including the - reference to the new address. However, external RELHI - and RELLO relocs are PC relative, but don't include any - reference to the address. The addend is merely an - addend. */ - if (howto->pc_relative - && (! int_rel.r_extern - || (int_rel.r_type != MIPS_R_RELHI - && int_rel.r_type != MIPS_R_RELLO))) - relocation -= (input_section->output_section->vma - + input_section->output_offset - - input_section->vma); - - /* Adjust the contents. */ - if (relocation == 0) - r = bfd_reloc_ok; - else - { - if (int_rel.r_type != MIPS_R_REFHI - && int_rel.r_type != MIPS_R_RELHI) - r = _bfd_relocate_contents (howto, input_bfd, relocation, - (contents - + adjust - + int_rel.r_vaddr - - input_section->vma)); - else - { - mips_relocate_hi (&int_rel, - use_lo ? &lo_int_rel : NULL, - input_bfd, input_section, contents, - adjust, relocation, - int_rel.r_type == MIPS_R_RELHI); - r = bfd_reloc_ok; - } - } - - /* Adjust the reloc address. */ - int_rel.r_vaddr += (input_section->output_section->vma - + input_section->output_offset - - input_section->vma); - - /* Save the changed reloc information. */ - mips_ecoff_swap_reloc_out (input_bfd, &int_rel, (PTR) ext_rel); - } - else - { - /* We are producing a final executable. */ - if (int_rel.r_extern) - { - /* This is a reloc against a symbol. */ - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - asection *hsec; - - hsec = h->root.u.def.section; - relocation = (h->root.u.def.value - + hsec->output_section->vma - + hsec->output_offset); - } - else - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, - int_rel.r_vaddr - input_section->vma, true))) - return false; - relocation = 0; - } - } - else - { - /* This is a reloc against a section. */ - relocation = (s->output_section->vma - + s->output_offset - - s->vma); - - /* A PC relative reloc is already correct in the object - file. Make it look like a pcrel_offset relocation by - adding in the start address. */ - if (howto->pc_relative) - { - if (int_rel.r_type != MIPS_R_RELHI || ! use_lo) - relocation += int_rel.r_vaddr + adjust; - else - relocation += lo_int_rel.r_vaddr + adjust; - } - } - - if (int_rel.r_type != MIPS_R_REFHI - && int_rel.r_type != MIPS_R_RELHI) - r = _bfd_final_link_relocate (howto, - input_bfd, - input_section, - contents, - (int_rel.r_vaddr - - input_section->vma - + adjust), - relocation, - addend); - else - { - mips_relocate_hi (&int_rel, - use_lo ? &lo_int_rel : NULL, - input_bfd, input_section, contents, adjust, - relocation, - int_rel.r_type == MIPS_R_RELHI); - r = bfd_reloc_ok; - } - } - - /* MIPS_R_JMPADDR requires peculiar overflow detection. The - instruction provides a 28 bit address (the two lower bits are - implicit zeroes) which is combined with the upper four bits - of the instruction address. */ - if (r == bfd_reloc_ok - && int_rel.r_type == MIPS_R_JMPADDR - && (((relocation - + addend - + (int_rel.r_extern ? 0 : s->vma)) - & 0xf0000000) - != ((input_section->output_section->vma - + input_section->output_offset - + (int_rel.r_vaddr - input_section->vma) - + adjust) - & 0xf0000000))) - r = bfd_reloc_overflow; - - if (r != bfd_reloc_ok) - { - switch (r) - { - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - { - const char *name; - - if (int_rel.r_extern) - name = h->root.root.string; - else - name = bfd_section_name (input_bfd, s); - if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, - int_rel.r_vaddr - input_section->vma))) - return false; - } - break; - } - } - } - - return true; -} - -/* Read in the relocs for a section. */ - -static boolean -mips_read_relocs (abfd, sec) - bfd *abfd; - asection *sec; -{ - struct ecoff_section_tdata *section_tdata; - - section_tdata = ecoff_section_data (abfd, sec); - if (section_tdata == (struct ecoff_section_tdata *) NULL) - { - sec->used_by_bfd = - (PTR) bfd_alloc (abfd, sizeof (struct ecoff_section_tdata)); - if (sec->used_by_bfd == NULL) - return false; - - section_tdata = ecoff_section_data (abfd, sec); - section_tdata->external_relocs = NULL; - section_tdata->contents = NULL; - section_tdata->offsets = NULL; - } - - if (section_tdata->external_relocs == NULL) - { - bfd_size_type external_relocs_size; - - external_relocs_size = (ecoff_backend (abfd)->external_reloc_size - * sec->reloc_count); - - section_tdata->external_relocs = - (PTR) bfd_alloc (abfd, external_relocs_size); - if (section_tdata->external_relocs == NULL && external_relocs_size != 0) - return false; - - if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0 - || (bfd_read (section_tdata->external_relocs, 1, - external_relocs_size, abfd) - != external_relocs_size)) - return false; - } - - return true; -} - -/* Relax a section when linking a MIPS ECOFF file. This is used for - embedded PIC code, which always uses PC relative branches which - only have an 18 bit range on MIPS. If a branch is not in range, we - generate a long instruction sequence to compensate. Each time we - find a branch to expand, we have to check all the others again to - make sure they are still in range. This is slow, but it only has - to be done when -relax is passed to the linker. - - This routine figures out which branches need to expand; the actual - expansion is done in mips_relocate_section when the section - contents are relocated. The information is stored in the offsets - field of the ecoff_section_tdata structure. An offset of 1 means - that the branch must be expanded into a multi-instruction PC - relative branch (such an offset will only occur for a PC relative - branch to an external symbol). Any other offset must be a multiple - of four, and is the amount to change the branch by (such an offset - will only occur for a PC relative branch within the same section). - - We do not modify the section relocs or contents themselves so that - if memory usage becomes an issue we can discard them and read them - again. The only information we must save in memory between this - routine and the mips_relocate_section routine is the table of - offsets. */ - -static boolean -mips_relax_section (abfd, sec, info, again) - bfd *abfd; - asection *sec; - struct bfd_link_info *info; - boolean *again; -{ - struct ecoff_section_tdata *section_tdata; - bfd_byte *contents = NULL; - long *offsets; - struct external_reloc *ext_rel; - struct external_reloc *ext_rel_end; - unsigned int i; - - /* Assume we are not going to need another pass. */ - *again = false; - - /* If we are not generating an ECOFF file, this is much too - confusing to deal with. */ - if (info->hash->creator->flavour != bfd_get_flavour (abfd)) - return true; - - /* If there are no relocs, there is nothing to do. */ - if (sec->reloc_count == 0) - return true; - - /* We are only interested in PC relative relocs, and why would there - ever be one from anything but the .text section? */ - if (strcmp (bfd_get_section_name (abfd, sec), ".text") != 0) - return true; - - /* Read in the relocs, if we haven't already got them. */ - section_tdata = ecoff_section_data (abfd, sec); - if (section_tdata == (struct ecoff_section_tdata *) NULL - || section_tdata->external_relocs == NULL) - { - if (! mips_read_relocs (abfd, sec)) - goto error_return; - section_tdata = ecoff_section_data (abfd, sec); - } - - if (sec->_cooked_size == 0) - { - /* We must initialize _cooked_size only the first time we are - called. */ - sec->_cooked_size = sec->_raw_size; - } - - contents = section_tdata->contents; - offsets = section_tdata->offsets; - - /* Look for any external PC relative relocs. Internal PC relative - relocs are already correct in the object file, so they certainly - can not overflow. */ - ext_rel = (struct external_reloc *) section_tdata->external_relocs; - ext_rel_end = ext_rel + sec->reloc_count; - for (i = 0; ext_rel < ext_rel_end; ext_rel++, i++) - { - struct internal_reloc int_rel; - struct ecoff_link_hash_entry *h; - asection *hsec; - bfd_signed_vma relocation; - struct external_reloc *adj_ext_rel; - unsigned int adj_i; - unsigned long ext_count; - struct ecoff_link_hash_entry **adj_h_ptr; - struct ecoff_link_hash_entry **adj_h_ptr_end; - struct ecoff_value_adjust *adjust; - - /* If we have already expanded this reloc, we certainly don't - need to do it again. */ - if (offsets != (long *) NULL && offsets[i] == 1) - continue; - - /* Quickly check that this reloc is external PCREL16. */ - if (bfd_header_big_endian (abfd)) - { - if ((ext_rel->r_bits[3] & RELOC_BITS3_EXTERN_BIG) == 0 - || (((ext_rel->r_bits[3] & RELOC_BITS3_TYPE_BIG) - >> RELOC_BITS3_TYPE_SH_BIG) - != MIPS_R_PCREL16)) - continue; - } - else - { - if ((ext_rel->r_bits[3] & RELOC_BITS3_EXTERN_LITTLE) == 0 - || (((ext_rel->r_bits[3] & RELOC_BITS3_TYPE_LITTLE) - >> RELOC_BITS3_TYPE_SH_LITTLE) - != MIPS_R_PCREL16)) - continue; - } - - mips_ecoff_swap_reloc_in (abfd, (PTR) ext_rel, &int_rel); - - h = ecoff_data (abfd)->sym_hashes[int_rel.r_symndx]; - if (h == (struct ecoff_link_hash_entry *) NULL) - abort (); - - if (h->root.type != bfd_link_hash_defined - && h->root.type != bfd_link_hash_defweak) - { - /* Just ignore undefined symbols. These will presumably - generate an error later in the link. */ - continue; - } - - /* Get the value of the symbol. */ - hsec = h->root.u.def.section; - relocation = (h->root.u.def.value - + hsec->output_section->vma - + hsec->output_offset); - - /* Subtract out the current address. */ - relocation -= (sec->output_section->vma - + sec->output_offset - + (int_rel.r_vaddr - sec->vma)); - - /* The addend is stored in the object file. In the normal case - of ``bal symbol'', the addend will be -4. It will only be - different in the case of ``bal symbol+constant''. To avoid - always reading in the section contents, we don't check the - addend in the object file (we could easily check the contents - if we happen to have already read them in, but I fear that - this could be confusing). This means we will screw up if - there is a branch to a symbol that is in range, but added to - a constant which puts it out of range; in such a case the - link will fail with a reloc overflow error. Since the - compiler will never generate such code, it should be easy - enough to work around it by changing the assembly code in the - source file. */ - relocation -= 4; - - /* Now RELOCATION is the number we want to put in the object - file. See whether it fits. */ - if (relocation >= -0x20000 && relocation < 0x20000) - continue; - - /* Now that we know this reloc needs work, which will rarely - happen, go ahead and grab the section contents. */ - if (contents == (bfd_byte *) NULL) - { - if (info->keep_memory) - contents = (bfd_byte *) bfd_alloc (abfd, sec->_raw_size); - else - contents = (bfd_byte *) bfd_malloc ((size_t) sec->_raw_size); - if (contents == (bfd_byte *) NULL) - goto error_return; - if (! bfd_get_section_contents (abfd, sec, (PTR) contents, - (file_ptr) 0, sec->_raw_size)) - goto error_return; - if (info->keep_memory) - section_tdata->contents = contents; - } - - /* We only support changing the bal instruction. It would be - possible to handle other PC relative branches, but some of - them (the conditional branches) would require a different - length instruction sequence which would complicate both this - routine and mips_relax_pcrel16. It could be written if - somebody felt it were important. Ignoring this reloc will - presumably cause a reloc overflow error later on. */ - if (bfd_get_32 (abfd, contents + int_rel.r_vaddr - sec->vma) - != 0x0411ffff) /* bgezal $0,. == bal . */ - continue; - - /* Bother. We need to expand this reloc, and we will need to - make another relaxation pass since this change may put other - relocs out of range. We need to examine the local branches - and we need to allocate memory to hold the offsets we must - add to them. We also need to adjust the values of all - symbols in the object file following this location. */ - - sec->_cooked_size += PCREL16_EXPANSION_ADJUSTMENT; - *again = true; - - if (offsets == (long *) NULL) - { - size_t size; - - size = sec->reloc_count * sizeof (long); - offsets = (long *) bfd_alloc (abfd, size); - if (offsets == (long *) NULL) - goto error_return; - memset (offsets, 0, size); - section_tdata->offsets = offsets; - } - - offsets[i] = 1; - - /* Now look for all PC relative references that cross this reloc - and adjust their offsets. */ - adj_ext_rel = (struct external_reloc *) section_tdata->external_relocs; - for (adj_i = 0; adj_ext_rel < ext_rel_end; adj_ext_rel++, adj_i++) - { - struct internal_reloc adj_int_rel; - bfd_vma start, stop; - int change; - - mips_ecoff_swap_reloc_in (abfd, (PTR) adj_ext_rel, &adj_int_rel); - - if (adj_int_rel.r_type == MIPS_R_PCREL16) - { - unsigned long insn; - - /* We only care about local references. External ones - will be relocated correctly anyhow. */ - if (adj_int_rel.r_extern) - continue; - - /* We are only interested in a PC relative reloc within - this section. FIXME: Cross section PC relative - relocs may not be handled correctly; does anybody - care? */ - if (adj_int_rel.r_symndx != RELOC_SECTION_TEXT) - continue; - - start = adj_int_rel.r_vaddr; - - insn = bfd_get_32 (abfd, - contents + adj_int_rel.r_vaddr - sec->vma); - - stop = (insn & 0xffff) << 2; - if ((stop & 0x20000) != 0) - stop -= 0x40000; - stop += adj_int_rel.r_vaddr + 4; - } - else if (adj_int_rel.r_type == MIPS_R_RELHI) - { - struct internal_reloc rello; - long addhi, addlo; - - /* The next reloc must be MIPS_R_RELLO, and we handle - them together. */ - BFD_ASSERT (adj_ext_rel + 1 < ext_rel_end); - - mips_ecoff_swap_reloc_in (abfd, (PTR) (adj_ext_rel + 1), &rello); - - BFD_ASSERT (rello.r_type == MIPS_R_RELLO); - - addhi = bfd_get_32 (abfd, - contents + adj_int_rel.r_vaddr - sec->vma); - addhi &= 0xffff; - if (addhi & 0x8000) - addhi -= 0x10000; - addhi <<= 16; - - addlo = bfd_get_32 (abfd, contents + rello.r_vaddr - sec->vma); - addlo &= 0xffff; - if (addlo & 0x8000) - addlo -= 0x10000; - - if (adj_int_rel.r_extern) - { - /* The value we want here is - sym - RELLOaddr + addend - which we can express as - sym - (RELLOaddr - addend) - Therefore if we are expanding the area between - RELLOaddr and RELLOaddr - addend we must adjust - the addend. This is admittedly ambiguous, since - we might mean (sym + addend) - RELLOaddr, but in - practice we don't, and there is no way to handle - that case correctly since at this point we have - no idea whether any reloc is being expanded - between sym and sym + addend. */ - start = rello.r_vaddr - (addhi + addlo); - stop = rello.r_vaddr; - } - else - { - /* An internal RELHI/RELLO pair represents the - difference between two addresses, $LC0 - foo. - The symndx value is actually the difference - between the reloc address and $LC0. This lets us - compute $LC0, and, by considering the addend, - foo. If the reloc we are expanding falls between - those two relocs, we must adjust the addend. At - this point, the symndx value is actually in the - r_offset field, where it was put by - mips_ecoff_swap_reloc_in. */ - start = rello.r_vaddr - adj_int_rel.r_offset; - stop = start + addhi + addlo; - } - } - else if (adj_int_rel.r_type == MIPS_R_SWITCH) - { - /* A MIPS_R_SWITCH reloc represents a word of the form - .word $L3-$LS12 - The value in the object file is correct, assuming the - original value of $L3. The symndx value is actually - the difference between the reloc address and $LS12. - This lets us compute the original value of $LS12 as - vaddr - symndx - and the original value of $L3 as - vaddr - symndx + addend - where addend is the value from the object file. At - this point, the symndx value is actually found in the - r_offset field, since it was moved by - mips_ecoff_swap_reloc_in. */ - start = adj_int_rel.r_vaddr - adj_int_rel.r_offset; - stop = start + bfd_get_32 (abfd, - (contents - + adj_int_rel.r_vaddr - - sec->vma)); - } - else - continue; - - /* If the range expressed by this reloc, which is the - distance between START and STOP crosses the reloc we are - expanding, we must adjust the offset. The sign of the - adjustment depends upon the direction in which the range - crosses the reloc being expanded. */ - if (start <= int_rel.r_vaddr && stop > int_rel.r_vaddr) - change = PCREL16_EXPANSION_ADJUSTMENT; - else if (start > int_rel.r_vaddr && stop <= int_rel.r_vaddr) - change = - PCREL16_EXPANSION_ADJUSTMENT; - else - change = 0; - - offsets[adj_i] += change; - - if (adj_int_rel.r_type == MIPS_R_RELHI) - { - adj_ext_rel++; - adj_i++; - offsets[adj_i] += change; - } - } - - /* Find all symbols in this section defined by this object file - and adjust their values. Note that we decide whether to - adjust the value based on the value stored in the ECOFF EXTR - structure, because the value stored in the hash table may - have been changed by an earlier expanded reloc and thus may - no longer correctly indicate whether the symbol is before or - after the expanded reloc. */ - ext_count = ecoff_data (abfd)->debug_info.symbolic_header.iextMax; - adj_h_ptr = ecoff_data (abfd)->sym_hashes; - adj_h_ptr_end = adj_h_ptr + ext_count; - for (; adj_h_ptr < adj_h_ptr_end; adj_h_ptr++) - { - struct ecoff_link_hash_entry *adj_h; - - adj_h = *adj_h_ptr; - if (adj_h != (struct ecoff_link_hash_entry *) NULL - && (adj_h->root.type == bfd_link_hash_defined - || adj_h->root.type == bfd_link_hash_defweak) - && adj_h->root.u.def.section == sec - && adj_h->esym.asym.value > int_rel.r_vaddr) - adj_h->root.u.def.value += PCREL16_EXPANSION_ADJUSTMENT; - } - - /* Add an entry to the symbol value adjust list. This is used - by bfd_ecoff_debug_accumulate to adjust the values of - internal symbols and FDR's. */ - adjust = ((struct ecoff_value_adjust *) - bfd_alloc (abfd, sizeof (struct ecoff_value_adjust))); - if (adjust == (struct ecoff_value_adjust *) NULL) - goto error_return; - - adjust->start = int_rel.r_vaddr; - adjust->end = sec->vma + sec->_raw_size; - adjust->adjust = PCREL16_EXPANSION_ADJUSTMENT; - - adjust->next = ecoff_data (abfd)->debug_info.adjust; - ecoff_data (abfd)->debug_info.adjust = adjust; - } - - if (contents != (bfd_byte *) NULL && ! info->keep_memory) - free (contents); - - return true; - - error_return: - if (contents != (bfd_byte *) NULL && ! info->keep_memory) - free (contents); - return false; -} - -/* This routine is called from mips_relocate_section when a PC - relative reloc must be expanded into the five instruction sequence. - It handles all the details of the expansion, including resolving - the reloc. */ - -static boolean -mips_relax_pcrel16 (info, input_bfd, input_section, h, location, address) - struct bfd_link_info *info ATTRIBUTE_UNUSED; - bfd *input_bfd; - asection *input_section ATTRIBUTE_UNUSED; - struct ecoff_link_hash_entry *h; - bfd_byte *location; - bfd_vma address; -{ - bfd_vma relocation; - - /* 0x0411ffff is bgezal $0,. == bal . */ - BFD_ASSERT (bfd_get_32 (input_bfd, location) == 0x0411ffff); - - /* We need to compute the distance between the symbol and the - current address plus eight. */ - relocation = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - relocation -= address + 8; - - /* If the lower half is negative, increment the upper 16 half. */ - if ((relocation & 0x8000) != 0) - relocation += 0x10000; - - bfd_put_32 (input_bfd, 0x04110001, location); /* bal .+8 */ - bfd_put_32 (input_bfd, - 0x3c010000 | ((relocation >> 16) & 0xffff), /* lui $at,XX */ - location + 4); - bfd_put_32 (input_bfd, - 0x24210000 | (relocation & 0xffff), /* addiu $at,$at,XX */ - location + 8); - bfd_put_32 (input_bfd, 0x003f0821, location + 12); /* addu $at,$at,$ra */ - bfd_put_32 (input_bfd, 0x0020f809, location + 16); /* jalr $at */ - - return true; -} - -/* Given a .sdata section and a .rel.sdata in-memory section, store - relocation information into the .rel.sdata section which can be - used at runtime to relocate the section. This is called by the - linker when the --embedded-relocs switch is used. This is called - after the add_symbols entry point has been called for all the - objects, and before the final_link entry point is called. This - function presumes that the object was compiled using - -membedded-pic. */ - -boolean -bfd_mips_ecoff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) - bfd *abfd; - struct bfd_link_info *info; - asection *datasec; - asection *relsec; - char **errmsg; -{ - struct ecoff_link_hash_entry **sym_hashes; - struct ecoff_section_tdata *section_tdata; - struct external_reloc *ext_rel; - struct external_reloc *ext_rel_end; - bfd_byte *p; - - BFD_ASSERT (! info->relocateable); - - *errmsg = NULL; - - if (datasec->reloc_count == 0) - return true; - - sym_hashes = ecoff_data (abfd)->sym_hashes; - - if (! mips_read_relocs (abfd, datasec)) - return false; - - relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 4); - if (relsec->contents == NULL) - return false; - - p = relsec->contents; - - section_tdata = ecoff_section_data (abfd, datasec); - ext_rel = (struct external_reloc *) section_tdata->external_relocs; - ext_rel_end = ext_rel + datasec->reloc_count; - for (; ext_rel < ext_rel_end; ext_rel++, p += 4) - { - struct internal_reloc int_rel; - boolean text_relative; - - mips_ecoff_swap_reloc_in (abfd, (PTR) ext_rel, &int_rel); - - /* We are going to write a four byte word into the runtime reloc - section. The word will be the address in the data section - which must be relocated. This must be on a word boundary, - which means the lower two bits must be zero. We use the - least significant bit to indicate how the value in the data - section must be relocated. A 0 means that the value is - relative to the text section, while a 1 indicates that the - value is relative to the data section. Given that we are - assuming the code was compiled using -membedded-pic, there - should not be any other possibilities. */ - - /* We can only relocate REFWORD relocs at run time. */ - if (int_rel.r_type != MIPS_R_REFWORD) - { - *errmsg = _("unsupported reloc type"); - bfd_set_error (bfd_error_bad_value); - return false; - } - - if (int_rel.r_extern) - { - struct ecoff_link_hash_entry *h; - - h = sym_hashes[int_rel.r_symndx]; - /* If h is NULL, that means that there is a reloc against an - external symbol which we thought was just a debugging - symbol. This should not happen. */ - if (h == (struct ecoff_link_hash_entry *) NULL) - abort (); - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && (h->root.u.def.section->flags & SEC_CODE) != 0) - text_relative = true; - else - text_relative = false; - } - else - { - switch (int_rel.r_symndx) - { - case RELOC_SECTION_TEXT: - text_relative = true; - break; - case RELOC_SECTION_SDATA: - case RELOC_SECTION_SBSS: - case RELOC_SECTION_LIT8: - text_relative = false; - break; - default: - /* No other sections should appear in -membedded-pic - code. */ - *errmsg = _("reloc against unsupported section"); - bfd_set_error (bfd_error_bad_value); - return false; - } - } - - if ((int_rel.r_offset & 3) != 0) - { - *errmsg = _("reloc not properly aligned"); - bfd_set_error (bfd_error_bad_value); - return false; - } - - bfd_put_32 (abfd, - (int_rel.r_vaddr - datasec->vma + datasec->output_offset - + (text_relative ? 0 : 1)), - p); - } - - return true; -} - -/* This is the ECOFF backend structure. The backend field of the - target vector points to this. */ - -static const struct ecoff_backend_data mips_ecoff_backend_data = -{ - /* COFF backend structure. */ - { - (void (*) PARAMS ((bfd *,PTR,int,int,int,int,PTR))) bfd_void, /* aux_in */ - (void (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* sym_in */ - (void (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* lineno_in */ - (unsigned (*) PARAMS ((bfd *,PTR,int,int,int,int,PTR)))bfd_void,/*aux_out*/ - (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* sym_out */ - (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* lineno_out */ - (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */ - mips_ecoff_swap_filehdr_out, mips_ecoff_swap_aouthdr_out, - mips_ecoff_swap_scnhdr_out, - FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true, false, 4, - mips_ecoff_swap_filehdr_in, mips_ecoff_swap_aouthdr_in, - mips_ecoff_swap_scnhdr_in, NULL, - mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook, - _bfd_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags, - _bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL - }, - /* Supported architecture. */ - bfd_arch_mips, - /* Initial portion of armap string. */ - "__________", - /* The page boundary used to align sections in a demand-paged - executable file. E.g., 0x1000. */ - 0x1000, - /* True if the .rdata section is part of the text segment, as on the - Alpha. False if .rdata is part of the data segment, as on the - MIPS. */ - false, - /* Bitsize of constructor entries. */ - 32, - /* Reloc to use for constructor entries. */ - &mips_howto_table[MIPS_R_REFWORD], - { - /* Symbol table magic number. */ - magicSym, - /* Alignment of debugging information. E.g., 4. */ - 4, - /* Sizes of external symbolic information. */ - sizeof (struct hdr_ext), - sizeof (struct dnr_ext), - sizeof (struct pdr_ext), - sizeof (struct sym_ext), - sizeof (struct opt_ext), - sizeof (struct fdr_ext), - sizeof (struct rfd_ext), - sizeof (struct ext_ext), - /* Functions to swap in external symbolic data. */ - ecoff_swap_hdr_in, - ecoff_swap_dnr_in, - ecoff_swap_pdr_in, - ecoff_swap_sym_in, - ecoff_swap_opt_in, - ecoff_swap_fdr_in, - ecoff_swap_rfd_in, - ecoff_swap_ext_in, - _bfd_ecoff_swap_tir_in, - _bfd_ecoff_swap_rndx_in, - /* Functions to swap out external symbolic data. */ - ecoff_swap_hdr_out, - ecoff_swap_dnr_out, - ecoff_swap_pdr_out, - ecoff_swap_sym_out, - ecoff_swap_opt_out, - ecoff_swap_fdr_out, - ecoff_swap_rfd_out, - ecoff_swap_ext_out, - _bfd_ecoff_swap_tir_out, - _bfd_ecoff_swap_rndx_out, - /* Function to read in symbolic data. */ - _bfd_ecoff_slurp_symbolic_info - }, - /* External reloc size. */ - RELSZ, - /* Reloc swapping functions. */ - mips_ecoff_swap_reloc_in, - mips_ecoff_swap_reloc_out, - /* Backend reloc tweaking. */ - mips_adjust_reloc_in, - mips_adjust_reloc_out, - /* Relocate section contents while linking. */ - mips_relocate_section, - /* Do final adjustments to filehdr and aouthdr. */ - NULL, - /* Read an element from an archive at a given file position. */ - _bfd_get_elt_at_filepos -}; - -/* Looking up a reloc type is MIPS specific. */ -#define _bfd_ecoff_bfd_reloc_type_lookup mips_bfd_reloc_type_lookup - -/* Getting relocated section contents is generic. */ -#define _bfd_ecoff_bfd_get_relocated_section_contents \ - bfd_generic_get_relocated_section_contents - -/* Handling file windows is generic. */ -#define _bfd_ecoff_get_section_contents_in_window \ - _bfd_generic_get_section_contents_in_window - -/* Relaxing sections is MIPS specific. */ -#define _bfd_ecoff_bfd_relax_section mips_relax_section - -/* GC of sections is not done. */ -#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections - -extern const bfd_target ecoff_big_vec; - -const bfd_target ecoff_little_vec = -{ - "ecoff-littlemips", /* name */ - bfd_target_ecoff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_LITTLE, /* header byte order is little */ - - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), - 0, /* leading underscore */ - ' ', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ - - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - _bfd_ecoff_archive_p, _bfd_dummy_target}, - {bfd_false, _bfd_ecoff_mkobject, /* bfd_set_format */ - _bfd_generic_mkarchive, bfd_false}, - {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (_bfd_ecoff), - BFD_JUMP_TABLE_COPY (_bfd_ecoff), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_ecoff), - BFD_JUMP_TABLE_SYMBOLS (_bfd_ecoff), - BFD_JUMP_TABLE_RELOCS (_bfd_ecoff), - BFD_JUMP_TABLE_WRITE (_bfd_ecoff), - BFD_JUMP_TABLE_LINK (_bfd_ecoff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - & ecoff_big_vec, - - (PTR) &mips_ecoff_backend_data -}; - -const bfd_target ecoff_big_vec = -{ - "ecoff-bigmips", /* name */ - bfd_target_ecoff_flavour, - BFD_ENDIAN_BIG, /* data byte order is big */ - BFD_ENDIAN_BIG, /* header byte order is big */ - - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), - 0, /* leading underscore */ - ' ', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - _bfd_ecoff_archive_p, _bfd_dummy_target}, - {bfd_false, _bfd_ecoff_mkobject, /* bfd_set_format */ - _bfd_generic_mkarchive, bfd_false}, - {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (_bfd_ecoff), - BFD_JUMP_TABLE_COPY (_bfd_ecoff), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_ecoff), - BFD_JUMP_TABLE_SYMBOLS (_bfd_ecoff), - BFD_JUMP_TABLE_RELOCS (_bfd_ecoff), - BFD_JUMP_TABLE_WRITE (_bfd_ecoff), - BFD_JUMP_TABLE_LINK (_bfd_ecoff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - & ecoff_little_vec, - - (PTR) &mips_ecoff_backend_data -}; - -const bfd_target ecoff_biglittle_vec = -{ - "ecoff-biglittlemips", /* name */ - bfd_target_ecoff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_BIG, /* header byte order is big */ - - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), - 0, /* leading underscore */ - ' ', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ - - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - _bfd_ecoff_archive_p, _bfd_dummy_target}, - {bfd_false, _bfd_ecoff_mkobject, /* bfd_set_format */ - _bfd_generic_mkarchive, bfd_false}, - {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (_bfd_ecoff), - BFD_JUMP_TABLE_COPY (_bfd_ecoff), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_ecoff), - BFD_JUMP_TABLE_SYMBOLS (_bfd_ecoff), - BFD_JUMP_TABLE_RELOCS (_bfd_ecoff), - BFD_JUMP_TABLE_WRITE (_bfd_ecoff), - BFD_JUMP_TABLE_LINK (_bfd_ecoff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - NULL, - - (PTR) &mips_ecoff_backend_data -}; diff --git a/contrib/binutils/bfd/coff-rs6000.c b/contrib/binutils/bfd/coff-rs6000.c deleted file mode 100644 index ed47000e1844..000000000000 --- a/contrib/binutils/bfd/coff-rs6000.c +++ /dev/null @@ -1,2358 +0,0 @@ -/* BFD back-end for IBM RS/6000 "XCOFF" files. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 - Free Software Foundation, Inc. - FIXME: Can someone provide a transliteration of this name into ASCII? - Using the following chars caused a compiler warning on HIUX (so I replaced - them with octal escapes), and isn't useful without an understanding of what - character set it is. - Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365, - and John Gilmore. - Archive support from Damon A. Permezel. - Contributed by IBM Corporation and Cygnus Support. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "coff/internal.h" -#include "coff/rs6000.h" -#include "libcoff.h" -#define TARGET_NAME "aixcoff-rs6000" -#define TARGET_SYM rs6000coff_vec -#include "xcoff-target.h" - -/* The main body of code is in coffcode.h. */ - -static const char *normalize_filename PARAMS ((bfd *)); - -/* We use our own tdata type. Its first field is the COFF tdata type, - so the COFF routines are compatible. */ - -boolean -_bfd_xcoff_mkobject (abfd) - bfd *abfd; -{ - coff_data_type *coff; - - abfd->tdata.xcoff_obj_data = - ((struct xcoff_tdata *) - bfd_zalloc (abfd, sizeof (struct xcoff_tdata))); - if (abfd->tdata.xcoff_obj_data == NULL) - return false; - coff = coff_data (abfd); - coff->symbols = (coff_symbol_type *) NULL; - coff->conversion_table = (unsigned int *) NULL; - coff->raw_syments = (struct coff_ptr_struct *) NULL; - coff->relocbase = 0; - - xcoff_data (abfd)->modtype = ('1' << 8) | 'L'; - - /* We set cputype to -1 to indicate that it has not been - initialized. */ - xcoff_data (abfd)->cputype = -1; - - xcoff_data (abfd)->csects = NULL; - xcoff_data (abfd)->debug_indices = NULL; - - return true; -} - -/* Copy XCOFF data from one BFD to another. */ - -boolean -_bfd_xcoff_copy_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; -{ - struct xcoff_tdata *ix, *ox; - asection *sec; - - if (ibfd->xvec != obfd->xvec) - return true; - ix = xcoff_data (ibfd); - ox = xcoff_data (obfd); - ox->full_aouthdr = ix->full_aouthdr; - ox->toc = ix->toc; - if (ix->sntoc == 0) - ox->sntoc = 0; - else - { - sec = coff_section_from_bfd_index (ibfd, ix->sntoc); - if (sec == NULL) - ox->sntoc = 0; - else - ox->sntoc = sec->output_section->target_index; - } - if (ix->snentry == 0) - ox->snentry = 0; - else - { - sec = coff_section_from_bfd_index (ibfd, ix->snentry); - if (sec == NULL) - ox->snentry = 0; - else - ox->snentry = sec->output_section->target_index; - } - ox->text_align_power = ix->text_align_power; - ox->data_align_power = ix->data_align_power; - ox->modtype = ix->modtype; - ox->cputype = ix->cputype; - ox->maxdata = ix->maxdata; - ox->maxstack = ix->maxstack; - return true; -} - -/* I don't think XCOFF really has a notion of local labels based on - name. This will mean that ld -X doesn't actually strip anything. - The AIX native linker does not have a -X option, and it ignores the - -x option. */ - -boolean -_bfd_xcoff_is_local_label_name (abfd, name) - bfd *abfd ATTRIBUTE_UNUSED; - const char *name ATTRIBUTE_UNUSED; -{ - return false; -} - -void -_bfd_xcoff_swap_sym_in (abfd, ext1, in1) - bfd *abfd; - PTR ext1; - PTR in1; -{ - SYMENT *ext = (SYMENT *)ext1; - struct internal_syment *in = (struct internal_syment *)in1; - - if (ext->e.e_name[0] != 0) - { - memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN); - } - else - { - in->_n._n_n._n_zeroes = 0; - in->_n._n_n._n_offset = - bfd_h_get_32(abfd, (bfd_byte *) ext->e.e.e_offset); - } - - in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value); - in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum); - in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type); - in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass); - in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux); -} - -unsigned int -_bfd_xcoff_swap_sym_out (abfd, inp, extp) - bfd *abfd; - PTR inp; - PTR extp; -{ - struct internal_syment *in = (struct internal_syment *)inp; - SYMENT *ext =(SYMENT *)extp; - - if (in->_n._n_name[0] != 0) - { - memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN); - } - else - { - bfd_h_put_32(abfd, 0, (bfd_byte *) ext->e.e.e_zeroes); - bfd_h_put_32(abfd, in->_n._n_n._n_offset, - (bfd_byte *) ext->e.e.e_offset); - } - - bfd_h_put_32(abfd, in->n_value , (bfd_byte *) ext->e_value); - bfd_h_put_16(abfd, in->n_scnum , (bfd_byte *) ext->e_scnum); - bfd_h_put_16(abfd, in->n_type , (bfd_byte *) ext->e_type); - bfd_h_put_8(abfd, in->n_sclass , ext->e_sclass); - bfd_h_put_8(abfd, in->n_numaux , ext->e_numaux); - return bfd_coff_symesz (abfd); -} - -#define PUTWORD bfd_h_put_32 -#define PUTHALF bfd_h_put_16 -#define PUTBYTE bfd_h_put_8 -#define GETWORD bfd_h_get_32 -#define GETHALF bfd_h_get_16 -#define GETBYTE bfd_h_get_8 - -void -_bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) - bfd *abfd; - PTR ext1; - int type; - int class; - int indx; - int numaux; - PTR in1; -{ - AUXENT *ext = (AUXENT *)ext1; - union internal_auxent *in = (union internal_auxent *)in1; - - switch (class) { - case C_FILE: - if (ext->x_file.x_fname[0] == 0) { - in->x_file.x_n.x_zeroes = 0; - in->x_file.x_n.x_offset = - bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset); - } else { - if (numaux > 1) - { - if (indx == 0) - memcpy (in->x_file.x_fname, ext->x_file.x_fname, - numaux * sizeof (AUXENT)); - } - else - { - memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN); - } - } - goto end; - - /* RS/6000 "csect" auxents */ - case C_EXT: - case C_HIDEXT: - if (indx + 1 == numaux) - { - in->x_csect.x_scnlen.l = - bfd_h_get_32 (abfd, ext->x_csect.x_scnlen); - in->x_csect.x_parmhash = bfd_h_get_32 (abfd, - ext->x_csect.x_parmhash); - in->x_csect.x_snhash = bfd_h_get_16 (abfd, ext->x_csect.x_snhash); - /* We don't have to hack bitfields in x_smtyp because it's - defined by shifts-and-ands, which are equivalent on all - byte orders. */ - in->x_csect.x_smtyp = bfd_h_get_8 (abfd, ext->x_csect.x_smtyp); - in->x_csect.x_smclas = bfd_h_get_8 (abfd, ext->x_csect.x_smclas); - in->x_csect.x_stab = bfd_h_get_32 (abfd, ext->x_csect.x_stab); - in->x_csect.x_snstab = bfd_h_get_16 (abfd, ext->x_csect.x_snstab); - goto end; - } - break; - - case C_STAT: - case C_LEAFSTAT: - case C_HIDDEN: - if (type == T_NULL) { - in->x_scn.x_scnlen = bfd_h_get_32(abfd, - (bfd_byte *) ext->x_scn.x_scnlen); - in->x_scn.x_nreloc = bfd_h_get_16(abfd, - (bfd_byte *) ext->x_scn.x_nreloc); - in->x_scn.x_nlinno = bfd_h_get_16(abfd, - (bfd_byte *) ext->x_scn.x_nlinno); - /* PE defines some extra fields; we zero them out for - safety. */ - in->x_scn.x_checksum = 0; - in->x_scn.x_associated = 0; - in->x_scn.x_comdat = 0; - - goto end; - } - break; - } - - in->x_sym.x_tagndx.l = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_tagndx); - in->x_sym.x_tvndx = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_tvndx); - - if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) - { - in->x_sym.x_fcnary.x_fcn.x_lnnoptr = bfd_h_get_32(abfd, (bfd_byte *) - ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); - in->x_sym.x_fcnary.x_fcn.x_endndx.l = bfd_h_get_32(abfd, (bfd_byte *) - ext->x_sym.x_fcnary.x_fcn.x_endndx); - } - else - { - in->x_sym.x_fcnary.x_ary.x_dimen[0] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]); - in->x_sym.x_fcnary.x_ary.x_dimen[1] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]); - in->x_sym.x_fcnary.x_ary.x_dimen[2] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]); - in->x_sym.x_fcnary.x_ary.x_dimen[3] = - bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]); - } - if (ISFCN(type)) { - in->x_sym.x_misc.x_fsize = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize); - } - else { - in->x_sym.x_misc.x_lnsz.x_lnno = bfd_h_get_16(abfd, (bfd_byte *) - ext->x_sym.x_misc.x_lnsz.x_lnno); - in->x_sym.x_misc.x_lnsz.x_size = bfd_h_get_16(abfd, (bfd_byte *) - ext->x_sym.x_misc.x_lnsz.x_size); - } - -end: ; - /* the semicolon is because MSVC doesn't like labels at - end of block. */ - -} - -unsigned int -_bfd_xcoff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) - bfd *abfd; - PTR inp; - int type; - int class; - int indx ATTRIBUTE_UNUSED; - int numaux ATTRIBUTE_UNUSED; - PTR extp; -{ - union internal_auxent *in = (union internal_auxent *)inp; - AUXENT *ext = (AUXENT *)extp; - - memset((PTR)ext, 0, bfd_coff_auxesz (abfd)); - switch (class) - { - case C_FILE: - if (in->x_file.x_fname[0] == 0) - { - PUTWORD(abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes); - PUTWORD(abfd, - in->x_file.x_n.x_offset, - (bfd_byte *) ext->x_file.x_n.x_offset); - } - else - { - memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN); - } - goto end; - - /* RS/6000 "csect" auxents */ - case C_EXT: - case C_HIDEXT: - if (indx + 1 == numaux) - { - PUTWORD (abfd, in->x_csect.x_scnlen.l,ext->x_csect.x_scnlen); - PUTWORD (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash); - PUTHALF (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash); - /* We don't have to hack bitfields in x_smtyp because it's - defined by shifts-and-ands, which are equivalent on all - byte orders. */ - PUTBYTE (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp); - PUTBYTE (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas); - PUTWORD (abfd, in->x_csect.x_stab, ext->x_csect.x_stab); - PUTHALF (abfd, in->x_csect.x_snstab, ext->x_csect.x_snstab); - goto end; - } - break; - - case C_STAT: - case C_LEAFSTAT: - case C_HIDDEN: - if (type == T_NULL) { - bfd_h_put_32(abfd, in->x_scn.x_scnlen, (bfd_byte *) ext->x_scn.x_scnlen); - bfd_h_put_16(abfd, in->x_scn.x_nreloc, (bfd_byte *) ext->x_scn.x_nreloc); - bfd_h_put_16(abfd, in->x_scn.x_nlinno, (bfd_byte *) ext->x_scn.x_nlinno); - goto end; - } - break; - } - - PUTWORD(abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx); - bfd_h_put_16 (abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx); - - if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) - { - bfd_h_put_32(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, - (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr); - PUTWORD(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, - (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx); - } - else - { - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]); - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]); - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]); - bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3], - (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]); - } - - if (ISFCN (type)) - PUTWORD (abfd, in->x_sym.x_misc.x_fsize, - (bfd_byte *) ext->x_sym.x_misc.x_fsize); - else - { - bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_lnno, - (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno); - bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_size, - (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_size); - } - -end: - return bfd_coff_auxesz (abfd); -} - -/* The XCOFF reloc table. Actually, XCOFF relocations specify the - bitsize and whether they are signed or not, along with a - conventional type. This table is for the types, which are used for - different algorithms for putting in the reloc. Many of these - relocs need special_function entries, which I have not written. */ - -/* In case we're on a 32-bit machine, construct a 64-bit "-1" value - from smaller values. Start with zero, widen, *then* decrement. */ -#define MINUS_ONE (((bfd_vma)0) - 1) - -reloc_howto_type xcoff_howto_table[] = -{ - /* Standard 32 bit relocation. */ - HOWTO (0, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_POS", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit relocation, but store negative value. */ - HOWTO (1, /* type */ - 0, /* rightshift */ - -2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_NEG", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit PC relative relocation. */ - HOWTO (2, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - 0, /* special_function */ - "R_REL", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit TOC relative relocation. */ - HOWTO (3, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_TOC", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* I don't really know what this is. */ - HOWTO (4, /* type */ - 1, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RTB", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* External TOC relative symbol. */ - HOWTO (5, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_GL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Local TOC relative symbol. */ - HOWTO (6, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_TCL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - EMPTY_HOWTO (7), - - /* Non modifiable absolute branch. */ - HOWTO (8, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_BA", /* name */ - true, /* partial_inplace */ - 0x3fffffc, /* src_mask */ - 0x3fffffc, /* dst_mask */ - false), /* pcrel_offset */ - - EMPTY_HOWTO (9), - - /* Non modifiable relative branch. */ - HOWTO (0xa, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - 0, /* special_function */ - "R_BR", /* name */ - true, /* partial_inplace */ - 0x3fffffc, /* src_mask */ - 0x3fffffc, /* dst_mask */ - false), /* pcrel_offset */ - - EMPTY_HOWTO (0xb), - - /* Indirect load. */ - HOWTO (0xc, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Load address. */ - HOWTO (0xd, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RLA", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - EMPTY_HOWTO (0xe), - - /* Non-relocating reference. */ - HOWTO (0xf, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_REF", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - EMPTY_HOWTO (0x10), - EMPTY_HOWTO (0x11), - - /* TOC relative indirect load. */ - HOWTO (0x12, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_TRL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* TOC relative load address. */ - HOWTO (0x13, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_TRLA", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Modifiable relative branch. */ - HOWTO (0x14, /* type */ - 1, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RRTBI", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Modifiable absolute branch. */ - HOWTO (0x15, /* type */ - 1, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RRTBA", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Modifiable call absolute indirect. */ - HOWTO (0x16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_CAI", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Modifiable call relative. */ - HOWTO (0x17, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_CREL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Modifiable branch absolute. */ - HOWTO (0x18, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RBA", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Modifiable branch absolute. */ - HOWTO (0x19, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RBAC", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Modifiable branch relative. */ - HOWTO (0x1a, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - 0, /* special_function */ - "R_RBR", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Modifiable branch absolute. */ - HOWTO (0x1b, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_RBRC", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - HOWTO (0, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_POS", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false) /* pcrel_offset */ - -}; - -/* These are the first two like the above but for 16-bit relocs. */ -static reloc_howto_type xcoff_howto_table_16[] = -{ - /* Standard 16 bit relocation. */ - HOWTO (0, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_POS_16", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit relocation, but store negative value. */ - HOWTO (1, /* type */ - 0, /* rightshift */ - -2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_NEG_16", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit PC relative relocation. */ - HOWTO (2, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - 0, /* special_function */ - "R_REL_16", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false) /* pcrel_offset */ - }; - -void -_bfd_xcoff_rtype2howto (relent, internal) - arelent *relent; - struct internal_reloc *internal; -{ - relent->howto = xcoff_howto_table + internal->r_type; - - if (relent->howto->bitsize != ((unsigned int) internal->r_size & 0x1f) + 1 - && (internal->r_type - < sizeof (xcoff_howto_table_16)/sizeof (xcoff_howto_table_16[0]))) - relent->howto = xcoff_howto_table_16 + internal->r_type; - - /* The r_size field of an XCOFF reloc encodes the bitsize of the - relocation, as well as indicating whether it is signed or not. - Doublecheck that the relocation information gathered from the - type matches this information. The bitsize is not significant - for R_REF relocs. */ - if (relent->howto->dst_mask != 0 - && (relent->howto->bitsize - != ((unsigned int) internal->r_size & 0x3f) + 1)) - abort (); -#if 0 - if ((internal->r_size & 0x80) != 0 - ? (relent->howto->complain_on_overflow != complain_overflow_signed) - : (relent->howto->complain_on_overflow != complain_overflow_bitfield)) - abort (); -#endif -} - -reloc_howto_type * -_bfd_xcoff_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; -{ - switch (code) - { - case BFD_RELOC_PPC_B26: - return &xcoff_howto_table[0xa]; - case BFD_RELOC_PPC_BA26: - return &xcoff_howto_table[8]; - case BFD_RELOC_PPC_TOC16: - return &xcoff_howto_table[3]; - case BFD_RELOC_32: - case BFD_RELOC_CTOR: - return &xcoff_howto_table[0]; - case BFD_RELOC_64: - return &xcoff_howto_table[0x1c]; - default: - return NULL; - } -} - -/* XCOFF archive support. The original version of this code was by - Damon A. Permezel. It was enhanced to permit cross support, and - writing archive files, by Ian Lance Taylor, Cygnus Support. - - XCOFF uses its own archive format. Everything is hooked together - with file offset links, so it is possible to rapidly update an - archive in place. Of course, we don't do that. An XCOFF archive - has a real file header, not just an ARMAG string. The structure of - the file header and of each archive header appear below. - - An XCOFF archive also has a member table, which is a list of - elements in the archive (you can get that by looking through the - linked list, but you have to read a lot more of the file). The - member table has a normal archive header with an empty name. It is - normally (and perhaps must be) the second to last entry in the - archive. The member table data is almost printable ASCII. It - starts with a 12 character decimal string which is the number of - entries in the table. For each entry it has a 12 character decimal - string which is the offset in the archive of that member. These - entries are followed by a series of null terminated strings which - are the member names for each entry. - - Finally, an XCOFF archive has a global symbol table, which is what - we call the armap. The global symbol table has a normal archive - header with an empty name. It is normally (and perhaps must be) - the last entry in the archive. The contents start with a four byte - binary number which is the number of entries. This is followed by - a that many four byte binary numbers; each is the file offset of an - entry in the archive. These numbers are followed by a series of - null terminated strings, which are symbol names. - - AIX 4.3 introduced a new archive format which can handle larger - files and also 32- and 64-bit objects in the same archive. The - things said above remain true except that there is now more than - one global symbol table. The one is used to index 32-bit objects, - the other for 64-bit objects. - - The new archives (recognizable by the new ARMAG string) has larger - field lengths so that we cannot really share any code. Also we have - to take care that we are not generating the new form of archives - on AIX 4.2 or earlier systems. */ - -/* XCOFF archives use this as a magic string. Note that both strings - have the same length. */ - -#define XCOFFARMAG "<aiaff>\012" -#define XCOFFARMAGBIG "<bigaf>\012" -#define SXCOFFARMAG 8 - -/* This terminates an XCOFF archive member name. */ - -#define XCOFFARFMAG "`\012" -#define SXCOFFARFMAG 2 - -/* XCOFF archives start with this (printable) structure. */ - -struct xcoff_ar_file_hdr -{ - /* Magic string. */ - char magic[SXCOFFARMAG]; - - /* Offset of the member table (decimal ASCII string). */ - char memoff[12]; - - /* Offset of the global symbol table (decimal ASCII string). */ - char symoff[12]; - - /* Offset of the first member in the archive (decimal ASCII string). */ - char firstmemoff[12]; - - /* Offset of the last member in the archive (decimal ASCII string). */ - char lastmemoff[12]; - - /* Offset of the first member on the free list (decimal ASCII - string). */ - char freeoff[12]; -}; - -#define SIZEOF_AR_FILE_HDR (5 * 12 + SXCOFFARMAG) - -/* This is the equivalent data structure for the big archive format. */ - -struct xcoff_ar_file_hdr_big -{ - /* Magic string. */ - char magic[SXCOFFARMAG]; - - /* Offset of the member table (decimal ASCII string). */ - char memoff[20]; - - /* Offset of the global symbol table for 32-bit objects (decimal ASCII - string). */ - char symoff[20]; - - /* Offset of the global symbol table for 64-bit objects (decimal ASCII - string). */ - char symoff64[20]; - - /* Offset of the first member in the archive (decimal ASCII string). */ - char firstmemoff[20]; - - /* Offset of the last member in the archive (decimal ASCII string). */ - char lastmemoff[20]; - - /* Offset of the first member on the free list (decimal ASCII - string). */ - char freeoff[20]; -}; - -#define SIZEOF_AR_FILE_HDR_BIG (6 * 20 + SXCOFFARMAG) - -/* Each XCOFF archive member starts with this (printable) structure. */ - -struct xcoff_ar_hdr -{ - /* File size not including the header (decimal ASCII string). */ - char size[12]; - - /* File offset of next archive member (decimal ASCII string). */ - char nextoff[12]; - - /* File offset of previous archive member (decimal ASCII string). */ - char prevoff[12]; - - /* File mtime (decimal ASCII string). */ - char date[12]; - - /* File UID (decimal ASCII string). */ - char uid[12]; - - /* File GID (decimal ASCII string). */ - char gid[12]; - - /* File mode (octal ASCII string). */ - char mode[12]; - - /* Length of file name (decimal ASCII string). */ - char namlen[4]; - - /* This structure is followed by the file name. The length of the - name is given in the namlen field. If the length of the name is - odd, the name is followed by a null byte. The name and optional - null byte are followed by XCOFFARFMAG, which is not included in - namlen. The contents of the archive member follow; the number of - bytes is given in the size field. */ -}; - -#define SIZEOF_AR_HDR (7 * 12 + 4) - -/* The equivalent for the big archive format. */ - -struct xcoff_ar_hdr_big -{ - /* File size not including the header (decimal ASCII string). */ - char size[20]; - - /* File offset of next archive member (decimal ASCII string). */ - char nextoff[20]; - - /* File offset of previous archive member (decimal ASCII string). */ - char prevoff[20]; - - /* File mtime (decimal ASCII string). */ - char date[12]; - - /* File UID (decimal ASCII string). */ - char uid[12]; - - /* File GID (decimal ASCII string). */ - char gid[12]; - - /* File mode (octal ASCII string). */ - char mode[12]; - - /* Length of file name (decimal ASCII string). */ - char namlen[4]; - - /* This structure is followed by the file name. The length of the - name is given in the namlen field. If the length of the name is - odd, the name is followed by a null byte. The name and optional - null byte are followed by XCOFFARFMAG, which is not included in - namlen. The contents of the archive member follow; the number of - bytes is given in the size field. */ -}; - -#define SIZEOF_AR_HDR_BIG (3 * 20 + 4 * 12 + 4) - -/* We often have to distinguish between the old and big file format. - Make it a bit cleaner. We can use `xcoff_ardata' here because the - `hdr' member has the same size and position in both formats. */ -#define xcoff_big_format_p(abfd) \ - (xcoff_ardata (abfd)->magic[1] == 'b') - -/* We store a copy of the xcoff_ar_file_hdr in the tdata field of the - artdata structure. Similar for the big archive. */ -#define xcoff_ardata(abfd) \ - ((struct xcoff_ar_file_hdr *) bfd_ardata (abfd)->tdata) -#define xcoff_ardata_big(abfd) \ - ((struct xcoff_ar_file_hdr_big *) bfd_ardata (abfd)->tdata) - -/* We store a copy of the xcoff_ar_hdr in the arelt_data field of an - archive element. Similar for the big archive. */ -#define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data)) -#define arch_xhdr(bfd) \ - ((struct xcoff_ar_hdr *) arch_eltdata (bfd)->arch_header) -#define arch_xhdr_big(bfd) \ - ((struct xcoff_ar_hdr_big *) arch_eltdata (bfd)->arch_header) - -/* Read in the armap of an XCOFF archive. */ - -boolean -_bfd_xcoff_slurp_armap (abfd) - bfd *abfd; -{ - file_ptr off; - size_t namlen; - bfd_size_type sz; - bfd_byte *contents, *cend; - bfd_vma c, i; - carsym *arsym; - bfd_byte *p; - - if (xcoff_ardata (abfd) == NULL) - { - bfd_has_map (abfd) = false; - return true; - } - - if (! xcoff_big_format_p (abfd)) - { - /* This is for the old format. */ - struct xcoff_ar_hdr hdr; - - off = strtol (xcoff_ardata (abfd)->symoff, (char **) NULL, 10); - if (off == 0) - { - bfd_has_map (abfd) = false; - return true; - } - - if (bfd_seek (abfd, off, SEEK_SET) != 0) - return false; - - /* The symbol table starts with a normal archive header. */ - if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR, 1, abfd) != SIZEOF_AR_HDR) - return false; - - /* Skip the name (normally empty). */ - namlen = strtol (hdr.namlen, (char **) NULL, 10); - if (bfd_seek (abfd, ((namlen + 1) & ~1) + SXCOFFARFMAG, SEEK_CUR) != 0) - return false; - - sz = strtol (hdr.size, (char **) NULL, 10); - - /* Read in the entire symbol table. */ - contents = (bfd_byte *) bfd_alloc (abfd, sz); - if (contents == NULL) - return false; - if (bfd_read ((PTR) contents, 1, sz, abfd) != sz) - return false; - - /* The symbol table starts with a four byte count. */ - c = bfd_h_get_32 (abfd, contents); - - if (c * 4 >= sz) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - bfd_ardata (abfd)->symdefs = ((carsym *) - bfd_alloc (abfd, c * sizeof (carsym))); - if (bfd_ardata (abfd)->symdefs == NULL) - return false; - - /* After the count comes a list of four byte file offsets. */ - for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 4; - i < c; - ++i, ++arsym, p += 4) - arsym->file_offset = bfd_h_get_32 (abfd, p); - } - else - { - /* This is for the new format. */ - struct xcoff_ar_hdr_big hdr; - - off = strtol (xcoff_ardata_big (abfd)->symoff, (char **) NULL, 10); - if (off == 0) - { - bfd_has_map (abfd) = false; - return true; - } - - if (bfd_seek (abfd, off, SEEK_SET) != 0) - return false; - - /* The symbol table starts with a normal archive header. */ - if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR_BIG, 1, abfd) - != SIZEOF_AR_HDR_BIG) - return false; - - /* Skip the name (normally empty). */ - namlen = strtol (hdr.namlen, (char **) NULL, 10); - if (bfd_seek (abfd, ((namlen + 1) & ~1) + SXCOFFARFMAG, SEEK_CUR) != 0) - return false; - - /* XXX This actually has to be a call to strtoll (at least on 32-bit - machines) since the field width is 20 and there numbers with more - than 32 bits can be represented. */ - sz = strtol (hdr.size, (char **) NULL, 10); - - /* Read in the entire symbol table. */ - contents = (bfd_byte *) bfd_alloc (abfd, sz); - if (contents == NULL) - return false; - if (bfd_read ((PTR) contents, 1, sz, abfd) != sz) - return false; - - /* The symbol table starts with an eight byte count. */ - c = bfd_h_get_64 (abfd, contents); - - if (c * 8 >= sz) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - bfd_ardata (abfd)->symdefs = ((carsym *) - bfd_alloc (abfd, c * sizeof (carsym))); - if (bfd_ardata (abfd)->symdefs == NULL) - return false; - - /* After the count comes a list of eight byte file offsets. */ - for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 8; - i < c; - ++i, ++arsym, p += 8) - arsym->file_offset = bfd_h_get_64 (abfd, p); - } - - /* After the file offsets come null terminated symbol names. */ - cend = contents + sz; - for (i = 0, arsym = bfd_ardata (abfd)->symdefs; - i < c; - ++i, ++arsym, p += strlen ((char *) p) + 1) - { - if (p >= cend) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - arsym->name = (char *) p; - } - - bfd_ardata (abfd)->symdef_count = c; - bfd_has_map (abfd) = true; - - return true; -} - -/* See if this is an XCOFF archive. */ - -const bfd_target * -_bfd_xcoff_archive_p (abfd) - bfd *abfd; -{ - char magic[SXCOFFARMAG]; - - if (bfd_read ((PTR) magic, SXCOFFARMAG, 1, abfd) != SXCOFFARMAG) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - if (strncmp (magic, XCOFFARMAG, SXCOFFARMAG) != 0 - && strncmp (magic, XCOFFARMAGBIG, SXCOFFARMAG) != 0) - { - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - /* We are setting bfd_ardata(abfd) here, but since bfd_ardata - involves a cast, we can't do it as the left operand of - assignment. */ - abfd->tdata.aout_ar_data = - (struct artdata *) bfd_zalloc (abfd, sizeof (struct artdata)); - - if (bfd_ardata (abfd) == (struct artdata *) NULL) - return NULL; - - bfd_ardata (abfd)->cache = NULL; - bfd_ardata (abfd)->archive_head = NULL; - bfd_ardata (abfd)->symdefs = NULL; - bfd_ardata (abfd)->extended_names = NULL; - - /* Now handle the two formats. */ - if (magic[1] != 'b') - { - /* This is the old format. */ - struct xcoff_ar_file_hdr hdr; - - /* Copy over the magic string. */ - memcpy (hdr.magic, magic, SXCOFFARMAG); - - /* Now read the rest of the file header. */ - if (bfd_read ((PTR) &hdr.memoff, SIZEOF_AR_FILE_HDR - SXCOFFARMAG, 1, - abfd) != SIZEOF_AR_FILE_HDR - SXCOFFARMAG) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - bfd_ardata (abfd)->first_file_filepos = strtol (hdr.firstmemoff, - (char **) NULL, 10); - - bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, SIZEOF_AR_FILE_HDR); - if (bfd_ardata (abfd)->tdata == NULL) - return NULL; - - memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR); - } - else - { - /* This is the new format. */ - struct xcoff_ar_file_hdr_big hdr; - - /* Copy over the magic string. */ - memcpy (hdr.magic, magic, SXCOFFARMAG); - - /* Now read the rest of the file header. */ - if (bfd_read ((PTR) &hdr.memoff, SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG, 1, - abfd) != SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - /* XXX This actually has to be a call to strtoll (at least on 32-bit - machines) since the field width is 20 and there numbers with more - than 32 bits can be represented. */ - bfd_ardata (abfd)->first_file_filepos = strtol (hdr.firstmemoff, - (char **) NULL, 10); - - bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, SIZEOF_AR_FILE_HDR_BIG); - if (bfd_ardata (abfd)->tdata == NULL) - return NULL; - - memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR_BIG); - } - - if (! _bfd_xcoff_slurp_armap (abfd)) - { - bfd_release (abfd, bfd_ardata (abfd)); - abfd->tdata.aout_ar_data = (struct artdata *) NULL; - return NULL; - } - - return abfd->xvec; -} - -/* Read the archive header in an XCOFF archive. */ - -PTR -_bfd_xcoff_read_ar_hdr (abfd) - bfd *abfd; -{ - size_t namlen; - struct areltdata *ret; - - ret = (struct areltdata *) bfd_alloc (abfd, sizeof (struct areltdata)); - if (ret == NULL) - return NULL; - - if (! xcoff_big_format_p (abfd)) - { - struct xcoff_ar_hdr hdr; - struct xcoff_ar_hdr *hdrp; - - if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR, 1, abfd) != SIZEOF_AR_HDR) - { - free (ret); - return NULL; - } - - namlen = strtol (hdr.namlen, (char **) NULL, 10); - hdrp = (struct xcoff_ar_hdr *) bfd_alloc (abfd, - SIZEOF_AR_HDR + namlen + 1); - if (hdrp == NULL) - { - free (ret); - return NULL; - } - memcpy (hdrp, &hdr, SIZEOF_AR_HDR); - if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR, 1, namlen, abfd) != namlen) - { - free (ret); - return NULL; - } - ((char *) hdrp)[SIZEOF_AR_HDR + namlen] = '\0'; - - ret->arch_header = (char *) hdrp; - ret->parsed_size = strtol (hdr.size, (char **) NULL, 10); - ret->filename = (char *) hdrp + SIZEOF_AR_HDR; - } - else - { - struct xcoff_ar_hdr_big hdr; - struct xcoff_ar_hdr_big *hdrp; - - if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR_BIG, 1, abfd) - != SIZEOF_AR_HDR_BIG) - { - free (ret); - return NULL; - } - - namlen = strtol (hdr.namlen, (char **) NULL, 10); - hdrp = (struct xcoff_ar_hdr_big *) bfd_alloc (abfd, - SIZEOF_AR_HDR_BIG - + namlen + 1); - if (hdrp == NULL) - { - free (ret); - return NULL; - } - memcpy (hdrp, &hdr, SIZEOF_AR_HDR_BIG); - if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR_BIG, 1, namlen, abfd) != namlen) - { - free (ret); - return NULL; - } - ((char *) hdrp)[SIZEOF_AR_HDR_BIG + namlen] = '\0'; - - ret->arch_header = (char *) hdrp; - /* XXX This actually has to be a call to strtoll (at least on 32-bit - machines) since the field width is 20 and there numbers with more - than 32 bits can be represented. */ - ret->parsed_size = strtol (hdr.size, (char **) NULL, 10); - ret->filename = (char *) hdrp + SIZEOF_AR_HDR_BIG; - } - - /* Skip over the XCOFFARFMAG at the end of the file name. */ - if (bfd_seek (abfd, (namlen & 1) + SXCOFFARFMAG, SEEK_CUR) != 0) - return NULL; - - return (PTR) ret; -} - -/* Open the next element in an XCOFF archive. */ - -bfd * -_bfd_xcoff_openr_next_archived_file (archive, last_file) - bfd *archive; - bfd *last_file; -{ - file_ptr filestart; - - if (xcoff_ardata (archive) == NULL) - { - bfd_set_error (bfd_error_invalid_operation); - return NULL; - } - - if (! xcoff_big_format_p (archive)) - { - if (last_file == NULL) - filestart = bfd_ardata (archive)->first_file_filepos; - else - filestart = strtol (arch_xhdr (last_file)->nextoff, (char **) NULL, - 10); - - if (filestart == 0 - || filestart == strtol (xcoff_ardata (archive)->memoff, - (char **) NULL, 10) - || filestart == strtol (xcoff_ardata (archive)->symoff, - (char **) NULL, 10)) - { - bfd_set_error (bfd_error_no_more_archived_files); - return NULL; - } - } - else - { - if (last_file == NULL) - filestart = bfd_ardata (archive)->first_file_filepos; - else - /* XXX These actually have to be a calls to strtoll (at least - on 32-bit machines) since the fields's width is 20 and - there numbers with more than 32 bits can be represented. */ - filestart = strtol (arch_xhdr_big (last_file)->nextoff, (char **) NULL, - 10); - - /* XXX These actually have to be calls to strtoll (at least on 32-bit - machines) since the fields's width is 20 and there numbers with more - than 32 bits can be represented. */ - if (filestart == 0 - || filestart == strtol (xcoff_ardata_big (archive)->memoff, - (char **) NULL, 10) - || filestart == strtol (xcoff_ardata_big (archive)->symoff, - (char **) NULL, 10)) - { - bfd_set_error (bfd_error_no_more_archived_files); - return NULL; - } - } - - return _bfd_get_elt_at_filepos (archive, filestart); -} - -/* Stat an element in an XCOFF archive. */ - -int -_bfd_xcoff_generic_stat_arch_elt (abfd, s) - bfd *abfd; - struct stat *s; -{ - if (abfd->arelt_data == NULL) - { - bfd_set_error (bfd_error_invalid_operation); - return -1; - } - - if (! xcoff_big_format_p (abfd)) - { - struct xcoff_ar_hdr *hdrp = arch_xhdr (abfd); - - s->st_mtime = strtol (hdrp->date, (char **) NULL, 10); - s->st_uid = strtol (hdrp->uid, (char **) NULL, 10); - s->st_gid = strtol (hdrp->gid, (char **) NULL, 10); - s->st_mode = strtol (hdrp->mode, (char **) NULL, 8); - s->st_size = arch_eltdata (abfd)->parsed_size; - } - else - { - struct xcoff_ar_hdr_big *hdrp = arch_xhdr_big (abfd); - - s->st_mtime = strtol (hdrp->date, (char **) NULL, 10); - s->st_uid = strtol (hdrp->uid, (char **) NULL, 10); - s->st_gid = strtol (hdrp->gid, (char **) NULL, 10); - s->st_mode = strtol (hdrp->mode, (char **) NULL, 8); - s->st_size = arch_eltdata (abfd)->parsed_size; - } - - return 0; -} - -/* Normalize a file name for inclusion in an archive. */ - -static const char * -normalize_filename (abfd) - bfd *abfd; -{ - const char *file; - const char *filename; - - file = bfd_get_filename (abfd); - filename = strrchr (file, '/'); - if (filename != NULL) - filename++; - else - filename = file; - return filename; -} - -/* Write out an XCOFF armap. */ - -static boolean -xcoff_write_armap_old (abfd, elength, map, orl_count, stridx) - bfd *abfd; - unsigned int elength ATTRIBUTE_UNUSED; - struct orl *map; - unsigned int orl_count; - int stridx; -{ - struct xcoff_ar_hdr hdr; - char *p; - unsigned char buf[4]; - bfd *sub; - file_ptr fileoff; - unsigned int i; - - memset (&hdr, 0, sizeof hdr); - sprintf (hdr.size, "%ld", (long) (4 + orl_count * 4 + stridx)); - sprintf (hdr.nextoff, "%d", 0); - memcpy (hdr.prevoff, xcoff_ardata (abfd)->memoff, 12); - sprintf (hdr.date, "%d", 0); - sprintf (hdr.uid, "%d", 0); - sprintf (hdr.gid, "%d", 0); - sprintf (hdr.mode, "%d", 0); - sprintf (hdr.namlen, "%d", 0); - - /* We need spaces, not null bytes, in the header. */ - for (p = (char *) &hdr; p < (char *) &hdr + SIZEOF_AR_HDR; p++) - if (*p == '\0') - *p = ' '; - - if (bfd_write ((PTR) &hdr, SIZEOF_AR_HDR, 1, abfd) != SIZEOF_AR_HDR - || bfd_write (XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) != SXCOFFARFMAG) - return false; - - bfd_h_put_32 (abfd, orl_count, buf); - if (bfd_write (buf, 1, 4, abfd) != 4) - return false; - - sub = abfd->archive_head; - fileoff = SIZEOF_AR_FILE_HDR; - i = 0; - while (sub != NULL && i < orl_count) - { - size_t namlen; - - while (((bfd *) (map[i]).pos) == sub) - { - bfd_h_put_32 (abfd, fileoff, buf); - if (bfd_write (buf, 1, 4, abfd) != 4) - return false; - ++i; - } - namlen = strlen (normalize_filename (sub)); - namlen = (namlen + 1) &~ 1; - fileoff += (SIZEOF_AR_HDR - + namlen - + SXCOFFARFMAG - + arelt_size (sub)); - fileoff = (fileoff + 1) &~ 1; - sub = sub->next; - } - - for (i = 0; i < orl_count; i++) - { - const char *name; - size_t namlen; - - name = *map[i].name; - namlen = strlen (name); - if (bfd_write (name, 1, namlen + 1, abfd) != namlen + 1) - return false; - } - - if ((stridx & 1) != 0) - { - char b; - - b = '\0'; - if (bfd_write (&b, 1, 1, abfd) != 1) - return false; - } - - return true; -} - -/* Write a single armap in the big format. */ -static boolean -xcoff_write_one_armap_big (abfd, map, orl_count, orl_ccount, stridx, bits64, - prevoff, nextoff) - bfd *abfd; - struct orl *map; - unsigned int orl_count; - unsigned int orl_ccount; - unsigned int stridx; - int bits64; - const char *prevoff; - char *nextoff; -{ - struct xcoff_ar_hdr_big hdr; - char *p; - unsigned char buf[4]; - const bfd_arch_info_type *arch_info = NULL; - bfd *sub; - file_ptr fileoff; - bfd *object_bfd; - unsigned int i; - - memset (&hdr, 0, sizeof hdr); - /* XXX This call actually should use %lld (at least on 32-bit - machines) since the fields's width is 20 and there numbers with - more than 32 bits can be represented. */ - sprintf (hdr.size, "%ld", (long) (4 + orl_ccount * 4 + stridx)); - if (bits64) - sprintf (hdr.nextoff, "%d", 0); - else - sprintf (hdr.nextoff, "%ld", (strtol (prevoff, (char **) NULL, 10) - + 4 + orl_ccount * 4 + stridx)); - memcpy (hdr.prevoff, prevoff, sizeof (hdr.prevoff)); - sprintf (hdr.date, "%d", 0); - sprintf (hdr.uid, "%d", 0); - sprintf (hdr.gid, "%d", 0); - sprintf (hdr.mode, "%d", 0); - sprintf (hdr.namlen, "%d", 0); - - /* We need spaces, not null bytes, in the header. */ - for (p = (char *) &hdr; p < (char *) &hdr + SIZEOF_AR_HDR_BIG; p++) - if (*p == '\0') - *p = ' '; - - memcpy (nextoff, hdr.nextoff, sizeof (hdr.nextoff)); - - if (bfd_write ((PTR) &hdr, SIZEOF_AR_HDR_BIG, 1, abfd) != SIZEOF_AR_HDR_BIG - || bfd_write (XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) != SXCOFFARFMAG) - return false; - - bfd_h_put_32 (abfd, orl_ccount, buf); - if (bfd_write (buf, 1, 4, abfd) != 4) - return false; - - sub = abfd->archive_head; - fileoff = SIZEOF_AR_FILE_HDR_BIG; - i = 0; - while (sub != NULL && i < orl_count) - { - size_t namlen; - - if ((bfd_arch_bits_per_address ((bfd *) map[i].pos) == 64) == bits64) - while (((bfd *) (map[i]).pos) == sub) - { - bfd_h_put_32 (abfd, fileoff, buf); - if (bfd_write (buf, 1, 4, abfd) != 4) - return false; - i++; - } - else - while (((bfd *) (map[i]).pos) == sub) - i++; - - namlen = strlen (normalize_filename (sub)); - namlen = (namlen + 1) &~ 1; - fileoff += (SIZEOF_AR_HDR_BIG - + namlen - + SXCOFFARFMAG - + arelt_size (sub)); - fileoff = (fileoff + 1) &~ 1; - sub = sub->next; - } - - object_bfd = NULL; - for (i = 0; i < orl_count; i++) - { - const char *name; - size_t namlen; - bfd *ob = (bfd *)map[i].pos; - - if (ob != object_bfd) - arch_info = bfd_get_arch_info (ob); - - if (arch_info && (arch_info->bits_per_address == 64) != bits64) - continue; - - name = *map[i].name; - namlen = strlen (name); - if (bfd_write (name, 1, namlen + 1, abfd) != namlen + 1) - return false; - } - - if ((stridx & 1) != 0) - { - char b; - - b = '\0'; - if (bfd_write (&b, 1, 1, abfd) != 1) - return false; - } - - return true; -} - -static boolean -xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) - bfd *abfd; - unsigned int elength ATTRIBUTE_UNUSED; - struct orl *map; - unsigned int orl_count; - int stridx; -{ - unsigned int i; - unsigned int orl_count_32, orl_count_64; - unsigned int stridx_32, stridx_64; - const bfd_arch_info_type *arch_info = NULL; - bfd *object_bfd; - - /* First, we look through the symbols and work out which are - from 32-bit objects and which from 64-bit ones. */ - orl_count_32 = 0; - orl_count_64 = 0; - stridx_32 = 0; - stridx_64 = 0; - object_bfd = NULL; - for (i = 0; i < orl_count; i++) - { - bfd *ob = (bfd *)map[i].pos; - unsigned int len; - if (ob != object_bfd) - arch_info = bfd_get_arch_info (ob); - len = strlen (*map[i].name) + 1; - if (arch_info && arch_info->bits_per_address == 64) - { - orl_count_64++; - stridx_64 += len; - } - else - { - orl_count_32++; - stridx_32 += len; - } - object_bfd = ob; - } - /* A quick sanity check... */ - BFD_ASSERT (orl_count_64 + orl_count_32 == orl_count); - BFD_ASSERT (stridx_64 + stridx_32 == stridx); - - /* Now write out each map. */ - if (! xcoff_write_one_armap_big (abfd, map, orl_count, orl_count_32, - stridx_32, false, - xcoff_ardata_big (abfd)->memoff, - xcoff_ardata_big (abfd)->symoff)) - return false; - if (! xcoff_write_one_armap_big (abfd, map, orl_count, orl_count_64, - stridx_64, true, - xcoff_ardata_big (abfd)->symoff, - xcoff_ardata_big (abfd)->symoff64)) - return false; - - return true; -} - -boolean -_bfd_xcoff_write_armap (abfd, elength, map, orl_count, stridx) - bfd *abfd; - unsigned int elength ATTRIBUTE_UNUSED; - struct orl *map; - unsigned int orl_count; - int stridx; -{ - if (! xcoff_big_format_p (abfd)) - return xcoff_write_armap_old (abfd, elength, map, orl_count, stridx); - else - return xcoff_write_armap_big (abfd, elength, map, orl_count, stridx); -} - -/* Write out an XCOFF archive. We always write an entire archive, - rather than fussing with the freelist and so forth. */ - -static boolean -xcoff_write_archive_contents_old (abfd) - bfd *abfd; -{ - struct xcoff_ar_file_hdr fhdr; - size_t count; - size_t total_namlen; - file_ptr *offsets; - boolean makemap; - boolean hasobjects; - file_ptr prevoff, nextoff; - bfd *sub; - unsigned int i; - struct xcoff_ar_hdr ahdr; - bfd_size_type size; - char *p; - char decbuf[13]; - - memset (&fhdr, 0, sizeof fhdr); - strncpy (fhdr.magic, XCOFFARMAG, SXCOFFARMAG); - sprintf (fhdr.firstmemoff, "%d", SIZEOF_AR_FILE_HDR); - sprintf (fhdr.freeoff, "%d", 0); - - count = 0; - total_namlen = 0; - for (sub = abfd->archive_head; sub != NULL; sub = sub->next) - { - ++count; - total_namlen += strlen (normalize_filename (sub)) + 1; - } - offsets = (file_ptr *) bfd_alloc (abfd, count * sizeof (file_ptr)); - if (offsets == NULL) - return false; - - if (bfd_seek (abfd, SIZEOF_AR_FILE_HDR, SEEK_SET) != 0) - return false; - - makemap = bfd_has_map (abfd); - hasobjects = false; - prevoff = 0; - nextoff = SIZEOF_AR_FILE_HDR; - for (sub = abfd->archive_head, i = 0; sub != NULL; sub = sub->next, i++) - { - const char *name; - size_t namlen; - struct xcoff_ar_hdr *ahdrp; - bfd_size_type remaining; - - if (makemap && ! hasobjects) - { - if (bfd_check_format (sub, bfd_object)) - hasobjects = true; - } - - name = normalize_filename (sub); - namlen = strlen (name); - - if (sub->arelt_data != NULL) - ahdrp = arch_xhdr (sub); - else - ahdrp = NULL; - - if (ahdrp == NULL) - { - struct stat s; - - memset (&ahdr, 0, sizeof ahdr); - ahdrp = &ahdr; - if (stat (bfd_get_filename (sub), &s) != 0) - { - bfd_set_error (bfd_error_system_call); - return false; - } - - sprintf (ahdrp->size, "%ld", (long) s.st_size); - sprintf (ahdrp->date, "%ld", (long) s.st_mtime); - sprintf (ahdrp->uid, "%ld", (long) s.st_uid); - sprintf (ahdrp->gid, "%ld", (long) s.st_gid); - sprintf (ahdrp->mode, "%o", (unsigned int) s.st_mode); - - if (sub->arelt_data == NULL) - { - sub->arelt_data = bfd_alloc (sub, sizeof (struct areltdata)); - if (sub->arelt_data == NULL) - return false; - } - - arch_eltdata (sub)->parsed_size = s.st_size; - } - - sprintf (ahdrp->prevoff, "%ld", (long) prevoff); - sprintf (ahdrp->namlen, "%ld", (long) namlen); - - /* If the length of the name is odd, we write out the null byte - after the name as well. */ - namlen = (namlen + 1) &~ 1; - - remaining = arelt_size (sub); - size = (SIZEOF_AR_HDR - + namlen - + SXCOFFARFMAG - + remaining); - - BFD_ASSERT (nextoff == bfd_tell (abfd)); - - offsets[i] = nextoff; - - prevoff = nextoff; - nextoff += size + (size & 1); - - sprintf (ahdrp->nextoff, "%ld", (long) nextoff); - - /* We need spaces, not null bytes, in the header. */ - for (p = (char *) ahdrp; p < (char *) ahdrp + SIZEOF_AR_HDR; p++) - if (*p == '\0') - *p = ' '; - - if (bfd_write ((PTR) ahdrp, 1, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR - || bfd_write ((PTR) name, 1, namlen, abfd) != namlen - || (bfd_write ((PTR) XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) - != SXCOFFARFMAG)) - return false; - - if (bfd_seek (sub, (file_ptr) 0, SEEK_SET) != 0) - return false; - while (remaining != 0) - { - bfd_size_type amt; - bfd_byte buffer[DEFAULT_BUFFERSIZE]; - - amt = sizeof buffer; - if (amt > remaining) - amt = remaining; - if (bfd_read (buffer, 1, amt, sub) != amt - || bfd_write (buffer, 1, amt, abfd) != amt) - return false; - remaining -= amt; - } - - if ((size & 1) != 0) - { - bfd_byte b; - - b = '\0'; - if (bfd_write (&b, 1, 1, abfd) != 1) - return false; - } - } - - sprintf (fhdr.lastmemoff, "%ld", (long) prevoff); - - /* Write out the member table. */ - - BFD_ASSERT (nextoff == bfd_tell (abfd)); - sprintf (fhdr.memoff, "%ld", (long) nextoff); - - memset (&ahdr, 0, sizeof ahdr); - sprintf (ahdr.size, "%ld", (long) (12 + count * 12 + total_namlen)); - sprintf (ahdr.prevoff, "%ld", (long) prevoff); - sprintf (ahdr.date, "%d", 0); - sprintf (ahdr.uid, "%d", 0); - sprintf (ahdr.gid, "%d", 0); - sprintf (ahdr.mode, "%d", 0); - sprintf (ahdr.namlen, "%d", 0); - - size = (SIZEOF_AR_HDR - + 12 - + count * 12 - + total_namlen - + SXCOFFARFMAG); - - prevoff = nextoff; - nextoff += size + (size & 1); - - if (makemap && hasobjects) - sprintf (ahdr.nextoff, "%ld", (long) nextoff); - else - sprintf (ahdr.nextoff, "%d", 0); - - /* We need spaces, not null bytes, in the header. */ - for (p = (char *) &ahdr; p < (char *) &ahdr + SIZEOF_AR_HDR; p++) - if (*p == '\0') - *p = ' '; - - if (bfd_write ((PTR) &ahdr, 1, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR - || (bfd_write ((PTR) XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) - != SXCOFFARFMAG)) - return false; - - sprintf (decbuf, "%-12ld", (long) count); - if (bfd_write ((PTR) decbuf, 1, 12, abfd) != 12) - return false; - for (i = 0; i < count; i++) - { - sprintf (decbuf, "%-12ld", (long) offsets[i]); - if (bfd_write ((PTR) decbuf, 1, 12, abfd) != 12) - return false; - } - for (sub = abfd->archive_head; sub != NULL; sub = sub->next) - { - const char *name; - size_t namlen; - - name = normalize_filename (sub); - namlen = strlen (name); - if (bfd_write ((PTR) name, 1, namlen + 1, abfd) != namlen + 1) - return false; - } - if ((size & 1) != 0) - { - bfd_byte b; - - b = '\0'; - if (bfd_write ((PTR) &b, 1, 1, abfd) != 1) - return false; - } - - /* Write out the armap, if appropriate. */ - - if (! makemap || ! hasobjects) - sprintf (fhdr.symoff, "%d", 0); - else - { - BFD_ASSERT (nextoff == bfd_tell (abfd)); - sprintf (fhdr.symoff, "%ld", (long) nextoff); - bfd_ardata (abfd)->tdata = (PTR) &fhdr; - if (! _bfd_compute_and_write_armap (abfd, 0)) - return false; - } - - /* Write out the archive file header. */ - - /* We need spaces, not null bytes, in the header. */ - for (p = (char *) &fhdr; p < (char *) &fhdr + SIZEOF_AR_FILE_HDR; p++) - if (*p == '\0') - *p = ' '; - - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || (bfd_write ((PTR) &fhdr, SIZEOF_AR_FILE_HDR, 1, abfd) != - SIZEOF_AR_FILE_HDR)) - return false; - - return true; -} - -static boolean -xcoff_write_archive_contents_big (abfd) - bfd *abfd; -{ - struct xcoff_ar_file_hdr_big fhdr; - size_t count; - size_t total_namlen; - file_ptr *offsets; - boolean makemap; - boolean hasobjects; - file_ptr prevoff, nextoff; - bfd *sub; - unsigned int i; - struct xcoff_ar_hdr_big ahdr; - bfd_size_type size; - char *p; - char decbuf[13]; - - memset (&fhdr, 0, sizeof fhdr); - strncpy (fhdr.magic, XCOFFARMAGBIG, SXCOFFARMAG); - sprintf (fhdr.firstmemoff, "%d", SIZEOF_AR_FILE_HDR_BIG); - sprintf (fhdr.freeoff, "%d", 0); - - count = 0; - total_namlen = 0; - for (sub = abfd->archive_head; sub != NULL; sub = sub->next) - { - ++count; - total_namlen += strlen (normalize_filename (sub)) + 1; - } - offsets = (file_ptr *) bfd_alloc (abfd, count * sizeof (file_ptr)); - if (offsets == NULL) - return false; - - if (bfd_seek (abfd, SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0) - return false; - - makemap = bfd_has_map (abfd); - hasobjects = false; - prevoff = 0; - nextoff = SIZEOF_AR_FILE_HDR_BIG; - for (sub = abfd->archive_head, i = 0; sub != NULL; sub = sub->next, i++) - { - const char *name; - size_t namlen; - struct xcoff_ar_hdr_big *ahdrp; - bfd_size_type remaining; - - if (makemap && ! hasobjects) - { - if (bfd_check_format (sub, bfd_object)) - hasobjects = true; - } - - name = normalize_filename (sub); - namlen = strlen (name); - - if (sub->arelt_data != NULL) - ahdrp = arch_xhdr_big (sub); - else - ahdrp = NULL; - - if (ahdrp == NULL) - { - struct stat s; - - memset (&ahdr, 0, sizeof ahdr); - ahdrp = &ahdr; - /* XXX This should actually be a call to stat64 (at least on - 32-bit machines). */ - if (stat (bfd_get_filename (sub), &s) != 0) - { - bfd_set_error (bfd_error_system_call); - return false; - } - - /* XXX This call actually should use %lld (at least on 32-bit - machines) since the fields's width is 20 and there numbers with - more than 32 bits can be represented. */ - sprintf (ahdrp->size, "%ld", (long) s.st_size); - sprintf (ahdrp->date, "%ld", (long) s.st_mtime); - sprintf (ahdrp->uid, "%ld", (long) s.st_uid); - sprintf (ahdrp->gid, "%ld", (long) s.st_gid); - sprintf (ahdrp->mode, "%o", (unsigned int) s.st_mode); - - if (sub->arelt_data == NULL) - { - sub->arelt_data = bfd_alloc (sub, sizeof (struct areltdata)); - if (sub->arelt_data == NULL) - return false; - } - - arch_eltdata (sub)->parsed_size = s.st_size; - } - - /* XXX These calls actually should use %lld (at least on 32-bit - machines) since the fields's width is 20 and there numbers with - more than 32 bits can be represented. */ - sprintf (ahdrp->prevoff, "%ld", (long) prevoff); - sprintf (ahdrp->namlen, "%ld", (long) namlen); - - /* If the length of the name is odd, we write out the null byte - after the name as well. */ - namlen = (namlen + 1) &~ 1; - - remaining = arelt_size (sub); - size = (SIZEOF_AR_HDR_BIG - + namlen - + SXCOFFARFMAG - + remaining); - - BFD_ASSERT (nextoff == bfd_tell (abfd)); - - offsets[i] = nextoff; - - prevoff = nextoff; - nextoff += size + (size & 1); - - sprintf (ahdrp->nextoff, "%ld", (long) nextoff); - - /* We need spaces, not null bytes, in the header. */ - for (p = (char *) ahdrp; p < (char *) ahdrp + SIZEOF_AR_HDR_BIG; p++) - if (*p == '\0') - *p = ' '; - - if (bfd_write ((PTR) ahdrp, 1, SIZEOF_AR_HDR_BIG, abfd) - != SIZEOF_AR_HDR_BIG - || bfd_write ((PTR) name, 1, namlen, abfd) != namlen - || (bfd_write ((PTR) XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) - != SXCOFFARFMAG)) - return false; - - if (bfd_seek (sub, (file_ptr) 0, SEEK_SET) != 0) - return false; - while (remaining != 0) - { - bfd_size_type amt; - bfd_byte buffer[DEFAULT_BUFFERSIZE]; - - amt = sizeof buffer; - if (amt > remaining) - amt = remaining; - if (bfd_read (buffer, 1, amt, sub) != amt - || bfd_write (buffer, 1, amt, abfd) != amt) - return false; - remaining -= amt; - } - - if ((size & 1) != 0) - { - bfd_byte b; - - b = '\0'; - if (bfd_write (&b, 1, 1, abfd) != 1) - return false; - } - } - - /* XXX This call actually should use %lld (at least on 32-bit - machines) since the fields's width is 20 and there numbers with - more than 32 bits can be represented. */ - sprintf (fhdr.lastmemoff, "%ld", (long) prevoff); - - /* Write out the member table. */ - - BFD_ASSERT (nextoff == bfd_tell (abfd)); - /* XXX This call actually should use %lld (at least on 32-bit - machines) since the fields's width is 20 and there numbers with - more than 32 bits can be represented. */ - sprintf (fhdr.memoff, "%ld", (long) nextoff); - - memset (&ahdr, 0, sizeof ahdr); - /* XXX The next two calls actually should use %lld (at least on 32-bit - machines) since the fields's width is 20 and there numbers with - more than 32 bits can be represented. */ - sprintf (ahdr.size, "%ld", (long) (12 + count * 12 + total_namlen)); - sprintf (ahdr.prevoff, "%ld", (long) prevoff); - sprintf (ahdr.date, "%d", 0); - sprintf (ahdr.uid, "%d", 0); - sprintf (ahdr.gid, "%d", 0); - sprintf (ahdr.mode, "%d", 0); - sprintf (ahdr.namlen, "%d", 0); - - size = (SIZEOF_AR_HDR_BIG - + 12 - + count * 12 - + total_namlen - + SXCOFFARFMAG); - - prevoff = nextoff; - nextoff += size + (size & 1); - - if (makemap && hasobjects) - /* XXX This call actually should use %lld (at least on 32-bit - machines) since the fields's width is 20 and there numbers with - more than 32 bits can be represented. */ - sprintf (ahdr.nextoff, "%ld", (long) nextoff); - else - sprintf (ahdr.nextoff, "%d", 0); - - /* We need spaces, not null bytes, in the header. */ - for (p = (char *) &ahdr; p < (char *) &ahdr + SIZEOF_AR_HDR_BIG; p++) - if (*p == '\0') - *p = ' '; - - if (bfd_write ((PTR) &ahdr, 1, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG - || (bfd_write ((PTR) XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) - != SXCOFFARFMAG)) - return false; - - sprintf (decbuf, "%-12ld", (long) count); - if (bfd_write ((PTR) decbuf, 1, 12, abfd) != 12) - return false; - for (i = 0; i < count; i++) - { - sprintf (decbuf, "%-12ld", (long) offsets[i]); - if (bfd_write ((PTR) decbuf, 1, 12, abfd) != 12) - return false; - } - for (sub = abfd->archive_head; sub != NULL; sub = sub->next) - { - const char *name; - size_t namlen; - - name = normalize_filename (sub); - namlen = strlen (name); - if (bfd_write ((PTR) name, 1, namlen + 1, abfd) != namlen + 1) - return false; - } - if ((size & 1) != 0) - { - bfd_byte b; - - b = '\0'; - if (bfd_write ((PTR) &b, 1, 1, abfd) != 1) - return false; - } - - /* Write out the armap, if appropriate. */ - - if (! makemap || ! hasobjects) - sprintf (fhdr.symoff, "%d", 0); - else - { - BFD_ASSERT (nextoff == bfd_tell (abfd)); - /* XXX This call actually should use %lld (at least on 32-bit - machines) since the fields's width is 20 and there numbers with - more than 32 bits can be represented. */ - bfd_ardata (abfd)->tdata = (PTR) &fhdr; - if (! _bfd_compute_and_write_armap (abfd, 0)) - return false; - } - - /* Write out the archive file header. */ - - /* We need spaces, not null bytes, in the header. */ - for (p = (char *) &fhdr; p < (char *) &fhdr + SIZEOF_AR_FILE_HDR_BIG; p++) - if (*p == '\0') - *p = ' '; - - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || (bfd_write ((PTR) &fhdr, SIZEOF_AR_FILE_HDR_BIG, 1, abfd) != - SIZEOF_AR_FILE_HDR_BIG)) - return false; - - return true; -} - -boolean -_bfd_xcoff_write_archive_contents (abfd) - bfd *abfd; -{ - if (! xcoff_big_format_p (abfd)) - return xcoff_write_archive_contents_old (abfd); - else - return xcoff_write_archive_contents_big (abfd); -} - -/* We can't use the usual coff_sizeof_headers routine, because AIX - always uses an a.out header. */ - -int -_bfd_xcoff_sizeof_headers (abfd, reloc) - bfd *abfd; - boolean reloc ATTRIBUTE_UNUSED; -{ - int size; - - size = FILHSZ; - if (xcoff_data (abfd)->full_aouthdr) - size += AOUTSZ; - else - size += SMALL_AOUTSZ; - size += abfd->section_count * SCNHSZ; - return size; -} diff --git a/contrib/binutils/bfd/coff-sh.c b/contrib/binutils/bfd/coff-sh.c deleted file mode 100644 index fd4f2180bce3..000000000000 --- a/contrib/binutils/bfd/coff-sh.c +++ /dev/null @@ -1,2944 +0,0 @@ -/* BFD back-end for Hitachi Super-H COFF binaries. - Copyright 1993, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. - Contributed by Cygnus Support. - Written by Steve Chamberlain, <sac@cygnus.com>. - Relaxing code written by Ian Lance Taylor, <ian@cygnus.com>. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "bfdlink.h" -#include "coff/sh.h" -#include "coff/internal.h" -#include "libcoff.h" - -/* Internal functions. */ -static bfd_reloc_status_type sh_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static long get_symbol_value PARAMS ((asymbol *)); -static boolean sh_merge_private_data PARAMS ((bfd *, bfd *)); -static boolean sh_relax_section - PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *)); -static boolean sh_relax_delete_bytes - PARAMS ((bfd *, asection *, bfd_vma, int)); -static const struct sh_opcode *sh_insn_info PARAMS ((unsigned int)); -static boolean sh_align_loads - PARAMS ((bfd *, asection *, struct internal_reloc *, bfd_byte *, boolean *)); -static boolean sh_swap_insns - PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma)); -static boolean sh_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - struct internal_reloc *, struct internal_syment *, asection **)); -static bfd_byte *sh_coff_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, boolean, asymbol **)); - -/* Default section alignment to 2**4. */ -#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (4) - -/* Generate long file names. */ -#define COFF_LONG_FILENAMES - -/* The supported relocations. There are a lot of relocations defined - in coff/internal.h which we do not expect to ever see. */ -static reloc_howto_type sh_coff_howtos[] = -{ - { 0 }, - { 1 }, - { 2 }, - { 3 }, /* R_SH_PCREL8 */ - { 4 }, /* R_SH_PCREL16 */ - { 5 }, /* R_SH_HIGH8 */ - { 6 }, /* R_SH_IMM24 */ - { 7 }, /* R_SH_LOW16 */ - { 8 }, - { 9 }, /* R_SH_PCDISP8BY4 */ - - HOWTO (R_SH_PCDISP8BY2, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_pcdisp8by2", /* name */ - true, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - { 11 }, /* R_SH_PCDISP8 */ - - HOWTO (R_SH_PCDISP, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 12, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_pcdisp12by2", /* name */ - true, /* partial_inplace */ - 0xfff, /* src_mask */ - 0xfff, /* dst_mask */ - true), /* pcrel_offset */ - - { 13 }, - - HOWTO (R_SH_IMM32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_imm32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - { 15 }, - { 16 }, /* R_SH_IMM8 */ - { 17 }, /* R_SH_IMM8BY2 */ - { 18 }, /* R_SH_IMM8BY4 */ - { 19 }, /* R_SH_IMM4 */ - { 20 }, /* R_SH_IMM4BY2 */ - { 21 }, /* R_SH_IMM4BY4 */ - - HOWTO (R_SH_PCRELIMM8BY2, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_pcrelimm8by2", /* name */ - true, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - HOWTO (R_SH_PCRELIMM8BY4, /* type */ - 2, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_pcrelimm8by4", /* name */ - true, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - HOWTO (R_SH_IMM16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_imm16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_SWITCH16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_switch16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_SWITCH32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_switch32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_USES, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_uses", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_COUNT, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_count", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_ALIGN, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_align", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_CODE, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_code", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_DATA, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_data", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_LABEL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_label", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_SH_SWITCH8, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "r_switch8", /* name */ - true, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - false) /* pcrel_offset */ -}; - -#define SH_COFF_HOWTO_COUNT (sizeof sh_coff_howtos / sizeof sh_coff_howtos[0]) - -/* Check for a bad magic number. */ -#define BADMAG(x) SHBADMAG(x) - -/* Customize coffcode.h (this is not currently used). */ -#define SH 1 - -/* FIXME: This should not be set here. */ -#define __A_MAGIC_SET__ - -/* Swap the r_offset field in and out. */ -#define SWAP_IN_RELOC_OFFSET bfd_h_get_32 -#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32 - -/* Swap out extra information in the reloc structure. */ -#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ - do \ - { \ - dst->r_stuff[0] = 'S'; \ - dst->r_stuff[1] = 'C'; \ - } \ - while (0) - -/* Get the value of a symbol, when performing a relocation. */ - -static long -get_symbol_value (symbol) - asymbol *symbol; -{ - bfd_vma relocation; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = (symbol->value + - symbol->section->output_section->vma + - symbol->section->output_offset); - - return relocation; -} - -/* This macro is used in coffcode.h to get the howto corresponding to - an internal reloc. */ - -#define RTYPE2HOWTO(relent, internal) \ - ((relent)->howto = \ - ((internal)->r_type < SH_COFF_HOWTO_COUNT \ - ? &sh_coff_howtos[(internal)->r_type] \ - : (reloc_howto_type *) NULL)) - -/* This is the same as the macro in coffcode.h, except that it copies - r_offset into reloc_entry->addend for some relocs. */ -#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ - { \ - coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ - if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ - coffsym = (obj_symbols (abfd) \ - + (cache_ptr->sym_ptr_ptr - symbols)); \ - else if (ptr) \ - coffsym = coff_symbol_from (abfd, ptr); \ - if (coffsym != (coff_symbol_type *) NULL \ - && coffsym->native->u.syment.n_scnum == 0) \ - cache_ptr->addend = 0; \ - else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ - && ptr->section != (asection *) NULL) \ - cache_ptr->addend = - (ptr->section->vma + ptr->value); \ - else \ - cache_ptr->addend = 0; \ - if ((reloc).r_type == R_SH_SWITCH8 \ - || (reloc).r_type == R_SH_SWITCH16 \ - || (reloc).r_type == R_SH_SWITCH32 \ - || (reloc).r_type == R_SH_USES \ - || (reloc).r_type == R_SH_COUNT \ - || (reloc).r_type == R_SH_ALIGN) \ - cache_ptr->addend = (reloc).r_offset; \ - } - -/* This is the howto function for the SH relocations. */ - -static bfd_reloc_status_type -sh_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol_in; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - unsigned long insn; - bfd_vma sym_value; - unsigned short r_type; - bfd_vma addr = reloc_entry->address; - bfd_byte *hit_data = addr + (bfd_byte *) data; - - r_type = reloc_entry->howto->type; - - if (output_bfd != NULL) - { - /* Partial linking--do nothing. */ - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* Almost all relocs have to do with relaxing. If any work must be - done for them, it has been done in sh_relax_section. */ - if (r_type != R_SH_IMM32 - && (r_type != R_SH_PCDISP - || (symbol_in->flags & BSF_LOCAL) != 0)) - return bfd_reloc_ok; - - if (symbol_in != NULL - && bfd_is_und_section (symbol_in->section)) - return bfd_reloc_undefined; - - sym_value = get_symbol_value (symbol_in); - - switch (r_type) - { - case R_SH_IMM32: - insn = bfd_get_32 (abfd, hit_data); - insn += sym_value + reloc_entry->addend; - bfd_put_32 (abfd, insn, hit_data); - break; - case R_SH_PCDISP: - insn = bfd_get_16 (abfd, hit_data); - sym_value += reloc_entry->addend; - sym_value -= (input_section->output_section->vma - + input_section->output_offset - + addr - + 4); - sym_value += (insn & 0xfff) << 1; - if (insn & 0x800) - sym_value -= 0x1000; - insn = (insn & 0xf000) | (sym_value & 0xfff); - bfd_put_16 (abfd, insn, hit_data); - if (sym_value < (bfd_vma) -0x1000 || sym_value >= 0x1000) - return bfd_reloc_overflow; - break; - default: - abort (); - break; - } - - return bfd_reloc_ok; -} - -/* This routine checks for linking big and little endian objects - together. */ - -static boolean -sh_merge_private_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; -{ - if (ibfd->xvec->byteorder != obfd->xvec->byteorder - && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN) - { - (*_bfd_error_handler) - ("%s: compiled for a %s endian system and target is %s endian", - bfd_get_filename (ibfd), - bfd_big_endian (ibfd) ? "big" : "little", - bfd_big_endian (obfd) ? "big" : "little"); - - bfd_set_error (bfd_error_wrong_format); - return false; - } - - return true; -} - -#define coff_bfd_merge_private_bfd_data sh_merge_private_data - -/* We can do relaxing. */ -#define coff_bfd_relax_section sh_relax_section - -/* We use the special COFF backend linker. */ -#define coff_relocate_section sh_relocate_section - -/* When relaxing, we need to use special code to get the relocated - section contents. */ -#define coff_bfd_get_relocated_section_contents \ - sh_coff_get_relocated_section_contents - -#include "coffcode.h" - -/* This function handles relaxing on the SH. - - Function calls on the SH look like this: - - movl L1,r0 - ... - jsr @r0 - ... - L1: - .long function - - The compiler and assembler will cooperate to create R_SH_USES - relocs on the jsr instructions. The r_offset field of the - R_SH_USES reloc is the PC relative offset to the instruction which - loads the register (the r_offset field is computed as though it - were a jump instruction, so the offset value is actually from four - bytes past the instruction). The linker can use this reloc to - determine just which function is being called, and thus decide - whether it is possible to replace the jsr with a bsr. - - If multiple function calls are all based on a single register load - (i.e., the same function is called multiple times), the compiler - guarantees that each function call will have an R_SH_USES reloc. - Therefore, if the linker is able to convert each R_SH_USES reloc - which refers to that address, it can safely eliminate the register - load. - - When the assembler creates an R_SH_USES reloc, it examines it to - determine which address is being loaded (L1 in the above example). - It then counts the number of references to that address, and - creates an R_SH_COUNT reloc at that address. The r_offset field of - the R_SH_COUNT reloc will be the number of references. If the - linker is able to eliminate a register load, it can use the - R_SH_COUNT reloc to see whether it can also eliminate the function - address. - - SH relaxing also handles another, unrelated, matter. On the SH, if - a load or store instruction is not aligned on a four byte boundary, - the memory cycle interferes with the 32 bit instruction fetch, - causing a one cycle bubble in the pipeline. Therefore, we try to - align load and store instructions on four byte boundaries if we - can, by swapping them with one of the adjacent instructions. */ - -static boolean -sh_relax_section (abfd, sec, link_info, again) - bfd *abfd; - asection *sec; - struct bfd_link_info *link_info; - boolean *again; -{ - struct internal_reloc *internal_relocs; - struct internal_reloc *free_relocs = NULL; - boolean have_code; - struct internal_reloc *irel, *irelend; - bfd_byte *contents = NULL; - bfd_byte *free_contents = NULL; - - *again = false; - - if (link_info->relocateable - || (sec->flags & SEC_RELOC) == 0 - || sec->reloc_count == 0) - return true; - - /* If this is the first time we have been called for this section, - initialize the cooked size. */ - if (sec->_cooked_size == 0) - sec->_cooked_size = sec->_raw_size; - - internal_relocs = (_bfd_coff_read_internal_relocs - (abfd, sec, link_info->keep_memory, - (bfd_byte *) NULL, false, - (struct internal_reloc *) NULL)); - if (internal_relocs == NULL) - goto error_return; - if (! link_info->keep_memory) - free_relocs = internal_relocs; - - have_code = false; - - irelend = internal_relocs + sec->reloc_count; - for (irel = internal_relocs; irel < irelend; irel++) - { - bfd_vma laddr, paddr, symval; - unsigned short insn; - struct internal_reloc *irelfn, *irelscan, *irelcount; - struct internal_syment sym; - bfd_signed_vma foff; - - if (irel->r_type == R_SH_CODE) - have_code = true; - - if (irel->r_type != R_SH_USES) - continue; - - /* Get the section contents. */ - if (contents == NULL) - { - if (coff_section_data (abfd, sec) != NULL - && coff_section_data (abfd, sec)->contents != NULL) - contents = coff_section_data (abfd, sec)->contents; - else - { - contents = (bfd_byte *) bfd_malloc (sec->_raw_size); - if (contents == NULL) - goto error_return; - free_contents = contents; - - if (! bfd_get_section_contents (abfd, sec, contents, - (file_ptr) 0, sec->_raw_size)) - goto error_return; - } - } - - /* The r_offset field of the R_SH_USES reloc will point us to - the register load. The 4 is because the r_offset field is - computed as though it were a jump offset, which are based - from 4 bytes after the jump instruction. */ - laddr = irel->r_vaddr - sec->vma + 4; - /* Careful to sign extend the 32-bit offset. */ - laddr += ((irel->r_offset & 0xffffffff) ^ 0x80000000) - 0x80000000; - if (laddr >= sec->_raw_size) - { - (*_bfd_error_handler) ("%s: 0x%lx: warning: bad R_SH_USES offset", - bfd_get_filename (abfd), - (unsigned long) irel->r_vaddr); - continue; - } - insn = bfd_get_16 (abfd, contents + laddr); - - /* If the instruction is not mov.l NN,rN, we don't know what to do. */ - if ((insn & 0xf000) != 0xd000) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x", - bfd_get_filename (abfd), (unsigned long) irel->r_vaddr, insn)); - continue; - } - - /* Get the address from which the register is being loaded. The - displacement in the mov.l instruction is quadrupled. It is a - displacement from four bytes after the movl instruction, but, - before adding in the PC address, two least significant bits - of the PC are cleared. We assume that the section is aligned - on a four byte boundary. */ - paddr = insn & 0xff; - paddr *= 4; - paddr += (laddr + 4) &~ 3; - if (paddr >= sec->_raw_size) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: bad R_SH_USES load offset", - bfd_get_filename (abfd), (unsigned long) irel->r_vaddr)); - continue; - } - - /* Get the reloc for the address from which the register is - being loaded. This reloc will tell us which function is - actually being called. */ - paddr += sec->vma; - for (irelfn = internal_relocs; irelfn < irelend; irelfn++) - if (irelfn->r_vaddr == paddr - && irelfn->r_type == R_SH_IMM32) - break; - if (irelfn >= irelend) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: could not find expected reloc", - bfd_get_filename (abfd), (unsigned long) paddr)); - continue; - } - - /* Get the value of the symbol referred to by the reloc. */ - if (! _bfd_coff_get_external_symbols (abfd)) - goto error_return; - bfd_coff_swap_sym_in (abfd, - ((bfd_byte *) obj_coff_external_syms (abfd) - + (irelfn->r_symndx - * bfd_coff_symesz (abfd))), - &sym); - if (sym.n_scnum != 0 && sym.n_scnum != sec->target_index) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: symbol in unexpected section", - bfd_get_filename (abfd), (unsigned long) paddr)); - continue; - } - - if (sym.n_sclass != C_EXT) - { - symval = (sym.n_value - - sec->vma - + sec->output_section->vma - + sec->output_offset); - } - else - { - struct coff_link_hash_entry *h; - - h = obj_coff_sym_hashes (abfd)[irelfn->r_symndx]; - BFD_ASSERT (h != NULL); - if (h->root.type != bfd_link_hash_defined - && h->root.type != bfd_link_hash_defweak) - { - /* This appears to be a reference to an undefined - symbol. Just ignore it--it will be caught by the - regular reloc processing. */ - continue; - } - - symval = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - } - - symval += bfd_get_32 (abfd, contents + paddr - sec->vma); - - /* See if this function call can be shortened. */ - foff = (symval - - (irel->r_vaddr - - sec->vma - + sec->output_section->vma - + sec->output_offset - + 4)); - if (foff < -0x1000 || foff >= 0x1000) - { - /* After all that work, we can't shorten this function call. */ - continue; - } - - /* Shorten the function call. */ - - /* For simplicity of coding, we are going to modify the section - contents, the section relocs, and the BFD symbol table. We - must tell the rest of the code not to free up this - information. It would be possible to instead create a table - of changes which have to be made, as is done in coff-mips.c; - that would be more work, but would require less memory when - the linker is run. */ - - if (coff_section_data (abfd, sec) == NULL) - { - sec->used_by_bfd = - ((PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata))); - if (sec->used_by_bfd == NULL) - goto error_return; - } - - coff_section_data (abfd, sec)->relocs = internal_relocs; - coff_section_data (abfd, sec)->keep_relocs = true; - free_relocs = NULL; - - coff_section_data (abfd, sec)->contents = contents; - coff_section_data (abfd, sec)->keep_contents = true; - free_contents = NULL; - - obj_coff_keep_syms (abfd) = true; - - /* Replace the jsr with a bsr. */ - - /* Change the R_SH_USES reloc into an R_SH_PCDISP reloc, and - replace the jsr with a bsr. */ - irel->r_type = R_SH_PCDISP; - irel->r_symndx = irelfn->r_symndx; - if (sym.n_sclass != C_EXT) - { - /* If this needs to be changed because of future relaxing, - it will be handled here like other internal PCDISP - relocs. */ - bfd_put_16 (abfd, - 0xb000 | ((foff >> 1) & 0xfff), - contents + irel->r_vaddr - sec->vma); - } - else - { - /* We can't fully resolve this yet, because the external - symbol value may be changed by future relaxing. We let - the final link phase handle it. */ - bfd_put_16 (abfd, 0xb000, contents + irel->r_vaddr - sec->vma); - } - - /* See if there is another R_SH_USES reloc referring to the same - register load. */ - for (irelscan = internal_relocs; irelscan < irelend; irelscan++) - if (irelscan->r_type == R_SH_USES - && laddr == irelscan->r_vaddr - sec->vma + 4 + irelscan->r_offset) - break; - if (irelscan < irelend) - { - /* Some other function call depends upon this register load, - and we have not yet converted that function call. - Indeed, we may never be able to convert it. There is - nothing else we can do at this point. */ - continue; - } - - /* Look for a R_SH_COUNT reloc on the location where the - function address is stored. Do this before deleting any - bytes, to avoid confusion about the address. */ - for (irelcount = internal_relocs; irelcount < irelend; irelcount++) - if (irelcount->r_vaddr == paddr - && irelcount->r_type == R_SH_COUNT) - break; - - /* Delete the register load. */ - if (! sh_relax_delete_bytes (abfd, sec, laddr, 2)) - goto error_return; - - /* That will change things, so, just in case it permits some - other function call to come within range, we should relax - again. Note that this is not required, and it may be slow. */ - *again = true; - - /* Now check whether we got a COUNT reloc. */ - if (irelcount >= irelend) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: could not find expected COUNT reloc", - bfd_get_filename (abfd), (unsigned long) paddr)); - continue; - } - - /* The number of uses is stored in the r_offset field. We've - just deleted one. */ - if (irelcount->r_offset == 0) - { - ((*_bfd_error_handler) ("%s: 0x%lx: warning: bad count", - bfd_get_filename (abfd), - (unsigned long) paddr)); - continue; - } - - --irelcount->r_offset; - - /* If there are no more uses, we can delete the address. Reload - the address from irelfn, in case it was changed by the - previous call to sh_relax_delete_bytes. */ - if (irelcount->r_offset == 0) - { - if (! sh_relax_delete_bytes (abfd, sec, - irelfn->r_vaddr - sec->vma, 4)) - goto error_return; - } - - /* We've done all we can with that function call. */ - } - - /* Look for load and store instructions that we can align on four - byte boundaries. */ - if (have_code) - { - boolean swapped; - - /* Get the section contents. */ - if (contents == NULL) - { - if (coff_section_data (abfd, sec) != NULL - && coff_section_data (abfd, sec)->contents != NULL) - contents = coff_section_data (abfd, sec)->contents; - else - { - contents = (bfd_byte *) bfd_malloc (sec->_raw_size); - if (contents == NULL) - goto error_return; - free_contents = contents; - - if (! bfd_get_section_contents (abfd, sec, contents, - (file_ptr) 0, sec->_raw_size)) - goto error_return; - } - } - - if (! sh_align_loads (abfd, sec, internal_relocs, contents, &swapped)) - goto error_return; - - if (swapped) - { - if (coff_section_data (abfd, sec) == NULL) - { - sec->used_by_bfd = - ((PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata))); - if (sec->used_by_bfd == NULL) - goto error_return; - } - - coff_section_data (abfd, sec)->relocs = internal_relocs; - coff_section_data (abfd, sec)->keep_relocs = true; - free_relocs = NULL; - - coff_section_data (abfd, sec)->contents = contents; - coff_section_data (abfd, sec)->keep_contents = true; - free_contents = NULL; - - obj_coff_keep_syms (abfd) = true; - } - } - - if (free_relocs != NULL) - { - free (free_relocs); - free_relocs = NULL; - } - - if (free_contents != NULL) - { - if (! link_info->keep_memory) - free (free_contents); - else - { - /* Cache the section contents for coff_link_input_bfd. */ - if (coff_section_data (abfd, sec) == NULL) - { - sec->used_by_bfd = - ((PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata))); - if (sec->used_by_bfd == NULL) - goto error_return; - coff_section_data (abfd, sec)->relocs = NULL; - } - coff_section_data (abfd, sec)->contents = contents; - } - } - - return true; - - error_return: - if (free_relocs != NULL) - free (free_relocs); - if (free_contents != NULL) - free (free_contents); - return false; -} - -/* Delete some bytes from a section while relaxing. */ - -static boolean -sh_relax_delete_bytes (abfd, sec, addr, count) - bfd *abfd; - asection *sec; - bfd_vma addr; - int count; -{ - bfd_byte *contents; - struct internal_reloc *irel, *irelend; - struct internal_reloc *irelalign; - bfd_vma toaddr; - bfd_byte *esym, *esymend; - bfd_size_type symesz; - struct coff_link_hash_entry **sym_hash; - asection *o; - - contents = coff_section_data (abfd, sec)->contents; - - /* The deletion must stop at the next ALIGN reloc for an aligment - power larger than the number of bytes we are deleting. */ - - irelalign = NULL; - toaddr = sec->_cooked_size; - - irel = coff_section_data (abfd, sec)->relocs; - irelend = irel + sec->reloc_count; - for (; irel < irelend; irel++) - { - if (irel->r_type == R_SH_ALIGN - && irel->r_vaddr - sec->vma > addr - && count < (1 << irel->r_offset)) - { - irelalign = irel; - toaddr = irel->r_vaddr - sec->vma; - break; - } - } - - /* Actually delete the bytes. */ - memmove (contents + addr, contents + addr + count, toaddr - addr - count); - if (irelalign == NULL) - sec->_cooked_size -= count; - else - { - int i; - -#define NOP_OPCODE (0x0009) - - BFD_ASSERT ((count & 1) == 0); - for (i = 0; i < count; i += 2) - bfd_put_16 (abfd, NOP_OPCODE, contents + toaddr - count + i); - } - - /* Adjust all the relocs. */ - for (irel = coff_section_data (abfd, sec)->relocs; irel < irelend; irel++) - { - bfd_vma nraddr, stop; - bfd_vma start = 0; - int insn = 0; - struct internal_syment sym; - int off, adjust, oinsn; - bfd_signed_vma voff = 0; - boolean overflow; - - /* Get the new reloc address. */ - nraddr = irel->r_vaddr - sec->vma; - if ((irel->r_vaddr - sec->vma > addr - && irel->r_vaddr - sec->vma < toaddr) - || (irel->r_type == R_SH_ALIGN - && irel->r_vaddr - sec->vma == toaddr)) - nraddr -= count; - - /* See if this reloc was for the bytes we have deleted, in which - case we no longer care about it. Don't delete relocs which - represent addresses, though. */ - if (irel->r_vaddr - sec->vma >= addr - && irel->r_vaddr - sec->vma < addr + count - && irel->r_type != R_SH_ALIGN - && irel->r_type != R_SH_CODE - && irel->r_type != R_SH_DATA - && irel->r_type != R_SH_LABEL) - irel->r_type = R_SH_UNUSED; - - /* If this is a PC relative reloc, see if the range it covers - includes the bytes we have deleted. */ - switch (irel->r_type) - { - default: - break; - - case R_SH_PCDISP8BY2: - case R_SH_PCDISP: - case R_SH_PCRELIMM8BY2: - case R_SH_PCRELIMM8BY4: - start = irel->r_vaddr - sec->vma; - insn = bfd_get_16 (abfd, contents + nraddr); - break; - } - - switch (irel->r_type) - { - default: - start = stop = addr; - break; - - case R_SH_IMM32: - /* If this reloc is against a symbol defined in this - section, and the symbol will not be adjusted below, we - must check the addend to see it will put the value in - range to be adjusted, and hence must be changed. */ - bfd_coff_swap_sym_in (abfd, - ((bfd_byte *) obj_coff_external_syms (abfd) - + (irel->r_symndx - * bfd_coff_symesz (abfd))), - &sym); - if (sym.n_sclass != C_EXT - && sym.n_scnum == sec->target_index - && ((bfd_vma) sym.n_value <= addr - || (bfd_vma) sym.n_value >= toaddr)) - { - bfd_vma val; - - val = bfd_get_32 (abfd, contents + nraddr); - val += sym.n_value; - if (val >= addr && val < toaddr) - bfd_put_32 (abfd, val - count, contents + nraddr); - } - start = stop = addr; - break; - - case R_SH_PCDISP8BY2: - off = insn & 0xff; - if (off & 0x80) - off -= 0x100; - stop = (bfd_vma) ((bfd_signed_vma) start + 4 + off * 2); - break; - - case R_SH_PCDISP: - bfd_coff_swap_sym_in (abfd, - ((bfd_byte *) obj_coff_external_syms (abfd) - + (irel->r_symndx - * bfd_coff_symesz (abfd))), - &sym); - if (sym.n_sclass == C_EXT) - start = stop = addr; - else - { - off = insn & 0xfff; - if (off & 0x800) - off -= 0x1000; - stop = (bfd_vma) ((bfd_signed_vma) start + 4 + off * 2); - } - break; - - case R_SH_PCRELIMM8BY2: - off = insn & 0xff; - stop = start + 4 + off * 2; - break; - - case R_SH_PCRELIMM8BY4: - off = insn & 0xff; - stop = (start &~ (bfd_vma) 3) + 4 + off * 4; - break; - - case R_SH_SWITCH8: - case R_SH_SWITCH16: - case R_SH_SWITCH32: - /* These relocs types represent - .word L2-L1 - The r_offset field holds the difference between the reloc - address and L1. That is the start of the reloc, and - adding in the contents gives us the top. We must adjust - both the r_offset field and the section contents. */ - - start = irel->r_vaddr - sec->vma; - stop = (bfd_vma) ((bfd_signed_vma) start - (long) irel->r_offset); - - if (start > addr - && start < toaddr - && (stop <= addr || stop >= toaddr)) - irel->r_offset += count; - else if (stop > addr - && stop < toaddr - && (start <= addr || start >= toaddr)) - irel->r_offset -= count; - - start = stop; - - if (irel->r_type == R_SH_SWITCH16) - voff = bfd_get_signed_16 (abfd, contents + nraddr); - else if (irel->r_type == R_SH_SWITCH8) - voff = bfd_get_8 (abfd, contents + nraddr); - else - voff = bfd_get_signed_32 (abfd, contents + nraddr); - stop = (bfd_vma) ((bfd_signed_vma) start + voff); - - break; - - case R_SH_USES: - start = irel->r_vaddr - sec->vma; - stop = (bfd_vma) ((bfd_signed_vma) start - + (long) irel->r_offset - + 4); - break; - } - - if (start > addr - && start < toaddr - && (stop <= addr || stop >= toaddr)) - adjust = count; - else if (stop > addr - && stop < toaddr - && (start <= addr || start >= toaddr)) - adjust = - count; - else - adjust = 0; - - if (adjust != 0) - { - oinsn = insn; - overflow = false; - switch (irel->r_type) - { - default: - abort (); - break; - - case R_SH_PCDISP8BY2: - case R_SH_PCRELIMM8BY2: - insn += adjust / 2; - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); - break; - - case R_SH_PCDISP: - insn += adjust / 2; - if ((oinsn & 0xf000) != (insn & 0xf000)) - overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); - break; - - case R_SH_PCRELIMM8BY4: - BFD_ASSERT (adjust == count || count >= 4); - if (count >= 4) - insn += adjust / 4; - else - { - if ((irel->r_vaddr & 3) == 0) - ++insn; - } - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); - break; - - case R_SH_SWITCH8: - voff += adjust; - if (voff < 0 || voff >= 0xff) - overflow = true; - bfd_put_8 (abfd, voff, contents + nraddr); - break; - - case R_SH_SWITCH16: - voff += adjust; - if (voff < - 0x8000 || voff >= 0x8000) - overflow = true; - bfd_put_signed_16 (abfd, voff, contents + nraddr); - break; - - case R_SH_SWITCH32: - voff += adjust; - bfd_put_signed_32 (abfd, voff, contents + nraddr); - break; - - case R_SH_USES: - irel->r_offset += adjust; - break; - } - - if (overflow) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: fatal: reloc overflow while relaxing", - bfd_get_filename (abfd), (unsigned long) irel->r_vaddr)); - bfd_set_error (bfd_error_bad_value); - return false; - } - } - - irel->r_vaddr = nraddr + sec->vma; - } - - /* Look through all the other sections. If there contain any IMM32 - relocs against internal symbols which we are not going to adjust - below, we may need to adjust the addends. */ - for (o = abfd->sections; o != NULL; o = o->next) - { - struct internal_reloc *internal_relocs; - struct internal_reloc *irelscan, *irelscanend; - bfd_byte *ocontents; - - if (o == sec - || (o->flags & SEC_RELOC) == 0 - || o->reloc_count == 0) - continue; - - /* We always cache the relocs. Perhaps, if info->keep_memory is - false, we should free them, if we are permitted to, when we - leave sh_coff_relax_section. */ - internal_relocs = (_bfd_coff_read_internal_relocs - (abfd, o, true, (bfd_byte *) NULL, false, - (struct internal_reloc *) NULL)); - if (internal_relocs == NULL) - return false; - - ocontents = NULL; - irelscanend = internal_relocs + o->reloc_count; - for (irelscan = internal_relocs; irelscan < irelscanend; irelscan++) - { - struct internal_syment sym; - - if (irelscan->r_type != R_SH_IMM32) - continue; - - bfd_coff_swap_sym_in (abfd, - ((bfd_byte *) obj_coff_external_syms (abfd) - + (irelscan->r_symndx - * bfd_coff_symesz (abfd))), - &sym); - if (sym.n_sclass != C_EXT - && sym.n_scnum == sec->target_index - && ((bfd_vma) sym.n_value <= addr - || (bfd_vma) sym.n_value >= toaddr)) - { - bfd_vma val; - - if (ocontents == NULL) - { - if (coff_section_data (abfd, o)->contents != NULL) - ocontents = coff_section_data (abfd, o)->contents; - else - { - /* We always cache the section contents. - Perhaps, if info->keep_memory is false, we - should free them, if we are permitted to, - when we leave sh_coff_relax_section. */ - ocontents = (bfd_byte *) bfd_malloc (o->_raw_size); - if (ocontents == NULL) - return false; - if (! bfd_get_section_contents (abfd, o, ocontents, - (file_ptr) 0, - o->_raw_size)) - return false; - coff_section_data (abfd, o)->contents = ocontents; - } - } - - val = bfd_get_32 (abfd, ocontents + irelscan->r_vaddr - o->vma); - val += sym.n_value; - if (val >= addr && val < toaddr) - bfd_put_32 (abfd, val - count, - ocontents + irelscan->r_vaddr - o->vma); - - coff_section_data (abfd, o)->keep_contents = true; - } - } - } - - /* Adjusting the internal symbols will not work if something has - already retrieved the generic symbols. It would be possible to - make this work by adjusting the generic symbols at the same time. - However, this case should not arise in normal usage. */ - if (obj_symbols (abfd) != NULL - || obj_raw_syments (abfd) != NULL) - { - ((*_bfd_error_handler) - ("%s: fatal: generic symbols retrieved before relaxing", - bfd_get_filename (abfd))); - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - /* Adjust all the symbols. */ - sym_hash = obj_coff_sym_hashes (abfd); - symesz = bfd_coff_symesz (abfd); - esym = (bfd_byte *) obj_coff_external_syms (abfd); - esymend = esym + obj_raw_syment_count (abfd) * symesz; - while (esym < esymend) - { - struct internal_syment isym; - - bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &isym); - - if (isym.n_scnum == sec->target_index - && (bfd_vma) isym.n_value > addr - && (bfd_vma) isym.n_value < toaddr) - { - isym.n_value -= count; - - bfd_coff_swap_sym_out (abfd, (PTR) &isym, (PTR) esym); - - if (*sym_hash != NULL) - { - BFD_ASSERT ((*sym_hash)->root.type == bfd_link_hash_defined - || (*sym_hash)->root.type == bfd_link_hash_defweak); - BFD_ASSERT ((*sym_hash)->root.u.def.value >= addr - && (*sym_hash)->root.u.def.value < toaddr); - (*sym_hash)->root.u.def.value -= count; - } - } - - esym += (isym.n_numaux + 1) * symesz; - sym_hash += isym.n_numaux + 1; - } - - /* See if we can move the ALIGN reloc forward. We have adjusted - r_vaddr for it already. */ - if (irelalign != NULL) - { - bfd_vma alignto, alignaddr; - - alignto = BFD_ALIGN (toaddr, 1 << irelalign->r_offset); - alignaddr = BFD_ALIGN (irelalign->r_vaddr - sec->vma, - 1 << irelalign->r_offset); - if (alignto != alignaddr) - { - /* Tail recursion. */ - return sh_relax_delete_bytes (abfd, sec, alignaddr, - alignto - alignaddr); - } - } - - return true; -} - -/* This is yet another version of the SH opcode table, used to rapidly - get information about a particular instruction. */ - -/* The opcode map is represented by an array of these structures. The - array is indexed by the high order four bits in the instruction. */ - -struct sh_major_opcode -{ - /* A pointer to the instruction list. This is an array which - contains all the instructions with this major opcode. */ - const struct sh_minor_opcode *minor_opcodes; - /* The number of elements in minor_opcodes. */ - unsigned short count; -}; - -/* This structure holds information for a set of SH opcodes. The - instruction code is anded with the mask value, and the resulting - value is used to search the order opcode list. */ - -struct sh_minor_opcode -{ - /* The sorted opcode list. */ - const struct sh_opcode *opcodes; - /* The number of elements in opcodes. */ - unsigned short count; - /* The mask value to use when searching the opcode list. */ - unsigned short mask; -}; - -/* This structure holds information for an SH instruction. An array - of these structures is sorted in order by opcode. */ - -struct sh_opcode -{ - /* The code for this instruction, after it has been anded with the - mask value in the sh_major_opcode structure. */ - unsigned short opcode; - /* Flags for this instruction. */ - unsigned short flags; -}; - -/* Flag which appear in the sh_opcode structure. */ - -/* This instruction loads a value from memory. */ -#define LOAD (0x1) - -/* This instruction stores a value to memory. */ -#define STORE (0x2) - -/* This instruction is a branch. */ -#define BRANCH (0x4) - -/* This instruction has a delay slot. */ -#define DELAY (0x8) - -/* This instruction uses the value in the register in the field at - mask 0x0f00 of the instruction. */ -#define USES1 (0x10) - -/* This instruction uses the value in the register in the field at - mask 0x00f0 of the instruction. */ -#define USES2 (0x20) - -/* This instruction uses the value in register 0. */ -#define USESR0 (0x40) - -/* This instruction sets the value in the register in the field at - mask 0x0f00 of the instruction. */ -#define SETS1 (0x80) - -/* This instruction sets the value in the register in the field at - mask 0x00f0 of the instruction. */ -#define SETS2 (0x100) - -/* This instruction sets register 0. */ -#define SETSR0 (0x200) - -/* This instruction sets a special register. */ -#define SETSSP (0x400) - -/* This instruction uses a special register. */ -#define USESSP (0x800) - -/* This instruction uses the floating point register in the field at - mask 0x0f00 of the instruction. */ -#define USESF1 (0x1000) - -/* This instruction uses the floating point register in the field at - mask 0x00f0 of the instruction. */ -#define USESF2 (0x2000) - -/* This instruction uses floating point register 0. */ -#define USESF0 (0x4000) - -/* This instruction sets the floating point register in the field at - mask 0x0f00 of the instruction. */ -#define SETSF1 (0x8000) - -static boolean sh_insn_uses_reg - PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); -static boolean sh_insn_uses_freg - PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); -static boolean sh_insns_conflict - PARAMS ((unsigned int, const struct sh_opcode *, unsigned int, - const struct sh_opcode *)); -static boolean sh_load_use - PARAMS ((unsigned int, const struct sh_opcode *, unsigned int, - const struct sh_opcode *)); - -/* The opcode maps. */ - -#define MAP(a) a, sizeof a / sizeof a[0] - -static const struct sh_opcode sh_opcode00[] = -{ - { 0x0008, SETSSP }, /* clrt */ - { 0x0009, 0 }, /* nop */ - { 0x000b, BRANCH | DELAY | USESSP }, /* rts */ - { 0x0018, SETSSP }, /* sett */ - { 0x0019, SETSSP }, /* div0u */ - { 0x001b, 0 }, /* sleep */ - { 0x0028, SETSSP }, /* clrmac */ - { 0x002b, BRANCH | DELAY | SETSSP }, /* rte */ - { 0x0038, USESSP | SETSSP }, /* ldtlb */ - { 0x0048, SETSSP }, /* clrs */ - { 0x0058, SETSSP } /* sets */ -}; - -static const struct sh_opcode sh_opcode01[] = -{ - { 0x0002, SETS1 | USESSP }, /* stc sr,rn */ - { 0x0003, BRANCH | DELAY | USES1 | SETSSP }, /* bsrf rn */ - { 0x000a, SETS1 | USESSP }, /* sts mach,rn */ - { 0x0012, SETS1 | USESSP }, /* stc gbr,rn */ - { 0x001a, SETS1 | USESSP }, /* sts macl,rn */ - { 0x0022, SETS1 | USESSP }, /* stc vbr,rn */ - { 0x0023, BRANCH | DELAY | USES1 }, /* braf rn */ - { 0x0029, SETS1 | USESSP }, /* movt rn */ - { 0x002a, SETS1 | USESSP }, /* sts pr,rn */ - { 0x0032, SETS1 | USESSP }, /* stc ssr,rn */ - { 0x0042, SETS1 | USESSP }, /* stc spc,rn */ - { 0x005a, SETS1 | USESSP }, /* sts fpul,rn */ - { 0x006a, SETS1 | USESSP }, /* sts fpscr,rn */ - { 0x0082, SETS1 | USESSP }, /* stc r0_bank,rn */ - { 0x0083, LOAD | USES1 }, /* pref @rn */ - { 0x0092, SETS1 | USESSP }, /* stc r1_bank,rn */ - { 0x00a2, SETS1 | USESSP }, /* stc r2_bank,rn */ - { 0x00b2, SETS1 | USESSP }, /* stc r3_bank,rn */ - { 0x00c2, SETS1 | USESSP }, /* stc r4_bank,rn */ - { 0x00d2, SETS1 | USESSP }, /* stc r5_bank,rn */ - { 0x00e2, SETS1 | USESSP }, /* stc r6_bank,rn */ - { 0x00f2, SETS1 | USESSP } /* stc r7_bank,rn */ -}; - -static const struct sh_opcode sh_opcode02[] = -{ - { 0x0004, STORE | USES1 | USES2 | USESR0 }, /* mov.b rm,@(r0,rn) */ - { 0x0005, STORE | USES1 | USES2 | USESR0 }, /* mov.w rm,@(r0,rn) */ - { 0x0006, STORE | USES1 | USES2 | USESR0 }, /* mov.l rm,@(r0,rn) */ - { 0x0007, SETSSP | USES1 | USES2 }, /* mul.l rm,rn */ - { 0x000c, LOAD | SETS1 | USES2 | USESR0 }, /* mov.b @(r0,rm),rn */ - { 0x000d, LOAD | SETS1 | USES2 | USESR0 }, /* mov.w @(r0,rm),rn */ - { 0x000e, LOAD | SETS1 | USES2 | USESR0 }, /* mov.l @(r0,rm),rn */ - { 0x000f, LOAD|SETS1|SETS2|SETSSP|USES1|USES2|USESSP }, /* mac.l @rm+,@rn+ */ -}; - -static const struct sh_minor_opcode sh_opcode0[] = -{ - { MAP (sh_opcode00), 0xffff }, - { MAP (sh_opcode01), 0xf0ff }, - { MAP (sh_opcode02), 0xf00f } -}; - -static const struct sh_opcode sh_opcode10[] = -{ - { 0x1000, STORE | USES1 | USES2 } /* mov.l rm,@(disp,rn) */ -}; - -static const struct sh_minor_opcode sh_opcode1[] = -{ - { MAP (sh_opcode10), 0xf000 } -}; - -static const struct sh_opcode sh_opcode20[] = -{ - { 0x2000, STORE | USES1 | USES2 }, /* mov.b rm,@rn */ - { 0x2001, STORE | USES1 | USES2 }, /* mov.w rm,@rn */ - { 0x2002, STORE | USES1 | USES2 }, /* mov.l rm,@rn */ - { 0x2004, STORE | SETS1 | USES1 | USES2 }, /* mov.b rm,@-rn */ - { 0x2005, STORE | SETS1 | USES1 | USES2 }, /* mov.w rm,@-rn */ - { 0x2006, STORE | SETS1 | USES1 | USES2 }, /* mov.l rm,@-rn */ - { 0x2007, SETSSP | USES1 | USES2 | USESSP }, /* div0s */ - { 0x2008, SETSSP | USES1 | USES2 }, /* tst rm,rn */ - { 0x2009, SETS1 | USES1 | USES2 }, /* and rm,rn */ - { 0x200a, SETS1 | USES1 | USES2 }, /* xor rm,rn */ - { 0x200b, SETS1 | USES1 | USES2 }, /* or rm,rn */ - { 0x200c, SETSSP | USES1 | USES2 }, /* cmp/str rm,rn */ - { 0x200d, SETS1 | USES1 | USES2 }, /* xtrct rm,rn */ - { 0x200e, SETSSP | USES1 | USES2 }, /* mulu.w rm,rn */ - { 0x200f, SETSSP | USES1 | USES2 } /* muls.w rm,rn */ -}; - -static const struct sh_minor_opcode sh_opcode2[] = -{ - { MAP (sh_opcode20), 0xf00f } -}; - -static const struct sh_opcode sh_opcode30[] = -{ - { 0x3000, SETSSP | USES1 | USES2 }, /* cmp/eq rm,rn */ - { 0x3002, SETSSP | USES1 | USES2 }, /* cmp/hs rm,rn */ - { 0x3003, SETSSP | USES1 | USES2 }, /* cmp/ge rm,rn */ - { 0x3004, SETSSP | USESSP | USES1 | USES2 }, /* div1 rm,rn */ - { 0x3005, SETSSP | USES1 | USES2 }, /* dmulu.l rm,rn */ - { 0x3006, SETSSP | USES1 | USES2 }, /* cmp/hi rm,rn */ - { 0x3007, SETSSP | USES1 | USES2 }, /* cmp/gt rm,rn */ - { 0x3008, SETS1 | USES1 | USES2 }, /* sub rm,rn */ - { 0x300a, SETS1 | SETSSP | USES1 | USES2 | USESSP }, /* subc rm,rn */ - { 0x300b, SETS1 | SETSSP | USES1 | USES2 }, /* subv rm,rn */ - { 0x300c, SETS1 | USES1 | USES2 }, /* add rm,rn */ - { 0x300d, SETSSP | USES1 | USES2 }, /* dmuls.l rm,rn */ - { 0x300e, SETS1 | SETSSP | USES1 | USES2 | USESSP }, /* addc rm,rn */ - { 0x300f, SETS1 | SETSSP | USES1 | USES2 } /* addv rm,rn */ -}; - -static const struct sh_minor_opcode sh_opcode3[] = -{ - { MAP (sh_opcode30), 0xf00f } -}; - -static const struct sh_opcode sh_opcode40[] = -{ - { 0x4000, SETS1 | SETSSP | USES1 }, /* shll rn */ - { 0x4001, SETS1 | SETSSP | USES1 }, /* shlr rn */ - { 0x4002, STORE | SETS1 | USES1 | USESSP }, /* sts.l mach,@-rn */ - { 0x4003, STORE | SETS1 | USES1 | USESSP }, /* stc.l sr,@-rn */ - { 0x4004, SETS1 | SETSSP | USES1 }, /* rotl rn */ - { 0x4005, SETS1 | SETSSP | USES1 }, /* rotr rn */ - { 0x4006, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,mach */ - { 0x4007, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,sr */ - { 0x4008, SETS1 | USES1 }, /* shll2 rn */ - { 0x4009, SETS1 | USES1 }, /* shlr2 rn */ - { 0x400a, SETSSP | USES1 }, /* lds rm,mach */ - { 0x400b, BRANCH | DELAY | USES1 }, /* jsr @rn */ - { 0x400e, SETSSP | USES1 }, /* ldc rm,sr */ - { 0x4010, SETS1 | SETSSP | USES1 }, /* dt rn */ - { 0x4011, SETSSP | USES1 }, /* cmp/pz rn */ - { 0x4012, STORE | SETS1 | USES1 | USESSP }, /* sts.l macl,@-rn */ - { 0x4013, STORE | SETS1 | USES1 | USESSP }, /* stc.l gbr,@-rn */ - { 0x4015, SETSSP | USES1 }, /* cmp/pl rn */ - { 0x4016, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,macl */ - { 0x4017, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,gbr */ - { 0x4018, SETS1 | USES1 }, /* shll8 rn */ - { 0x4019, SETS1 | USES1 }, /* shlr8 rn */ - { 0x401a, SETSSP | USES1 }, /* lds rm,macl */ - { 0x401b, LOAD | SETSSP | USES1 }, /* tas.b @rn */ - { 0x401e, SETSSP | USES1 }, /* ldc rm,gbr */ - { 0x4020, SETS1 | SETSSP | USES1 }, /* shal rn */ - { 0x4021, SETS1 | SETSSP | USES1 }, /* shar rn */ - { 0x4022, STORE | SETS1 | USES1 | USESSP }, /* sts.l pr,@-rn */ - { 0x4023, STORE | SETS1 | USES1 | USESSP }, /* stc.l vbr,@-rn */ - { 0x4024, SETS1 | SETSSP | USES1 | USESSP }, /* rotcl rn */ - { 0x4025, SETS1 | SETSSP | USES1 | USESSP }, /* rotcr rn */ - { 0x4026, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,pr */ - { 0x4027, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,vbr */ - { 0x4028, SETS1 | USES1 }, /* shll16 rn */ - { 0x4029, SETS1 | USES1 }, /* shlr16 rn */ - { 0x402a, SETSSP | USES1 }, /* lds rm,pr */ - { 0x402b, BRANCH | DELAY | USES1 }, /* jmp @rn */ - { 0x402e, SETSSP | USES1 }, /* ldc rm,vbr */ - { 0x4033, STORE | SETS1 | USES1 | USESSP }, /* stc.l ssr,@-rn */ - { 0x4037, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,ssr */ - { 0x403e, SETSSP | USES1 }, /* ldc rm,ssr */ - { 0x4043, STORE | SETS1 | USES1 | USESSP }, /* stc.l spc,@-rn */ - { 0x4047, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,spc */ - { 0x404e, SETSSP | USES1 }, /* ldc rm,spc */ - { 0x4052, STORE | SETS1 | USES1 | USESSP }, /* sts.l fpul,@-rn */ - { 0x4056, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,fpul */ - { 0x405a, SETSSP | USES1 }, /* lds.l rm,fpul */ - { 0x4062, STORE | SETS1 | USES1 | USESSP }, /* sts.l fpscr,@-rn */ - { 0x4066, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,fpscr */ - { 0x406a, SETSSP | USES1 } /* lds rm,fpscr */ -}; - -static const struct sh_opcode sh_opcode41[] = -{ - { 0x4083, STORE | SETS1 | USES1 | USESSP }, /* stc.l rx_bank,@-rn */ - { 0x4087, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,rx_bank */ - { 0x408e, SETSSP | USES1 } /* ldc rm,rx_bank */ -}; - -static const struct sh_opcode sh_opcode42[] = -{ - { 0x400c, SETS1 | USES1 | USES2 }, /* shad rm,rn */ - { 0x400d, SETS1 | USES1 | USES2 }, /* shld rm,rn */ - { 0x400f, LOAD|SETS1|SETS2|SETSSP|USES1|USES2|USESSP }, /* mac.w @rm+,@rn+ */ -}; - -static const struct sh_minor_opcode sh_opcode4[] = -{ - { MAP (sh_opcode40), 0xf0ff }, - { MAP (sh_opcode41), 0xf08f }, - { MAP (sh_opcode42), 0xf00f } -}; - -static const struct sh_opcode sh_opcode50[] = -{ - { 0x5000, LOAD | SETS1 | USES2 } /* mov.l @(disp,rm),rn */ -}; - -static const struct sh_minor_opcode sh_opcode5[] = -{ - { MAP (sh_opcode50), 0xf000 } -}; - -static const struct sh_opcode sh_opcode60[] = -{ - { 0x6000, LOAD | SETS1 | USES2 }, /* mov.b @rm,rn */ - { 0x6001, LOAD | SETS1 | USES2 }, /* mov.w @rm,rn */ - { 0x6002, LOAD | SETS1 | USES2 }, /* mov.l @rm,rn */ - { 0x6003, SETS1 | USES2 }, /* mov rm,rn */ - { 0x6004, LOAD | SETS1 | SETS2 | USES2 }, /* mov.b @rm+,rn */ - { 0x6005, LOAD | SETS1 | SETS2 | USES2 }, /* mov.w @rm+,rn */ - { 0x6006, LOAD | SETS1 | SETS2 | USES2 }, /* mov.l @rm+,rn */ - { 0x6007, SETS1 | USES2 }, /* not rm,rn */ - { 0x6008, SETS1 | USES2 }, /* swap.b rm,rn */ - { 0x6009, SETS1 | USES2 }, /* swap.w rm,rn */ - { 0x600a, SETS1 | SETSSP | USES2 | USESSP }, /* negc rm,rn */ - { 0x600b, SETS1 | USES2 }, /* neg rm,rn */ - { 0x600c, SETS1 | USES2 }, /* extu.b rm,rn */ - { 0x600d, SETS1 | USES2 }, /* extu.w rm,rn */ - { 0x600e, SETS1 | USES2 }, /* exts.b rm,rn */ - { 0x600f, SETS1 | USES2 } /* exts.w rm,rn */ -}; - -static const struct sh_minor_opcode sh_opcode6[] = -{ - { MAP (sh_opcode60), 0xf00f } -}; - -static const struct sh_opcode sh_opcode70[] = -{ - { 0x7000, SETS1 | USES1 } /* add #imm,rn */ -}; - -static const struct sh_minor_opcode sh_opcode7[] = -{ - { MAP (sh_opcode70), 0xf000 } -}; - -static const struct sh_opcode sh_opcode80[] = -{ - { 0x8000, STORE | USES2 | USESR0 }, /* mov.b r0,@(disp,rn) */ - { 0x8100, STORE | USES2 | USESR0 }, /* mov.w r0,@(disp,rn) */ - { 0x8400, LOAD | SETSR0 | USES2 }, /* mov.b @(disp,rm),r0 */ - { 0x8500, LOAD | SETSR0 | USES2 }, /* mov.w @(disp,rn),r0 */ - { 0x8800, SETSSP | USESR0 }, /* cmp/eq #imm,r0 */ - { 0x8900, BRANCH | USESSP }, /* bt label */ - { 0x8b00, BRANCH | USESSP }, /* bf label */ - { 0x8d00, BRANCH | DELAY | USESSP }, /* bt/s label */ - { 0x8f00, BRANCH | DELAY | USESSP } /* bf/s label */ -}; - -static const struct sh_minor_opcode sh_opcode8[] = -{ - { MAP (sh_opcode80), 0xff00 } -}; - -static const struct sh_opcode sh_opcode90[] = -{ - { 0x9000, LOAD | SETS1 } /* mov.w @(disp,pc),rn */ -}; - -static const struct sh_minor_opcode sh_opcode9[] = -{ - { MAP (sh_opcode90), 0xf000 } -}; - -static const struct sh_opcode sh_opcodea0[] = -{ - { 0xa000, BRANCH | DELAY } /* bra label */ -}; - -static const struct sh_minor_opcode sh_opcodea[] = -{ - { MAP (sh_opcodea0), 0xf000 } -}; - -static const struct sh_opcode sh_opcodeb0[] = -{ - { 0xb000, BRANCH | DELAY } /* bsr label */ -}; - -static const struct sh_minor_opcode sh_opcodeb[] = -{ - { MAP (sh_opcodeb0), 0xf000 } -}; - -static const struct sh_opcode sh_opcodec0[] = -{ - { 0xc000, STORE | USESR0 | USESSP }, /* mov.b r0,@(disp,gbr) */ - { 0xc100, STORE | USESR0 | USESSP }, /* mov.w r0,@(disp,gbr) */ - { 0xc200, STORE | USESR0 | USESSP }, /* mov.l r0,@(disp,gbr) */ - { 0xc300, BRANCH | USESSP }, /* trapa #imm */ - { 0xc400, LOAD | SETSR0 | USESSP }, /* mov.b @(disp,gbr),r0 */ - { 0xc500, LOAD | SETSR0 | USESSP }, /* mov.w @(disp,gbr),r0 */ - { 0xc600, LOAD | SETSR0 | USESSP }, /* mov.l @(disp,gbr),r0 */ - { 0xc700, SETSR0 }, /* mova @(disp,pc),r0 */ - { 0xc800, SETSSP | USESR0 }, /* tst #imm,r0 */ - { 0xc900, SETSR0 | USESR0 }, /* and #imm,r0 */ - { 0xca00, SETSR0 | USESR0 }, /* xor #imm,r0 */ - { 0xcb00, SETSR0 | USESR0 }, /* or #imm,r0 */ - { 0xcc00, LOAD | SETSSP | USESR0 | USESSP }, /* tst.b #imm,@(r0,gbr) */ - { 0xcd00, LOAD | STORE | USESR0 | USESSP }, /* and.b #imm,@(r0,gbr) */ - { 0xce00, LOAD | STORE | USESR0 | USESSP }, /* xor.b #imm,@(r0,gbr) */ - { 0xcf00, LOAD | STORE | USESR0 | USESSP } /* or.b #imm,@(r0,gbr) */ -}; - -static const struct sh_minor_opcode sh_opcodec[] = -{ - { MAP (sh_opcodec0), 0xff00 } -}; - -static const struct sh_opcode sh_opcoded0[] = -{ - { 0xd000, LOAD | SETS1 } /* mov.l @(disp,pc),rn */ -}; - -static const struct sh_minor_opcode sh_opcoded[] = -{ - { MAP (sh_opcoded0), 0xf000 } -}; - -static const struct sh_opcode sh_opcodee0[] = -{ - { 0xe000, SETS1 } /* mov #imm,rn */ -}; - -static const struct sh_minor_opcode sh_opcodee[] = -{ - { MAP (sh_opcodee0), 0xf000 } -}; - -static const struct sh_opcode sh_opcodef0[] = -{ - { 0xf000, SETSF1 | USESF1 | USESF2 }, /* fadd fm,fn */ - { 0xf001, SETSF1 | USESF1 | USESF2 }, /* fsub fm,fn */ - { 0xf002, SETSF1 | USESF1 | USESF2 }, /* fmul fm,fn */ - { 0xf003, SETSF1 | USESF1 | USESF2 }, /* fdiv fm,fn */ - { 0xf004, SETSSP | USESF1 | USESF2 }, /* fcmp/eq fm,fn */ - { 0xf005, SETSSP | USESF1 | USESF2 }, /* fcmp/gt fm,fn */ - { 0xf006, LOAD | SETSF1 | USES2 | USESR0 }, /* fmov.s @(r0,rm),fn */ - { 0xf007, STORE | USES1 | USESF2 | USESR0 }, /* fmov.s fm,@(r0,rn) */ - { 0xf008, LOAD | SETSF1 | USES2 }, /* fmov.s @rm,fn */ - { 0xf009, LOAD | SETS2 | SETSF1 | USES2 }, /* fmov.s @rm+,fn */ - { 0xf00a, STORE | USES1 | USESF2 }, /* fmov.s fm,@rn */ - { 0xf00b, STORE | SETS1 | USES1 | USESF2 }, /* fmov.s fm,@-rn */ - { 0xf00c, SETSF1 | USESF2 }, /* fmov fm,fn */ - { 0xf00e, SETSF1 | USESF1 | USESF2 | USESF0 } /* fmac f0,fm,fn */ -}; - -static const struct sh_opcode sh_opcodef1[] = -{ - { 0xf00d, SETSF1 | USESSP }, /* fsts fpul,fn */ - { 0xf01d, SETSSP | USESF1 }, /* flds fn,fpul */ - { 0xf02d, SETSF1 | USESSP }, /* float fpul,fn */ - { 0xf03d, SETSSP | USESF1 }, /* ftrc fn,fpul */ - { 0xf04d, SETSF1 | USESF1 }, /* fneg fn */ - { 0xf05d, SETSF1 | USESF1 }, /* fabs fn */ - { 0xf06d, SETSF1 | USESF1 }, /* fsqrt fn */ - { 0xf07d, SETSSP | USESF1 }, /* ftst/nan fn */ - { 0xf08d, SETSF1 }, /* fldi0 fn */ - { 0xf09d, SETSF1 } /* fldi1 fn */ -}; - -static const struct sh_minor_opcode sh_opcodef[] = -{ - { MAP (sh_opcodef0), 0xf00f }, - { MAP (sh_opcodef1), 0xf0ff } -}; - -static const struct sh_major_opcode sh_opcodes[] = -{ - { MAP (sh_opcode0) }, - { MAP (sh_opcode1) }, - { MAP (sh_opcode2) }, - { MAP (sh_opcode3) }, - { MAP (sh_opcode4) }, - { MAP (sh_opcode5) }, - { MAP (sh_opcode6) }, - { MAP (sh_opcode7) }, - { MAP (sh_opcode8) }, - { MAP (sh_opcode9) }, - { MAP (sh_opcodea) }, - { MAP (sh_opcodeb) }, - { MAP (sh_opcodec) }, - { MAP (sh_opcoded) }, - { MAP (sh_opcodee) }, - { MAP (sh_opcodef) } -}; - -/* Given an instruction, return a pointer to the corresponding - sh_opcode structure. Return NULL if the instruction is not - recognized. */ - -static const struct sh_opcode * -sh_insn_info (insn) - unsigned int insn; -{ - const struct sh_major_opcode *maj; - const struct sh_minor_opcode *min, *minend; - - maj = &sh_opcodes[(insn & 0xf000) >> 12]; - min = maj->minor_opcodes; - minend = min + maj->count; - for (; min < minend; min++) - { - unsigned int l; - const struct sh_opcode *op, *opend; - - l = insn & min->mask; - op = min->opcodes; - opend = op + min->count; - - /* Since the opcodes tables are sorted, we could use a binary - search here if the count were above some cutoff value. */ - for (; op < opend; op++) - if (op->opcode == l) - return op; - } - - return NULL; -} - -/* See whether an instruction uses a general purpose register. */ - -static boolean -sh_insn_uses_reg (insn, op, reg) - unsigned int insn; - const struct sh_opcode *op; - unsigned int reg; -{ - unsigned int f; - - f = op->flags; - - if ((f & USES1) != 0 - && ((insn & 0x0f00) >> 8) == reg) - return true; - if ((f & USES2) != 0 - && ((insn & 0x00f0) >> 4) == reg) - return true; - if ((f & USESR0) != 0 - && reg == 0) - return true; - - return false; -} - -/* See whether an instruction uses a floating point register. */ - -static boolean -sh_insn_uses_freg (insn, op, freg) - unsigned int insn; - const struct sh_opcode *op; - unsigned int freg; -{ - unsigned int f; - - f = op->flags; - - if ((f & USESF1) != 0 - && ((insn & 0x0f00) >> 8) == freg) - return true; - if ((f & USESF2) != 0 - && ((insn & 0x00f0) >> 4) == freg) - return true; - if ((f & USESF0) != 0 - && freg == 0) - return true; - - return false; -} - -/* See whether instructions I1 and I2 conflict, assuming I1 comes - before I2. OP1 and OP2 are the corresponding sh_opcode structures. - This should return true if there is a conflict, or false if the - instructions can be swapped safely. */ - -static boolean -sh_insns_conflict (i1, op1, i2, op2) - unsigned int i1; - const struct sh_opcode *op1; - unsigned int i2; - const struct sh_opcode *op2; -{ - unsigned int f1, f2; - - f1 = op1->flags; - f2 = op2->flags; - - if ((f1 & (BRANCH | DELAY)) != 0 - || (f2 & (BRANCH | DELAY)) != 0) - return true; - - if ((f1 & SETSSP) != 0 && (f2 & USESSP) != 0) - return true; - if ((f2 & SETSSP) != 0 && (f1 & USESSP) != 0) - return true; - - if ((f1 & SETS1) != 0 - && sh_insn_uses_reg (i2, op2, (i1 & 0x0f00) >> 8)) - return true; - if ((f1 & SETS2) != 0 - && sh_insn_uses_reg (i2, op2, (i1 & 0x00f0) >> 4)) - return true; - if ((f1 & SETSR0) != 0 - && sh_insn_uses_reg (i2, op2, 0)) - return true; - if ((f1 & SETSF1) != 0 - && sh_insn_uses_freg (i2, op2, (i1 & 0x0f00) >> 8)) - return true; - - if ((f2 & SETS1) != 0 - && sh_insn_uses_reg (i1, op1, (i2 & 0x0f00) >> 8)) - return true; - if ((f2 & SETS2) != 0 - && sh_insn_uses_reg (i1, op1, (i2 & 0x00f0) >> 4)) - return true; - if ((f2 & SETSR0) != 0 - && sh_insn_uses_reg (i1, op1, 0)) - return true; - if ((f2 & SETSF1) != 0 - && sh_insn_uses_freg (i1, op1, (i2 & 0x0f00) >> 8)) - return true; - - /* The instructions do not conflict. */ - return false; -} - -/* I1 is a load instruction, and I2 is some other instruction. Return - true if I1 loads a register which I2 uses. */ - -static boolean -sh_load_use (i1, op1, i2, op2) - unsigned int i1; - const struct sh_opcode *op1; - unsigned int i2; - const struct sh_opcode *op2; -{ - unsigned int f1; - - f1 = op1->flags; - - if ((f1 & LOAD) == 0) - return false; - - /* If both SETS1 and SETSSP are set, that means a load to a special - register using postincrement addressing mode, which we don't care - about here. */ - if ((f1 & SETS1) != 0 - && (f1 & SETSSP) == 0 - && sh_insn_uses_reg (i2, op2, (i1 & 0x0f00) >> 8)) - return true; - - if ((f1 & SETSR0) != 0 - && sh_insn_uses_reg (i2, op2, 0)) - return true; - - if ((f1 & SETSF1) != 0 - && sh_insn_uses_freg (i2, op2, (i1 & 0x0f00) >> 8)) - return true; - - return false; -} - -/* Try to align loads and stores within a span of memory. This is - called by both the ELF and the COFF sh targets. ABFD and SEC are - the BFD and section we are examining. CONTENTS is the contents of - the section. SWAP is the routine to call to swap two instructions. - RELOCS is a pointer to the internal relocation information, to be - passed to SWAP. PLABEL is a pointer to the current label in a - sorted list of labels; LABEL_END is the end of the list. START and - STOP are the range of memory to examine. If a swap is made, - *PSWAPPED is set to true. */ - -boolean -_bfd_sh_align_load_span (abfd, sec, contents, swap, relocs, - plabel, label_end, start, stop, pswapped) - bfd *abfd; - asection *sec; - bfd_byte *contents; - boolean (*swap) PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma)); - PTR relocs; - bfd_vma **plabel; - bfd_vma *label_end; - bfd_vma start; - bfd_vma stop; - boolean *pswapped; -{ - bfd_vma i; - - /* Instructions should be aligned on 2 byte boundaries. */ - if ((start & 1) == 1) - ++start; - - /* Now look through the unaligned addresses. */ - i = start; - if ((i & 2) == 0) - i += 2; - for (; i < stop; i += 4) - { - unsigned int insn; - const struct sh_opcode *op; - unsigned int prev_insn = 0; - const struct sh_opcode *prev_op = NULL; - - insn = bfd_get_16 (abfd, contents + i); - op = sh_insn_info (insn); - if (op == NULL - || (op->flags & (LOAD | STORE)) == 0) - continue; - - /* This is a load or store which is not on a four byte boundary. */ - - while (*plabel < label_end && **plabel < i) - ++*plabel; - - if (i > start) - { - prev_insn = bfd_get_16 (abfd, contents + i - 2); - prev_op = sh_insn_info (prev_insn); - - /* If the load/store instruction is in a delay slot, we - can't swap. */ - if (prev_op == NULL - || (prev_op->flags & DELAY) != 0) - continue; - } - if (i > start - && (*plabel >= label_end || **plabel != i) - && prev_op != NULL - && (prev_op->flags & (LOAD | STORE)) == 0 - && ! sh_insns_conflict (prev_insn, prev_op, insn, op)) - { - boolean ok; - - /* The load/store instruction does not have a label, and - there is a previous instruction; PREV_INSN is not - itself a load/store instruction, and PREV_INSN and - INSN do not conflict. */ - - ok = true; - - if (i >= start + 4) - { - unsigned int prev2_insn; - const struct sh_opcode *prev2_op; - - prev2_insn = bfd_get_16 (abfd, contents + i - 4); - prev2_op = sh_insn_info (prev2_insn); - - /* If the instruction before PREV_INSN has a delay - slot--that is, PREV_INSN is in a delay slot--we - can not swap. */ - if (prev2_op == NULL - || (prev2_op->flags & DELAY) != 0) - ok = false; - - /* If the instruction before PREV_INSN is a load, - and it sets a register which INSN uses, then - putting INSN immediately after PREV_INSN will - cause a pipeline bubble, so there is no point to - making the swap. */ - if (ok - && (prev2_op->flags & LOAD) != 0 - && sh_load_use (prev2_insn, prev2_op, insn, op)) - ok = false; - } - - if (ok) - { - if (! (*swap) (abfd, sec, relocs, contents, i - 2)) - return false; - *pswapped = true; - continue; - } - } - - while (*plabel < label_end && **plabel < i + 2) - ++*plabel; - - if (i + 2 < stop - && (*plabel >= label_end || **plabel != i + 2)) - { - unsigned int next_insn; - const struct sh_opcode *next_op; - - /* There is an instruction after the load/store - instruction, and it does not have a label. */ - next_insn = bfd_get_16 (abfd, contents + i + 2); - next_op = sh_insn_info (next_insn); - if (next_op != NULL - && (next_op->flags & (LOAD | STORE)) == 0 - && ! sh_insns_conflict (insn, op, next_insn, next_op)) - { - boolean ok; - - /* NEXT_INSN is not itself a load/store instruction, - and it does not conflict with INSN. */ - - ok = true; - - /* If PREV_INSN is a load, and it sets a register - which NEXT_INSN uses, then putting NEXT_INSN - immediately after PREV_INSN will cause a pipeline - bubble, so there is no reason to make this swap. */ - if (prev_op != NULL - && (prev_op->flags & LOAD) != 0 - && sh_load_use (prev_insn, prev_op, next_insn, next_op)) - ok = false; - - /* If INSN is a load, and it sets a register which - the insn after NEXT_INSN uses, then doing the - swap will cause a pipeline bubble, so there is no - reason to make the swap. However, if the insn - after NEXT_INSN is itself a load or store - instruction, then it is misaligned, so - optimistically hope that it will be swapped - itself, and just live with the pipeline bubble if - it isn't. */ - if (ok - && i + 4 < stop - && (op->flags & LOAD) != 0) - { - unsigned int next2_insn; - const struct sh_opcode *next2_op; - - next2_insn = bfd_get_16 (abfd, contents + i + 4); - next2_op = sh_insn_info (next2_insn); - if ((next2_op->flags & (LOAD | STORE)) == 0 - && sh_load_use (insn, op, next2_insn, next2_op)) - ok = false; - } - - if (ok) - { - if (! (*swap) (abfd, sec, relocs, contents, i)) - return false; - *pswapped = true; - continue; - } - } - } - } - - return true; -} - -/* Look for loads and stores which we can align to four byte - boundaries. See the longer comment above sh_relax_section for why - this is desirable. This sets *PSWAPPED if some instruction was - swapped. */ - -static boolean -sh_align_loads (abfd, sec, internal_relocs, contents, pswapped) - bfd *abfd; - asection *sec; - struct internal_reloc *internal_relocs; - bfd_byte *contents; - boolean *pswapped; -{ - struct internal_reloc *irel, *irelend; - bfd_vma *labels = NULL; - bfd_vma *label, *label_end; - - *pswapped = false; - - irelend = internal_relocs + sec->reloc_count; - - /* Get all the addresses with labels on them. */ - labels = (bfd_vma *) bfd_malloc (sec->reloc_count * sizeof (bfd_vma)); - if (labels == NULL) - goto error_return; - label_end = labels; - for (irel = internal_relocs; irel < irelend; irel++) - { - if (irel->r_type == R_SH_LABEL) - { - *label_end = irel->r_vaddr - sec->vma; - ++label_end; - } - } - - /* Note that the assembler currently always outputs relocs in - address order. If that ever changes, this code will need to sort - the label values and the relocs. */ - - label = labels; - - for (irel = internal_relocs; irel < irelend; irel++) - { - bfd_vma start, stop; - - if (irel->r_type != R_SH_CODE) - continue; - - start = irel->r_vaddr - sec->vma; - - for (irel++; irel < irelend; irel++) - if (irel->r_type == R_SH_DATA) - break; - if (irel < irelend) - stop = irel->r_vaddr - sec->vma; - else - stop = sec->_cooked_size; - - if (! _bfd_sh_align_load_span (abfd, sec, contents, sh_swap_insns, - (PTR) internal_relocs, &label, - label_end, start, stop, pswapped)) - goto error_return; - } - - free (labels); - - return true; - - error_return: - if (labels != NULL) - free (labels); - return false; -} - -/* Swap two SH instructions. */ - -static boolean -sh_swap_insns (abfd, sec, relocs, contents, addr) - bfd *abfd; - asection *sec; - PTR relocs; - bfd_byte *contents; - bfd_vma addr; -{ - struct internal_reloc *internal_relocs = (struct internal_reloc *) relocs; - unsigned short i1, i2; - struct internal_reloc *irel, *irelend; - - /* Swap the instructions themselves. */ - i1 = bfd_get_16 (abfd, contents + addr); - i2 = bfd_get_16 (abfd, contents + addr + 2); - bfd_put_16 (abfd, i2, contents + addr); - bfd_put_16 (abfd, i1, contents + addr + 2); - - /* Adjust all reloc addresses. */ - irelend = internal_relocs + sec->reloc_count; - for (irel = internal_relocs; irel < irelend; irel++) - { - int type, add; - - /* There are a few special types of relocs that we don't want to - adjust. These relocs do not apply to the instruction itself, - but are only associated with the address. */ - type = irel->r_type; - if (type == R_SH_ALIGN - || type == R_SH_CODE - || type == R_SH_DATA - || type == R_SH_LABEL) - continue; - - /* If an R_SH_USES reloc points to one of the addresses being - swapped, we must adjust it. It would be incorrect to do this - for a jump, though, since we want to execute both - instructions after the jump. (We have avoided swapping - around a label, so the jump will not wind up executing an - instruction it shouldn't). */ - if (type == R_SH_USES) - { - bfd_vma off; - - off = irel->r_vaddr - sec->vma + 4 + irel->r_offset; - if (off == addr) - irel->r_offset += 2; - else if (off == addr + 2) - irel->r_offset -= 2; - } - - if (irel->r_vaddr - sec->vma == addr) - { - irel->r_vaddr += 2; - add = -2; - } - else if (irel->r_vaddr - sec->vma == addr + 2) - { - irel->r_vaddr -= 2; - add = 2; - } - else - add = 0; - - if (add != 0) - { - bfd_byte *loc; - unsigned short insn, oinsn; - boolean overflow; - - loc = contents + irel->r_vaddr - sec->vma; - overflow = false; - switch (type) - { - default: - break; - - case R_SH_PCDISP8BY2: - case R_SH_PCRELIMM8BY2: - insn = bfd_get_16 (abfd, loc); - oinsn = insn; - insn += add / 2; - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, loc); - break; - - case R_SH_PCDISP: - insn = bfd_get_16 (abfd, loc); - oinsn = insn; - insn += add / 2; - if ((oinsn & 0xf000) != (insn & 0xf000)) - overflow = true; - bfd_put_16 (abfd, insn, loc); - break; - - case R_SH_PCRELIMM8BY4: - /* This reloc ignores the least significant 3 bits of - the program counter before adding in the offset. - This means that if ADDR is at an even address, the - swap will not affect the offset. If ADDR is an at an - odd address, then the instruction will be crossing a - four byte boundary, and must be adjusted. */ - if ((addr & 3) != 0) - { - insn = bfd_get_16 (abfd, loc); - oinsn = insn; - insn += add / 2; - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, loc); - } - - break; - } - - if (overflow) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: fatal: reloc overflow while relaxing", - bfd_get_filename (abfd), (unsigned long) irel->r_vaddr)); - bfd_set_error (bfd_error_bad_value); - return false; - } - } - } - - return true; -} - -/* This is a modification of _bfd_coff_generic_relocate_section, which - will handle SH relaxing. */ - -static boolean -sh_relocate_section (output_bfd, info, input_bfd, input_section, contents, - relocs, syms, sections) - bfd *output_bfd; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - struct internal_reloc *relocs; - struct internal_syment *syms; - asection **sections; -{ - struct internal_reloc *rel; - struct internal_reloc *relend; - - rel = relocs; - relend = rel + input_section->reloc_count; - for (; rel < relend; rel++) - { - long symndx; - struct coff_link_hash_entry *h; - struct internal_syment *sym; - bfd_vma addend; - bfd_vma val; - reloc_howto_type *howto; - bfd_reloc_status_type rstat; - - /* Almost all relocs have to do with relaxing. If any work must - be done for them, it has been done in sh_relax_section. */ - if (rel->r_type != R_SH_IMM32 - && rel->r_type != R_SH_PCDISP) - continue; - - symndx = rel->r_symndx; - - if (symndx == -1) - { - h = NULL; - sym = NULL; - } - else - { - if (symndx < 0 - || (unsigned long) symndx >= obj_raw_syment_count (input_bfd)) - { - (*_bfd_error_handler) - ("%s: illegal symbol index %ld in relocs", - bfd_get_filename (input_bfd), symndx); - bfd_set_error (bfd_error_bad_value); - return false; - } - h = obj_coff_sym_hashes (input_bfd)[symndx]; - sym = syms + symndx; - } - - if (sym != NULL && sym->n_scnum != 0) - addend = - sym->n_value; - else - addend = 0; - - if (rel->r_type == R_SH_PCDISP) - addend -= 4; - - if (rel->r_type >= SH_COFF_HOWTO_COUNT) - howto = NULL; - else - howto = &sh_coff_howtos[rel->r_type]; - - if (howto == NULL) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - val = 0; - - if (h == NULL) - { - asection *sec; - - /* There is nothing to do for an internal PCDISP reloc. */ - if (rel->r_type == R_SH_PCDISP) - continue; - - if (symndx == -1) - { - sec = bfd_abs_section_ptr; - val = 0; - } - else - { - sec = sections[symndx]; - val = (sec->output_section->vma - + sec->output_offset - + sym->n_value - - sec->vma); - } - } - else - { - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - asection *sec; - - sec = h->root.u.def.section; - val = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } - else if (! info->relocateable) - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma))) - return false; - } - } - - rstat = _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, - rel->r_vaddr - input_section->vma, - val, addend); - - switch (rstat) - { - default: - abort (); - case bfd_reloc_ok: - break; - case bfd_reloc_overflow: - { - const char *name; - char buf[SYMNMLEN + 1]; - - if (symndx == -1) - name = "*ABS*"; - else if (h != NULL) - name = h->root.root.string; - else if (sym->_n._n_n._n_zeroes == 0 - && sym->_n._n_n._n_offset != 0) - name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset; - else - { - strncpy (buf, sym->_n._n_name, SYMNMLEN); - buf[SYMNMLEN] = '\0'; - name = buf; - } - - if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, input_bfd, - input_section, rel->r_vaddr - input_section->vma))) - return false; - } - } - } - - return true; -} - -/* This is a version of bfd_generic_get_relocated_section_contents - which uses sh_relocate_section. */ - -static bfd_byte * -sh_coff_get_relocated_section_contents (output_bfd, link_info, link_order, - data, relocateable, symbols) - bfd *output_bfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - bfd_byte *data; - boolean relocateable; - asymbol **symbols; -{ - asection *input_section = link_order->u.indirect.section; - bfd *input_bfd = input_section->owner; - asection **sections = NULL; - struct internal_reloc *internal_relocs = NULL; - struct internal_syment *internal_syms = NULL; - - /* We only need to handle the case of relaxing, or of having a - particular set of section contents, specially. */ - if (relocateable - || coff_section_data (input_bfd, input_section) == NULL - || coff_section_data (input_bfd, input_section)->contents == NULL) - return bfd_generic_get_relocated_section_contents (output_bfd, link_info, - link_order, data, - relocateable, - symbols); - - memcpy (data, coff_section_data (input_bfd, input_section)->contents, - input_section->_raw_size); - - if ((input_section->flags & SEC_RELOC) != 0 - && input_section->reloc_count > 0) - { - bfd_size_type symesz = bfd_coff_symesz (input_bfd); - bfd_byte *esym, *esymend; - struct internal_syment *isymp; - asection **secpp; - - if (! _bfd_coff_get_external_symbols (input_bfd)) - goto error_return; - - internal_relocs = (_bfd_coff_read_internal_relocs - (input_bfd, input_section, false, (bfd_byte *) NULL, - false, (struct internal_reloc *) NULL)); - if (internal_relocs == NULL) - goto error_return; - - internal_syms = ((struct internal_syment *) - bfd_malloc (obj_raw_syment_count (input_bfd) - * sizeof (struct internal_syment))); - if (internal_syms == NULL) - goto error_return; - - sections = (asection **) bfd_malloc (obj_raw_syment_count (input_bfd) - * sizeof (asection *)); - if (sections == NULL) - goto error_return; - - isymp = internal_syms; - secpp = sections; - esym = (bfd_byte *) obj_coff_external_syms (input_bfd); - esymend = esym + obj_raw_syment_count (input_bfd) * symesz; - while (esym < esymend) - { - bfd_coff_swap_sym_in (input_bfd, (PTR) esym, (PTR) isymp); - - if (isymp->n_scnum != 0) - *secpp = coff_section_from_bfd_index (input_bfd, isymp->n_scnum); - else - { - if (isymp->n_value == 0) - *secpp = bfd_und_section_ptr; - else - *secpp = bfd_com_section_ptr; - } - - esym += (isymp->n_numaux + 1) * symesz; - secpp += isymp->n_numaux + 1; - isymp += isymp->n_numaux + 1; - } - - if (! sh_relocate_section (output_bfd, link_info, input_bfd, - input_section, data, internal_relocs, - internal_syms, sections)) - goto error_return; - - free (sections); - sections = NULL; - free (internal_syms); - internal_syms = NULL; - free (internal_relocs); - internal_relocs = NULL; - } - - return data; - - error_return: - if (internal_relocs != NULL) - free (internal_relocs); - if (internal_syms != NULL) - free (internal_syms); - if (sections != NULL) - free (sections); - return NULL; -} - -/* The target vectors. */ - -const bfd_target shcoff_vec = -{ - "coff-sh", /* name */ - bfd_target_coff_flavour, - BFD_ENDIAN_BIG, /* data byte order is big */ - BFD_ENDIAN_BIG, /* header byte order is big */ - - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), - '_', /* leading symbol underscore */ - '/', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ - - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ - bfd_false}, - {bfd_false, coff_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (coff), - BFD_JUMP_TABLE_COPY (coff), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), - BFD_JUMP_TABLE_SYMBOLS (coff), - BFD_JUMP_TABLE_RELOCS (coff), - BFD_JUMP_TABLE_WRITE (coff), - BFD_JUMP_TABLE_LINK (coff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - COFF_SWAP_TABLE, -}; - -const bfd_target shlcoff_vec = -{ - "coff-shl", /* name */ - bfd_target_coff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_LITTLE, /* header byte order is little endian too*/ - - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), - '_', /* leading symbol underscore */ - '/', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ - - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ - bfd_false}, - {bfd_false, coff_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (coff), - BFD_JUMP_TABLE_COPY (coff), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), - BFD_JUMP_TABLE_SYMBOLS (coff), - BFD_JUMP_TABLE_RELOCS (coff), - BFD_JUMP_TABLE_WRITE (coff), - BFD_JUMP_TABLE_LINK (coff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - COFF_SWAP_TABLE, -}; - -/* Some people want versions of the SH COFF target which do not align - to 16 byte boundaries. We implement that by adding a couple of new - target vectors. These are just like the ones above, but they - change the default section alignment. To generate them in the - assembler, use -small. To use them in the linker, use -b - coff-sh{l}-small and -oformat coff-sh{l}-small. - - Yes, this is a horrible hack. A general solution for setting - section alignment in COFF is rather complex. ELF handles this - correctly. */ - -/* Only recognize the small versions if the target was not defaulted. - Otherwise we won't recognize the non default endianness. */ - -static const bfd_target * -coff_small_object_p (abfd) - bfd *abfd; -{ - if (abfd->target_defaulted) - { - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - return coff_object_p (abfd); -} - -/* Set the section alignment for the small versions. */ - -static boolean -coff_small_new_section_hook (abfd, section) - bfd *abfd; - asection *section; -{ - if (! coff_new_section_hook (abfd, section)) - return false; - - /* We must align to at least a four byte boundary, because longword - accesses must be on a four byte boundary. */ - if (section->alignment_power == COFF_DEFAULT_SECTION_ALIGNMENT_POWER) - section->alignment_power = 2; - - return true; -} - -/* This is copied from bfd_coff_std_swap_table so that we can change - the default section alignment power. */ - -static const bfd_coff_backend_data bfd_coff_small_swap_table = -{ - coff_swap_aux_in, coff_swap_sym_in, coff_swap_lineno_in, - coff_swap_aux_out, coff_swap_sym_out, - coff_swap_lineno_out, coff_swap_reloc_out, - coff_swap_filehdr_out, coff_swap_aouthdr_out, - coff_swap_scnhdr_out, - FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ, -#ifdef COFF_LONG_FILENAMES - true, -#else - false, -#endif -#ifdef COFF_LONG_SECTION_NAMES - true, -#else - false, -#endif - 2, - coff_swap_filehdr_in, coff_swap_aouthdr_in, coff_swap_scnhdr_in, - coff_swap_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook, - coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, - coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, - coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, - coff_sym_is_global, coff_compute_section_file_positions, - coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, - coff_adjust_symndx, coff_link_add_one_symbol, - coff_link_output_has_begun, coff_final_link_postscript -}; - -#define coff_small_close_and_cleanup \ - coff_close_and_cleanup -#define coff_small_bfd_free_cached_info \ - coff_bfd_free_cached_info -#define coff_small_get_section_contents \ - coff_get_section_contents -#define coff_small_get_section_contents_in_window \ - coff_get_section_contents_in_window - -const bfd_target shcoff_small_vec = -{ - "coff-sh-small", /* name */ - bfd_target_coff_flavour, - BFD_ENDIAN_BIG, /* data byte order is big */ - BFD_ENDIAN_BIG, /* header byte order is big */ - - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), - '_', /* leading symbol underscore */ - '/', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ - - {_bfd_dummy_target, coff_small_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ - bfd_false}, - {bfd_false, coff_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (coff_small), - BFD_JUMP_TABLE_COPY (coff), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), - BFD_JUMP_TABLE_SYMBOLS (coff), - BFD_JUMP_TABLE_RELOCS (coff), - BFD_JUMP_TABLE_WRITE (coff), - BFD_JUMP_TABLE_LINK (coff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - (PTR) &bfd_coff_small_swap_table -}; - -const bfd_target shlcoff_small_vec = -{ - "coff-shl-small", /* name */ - bfd_target_coff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_LITTLE, /* header byte order is little endian too*/ - - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), - '_', /* leading symbol underscore */ - '/', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ - - {_bfd_dummy_target, coff_small_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ - bfd_false}, - {bfd_false, coff_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (coff_small), - BFD_JUMP_TABLE_COPY (coff), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), - BFD_JUMP_TABLE_SYMBOLS (coff), - BFD_JUMP_TABLE_RELOCS (coff), - BFD_JUMP_TABLE_WRITE (coff), - BFD_JUMP_TABLE_LINK (coff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - (PTR) &bfd_coff_small_swap_table -}; diff --git a/contrib/binutils/bfd/coff-tic30.c b/contrib/binutils/bfd/coff-tic30.c deleted file mode 100644 index 5b8ffd4625ff..000000000000 --- a/contrib/binutils/bfd/coff-tic30.c +++ /dev/null @@ -1,206 +0,0 @@ -/* BFD back-end for TMS320C30 coff binaries. - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. - Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) - - This file is part of BFD, the Binary File Descriptor library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "bfdlink.h" -#include "coff/tic30.h" -#include "coff/internal.h" -#include "libcoff.h" - -#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1) - -reloc_howto_type tic30_coff_howto_table[] = -{ - HOWTO (R_TIC30_ABS16, 2, 1, 16, false, 0, 0, NULL, - "16", false, 0x0000FFFF, 0x0000FFFF, false), - HOWTO (R_TIC30_ABS24, 2, 2, 24, false, 8, complain_overflow_bitfield, NULL, - "24", false, 0xFFFFFF00, 0xFFFFFF00, false), - HOWTO (R_TIC30_LDP, 18, 0, 24, false, 0, complain_overflow_bitfield, NULL, - "LDP", false, 0x00FF0000, 0x000000FF, false), - HOWTO (R_TIC30_ABS32, 2, 2, 32, false, 0, complain_overflow_bitfield, NULL, - "32", false, 0xFFFFFFFF, 0xFFFFFFFF, false), - HOWTO (R_TIC30_PC16, 2, 1, 16, true, 0, complain_overflow_signed, NULL, - "PCREL", false, 0x0000FFFF, 0x0000FFFF, false), - EMPTY_HOWTO (-1) -}; - -#ifndef coff_bfd_reloc_type_lookup -#define coff_bfd_reloc_type_lookup tic30_coff_reloc_type_lookup - -/* For the case statement use the code values used in tc_gen_reloc to - map to the howto table entries that match those in both the aout - and coff implementations. */ -reloc_howto_type * -tic30_coff_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; -{ - switch (code) - { - case BFD_RELOC_8: - case BFD_RELOC_TIC30_LDP: - return &tic30_coff_howto_table[2]; - case BFD_RELOC_16: - return &tic30_coff_howto_table[0]; - case BFD_RELOC_24: - return &tic30_coff_howto_table[1]; - case BFD_RELOC_16_PCREL: - return &tic30_coff_howto_table[4]; - case BFD_RELOC_32: - return &tic30_coff_howto_table[3]; - default: - return (reloc_howto_type *) NULL; - } -} - -#endif - -/* Turn a howto into a reloc number */ - -static int -coff_tic30_select_reloc (howto) - reloc_howto_type *howto; -{ - return howto->type; -} - -#define SELECT_RELOC(x,howto) x.r_type = coff_tic30_select_reloc(howto) - -#define BADMAG(x) TIC30BADMAG(x) -#define TIC30 1 /* Customize coffcode.h */ -#define __A_MAGIC_SET__ - -/* Code to swap in the reloc */ -#define SWAP_IN_RELOC_OFFSET bfd_h_get_32 -#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32 -#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) dst->r_stuff[0] = 'S'; \ -dst->r_stuff[1] = 'C'; - -/* Code to turn a r_type into a howto ptr, uses the above howto table. */ - -static void -rtype2howto (internal, dst) - arelent *internal; - struct internal_reloc *dst; -{ - switch (dst->r_type) - { - case R_TIC30_ABS16: - internal->howto = &tic30_coff_howto_table[0]; - break; - case R_TIC30_ABS24: - internal->howto = &tic30_coff_howto_table[1]; - break; - case R_TIC30_ABS32: - internal->howto = &tic30_coff_howto_table[3]; - break; - case R_TIC30_LDP: - internal->howto = &tic30_coff_howto_table[2]; - break; - case R_TIC30_PC16: - internal->howto = &tic30_coff_howto_table[4]; - break; - default: - abort (); - break; - } -} - -#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) - -/* Perform any necessary magic to the addend in a reloc entry */ - -#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ - cache_ptr->addend = ext_reloc.r_offset; - -#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \ - reloc_processing(relent, reloc, symbols, abfd, section) - -static void -reloc_processing (relent, reloc, symbols, abfd, section) - arelent *relent; - struct internal_reloc *reloc; - asymbol **symbols; - bfd *abfd; - asection *section; -{ - relent->address = reloc->r_vaddr; - rtype2howto (relent, reloc); - - if (reloc->r_symndx > 0) - { - relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; - } - else - { - relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - } - relent->addend = reloc->r_offset; - relent->address -= section->vma; -} - -#include "coffcode.h" - -const bfd_target tic30_coff_vec = -{ - "coff-tic30", /* name */ - bfd_target_coff_flavour, - BFD_ENDIAN_BIG, /* data byte order is big */ - BFD_ENDIAN_LITTLE, /* header byte order is little */ - - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - '_', /* leading symbol underscore */ - '/', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ - - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, - {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ - bfd_false}, - {bfd_false, coff_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (coff), - BFD_JUMP_TABLE_COPY (coff), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), - BFD_JUMP_TABLE_SYMBOLS (coff), - BFD_JUMP_TABLE_RELOCS (coff), - BFD_JUMP_TABLE_WRITE (coff), - BFD_JUMP_TABLE_LINK (coff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - NULL, - - COFF_SWAP_TABLE -}; diff --git a/contrib/binutils/bfd/coff-z8k.c b/contrib/binutils/bfd/coff-z8k.c deleted file mode 100644 index 817b6dcd1e68..000000000000 --- a/contrib/binutils/bfd/coff-z8k.c +++ /dev/null @@ -1,233 +0,0 @@ -/* BFD back-end for Zilog Z800n COFF binaries. - Copyright 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001 - Free Software Foundation, Inc. - Contributed by Cygnus Support. - Written by Steve Chamberlain, <sac@cygnus.com>. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "bfdlink.h" -#include "coff/z8k.h" -#include "coff/internal.h" -#include "libcoff.h" - -#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1) - -static reloc_howto_type r_imm32 = -HOWTO (R_IMM32, 0, 1, 32, false, 0, - complain_overflow_bitfield, 0, "r_imm32", true, 0xffffffff, - 0xffffffff, false); - -static reloc_howto_type r_imm4l = -HOWTO (R_IMM4L, 0, 1, 4, false, 0, - complain_overflow_bitfield, 0, "r_imm4l", true, 0xf, 0xf, false); - -static reloc_howto_type r_da = -HOWTO (R_IMM16, 0, 1, 16, false, 0, - complain_overflow_bitfield, 0, "r_da", true, 0x0000ffff, 0x0000ffff, - false); - -static reloc_howto_type r_imm8 = -HOWTO (R_IMM8, 0, 1, 8, false, 0, - complain_overflow_bitfield, 0, "r_imm8", true, 0x000000ff, 0x000000ff, - false); - -static reloc_howto_type r_jr = -HOWTO (R_JR, 0, 1, 8, true, 0, complain_overflow_signed, 0, - "r_jr", true, 0, 0, true); - -/* Turn a howto into a reloc number */ - -static int -coff_z8k_select_reloc (howto) - reloc_howto_type *howto; -{ - return howto->type; -} - -#define SELECT_RELOC(x,howto) x.r_type = coff_z8k_select_reloc(howto) - -#define BADMAG(x) Z8KBADMAG(x) -#define Z8K 1 /* Customize coffcode.h */ -#define __A_MAGIC_SET__ - -/* Code to swap in the reloc */ -#define SWAP_IN_RELOC_OFFSET bfd_h_get_32 -#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32 -#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ - dst->r_stuff[0] = 'S'; \ - dst->r_stuff[1] = 'C'; - -/* Code to turn a r_type into a howto ptr, uses the above howto table - */ - -static void -rtype2howto (internal, dst) - arelent * internal; - struct internal_reloc *dst; -{ - switch (dst->r_type) - { - default: - abort (); - break; - case R_IMM8: - internal->howto = &r_imm8; - break; - case R_IMM16: - internal->howto = &r_da; - break; - case R_JR: - internal->howto = &r_jr; - break; - case R_IMM32: - internal->howto = &r_imm32; - break; - case R_IMM4L: - internal->howto = &r_imm4l; - break; - } -} - -#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) - -/* Perform any necessary magic to the addend in a reloc entry */ - -#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ - cache_ptr->addend = ext_reloc.r_offset; - -#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \ - reloc_processing(relent, reloc, symbols, abfd, section) - -static void -reloc_processing (relent, reloc, symbols, abfd, section) - arelent * relent; - struct internal_reloc *reloc; - asymbol ** symbols; - bfd * abfd; - asection * section; -{ - relent->address = reloc->r_vaddr; - rtype2howto (relent, reloc); - - if (reloc->r_symndx > 0) - { - relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; - } - else - { - relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - } - - relent->addend = reloc->r_offset; - relent->address -= section->vma; -} - -static void -extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) - bfd *in_abfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - arelent *reloc; - bfd_byte *data; - unsigned int *src_ptr; - unsigned int *dst_ptr; -{ - asection *input_section = link_order->u.indirect.section; - - switch (reloc->howto->type) - { - case R_IMM8: - bfd_put_8 (in_abfd, - bfd_coff_reloc16_get_value (reloc, link_info, input_section), - data + *dst_ptr); - (*dst_ptr) += 1; - (*src_ptr) += 1; - break; - - case R_IMM32: - bfd_put_32 (in_abfd, - bfd_coff_reloc16_get_value (reloc, link_info, input_section), - data + *dst_ptr); - (*dst_ptr) += 4; - (*src_ptr) += 4; - break; - - case R_IMM4L: - bfd_put_8 (in_abfd, - ((bfd_get_8 (in_abfd, data + *dst_ptr) & 0xf0) - | (0x0f - & bfd_coff_reloc16_get_value (reloc, link_info, - input_section))), - data + *dst_ptr); - (*dst_ptr) += 1; - (*src_ptr) += 1; - break; - - case R_IMM16: - bfd_put_16 (in_abfd, - bfd_coff_reloc16_get_value (reloc, link_info, input_section), - data + *dst_ptr); - (*dst_ptr) += 2; - (*src_ptr) += 2; - break; - - case R_JR: - { - bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info, - input_section); - bfd_vma dot = (link_order->offset - + *dst_ptr - + input_section->output_section->vma); - int gap = dst - dot - 1;/* -1 since were in the odd byte of the - word and the pc's been incremented */ - - if (gap & 1) - abort (); - gap /= 2; - if (gap > 128 || gap < -128) - { - if (! ((*link_info->callbacks->reloc_overflow) - (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), - reloc->howto->name, reloc->addend, input_section->owner, - input_section, reloc->address))) - abort (); - } - bfd_put_8 (in_abfd, gap, data + *dst_ptr); - (*dst_ptr)++; - (*src_ptr)++; - break; - } - default: - abort (); - } -} - -#define coff_reloc16_extra_cases extra_case - -#include "coffcode.h" - -#undef coff_bfd_get_relocated_section_contents -#undef coff_bfd_relax_section -#define coff_bfd_get_relocated_section_contents \ - bfd_coff_reloc16_get_relocated_section_contents -#define coff_bfd_relax_section bfd_coff_reloc16_relax_section - -CREATE_BIG_COFF_TARGET_VEC (z8kcoff_vec, "coff-z8k", 0, 0, '_', NULL) diff --git a/contrib/binutils/bfd/cpu-mips.c b/contrib/binutils/bfd/cpu-mips.c deleted file mode 100644 index a933b8cd10bc..000000000000 --- a/contrib/binutils/bfd/cpu-mips.c +++ /dev/null @@ -1,88 +0,0 @@ -/* bfd back-end for mips support - Copyright (C) 1990, 91-97, 1998 Free Software Foundation, Inc. - Written by Steve Chamberlain of Cygnus Support. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" - -#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \ - { \ - BITS_WORD, /* bits in a word */ \ - BITS_ADDR, /* bits in an address */ \ - 8, /* 8 bits in a byte */ \ - bfd_arch_mips, \ - NUMBER, \ - "mips", \ - PRINT, \ - 3, \ - DEFAULT, \ - bfd_default_compatible, \ - bfd_default_scan, \ - NEXT, \ - } - -enum { -I_mips3000, -I_mips3900, -I_mips4000, -I_mips4010, -I_mips4100, -I_mips4111, -I_mips4300, -I_mips4400, -I_mips4600, -I_mips4650, -I_mips5000, -I_mips6000, -I_mips8000, -I_mips10000, -I_mips16 -}; - - -#define NN(index) (&arch_info_struct[(index)+1]) - -static const bfd_arch_info_type arch_info_struct[] = -{ - N (32, 32, bfd_mach_mips3000, "mips:3000", false, NN(I_mips3000)), - N (32, 32, bfd_mach_mips3900, "mips:3900", false, NN(I_mips3900)), - N (64, 64, bfd_mach_mips4000, "mips:4000", false, NN(I_mips4000)), - N (64, 64, bfd_mach_mips4010, "mips:4010", false, NN(I_mips4010)), - N (64, 64, bfd_mach_mips4100, "mips:4100", false, NN(I_mips4100)), - N (64, 64, bfd_mach_mips4111, "mips:4111", false, NN(I_mips4111)), - N (64, 64, bfd_mach_mips4300, "mips:4300", false, NN(I_mips4300)), - N (64, 64, bfd_mach_mips4400, "mips:4400", false, NN(I_mips4400)), - N (64, 64, bfd_mach_mips4600, "mips:4600", false, NN(I_mips4600)), - N (64, 64, bfd_mach_mips4650, "mips:4650", false, NN(I_mips4650)), - N (64, 64, bfd_mach_mips5000, "mips:5000", false, NN(I_mips5000)), - N (32, 32, bfd_mach_mips6000, "mips:6000", false, NN(I_mips6000)), - N (64, 64, bfd_mach_mips8000, "mips:8000", false, NN(I_mips8000)), - N (64, 64, bfd_mach_mips10000, "mips:10000", false, NN(I_mips10000)), - - - N (64, 64, bfd_mach_mips16, "mips:16", false, 0), -}; - -/* The default architecture is mips:3000, but with a machine number of - zero. This lets the linker distinguish between a default setting - of mips, and an explicit setting of mips:3000. */ - -const bfd_arch_info_type bfd_mips_arch = -N (32, 32, 0, "mips", true, &arch_info_struct[0]); diff --git a/contrib/binutils/bfd/cpu-rs6000.c b/contrib/binutils/bfd/cpu-rs6000.c deleted file mode 100644 index 89b92308c899..000000000000 --- a/contrib/binutils/bfd/cpu-rs6000.c +++ /dev/null @@ -1,116 +0,0 @@ -/* BFD back-end for rs6000 support - Copyright 1990, 1991, 1993, 1995, 2000 Free Software Foundation, Inc. - FIXME: Can someone provide a transliteration of this name into ASCII? - Using the following chars caused a compiler warning on HIUX (so I replaced - them with octal escapes), and isn't useful without an understanding of what - character set it is. - Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM - and John Gilmore of Cygnus Support. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" - -/* The RS/6000 architecture is compatible with the PowerPC common - architecture. */ - -static const bfd_arch_info_type *rs6000_compatible - PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); - -static const bfd_arch_info_type * -rs6000_compatible (a,b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; -{ - BFD_ASSERT (a->arch == bfd_arch_rs6000); - switch (b->arch) - { - default: - return NULL; - case bfd_arch_rs6000: - return bfd_default_compatible (a, b); - case bfd_arch_powerpc: - if (b->mach == 0) - return b; - return NULL; - } - /*NOTREACHED*/ -} - -static const bfd_arch_info_type arch_info_struct[] = -{ - { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_rs6000, - bfd_mach_rs6k_rs1, - "rs6000", - "rs6000:rs1", - 3, - false, /* not the default */ - rs6000_compatible, - bfd_default_scan, - &arch_info_struct[1] - }, - { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_rs6000, - bfd_mach_rs6k_rsc, - "rs6000", - "rs6000:rsc", - 3, - false, /* not the default */ - rs6000_compatible, - bfd_default_scan, - &arch_info_struct[2] - }, - { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_rs6000, - bfd_mach_rs6k_rs2, - "rs6000", - "rs6000:rs2", - 3, - false, /* not the default */ - rs6000_compatible, - bfd_default_scan, - 0 - } -}; - -const bfd_arch_info_type bfd_rs6000_arch = - { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_rs6000, - bfd_mach_rs6k, /* POWER common architecture */ - "rs6000", - "rs6000:6000", - 3, - true, /* the default */ - rs6000_compatible, - bfd_default_scan, - &arch_info_struct[0] - }; diff --git a/contrib/binutils/bfd/cpu-sh.c b/contrib/binutils/bfd/cpu-sh.c deleted file mode 100644 index 9f7ef2021421..000000000000 --- a/contrib/binutils/bfd/cpu-sh.c +++ /dev/null @@ -1,117 +0,0 @@ -/* BFD library support routines for the Hitachi-SH architecture. - Copyright (C) 1993 Free Software Foundation, Inc. - Hacked by Steve Chamberlain of Cygnus Support. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" - - -static boolean -scan_mach (info, string) - const struct bfd_arch_info *info; - const char *string; -{ - if (strcasecmp (info->printable_name, string) == 0) - return true; - return false; -} - - -#if 0 -/* This routine is provided two arch_infos and returns whether - they'd be compatible */ - -static const bfd_arch_info_type * -compatible (a,b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; -{ - if (a->arch != b->arch || a->mach != b->mach) - return NULL; - return a; -} -#endif - -#define SH_NEXT &arch_info_struct[0] -#define SH3_NEXT &arch_info_struct[1] -#define SH3E_NEXT &arch_info_struct[2] -#define SH4_NEXT NULL - -static const bfd_arch_info_type arch_info_struct[] = -{ - { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_sh, - bfd_mach_sh3, - "sh", /* arch_name */ - "sh3", /* printable name */ - 1, - false, /* not the default */ - bfd_default_compatible, - scan_mach, - SH3_NEXT - }, - { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_sh, - bfd_mach_sh3e, - "sh", /* arch_name */ - "sh3e", /* printable name */ - 1, - false, /* not the default */ - bfd_default_compatible, - scan_mach, - SH3E_NEXT - }, - { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_sh, - bfd_mach_sh4, - "sh", /* arch_name */ - "sh4", /* printable name */ - 1, - false, /* not the default */ - bfd_default_compatible, - scan_mach, - SH4_NEXT - }, -}; - -const bfd_arch_info_type bfd_sh_arch = -{ - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_sh, - bfd_mach_sh, - "sh", /* arch_name */ - "sh", /* printable name */ - 1, - true, /* the default machine */ - bfd_default_compatible, - scan_mach, - SH_NEXT -}; diff --git a/contrib/binutils/bfd/cpu-tic30.c b/contrib/binutils/bfd/cpu-tic30.c deleted file mode 100644 index dd723f7b4a59..000000000000 --- a/contrib/binutils/bfd/cpu-tic30.c +++ /dev/null @@ -1,39 +0,0 @@ -/* BFD support for the Texas Instruments TMS320C30 architecture. - Copyright 1998 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" - -const bfd_arch_info_type bfd_tic30_arch = -{ - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_tic30, - 0, /* only 1 machine */ - "tic30", - "tms320c30", - 2, - true, /* the one and only */ - bfd_default_compatible, - bfd_default_scan, - 0, -}; diff --git a/contrib/binutils/bfd/cpu-v850.c b/contrib/binutils/bfd/cpu-v850.c deleted file mode 100644 index 5eb5b742ad92..000000000000 --- a/contrib/binutils/bfd/cpu-v850.c +++ /dev/null @@ -1,103 +0,0 @@ -/* BFD support for the NEC V850 processor - Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" - -#include <ctype.h> - -static boolean -scan (info, string) - const struct bfd_arch_info * info; - const char * string; -{ - const char *ptr_src; - const char *ptr_tst; - unsigned long number; - enum bfd_architecture arch; - - /* First test for an exact match */ - if (strcasecmp (string, info->printable_name) == 0) - return true; - - /* See how much of the supplied string matches with the - architecture, eg the string m68k:68020 would match the m68k entry - up to the :, then we get left with the machine number */ - - for (ptr_src = string, ptr_tst = info->arch_name; - *ptr_src && *ptr_tst; - ptr_src++, ptr_tst++) - { - if (*ptr_src != *ptr_tst) break; - } - - /* Chewed up as much of the architecture as will match, skip any - colons */ - if (*ptr_src == ':') - ptr_src++; - - if (*ptr_src == 0) - { - /* nothing more, then only keep this one if it is the default - machine for this architecture */ - return info->the_default; - } - - number = 0; - while (isdigit ((unsigned char) *ptr_src)) - { - number = number * 10 + * ptr_src - '0'; - ptr_src++; - } - - switch (number) - { - case bfd_mach_v850e: arch = bfd_arch_v850; break; - case bfd_mach_v850ea: arch = bfd_arch_v850; break; - default: - return false; - } - - if (arch != info->arch) - return false; - - if (number != info->mach) - return false; - - return true; -} - -#define N(number, print, default, next) \ -{ 32, 32, 8, bfd_arch_v850, number, "v850", print, 2, default, \ - bfd_default_compatible, scan, next } - -#define NEXT NULL - -static const bfd_arch_info_type arch_info_struct[] = -{ - N (bfd_mach_v850e, "v850e", false, &arch_info_struct[1]), - N (bfd_mach_v850ea, "v850ea", false, NULL) -}; - -#undef NEXT -#define NEXT &arch_info_struct[0] - -const bfd_arch_info_type bfd_v850_arch = - N (bfd_mach_v850, "v850", true, NEXT); diff --git a/contrib/binutils/bfd/cpu-z8k.c b/contrib/binutils/bfd/cpu-z8k.c deleted file mode 100644 index 643932a2b6de..000000000000 --- a/contrib/binutils/bfd/cpu-z8k.c +++ /dev/null @@ -1,190 +0,0 @@ -/* BFD library support routines for the Z800n architecture. - Copyright 1992, 1993, 1994, 2000 Free Software Foundation, Inc. - Hacked by Steve Chamberlain of Cygnus Support. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" - -#if 0 /* not used currently */ -/* -Relocations for the Z8K - -*/ -static bfd_reloc_status_type -howto16_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct symbol_cache_entry *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - long x = bfd_get_16 (abfd, (bfd_byte *) data + addr); - - HOWTO_PREPARE (relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_16 (abfd, x, (bfd_byte *) data + addr); - return bfd_reloc_ok; -} - -static bfd_reloc_status_type -howto8_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct symbol_cache_entry *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - long x = bfd_get_8 (abfd, (bfd_byte *) data + addr); - - HOWTO_PREPARE (relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_8 (abfd, x, (bfd_byte *) data + addr); - return bfd_reloc_ok; -} - -static bfd_reloc_status_type -howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct symbol_cache_entry *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - - long x = bfd_get_8 (abfd, (bfd_byte *) data + addr); - abort (); - HOWTO_PREPARE (relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_8 (abfd, x, (bfd_byte *) data + addr); - return bfd_reloc_ok; -} - -static bfd_reloc_status_type -howto8_pcrel_callback (abfd, reloc_entry, symbol_in, data, - ignore_input_section, ignore_bfd) - bfd *abfd; - arelent *reloc_entry; - struct symbol_cache_entry *symbol_in; - PTR data; - asection *ignore_input_section; - bfd *ignore_bfd; -{ - long relocation = 0; - bfd_vma addr = reloc_entry->address; - long x = bfd_get_8 (abfd, (bfd_byte *) data + addr); - abort (); - HOWTO_PREPARE (relocation, symbol_in); - - x = (x + relocation + reloc_entry->addend); - - bfd_put_8 (abfd, x, (bfd_byte *) data + addr); - return bfd_reloc_ok; -} - -static reloc_howto_type howto_16 -= NEWHOWTO (howto16_callback, "abs16", 1, false, false); -static reloc_howto_type howto_8 -= NEWHOWTO (howto8_callback, "abs8", 0, false, false); - -static reloc_howto_type howto_8_FFnn -= NEWHOWTO (howto8_FFnn_callback, "ff00+abs8", 0, false, false); - -static reloc_howto_type howto_8_pcrel -= NEWHOWTO (howto8_pcrel_callback, "pcrel8", 0, false, true); - -static reloc_howto_type * -local_bfd_reloc_type_lookup (arch, code) - const struct bfd_arch_info *arch; - bfd_reloc_code_real_type code; -{ - switch (code) - { - case BFD_RELOC_16: - return &howto_16; - case BFD_RELOC_8_FFnn: - return &howto_8_FFnn; - case BFD_RELOC_8: - return &howto_8; - case BFD_RELOC_8_PCREL: - return &howto_8_pcrel; - default: - return (reloc_howto_type *) NULL; - } -} -#endif - -int bfd_default_scan_num_mach (); - -static boolean -scan_mach (info, string) - const struct bfd_arch_info *info; - const char *string; -{ - if (strcmp (string, "z8001") == 0 || strcmp (string, "z8k") == 0) - { - return bfd_mach_z8001 == info->mach; - } - if (strcmp (string, "z8002") == 0) - { - return bfd_mach_z8002 == info->mach; - } - return false; -} - -/* This routine is provided two arch_infos and returns whether - they'd be compatible */ - -static const bfd_arch_info_type * -compatible (a, b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; -{ - if (a->arch != b->arch || a->mach != b->mach) - return NULL; - return a; -} - -static const bfd_arch_info_type arch_info_struct[] = -{ - {32, 32, 8, bfd_arch_z8k, bfd_mach_z8001, "z8k", "z8001", 1, false, compatible, scan_mach, 0,}, -}; - -const bfd_arch_info_type bfd_z8k_arch = -{ - 32, 16, 8, bfd_arch_z8k, bfd_mach_z8002, "z8k", "z8002", 1, true, compatible, scan_mach, &arch_info_struct[0], -}; diff --git a/contrib/binutils/bfd/doc/bfd.texi b/contrib/binutils/bfd/doc/bfd.texi deleted file mode 100644 index ea0ca9e56dc9..000000000000 --- a/contrib/binutils/bfd/doc/bfd.texi +++ /dev/null @@ -1,585 +0,0 @@ -@section @code{typedef bfd} -A BFD has type @code{bfd}; objects of this type are the -cornerstone of any application using BFD. Using BFD -consists of making references though the BFD and to data in the BFD. - -Here is the structure that defines the type @code{bfd}. It -contains the major data about the file and pointers -to the rest of the data. -@* -. -@example -struct _bfd -@{ - /* The filename the application opened the BFD with. */ - CONST char *filename; - - /* A pointer to the target jump table. */ - const struct bfd_target *xvec; - - /* To avoid dragging too many header files into every file that - includes `@code{bfd.h}', IOSTREAM has been declared as a "char - *", and MTIME as a "long". Their correct types, to which they - are cast when used, are "FILE *" and "time_t". The iostream - is the result of an fopen on the filename. However, if the - BFD_IN_MEMORY flag is set, then iostream is actually a pointer - to a bfd_in_memory struct. */ - PTR iostream; - - /* Is the file descriptor being cached? That is, can it be closed as - needed, and re-opened when accessed later? */ - - boolean cacheable; - - /* Marks whether there was a default target specified when the - BFD was opened. This is used to select which matching algorithm - to use to choose the back end. */ - - boolean target_defaulted; - - /* The caching routines use these to maintain a - least-recently-used list of BFDs */ - - struct _bfd *lru_prev, *lru_next; - - /* When a file is closed by the caching routines, BFD retains - state information on the file here: */ - - file_ptr where; - - /* and here: (``once'' means at least once) */ - - boolean opened_once; - - /* Set if we have a locally maintained mtime value, rather than - getting it from the file each time: */ - - boolean mtime_set; - - /* File modified time, if mtime_set is true: */ - - long mtime; - - /* Reserved for an unimplemented file locking extension.*/ - - int ifd; - - /* The format which belongs to the BFD. (object, core, etc.) */ - - bfd_format format; - - /* The direction the BFD was opened with*/ - - enum bfd_direction @{no_direction = 0, - read_direction = 1, - write_direction = 2, - both_direction = 3@} direction; - - /* Format_specific flags*/ - - flagword flags; - - /* Currently my_archive is tested before adding origin to - anything. I believe that this can become always an add of - origin, with origin set to 0 for non archive files. */ - - file_ptr origin; - - /* Remember when output has begun, to stop strange things - from happening. */ - boolean output_has_begun; - - /* Pointer to linked list of sections*/ - struct sec *sections; - - /* The number of sections */ - unsigned int section_count; - - /* Stuff only useful for object files: - The start address. */ - bfd_vma start_address; - - /* Used for input and output*/ - unsigned int symcount; - - /* Symbol table for output BFD (with symcount entries) */ - struct symbol_cache_entry **outsymbols; - - /* Pointer to structure which contains architecture information*/ - const struct bfd_arch_info *arch_info; - - /* Stuff only useful for archives:*/ - PTR arelt_data; - struct _bfd *my_archive; /* The containing archive BFD. */ - struct _bfd *next; /* The next BFD in the archive. */ - struct _bfd *archive_head; /* The first BFD in the archive. */ - boolean has_armap; - - /* A chain of BFD structures involved in a link. */ - struct _bfd *link_next; - - /* A field used by _bfd_generic_link_add_archive_symbols. This will - be used only for archive elements. */ - int archive_pass; - - /* Used by the back end to hold private data. */ - - union - @{ - struct aout_data_struct *aout_data; - struct artdata *aout_ar_data; - struct _oasys_data *oasys_obj_data; - struct _oasys_ar_data *oasys_ar_data; - struct coff_tdata *coff_obj_data; - struct pe_tdata *pe_obj_data; - struct xcoff_tdata *xcoff_obj_data; - struct ecoff_tdata *ecoff_obj_data; - struct ieee_data_struct *ieee_data; - struct ieee_ar_data_struct *ieee_ar_data; - struct srec_data_struct *srec_data; - struct ihex_data_struct *ihex_data; - struct tekhex_data_struct *tekhex_data; - struct elf_obj_tdata *elf_obj_data; - struct nlm_obj_tdata *nlm_obj_data; - struct bout_data_struct *bout_data; - struct sun_core_struct *sun_core_data; - struct trad_core_struct *trad_core_data; - struct som_data_struct *som_data; - struct hpux_core_struct *hpux_core_data; - struct hppabsd_core_struct *hppabsd_core_data; - struct sgi_core_struct *sgi_core_data; - struct lynx_core_struct *lynx_core_data; - struct osf_core_struct *osf_core_data; - struct cisco_core_struct *cisco_core_data; - struct versados_data_struct *versados_data; - struct netbsd_core_struct *netbsd_core_data; - PTR any; - @} tdata; - - /* Used by the application to hold private data*/ - PTR usrdata; - - /* Where all the allocated stuff under this BFD goes. This is a - struct objalloc *, but we use PTR to avoid requiring the inclusion of - objalloc.h. */ - PTR memory; -@}; - -@end example -@section Error reporting -Most BFD functions return nonzero on success (check their -individual documentation for precise semantics). On an error, -they call @code{bfd_set_error} to set an error condition that callers -can check by calling @code{bfd_get_error}. -If that returns @code{bfd_error_system_call}, then check -@code{errno}. - -The easiest way to report a BFD error to the user is to -use @code{bfd_perror}. -@* -@subsection Type @code{bfd_error_type} -The values returned by @code{bfd_get_error} are defined by the -enumerated type @code{bfd_error_type}. -@* -. -@example -typedef enum bfd_error -@{ - bfd_error_no_error = 0, - bfd_error_system_call, - bfd_error_invalid_target, - bfd_error_wrong_format, - bfd_error_invalid_operation, - bfd_error_no_memory, - bfd_error_no_symbols, - bfd_error_no_armap, - bfd_error_no_more_archived_files, - bfd_error_malformed_archive, - bfd_error_file_not_recognized, - bfd_error_file_ambiguously_recognized, - bfd_error_no_contents, - bfd_error_nonrepresentable_section, - bfd_error_no_debug_section, - bfd_error_bad_value, - bfd_error_file_truncated, - bfd_error_file_too_big, - bfd_error_invalid_error_code -@} bfd_error_type; - -@end example -@findex bfd_get_error -@subsubsection @code{bfd_get_error} -@strong{Synopsis} -@example -bfd_error_type bfd_get_error (void); -@end example -@strong{Description}@* -Return the current BFD error condition. -@* -@findex bfd_set_error -@subsubsection @code{bfd_set_error} -@strong{Synopsis} -@example -void bfd_set_error (bfd_error_type error_tag); -@end example -@strong{Description}@* -Set the BFD error condition to be @var{error_tag}. -@* -@findex bfd_errmsg -@subsubsection @code{bfd_errmsg} -@strong{Synopsis} -@example -CONST char *bfd_errmsg (bfd_error_type error_tag); -@end example -@strong{Description}@* -Return a string describing the error @var{error_tag}, or -the system error if @var{error_tag} is @code{bfd_error_system_call}. -@* -@findex bfd_perror -@subsubsection @code{bfd_perror} -@strong{Synopsis} -@example -void bfd_perror (CONST char *message); -@end example -@strong{Description}@* -Print to the standard error stream a string describing the -last BFD error that occurred, or the last system error if -the last BFD error was a system call failure. If @var{message} -is non-NULL and non-empty, the error string printed is preceded -by @var{message}, a colon, and a space. It is followed by a newline. -@* -@subsection BFD error handler -Some BFD functions want to print messages describing the -problem. They call a BFD error handler function. This -function may be overriden by the program. - -The BFD error handler acts like printf. -@* -. -@example -typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...)); - -@end example -@findex bfd_set_error_handler -@subsubsection @code{bfd_set_error_handler} -@strong{Synopsis} -@example -bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); -@end example -@strong{Description}@* -Set the BFD error handler function. Returns the previous -function. -@* -@findex bfd_set_error_program_name -@subsubsection @code{bfd_set_error_program_name} -@strong{Synopsis} -@example -void bfd_set_error_program_name (const char *); -@end example -@strong{Description}@* -Set the program name to use when printing a BFD error. This -is printed before the error message followed by a colon and -space. The string must not be changed after it is passed to -this function. -@* -@section Symbols - -@* -@findex bfd_get_reloc_upper_bound -@subsubsection @code{bfd_get_reloc_upper_bound} -@strong{Synopsis} -@example -long bfd_get_reloc_upper_bound(bfd *abfd, asection *sect); -@end example -@strong{Description}@* -Return the number of bytes required to store the -relocation information associated with section @var{sect} -attached to bfd @var{abfd}. If an error occurs, return -1. -@* -@findex bfd_canonicalize_reloc -@subsubsection @code{bfd_canonicalize_reloc} -@strong{Synopsis} -@example -long bfd_canonicalize_reloc - (bfd *abfd, - asection *sec, - arelent **loc, - asymbol **syms); -@end example -@strong{Description}@* -Call the back end associated with the open BFD -@var{abfd} and translate the external form of the relocation -information attached to @var{sec} into the internal canonical -form. Place the table into memory at @var{loc}, which has -been preallocated, usually by a call to -@code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or --1 on error. - -The @var{syms} table is also needed for horrible internal magic -reasons. -@* -@findex bfd_set_reloc -@subsubsection @code{bfd_set_reloc} -@strong{Synopsis} -@example -void bfd_set_reloc - (bfd *abfd, asection *sec, arelent **rel, unsigned int count) -@end example -@strong{Description}@* -Set the relocation pointer and count within -section @var{sec} to the values @var{rel} and @var{count}. -The argument @var{abfd} is ignored. -@* -@findex bfd_set_file_flags -@subsubsection @code{bfd_set_file_flags} -@strong{Synopsis} -@example -boolean bfd_set_file_flags(bfd *abfd, flagword flags); -@end example -@strong{Description}@* -Set the flag word in the BFD @var{abfd} to the value @var{flags}. - -Possible errors are: -@itemize @bullet - -@item -@code{bfd_error_wrong_format} - The target bfd was not of object format. -@item -@code{bfd_error_invalid_operation} - The target bfd was open for reading. -@item -@code{bfd_error_invalid_operation} - -The flag word contained a bit which was not applicable to the -type of file. E.g., an attempt was made to set the @code{D_PAGED} bit -on a BFD format which does not support demand paging. -@end itemize -@* -@findex bfd_set_start_address -@subsubsection @code{bfd_set_start_address} -@strong{Synopsis} -@example -boolean bfd_set_start_address(bfd *abfd, bfd_vma vma); -@end example -@strong{Description}@* -Make @var{vma} the entry point of output BFD @var{abfd}. -@* -@strong{Returns}@* -Returns @code{true} on success, @code{false} otherwise. -@* -@findex bfd_get_mtime -@subsubsection @code{bfd_get_mtime} -@strong{Synopsis} -@example -long bfd_get_mtime(bfd *abfd); -@end example -@strong{Description}@* -Return the file modification time (as read from the file system, or -from the archive header for archive members). -@* -@findex bfd_get_size -@subsubsection @code{bfd_get_size} -@strong{Synopsis} -@example -long bfd_get_size(bfd *abfd); -@end example -@strong{Description}@* -Return the file size (as read from file system) for the file -associated with BFD @var{abfd}. - -The initial motivation for, and use of, this routine is not -so we can get the exact size of the object the BFD applies to, since -that might not be generally possible (archive members for example). -It would be ideal if someone could eventually modify -it so that such results were guaranteed. - -Instead, we want to ask questions like "is this NNN byte sized -object I'm about to try read from file offset YYY reasonable?" -As as example of where we might do this, some object formats -use string tables for which the first @code{sizeof(long)} bytes of the -table contain the size of the table itself, including the size bytes. -If an application tries to read what it thinks is one of these -string tables, without some way to validate the size, and for -some reason the size is wrong (byte swapping error, wrong location -for the string table, etc.), the only clue is likely to be a read -error when it tries to read the table, or a "virtual memory -exhausted" error when it tries to allocate 15 bazillon bytes -of space for the 15 bazillon byte table it is about to read. -This function at least allows us to answer the quesion, "is the -size reasonable?". -@* -@findex bfd_get_gp_size -@subsubsection @code{bfd_get_gp_size} -@strong{Synopsis} -@example -int bfd_get_gp_size(bfd *abfd); -@end example -@strong{Description}@* -Return the maximum size of objects to be optimized using the GP -register under MIPS ECOFF. This is typically set by the @code{-G} -argument to the compiler, assembler or linker. -@* -@findex bfd_set_gp_size -@subsubsection @code{bfd_set_gp_size} -@strong{Synopsis} -@example -void bfd_set_gp_size(bfd *abfd, int i); -@end example -@strong{Description}@* -Set the maximum size of objects to be optimized using the GP -register under ECOFF or MIPS ELF. This is typically set by -the @code{-G} argument to the compiler, assembler or linker. -@* -@findex bfd_scan_vma -@subsubsection @code{bfd_scan_vma} -@strong{Synopsis} -@example -bfd_vma bfd_scan_vma(CONST char *string, CONST char **end, int base); -@end example -@strong{Description}@* -Convert, like @code{strtoul}, a numerical expression -@var{string} into a @code{bfd_vma} integer, and return that integer. -(Though without as many bells and whistles as @code{strtoul}.) -The expression is assumed to be unsigned (i.e., positive). -If given a @var{base}, it is used as the base for conversion. -A base of 0 causes the function to interpret the string -in hex if a leading "0x" or "0X" is found, otherwise -in octal if a leading zero is found, otherwise in decimal. - -Overflow is not detected. -@* -@findex bfd_copy_private_bfd_data -@subsubsection @code{bfd_copy_private_bfd_data} -@strong{Synopsis} -@example -boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd); -@end example -@strong{Description}@* -Copy private BFD information from the BFD @var{ibfd} to the -the BFD @var{obfd}. Return @code{true} on success, @code{false} on error. -Possible error returns are: - -@itemize @bullet - -@item -@code{bfd_error_no_memory} - -Not enough memory exists to create private data for @var{obfd}. -@end itemize -@example -#define bfd_copy_private_bfd_data(ibfd, obfd) \ - BFD_SEND (obfd, _bfd_copy_private_bfd_data, \ - (ibfd, obfd)) -@end example -@* -@findex bfd_merge_private_bfd_data -@subsubsection @code{bfd_merge_private_bfd_data} -@strong{Synopsis} -@example -boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd); -@end example -@strong{Description}@* -Merge private BFD information from the BFD @var{ibfd} to the -the output file BFD @var{obfd} when linking. Return @code{true} -on success, @code{false} on error. Possible error returns are: - -@itemize @bullet - -@item -@code{bfd_error_no_memory} - -Not enough memory exists to create private data for @var{obfd}. -@end itemize -@example -#define bfd_merge_private_bfd_data(ibfd, obfd) \ - BFD_SEND (obfd, _bfd_merge_private_bfd_data, \ - (ibfd, obfd)) -@end example -@* -@findex bfd_set_private_flags -@subsubsection @code{bfd_set_private_flags} -@strong{Synopsis} -@example -boolean bfd_set_private_flags(bfd *abfd, flagword flags); -@end example -@strong{Description}@* -Set private BFD flag information in the BFD @var{abfd}. -Return @code{true} on success, @code{false} on error. Possible error -returns are: - -@itemize @bullet - -@item -@code{bfd_error_no_memory} - -Not enough memory exists to create private data for @var{obfd}. -@end itemize -@example -#define bfd_set_private_flags(abfd, flags) \ - BFD_SEND (abfd, _bfd_set_private_flags, \ - (abfd, flags)) -@end example -@* -@findex stuff -@subsubsection @code{stuff} -@strong{Description}@* -Stuff which should be documented: -@example -#define bfd_sizeof_headers(abfd, reloc) \ - BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc)) - -#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ - BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line)) - - /* Do these three do anything useful at all, for any back end? */ -#define bfd_debug_info_start(abfd) \ - BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) - -#define bfd_debug_info_end(abfd) \ - BFD_SEND (abfd, _bfd_debug_info_end, (abfd)) - -#define bfd_debug_info_accumulate(abfd, section) \ - BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section)) - - -#define bfd_stat_arch_elt(abfd, stat) \ - BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat)) - -#define bfd_update_armap_timestamp(abfd) \ - BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd)) - -#define bfd_set_arch_mach(abfd, arch, mach)\ - BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach)) - -#define bfd_relax_section(abfd, section, link_info, again) \ - BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again)) - -#define bfd_link_hash_table_create(abfd) \ - BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) - -#define bfd_link_add_symbols(abfd, info) \ - BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) - -#define bfd_final_link(abfd, info) \ - BFD_SEND (abfd, _bfd_final_link, (abfd, info)) - -#define bfd_free_cached_info(abfd) \ - BFD_SEND (abfd, _bfd_free_cached_info, (abfd)) - -#define bfd_get_dynamic_symtab_upper_bound(abfd) \ - BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd)) - -#define bfd_print_private_bfd_data(abfd, file)\ - BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file)) - -#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \ - BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols)) - -#define bfd_get_dynamic_reloc_upper_bound(abfd) \ - BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd)) - -#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \ - BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms)) - -extern bfd_byte *bfd_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, - struct bfd_link_order *, bfd_byte *, - boolean, asymbol **)); - -@end example -@* diff --git a/contrib/binutils/bfd/elf32-mips.c b/contrib/binutils/bfd/elf32-mips.c deleted file mode 100644 index e7e1c2a7ab20..000000000000 --- a/contrib/binutils/bfd/elf32-mips.c +++ /dev/null @@ -1,9049 +0,0 @@ -/* MIPS-specific support for 32-bit ELF - Copyright 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc. - - Most of the information added by Ian Lance Taylor, Cygnus Support, - <ian@cygnus.com>. - N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC. - <mark@codesourcery.com> - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file handles MIPS ELF targets. SGI Irix 5 uses a slightly - different MIPS ELF from other targets. This matters when linking. - This file supports both, switching at runtime. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "bfdlink.h" -#include "genlink.h" -#include "elf-bfd.h" -#include "elf/mips.h" - -/* Get the ECOFF swapping routines. */ -#include "coff/sym.h" -#include "coff/symconst.h" -#include "coff/internal.h" -#include "coff/ecoff.h" -#include "coff/mips.h" -#define ECOFF_32 -#include "ecoffswap.h" - -/* This structure is used to hold .got information when linking. It - is stored in the tdata field of the bfd_elf_section_data structure. */ - -struct mips_got_info -{ - /* The global symbol in the GOT with the lowest index in the dynamic - symbol table. */ - struct elf_link_hash_entry *global_gotsym; - /* The number of global .got entries. */ - unsigned int global_gotno; - /* The number of local .got entries. */ - unsigned int local_gotno; - /* The number of local .got entries we have used. */ - unsigned int assigned_gotno; -}; - -/* The MIPS ELF linker needs additional information for each symbol in - the global hash table. */ - -struct mips_elf_link_hash_entry -{ - struct elf_link_hash_entry root; - - /* External symbol information. */ - EXTR esym; - - /* Number of R_MIPS_32, R_MIPS_REL32, or R_MIPS_64 relocs against - this symbol. */ - unsigned int possibly_dynamic_relocs; - - /* The index of the first dynamic relocation (in the .rel.dyn - section) against this symbol. */ - unsigned int min_dyn_reloc_index; - - /* If there is a stub that 32 bit functions should use to call this - 16 bit function, this points to the section containing the stub. */ - asection *fn_stub; - - /* Whether we need the fn_stub; this is set if this symbol appears - in any relocs other than a 16 bit call. */ - boolean need_fn_stub; - - /* If there is a stub that 16 bit functions should use to call this - 32 bit function, this points to the section containing the stub. */ - asection *call_stub; - - /* This is like the call_stub field, but it is used if the function - being called returns a floating point value. */ - asection *call_fp_stub; -}; - -static bfd_reloc_status_type mips32_64bit_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static reloc_howto_type *mips_rtype_to_howto - PARAMS ((unsigned int)); -static void mips_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); -static void mips_info_to_howto_rela - PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); -static void bfd_mips_elf32_swap_gptab_in - PARAMS ((bfd *, const Elf32_External_gptab *, Elf32_gptab *)); -static void bfd_mips_elf32_swap_gptab_out - PARAMS ((bfd *, const Elf32_gptab *, Elf32_External_gptab *)); -#if 0 -static void bfd_mips_elf_swap_msym_in - PARAMS ((bfd *, const Elf32_External_Msym *, Elf32_Internal_Msym *)); -#endif -static void bfd_mips_elf_swap_msym_out - PARAMS ((bfd *, const Elf32_Internal_Msym *, Elf32_External_Msym *)); -static boolean mips_elf_sym_is_global PARAMS ((bfd *, asymbol *)); -static boolean mips_elf_create_procedure_table - PARAMS ((PTR, bfd *, struct bfd_link_info *, asection *, - struct ecoff_debug_info *)); -static INLINE int elf_mips_isa PARAMS ((flagword)); -static INLINE int elf_mips_mach PARAMS ((flagword)); -static INLINE char* elf_mips_abi_name PARAMS ((bfd *)); -static boolean mips_elf_is_local_label_name - PARAMS ((bfd *, const char *)); -static struct bfd_hash_entry *mips_elf_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static int gptab_compare PARAMS ((const void *, const void *)); -static bfd_reloc_status_type mips16_jump_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type mips16_gprel_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static boolean mips_elf_create_compact_rel_section - PARAMS ((bfd *, struct bfd_link_info *)); -static boolean mips_elf_create_got_section - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_reloc_status_type mips_elf_final_gp - PARAMS ((bfd *, asymbol *, boolean, char **, bfd_vma *)); -static bfd_byte *elf32_mips_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, boolean, asymbol **)); -static asection *mips_elf_create_msym_section - PARAMS ((bfd *)); -static void mips_elf_irix6_finish_dynamic_symbol - PARAMS ((bfd *, const char *, Elf_Internal_Sym *)); -static bfd_vma mips_elf_sign_extend PARAMS ((bfd_vma, int)); -static boolean mips_elf_overflow_p PARAMS ((bfd_vma, int)); -static bfd_vma mips_elf_high PARAMS ((bfd_vma)); -static bfd_vma mips_elf_higher PARAMS ((bfd_vma)); -static bfd_vma mips_elf_highest PARAMS ((bfd_vma)); -static bfd_vma mips_elf_global_got_index - PARAMS ((bfd *, struct elf_link_hash_entry *)); -static bfd_vma mips_elf_local_got_index - PARAMS ((bfd *, struct bfd_link_info *, bfd_vma)); -static bfd_vma mips_elf_got_offset_from_index - PARAMS ((bfd *, bfd *, bfd_vma)); -static boolean mips_elf_record_global_got_symbol - PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *, - struct mips_got_info *)); -static bfd_vma mips_elf_got_page - PARAMS ((bfd *, struct bfd_link_info *, bfd_vma, bfd_vma *)); -static const Elf_Internal_Rela *mips_elf_next_relocation - PARAMS ((unsigned int, const Elf_Internal_Rela *, - const Elf_Internal_Rela *)); -static bfd_reloc_status_type mips_elf_calculate_relocation - PARAMS ((bfd *, bfd *, asection *, struct bfd_link_info *, - const Elf_Internal_Rela *, bfd_vma, reloc_howto_type *, - Elf_Internal_Sym *, asection **, bfd_vma *, const char **, - boolean *)); -static bfd_vma mips_elf_obtain_contents - PARAMS ((reloc_howto_type *, const Elf_Internal_Rela *, bfd *, bfd_byte *)); -static boolean mips_elf_perform_relocation - PARAMS ((struct bfd_link_info *, reloc_howto_type *, - const Elf_Internal_Rela *, bfd_vma, - bfd *, asection *, bfd_byte *, boolean)); -static boolean mips_elf_assign_gp PARAMS ((bfd *, bfd_vma *)); -static boolean mips_elf_sort_hash_table_f - PARAMS ((struct mips_elf_link_hash_entry *, PTR)); -static boolean mips_elf_sort_hash_table - PARAMS ((struct bfd_link_info *, unsigned long)); -static asection * mips_elf_got_section PARAMS ((bfd *)); -static struct mips_got_info *mips_elf_got_info - PARAMS ((bfd *, asection **)); -static boolean mips_elf_local_relocation_p - PARAMS ((bfd *, const Elf_Internal_Rela *, asection **)); -static bfd_vma mips_elf_create_local_got_entry - PARAMS ((bfd *, struct mips_got_info *, asection *, bfd_vma)); -static bfd_vma mips_elf_got16_entry - PARAMS ((bfd *, struct bfd_link_info *, bfd_vma)); -static boolean mips_elf_create_dynamic_relocation - PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Rela *, - struct mips_elf_link_hash_entry *, asection *, - bfd_vma, bfd_vma *, asection *)); -static void mips_elf_allocate_dynamic_relocations - PARAMS ((bfd *, unsigned int)); -static boolean mips_elf_stub_section_p - PARAMS ((bfd *, asection *)); - -/* The level of IRIX compatibility we're striving for. */ - -typedef enum { - ict_none, - ict_irix5, - ict_irix6 -} irix_compat_t; - -/* Nonzero if ABFD is using the N32 ABI. */ - -#define ABI_N32_P(abfd) \ - ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0) - -/* Nonzero if ABFD is using the 64-bit ABI. FIXME: This is never - true, yet. */ -#define ABI_64_P(abfd) \ - ((elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64) != 0) - -/* What version of Irix we are trying to be compatible with. FIXME: - At the moment, we never generate "normal" MIPS ELF ABI executables; - we always use some version of Irix. */ - -#define IRIX_COMPAT(abfd) \ - ((ABI_N32_P (abfd) || ABI_64_P (abfd)) ? ict_irix6 : ict_irix5) - -/* Whether we are trying to be compatible with IRIX at all. */ - -#define SGI_COMPAT(abfd) \ - (IRIX_COMPAT (abfd) != ict_none) - -/* The name of the msym section. */ -#define MIPS_ELF_MSYM_SECTION_NAME(abfd) ".msym" - -/* The name of the srdata section. */ -#define MIPS_ELF_SRDATA_SECTION_NAME(abfd) ".srdata" - -/* The name of the options section. */ -#define MIPS_ELF_OPTIONS_SECTION_NAME(abfd) \ - (IRIX_COMPAT (abfd) == ict_irix6 ? ".MIPS.options" : ".options") - -/* The name of the stub section. */ -#define MIPS_ELF_STUB_SECTION_NAME(abfd) \ - (IRIX_COMPAT (abfd) == ict_irix6 ? ".MIPS.stubs" : ".stub") - -/* The name of the dynamic relocation section. */ -#define MIPS_ELF_REL_DYN_SECTION_NAME(abfd) ".rel.dyn" - -/* The size of an external REL relocation. */ -#define MIPS_ELF_REL_SIZE(abfd) \ - (get_elf_backend_data (abfd)->s->sizeof_rel) - -/* The size of an external dynamic table entry. */ -#define MIPS_ELF_DYN_SIZE(abfd) \ - (get_elf_backend_data (abfd)->s->sizeof_dyn) - -/* The size of a GOT entry. */ -#define MIPS_ELF_GOT_SIZE(abfd) \ - (get_elf_backend_data (abfd)->s->arch_size / 8) - -/* The size of a symbol-table entry. */ -#define MIPS_ELF_SYM_SIZE(abfd) \ - (get_elf_backend_data (abfd)->s->sizeof_sym) - -/* The default alignment for sections, as a power of two. */ -#define MIPS_ELF_LOG_FILE_ALIGN(abfd) \ - (get_elf_backend_data (abfd)->s->file_align == 8 ? 3 : 2) - -/* Get word-sized data. */ -#define MIPS_ELF_GET_WORD(abfd, ptr) \ - (ABI_64_P (abfd) ? bfd_get_64 (abfd, ptr) : bfd_get_32 (abfd, ptr)) - -/* Put out word-sized data. */ -#define MIPS_ELF_PUT_WORD(abfd, val, ptr) \ - (ABI_64_P (abfd) \ - ? bfd_put_64 (abfd, val, ptr) \ - : bfd_put_32 (abfd, val, ptr)) - -/* Add a dynamic symbol table-entry. */ -#ifdef BFD64 -#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ - (ABI_64_P (elf_hash_table (info)->dynobj) \ - ? bfd_elf64_add_dynamic_entry (info, tag, val) \ - : bfd_elf32_add_dynamic_entry (info, tag, val)) -#else -#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \ - (ABI_64_P (elf_hash_table (info)->dynobj) \ - ? (abort (), false) \ - : bfd_elf32_add_dynamic_entry (info, tag, val)) -#endif - -/* The number of local .got entries we reserve. */ -#define MIPS_RESERVED_GOTNO (2) - -/* Instructions which appear in a stub. For some reason the stub is - slightly different on an SGI system. */ -#define ELF_MIPS_GP_OFFSET(abfd) (SGI_COMPAT (abfd) ? 0x7ff0 : 0x8000) -#define STUB_LW(abfd) \ - (SGI_COMPAT (abfd) \ - ? (ABI_64_P (abfd) \ - ? 0xdf998010 /* ld t9,0x8010(gp) */ \ - : 0x8f998010) /* lw t9,0x8010(gp) */ \ - : 0x8f998000) /* lw t9,0x8000(gp) */ -#define STUB_MOVE 0x03e07825 /* move t7,ra */ -#define STUB_JALR 0x0320f809 /* jal t9 */ -#define STUB_LI16 0x34180000 /* ori t8,zero,0 */ -#define MIPS_FUNCTION_STUB_SIZE (16) - -#if 0 -/* We no longer try to identify particular sections for the .dynsym - section. When we do, we wind up crashing if there are other random - sections with relocations. */ - -/* Names of sections which appear in the .dynsym section in an Irix 5 - executable. */ - -static const char * const mips_elf_dynsym_sec_names[] = -{ - ".text", - ".init", - ".fini", - ".data", - ".rodata", - ".sdata", - ".sbss", - ".bss", - NULL -}; - -#define SIZEOF_MIPS_DYNSYM_SECNAMES \ - (sizeof mips_elf_dynsym_sec_names / sizeof mips_elf_dynsym_sec_names[0]) - -/* The number of entries in mips_elf_dynsym_sec_names which go in the - text segment. */ - -#define MIPS_TEXT_DYNSYM_SECNO (3) - -#endif /* 0 */ - -/* The names of the runtime procedure table symbols used on Irix 5. */ - -static const char * const mips_elf_dynsym_rtproc_names[] = -{ - "_procedure_table", - "_procedure_string_table", - "_procedure_table_size", - NULL -}; - -/* These structures are used to generate the .compact_rel section on - Irix 5. */ - -typedef struct -{ - unsigned long id1; /* Always one? */ - unsigned long num; /* Number of compact relocation entries. */ - unsigned long id2; /* Always two? */ - unsigned long offset; /* The file offset of the first relocation. */ - unsigned long reserved0; /* Zero? */ - unsigned long reserved1; /* Zero? */ -} Elf32_compact_rel; - -typedef struct -{ - bfd_byte id1[4]; - bfd_byte num[4]; - bfd_byte id2[4]; - bfd_byte offset[4]; - bfd_byte reserved0[4]; - bfd_byte reserved1[4]; -} Elf32_External_compact_rel; - -typedef struct -{ - unsigned int ctype : 1; /* 1: long 0: short format. See below. */ - unsigned int rtype : 4; /* Relocation types. See below. */ - unsigned int dist2to : 8; - unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */ - unsigned long konst; /* KONST field. See below. */ - unsigned long vaddr; /* VADDR to be relocated. */ -} Elf32_crinfo; - -typedef struct -{ - unsigned int ctype : 1; /* 1: long 0: short format. See below. */ - unsigned int rtype : 4; /* Relocation types. See below. */ - unsigned int dist2to : 8; - unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */ - unsigned long konst; /* KONST field. See below. */ -} Elf32_crinfo2; - -typedef struct -{ - bfd_byte info[4]; - bfd_byte konst[4]; - bfd_byte vaddr[4]; -} Elf32_External_crinfo; - -typedef struct -{ - bfd_byte info[4]; - bfd_byte konst[4]; -} Elf32_External_crinfo2; - -/* These are the constants used to swap the bitfields in a crinfo. */ - -#define CRINFO_CTYPE (0x1) -#define CRINFO_CTYPE_SH (31) -#define CRINFO_RTYPE (0xf) -#define CRINFO_RTYPE_SH (27) -#define CRINFO_DIST2TO (0xff) -#define CRINFO_DIST2TO_SH (19) -#define CRINFO_RELVADDR (0x7ffff) -#define CRINFO_RELVADDR_SH (0) - -/* A compact relocation info has long (3 words) or short (2 words) - formats. A short format doesn't have VADDR field and relvaddr - fields contains ((VADDR - vaddr of the previous entry) >> 2). */ -#define CRF_MIPS_LONG 1 -#define CRF_MIPS_SHORT 0 - -/* There are 4 types of compact relocation at least. The value KONST - has different meaning for each type: - - (type) (konst) - CT_MIPS_REL32 Address in data - CT_MIPS_WORD Address in word (XXX) - CT_MIPS_GPHI_LO GP - vaddr - CT_MIPS_JMPAD Address to jump - */ - -#define CRT_MIPS_REL32 0xa -#define CRT_MIPS_WORD 0xb -#define CRT_MIPS_GPHI_LO 0xc -#define CRT_MIPS_JMPAD 0xd - -#define mips_elf_set_cr_format(x,format) ((x).ctype = (format)) -#define mips_elf_set_cr_type(x,type) ((x).rtype = (type)) -#define mips_elf_set_cr_dist2to(x,v) ((x).dist2to = (v)) -#define mips_elf_set_cr_relvaddr(x,d) ((x).relvaddr = (d)<<2) - -static void bfd_elf32_swap_compact_rel_out - PARAMS ((bfd *, const Elf32_compact_rel *, Elf32_External_compact_rel *)); -static void bfd_elf32_swap_crinfo_out - PARAMS ((bfd *, const Elf32_crinfo *, Elf32_External_crinfo *)); - -#define USE_REL 1 /* MIPS uses REL relocations instead of RELA */ - -/* In case we're on a 32-bit machine, construct a 64-bit "-1" value - from smaller values. Start with zero, widen, *then* decrement. */ -#define MINUS_ONE (((bfd_vma)0) - 1) - -static reloc_howto_type elf_mips_howto_table[] = -{ - /* No relocation. */ - HOWTO (R_MIPS_NONE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_NONE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit relocation. */ - HOWTO (R_MIPS_16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit relocation. */ - HOWTO (R_MIPS_32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit symbol relative relocation. */ - HOWTO (R_MIPS_REL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_REL32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 26 bit branch address. */ - HOWTO (R_MIPS_26, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - /* This needs complex overflow - detection, because the upper four - bits must match the PC. */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_26", /* name */ - true, /* partial_inplace */ - 0x3ffffff, /* src_mask */ - 0x3ffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of symbol value. */ - HOWTO (R_MIPS_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_hi16_reloc, /* special_function */ - "R_MIPS_HI16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of symbol value. */ - HOWTO (R_MIPS_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_lo16_reloc, /* special_function */ - "R_MIPS_LO16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* GP relative reference. */ - HOWTO (R_MIPS_GPREL16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_gprel16_reloc, /* special_function */ - "R_MIPS_GPREL16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Reference to literal section. */ - HOWTO (R_MIPS_LITERAL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_gprel16_reloc, /* special_function */ - "R_MIPS_LITERAL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Reference to global offset table. */ - HOWTO (R_MIPS_GOT16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_got16_reloc, /* special_function */ - "R_MIPS_GOT16", /* name */ - false, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit PC relative reference. */ - HOWTO (R_MIPS_PC16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PC16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 16 bit call through global offset table. */ - HOWTO (R_MIPS_CALL16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL16", /* name */ - false, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit GP relative reference. */ - HOWTO (R_MIPS_GPREL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - _bfd_mips_elf_gprel32_reloc, /* special_function */ - "R_MIPS_GPREL32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* The remaining relocs are defined on Irix 5, although they are - not defined by the ABI. */ - EMPTY_HOWTO (13), - EMPTY_HOWTO (14), - EMPTY_HOWTO (15), - - /* A 5 bit shift field. */ - HOWTO (R_MIPS_SHIFT5, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 5, /* bitsize */ - false, /* pc_relative */ - 6, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SHIFT5", /* name */ - true, /* partial_inplace */ - 0x000007c0, /* src_mask */ - 0x000007c0, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 6 bit shift field. */ - /* FIXME: This is not handled correctly; a special function is - needed to put the most significant bit in the right place. */ - HOWTO (R_MIPS_SHIFT6, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 6, /* bitsize */ - false, /* pc_relative */ - 6, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SHIFT6", /* name */ - true, /* partial_inplace */ - 0x000007c4, /* src_mask */ - 0x000007c4, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 64 bit relocation. */ - HOWTO (R_MIPS_64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - mips32_64bit_reloc, /* special_function */ - "R_MIPS_64", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* Displacement in the global offset table. */ - HOWTO (R_MIPS_GOT_DISP, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_DISP", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Displacement to page pointer in the global offset table. */ - HOWTO (R_MIPS_GOT_PAGE, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_PAGE", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Offset from page pointer in the global offset table. */ - HOWTO (R_MIPS_GOT_OFST, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_OFST", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of displacement in global offset table. */ - HOWTO (R_MIPS_GOT_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_HI16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of displacement in global offset table. */ - HOWTO (R_MIPS_GOT_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_LO16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 64 bit subtraction. Used in the N32 ABI. */ - HOWTO (R_MIPS_SUB, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SUB", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* Used to cause the linker to insert and delete instructions? */ - EMPTY_HOWTO (R_MIPS_INSERT_A), - EMPTY_HOWTO (R_MIPS_INSERT_B), - EMPTY_HOWTO (R_MIPS_DELETE), - - /* Get the higher value of a 64 bit addend. */ - HOWTO (R_MIPS_HIGHER, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HIGHER", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Get the highest value of a 64 bit addend. */ - HOWTO (R_MIPS_HIGHEST, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HIGHEST", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of displacement in global offset table. */ - HOWTO (R_MIPS_CALL_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL_HI16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of displacement in global offset table. */ - HOWTO (R_MIPS_CALL_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL_LO16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Section displacement. */ - HOWTO (R_MIPS_SCN_DISP, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SCN_DISP", /* name */ - false, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - EMPTY_HOWTO (R_MIPS_REL16), - EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE), - EMPTY_HOWTO (R_MIPS_PJUMP), - EMPTY_HOWTO (R_MIPS_RELGOT), - - /* Protected jump conversion. This is an optimization hint. No - relocation is required for correctness. */ - HOWTO (R_MIPS_JALR, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_JALR", /* name */ - false, /* partial_inplace */ - 0x00000000, /* src_mask */ - 0x00000000, /* dst_mask */ - false), /* pcrel_offset */ -}; - -/* The reloc used for BFD_RELOC_CTOR when doing a 64 bit link. This - is a hack to make the linker think that we need 64 bit values. */ -static reloc_howto_type elf_mips_ctor64_howto = - HOWTO (R_MIPS_64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - mips32_64bit_reloc, /* special_function */ - "R_MIPS_64", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false); /* pcrel_offset */ - -/* The reloc used for the mips16 jump instruction. */ -static reloc_howto_type elf_mips16_jump_howto = - HOWTO (R_MIPS16_26, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - /* This needs complex overflow - detection, because the upper four - bits must match the PC. */ - mips16_jump_reloc, /* special_function */ - "R_MIPS16_26", /* name */ - true, /* partial_inplace */ - 0x3ffffff, /* src_mask */ - 0x3ffffff, /* dst_mask */ - false); /* pcrel_offset */ - -/* The reloc used for the mips16 gprel instruction. */ -static reloc_howto_type elf_mips16_gprel_howto = - HOWTO (R_MIPS16_GPREL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - mips16_gprel_reloc, /* special_function */ - "R_MIPS16_GPREL", /* name */ - true, /* partial_inplace */ - 0x07ff001f, /* src_mask */ - 0x07ff001f, /* dst_mask */ - false); /* pcrel_offset */ - - -/* GNU extensions for embedded-pic. */ -/* High 16 bits of symbol value, pc-relative. */ -static reloc_howto_type elf_mips_gnu_rel_hi16 = - HOWTO (R_MIPS_GNU_REL_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_hi16_reloc, /* special_function */ - "R_MIPS_GNU_REL_HI16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true); /* pcrel_offset */ - -/* Low 16 bits of symbol value, pc-relative. */ -static reloc_howto_type elf_mips_gnu_rel_lo16 = - HOWTO (R_MIPS_GNU_REL_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_lo16_reloc, /* special_function */ - "R_MIPS_GNU_REL_LO16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true); /* pcrel_offset */ - -/* 16 bit offset for pc-relative branches. */ -static reloc_howto_type elf_mips_gnu_rel16_s2 = - HOWTO (R_MIPS_GNU_REL16_S2, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GNU_REL16_S2", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - true); /* pcrel_offset */ - -/* 64 bit pc-relative. */ -static reloc_howto_type elf_mips_gnu_pcrel64 = - HOWTO (R_MIPS_PC64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PC64", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - true); /* pcrel_offset */ - -/* 32 bit pc-relative. */ -static reloc_howto_type elf_mips_gnu_pcrel32 = - HOWTO (R_MIPS_PC32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PC32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - true); /* pcrel_offset */ - -/* GNU extension to record C++ vtable hierarchy */ -static reloc_howto_type elf_mips_gnu_vtinherit_howto = - HOWTO (R_MIPS_GNU_VTINHERIT, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - NULL, /* special_function */ - "R_MIPS_GNU_VTINHERIT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false); /* pcrel_offset */ - -/* GNU extension to record C++ vtable member usage */ -static reloc_howto_type elf_mips_gnu_vtentry_howto = - HOWTO (R_MIPS_GNU_VTENTRY, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_elf_rel_vtable_reloc_fn, /* special_function */ - "R_MIPS_GNU_VTENTRY", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false); /* pcrel_offset */ - -/* Do a R_MIPS_HI16 relocation. This has to be done in combination - with a R_MIPS_LO16 reloc, because there is a carry from the LO16 to - the HI16. Here we just save the information we need; we do the - actual relocation when we see the LO16. MIPS ELF requires that the - LO16 immediately follow the HI16. As a GNU extension, we permit an - arbitrary number of HI16 relocs to be associated with a single LO16 - reloc. This extension permits gcc to output the HI and LO relocs - itself. */ - -struct mips_hi16 -{ - struct mips_hi16 *next; - bfd_byte *addr; - bfd_vma addend; -}; - -/* FIXME: This should not be a static variable. */ - -static struct mips_hi16 *mips_hi16_list; - -bfd_reloc_status_type -_bfd_mips_elf_hi16_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - bfd_reloc_status_type ret; - bfd_vma relocation; - struct mips_hi16 *n; - - /* If we're relocating, and this an external symbol, we don't want - to change anything. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - ret = bfd_reloc_ok; - - if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0) - { - boolean relocateable; - bfd_vma gp; - - if (ret == bfd_reloc_undefined) - abort (); - - if (output_bfd != NULL) - relocateable = true; - else - { - relocateable = false; - output_bfd = symbol->section->output_section->owner; - } - - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, - error_message, &gp); - if (ret != bfd_reloc_ok) - return ret; - - relocation = gp - reloc_entry->address; - } - else - { - if (bfd_is_und_section (symbol->section) - && output_bfd == (bfd *) NULL) - ret = bfd_reloc_undefined; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - } - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* Save the information, and let LO16 do the actual relocation. */ - n = (struct mips_hi16 *) bfd_malloc (sizeof *n); - if (n == NULL) - return bfd_reloc_outofrange; - n->addr = (bfd_byte *) data + reloc_entry->address; - n->addend = relocation; - n->next = mips_hi16_list; - mips_hi16_list = n; - - if (output_bfd != (bfd *) NULL) - reloc_entry->address += input_section->output_offset; - - return ret; -} - -/* Do a R_MIPS_LO16 relocation. This is a straightforward 16 bit - inplace relocation; this function exists in order to do the - R_MIPS_HI16 relocation described above. */ - -bfd_reloc_status_type -_bfd_mips_elf_lo16_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - arelent gp_disp_relent; - - if (mips_hi16_list != NULL) - { - struct mips_hi16 *l; - - l = mips_hi16_list; - while (l != NULL) - { - unsigned long insn; - unsigned long val; - unsigned long vallo; - struct mips_hi16 *next; - - /* Do the HI16 relocation. Note that we actually don't need - to know anything about the LO16 itself, except where to - find the low 16 bits of the addend needed by the LO16. */ - insn = bfd_get_32 (abfd, l->addr); - vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address) - & 0xffff); - val = ((insn & 0xffff) << 16) + vallo; - val += l->addend; - - /* The low order 16 bits are always treated as a signed - value. Therefore, a negative value in the low order bits - requires an adjustment in the high order bits. We need - to make this adjustment in two ways: once for the bits we - took from the data, and once for the bits we are putting - back in to the data. */ - if ((vallo & 0x8000) != 0) - val -= 0x10000; - if ((val & 0x8000) != 0) - val += 0x10000; - - insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (abfd, insn, l->addr); - - if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0) - { - gp_disp_relent = *reloc_entry; - reloc_entry = &gp_disp_relent; - reloc_entry->addend = l->addend; - } - - next = l->next; - free (l); - l = next; - } - - mips_hi16_list = NULL; - } - else if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0) - { - bfd_reloc_status_type ret; - bfd_vma gp, relocation; - - /* FIXME: Does this case ever occur? */ - - ret = mips_elf_final_gp (output_bfd, symbol, true, error_message, &gp); - if (ret != bfd_reloc_ok) - return ret; - - relocation = gp - reloc_entry->address; - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - gp_disp_relent = *reloc_entry; - reloc_entry = &gp_disp_relent; - reloc_entry->addend = relocation - 4; - } - - /* Now do the LO16 reloc in the usual way. */ - return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); -} - -/* Do a R_MIPS_GOT16 reloc. This is a reloc against the global offset - table used for PIC code. If the symbol is an external symbol, the - instruction is modified to contain the offset of the appropriate - entry in the global offset table. If the symbol is a section - symbol, the next reloc is a R_MIPS_LO16 reloc. The two 16 bit - addends are combined to form the real addend against the section - symbol; the GOT16 is modified to contain the offset of an entry in - the global offset table, and the LO16 is modified to offset it - appropriately. Thus an offset larger than 16 bits requires a - modified value in the global offset table. - - This implementation suffices for the assembler, but the linker does - not yet know how to create global offset tables. */ - -bfd_reloc_status_type -_bfd_mips_elf_got16_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - /* If we're relocating, and this an external symbol, we don't want - to change anything. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* If we're relocating, and this is a local symbol, we can handle it - just like HI16. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) != 0) - return _bfd_mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); - - abort (); -} - -/* Set the GP value for OUTPUT_BFD. Returns false if this is a - dangerous relocation. */ - -static boolean -mips_elf_assign_gp (output_bfd, pgp) - bfd *output_bfd; - bfd_vma *pgp; -{ - unsigned int count; - asymbol **sym; - unsigned int i; - - /* If we've already figured out what GP will be, just return it. */ - *pgp = _bfd_get_gp_value (output_bfd); - if (*pgp) - return true; - - count = bfd_get_symcount (output_bfd); - sym = bfd_get_outsymbols (output_bfd); - - /* The linker script will have created a symbol named `_gp' with the - appropriate value. */ - if (sym == (asymbol **) NULL) - i = count; - else - { - for (i = 0; i < count; i++, sym++) - { - register CONST char *name; - - name = bfd_asymbol_name (*sym); - if (*name == '_' && strcmp (name, "_gp") == 0) - { - *pgp = bfd_asymbol_value (*sym); - _bfd_set_gp_value (output_bfd, *pgp); - break; - } - } - } - - if (i >= count) - { - /* Only get the error once. */ - *pgp = 4; - _bfd_set_gp_value (output_bfd, *pgp); - return false; - } - - return true; -} - -/* We have to figure out the gp value, so that we can adjust the - symbol value correctly. We look up the symbol _gp in the output - BFD. If we can't find it, we're stuck. We cache it in the ELF - target data. We don't need to adjust the symbol value for an - external symbol if we are producing relocateable output. */ - -static bfd_reloc_status_type -mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, pgp) - bfd *output_bfd; - asymbol *symbol; - boolean relocateable; - char **error_message; - bfd_vma *pgp; -{ - if (bfd_is_und_section (symbol->section) - && ! relocateable) - { - *pgp = 0; - return bfd_reloc_undefined; - } - - *pgp = _bfd_get_gp_value (output_bfd); - if (*pgp == 0 - && (! relocateable - || (symbol->flags & BSF_SECTION_SYM) != 0)) - { - if (relocateable) - { - /* Make up a value. */ - *pgp = symbol->section->output_section->vma + 0x4000; - _bfd_set_gp_value (output_bfd, *pgp); - } - else if (!mips_elf_assign_gp (output_bfd, pgp)) - { - *error_message = - (char *) _("GP relative relocation when _gp not defined"); - return bfd_reloc_dangerous; - } - } - - return bfd_reloc_ok; -} - -/* Do a R_MIPS_GPREL16 relocation. This is a 16 bit value which must - become the offset from the gp register. This function also handles - R_MIPS_LITERAL relocations, although those can be handled more - cleverly because the entries in the .lit8 and .lit4 sections can be - merged. */ - -static bfd_reloc_status_type gprel16_with_gp PARAMS ((bfd *, asymbol *, - arelent *, asection *, - boolean, PTR, bfd_vma)); - -bfd_reloc_status_type -_bfd_mips_elf_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - boolean relocateable; - bfd_reloc_status_type ret; - bfd_vma gp; - - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ELF - file. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (output_bfd != (bfd *) NULL) - relocateable = true; - else - { - relocateable = false; - output_bfd = symbol->section->output_section->owner; - } - - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, - &gp); - if (ret != bfd_reloc_ok) - return ret; - - return gprel16_with_gp (abfd, symbol, reloc_entry, input_section, - relocateable, data, gp); -} - -static bfd_reloc_status_type -gprel16_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data, - gp) - bfd *abfd; - asymbol *symbol; - arelent *reloc_entry; - asection *input_section; - boolean relocateable; - PTR data; - bfd_vma gp; -{ - bfd_vma relocation; - unsigned long insn; - unsigned long val; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - - /* Set val to the offset into the section or symbol. */ - if (reloc_entry->howto->src_mask == 0) - { - /* This case occurs with the 64-bit MIPS ELF ABI. */ - val = reloc_entry->addend; - } - else - { - val = ((insn & 0xffff) + reloc_entry->addend) & 0xffff; - if (val & 0x8000) - val -= 0x10000; - } - - /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for - an external symbol. */ - if (! relocateable - || (symbol->flags & BSF_SECTION_SYM) != 0) - val += relocation - gp; - - insn = (insn &~ 0xffff) | (val & 0xffff); - bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); - - if (relocateable) - reloc_entry->address += input_section->output_offset; - - /* Make sure it fit in 16 bits. */ - if (val >= 0x8000 && val < 0xffff8000) - return bfd_reloc_overflow; - - return bfd_reloc_ok; -} - -/* Do a R_MIPS_GPREL32 relocation. Is this 32 bit value the offset - from the gp register? XXX */ - -static bfd_reloc_status_type gprel32_with_gp PARAMS ((bfd *, asymbol *, - arelent *, asection *, - boolean, PTR, bfd_vma)); - -bfd_reloc_status_type -_bfd_mips_elf_gprel32_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - boolean relocateable; - bfd_reloc_status_type ret; - bfd_vma gp; - - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ELF - file. */ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - *error_message = (char *) - _("32bits gp relative relocation occurs for an external symbol"); - return bfd_reloc_outofrange; - } - - if (output_bfd != (bfd *) NULL) - { - relocateable = true; - gp = _bfd_get_gp_value (output_bfd); - } - else - { - relocateable = false; - output_bfd = symbol->section->output_section->owner; - - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, - error_message, &gp); - if (ret != bfd_reloc_ok) - return ret; - } - - return gprel32_with_gp (abfd, symbol, reloc_entry, input_section, - relocateable, data, gp); -} - -static bfd_reloc_status_type -gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data, - gp) - bfd *abfd; - asymbol *symbol; - arelent *reloc_entry; - asection *input_section; - boolean relocateable; - PTR data; - bfd_vma gp; -{ - bfd_vma relocation; - unsigned long val; - - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - if (reloc_entry->howto->src_mask == 0) - { - /* This case arises with the 64-bit MIPS ELF ABI. */ - val = 0; - } - else - val = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - - /* Set val to the offset into the section or symbol. */ - val += reloc_entry->addend; - - /* Adjust val for the final section location and GP value. If we - are producing relocateable output, we don't want to do this for - an external symbol. */ - if (! relocateable - || (symbol->flags & BSF_SECTION_SYM) != 0) - val += relocation - gp; - - bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address); - - if (relocateable) - reloc_entry->address += input_section->output_offset; - - return bfd_reloc_ok; -} - -/* Handle a 64 bit reloc in a 32 bit MIPS ELF file. These are - generated when addreses are 64 bits. The upper 32 bits are a simle - sign extension. */ - -static bfd_reloc_status_type -mips32_64bit_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - bfd_reloc_status_type r; - arelent reloc32; - unsigned long val; - bfd_size_type addr; - - r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); - if (r != bfd_reloc_continue) - return r; - - /* Do a normal 32 bit relocation on the lower 32 bits. */ - reloc32 = *reloc_entry; - if (bfd_big_endian (abfd)) - reloc32.address += 4; - reloc32.howto = &elf_mips_howto_table[R_MIPS_32]; - r = bfd_perform_relocation (abfd, &reloc32, data, input_section, - output_bfd, error_message); - - /* Sign extend into the upper 32 bits. */ - val = bfd_get_32 (abfd, (bfd_byte *) data + reloc32.address); - if ((val & 0x80000000) != 0) - val = 0xffffffff; - else - val = 0; - addr = reloc_entry->address; - if (bfd_little_endian (abfd)) - addr += 4; - bfd_put_32 (abfd, val, (bfd_byte *) data + addr); - - return r; -} - -/* Handle a mips16 jump. */ - -static bfd_reloc_status_type -mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* FIXME. */ - { - static boolean warned; - - if (! warned) - (*_bfd_error_handler) - (_("Linking mips16 objects into %s format is not supported"), - bfd_get_target (input_section->output_section->owner)); - warned = true; - } - - return bfd_reloc_undefined; -} - -/* Handle a mips16 GP relative reloc. */ - -static bfd_reloc_status_type -mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - boolean relocateable; - bfd_reloc_status_type ret; - bfd_vma gp; - unsigned short extend, insn; - unsigned long final; - - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. We will only have an - addend if this is a newly created reloc, not read from an ELF - file. */ - if (output_bfd != NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && reloc_entry->addend == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (output_bfd != NULL) - relocateable = true; - else - { - relocateable = false; - output_bfd = symbol->section->output_section->owner; - } - - ret = mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, - &gp); - if (ret != bfd_reloc_ok) - return ret; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* Pick up the mips16 extend instruction and the real instruction. */ - extend = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); - insn = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address + 2); - - /* Stuff the current addend back as a 32 bit value, do the usual - relocation, and then clean up. */ - bfd_put_32 (abfd, - (((extend & 0x1f) << 11) - | (extend & 0x7e0) - | (insn & 0x1f)), - (bfd_byte *) data + reloc_entry->address); - - ret = gprel16_with_gp (abfd, symbol, reloc_entry, input_section, - relocateable, data, gp); - - final = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, - ((extend & 0xf800) - | ((final >> 11) & 0x1f) - | (final & 0x7e0)), - (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, - ((insn & 0xffe0) - | (final & 0x1f)), - (bfd_byte *) data + reloc_entry->address + 2); - - return ret; -} - -/* Return the ISA for a MIPS e_flags value. */ - -static INLINE int -elf_mips_isa (flags) - flagword flags; -{ - switch (flags & EF_MIPS_ARCH) - { - case E_MIPS_ARCH_1: - return 1; - case E_MIPS_ARCH_2: - return 2; - case E_MIPS_ARCH_3: - return 3; - case E_MIPS_ARCH_4: - return 4; - } - return 4; -} - -/* Return the MACH for a MIPS e_flags value. */ - -static INLINE int -elf_mips_mach (flags) - flagword flags; -{ - switch (flags & EF_MIPS_MACH) - { - case E_MIPS_MACH_3900: - return bfd_mach_mips3900; - - case E_MIPS_MACH_4010: - return bfd_mach_mips4010; - - case E_MIPS_MACH_4100: - return bfd_mach_mips4100; - - case E_MIPS_MACH_4111: - return bfd_mach_mips4111; - - case E_MIPS_MACH_4650: - return bfd_mach_mips4650; - - default: - switch (flags & EF_MIPS_ARCH) - { - default: - case E_MIPS_ARCH_1: - return bfd_mach_mips3000; - break; - - case E_MIPS_ARCH_2: - return bfd_mach_mips6000; - break; - - case E_MIPS_ARCH_3: - return bfd_mach_mips4000; - break; - - case E_MIPS_ARCH_4: - return bfd_mach_mips8000; - break; - } - } - - return 0; -} - -/* Return printable name for ABI. */ - -static INLINE char* -elf_mips_abi_name (abfd) - bfd *abfd; -{ - flagword flags; - - if (ABI_N32_P (abfd)) - return "N32"; - else if (ABI_64_P (abfd)) - return "64"; - - flags = elf_elfheader (abfd)->e_flags; - switch (flags & EF_MIPS_ABI) - { - case 0: - return "none"; - case E_MIPS_ABI_O32: - return "O32"; - case E_MIPS_ABI_O64: - return "O64"; - case E_MIPS_ABI_EABI32: - return "EABI32"; - case E_MIPS_ABI_EABI64: - return "EABI64"; - default: - return "unknown abi"; - } -} - -/* A mapping from BFD reloc types to MIPS ELF reloc types. */ - -struct elf_reloc_map { - bfd_reloc_code_real_type bfd_reloc_val; - enum elf_mips_reloc_type elf_reloc_val; -}; - -static CONST struct elf_reloc_map mips_reloc_map[] = -{ - { BFD_RELOC_NONE, R_MIPS_NONE, }, - { BFD_RELOC_16, R_MIPS_16 }, - { BFD_RELOC_32, R_MIPS_32 }, - { BFD_RELOC_64, R_MIPS_64 }, - { BFD_RELOC_MIPS_JMP, R_MIPS_26 }, - { BFD_RELOC_HI16_S, R_MIPS_HI16 }, - { BFD_RELOC_LO16, R_MIPS_LO16 }, - { BFD_RELOC_MIPS_GPREL, R_MIPS_GPREL16 }, - { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL }, - { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 }, - { BFD_RELOC_16_PCREL, R_MIPS_PC16 }, - { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 }, - { BFD_RELOC_MIPS_GPREL32, R_MIPS_GPREL32 }, - { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 }, - { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 }, - { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 }, - { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 }, - { BFD_RELOC_MIPS_SUB, R_MIPS_SUB }, - { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE }, - { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST }, - { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP } -}; - -/* Given a BFD reloc type, return a howto structure. */ - -static reloc_howto_type * -bfd_elf32_bfd_reloc_type_lookup (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; -{ - unsigned int i; - - for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); i++) - { - if (mips_reloc_map[i].bfd_reloc_val == code) - return &elf_mips_howto_table[(int) mips_reloc_map[i].elf_reloc_val]; - } - - switch (code) - { - default: - bfd_set_error (bfd_error_bad_value); - return NULL; - - case BFD_RELOC_CTOR: - /* We need to handle BFD_RELOC_CTOR specially. - Select the right relocation (R_MIPS_32 or R_MIPS_64) based on the - size of addresses on this architecture. */ - if (bfd_arch_bits_per_address (abfd) == 32) - return &elf_mips_howto_table[(int) R_MIPS_32]; - else - return &elf_mips_ctor64_howto; - - case BFD_RELOC_MIPS16_JMP: - return &elf_mips16_jump_howto; - case BFD_RELOC_MIPS16_GPREL: - return &elf_mips16_gprel_howto; - case BFD_RELOC_VTABLE_INHERIT: - return &elf_mips_gnu_vtinherit_howto; - case BFD_RELOC_VTABLE_ENTRY: - return &elf_mips_gnu_vtentry_howto; - case BFD_RELOC_PCREL_HI16_S: - return &elf_mips_gnu_rel_hi16; - case BFD_RELOC_PCREL_LO16: - return &elf_mips_gnu_rel_lo16; - case BFD_RELOC_16_PCREL_S2: - return &elf_mips_gnu_rel16_s2; - case BFD_RELOC_64_PCREL: - return &elf_mips_gnu_pcrel64; - case BFD_RELOC_32_PCREL: - return &elf_mips_gnu_pcrel32; - } -} - -/* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure. */ - -static reloc_howto_type * -mips_rtype_to_howto (r_type) - unsigned int r_type; -{ - switch (r_type) - { - case R_MIPS16_26: - return &elf_mips16_jump_howto; - break; - case R_MIPS16_GPREL: - return &elf_mips16_gprel_howto; - break; - case R_MIPS_GNU_VTINHERIT: - return &elf_mips_gnu_vtinherit_howto; - break; - case R_MIPS_GNU_VTENTRY: - return &elf_mips_gnu_vtentry_howto; - break; - case R_MIPS_GNU_REL_HI16: - return &elf_mips_gnu_rel_hi16; - break; - case R_MIPS_GNU_REL_LO16: - return &elf_mips_gnu_rel_lo16; - break; - case R_MIPS_GNU_REL16_S2: - return &elf_mips_gnu_rel16_s2; - break; - case R_MIPS_PC64: - return &elf_mips_gnu_pcrel64; - break; - case R_MIPS_PC32: - return &elf_mips_gnu_pcrel32; - break; - - default: - BFD_ASSERT (r_type < (unsigned int) R_MIPS_max); - return &elf_mips_howto_table[r_type]; - break; - } -} - -/* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure. */ - -static void -mips_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf32_Internal_Rel *dst; -{ - unsigned int r_type; - - r_type = ELF32_R_TYPE (dst->r_info); - cache_ptr->howto = mips_rtype_to_howto (r_type); - - /* The addend for a GPREL16 or LITERAL relocation comes from the GP - value for the object file. We get the addend now, rather than - when we do the relocation, because the symbol manipulations done - by the linker may cause us to lose track of the input BFD. */ - if (((*cache_ptr->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0 - && (r_type == (unsigned int) R_MIPS_GPREL16 - || r_type == (unsigned int) R_MIPS_LITERAL)) - cache_ptr->addend = elf_gp (abfd); -} - -/* Given a MIPS Elf32_Internal_Rela, fill in an arelent structure. */ - -static void -mips_info_to_howto_rela (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf32_Internal_Rela *dst; -{ - /* Since an Elf32_Internal_Rel is an initial prefix of an - Elf32_Internal_Rela, we can just use mips_info_to_howto_rel - above. */ - mips_info_to_howto_rel (abfd, cache_ptr, (Elf32_Internal_Rel *) dst); - - /* If we ever need to do any extra processing with dst->r_addend - (the field omitted in an Elf32_Internal_Rel) we can do it here. */ -} - -/* A .reginfo section holds a single Elf32_RegInfo structure. These - routines swap this structure in and out. They are used outside of - BFD, so they are globally visible. */ - -void -bfd_mips_elf32_swap_reginfo_in (abfd, ex, in) - bfd *abfd; - const Elf32_External_RegInfo *ex; - Elf32_RegInfo *in; -{ - in->ri_gprmask = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_gprmask); - in->ri_cprmask[0] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[0]); - in->ri_cprmask[1] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[1]); - in->ri_cprmask[2] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[2]); - in->ri_cprmask[3] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[3]); - in->ri_gp_value = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_gp_value); -} - -void -bfd_mips_elf32_swap_reginfo_out (abfd, in, ex) - bfd *abfd; - const Elf32_RegInfo *in; - Elf32_External_RegInfo *ex; -{ - bfd_h_put_32 (abfd, (bfd_vma) in->ri_gprmask, - (bfd_byte *) ex->ri_gprmask); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[0], - (bfd_byte *) ex->ri_cprmask[0]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[1], - (bfd_byte *) ex->ri_cprmask[1]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[2], - (bfd_byte *) ex->ri_cprmask[2]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[3], - (bfd_byte *) ex->ri_cprmask[3]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_gp_value, - (bfd_byte *) ex->ri_gp_value); -} - -/* In the 64 bit ABI, the .MIPS.options section holds register - information in an Elf64_Reginfo structure. These routines swap - them in and out. They are globally visible because they are used - outside of BFD. These routines are here so that gas can call them - without worrying about whether the 64 bit ABI has been included. */ - -void -bfd_mips_elf64_swap_reginfo_in (abfd, ex, in) - bfd *abfd; - const Elf64_External_RegInfo *ex; - Elf64_Internal_RegInfo *in; -{ - in->ri_gprmask = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_gprmask); - in->ri_pad = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_pad); - in->ri_cprmask[0] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[0]); - in->ri_cprmask[1] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[1]); - in->ri_cprmask[2] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[2]); - in->ri_cprmask[3] = bfd_h_get_32 (abfd, (bfd_byte *) ex->ri_cprmask[3]); - in->ri_gp_value = bfd_h_get_64 (abfd, (bfd_byte *) ex->ri_gp_value); -} - -void -bfd_mips_elf64_swap_reginfo_out (abfd, in, ex) - bfd *abfd; - const Elf64_Internal_RegInfo *in; - Elf64_External_RegInfo *ex; -{ - bfd_h_put_32 (abfd, (bfd_vma) in->ri_gprmask, - (bfd_byte *) ex->ri_gprmask); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_pad, - (bfd_byte *) ex->ri_pad); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[0], - (bfd_byte *) ex->ri_cprmask[0]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[1], - (bfd_byte *) ex->ri_cprmask[1]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[2], - (bfd_byte *) ex->ri_cprmask[2]); - bfd_h_put_32 (abfd, (bfd_vma) in->ri_cprmask[3], - (bfd_byte *) ex->ri_cprmask[3]); - bfd_h_put_64 (abfd, (bfd_vma) in->ri_gp_value, - (bfd_byte *) ex->ri_gp_value); -} - -/* Swap an entry in a .gptab section. Note that these routines rely - on the equivalence of the two elements of the union. */ - -static void -bfd_mips_elf32_swap_gptab_in (abfd, ex, in) - bfd *abfd; - const Elf32_External_gptab *ex; - Elf32_gptab *in; -{ - in->gt_entry.gt_g_value = bfd_h_get_32 (abfd, ex->gt_entry.gt_g_value); - in->gt_entry.gt_bytes = bfd_h_get_32 (abfd, ex->gt_entry.gt_bytes); -} - -static void -bfd_mips_elf32_swap_gptab_out (abfd, in, ex) - bfd *abfd; - const Elf32_gptab *in; - Elf32_External_gptab *ex; -{ - bfd_h_put_32 (abfd, (bfd_vma) in->gt_entry.gt_g_value, - ex->gt_entry.gt_g_value); - bfd_h_put_32 (abfd, (bfd_vma) in->gt_entry.gt_bytes, - ex->gt_entry.gt_bytes); -} - -static void -bfd_elf32_swap_compact_rel_out (abfd, in, ex) - bfd *abfd; - const Elf32_compact_rel *in; - Elf32_External_compact_rel *ex; -{ - bfd_h_put_32 (abfd, (bfd_vma) in->id1, ex->id1); - bfd_h_put_32 (abfd, (bfd_vma) in->num, ex->num); - bfd_h_put_32 (abfd, (bfd_vma) in->id2, ex->id2); - bfd_h_put_32 (abfd, (bfd_vma) in->offset, ex->offset); - bfd_h_put_32 (abfd, (bfd_vma) in->reserved0, ex->reserved0); - bfd_h_put_32 (abfd, (bfd_vma) in->reserved1, ex->reserved1); -} - -static void -bfd_elf32_swap_crinfo_out (abfd, in, ex) - bfd *abfd; - const Elf32_crinfo *in; - Elf32_External_crinfo *ex; -{ - unsigned long l; - - l = (((in->ctype & CRINFO_CTYPE) << CRINFO_CTYPE_SH) - | ((in->rtype & CRINFO_RTYPE) << CRINFO_RTYPE_SH) - | ((in->dist2to & CRINFO_DIST2TO) << CRINFO_DIST2TO_SH) - | ((in->relvaddr & CRINFO_RELVADDR) << CRINFO_RELVADDR_SH)); - bfd_h_put_32 (abfd, (bfd_vma) l, ex->info); - bfd_h_put_32 (abfd, (bfd_vma) in->konst, ex->konst); - bfd_h_put_32 (abfd, (bfd_vma) in->vaddr, ex->vaddr); -} - -/* Swap in an options header. */ - -void -bfd_mips_elf_swap_options_in (abfd, ex, in) - bfd *abfd; - const Elf_External_Options *ex; - Elf_Internal_Options *in; -{ - in->kind = bfd_h_get_8 (abfd, ex->kind); - in->size = bfd_h_get_8 (abfd, ex->size); - in->section = bfd_h_get_16 (abfd, ex->section); - in->info = bfd_h_get_32 (abfd, ex->info); -} - -/* Swap out an options header. */ - -void -bfd_mips_elf_swap_options_out (abfd, in, ex) - bfd *abfd; - const Elf_Internal_Options *in; - Elf_External_Options *ex; -{ - bfd_h_put_8 (abfd, in->kind, ex->kind); - bfd_h_put_8 (abfd, in->size, ex->size); - bfd_h_put_16 (abfd, in->section, ex->section); - bfd_h_put_32 (abfd, in->info, ex->info); -} -#if 0 -/* Swap in an MSYM entry. */ - -static void -bfd_mips_elf_swap_msym_in (abfd, ex, in) - bfd *abfd; - const Elf32_External_Msym *ex; - Elf32_Internal_Msym *in; -{ - in->ms_hash_value = bfd_h_get_32 (abfd, ex->ms_hash_value); - in->ms_info = bfd_h_get_32 (abfd, ex->ms_info); -} -#endif -/* Swap out an MSYM entry. */ - -static void -bfd_mips_elf_swap_msym_out (abfd, in, ex) - bfd *abfd; - const Elf32_Internal_Msym *in; - Elf32_External_Msym *ex; -{ - bfd_h_put_32 (abfd, in->ms_hash_value, ex->ms_hash_value); - bfd_h_put_32 (abfd, in->ms_info, ex->ms_info); -} - - -/* Determine whether a symbol is global for the purposes of splitting - the symbol table into global symbols and local symbols. At least - on Irix 5, this split must be between section symbols and all other - symbols. On most ELF targets the split is between static symbols - and externally visible symbols. */ - -/*ARGSUSED*/ -static boolean -mips_elf_sym_is_global (abfd, sym) - bfd *abfd ATTRIBUTE_UNUSED; - asymbol *sym; -{ - return (sym->flags & BSF_SECTION_SYM) == 0 ? true : false; -} - -/* Set the right machine number for a MIPS ELF file. This is used for - both the 32-bit and the 64-bit ABI. */ - -boolean -_bfd_mips_elf_object_p (abfd) - bfd *abfd; -{ - /* Irix 5 and 6 is broken. Object file symbol tables are not always - sorted correctly such that local symbols precede global symbols, - and the sh_info field in the symbol table is not always right. */ - elf_bad_symtab (abfd) = true; - - bfd_default_set_arch_mach (abfd, bfd_arch_mips, - elf_mips_mach (elf_elfheader (abfd)->e_flags)); - return true; -} - -/* The final processing done just before writing out a MIPS ELF object - file. This gets the MIPS architecture right based on the machine - number. This is used by both the 32-bit and the 64-bit ABI. */ - -/*ARGSUSED*/ -void -_bfd_mips_elf_final_write_processing (abfd, linker) - bfd *abfd; - boolean linker ATTRIBUTE_UNUSED; -{ - unsigned long val; - unsigned int i; - Elf_Internal_Shdr **hdrpp; - const char *name; - asection *sec; - - switch (bfd_get_mach (abfd)) - { - default: - case bfd_mach_mips3000: - val = E_MIPS_ARCH_1; - break; - - case bfd_mach_mips3900: - val = E_MIPS_ARCH_1 | E_MIPS_MACH_3900; - break; - - case bfd_mach_mips6000: - val = E_MIPS_ARCH_2; - break; - - case bfd_mach_mips4000: - case bfd_mach_mips4300: - val = E_MIPS_ARCH_3; - break; - - case bfd_mach_mips4010: - val = E_MIPS_ARCH_3 | E_MIPS_MACH_4010; - break; - - case bfd_mach_mips4100: - val = E_MIPS_ARCH_3 | E_MIPS_MACH_4100; - break; - - case bfd_mach_mips4111: - val = E_MIPS_ARCH_3 | E_MIPS_MACH_4111; - break; - - case bfd_mach_mips4650: - val = E_MIPS_ARCH_3 | E_MIPS_MACH_4650; - break; - - case bfd_mach_mips8000: - val = E_MIPS_ARCH_4; - break; - } - - elf_elfheader (abfd)->e_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH); - elf_elfheader (abfd)->e_flags |= val; - - /* Set the sh_info field for .gptab sections and other appropriate - info for each special section. */ - for (i = 1, hdrpp = elf_elfsections (abfd) + 1; - i < elf_elfheader (abfd)->e_shnum; - i++, hdrpp++) - { - switch ((*hdrpp)->sh_type) - { - case SHT_MIPS_MSYM: - case SHT_MIPS_LIBLIST: - sec = bfd_get_section_by_name (abfd, ".dynstr"); - if (sec != NULL) - (*hdrpp)->sh_link = elf_section_data (sec)->this_idx; - break; - - case SHT_MIPS_GPTAB: - BFD_ASSERT ((*hdrpp)->bfd_section != NULL); - name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); - BFD_ASSERT (name != NULL - && strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0); - sec = bfd_get_section_by_name (abfd, name + sizeof ".gptab" - 1); - BFD_ASSERT (sec != NULL); - (*hdrpp)->sh_info = elf_section_data (sec)->this_idx; - break; - - case SHT_MIPS_CONTENT: - BFD_ASSERT ((*hdrpp)->bfd_section != NULL); - name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); - BFD_ASSERT (name != NULL - && strncmp (name, ".MIPS.content", - sizeof ".MIPS.content" - 1) == 0); - sec = bfd_get_section_by_name (abfd, - name + sizeof ".MIPS.content" - 1); - BFD_ASSERT (sec != NULL); - (*hdrpp)->sh_link = elf_section_data (sec)->this_idx; - break; - - case SHT_MIPS_SYMBOL_LIB: - sec = bfd_get_section_by_name (abfd, ".dynsym"); - if (sec != NULL) - (*hdrpp)->sh_link = elf_section_data (sec)->this_idx; - sec = bfd_get_section_by_name (abfd, ".liblist"); - if (sec != NULL) - (*hdrpp)->sh_info = elf_section_data (sec)->this_idx; - break; - - case SHT_MIPS_EVENTS: - BFD_ASSERT ((*hdrpp)->bfd_section != NULL); - name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); - BFD_ASSERT (name != NULL); - if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0) - sec = bfd_get_section_by_name (abfd, - name + sizeof ".MIPS.events" - 1); - else - { - BFD_ASSERT (strncmp (name, ".MIPS.post_rel", - sizeof ".MIPS.post_rel" - 1) == 0); - sec = bfd_get_section_by_name (abfd, - (name - + sizeof ".MIPS.post_rel" - 1)); - } - BFD_ASSERT (sec != NULL); - (*hdrpp)->sh_link = elf_section_data (sec)->this_idx; - break; - - } - } -} - -/* Function to keep MIPS specific file flags like as EF_MIPS_PIC. */ - -boolean -_bfd_mips_elf_set_private_flags (abfd, flags) - bfd *abfd; - flagword flags; -{ - BFD_ASSERT (!elf_flags_init (abfd) - || elf_elfheader (abfd)->e_flags == flags); - - elf_elfheader (abfd)->e_flags = flags; - elf_flags_init (abfd) = true; - return true; -} - -/* Copy backend specific data from one object module to another */ - -boolean -_bfd_mips_elf_copy_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; -{ - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return true; - - BFD_ASSERT (!elf_flags_init (obfd) - || (elf_elfheader (obfd)->e_flags - == elf_elfheader (ibfd)->e_flags)); - - elf_gp (obfd) = elf_gp (ibfd); - elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags; - elf_flags_init (obfd) = true; - return true; -} - -/* Merge backend specific data from an object file to the output - object file when linking. */ - -boolean -_bfd_mips_elf_merge_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; -{ - flagword old_flags; - flagword new_flags; - boolean ok; - - /* Check if we have the same endianess */ - if (ibfd->xvec->byteorder != obfd->xvec->byteorder - && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN) - { - const char *msg; - - if (bfd_big_endian (ibfd)) - msg = _("%s: compiled for a big endian system and target is little endian"); - else - msg = _("%s: compiled for a little endian system and target is big endian"); - - (*_bfd_error_handler) (msg, bfd_get_filename (ibfd)); - - bfd_set_error (bfd_error_wrong_format); - return false; - } - - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return true; - - new_flags = elf_elfheader (ibfd)->e_flags; - elf_elfheader (obfd)->e_flags |= new_flags & EF_MIPS_NOREORDER; - old_flags = elf_elfheader (obfd)->e_flags; - - if (! elf_flags_init (obfd)) - { - elf_flags_init (obfd) = true; - elf_elfheader (obfd)->e_flags = new_flags; - elf_elfheader (obfd)->e_ident[EI_CLASS] - = elf_elfheader (ibfd)->e_ident[EI_CLASS]; - - if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) - && bfd_get_arch_info (obfd)->the_default) - { - if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), - bfd_get_mach (ibfd))) - return false; - } - - return true; - } - - /* Check flag compatibility. */ - - new_flags &= ~EF_MIPS_NOREORDER; - old_flags &= ~EF_MIPS_NOREORDER; - - if (new_flags == old_flags) - return true; - - ok = true; - - if ((new_flags & EF_MIPS_PIC) != (old_flags & EF_MIPS_PIC)) - { - new_flags &= ~EF_MIPS_PIC; - old_flags &= ~EF_MIPS_PIC; - (*_bfd_error_handler) - (_("%s: linking PIC files with non-PIC files"), - bfd_get_filename (ibfd)); - ok = false; - } - - if ((new_flags & EF_MIPS_CPIC) != (old_flags & EF_MIPS_CPIC)) - { - new_flags &= ~EF_MIPS_CPIC; - old_flags &= ~EF_MIPS_CPIC; - (*_bfd_error_handler) - (_("%s: linking abicalls files with non-abicalls files"), - bfd_get_filename (ibfd)); - ok = false; - } - - /* Compare the ISA's. */ - if ((new_flags & (EF_MIPS_ARCH | EF_MIPS_MACH)) - != (old_flags & (EF_MIPS_ARCH | EF_MIPS_MACH))) - { - int new_mach = new_flags & EF_MIPS_MACH; - int old_mach = old_flags & EF_MIPS_MACH; - int new_isa = elf_mips_isa (new_flags); - int old_isa = elf_mips_isa (old_flags); - - /* If either has no machine specified, just compare the general isa's. - Some combinations of machines are ok, if the isa's match. */ - if (! new_mach - || ! old_mach - || new_mach == old_mach - ) - { - /* Don't warn about mixing -mips1 and -mips2 code, or mixing -mips3 - and -mips4 code. They will normally use the same data sizes and - calling conventions. */ - - if ((new_isa == 1 || new_isa == 2) - ? (old_isa != 1 && old_isa != 2) - : (old_isa == 1 || old_isa == 2)) - { - (*_bfd_error_handler) - (_("%s: ISA mismatch (-mips%d) with previous modules (-mips%d)"), - bfd_get_filename (ibfd), new_isa, old_isa); - ok = false; - } - } - - else - { - (*_bfd_error_handler) - (_("%s: ISA mismatch (%d) with previous modules (%d)"), - bfd_get_filename (ibfd), - elf_mips_mach (new_flags), - elf_mips_mach (old_flags)); - ok = false; - } - - new_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH); - old_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH); - } - - /* Compare ABI's. The 64-bit ABI does not use EF_MIPS_ABI. But, it - does set EI_CLASS differently from any 32-bit ABI. */ - if ((new_flags & EF_MIPS_ABI) != (old_flags & EF_MIPS_ABI) - || (elf_elfheader (ibfd)->e_ident[EI_CLASS] - != elf_elfheader (obfd)->e_ident[EI_CLASS])) - { - /* Only error if both are set (to different values). */ - if (((new_flags & EF_MIPS_ABI) && (old_flags & EF_MIPS_ABI)) - || (elf_elfheader (ibfd)->e_ident[EI_CLASS] - != elf_elfheader (obfd)->e_ident[EI_CLASS])) - { - (*_bfd_error_handler) - (_("%s: ABI mismatch: linking %s module with previous %s modules"), - bfd_get_filename (ibfd), - elf_mips_abi_name (ibfd), - elf_mips_abi_name (obfd)); - ok = false; - } - new_flags &= ~EF_MIPS_ABI; - old_flags &= ~EF_MIPS_ABI; - } - - /* Warn about any other mismatches */ - if (new_flags != old_flags) - { - (*_bfd_error_handler) - (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), - bfd_get_filename (ibfd), (unsigned long) new_flags, - (unsigned long) old_flags); - ok = false; - } - - if (! ok) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - return true; -} - -boolean -_bfd_mips_elf_print_private_bfd_data (abfd, ptr) - bfd *abfd; - PTR ptr; -{ - FILE *file = (FILE *) ptr; - - BFD_ASSERT (abfd != NULL && ptr != NULL); - - /* Print normal ELF private data. */ - _bfd_elf_print_private_bfd_data (abfd, ptr); - - /* xgettext:c-format */ - fprintf (file, _ ("private flags = %lx:"), elf_elfheader (abfd)->e_flags); - - if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_O32) - fprintf (file, _ (" [abi=O32]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_O64) - fprintf (file, _ (" [abi=O64]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI32) - fprintf (file, _ (" [abi=EABI32]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI64) - fprintf (file, _ (" [abi=EABI64]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI)) - fprintf (file, _ (" [abi unknown]")); - else if (ABI_N32_P (abfd)) - fprintf (file, _ (" [abi=N32]")); - else if (ABI_64_P (abfd)) - fprintf (file, _ (" [abi=64]")); - else - fprintf (file, _ (" [no abi set]")); - - if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_1) - fprintf (file, _ (" [mips1]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_2) - fprintf (file, _ (" [mips2]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_3) - fprintf (file, _ (" [mips3]")); - else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_4) - fprintf (file, _ (" [mips4]")); - else - fprintf (file, _ (" [unknown ISA]")); - - if (elf_elfheader (abfd)->e_flags & EF_MIPS_32BITMODE) - fprintf (file, _ (" [32bitmode]")); - else - fprintf (file, _ (" [not 32bitmode]")); - - fputc ('\n', file); - - return true; -} - -/* Handle a MIPS specific section when reading an object file. This - is called when elfcode.h finds a section with an unknown type. - This routine supports both the 32-bit and 64-bit ELF ABI. - - FIXME: We need to handle the SHF_MIPS_GPREL flag, but I'm not sure - how to. */ - -boolean -_bfd_mips_elf_section_from_shdr (abfd, hdr, name) - bfd *abfd; - Elf_Internal_Shdr *hdr; - char *name; -{ - flagword flags = 0; - - /* There ought to be a place to keep ELF backend specific flags, but - at the moment there isn't one. We just keep track of the - sections by their name, instead. Fortunately, the ABI gives - suggested names for all the MIPS specific sections, so we will - probably get away with this. */ - switch (hdr->sh_type) - { - case SHT_MIPS_LIBLIST: - if (strcmp (name, ".liblist") != 0) - return false; - break; - case SHT_MIPS_MSYM: - if (strcmp (name, MIPS_ELF_MSYM_SECTION_NAME (abfd)) != 0) - return false; - break; - case SHT_MIPS_CONFLICT: - if (strcmp (name, ".conflict") != 0) - return false; - break; - case SHT_MIPS_GPTAB: - if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) != 0) - return false; - break; - case SHT_MIPS_UCODE: - if (strcmp (name, ".ucode") != 0) - return false; - break; - case SHT_MIPS_DEBUG: - if (strcmp (name, ".mdebug") != 0) - return false; - flags = SEC_DEBUGGING; - break; - case SHT_MIPS_REGINFO: - if (strcmp (name, ".reginfo") != 0 - || hdr->sh_size != sizeof (Elf32_External_RegInfo)) - return false; - flags = (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_SIZE); - break; - case SHT_MIPS_IFACE: - if (strcmp (name, ".MIPS.interfaces") != 0) - return false; - break; - case SHT_MIPS_CONTENT: - if (strncmp (name, ".MIPS.content", sizeof ".MIPS.content" - 1) != 0) - return false; - break; - case SHT_MIPS_OPTIONS: - if (strcmp (name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) != 0) - return false; - break; - case SHT_MIPS_DWARF: - if (strncmp (name, ".debug_", sizeof ".debug_" - 1) != 0) - return false; - break; - case SHT_MIPS_SYMBOL_LIB: - if (strcmp (name, ".MIPS.symlib") != 0) - return false; - break; - case SHT_MIPS_EVENTS: - if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) != 0 - && strncmp (name, ".MIPS.post_rel", - sizeof ".MIPS.post_rel" - 1) != 0) - return false; - break; - default: - return false; - } - - if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) - return false; - - if (flags) - { - if (! bfd_set_section_flags (abfd, hdr->bfd_section, - (bfd_get_section_flags (abfd, - hdr->bfd_section) - | flags))) - return false; - } - - /* FIXME: We should record sh_info for a .gptab section. */ - - /* For a .reginfo section, set the gp value in the tdata information - from the contents of this section. We need the gp value while - processing relocs, so we just get it now. The .reginfo section - is not used in the 64-bit MIPS ELF ABI. */ - if (hdr->sh_type == SHT_MIPS_REGINFO) - { - Elf32_External_RegInfo ext; - Elf32_RegInfo s; - - if (! bfd_get_section_contents (abfd, hdr->bfd_section, (PTR) &ext, - (file_ptr) 0, sizeof ext)) - return false; - bfd_mips_elf32_swap_reginfo_in (abfd, &ext, &s); - elf_gp (abfd) = s.ri_gp_value; - } - - /* For a SHT_MIPS_OPTIONS section, look for a ODK_REGINFO entry, and - set the gp value based on what we find. We may see both - SHT_MIPS_REGINFO and SHT_MIPS_OPTIONS/ODK_REGINFO; in that case, - they should agree. */ - if (hdr->sh_type == SHT_MIPS_OPTIONS) - { - bfd_byte *contents, *l, *lend; - - contents = (bfd_byte *) bfd_malloc (hdr->sh_size); - if (contents == NULL) - return false; - if (! bfd_get_section_contents (abfd, hdr->bfd_section, contents, - (file_ptr) 0, hdr->sh_size)) - { - free (contents); - return false; - } - l = contents; - lend = contents + hdr->sh_size; - while (l + sizeof (Elf_External_Options) <= lend) - { - Elf_Internal_Options intopt; - - bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l, - &intopt); - if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO) - { - Elf64_Internal_RegInfo intreg; - - bfd_mips_elf64_swap_reginfo_in - (abfd, - ((Elf64_External_RegInfo *) - (l + sizeof (Elf_External_Options))), - &intreg); - elf_gp (abfd) = intreg.ri_gp_value; - } - else if (intopt.kind == ODK_REGINFO) - { - Elf32_RegInfo intreg; - - bfd_mips_elf32_swap_reginfo_in - (abfd, - ((Elf32_External_RegInfo *) - (l + sizeof (Elf_External_Options))), - &intreg); - elf_gp (abfd) = intreg.ri_gp_value; - } - l += intopt.size; - } - free (contents); - } - - return true; -} - -/* Set the correct type for a MIPS ELF section. We do this by the - section name, which is a hack, but ought to work. This routine is - used by both the 32-bit and the 64-bit ABI. */ - -boolean -_bfd_mips_elf_fake_sections (abfd, hdr, sec) - bfd *abfd; - Elf32_Internal_Shdr *hdr; - asection *sec; -{ - register const char *name; - - name = bfd_get_section_name (abfd, sec); - - if (strcmp (name, ".liblist") == 0) - { - hdr->sh_type = SHT_MIPS_LIBLIST; - hdr->sh_info = sec->_raw_size / sizeof (Elf32_Lib); - /* The sh_link field is set in final_write_processing. */ - } - else if (strcmp (name, ".conflict") == 0) - hdr->sh_type = SHT_MIPS_CONFLICT; - else if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0) - { - hdr->sh_type = SHT_MIPS_GPTAB; - hdr->sh_entsize = sizeof (Elf32_External_gptab); - /* The sh_info field is set in final_write_processing. */ - } - else if (strcmp (name, ".ucode") == 0) - hdr->sh_type = SHT_MIPS_UCODE; - else if (strcmp (name, ".mdebug") == 0) - { - hdr->sh_type = SHT_MIPS_DEBUG; - /* In a shared object on Irix 5.3, the .mdebug section has an - entsize of 0. FIXME: Does this matter? */ - if (SGI_COMPAT (abfd) && (abfd->flags & DYNAMIC) != 0) - hdr->sh_entsize = 0; - else - hdr->sh_entsize = 1; - } - else if (strcmp (name, ".reginfo") == 0) - { - hdr->sh_type = SHT_MIPS_REGINFO; - /* In a shared object on Irix 5.3, the .reginfo section has an - entsize of 0x18. FIXME: Does this matter? */ - if (SGI_COMPAT (abfd) && (abfd->flags & DYNAMIC) != 0) - hdr->sh_entsize = sizeof (Elf32_External_RegInfo); - else - hdr->sh_entsize = 1; - } - else if (SGI_COMPAT (abfd) - && (strcmp (name, ".hash") == 0 - || strcmp (name, ".dynamic") == 0 - || strcmp (name, ".dynstr") == 0)) - { - hdr->sh_entsize = 0; -#if 0 - /* This isn't how the Irix 6 linker behaves. */ - hdr->sh_info = SIZEOF_MIPS_DYNSYM_SECNAMES; -#endif - } - else if (strcmp (name, ".got") == 0 - || strcmp (name, MIPS_ELF_SRDATA_SECTION_NAME (abfd)) == 0 - || strcmp (name, ".sdata") == 0 - || strcmp (name, ".sbss") == 0 - || strcmp (name, ".lit4") == 0 - || strcmp (name, ".lit8") == 0) - hdr->sh_flags |= SHF_MIPS_GPREL; - else if (strcmp (name, ".MIPS.interfaces") == 0) - { - hdr->sh_type = SHT_MIPS_IFACE; - hdr->sh_flags |= SHF_MIPS_NOSTRIP; - } - else if (strncmp (name, ".MIPS.content", strlen (".MIPS.content")) == 0) - { - hdr->sh_type = SHT_MIPS_CONTENT; - hdr->sh_flags |= SHF_MIPS_NOSTRIP; - /* The sh_info field is set in final_write_processing. */ - } - else if (strcmp (name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0) - { - hdr->sh_type = SHT_MIPS_OPTIONS; - hdr->sh_entsize = 1; - hdr->sh_flags |= SHF_MIPS_NOSTRIP; - } - else if (strncmp (name, ".debug_", sizeof ".debug_" - 1) == 0) - hdr->sh_type = SHT_MIPS_DWARF; - else if (strcmp (name, ".MIPS.symlib") == 0) - { - hdr->sh_type = SHT_MIPS_SYMBOL_LIB; - /* The sh_link and sh_info fields are set in - final_write_processing. */ - } - else if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0 - || strncmp (name, ".MIPS.post_rel", - sizeof ".MIPS.post_rel" - 1) == 0) - { - hdr->sh_type = SHT_MIPS_EVENTS; - hdr->sh_flags |= SHF_MIPS_NOSTRIP; - /* The sh_link field is set in final_write_processing. */ - } - else if (strcmp (name, MIPS_ELF_MSYM_SECTION_NAME (abfd)) == 0) - { - hdr->sh_type = SHT_MIPS_MSYM; - hdr->sh_flags |= SHF_ALLOC; - hdr->sh_entsize = 8; - } - - /* The generic elf_fake_sections will set up REL_HDR using the - default kind of relocations. But, we may actually need both - kinds of relocations, so we set up the second header here. */ - if ((sec->flags & SEC_RELOC) != 0) - { - struct bfd_elf_section_data *esd; - - esd = elf_section_data (sec); - BFD_ASSERT (esd->rel_hdr2 == NULL); - esd->rel_hdr2 - = (Elf_Internal_Shdr *) bfd_zalloc (abfd, sizeof (Elf_Internal_Shdr)); - if (!esd->rel_hdr2) - return false; - _bfd_elf_init_reloc_shdr (abfd, esd->rel_hdr2, sec, - !elf_section_data (sec)->use_rela_p); - } - - return true; -} - -/* Given a BFD section, try to locate the corresponding ELF section - index. This is used by both the 32-bit and the 64-bit ABI. - Actually, it's not clear to me that the 64-bit ABI supports these, - but for non-PIC objects we will certainly want support for at least - the .scommon section. */ - -boolean -_bfd_mips_elf_section_from_bfd_section (abfd, hdr, sec, retval) - bfd *abfd ATTRIBUTE_UNUSED; - Elf32_Internal_Shdr *hdr ATTRIBUTE_UNUSED; - asection *sec; - int *retval; -{ - if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) - { - *retval = SHN_MIPS_SCOMMON; - return true; - } - if (strcmp (bfd_get_section_name (abfd, sec), ".acommon") == 0) - { - *retval = SHN_MIPS_ACOMMON; - return true; - } - return false; -} - -/* When are writing out the .options or .MIPS.options section, - remember the bytes we are writing out, so that we can install the - GP value in the section_processing routine. */ - -boolean -_bfd_mips_elf_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; -{ - if (strcmp (section->name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0) - { - bfd_byte *c; - - if (elf_section_data (section) == NULL) - { - section->used_by_bfd = - (PTR) bfd_zalloc (abfd, sizeof (struct bfd_elf_section_data)); - if (elf_section_data (section) == NULL) - return false; - } - c = (bfd_byte *) elf_section_data (section)->tdata; - if (c == NULL) - { - bfd_size_type size; - - if (section->_cooked_size != 0) - size = section->_cooked_size; - else - size = section->_raw_size; - c = (bfd_byte *) bfd_zalloc (abfd, size); - if (c == NULL) - return false; - elf_section_data (section)->tdata = (PTR) c; - } - - memcpy (c + offset, location, count); - } - - return _bfd_elf_set_section_contents (abfd, section, location, offset, - count); -} - -/* Work over a section just before writing it out. This routine is - used by both the 32-bit and the 64-bit ABI. FIXME: We recognize - sections that need the SHF_MIPS_GPREL flag by name; there has to be - a better way. */ - -boolean -_bfd_mips_elf_section_processing (abfd, hdr) - bfd *abfd; - Elf_Internal_Shdr *hdr; -{ - if (hdr->sh_type == SHT_MIPS_REGINFO - && hdr->sh_size > 0) - { - bfd_byte buf[4]; - - BFD_ASSERT (hdr->sh_size == sizeof (Elf32_External_RegInfo)); - BFD_ASSERT (hdr->contents == NULL); - - if (bfd_seek (abfd, - hdr->sh_offset + sizeof (Elf32_External_RegInfo) - 4, - SEEK_SET) == -1) - return false; - bfd_h_put_32 (abfd, (bfd_vma) elf_gp (abfd), buf); - if (bfd_write (buf, (bfd_size_type) 1, (bfd_size_type) 4, abfd) != 4) - return false; - } - - if (hdr->sh_type == SHT_MIPS_OPTIONS - && hdr->bfd_section != NULL - && elf_section_data (hdr->bfd_section) != NULL - && elf_section_data (hdr->bfd_section)->tdata != NULL) - { - bfd_byte *contents, *l, *lend; - - /* We stored the section contents in the elf_section_data tdata - field in the set_section_contents routine. We save the - section contents so that we don't have to read them again. - At this point we know that elf_gp is set, so we can look - through the section contents to see if there is an - ODK_REGINFO structure. */ - - contents = (bfd_byte *) elf_section_data (hdr->bfd_section)->tdata; - l = contents; - lend = contents + hdr->sh_size; - while (l + sizeof (Elf_External_Options) <= lend) - { - Elf_Internal_Options intopt; - - bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l, - &intopt); - if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO) - { - bfd_byte buf[8]; - - if (bfd_seek (abfd, - (hdr->sh_offset - + (l - contents) - + sizeof (Elf_External_Options) - + (sizeof (Elf64_External_RegInfo) - 8)), - SEEK_SET) == -1) - return false; - bfd_h_put_64 (abfd, elf_gp (abfd), buf); - if (bfd_write (buf, 1, 8, abfd) != 8) - return false; - } - else if (intopt.kind == ODK_REGINFO) - { - bfd_byte buf[4]; - - if (bfd_seek (abfd, - (hdr->sh_offset - + (l - contents) - + sizeof (Elf_External_Options) - + (sizeof (Elf32_External_RegInfo) - 4)), - SEEK_SET) == -1) - return false; - bfd_h_put_32 (abfd, elf_gp (abfd), buf); - if (bfd_write (buf, 1, 4, abfd) != 4) - return false; - } - l += intopt.size; - } - } - - if (hdr->bfd_section != NULL) - { - const char *name = bfd_get_section_name (abfd, hdr->bfd_section); - - if (strcmp (name, ".sdata") == 0 - || strcmp (name, ".lit8") == 0 - || strcmp (name, ".lit4") == 0) - { - hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL; - hdr->sh_type = SHT_PROGBITS; - } - else if (strcmp (name, ".sbss") == 0) - { - hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL; - hdr->sh_type = SHT_NOBITS; - } - else if (strcmp (name, MIPS_ELF_SRDATA_SECTION_NAME (abfd)) == 0) - { - hdr->sh_flags |= SHF_ALLOC | SHF_MIPS_GPREL; - hdr->sh_type = SHT_PROGBITS; - } - else if (strcmp (name, ".compact_rel") == 0) - { - hdr->sh_flags = 0; - hdr->sh_type = SHT_PROGBITS; - } - else if (strcmp (name, ".rtproc") == 0) - { - if (hdr->sh_addralign != 0 && hdr->sh_entsize == 0) - { - unsigned int adjust; - - adjust = hdr->sh_size % hdr->sh_addralign; - if (adjust != 0) - hdr->sh_size += hdr->sh_addralign - adjust; - } - } - } - - return true; -} - - -/* MIPS ELF uses two common sections. One is the usual one, and the - other is for small objects. All the small objects are kept - together, and then referenced via the gp pointer, which yields - faster assembler code. This is what we use for the small common - section. This approach is copied from ecoff.c. */ -static asection mips_elf_scom_section; -static asymbol mips_elf_scom_symbol; -static asymbol *mips_elf_scom_symbol_ptr; - -/* MIPS ELF also uses an acommon section, which represents an - allocated common symbol which may be overridden by a - definition in a shared library. */ -static asection mips_elf_acom_section; -static asymbol mips_elf_acom_symbol; -static asymbol *mips_elf_acom_symbol_ptr; - -/* The Irix 5 support uses two virtual sections, which represent - text/data symbols defined in dynamic objects. */ -static asection mips_elf_text_section; -static asection *mips_elf_text_section_ptr; -static asymbol mips_elf_text_symbol; -static asymbol *mips_elf_text_symbol_ptr; - -static asection mips_elf_data_section; -static asection *mips_elf_data_section_ptr; -static asymbol mips_elf_data_symbol; -static asymbol *mips_elf_data_symbol_ptr; - -/* Handle the special MIPS section numbers that a symbol may use. - This is used for both the 32-bit and the 64-bit ABI. */ - -void -_bfd_mips_elf_symbol_processing (abfd, asym) - bfd *abfd; - asymbol *asym; -{ - elf_symbol_type *elfsym; - - elfsym = (elf_symbol_type *) asym; - switch (elfsym->internal_elf_sym.st_shndx) - { - case SHN_MIPS_ACOMMON: - /* This section is used in a dynamically linked executable file. - It is an allocated common section. The dynamic linker can - either resolve these symbols to something in a shared - library, or it can just leave them here. For our purposes, - we can consider these symbols to be in a new section. */ - if (mips_elf_acom_section.name == NULL) - { - /* Initialize the acommon section. */ - mips_elf_acom_section.name = ".acommon"; - mips_elf_acom_section.flags = SEC_ALLOC; - mips_elf_acom_section.output_section = &mips_elf_acom_section; - mips_elf_acom_section.symbol = &mips_elf_acom_symbol; - mips_elf_acom_section.symbol_ptr_ptr = &mips_elf_acom_symbol_ptr; - mips_elf_acom_symbol.name = ".acommon"; - mips_elf_acom_symbol.flags = BSF_SECTION_SYM; - mips_elf_acom_symbol.section = &mips_elf_acom_section; - mips_elf_acom_symbol_ptr = &mips_elf_acom_symbol; - } - asym->section = &mips_elf_acom_section; - break; - - case SHN_COMMON: - /* Common symbols less than the GP size are automatically - treated as SHN_MIPS_SCOMMON symbols on IRIX5. */ - if (asym->value > elf_gp_size (abfd) - || IRIX_COMPAT (abfd) == ict_irix6) - break; - /* Fall through. */ - case SHN_MIPS_SCOMMON: - if (mips_elf_scom_section.name == NULL) - { - /* Initialize the small common section. */ - mips_elf_scom_section.name = ".scommon"; - mips_elf_scom_section.flags = SEC_IS_COMMON; - mips_elf_scom_section.output_section = &mips_elf_scom_section; - mips_elf_scom_section.symbol = &mips_elf_scom_symbol; - mips_elf_scom_section.symbol_ptr_ptr = &mips_elf_scom_symbol_ptr; - mips_elf_scom_symbol.name = ".scommon"; - mips_elf_scom_symbol.flags = BSF_SECTION_SYM; - mips_elf_scom_symbol.section = &mips_elf_scom_section; - mips_elf_scom_symbol_ptr = &mips_elf_scom_symbol; - } - asym->section = &mips_elf_scom_section; - asym->value = elfsym->internal_elf_sym.st_size; - break; - - case SHN_MIPS_SUNDEFINED: - asym->section = bfd_und_section_ptr; - break; - -#if 0 /* for SGI_COMPAT */ - case SHN_MIPS_TEXT: - asym->section = mips_elf_text_section_ptr; - break; - - case SHN_MIPS_DATA: - asym->section = mips_elf_data_section_ptr; - break; -#endif - } -} - -/* When creating an Irix 5 executable, we need REGINFO and RTPROC - segments. */ - -int -_bfd_mips_elf_additional_program_headers (abfd) - bfd *abfd; -{ - asection *s; - int ret = 0; - - if (!SGI_COMPAT (abfd)) - return 0; - - /* See if we need a PT_MIPS_REGINFO segment. */ - s = bfd_get_section_by_name (abfd, ".reginfo"); - if (s && (s->flags & SEC_LOAD)) - ++ret; - - /* See if we need a PT_MIPS_OPTIONS segment. */ - if (IRIX_COMPAT (abfd) == ict_irix6 - && bfd_get_section_by_name (abfd, - MIPS_ELF_OPTIONS_SECTION_NAME (abfd))) - ++ret; - - /* See if we need a PT_MIPS_RTPROC segment. */ - if (IRIX_COMPAT (abfd) == ict_irix5 - && bfd_get_section_by_name (abfd, ".dynamic") - && bfd_get_section_by_name (abfd, ".mdebug")) - ++ret; - - return ret; -} - -/* Modify the segment map for an Irix 5 executable. */ - -boolean -_bfd_mips_elf_modify_segment_map (abfd) - bfd *abfd; -{ - asection *s; - struct elf_segment_map *m, **pm; - - if (! SGI_COMPAT (abfd)) - return true; - - /* If there is a .reginfo section, we need a PT_MIPS_REGINFO - segment. */ - s = bfd_get_section_by_name (abfd, ".reginfo"); - if (s != NULL && (s->flags & SEC_LOAD) != 0) - { - for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) - if (m->p_type == PT_MIPS_REGINFO) - break; - if (m == NULL) - { - m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m); - if (m == NULL) - return false; - - m->p_type = PT_MIPS_REGINFO; - m->count = 1; - m->sections[0] = s; - - /* We want to put it after the PHDR and INTERP segments. */ - pm = &elf_tdata (abfd)->segment_map; - while (*pm != NULL - && ((*pm)->p_type == PT_PHDR - || (*pm)->p_type == PT_INTERP)) - pm = &(*pm)->next; - - m->next = *pm; - *pm = m; - } - } - - /* For IRIX 6, we don't have .mdebug sections, nor does anything but - .dynamic end up in PT_DYNAMIC. However, we do have to insert a - PT_OPTIONS segement immediately following the program header - table. */ - if (IRIX_COMPAT (abfd) == ict_irix6) - { - asection *s; - - for (s = abfd->sections; s; s = s->next) - if (elf_section_data (s)->this_hdr.sh_type == SHT_MIPS_OPTIONS) - break; - - if (s) - { - struct elf_segment_map *options_segment; - - /* Usually, there's a program header table. But, sometimes - there's not (like when running the `ld' testsuite). So, - if there's no program header table, we just put the - options segement at the end. */ - for (pm = &elf_tdata (abfd)->segment_map; - *pm != NULL; - pm = &(*pm)->next) - if ((*pm)->p_type == PT_PHDR) - break; - - options_segment = bfd_zalloc (abfd, - sizeof (struct elf_segment_map)); - options_segment->next = *pm; - options_segment->p_type = PT_MIPS_OPTIONS; - options_segment->p_flags = PF_R; - options_segment->p_flags_valid = true; - options_segment->count = 1; - options_segment->sections[0] = s; - *pm = options_segment; - } - } - else - { - /* If there are .dynamic and .mdebug sections, we make a room - for the RTPROC header. FIXME: Rewrite without section names. */ - if (bfd_get_section_by_name (abfd, ".interp") == NULL - && bfd_get_section_by_name (abfd, ".dynamic") != NULL - && bfd_get_section_by_name (abfd, ".mdebug") != NULL) - { - for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) - if (m->p_type == PT_MIPS_RTPROC) - break; - if (m == NULL) - { - m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m); - if (m == NULL) - return false; - - m->p_type = PT_MIPS_RTPROC; - - s = bfd_get_section_by_name (abfd, ".rtproc"); - if (s == NULL) - { - m->count = 0; - m->p_flags = 0; - m->p_flags_valid = 1; - } - else - { - m->count = 1; - m->sections[0] = s; - } - - /* We want to put it after the DYNAMIC segment. */ - pm = &elf_tdata (abfd)->segment_map; - while (*pm != NULL && (*pm)->p_type != PT_DYNAMIC) - pm = &(*pm)->next; - if (*pm != NULL) - pm = &(*pm)->next; - - m->next = *pm; - *pm = m; - } - } - - /* On Irix 5, the PT_DYNAMIC segment includes the .dynamic, - .dynstr, .dynsym, and .hash sections, and everything in - between. */ - for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL; pm = &(*pm)->next) - if ((*pm)->p_type == PT_DYNAMIC) - break; - m = *pm; - if (m != NULL - && m->count == 1 - && strcmp (m->sections[0]->name, ".dynamic") == 0) - { - static const char *sec_names[] = - { ".dynamic", ".dynstr", ".dynsym", ".hash" }; - bfd_vma low, high; - unsigned int i, c; - struct elf_segment_map *n; - - low = 0xffffffff; - high = 0; - for (i = 0; i < sizeof sec_names / sizeof sec_names[0]; i++) - { - s = bfd_get_section_by_name (abfd, sec_names[i]); - if (s != NULL && (s->flags & SEC_LOAD) != 0) - { - bfd_size_type sz; - - if (low > s->vma) - low = s->vma; - sz = s->_cooked_size; - if (sz == 0) - sz = s->_raw_size; - if (high < s->vma + sz) - high = s->vma + sz; - } - } - - c = 0; - for (s = abfd->sections; s != NULL; s = s->next) - if ((s->flags & SEC_LOAD) != 0 - && s->vma >= low - && ((s->vma - + (s->_cooked_size != 0 ? s->_cooked_size : s->_raw_size)) - <= high)) - ++c; - - n = ((struct elf_segment_map *) - bfd_zalloc (abfd, sizeof *n + (c - 1) * sizeof (asection *))); - if (n == NULL) - return false; - *n = *m; - n->count = c; - - i = 0; - for (s = abfd->sections; s != NULL; s = s->next) - { - if ((s->flags & SEC_LOAD) != 0 - && s->vma >= low - && ((s->vma - + (s->_cooked_size != 0 ? - s->_cooked_size : s->_raw_size)) - <= high)) - { - n->sections[i] = s; - ++i; - } - } - - *pm = n; - } - } - - return true; -} - -/* The structure of the runtime procedure descriptor created by the - loader for use by the static exception system. */ - -typedef struct runtime_pdr { - bfd_vma adr; /* memory address of start of procedure */ - long regmask; /* save register mask */ - long regoffset; /* save register offset */ - long fregmask; /* save floating point register mask */ - long fregoffset; /* save floating point register offset */ - long frameoffset; /* frame size */ - short framereg; /* frame pointer register */ - short pcreg; /* offset or reg of return pc */ - long irpss; /* index into the runtime string table */ - long reserved; - struct exception_info *exception_info;/* pointer to exception array */ -} RPDR, *pRPDR; -#define cbRPDR sizeof(RPDR) -#define rpdNil ((pRPDR) 0) - -/* Swap RPDR (runtime procedure table entry) for output. */ - -static void ecoff_swap_rpdr_out - PARAMS ((bfd *, const RPDR *, struct rpdr_ext *)); - -static void -ecoff_swap_rpdr_out (abfd, in, ex) - bfd *abfd; - const RPDR *in; - struct rpdr_ext *ex; -{ - /* ecoff_put_off was defined in ecoffswap.h. */ - ecoff_put_off (abfd, in->adr, (bfd_byte *) ex->p_adr); - bfd_h_put_32 (abfd, in->regmask, (bfd_byte *) ex->p_regmask); - bfd_h_put_32 (abfd, in->regoffset, (bfd_byte *) ex->p_regoffset); - bfd_h_put_32 (abfd, in->fregmask, (bfd_byte *) ex->p_fregmask); - bfd_h_put_32 (abfd, in->fregoffset, (bfd_byte *) ex->p_fregoffset); - bfd_h_put_32 (abfd, in->frameoffset, (bfd_byte *) ex->p_frameoffset); - - bfd_h_put_16 (abfd, in->framereg, (bfd_byte *) ex->p_framereg); - bfd_h_put_16 (abfd, in->pcreg, (bfd_byte *) ex->p_pcreg); - - bfd_h_put_32 (abfd, in->irpss, (bfd_byte *) ex->p_irpss); -#if 0 /* FIXME */ - ecoff_put_off (abfd, in->exception_info, (bfd_byte *) ex->p_exception_info); -#endif -} - -/* Read ECOFF debugging information from a .mdebug section into a - ecoff_debug_info structure. */ - -boolean -_bfd_mips_elf_read_ecoff_info (abfd, section, debug) - bfd *abfd; - asection *section; - struct ecoff_debug_info *debug; -{ - HDRR *symhdr; - const struct ecoff_debug_swap *swap; - char *ext_hdr = NULL; - - swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; - memset (debug, 0, sizeof(*debug)); - - ext_hdr = (char *) bfd_malloc ((size_t) swap->external_hdr_size); - if (ext_hdr == NULL && swap->external_hdr_size != 0) - goto error_return; - - if (bfd_get_section_contents (abfd, section, ext_hdr, (file_ptr) 0, - swap->external_hdr_size) - == false) - goto error_return; - - symhdr = &debug->symbolic_header; - (*swap->swap_hdr_in) (abfd, ext_hdr, symhdr); - - /* The symbolic header contains absolute file offsets and sizes to - read. */ -#define READ(ptr, offset, count, size, type) \ - if (symhdr->count == 0) \ - debug->ptr = NULL; \ - else \ - { \ - debug->ptr = (type) bfd_malloc ((size_t) (size * symhdr->count)); \ - if (debug->ptr == NULL) \ - goto error_return; \ - if (bfd_seek (abfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \ - || (bfd_read (debug->ptr, size, symhdr->count, \ - abfd) != size * symhdr->count)) \ - goto error_return; \ - } - - READ (line, cbLineOffset, cbLine, sizeof (unsigned char), unsigned char *); - READ (external_dnr, cbDnOffset, idnMax, swap->external_dnr_size, PTR); - READ (external_pdr, cbPdOffset, ipdMax, swap->external_pdr_size, PTR); - READ (external_sym, cbSymOffset, isymMax, swap->external_sym_size, PTR); - READ (external_opt, cbOptOffset, ioptMax, swap->external_opt_size, PTR); - READ (external_aux, cbAuxOffset, iauxMax, sizeof (union aux_ext), - union aux_ext *); - READ (ss, cbSsOffset, issMax, sizeof (char), char *); - READ (ssext, cbSsExtOffset, issExtMax, sizeof (char), char *); - READ (external_fdr, cbFdOffset, ifdMax, swap->external_fdr_size, PTR); - READ (external_rfd, cbRfdOffset, crfd, swap->external_rfd_size, PTR); - READ (external_ext, cbExtOffset, iextMax, swap->external_ext_size, PTR); -#undef READ - - debug->fdr = NULL; - debug->adjust = NULL; - - return true; - - error_return: - if (ext_hdr != NULL) - free (ext_hdr); - if (debug->line != NULL) - free (debug->line); - if (debug->external_dnr != NULL) - free (debug->external_dnr); - if (debug->external_pdr != NULL) - free (debug->external_pdr); - if (debug->external_sym != NULL) - free (debug->external_sym); - if (debug->external_opt != NULL) - free (debug->external_opt); - if (debug->external_aux != NULL) - free (debug->external_aux); - if (debug->ss != NULL) - free (debug->ss); - if (debug->ssext != NULL) - free (debug->ssext); - if (debug->external_fdr != NULL) - free (debug->external_fdr); - if (debug->external_rfd != NULL) - free (debug->external_rfd); - if (debug->external_ext != NULL) - free (debug->external_ext); - return false; -} - -/* MIPS ELF local labels start with '$', not 'L'. */ - -/*ARGSUSED*/ -static boolean -mips_elf_is_local_label_name (abfd, name) - bfd *abfd; - const char *name; -{ - if (name[0] == '$') - return true; - - /* On Irix 6, the labels go back to starting with '.', so we accept - the generic ELF local label syntax as well. */ - return _bfd_elf_is_local_label_name (abfd, name); -} - -/* MIPS ELF uses a special find_nearest_line routine in order the - handle the ECOFF debugging information. */ - -struct mips_elf_find_line -{ - struct ecoff_debug_info d; - struct ecoff_find_line i; -}; - -boolean -_bfd_mips_elf_find_nearest_line (abfd, section, symbols, offset, filename_ptr, - functionname_ptr, line_ptr) - bfd *abfd; - asection *section; - asymbol **symbols; - bfd_vma offset; - const char **filename_ptr; - const char **functionname_ptr; - unsigned int *line_ptr; -{ - asection *msec; - - if (_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset, - filename_ptr, functionname_ptr, - line_ptr)) - return true; - - if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, - filename_ptr, functionname_ptr, - line_ptr, - ABI_64_P (abfd) ? 8 : 0)) - return true; - - msec = bfd_get_section_by_name (abfd, ".mdebug"); - if (msec != NULL) - { - flagword origflags; - struct mips_elf_find_line *fi; - const struct ecoff_debug_swap * const swap = - get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; - - /* If we are called during a link, mips_elf_final_link may have - cleared the SEC_HAS_CONTENTS field. We force it back on here - if appropriate (which it normally will be). */ - origflags = msec->flags; - if (elf_section_data (msec)->this_hdr.sh_type != SHT_NOBITS) - msec->flags |= SEC_HAS_CONTENTS; - - fi = elf_tdata (abfd)->find_line_info; - if (fi == NULL) - { - bfd_size_type external_fdr_size; - char *fraw_src; - char *fraw_end; - struct fdr *fdr_ptr; - - fi = ((struct mips_elf_find_line *) - bfd_zalloc (abfd, sizeof (struct mips_elf_find_line))); - if (fi == NULL) - { - msec->flags = origflags; - return false; - } - - if (! _bfd_mips_elf_read_ecoff_info (abfd, msec, &fi->d)) - { - msec->flags = origflags; - return false; - } - - /* Swap in the FDR information. */ - fi->d.fdr = ((struct fdr *) - bfd_alloc (abfd, - (fi->d.symbolic_header.ifdMax * - sizeof (struct fdr)))); - if (fi->d.fdr == NULL) - { - msec->flags = origflags; - return false; - } - external_fdr_size = swap->external_fdr_size; - fdr_ptr = fi->d.fdr; - fraw_src = (char *) fi->d.external_fdr; - fraw_end = (fraw_src - + fi->d.symbolic_header.ifdMax * external_fdr_size); - for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++) - (*swap->swap_fdr_in) (abfd, (PTR) fraw_src, fdr_ptr); - - elf_tdata (abfd)->find_line_info = fi; - - /* Note that we don't bother to ever free this information. - find_nearest_line is either called all the time, as in - objdump -l, so the information should be saved, or it is - rarely called, as in ld error messages, so the memory - wasted is unimportant. Still, it would probably be a - good idea for free_cached_info to throw it away. */ - } - - if (_bfd_ecoff_locate_line (abfd, section, offset, &fi->d, swap, - &fi->i, filename_ptr, functionname_ptr, - line_ptr)) - { - msec->flags = origflags; - return true; - } - - msec->flags = origflags; - } - - /* Fall back on the generic ELF find_nearest_line routine. */ - - return _bfd_elf_find_nearest_line (abfd, section, symbols, offset, - filename_ptr, functionname_ptr, - line_ptr); -} - - /* The mips16 compiler uses a couple of special sections to handle - floating point arguments. - - Section names that look like .mips16.fn.FNNAME contain stubs that - copy floating point arguments from the fp regs to the gp regs and - then jump to FNNAME. If any 32 bit function calls FNNAME, the - call should be redirected to the stub instead. If no 32 bit - function calls FNNAME, the stub should be discarded. We need to - consider any reference to the function, not just a call, because - if the address of the function is taken we will need the stub, - since the address might be passed to a 32 bit function. - - Section names that look like .mips16.call.FNNAME contain stubs - that copy floating point arguments from the gp regs to the fp - regs and then jump to FNNAME. If FNNAME is a 32 bit function, - then any 16 bit function that calls FNNAME should be redirected - to the stub instead. If FNNAME is not a 32 bit function, the - stub should be discarded. - - .mips16.call.fp.FNNAME sections are similar, but contain stubs - which call FNNAME and then copy the return value from the fp regs - to the gp regs. These stubs store the return value in $18 while - calling FNNAME; any function which might call one of these stubs - must arrange to save $18 around the call. (This case is not - needed for 32 bit functions that call 16 bit functions, because - 16 bit functions always return floating point values in both - $f0/$f1 and $2/$3.) - - Note that in all cases FNNAME might be defined statically. - Therefore, FNNAME is not used literally. Instead, the relocation - information will indicate which symbol the section is for. - - We record any stubs that we find in the symbol table. */ - -#define FN_STUB ".mips16.fn." -#define CALL_STUB ".mips16.call." -#define CALL_FP_STUB ".mips16.call.fp." - -/* MIPS ELF linker hash table. */ - -struct mips_elf_link_hash_table -{ - struct elf_link_hash_table root; -#if 0 - /* We no longer use this. */ - /* String section indices for the dynamic section symbols. */ - bfd_size_type dynsym_sec_strindex[SIZEOF_MIPS_DYNSYM_SECNAMES]; -#endif - /* The number of .rtproc entries. */ - bfd_size_type procedure_count; - /* The size of the .compact_rel section (if SGI_COMPAT). */ - bfd_size_type compact_rel_size; - /* This flag indicates that the value of DT_MIPS_RLD_MAP dynamic - entry is set to the address of __rld_obj_head as in Irix 5. */ - boolean use_rld_obj_head; - /* This is the value of the __rld_map or __rld_obj_head symbol. */ - bfd_vma rld_value; - /* This is set if we see any mips16 stub sections. */ - boolean mips16_stubs_seen; -}; - -/* Look up an entry in a MIPS ELF linker hash table. */ - -#define mips_elf_link_hash_lookup(table, string, create, copy, follow) \ - ((struct mips_elf_link_hash_entry *) \ - elf_link_hash_lookup (&(table)->root, (string), (create), \ - (copy), (follow))) - -/* Traverse a MIPS ELF linker hash table. */ - -#define mips_elf_link_hash_traverse(table, func, info) \ - (elf_link_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ - (info))) - -/* Get the MIPS ELF linker hash table from a link_info structure. */ - -#define mips_elf_hash_table(p) \ - ((struct mips_elf_link_hash_table *) ((p)->hash)) - -static boolean mips_elf_output_extsym - PARAMS ((struct mips_elf_link_hash_entry *, PTR)); - -/* Create an entry in a MIPS ELF linker hash table. */ - -static struct bfd_hash_entry * -mips_elf_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct mips_elf_link_hash_entry *ret = - (struct mips_elf_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct mips_elf_link_hash_entry *) NULL) - ret = ((struct mips_elf_link_hash_entry *) - bfd_hash_allocate (table, - sizeof (struct mips_elf_link_hash_entry))); - if (ret == (struct mips_elf_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; - - /* Call the allocation method of the superclass. */ - ret = ((struct mips_elf_link_hash_entry *) - _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != (struct mips_elf_link_hash_entry *) NULL) - { - /* Set local fields. */ - memset (&ret->esym, 0, sizeof (EXTR)); - /* We use -2 as a marker to indicate that the information has - not been set. -1 means there is no associated ifd. */ - ret->esym.ifd = -2; - ret->possibly_dynamic_relocs = 0; - ret->min_dyn_reloc_index = 0; - ret->fn_stub = NULL; - ret->need_fn_stub = false; - ret->call_stub = NULL; - ret->call_fp_stub = NULL; - } - - return (struct bfd_hash_entry *) ret; -} - -/* Create a MIPS ELF linker hash table. */ - -struct bfd_link_hash_table * -_bfd_mips_elf_link_hash_table_create (abfd) - bfd *abfd; -{ - struct mips_elf_link_hash_table *ret; - - ret = ((struct mips_elf_link_hash_table *) - bfd_alloc (abfd, sizeof (struct mips_elf_link_hash_table))); - if (ret == (struct mips_elf_link_hash_table *) NULL) - return NULL; - - if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, - mips_elf_link_hash_newfunc)) - { - bfd_release (abfd, ret); - return NULL; - } - -#if 0 - /* We no longer use this. */ - for (i = 0; i < SIZEOF_MIPS_DYNSYM_SECNAMES; i++) - ret->dynsym_sec_strindex[i] = (bfd_size_type) -1; -#endif - ret->procedure_count = 0; - ret->compact_rel_size = 0; - ret->use_rld_obj_head = false; - ret->rld_value = 0; - ret->mips16_stubs_seen = false; - - return &ret->root.root; -} - -/* Hook called by the linker routine which adds symbols from an object - file. We must handle the special MIPS section numbers here. */ - -/*ARGSUSED*/ -boolean -_bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) - bfd *abfd; - struct bfd_link_info *info; - const Elf_Internal_Sym *sym; - const char **namep; - flagword *flagsp ATTRIBUTE_UNUSED; - asection **secp; - bfd_vma *valp; -{ - if (SGI_COMPAT (abfd) - && (abfd->flags & DYNAMIC) != 0 - && strcmp (*namep, "_rld_new_interface") == 0) - { - /* Skip Irix 5 rld entry name. */ - *namep = NULL; - return true; - } - - switch (sym->st_shndx) - { - case SHN_COMMON: - /* Common symbols less than the GP size are automatically - treated as SHN_MIPS_SCOMMON symbols. */ - if (sym->st_size > elf_gp_size (abfd) - || IRIX_COMPAT (abfd) == ict_irix6) - break; - /* Fall through. */ - case SHN_MIPS_SCOMMON: - *secp = bfd_make_section_old_way (abfd, ".scommon"); - (*secp)->flags |= SEC_IS_COMMON; - *valp = sym->st_size; - break; - - case SHN_MIPS_TEXT: - /* This section is used in a shared object. */ - if (mips_elf_text_section_ptr == NULL) - { - /* Initialize the section. */ - mips_elf_text_section.name = ".text"; - mips_elf_text_section.flags = SEC_NO_FLAGS; - mips_elf_text_section.output_section = NULL; - mips_elf_text_section.symbol = &mips_elf_text_symbol; - mips_elf_text_section.symbol_ptr_ptr = &mips_elf_text_symbol_ptr; - mips_elf_text_symbol.name = ".text"; - mips_elf_text_symbol.flags = BSF_SECTION_SYM | BSF_DYNAMIC; - mips_elf_text_symbol.section = &mips_elf_text_section; - mips_elf_text_symbol_ptr = &mips_elf_text_symbol; - mips_elf_text_section_ptr = &mips_elf_text_section; - } - /* This code used to do *secp = bfd_und_section_ptr if - info->shared. I don't know why, and that doesn't make sense, - so I took it out. */ - *secp = mips_elf_text_section_ptr; - break; - - case SHN_MIPS_ACOMMON: - /* Fall through. XXX Can we treat this as allocated data? */ - case SHN_MIPS_DATA: - /* This section is used in a shared object. */ - if (mips_elf_data_section_ptr == NULL) - { - /* Initialize the section. */ - mips_elf_data_section.name = ".data"; - mips_elf_data_section.flags = SEC_NO_FLAGS; - mips_elf_data_section.output_section = NULL; - mips_elf_data_section.symbol = &mips_elf_data_symbol; - mips_elf_data_section.symbol_ptr_ptr = &mips_elf_data_symbol_ptr; - mips_elf_data_symbol.name = ".data"; - mips_elf_data_symbol.flags = BSF_SECTION_SYM | BSF_DYNAMIC; - mips_elf_data_symbol.section = &mips_elf_data_section; - mips_elf_data_symbol_ptr = &mips_elf_data_symbol; - mips_elf_data_section_ptr = &mips_elf_data_section; - } - /* This code used to do *secp = bfd_und_section_ptr if - info->shared. I don't know why, and that doesn't make sense, - so I took it out. */ - *secp = mips_elf_data_section_ptr; - break; - - case SHN_MIPS_SUNDEFINED: - *secp = bfd_und_section_ptr; - break; - } - - if (SGI_COMPAT (abfd) - && ! info->shared - && info->hash->creator == abfd->xvec - && strcmp (*namep, "__rld_obj_head") == 0) - { - struct elf_link_hash_entry *h; - - /* Mark __rld_obj_head as dynamic. */ - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, *namep, BSF_GLOBAL, *secp, - (bfd_vma) *valp, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - - mips_elf_hash_table (info)->use_rld_obj_head = true; - } - - /* If this is a mips16 text symbol, add 1 to the value to make it - odd. This will cause something like .word SYM to come up with - the right value when it is loaded into the PC. */ - if (sym->st_other == STO_MIPS16) - ++*valp; - - return true; -} - -/* Structure used to pass information to mips_elf_output_extsym. */ - -struct extsym_info -{ - bfd *abfd; - struct bfd_link_info *info; - struct ecoff_debug_info *debug; - const struct ecoff_debug_swap *swap; - boolean failed; -}; - -/* This routine is used to write out ECOFF debugging external symbol - information. It is called via mips_elf_link_hash_traverse. The - ECOFF external symbol information must match the ELF external - symbol information. Unfortunately, at this point we don't know - whether a symbol is required by reloc information, so the two - tables may wind up being different. We must sort out the external - symbol information before we can set the final size of the .mdebug - section, and we must set the size of the .mdebug section before we - can relocate any sections, and we can't know which symbols are - required by relocation until we relocate the sections. - Fortunately, it is relatively unlikely that any symbol will be - stripped but required by a reloc. In particular, it can not happen - when generating a final executable. */ - -static boolean -mips_elf_output_extsym (h, data) - struct mips_elf_link_hash_entry *h; - PTR data; -{ - struct extsym_info *einfo = (struct extsym_info *) data; - boolean strip; - asection *sec, *output_section; - - if (h->root.indx == -2) - strip = false; - else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - || (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0) - && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0) - strip = true; - else if (einfo->info->strip == strip_all - || (einfo->info->strip == strip_some - && bfd_hash_lookup (einfo->info->keep_hash, - h->root.root.root.string, - false, false) == NULL)) - strip = true; - else - strip = false; - - if (strip) - return true; - - if (h->esym.ifd == -2) - { - h->esym.jmptbl = 0; - h->esym.cobol_main = 0; - h->esym.weakext = 0; - h->esym.reserved = 0; - h->esym.ifd = ifdNil; - h->esym.asym.value = 0; - h->esym.asym.st = stGlobal; - - if (SGI_COMPAT (einfo->abfd) - && (h->root.root.type == bfd_link_hash_undefined - || h->root.root.type == bfd_link_hash_undefweak)) - { - const char *name; - - /* Use undefined class. Also, set class and type for some - special symbols. */ - name = h->root.root.root.string; - if (strcmp (name, mips_elf_dynsym_rtproc_names[0]) == 0 - || strcmp (name, mips_elf_dynsym_rtproc_names[1]) == 0) - { - h->esym.asym.sc = scData; - h->esym.asym.st = stLabel; - h->esym.asym.value = 0; - } - else if (strcmp (name, mips_elf_dynsym_rtproc_names[2]) == 0) - { - h->esym.asym.sc = scAbs; - h->esym.asym.st = stLabel; - h->esym.asym.value = - mips_elf_hash_table (einfo->info)->procedure_count; - } - else if (strcmp (name, "_gp_disp") == 0) - { - h->esym.asym.sc = scAbs; - h->esym.asym.st = stLabel; - h->esym.asym.value = elf_gp (einfo->abfd); - } - else - h->esym.asym.sc = scUndefined; - } - else if (h->root.root.type != bfd_link_hash_defined - && h->root.root.type != bfd_link_hash_defweak) - h->esym.asym.sc = scAbs; - else - { - const char *name; - - sec = h->root.root.u.def.section; - output_section = sec->output_section; - - /* When making a shared library and symbol h is the one from - the another shared library, OUTPUT_SECTION may be null. */ - if (output_section == NULL) - h->esym.asym.sc = scUndefined; - else - { - name = bfd_section_name (output_section->owner, output_section); - - if (strcmp (name, ".text") == 0) - h->esym.asym.sc = scText; - else if (strcmp (name, ".data") == 0) - h->esym.asym.sc = scData; - else if (strcmp (name, ".sdata") == 0) - h->esym.asym.sc = scSData; - else if (strcmp (name, ".rodata") == 0 - || strcmp (name, ".rdata") == 0) - h->esym.asym.sc = scRData; - else if (strcmp (name, ".bss") == 0) - h->esym.asym.sc = scBss; - else if (strcmp (name, ".sbss") == 0) - h->esym.asym.sc = scSBss; - else if (strcmp (name, ".init") == 0) - h->esym.asym.sc = scInit; - else if (strcmp (name, ".fini") == 0) - h->esym.asym.sc = scFini; - else - h->esym.asym.sc = scAbs; - } - } - - h->esym.asym.reserved = 0; - h->esym.asym.index = indexNil; - } - - if (h->root.root.type == bfd_link_hash_common) - h->esym.asym.value = h->root.root.u.c.size; - else if (h->root.root.type == bfd_link_hash_defined - || h->root.root.type == bfd_link_hash_defweak) - { - if (h->esym.asym.sc == scCommon) - h->esym.asym.sc = scBss; - else if (h->esym.asym.sc == scSCommon) - h->esym.asym.sc = scSBss; - - sec = h->root.root.u.def.section; - output_section = sec->output_section; - if (output_section != NULL) - h->esym.asym.value = (h->root.root.u.def.value - + sec->output_offset - + output_section->vma); - else - h->esym.asym.value = 0; - } - else if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) - { - /* Set type and value for a symbol with a function stub. */ - h->esym.asym.st = stProc; - sec = h->root.root.u.def.section; - if (sec == NULL) - h->esym.asym.value = 0; - else - { - output_section = sec->output_section; - if (output_section != NULL) - h->esym.asym.value = (h->root.plt.offset - + sec->output_offset - + output_section->vma); - else - h->esym.asym.value = 0; - } -#if 0 /* FIXME? */ - h->esym.ifd = 0; -#endif - } - - if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap, - h->root.root.root.string, - &h->esym)) - { - einfo->failed = true; - return false; - } - - return true; -} - -/* Create a runtime procedure table from the .mdebug section. */ - -static boolean -mips_elf_create_procedure_table (handle, abfd, info, s, debug) - PTR handle; - bfd *abfd; - struct bfd_link_info *info; - asection *s; - struct ecoff_debug_info *debug; -{ - const struct ecoff_debug_swap *swap; - HDRR *hdr = &debug->symbolic_header; - RPDR *rpdr, *rp; - struct rpdr_ext *erp; - PTR rtproc; - struct pdr_ext *epdr; - struct sym_ext *esym; - char *ss, **sv; - char *str; - unsigned long size, count; - unsigned long sindex; - unsigned long i; - PDR pdr; - SYMR sym; - const char *no_name_func = _("static procedure (no name)"); - - epdr = NULL; - rpdr = NULL; - esym = NULL; - ss = NULL; - sv = NULL; - - swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; - - sindex = strlen (no_name_func) + 1; - count = hdr->ipdMax; - if (count > 0) - { - size = swap->external_pdr_size; - - epdr = (struct pdr_ext *) bfd_malloc (size * count); - if (epdr == NULL) - goto error_return; - - if (! _bfd_ecoff_get_accumulated_pdr (handle, (PTR) epdr)) - goto error_return; - - size = sizeof (RPDR); - rp = rpdr = (RPDR *) bfd_malloc (size * count); - if (rpdr == NULL) - goto error_return; - - sv = (char **) bfd_malloc (sizeof (char *) * count); - if (sv == NULL) - goto error_return; - - count = hdr->isymMax; - size = swap->external_sym_size; - esym = (struct sym_ext *) bfd_malloc (size * count); - if (esym == NULL) - goto error_return; - - if (! _bfd_ecoff_get_accumulated_sym (handle, (PTR) esym)) - goto error_return; - - count = hdr->issMax; - ss = (char *) bfd_malloc (count); - if (ss == NULL) - goto error_return; - if (! _bfd_ecoff_get_accumulated_ss (handle, (PTR) ss)) - goto error_return; - - count = hdr->ipdMax; - for (i = 0; i < count; i++, rp++) - { - (*swap->swap_pdr_in) (abfd, (PTR) (epdr + i), &pdr); - (*swap->swap_sym_in) (abfd, (PTR) &esym[pdr.isym], &sym); - rp->adr = sym.value; - rp->regmask = pdr.regmask; - rp->regoffset = pdr.regoffset; - rp->fregmask = pdr.fregmask; - rp->fregoffset = pdr.fregoffset; - rp->frameoffset = pdr.frameoffset; - rp->framereg = pdr.framereg; - rp->pcreg = pdr.pcreg; - rp->irpss = sindex; - sv[i] = ss + sym.iss; - sindex += strlen (sv[i]) + 1; - } - } - - size = sizeof (struct rpdr_ext) * (count + 2) + sindex; - size = BFD_ALIGN (size, 16); - rtproc = (PTR) bfd_alloc (abfd, size); - if (rtproc == NULL) - { - mips_elf_hash_table (info)->procedure_count = 0; - goto error_return; - } - - mips_elf_hash_table (info)->procedure_count = count + 2; - - erp = (struct rpdr_ext *) rtproc; - memset (erp, 0, sizeof (struct rpdr_ext)); - erp++; - str = (char *) rtproc + sizeof (struct rpdr_ext) * (count + 2); - strcpy (str, no_name_func); - str += strlen (no_name_func) + 1; - for (i = 0; i < count; i++) - { - ecoff_swap_rpdr_out (abfd, rpdr + i, erp + i); - strcpy (str, sv[i]); - str += strlen (sv[i]) + 1; - } - ecoff_put_off (abfd, (bfd_vma) -1, (bfd_byte *) (erp + count)->p_adr); - - /* Set the size and contents of .rtproc section. */ - s->_raw_size = size; - s->contents = (bfd_byte *) rtproc; - - /* Skip this section later on (I don't think this currently - matters, but someday it might). */ - s->link_order_head = (struct bfd_link_order *) NULL; - - if (epdr != NULL) - free (epdr); - if (rpdr != NULL) - free (rpdr); - if (esym != NULL) - free (esym); - if (ss != NULL) - free (ss); - if (sv != NULL) - free (sv); - - return true; - - error_return: - if (epdr != NULL) - free (epdr); - if (rpdr != NULL) - free (rpdr); - if (esym != NULL) - free (esym); - if (ss != NULL) - free (ss); - if (sv != NULL) - free (sv); - return false; -} - -/* A comparison routine used to sort .gptab entries. */ - -static int -gptab_compare (p1, p2) - const PTR p1; - const PTR p2; -{ - const Elf32_gptab *a1 = (const Elf32_gptab *) p1; - const Elf32_gptab *a2 = (const Elf32_gptab *) p2; - - return a1->gt_entry.gt_g_value - a2->gt_entry.gt_g_value; -} - -/* We need to use a special link routine to handle the .reginfo and - the .mdebug sections. We need to merge all instances of these - sections together, not write them all out sequentially. */ - -boolean -_bfd_mips_elf_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - asection **secpp; - asection *o; - struct bfd_link_order *p; - asection *reginfo_sec, *mdebug_sec, *gptab_data_sec, *gptab_bss_sec; - asection *rtproc_sec; - Elf32_RegInfo reginfo; - struct ecoff_debug_info debug; - const struct ecoff_debug_swap *swap - = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap; - HDRR *symhdr = &debug.symbolic_header; - PTR mdebug_handle = NULL; - - /* If all the things we linked together were PIC, but we're - producing an executable (rather than a shared object), then the - resulting file is CPIC (i.e., it calls PIC code.) */ - if (!info->shared - && !info->relocateable - && elf_elfheader (abfd)->e_flags & EF_MIPS_PIC) - { - elf_elfheader (abfd)->e_flags &= ~EF_MIPS_PIC; - elf_elfheader (abfd)->e_flags |= EF_MIPS_CPIC; - } - - /* We'd carefully arranged the dynamic symbol indices, and then the - generic size_dynamic_sections renumbered them out from under us. - Rather than trying somehow to prevent the renumbering, just do - the sort again. */ - if (elf_hash_table (info)->dynamic_sections_created) - { - bfd *dynobj; - asection *got; - struct mips_got_info *g; - - /* When we resort, we must tell mips_elf_sort_hash_table what - the lowest index it may use is. That's the number of section - symbols we're going to add. The generic ELF linker only - adds these symbols when building a shared object. Note that - we count the sections after (possibly) removing the .options - section above. */ - if (!mips_elf_sort_hash_table (info, (info->shared - ? bfd_count_sections (abfd) + 1 - : 1))) - return false; - - /* Make sure we didn't grow the global .got region. */ - dynobj = elf_hash_table (info)->dynobj; - got = bfd_get_section_by_name (dynobj, ".got"); - g = (struct mips_got_info *) elf_section_data (got)->tdata; - - if (g->global_gotsym != NULL) - BFD_ASSERT ((elf_hash_table (info)->dynsymcount - - g->global_gotsym->dynindx) - <= g->global_gotno); - } - - /* On IRIX5, we omit the .options section. On IRIX6, however, we - include it, even though we don't process it quite right. (Some - entries are supposed to be merged.) Empirically, we seem to be - better off including it then not. */ - if (IRIX_COMPAT (abfd) == ict_irix5) - for (secpp = &abfd->sections; *secpp != NULL; secpp = &(*secpp)->next) - { - if (strcmp ((*secpp)->name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0) - { - for (p = (*secpp)->link_order_head; p != NULL; p = p->next) - if (p->type == bfd_indirect_link_order) - p->u.indirect.section->flags &=~ SEC_HAS_CONTENTS; - (*secpp)->link_order_head = NULL; - *secpp = (*secpp)->next; - --abfd->section_count; - - break; - } - } - - /* Get a value for the GP register. */ - if (elf_gp (abfd) == 0) - { - struct bfd_link_hash_entry *h; - - h = bfd_link_hash_lookup (info->hash, "_gp", false, false, true); - if (h != (struct bfd_link_hash_entry *) NULL - && h->type == bfd_link_hash_defined) - elf_gp (abfd) = (h->u.def.value - + h->u.def.section->output_section->vma - + h->u.def.section->output_offset); - else if (info->relocateable) - { - bfd_vma lo; - - /* Find the GP-relative section with the lowest offset. */ - lo = (bfd_vma) -1; - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - if (o->vma < lo - && (elf_section_data (o)->this_hdr.sh_flags & SHF_MIPS_GPREL)) - lo = o->vma; - - /* And calculate GP relative to that. */ - elf_gp (abfd) = lo + ELF_MIPS_GP_OFFSET (abfd); - } - else - { - /* If the relocate_section function needs to do a reloc - involving the GP value, it should make a reloc_dangerous - callback to warn that GP is not defined. */ - } - } - - /* Go through the sections and collect the .reginfo and .mdebug - information. */ - reginfo_sec = NULL; - mdebug_sec = NULL; - gptab_data_sec = NULL; - gptab_bss_sec = NULL; - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - { - if (strcmp (o->name, ".reginfo") == 0) - { - memset (®info, 0, sizeof reginfo); - - /* We have found the .reginfo section in the output file. - Look through all the link_orders comprising it and merge - the information together. */ - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - asection *input_section; - bfd *input_bfd; - Elf32_External_RegInfo ext; - Elf32_RegInfo sub; - - if (p->type != bfd_indirect_link_order) - { - if (p->type == bfd_fill_link_order) - continue; - abort (); - } - - input_section = p->u.indirect.section; - input_bfd = input_section->owner; - - /* The linker emulation code has probably clobbered the - size to be zero bytes. */ - if (input_section->_raw_size == 0) - input_section->_raw_size = sizeof (Elf32_External_RegInfo); - - if (! bfd_get_section_contents (input_bfd, input_section, - (PTR) &ext, - (file_ptr) 0, - sizeof ext)) - return false; - - bfd_mips_elf32_swap_reginfo_in (input_bfd, &ext, &sub); - - reginfo.ri_gprmask |= sub.ri_gprmask; - reginfo.ri_cprmask[0] |= sub.ri_cprmask[0]; - reginfo.ri_cprmask[1] |= sub.ri_cprmask[1]; - reginfo.ri_cprmask[2] |= sub.ri_cprmask[2]; - reginfo.ri_cprmask[3] |= sub.ri_cprmask[3]; - - /* ri_gp_value is set by the function - mips_elf32_section_processing when the section is - finally written out. */ - - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &=~ SEC_HAS_CONTENTS; - } - - /* Size has been set in mips_elf_always_size_sections */ - BFD_ASSERT(o->_raw_size == sizeof (Elf32_External_RegInfo)); - - /* Skip this section later on (I don't think this currently - matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; - - reginfo_sec = o; - } - - if (strcmp (o->name, ".mdebug") == 0) - { - struct extsym_info einfo; - - /* We have found the .mdebug section in the output file. - Look through all the link_orders comprising it and merge - the information together. */ - symhdr->magic = swap->sym_magic; - /* FIXME: What should the version stamp be? */ - symhdr->vstamp = 0; - symhdr->ilineMax = 0; - symhdr->cbLine = 0; - symhdr->idnMax = 0; - symhdr->ipdMax = 0; - symhdr->isymMax = 0; - symhdr->ioptMax = 0; - symhdr->iauxMax = 0; - symhdr->issMax = 0; - symhdr->issExtMax = 0; - symhdr->ifdMax = 0; - symhdr->crfd = 0; - symhdr->iextMax = 0; - - /* We accumulate the debugging information itself in the - debug_info structure. */ - debug.line = NULL; - debug.external_dnr = NULL; - debug.external_pdr = NULL; - debug.external_sym = NULL; - debug.external_opt = NULL; - debug.external_aux = NULL; - debug.ss = NULL; - debug.ssext = debug.ssext_end = NULL; - debug.external_fdr = NULL; - debug.external_rfd = NULL; - debug.external_ext = debug.external_ext_end = NULL; - - mdebug_handle = bfd_ecoff_debug_init (abfd, &debug, swap, info); - if (mdebug_handle == (PTR) NULL) - return false; - - if (SGI_COMPAT (abfd)) - { - asection *s; - EXTR esym; - bfd_vma last; - unsigned int i; - static const char * const name[] = - { ".text", ".init", ".fini", ".data", - ".rodata", ".sdata", ".sbss", ".bss" }; - static const int sc[] = { scText, scInit, scFini, scData, - scRData, scSData, scSBss, scBss }; - - esym.jmptbl = 0; - esym.cobol_main = 0; - esym.weakext = 0; - esym.reserved = 0; - esym.ifd = ifdNil; - esym.asym.iss = issNil; - esym.asym.st = stLocal; - esym.asym.reserved = 0; - esym.asym.index = indexNil; - last = 0; - for (i = 0; i < 8; i++) - { - esym.asym.sc = sc[i]; - s = bfd_get_section_by_name (abfd, name[i]); - if (s != NULL) - { - esym.asym.value = s->vma; - last = s->vma + s->_raw_size; - } - else - esym.asym.value = last; - - if (! bfd_ecoff_debug_one_external (abfd, &debug, swap, - name[i], &esym)) - return false; - } - } - - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - asection *input_section; - bfd *input_bfd; - const struct ecoff_debug_swap *input_swap; - struct ecoff_debug_info input_debug; - char *eraw_src; - char *eraw_end; - - if (p->type != bfd_indirect_link_order) - { - if (p->type == bfd_fill_link_order) - continue; - abort (); - } - - input_section = p->u.indirect.section; - input_bfd = input_section->owner; - - if (bfd_get_flavour (input_bfd) != bfd_target_elf_flavour - || (get_elf_backend_data (input_bfd) - ->elf_backend_ecoff_debug_swap) == NULL) - { - /* I don't know what a non MIPS ELF bfd would be - doing with a .mdebug section, but I don't really - want to deal with it. */ - continue; - } - - input_swap = (get_elf_backend_data (input_bfd) - ->elf_backend_ecoff_debug_swap); - - BFD_ASSERT (p->size == input_section->_raw_size); - - /* The ECOFF linking code expects that we have already - read in the debugging information and set up an - ecoff_debug_info structure, so we do that now. */ - if (! _bfd_mips_elf_read_ecoff_info (input_bfd, input_section, - &input_debug)) - return false; - - if (! (bfd_ecoff_debug_accumulate - (mdebug_handle, abfd, &debug, swap, input_bfd, - &input_debug, input_swap, info))) - return false; - - /* Loop through the external symbols. For each one with - interesting information, try to find the symbol in - the linker global hash table and save the information - for the output external symbols. */ - eraw_src = input_debug.external_ext; - eraw_end = (eraw_src - + (input_debug.symbolic_header.iextMax - * input_swap->external_ext_size)); - for (; - eraw_src < eraw_end; - eraw_src += input_swap->external_ext_size) - { - EXTR ext; - const char *name; - struct mips_elf_link_hash_entry *h; - - (*input_swap->swap_ext_in) (input_bfd, (PTR) eraw_src, &ext); - if (ext.asym.sc == scNil - || ext.asym.sc == scUndefined - || ext.asym.sc == scSUndefined) - continue; - - name = input_debug.ssext + ext.asym.iss; - h = mips_elf_link_hash_lookup (mips_elf_hash_table (info), - name, false, false, true); - if (h == NULL || h->esym.ifd != -2) - continue; - - if (ext.ifd != -1) - { - BFD_ASSERT (ext.ifd - < input_debug.symbolic_header.ifdMax); - ext.ifd = input_debug.ifdmap[ext.ifd]; - } - - h->esym = ext; - } - - /* Free up the information we just read. */ - free (input_debug.line); - free (input_debug.external_dnr); - free (input_debug.external_pdr); - free (input_debug.external_sym); - free (input_debug.external_opt); - free (input_debug.external_aux); - free (input_debug.ss); - free (input_debug.ssext); - free (input_debug.external_fdr); - free (input_debug.external_rfd); - free (input_debug.external_ext); - - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &=~ SEC_HAS_CONTENTS; - } - - if (SGI_COMPAT (abfd) && info->shared) - { - /* Create .rtproc section. */ - rtproc_sec = bfd_get_section_by_name (abfd, ".rtproc"); - if (rtproc_sec == NULL) - { - flagword flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED | SEC_READONLY); - - rtproc_sec = bfd_make_section (abfd, ".rtproc"); - if (rtproc_sec == NULL - || ! bfd_set_section_flags (abfd, rtproc_sec, flags) - || ! bfd_set_section_alignment (abfd, rtproc_sec, 4)) - return false; - } - - if (! mips_elf_create_procedure_table (mdebug_handle, abfd, - info, rtproc_sec, &debug)) - return false; - } - - /* Build the external symbol information. */ - einfo.abfd = abfd; - einfo.info = info; - einfo.debug = &debug; - einfo.swap = swap; - einfo.failed = false; - mips_elf_link_hash_traverse (mips_elf_hash_table (info), - mips_elf_output_extsym, - (PTR) &einfo); - if (einfo.failed) - return false; - - /* Set the size of the .mdebug section. */ - o->_raw_size = bfd_ecoff_debug_size (abfd, &debug, swap); - - /* Skip this section later on (I don't think this currently - matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; - - mdebug_sec = o; - } - - if (strncmp (o->name, ".gptab.", sizeof ".gptab." - 1) == 0) - { - const char *subname; - unsigned int c; - Elf32_gptab *tab; - Elf32_External_gptab *ext_tab; - unsigned int i; - - /* The .gptab.sdata and .gptab.sbss sections hold - information describing how the small data area would - change depending upon the -G switch. These sections - not used in executables files. */ - if (! info->relocateable) - { - asection **secpp; - - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - asection *input_section; - - if (p->type != bfd_indirect_link_order) - { - if (p->type == bfd_fill_link_order) - continue; - abort (); - } - - input_section = p->u.indirect.section; - - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &=~ SEC_HAS_CONTENTS; - } - - /* Skip this section later on (I don't think this - currently matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; - - /* Really remove the section. */ - for (secpp = &abfd->sections; - *secpp != o; - secpp = &(*secpp)->next) - ; - *secpp = (*secpp)->next; - --abfd->section_count; - - continue; - } - - /* There is one gptab for initialized data, and one for - uninitialized data. */ - if (strcmp (o->name, ".gptab.sdata") == 0) - gptab_data_sec = o; - else if (strcmp (o->name, ".gptab.sbss") == 0) - gptab_bss_sec = o; - else - { - (*_bfd_error_handler) - (_("%s: illegal section name `%s'"), - bfd_get_filename (abfd), o->name); - bfd_set_error (bfd_error_nonrepresentable_section); - return false; - } - - /* The linker script always combines .gptab.data and - .gptab.sdata into .gptab.sdata, and likewise for - .gptab.bss and .gptab.sbss. It is possible that there is - no .sdata or .sbss section in the output file, in which - case we must change the name of the output section. */ - subname = o->name + sizeof ".gptab" - 1; - if (bfd_get_section_by_name (abfd, subname) == NULL) - { - if (o == gptab_data_sec) - o->name = ".gptab.data"; - else - o->name = ".gptab.bss"; - subname = o->name + sizeof ".gptab" - 1; - BFD_ASSERT (bfd_get_section_by_name (abfd, subname) != NULL); - } - - /* Set up the first entry. */ - c = 1; - tab = (Elf32_gptab *) bfd_malloc (c * sizeof (Elf32_gptab)); - if (tab == NULL) - return false; - tab[0].gt_header.gt_current_g_value = elf_gp_size (abfd); - tab[0].gt_header.gt_unused = 0; - - /* Combine the input sections. */ - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - asection *input_section; - bfd *input_bfd; - bfd_size_type size; - unsigned long last; - bfd_size_type gpentry; - - if (p->type != bfd_indirect_link_order) - { - if (p->type == bfd_fill_link_order) - continue; - abort (); - } - - input_section = p->u.indirect.section; - input_bfd = input_section->owner; - - /* Combine the gptab entries for this input section one - by one. We know that the input gptab entries are - sorted by ascending -G value. */ - size = bfd_section_size (input_bfd, input_section); - last = 0; - for (gpentry = sizeof (Elf32_External_gptab); - gpentry < size; - gpentry += sizeof (Elf32_External_gptab)) - { - Elf32_External_gptab ext_gptab; - Elf32_gptab int_gptab; - unsigned long val; - unsigned long add; - boolean exact; - unsigned int look; - - if (! (bfd_get_section_contents - (input_bfd, input_section, (PTR) &ext_gptab, - gpentry, sizeof (Elf32_External_gptab)))) - { - free (tab); - return false; - } - - bfd_mips_elf32_swap_gptab_in (input_bfd, &ext_gptab, - &int_gptab); - val = int_gptab.gt_entry.gt_g_value; - add = int_gptab.gt_entry.gt_bytes - last; - - exact = false; - for (look = 1; look < c; look++) - { - if (tab[look].gt_entry.gt_g_value >= val) - tab[look].gt_entry.gt_bytes += add; - - if (tab[look].gt_entry.gt_g_value == val) - exact = true; - } - - if (! exact) - { - Elf32_gptab *new_tab; - unsigned int max; - - /* We need a new table entry. */ - new_tab = ((Elf32_gptab *) - bfd_realloc ((PTR) tab, - (c + 1) * sizeof (Elf32_gptab))); - if (new_tab == NULL) - { - free (tab); - return false; - } - tab = new_tab; - tab[c].gt_entry.gt_g_value = val; - tab[c].gt_entry.gt_bytes = add; - - /* Merge in the size for the next smallest -G - value, since that will be implied by this new - value. */ - max = 0; - for (look = 1; look < c; look++) - { - if (tab[look].gt_entry.gt_g_value < val - && (max == 0 - || (tab[look].gt_entry.gt_g_value - > tab[max].gt_entry.gt_g_value))) - max = look; - } - if (max != 0) - tab[c].gt_entry.gt_bytes += - tab[max].gt_entry.gt_bytes; - - ++c; - } - - last = int_gptab.gt_entry.gt_bytes; - } - - /* Hack: reset the SEC_HAS_CONTENTS flag so that - elf_link_input_bfd ignores this section. */ - input_section->flags &=~ SEC_HAS_CONTENTS; - } - - /* The table must be sorted by -G value. */ - if (c > 2) - qsort (tab + 1, c - 1, sizeof (tab[0]), gptab_compare); - - /* Swap out the table. */ - ext_tab = ((Elf32_External_gptab *) - bfd_alloc (abfd, c * sizeof (Elf32_External_gptab))); - if (ext_tab == NULL) - { - free (tab); - return false; - } - - for (i = 0; i < c; i++) - bfd_mips_elf32_swap_gptab_out (abfd, tab + i, ext_tab + i); - free (tab); - - o->_raw_size = c * sizeof (Elf32_External_gptab); - o->contents = (bfd_byte *) ext_tab; - - /* Skip this section later on (I don't think this currently - matters, but someday it might). */ - o->link_order_head = (struct bfd_link_order *) NULL; - } - } - - /* Invoke the regular ELF backend linker to do all the work. */ - if (ABI_64_P (abfd)) - { -#ifdef BFD64 - if (!bfd_elf64_bfd_final_link (abfd, info)) - return false; -#else - abort (); - return false; -#endif /* BFD64 */ - } - else if (!bfd_elf32_bfd_final_link (abfd, info)) - return false; - - /* Now write out the computed sections. */ - - if (reginfo_sec != (asection *) NULL) - { - Elf32_External_RegInfo ext; - - bfd_mips_elf32_swap_reginfo_out (abfd, ®info, &ext); - if (! bfd_set_section_contents (abfd, reginfo_sec, (PTR) &ext, - (file_ptr) 0, sizeof ext)) - return false; - } - - if (mdebug_sec != (asection *) NULL) - { - BFD_ASSERT (abfd->output_has_begun); - if (! bfd_ecoff_write_accumulated_debug (mdebug_handle, abfd, &debug, - swap, info, - mdebug_sec->filepos)) - return false; - - bfd_ecoff_debug_free (mdebug_handle, abfd, &debug, swap, info); - } - - if (gptab_data_sec != (asection *) NULL) - { - if (! bfd_set_section_contents (abfd, gptab_data_sec, - gptab_data_sec->contents, - (file_ptr) 0, - gptab_data_sec->_raw_size)) - return false; - } - - if (gptab_bss_sec != (asection *) NULL) - { - if (! bfd_set_section_contents (abfd, gptab_bss_sec, - gptab_bss_sec->contents, - (file_ptr) 0, - gptab_bss_sec->_raw_size)) - return false; - } - - if (SGI_COMPAT (abfd)) - { - rtproc_sec = bfd_get_section_by_name (abfd, ".rtproc"); - if (rtproc_sec != NULL) - { - if (! bfd_set_section_contents (abfd, rtproc_sec, - rtproc_sec->contents, - (file_ptr) 0, - rtproc_sec->_raw_size)) - return false; - } - } - - return true; -} - -/* Returns the GOT section for ABFD. */ - -static asection * -mips_elf_got_section (abfd) - bfd *abfd; -{ - return bfd_get_section_by_name (abfd, ".got"); -} - -/* Returns the GOT information associated with the link indicated by - INFO. If SGOTP is non-NULL, it is filled in with the GOT - section. */ - -static struct mips_got_info * -mips_elf_got_info (abfd, sgotp) - bfd *abfd; - asection **sgotp; -{ - asection *sgot; - struct mips_got_info *g; - - sgot = mips_elf_got_section (abfd); - BFD_ASSERT (sgot != NULL); - BFD_ASSERT (elf_section_data (sgot) != NULL); - g = (struct mips_got_info *) elf_section_data (sgot)->tdata; - BFD_ASSERT (g != NULL); - - if (sgotp) - *sgotp = sgot; - return g; -} - -/* Return whether a relocation is against a local symbol. */ - -static boolean -mips_elf_local_relocation_p (input_bfd, relocation, local_sections) - bfd *input_bfd; - const Elf_Internal_Rela *relocation; - asection **local_sections; -{ - unsigned long r_symndx; - Elf_Internal_Shdr *symtab_hdr; - - r_symndx = ELF32_R_SYM (relocation->r_info); - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - if (! elf_bad_symtab (input_bfd)) - return r_symndx < symtab_hdr->sh_info; - else - { - /* The symbol table does not follow the rule that local symbols - must come before globals. */ - return local_sections[r_symndx] != NULL; - } -} - -/* Sign-extend VALUE, which has the indicated number of BITS. */ - -static bfd_vma -mips_elf_sign_extend (value, bits) - bfd_vma value; - int bits; -{ - if (value & ((bfd_vma)1 << (bits - 1))) - /* VALUE is negative. */ - value |= ((bfd_vma) - 1) << bits; - - return value; -} - -/* Return non-zero if the indicated VALUE has overflowed the maximum - range expressable by a signed number with the indicated number of - BITS. */ - -static boolean -mips_elf_overflow_p (value, bits) - bfd_vma value; - int bits; -{ - bfd_signed_vma svalue = (bfd_signed_vma) value; - - if (svalue > (1 << (bits - 1)) - 1) - /* The value is too big. */ - return true; - else if (svalue < -(1 << (bits - 1))) - /* The value is too small. */ - return true; - - /* All is well. */ - return false; -} - -/* Calculate the %high function. */ - -static bfd_vma -mips_elf_high (value) - bfd_vma value; -{ - return ((value + (bfd_vma) 0x8000) >> 16) & 0xffff; -} - -/* Calculate the %higher function. */ - -static bfd_vma -mips_elf_higher (value) - bfd_vma value ATTRIBUTE_UNUSED; -{ -#ifdef BFD64 - return ((value + (bfd_vma) 0x80008000) >> 32) & 0xffff; -#else - abort (); - return (bfd_vma) -1; -#endif -} - -/* Calculate the %highest function. */ - -static bfd_vma -mips_elf_highest (value) - bfd_vma value ATTRIBUTE_UNUSED; -{ -#ifdef BFD64 - return ((value + (bfd_vma) 0x800080008000) >> 48) & 0xffff; -#else - abort (); - return (bfd_vma) -1; -#endif -} - -/* Returns the GOT index for the global symbol indicated by H. */ - -static bfd_vma -mips_elf_global_got_index (abfd, h) - bfd *abfd; - struct elf_link_hash_entry *h; -{ - bfd_vma index; - asection *sgot; - struct mips_got_info *g; - - g = mips_elf_got_info (abfd, &sgot); - - /* Once we determine the global GOT entry with the lowest dynamic - symbol table index, we must put all dynamic symbols with greater - indices into the GOT. That makes it easy to calculate the GOT - offset. */ - BFD_ASSERT (h->dynindx >= g->global_gotsym->dynindx); - index = ((h->dynindx - g->global_gotsym->dynindx + g->local_gotno) - * MIPS_ELF_GOT_SIZE (abfd)); - BFD_ASSERT (index < sgot->_raw_size); - - return index; -} - -/* Returns the offset for the entry at the INDEXth position - in the GOT. */ - -static bfd_vma -mips_elf_got_offset_from_index (dynobj, output_bfd, index) - bfd *dynobj; - bfd *output_bfd; - bfd_vma index; -{ - asection *sgot; - bfd_vma gp; - - sgot = mips_elf_got_section (dynobj); - gp = _bfd_get_gp_value (output_bfd); - return (sgot->output_section->vma + sgot->output_offset + index - - gp); -} - -/* If H is a symbol that needs a global GOT entry, but has a dynamic - symbol table index lower than any we've seen to date, record it for - posterity. */ - -static boolean -mips_elf_record_global_got_symbol (h, info, g) - struct elf_link_hash_entry *h; - struct bfd_link_info *info; - struct mips_got_info *g ATTRIBUTE_UNUSED; -{ - /* A global symbol in the GOT must also be in the dynamic symbol - table. */ - if (h->dynindx == -1 - && !bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - - /* If we've already marked this entry as need GOT space, we don't - need to do it again. */ - if (h->got.offset != (bfd_vma) - 1) - return true; - - /* By setting this to a value other than -1, we are indicating that - there needs to be a GOT entry for H. */ - h->got.offset = 0; - - return true; -} - -/* This structure is passed to mips_elf_sort_hash_table_f when sorting - the dynamic symbols. */ - -struct mips_elf_hash_sort_data -{ - /* The symbol in the global GOT with the lowest dynamic symbol table - index. */ - struct elf_link_hash_entry *low; - /* The least dynamic symbol table index corresponding to a symbol - with a GOT entry. */ - long min_got_dynindx; - /* The greatest dynamic symbol table index not corresponding to a - symbol without a GOT entry. */ - long max_non_got_dynindx; -}; - -/* If H needs a GOT entry, assign it the highest available dynamic - index. Otherwise, assign it the lowest available dynamic - index. */ - -static boolean -mips_elf_sort_hash_table_f (h, data) - struct mips_elf_link_hash_entry *h; - PTR data; -{ - struct mips_elf_hash_sort_data *hsd - = (struct mips_elf_hash_sort_data *) data; - - /* Symbols without dynamic symbol table entries aren't interesting - at all. */ - if (h->root.dynindx == -1) - return true; - - if (h->root.got.offset != 0) - h->root.dynindx = hsd->max_non_got_dynindx++; - else - { - h->root.dynindx = --hsd->min_got_dynindx; - hsd->low = (struct elf_link_hash_entry *) h; - } - - return true; -} - -/* Sort the dynamic symbol table so that symbols that need GOT entries - appear towards the end. This reduces the amount of GOT space - required. MAX_LOCAL is used to set the number of local symbols - known to be in the dynamic symbol table. During - mips_elf_size_dynamic_sections, this value is 1. Afterward, the - section symbols are added and the count is higher. */ - -static boolean -mips_elf_sort_hash_table (info, max_local) - struct bfd_link_info *info; - unsigned long max_local; -{ - struct mips_elf_hash_sort_data hsd; - struct mips_got_info *g; - bfd *dynobj; - - dynobj = elf_hash_table (info)->dynobj; - - hsd.low = NULL; - hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount; - hsd.max_non_got_dynindx = max_local; - mips_elf_link_hash_traverse (((struct mips_elf_link_hash_table *) - elf_hash_table (info)), - mips_elf_sort_hash_table_f, - &hsd); - - /* There shoud have been enough room in the symbol table to - accomodate both the GOT and non-GOT symbols. */ - BFD_ASSERT (hsd.min_got_dynindx == hsd.max_non_got_dynindx); - - /* Now we know which dynamic symbol has the lowest dynamic symbol - table index in the GOT. */ - g = mips_elf_got_info (dynobj, NULL); - g->global_gotsym = hsd.low; - - return true; -} - -/* Create a local GOT entry for VALUE. Return the index of the entry, - or -1 if it could not be created. */ - -static bfd_vma -mips_elf_create_local_got_entry (abfd, g, sgot, value) - bfd *abfd; - struct mips_got_info *g; - asection *sgot; - bfd_vma value; -{ - if (g->assigned_gotno >= g->local_gotno) - { - /* We didn't allocate enough space in the GOT. */ - (*_bfd_error_handler) - (_("not enough GOT space for local GOT entries")); - bfd_set_error (bfd_error_bad_value); - return (bfd_vma) -1; - } - - MIPS_ELF_PUT_WORD (abfd, value, - (sgot->contents - + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno)); - return MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno++; -} - -/* Returns the GOT offset at which the indicated address can be found. - If there is not yet a GOT entry for this value, create one. Returns - -1 if no satisfactory GOT offset can be found. */ - -static bfd_vma -mips_elf_local_got_index (abfd, info, value) - bfd *abfd; - struct bfd_link_info *info; - bfd_vma value; -{ - asection *sgot; - struct mips_got_info *g; - bfd_byte *entry; - - g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot); - - /* Look to see if we already have an appropriate entry. */ - for (entry = (sgot->contents - + MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO); - entry != sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno; - entry += MIPS_ELF_GOT_SIZE (abfd)) - { - bfd_vma address = MIPS_ELF_GET_WORD (abfd, entry); - if (address == value) - return entry - sgot->contents; - } - - return mips_elf_create_local_got_entry (abfd, g, sgot, value); -} - -/* Find a GOT entry that is within 32KB of the VALUE. These entries - are supposed to be placed at small offsets in the GOT, i.e., - within 32KB of GP. Return the index into the GOT for this page, - and store the offset from this entry to the desired address in - OFFSETP, if it is non-NULL. */ - -static bfd_vma -mips_elf_got_page (abfd, info, value, offsetp) - bfd *abfd; - struct bfd_link_info *info; - bfd_vma value; - bfd_vma *offsetp; -{ - asection *sgot; - struct mips_got_info *g; - bfd_byte *entry; - bfd_byte *last_entry; - bfd_vma index = 0; - bfd_vma address; - - g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot); - - /* Look to see if we aleady have an appropriate entry. */ - last_entry = sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno; - for (entry = (sgot->contents - + MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO); - entry != last_entry; - entry += MIPS_ELF_GOT_SIZE (abfd)) - { - address = MIPS_ELF_GET_WORD (abfd, entry); - - if (!mips_elf_overflow_p (value - address, 16)) - { - /* This entry will serve as the page pointer. We can add a - 16-bit number to it to get the actual address. */ - index = entry - sgot->contents; - break; - } - } - - /* If we didn't have an appropriate entry, we create one now. */ - if (entry == last_entry) - index = mips_elf_create_local_got_entry (abfd, g, sgot, value); - - if (offsetp) - { - address = MIPS_ELF_GET_WORD (abfd, entry); - *offsetp = value - address; - } - - return index; -} - -/* Find a GOT entry whose higher-order 16 bits are the same as those - for value. Return the index into the GOT for this entry. */ - -static bfd_vma -mips_elf_got16_entry (abfd, info, value) - bfd *abfd; - struct bfd_link_info *info; - bfd_vma value; -{ - asection *sgot; - struct mips_got_info *g; - bfd_byte *entry; - bfd_byte *last_entry; - bfd_vma index = 0; - bfd_vma address; - - /* Although the ABI says that it is "the high-order 16 bits" that we - want, it is really the %high value. The complete value is - calculated with a `addiu' of a LO16 relocation, just as with a - HI16/LO16 pair. */ - value = mips_elf_high (value) << 16; - g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot); - - /* Look to see if we already have an appropriate entry. */ - last_entry = sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno; - for (entry = (sgot->contents - + MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO); - entry != last_entry; - entry += MIPS_ELF_GOT_SIZE (abfd)) - { - address = MIPS_ELF_GET_WORD (abfd, entry); - if ((address & 0xffff0000) == value) - { - /* This entry has the right high-order 16 bits. */ - index = entry - sgot->contents; - break; - } - } - - /* If we didn't have an appropriate entry, we create one now. */ - if (entry == last_entry) - index = mips_elf_create_local_got_entry (abfd, g, sgot, value); - - return index; -} - -/* Returns the first relocation of type r_type found, beginning with - RELOCATION. RELEND is one-past-the-end of the relocation table. */ - -static const Elf_Internal_Rela * -mips_elf_next_relocation (r_type, relocation, relend) - unsigned int r_type; - const Elf_Internal_Rela *relocation; - const Elf_Internal_Rela *relend; -{ - /* According to the MIPS ELF ABI, the R_MIPS_LO16 relocation must be - immediately following. However, for the IRIX6 ABI, the next - relocation may be a composed relocation consisting of several - relocations for the same address. In that case, the R_MIPS_LO16 - relocation may occur as one of these. We permit a similar - extension in general, as that is useful for GCC. */ - while (relocation < relend) - { - if (ELF32_R_TYPE (relocation->r_info) == r_type) - return relocation; - - ++relocation; - } - - /* We didn't find it. */ - bfd_set_error (bfd_error_bad_value); - return NULL; -} - -/* Create a rel.dyn relocation for the dynamic linker to resolve. REL - is the original relocation, which is now being transformed into a - dyanmic relocation. The ADDENDP is adjusted if necessary; the - caller should store the result in place of the original addend. */ - -static boolean -mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, - symbol, addendp, input_section) - bfd *output_bfd; - struct bfd_link_info *info; - const Elf_Internal_Rela *rel; - struct mips_elf_link_hash_entry *h; - asection *sec; - bfd_vma symbol; - bfd_vma *addendp; - asection *input_section; -{ - Elf_Internal_Rel outrel; - boolean skip; - asection *sreloc; - bfd *dynobj; - int r_type; - - r_type = ELF32_R_TYPE (rel->r_info); - dynobj = elf_hash_table (info)->dynobj; - sreloc - = bfd_get_section_by_name (dynobj, - MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)); - BFD_ASSERT (sreloc != NULL); - - skip = false; - - /* We begin by assuming that the offset for the dynamic relocation - is the same as for the original relocation. We'll adjust this - later to reflect the correct output offsets. */ - if (elf_section_data (input_section)->stab_info == NULL) - outrel.r_offset = rel->r_offset; - else - { - /* Except that in a stab section things are more complex. - Because we compress stab information, the offset given in the - relocation may not be the one we want; we must let the stabs - machinery tell us the offset. */ - outrel.r_offset - = (_bfd_stab_section_offset - (output_bfd, &elf_hash_table (info)->stab_info, - input_section, - &elf_section_data (input_section)->stab_info, - rel->r_offset)); - /* If we didn't need the relocation at all, this value will be - -1. */ - if (outrel.r_offset == (bfd_vma) -1) - skip = true; - } - - /* If we've decided to skip this relocation, just output an emtpy - record. Note that R_MIPS_NONE == 0, so that this call to memset - is a way of setting R_TYPE to R_MIPS_NONE. */ - if (skip) - memset (&outrel, 0, sizeof (outrel)); - else - { - long indx; - bfd_vma section_offset; - - /* We must now calculate the dynamic symbol table index to use - in the relocation. */ - if (h != NULL - && (! info->symbolic || (h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) - { - indx = h->root.dynindx; - BFD_ASSERT (indx != -1); - } - else - { - if (sec != NULL && bfd_is_abs_section (sec)) - indx = 0; - else if (sec == NULL || sec->owner == NULL) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - else - { - indx = elf_section_data (sec->output_section)->dynindx; - if (indx == 0) - abort (); - } - - /* Figure out how far the target of the relocation is from - the beginning of its section. */ - section_offset = symbol - sec->output_section->vma; - /* The relocation we're building is section-relative. - Therefore, the original addend must be adjusted by the - section offset. */ - *addendp += symbol - sec->output_section->vma; - /* Now, the relocation is just against the section. */ - symbol = sec->output_section->vma; - } - - /* If the relocation was previously an absolute relocation, we - must adjust it by the value we give it in the dynamic symbol - table. */ - if (r_type != R_MIPS_REL32) - *addendp += symbol; - - /* The relocation is always an REL32 relocation because we don't - know where the shared library will wind up at load-time. */ - outrel.r_info = ELF32_R_INFO (indx, R_MIPS_REL32); - - /* Adjust the output offset of the relocation to reference the - correct location in the output file. */ - outrel.r_offset += (input_section->output_section->vma - + input_section->output_offset); - } - - /* Put the relocation back out. We have to use the special - relocation outputter in the 64-bit case since the 64-bit - relocation format is non-standard. */ - if (ABI_64_P (output_bfd)) - { - (*get_elf_backend_data (output_bfd)->s->swap_reloc_out) - (output_bfd, &outrel, - (sreloc->contents - + sreloc->reloc_count * sizeof (Elf64_Mips_External_Rel))); - } - else - bfd_elf32_swap_reloc_out (output_bfd, &outrel, - (((Elf32_External_Rel *) - sreloc->contents) - + sreloc->reloc_count)); - - /* Record the index of the first relocation referencing H. This - information is later emitted in the .msym section. */ - if (h != NULL - && (h->min_dyn_reloc_index == 0 - || sreloc->reloc_count < h->min_dyn_reloc_index)) - h->min_dyn_reloc_index = sreloc->reloc_count; - - /* We've now added another relocation. */ - ++sreloc->reloc_count; - - /* Make sure the output section is writable. The dynamic linker - will be writing to it. */ - elf_section_data (input_section->output_section)->this_hdr.sh_flags - |= SHF_WRITE; - - /* On IRIX5, make an entry of compact relocation info. */ - if (! skip && IRIX_COMPAT (output_bfd) == ict_irix5) - { - asection* scpt = bfd_get_section_by_name (dynobj, ".compact_rel"); - bfd_byte *cr; - - if (scpt) - { - Elf32_crinfo cptrel; - - mips_elf_set_cr_format (cptrel, CRF_MIPS_LONG); - cptrel.vaddr = (rel->r_offset - + input_section->output_section->vma - + input_section->output_offset); - if (r_type == R_MIPS_REL32) - mips_elf_set_cr_type (cptrel, CRT_MIPS_REL32); - else - mips_elf_set_cr_type (cptrel, CRT_MIPS_WORD); - mips_elf_set_cr_dist2to (cptrel, 0); - cptrel.konst = *addendp; - - cr = (scpt->contents - + sizeof (Elf32_External_compact_rel)); - bfd_elf32_swap_crinfo_out (output_bfd, &cptrel, - ((Elf32_External_crinfo *) cr - + scpt->reloc_count)); - ++scpt->reloc_count; - } - } - - return true; -} - -/* Calculate the value produced by the RELOCATION (which comes from - the INPUT_BFD). The ADDEND is the addend to use for this - RELOCATION; RELOCATION->R_ADDEND is ignored. - - The result of the relocation calculation is stored in VALUEP. - REQUIRE_JALXP indicates whether or not the opcode used with this - relocation must be JALX. - - This function returns bfd_reloc_continue if the caller need take no - further action regarding this relocation, bfd_reloc_notsupported if - something goes dramatically wrong, bfd_reloc_overflow if an - overflow occurs, and bfd_reloc_ok to indicate success. */ - -static bfd_reloc_status_type -mips_elf_calculate_relocation (abfd, - input_bfd, - input_section, - info, - relocation, - addend, - howto, - local_syms, - local_sections, - valuep, - namep, - require_jalxp) - bfd *abfd; - bfd *input_bfd; - asection *input_section; - struct bfd_link_info *info; - const Elf_Internal_Rela *relocation; - bfd_vma addend; - reloc_howto_type *howto; - Elf_Internal_Sym *local_syms; - asection **local_sections; - bfd_vma *valuep; - const char **namep; - boolean *require_jalxp; -{ - /* The eventual value we will return. */ - bfd_vma value; - /* The address of the symbol against which the relocation is - occurring. */ - bfd_vma symbol = 0; - /* The final GP value to be used for the relocatable, executable, or - shared object file being produced. */ - bfd_vma gp = (bfd_vma) - 1; - /* The place (section offset or address) of the storage unit being - relocated. */ - bfd_vma p; - /* The value of GP used to create the relocatable object. */ - bfd_vma gp0 = (bfd_vma) - 1; - /* The offset into the global offset table at which the address of - the relocation entry symbol, adjusted by the addend, resides - during execution. */ - bfd_vma g = (bfd_vma) - 1; - /* The section in which the symbol referenced by the relocation is - located. */ - asection *sec = NULL; - struct mips_elf_link_hash_entry* h = NULL; - /* True if the symbol referred to by this relocation is a local - symbol. */ - boolean local_p; - /* True if the symbol referred to by this relocation is "_gp_disp". */ - boolean gp_disp_p = false; - Elf_Internal_Shdr *symtab_hdr; - size_t extsymoff; - unsigned long r_symndx; - int r_type; - /* True if overflow occurred during the calculation of the - relocation value. */ - boolean overflowed_p; - /* True if this relocation refers to a MIPS16 function. */ - boolean target_is_16_bit_code_p = false; - - /* Parse the relocation. */ - r_symndx = ELF32_R_SYM (relocation->r_info); - r_type = ELF32_R_TYPE (relocation->r_info); - p = (input_section->output_section->vma - + input_section->output_offset - + relocation->r_offset); - - /* Assume that there will be no overflow. */ - overflowed_p = false; - - /* Figure out whether or not the symbol is local, and get the offset - used in the array of hash table entries. */ - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - local_p = mips_elf_local_relocation_p (input_bfd, relocation, - local_sections); - if (! elf_bad_symtab (input_bfd)) - extsymoff = symtab_hdr->sh_info; - else - { - /* The symbol table does not follow the rule that local symbols - must come before globals. */ - extsymoff = 0; - } - - /* Figure out the value of the symbol. */ - if (local_p) - { - Elf_Internal_Sym *sym; - - sym = local_syms + r_symndx; - sec = local_sections[r_symndx]; - - symbol = sec->output_section->vma + sec->output_offset; - if (ELF_ST_TYPE (sym->st_info) != STT_SECTION) - symbol += sym->st_value; - - /* MIPS16 text labels should be treated as odd. */ - if (sym->st_other == STO_MIPS16) - ++symbol; - - /* Record the name of this symbol, for our caller. */ - *namep = bfd_elf_string_from_elf_section (input_bfd, - symtab_hdr->sh_link, - sym->st_name); - if (*namep == '\0') - *namep = bfd_section_name (input_bfd, sec); - - target_is_16_bit_code_p = (sym->st_other == STO_MIPS16); - } - else - { - /* For global symbols we look up the symbol in the hash-table. */ - h = ((struct mips_elf_link_hash_entry *) - elf_sym_hashes (input_bfd) [r_symndx - extsymoff]); - /* Find the real hash-table entry for this symbol. */ - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; - - /* Record the name of this symbol, for our caller. */ - *namep = h->root.root.root.string; - - /* See if this is the special _gp_disp symbol. Note that such a - symbol must always be a global symbol. */ - if (strcmp (h->root.root.root.string, "_gp_disp") == 0) - { - /* Relocations against _gp_disp are permitted only with - R_MIPS_HI16 and R_MIPS_LO16 relocations. */ - if (r_type != R_MIPS_HI16 && r_type != R_MIPS_LO16) - return bfd_reloc_notsupported; - - gp_disp_p = true; - } - /* If this symbol is defined, calculate its address. Note that - _gp_disp is a magic symbol, always implicitly defined by the - linker, so it's inappropriate to check to see whether or not - its defined. */ - else if ((h->root.root.type == bfd_link_hash_defined - || h->root.root.type == bfd_link_hash_defweak) - && h->root.root.u.def.section) - { - sec = h->root.root.u.def.section; - if (sec->output_section) - symbol = (h->root.root.u.def.value - + sec->output_section->vma - + sec->output_offset); - else - symbol = h->root.root.u.def.value; - } - else if (h->root.root.type == bfd_link_hash_undefweak) - /* We allow relocations against undefined weak symbols, giving - it the value zero, so that you can undefined weak functions - and check to see if they exist by looking at their - addresses. */ - symbol = 0; - else if (info->shared && !info->symbolic && !info->no_undefined - && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT) - symbol = 0; - else if (strcmp (h->root.root.root.string, "_DYNAMIC_LINK") == 0) - { - /* If this is a dynamic link, we should have created a - _DYNAMIC_LINK symbol in mips_elf_create_dynamic_sections. - Otherwise, we should define the symbol with a value of 0. - FIXME: It should probably get into the symbol table - somehow as well. */ - BFD_ASSERT (! info->shared); - BFD_ASSERT (bfd_get_section_by_name (abfd, ".dynamic") == NULL); - symbol = 0; - } - else - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.root.string, input_bfd, - input_section, relocation->r_offset, - (!info->shared || info->no_undefined - || ELF_ST_VISIBILITY (h->root.other))))) - return bfd_reloc_undefined; - symbol = 0; - } - - target_is_16_bit_code_p = (h->root.other == STO_MIPS16); - } - - /* If this is a 32-bit call to a 16-bit function with a stub, we - need to redirect the call to the stub, unless we're already *in* - a stub. */ - if (r_type != R_MIPS16_26 && !info->relocateable - && ((h != NULL && h->fn_stub != NULL) - || (local_p && elf_tdata (input_bfd)->local_stubs != NULL - && elf_tdata (input_bfd)->local_stubs[r_symndx] != NULL)) - && !mips_elf_stub_section_p (input_bfd, input_section)) - { - /* This is a 32-bit call to a 16-bit function. We should - have already noticed that we were going to need the - stub. */ - if (local_p) - sec = elf_tdata (input_bfd)->local_stubs[r_symndx]; - else - { - BFD_ASSERT (h->need_fn_stub); - sec = h->fn_stub; - } - - symbol = sec->output_section->vma + sec->output_offset; - } - /* If this is a 16-bit call to a 32-bit function with a stub, we - need to redirect the call to the stub. */ - else if (r_type == R_MIPS16_26 && !info->relocateable - && h != NULL - && (h->call_stub != NULL || h->call_fp_stub != NULL) - && !target_is_16_bit_code_p) - { - /* If both call_stub and call_fp_stub are defined, we can figure - out which one to use by seeing which one appears in the input - file. */ - if (h->call_stub != NULL && h->call_fp_stub != NULL) - { - asection *o; - - sec = NULL; - for (o = input_bfd->sections; o != NULL; o = o->next) - { - if (strncmp (bfd_get_section_name (input_bfd, o), - CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0) - { - sec = h->call_fp_stub; - break; - } - } - if (sec == NULL) - sec = h->call_stub; - } - else if (h->call_stub != NULL) - sec = h->call_stub; - else - sec = h->call_fp_stub; - - BFD_ASSERT (sec->_raw_size > 0); - symbol = sec->output_section->vma + sec->output_offset; - } - - /* Calls from 16-bit code to 32-bit code and vice versa require the - special jalx instruction. */ - *require_jalxp = (!info->relocateable - && ((r_type == R_MIPS16_26) != target_is_16_bit_code_p)); - - /* If we haven't already determined the GOT offset, or the GP value, - and we're going to need it, get it now. */ - switch (r_type) - { - case R_MIPS_CALL16: - case R_MIPS_GOT16: - case R_MIPS_GOT_DISP: - case R_MIPS_GOT_HI16: - case R_MIPS_CALL_HI16: - case R_MIPS_GOT_LO16: - case R_MIPS_CALL_LO16: - /* Find the index into the GOT where this value is located. */ - if (!local_p) - { - BFD_ASSERT (addend == 0); - g = mips_elf_global_got_index - (elf_hash_table (info)->dynobj, - (struct elf_link_hash_entry*) h); - } - else if (r_type == R_MIPS_GOT16) - /* There's no need to create a local GOT entry here; the - calculation for a local GOT16 entry does not involve G. */ - break; - else - { - g = mips_elf_local_got_index (abfd, info, symbol + addend); - if (g == (bfd_vma) -1) - return false; - } - - /* Convert GOT indices to actual offsets. */ - g = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj, - abfd, g); - break; - - case R_MIPS_HI16: - case R_MIPS_LO16: - case R_MIPS_GPREL16: - case R_MIPS_GPREL32: - case R_MIPS_LITERAL: - gp0 = _bfd_get_gp_value (input_bfd); - gp = _bfd_get_gp_value (abfd); - break; - - default: - break; - } - - /* Figure out what kind of relocation is being performed. */ - switch (r_type) - { - case R_MIPS_NONE: - return bfd_reloc_continue; - - case R_MIPS_16: - value = symbol + mips_elf_sign_extend (addend, 16); - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_32: - case R_MIPS_REL32: - case R_MIPS_64: - if ((info->shared - || (elf_hash_table (info)->dynamic_sections_created - && h != NULL - && ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) - == 0))) - && (input_section->flags & SEC_ALLOC) != 0) - { - /* If we're creating a shared library, or this relocation is - against a symbol in a shared library, then we can't know - where the symbol will end up. So, we create a relocation - record in the output, and leave the job up to the dynamic - linker. */ - value = addend; - if (!mips_elf_create_dynamic_relocation (abfd, - info, - relocation, - h, - sec, - symbol, - &value, - input_section)) - return false; - } - else - { - if (r_type != R_MIPS_REL32) - value = symbol + addend; - else - value = addend; - } - value &= howto->dst_mask; - break; - - case R_MIPS_PC32: - case R_MIPS_PC64: - case R_MIPS_GNU_REL_LO16: - value = symbol + addend - p; - value &= howto->dst_mask; - break; - - case R_MIPS_GNU_REL16_S2: - value = symbol + mips_elf_sign_extend (addend << 2, 18) - p; - overflowed_p = mips_elf_overflow_p (value, 18); - value = (value >> 2) & howto->dst_mask; - break; - - case R_MIPS_GNU_REL_HI16: - value = mips_elf_high (addend + symbol - p); - value &= howto->dst_mask; - break; - - case R_MIPS16_26: - /* The calculation for R_MIPS_26 is just the same as for an - R_MIPS_26. It's only the storage of the relocated field into - the output file that's different. That's handled in - mips_elf_perform_relocation. So, we just fall through to the - R_MIPS_26 case here. */ - case R_MIPS_26: - if (local_p) - value = (((addend << 2) | (p & 0xf0000000)) + symbol) >> 2; - else - value = (mips_elf_sign_extend (addend << 2, 28) + symbol) >> 2; - value &= howto->dst_mask; - break; - - case R_MIPS_HI16: - if (!gp_disp_p) - { - value = mips_elf_high (addend + symbol); - value &= howto->dst_mask; - } - else - { - value = mips_elf_high (addend + gp - p); - overflowed_p = mips_elf_overflow_p (value, 16); - } - break; - - case R_MIPS_LO16: - if (!gp_disp_p) - value = (symbol + addend) & howto->dst_mask; - else - { - value = addend + gp - p + 4; - /* The MIPS ABI requires checking the R_MIPS_LO16 relocation - for overflow. But, on, say, Irix 5, relocations against - _gp_disp are normally generated from the .cpload - pseudo-op. It generates code that normally looks like - this: - - lui $gp,%hi(_gp_disp) - addiu $gp,$gp,%lo(_gp_disp) - addu $gp,$gp,$t9 - - Here $t9 holds the address of the function being called, - as required by the MIPS ELF ABI. The R_MIPS_LO16 - relocation can easily overflow in this situation, but the - R_MIPS_HI16 relocation will handle the overflow. - Therefore, we consider this a bug in the MIPS ABI, and do - not check for overflow here. */ - } - break; - - case R_MIPS_LITERAL: - /* Because we don't merge literal sections, we can handle this - just like R_MIPS_GPREL16. In the long run, we should merge - shared literals, and then we will need to additional work - here. */ - - /* Fall through. */ - - case R_MIPS16_GPREL: - /* The R_MIPS16_GPREL performs the same calculation as - R_MIPS_GPREL16, but stores the relocated bits in a different - order. We don't need to do anything special here; the - differences are handled in mips_elf_perform_relocation. */ - case R_MIPS_GPREL16: - if (local_p) - value = mips_elf_sign_extend (addend, 16) + symbol + gp0 - gp; - else - value = mips_elf_sign_extend (addend, 16) + symbol - gp; - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_GOT16: - if (local_p) - { - value = mips_elf_got16_entry (abfd, info, symbol + addend); - if (value == (bfd_vma) -1) - return false; - value - = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj, - abfd, - value); - overflowed_p = mips_elf_overflow_p (value, 16); - break; - } - - /* Fall through. */ - - case R_MIPS_CALL16: - case R_MIPS_GOT_DISP: - value = g; - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_GPREL32: - value = (addend + symbol + gp0 - gp) & howto->dst_mask; - break; - - case R_MIPS_PC16: - value = mips_elf_sign_extend (addend, 16) + symbol - p; - value = (bfd_vma) ((bfd_signed_vma) value / 4); - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_GOT_HI16: - case R_MIPS_CALL_HI16: - /* We're allowed to handle these two relocations identically. - The dynamic linker is allowed to handle the CALL relocations - differently by creating a lazy evaluation stub. */ - value = g; - value = mips_elf_high (value); - value &= howto->dst_mask; - break; - - case R_MIPS_GOT_LO16: - case R_MIPS_CALL_LO16: - value = g & howto->dst_mask; - break; - - case R_MIPS_GOT_PAGE: - value = mips_elf_got_page (abfd, info, symbol + addend, NULL); - if (value == (bfd_vma) -1) - return false; - value = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj, - abfd, - value); - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_GOT_OFST: - mips_elf_got_page (abfd, info, symbol + addend, &value); - overflowed_p = mips_elf_overflow_p (value, 16); - break; - - case R_MIPS_SUB: - value = symbol - addend; - value &= howto->dst_mask; - break; - - case R_MIPS_HIGHER: - value = mips_elf_higher (addend + symbol); - value &= howto->dst_mask; - break; - - case R_MIPS_HIGHEST: - value = mips_elf_highest (addend + symbol); - value &= howto->dst_mask; - break; - - case R_MIPS_SCN_DISP: - value = symbol + addend - sec->output_offset; - value &= howto->dst_mask; - break; - - case R_MIPS_PJUMP: - case R_MIPS_JALR: - /* Both of these may be ignored. R_MIPS_JALR is an optimization - hint; we could improve performance by honoring that hint. */ - return bfd_reloc_continue; - - case R_MIPS_GNU_VTINHERIT: - case R_MIPS_GNU_VTENTRY: - /* We don't do anything with these at present. */ - return bfd_reloc_continue; - - default: - /* An unrecognized relocation type. */ - return bfd_reloc_notsupported; - } - - /* Store the VALUE for our caller. */ - *valuep = value; - return overflowed_p ? bfd_reloc_overflow : bfd_reloc_ok; -} - -/* Obtain the field relocated by RELOCATION. */ - -static bfd_vma -mips_elf_obtain_contents (howto, relocation, input_bfd, contents) - reloc_howto_type *howto; - const Elf_Internal_Rela *relocation; - bfd *input_bfd; - bfd_byte *contents; -{ - bfd_vma x; - bfd_byte *location = contents + relocation->r_offset; - - /* Obtain the bytes. */ - x = bfd_get (8 * bfd_get_reloc_size (howto), input_bfd, location); - - if ((ELF32_R_TYPE (relocation->r_info) == R_MIPS16_26 - || ELF32_R_TYPE (relocation->r_info) == R_MIPS16_GPREL) - && bfd_little_endian (input_bfd)) - /* The two 16-bit words will be reversed on a little-endian - system. See mips_elf_perform_relocation for more details. */ - x = (((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16)); - - return x; -} - -/* It has been determined that the result of the RELOCATION is the - VALUE. Use HOWTO to place VALUE into the output file at the - appropriate position. The SECTION is the section to which the - relocation applies. If REQUIRE_JALX is true, then the opcode used - for the relocation must be either JAL or JALX, and it is - unconditionally converted to JALX. - - Returns false if anything goes wrong. */ - -static boolean -mips_elf_perform_relocation (info, howto, relocation, value, - input_bfd, input_section, - contents, require_jalx) - struct bfd_link_info *info; - reloc_howto_type *howto; - const Elf_Internal_Rela *relocation; - bfd_vma value; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - boolean require_jalx; -{ - bfd_vma x; - bfd_byte *location; - int r_type = ELF32_R_TYPE (relocation->r_info); - - /* Figure out where the relocation is occurring. */ - location = contents + relocation->r_offset; - - /* Obtain the current value. */ - x = mips_elf_obtain_contents (howto, relocation, input_bfd, contents); - - /* Clear the field we are setting. */ - x &= ~howto->dst_mask; - - /* If this is the R_MIPS16_26 relocation, we must store the - value in a funny way. */ - if (r_type == R_MIPS16_26) - { - /* R_MIPS16_26 is used for the mips16 jal and jalx instructions. - Most mips16 instructions are 16 bits, but these instructions - are 32 bits. - - The format of these instructions is: - - +--------------+--------------------------------+ - ! JALX ! X! Imm 20:16 ! Imm 25:21 ! - +--------------+--------------------------------+ - ! Immediate 15:0 ! - +-----------------------------------------------+ - - JALX is the 5-bit value 00011. X is 0 for jal, 1 for jalx. - Note that the immediate value in the first word is swapped. - - When producing a relocateable object file, R_MIPS16_26 is - handled mostly like R_MIPS_26. In particular, the addend is - stored as a straight 26-bit value in a 32-bit instruction. - (gas makes life simpler for itself by never adjusting a - R_MIPS16_26 reloc to be against a section, so the addend is - always zero). However, the 32 bit instruction is stored as 2 - 16-bit values, rather than a single 32-bit value. In a - big-endian file, the result is the same; in a little-endian - file, the two 16-bit halves of the 32 bit value are swapped. - This is so that a disassembler can recognize the jal - instruction. - - When doing a final link, R_MIPS16_26 is treated as a 32 bit - instruction stored as two 16-bit values. The addend A is the - contents of the targ26 field. The calculation is the same as - R_MIPS_26. When storing the calculated value, reorder the - immediate value as shown above, and don't forget to store the - value as two 16-bit values. - - To put it in MIPS ABI terms, the relocation field is T-targ26-16, - defined as - - big-endian: - +--------+----------------------+ - | | | - | | targ26-16 | - |31 26|25 0| - +--------+----------------------+ - - little-endian: - +----------+------+-------------+ - | | | | - | sub1 | | sub2 | - |0 9|10 15|16 31| - +----------+--------------------+ - where targ26-16 is sub1 followed by sub2 (i.e., the addend field A is - ((sub1 << 16) | sub2)). - - When producing a relocateable object file, the calculation is - (((A < 2) | (P & 0xf0000000) + S) >> 2) - When producing a fully linked file, the calculation is - let R = (((A < 2) | (P & 0xf0000000) + S) >> 2) - ((R & 0x1f0000) << 5) | ((R & 0x3e00000) >> 5) | (R & 0xffff) */ - - if (!info->relocateable) - /* Shuffle the bits according to the formula above. */ - value = (((value & 0x1f0000) << 5) - | ((value & 0x3e00000) >> 5) - | (value & 0xffff)); - - } - else if (r_type == R_MIPS16_GPREL) - { - /* R_MIPS16_GPREL is used for GP-relative addressing in mips16 - mode. A typical instruction will have a format like this: - - +--------------+--------------------------------+ - ! EXTEND ! Imm 10:5 ! Imm 15:11 ! - +--------------+--------------------------------+ - ! Major ! rx ! ry ! Imm 4:0 ! - +--------------+--------------------------------+ - - EXTEND is the five bit value 11110. Major is the instruction - opcode. - - This is handled exactly like R_MIPS_GPREL16, except that the - addend is retrieved and stored as shown in this diagram; that - is, the Imm fields above replace the V-rel16 field. - - All we need to do here is shuffle the bits appropriately. As - above, the two 16-bit halves must be swapped on a - little-endian system. */ - value = (((value & 0x7e0) << 16) - | ((value & 0xf800) << 5) - | (value & 0x1f)); - } - - /* Set the field. */ - x |= (value & howto->dst_mask); - - /* If required, turn JAL into JALX. */ - if (require_jalx) - { - boolean ok; - bfd_vma opcode = x >> 26; - bfd_vma jalx_opcode; - - /* Check to see if the opcode is already JAL or JALX. */ - if (r_type == R_MIPS16_26) - { - ok = ((opcode == 0x6) || (opcode == 0x7)); - jalx_opcode = 0x7; - } - else - { - ok = ((opcode == 0x3) || (opcode == 0x1d)); - jalx_opcode = 0x1d; - } - - /* If the opcode is not JAL or JALX, there's a problem. */ - if (!ok) - { - (*_bfd_error_handler) - (_("%s: %s+0x%lx: jump to stub routine which is not jal"), - bfd_get_filename (input_bfd), - input_section->name, - (unsigned long) relocation->r_offset); - bfd_set_error (bfd_error_bad_value); - return false; - } - - /* Make this the JALX opcode. */ - x = (x & ~(0x3f << 26)) | (jalx_opcode << 26); - } - - /* Swap the high- and low-order 16 bits on little-endian systems - when doing a MIPS16 relocation. */ - if ((r_type == R_MIPS16_GPREL || r_type == R_MIPS16_26) - && bfd_little_endian (input_bfd)) - x = (((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16)); - - /* Put the value into the output. */ - bfd_put (8 * bfd_get_reloc_size (howto), input_bfd, x, location); - return true; -} - -/* Returns true if SECTION is a MIPS16 stub section. */ - -static boolean -mips_elf_stub_section_p (abfd, section) - bfd *abfd ATTRIBUTE_UNUSED; - asection *section; -{ - const char *name = bfd_get_section_name (abfd, section); - - return (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0 - || strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0 - || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0); -} - -/* Relocate a MIPS ELF section. */ - -boolean -_bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, - contents, relocs, local_syms, local_sections) - bfd *output_bfd; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - Elf_Internal_Rela *relocs; - Elf_Internal_Sym *local_syms; - asection **local_sections; -{ - Elf_Internal_Rela *rel; - const Elf_Internal_Rela *relend; - bfd_vma addend = 0; - boolean use_saved_addend_p = false; - struct elf_backend_data *bed; - - bed = get_elf_backend_data (output_bfd); - relend = relocs + input_section->reloc_count * bed->s->int_rels_per_ext_rel; - for (rel = relocs; rel < relend; ++rel) - { - const char *name; - bfd_vma value; - reloc_howto_type *howto; - boolean require_jalx; - /* True if the relocation is a RELA relocation, rather than a - REL relocation. */ - boolean rela_relocation_p = true; - int r_type = ELF32_R_TYPE (rel->r_info); - - /* Find the relocation howto for this relocation. */ - if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd)) - { - /* Some 32-bit code uses R_MIPS_64. In particular, people use - 64-bit code, but make sure all their addresses are in the - lowermost or uppermost 32-bit section of the 64-bit address - space. Thus, when they use an R_MIPS_64 they mean what is - usually meant by R_MIPS_32, with the exception that the - stored value is sign-extended to 64 bits. */ - howto = elf_mips_howto_table + R_MIPS_32; - - /* On big-endian systems, we need to lie about the position - of the reloc. */ - if (bfd_big_endian (input_bfd)) - rel->r_offset += 4; - } - else - howto = mips_rtype_to_howto (r_type); - - if (!use_saved_addend_p) - { - Elf_Internal_Shdr *rel_hdr; - - /* If these relocations were originally of the REL variety, - we must pull the addend out of the field that will be - relocated. Otherwise, we simply use the contents of the - RELA relocation. To determine which flavor or relocation - this is, we depend on the fact that the INPUT_SECTION's - REL_HDR is read before its REL_HDR2. */ - rel_hdr = &elf_section_data (input_section)->rel_hdr; - if ((size_t) (rel - relocs) - >= (rel_hdr->sh_size / rel_hdr->sh_entsize - * bed->s->int_rels_per_ext_rel)) - rel_hdr = elf_section_data (input_section)->rel_hdr2; - if (rel_hdr->sh_entsize == MIPS_ELF_REL_SIZE (input_bfd)) - { - /* Note that this is a REL relocation. */ - rela_relocation_p = false; - - /* Get the addend, which is stored in the input file. */ - addend = mips_elf_obtain_contents (howto, - rel, - input_bfd, - contents); - addend &= howto->src_mask; - - /* For some kinds of relocations, the ADDEND is a - combination of the addend stored in two different - relocations. */ - if (r_type == R_MIPS_HI16 - || r_type == R_MIPS_GNU_REL_HI16 - || (r_type == R_MIPS_GOT16 - && mips_elf_local_relocation_p (input_bfd, rel, - local_sections))) - { - bfd_vma l; - const Elf_Internal_Rela *lo16_relocation; - reloc_howto_type *lo16_howto; - int lo; - - /* The combined value is the sum of the HI16 addend, - left-shifted by sixteen bits, and the LO16 - addend, sign extended. (Usually, the code does - a `lui' of the HI16 value, and then an `addiu' of - the LO16 value.) - - Scan ahead to find a matching LO16 relocation. */ - if (r_type == R_MIPS_GNU_REL_HI16) - lo = R_MIPS_GNU_REL_LO16; - else - lo = R_MIPS_LO16; - lo16_relocation - = mips_elf_next_relocation (lo, rel, relend); - if (lo16_relocation == NULL) - return false; - - /* Obtain the addend kept there. */ - lo16_howto = mips_rtype_to_howto (lo); - l = mips_elf_obtain_contents (lo16_howto, - lo16_relocation, - input_bfd, contents); - l &= lo16_howto->src_mask; - l = mips_elf_sign_extend (l, 16); - - addend <<= 16; - - /* Compute the combined addend. */ - addend += l; - } - else if (r_type == R_MIPS16_GPREL) - { - /* The addend is scrambled in the object file. See - mips_elf_perform_relocation for details on the - format. */ - addend = (((addend & 0x1f0000) >> 5) - | ((addend & 0x7e00000) >> 16) - | (addend & 0x1f)); - } - } - else - addend = rel->r_addend; - } - - if (info->relocateable) - { - Elf_Internal_Sym *sym; - unsigned long r_symndx; - - if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd) - && bfd_big_endian (input_bfd)) - rel->r_offset -= 4; - - /* Since we're just relocating, all we need to do is copy - the relocations back out to the object file, unless - they're against a section symbol, in which case we need - to adjust by the section offset, or unless they're GP - relative in which case we need to adjust by the amount - that we're adjusting GP in this relocateable object. */ - - if (!mips_elf_local_relocation_p (input_bfd, rel, local_sections)) - /* There's nothing to do for non-local relocations. */ - continue; - - if (r_type == R_MIPS16_GPREL - || r_type == R_MIPS_GPREL16 - || r_type == R_MIPS_GPREL32 - || r_type == R_MIPS_LITERAL) - addend -= (_bfd_get_gp_value (output_bfd) - - _bfd_get_gp_value (input_bfd)); - else if (r_type == R_MIPS_26 || r_type == R_MIPS16_26 - || r_type == R_MIPS_GNU_REL16_S2) - /* The addend is stored without its two least - significant bits (which are always zero.) In a - non-relocateable link, calculate_relocation will do - this shift; here, we must do it ourselves. */ - addend <<= 2; - - r_symndx = ELF32_R_SYM (rel->r_info); - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - /* Adjust the addend appropriately. */ - addend += local_sections[r_symndx]->output_offset; - - /* If the relocation is for a R_MIPS_HI16 or R_MIPS_GOT16, - then we only want to write out the high-order 16 bits. - The subsequent R_MIPS_LO16 will handle the low-order bits. */ - if (r_type == R_MIPS_HI16 || r_type == R_MIPS_GOT16 - || r_type == R_MIPS_GNU_REL_HI16) - addend = mips_elf_high (addend); - /* If the relocation is for an R_MIPS_26 relocation, then - the two low-order bits are not stored in the object file; - they are implicitly zero. */ - else if (r_type == R_MIPS_26 || r_type == R_MIPS16_26 - || r_type == R_MIPS_GNU_REL16_S2) - addend >>= 2; - - if (rela_relocation_p) - /* If this is a RELA relocation, just update the addend. - We have to cast away constness for REL. */ - rel->r_addend = addend; - else - { - /* Otherwise, we have to write the value back out. Note - that we use the source mask, rather than the - destination mask because the place to which we are - writing will be source of the addend in the final - link. */ - addend &= howto->src_mask; - - if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd)) - /* See the comment above about using R_MIPS_64 in the 32-bit - ABI. Here, we need to update the addend. It would be - possible to get away with just using the R_MIPS_32 reloc - but for endianness. */ - { - bfd_vma sign_bits; - bfd_vma low_bits; - bfd_vma high_bits; - - if (addend & 0x80000000u) - sign_bits = 0xffffffffu; - else - sign_bits = 0; - - /* If we don't know that we have a 64-bit type, - do two separate stores. */ - if (bfd_big_endian (input_bfd)) - { - /* Store the sign-bits (which are most significant) - first. */ - low_bits = sign_bits; - high_bits = addend; - } - else - { - low_bits = addend; - high_bits = sign_bits; - } - bfd_put_32 (input_bfd, low_bits, - contents + rel->r_offset); - bfd_put_32 (input_bfd, high_bits, - contents + rel->r_offset + 4); - continue; - } - - if (!mips_elf_perform_relocation (info, howto, rel, addend, - input_bfd, input_section, - contents, false)) - return false; - } - - /* Go on to the next relocation. */ - continue; - } - - /* In the N32 and 64-bit ABIs there may be multiple consecutive - relocations for the same offset. In that case we are - supposed to treat the output of each relocation as the addend - for the next. */ - if (rel + 1 < relend - && rel->r_offset == rel[1].r_offset - && ELF32_R_TYPE (rel[1].r_info) != R_MIPS_NONE) - use_saved_addend_p = true; - else - use_saved_addend_p = false; - - /* Figure out what value we are supposed to relocate. */ - switch (mips_elf_calculate_relocation (output_bfd, - input_bfd, - input_section, - info, - rel, - addend, - howto, - local_syms, - local_sections, - &value, - &name, - &require_jalx)) - { - case bfd_reloc_continue: - /* There's nothing to do. */ - continue; - - case bfd_reloc_undefined: - /* mips_elf_calculate_relocation already called the - undefined_symbol callback. There's no real point in - trying to perform the relocation at this point, so we - just skip ahead to the next relocation. */ - continue; - - case bfd_reloc_notsupported: - abort (); - break; - - case bfd_reloc_overflow: - if (use_saved_addend_p) - /* Ignore overflow until we reach the last relocation for - a given location. */ - ; - else - { - BFD_ASSERT (name != NULL); - if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rel->r_offset))) - return false; - } - break; - - case bfd_reloc_ok: - break; - - default: - abort (); - break; - } - - /* If we've got another relocation for the address, keep going - until we reach the last one. */ - if (use_saved_addend_p) - { - addend = value; - continue; - } - - if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd)) - /* See the comment above about using R_MIPS_64 in the 32-bit - ABI. Until now, we've been using the HOWTO for R_MIPS_32; - that calculated the right value. Now, however, we - sign-extend the 32-bit result to 64-bits, and store it as a - 64-bit value. We are especially generous here in that we - go to extreme lengths to support this usage on systems with - only a 32-bit VMA. */ - { - bfd_vma sign_bits; - bfd_vma low_bits; - bfd_vma high_bits; - - if (value & 0x80000000u) - sign_bits = 0xffffffffu; - else - sign_bits = 0; - - /* If we don't know that we have a 64-bit type, - do two separate stores. */ - if (bfd_big_endian (input_bfd)) - { - /* Undo what we did above. */ - rel->r_offset -= 4; - /* Store the sign-bits (which are most significant) - first. */ - low_bits = sign_bits; - high_bits = value; - } - else - { - low_bits = value; - high_bits = sign_bits; - } - bfd_put_32 (input_bfd, low_bits, - contents + rel->r_offset); - bfd_put_32 (input_bfd, high_bits, - contents + rel->r_offset + 4); - continue; - } - - /* Actually perform the relocation. */ - if (!mips_elf_perform_relocation (info, howto, rel, value, input_bfd, - input_section, contents, - require_jalx)) - return false; - } - - return true; -} - -/* This hook function is called before the linker writes out a global - symbol. We mark symbols as small common if appropriate. This is - also where we undo the increment of the value for a mips16 symbol. */ - -/*ARGSIGNORED*/ -boolean -_bfd_mips_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - const char *name ATTRIBUTE_UNUSED; - Elf_Internal_Sym *sym; - asection *input_sec; -{ - /* If we see a common symbol, which implies a relocatable link, then - if a symbol was small common in an input file, mark it as small - common in the output file. */ - if (sym->st_shndx == SHN_COMMON - && strcmp (input_sec->name, ".scommon") == 0) - sym->st_shndx = SHN_MIPS_SCOMMON; - - if (sym->st_other == STO_MIPS16 - && (sym->st_value & 1) != 0) - --sym->st_value; - - return true; -} - -/* Functions for the dynamic linker. */ - -/* The name of the dynamic interpreter. This is put in the .interp - section. */ - -#define ELF_DYNAMIC_INTERPRETER(abfd) \ - (ABI_N32_P (abfd) ? "/usr/lib32/libc.so.1" \ - : ABI_64_P (abfd) ? "/usr/lib64/libc.so.1" \ - : "/usr/lib/libc.so.1") - -/* Create dynamic sections when linking against a dynamic object. */ - -boolean -_bfd_mips_elf_create_dynamic_sections (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - struct elf_link_hash_entry *h; - flagword flags; - register asection *s; - const char * const *namep; - - flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED | SEC_READONLY); - - /* Mips ABI requests the .dynamic section to be read only. */ - s = bfd_get_section_by_name (abfd, ".dynamic"); - if (s != NULL) - { - if (! bfd_set_section_flags (abfd, s, flags)) - return false; - } - - /* We need to create .got section. */ - if (! mips_elf_create_got_section (abfd, info)) - return false; - - /* Create the .msym section on IRIX6. It is used by the dynamic - linker to speed up dynamic relocations, and to avoid computing - the ELF hash for symbols. */ - if (IRIX_COMPAT (abfd) == ict_irix6 - && !mips_elf_create_msym_section (abfd)) - return false; - - /* Create .stub section. */ - if (bfd_get_section_by_name (abfd, - MIPS_ELF_STUB_SECTION_NAME (abfd)) == NULL) - { - s = bfd_make_section (abfd, MIPS_ELF_STUB_SECTION_NAME (abfd)); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_CODE) - || ! bfd_set_section_alignment (abfd, s, - MIPS_ELF_LOG_FILE_ALIGN (abfd))) - return false; - } - - if (IRIX_COMPAT (abfd) == ict_irix5 - && !info->shared - && bfd_get_section_by_name (abfd, ".rld_map") == NULL) - { - s = bfd_make_section (abfd, ".rld_map"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags & ~SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, - MIPS_ELF_LOG_FILE_ALIGN (abfd))) - return false; - } - - /* On IRIX5, we adjust add some additional symbols and change the - alignments of several sections. There is no ABI documentation - indicating that this is necessary on IRIX6, nor any evidence that - the linker takes such action. */ - if (IRIX_COMPAT (abfd) == ict_irix5) - { - for (namep = mips_elf_dynsym_rtproc_names; *namep != NULL; namep++) - { - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, *namep, BSF_GLOBAL, bfd_und_section_ptr, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_SECTION; - - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - } - - /* We need to create a .compact_rel section. */ - if (! mips_elf_create_compact_rel_section (abfd, info)) - return false; - - /* Change aligments of some sections. */ - s = bfd_get_section_by_name (abfd, ".hash"); - if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); - s = bfd_get_section_by_name (abfd, ".dynsym"); - if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); - s = bfd_get_section_by_name (abfd, ".dynstr"); - if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); - s = bfd_get_section_by_name (abfd, ".reginfo"); - if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); - s = bfd_get_section_by_name (abfd, ".dynamic"); - if (s != NULL) - bfd_set_section_alignment (abfd, s, 4); - } - - if (!info->shared) - { - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, "_DYNAMIC_LINK", BSF_GLOBAL, bfd_abs_section_ptr, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_SECTION; - - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - - if (! mips_elf_hash_table (info)->use_rld_obj_head) - { - /* __rld_map is a four byte word located in the .data section - and is filled in by the rtld to contain a pointer to - the _r_debug structure. Its symbol value will be set in - mips_elf_finish_dynamic_symbol. */ - s = bfd_get_section_by_name (abfd, ".rld_map"); - BFD_ASSERT (s != NULL); - - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, "__rld_map", BSF_GLOBAL, s, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - } - } - - return true; -} - -/* Create the .compact_rel section. */ - -static boolean -mips_elf_create_compact_rel_section (abfd, info) - bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; -{ - flagword flags; - register asection *s; - - if (bfd_get_section_by_name (abfd, ".compact_rel") == NULL) - { - flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED - | SEC_READONLY); - - s = bfd_make_section (abfd, ".compact_rel"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) - || ! bfd_set_section_alignment (abfd, s, - MIPS_ELF_LOG_FILE_ALIGN (abfd))) - return false; - - s->_raw_size = sizeof (Elf32_External_compact_rel); - } - - return true; -} - -/* Create the .got section to hold the global offset table. */ - -static boolean -mips_elf_create_got_section (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - flagword flags; - register asection *s; - struct elf_link_hash_entry *h; - struct mips_got_info *g; - - /* This function may be called more than once. */ - if (mips_elf_got_section (abfd)) - return true; - - flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED); - - s = bfd_make_section (abfd, ".got"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) - || ! bfd_set_section_alignment (abfd, s, 4)) - return false; - - /* Define the symbol _GLOBAL_OFFSET_TABLE_. We don't do this in the - linker script because we don't want to define the symbol if we - are not creating a global offset table. */ - h = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (info->shared - && ! bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - - /* The first several global offset table entries are reserved. */ - s->_raw_size = MIPS_RESERVED_GOTNO * MIPS_ELF_GOT_SIZE (abfd); - - g = (struct mips_got_info *) bfd_alloc (abfd, - sizeof (struct mips_got_info)); - if (g == NULL) - return false; - g->global_gotsym = NULL; - g->local_gotno = MIPS_RESERVED_GOTNO; - g->assigned_gotno = MIPS_RESERVED_GOTNO; - if (elf_section_data (s) == NULL) - { - s->used_by_bfd = - (PTR) bfd_zalloc (abfd, sizeof (struct bfd_elf_section_data)); - if (elf_section_data (s) == NULL) - return false; - } - elf_section_data (s)->tdata = (PTR) g; - elf_section_data (s)->this_hdr.sh_flags - |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL; - - return true; -} - -/* Returns the .msym section for ABFD, creating it if it does not - already exist. Returns NULL to indicate error. */ - -static asection * -mips_elf_create_msym_section (abfd) - bfd *abfd; -{ - asection *s; - - s = bfd_get_section_by_name (abfd, MIPS_ELF_MSYM_SECTION_NAME (abfd)); - if (!s) - { - s = bfd_make_section (abfd, MIPS_ELF_MSYM_SECTION_NAME (abfd)); - if (!s - || !bfd_set_section_flags (abfd, s, - SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_LINKER_CREATED - | SEC_READONLY) - || !bfd_set_section_alignment (abfd, s, - MIPS_ELF_LOG_FILE_ALIGN (abfd))) - return NULL; - } - - return s; -} - -/* Add room for N relocations to the .rel.dyn section in ABFD. */ - -static void -mips_elf_allocate_dynamic_relocations (abfd, n) - bfd *abfd; - unsigned int n; -{ - asection *s; - - s = bfd_get_section_by_name (abfd, MIPS_ELF_REL_DYN_SECTION_NAME (abfd)); - BFD_ASSERT (s != NULL); - - if (s->_raw_size == 0) - { - /* Make room for a null element. */ - s->_raw_size += MIPS_ELF_REL_SIZE (abfd); - ++s->reloc_count; - } - s->_raw_size += n * MIPS_ELF_REL_SIZE (abfd); -} - -/* Look through the relocs for a section during the first phase, and - allocate space in the global offset table. */ - -boolean -_bfd_mips_elf_check_relocs (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; -{ - const char *name; - bfd *dynobj; - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - struct mips_got_info *g; - size_t extsymoff; - const Elf_Internal_Rela *rel; - const Elf_Internal_Rela *rel_end; - asection *sgot; - asection *sreloc; - struct elf_backend_data *bed; - - if (info->relocateable) - return true; - - dynobj = elf_hash_table (info)->dynobj; - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (abfd); - extsymoff = (elf_bad_symtab (abfd)) ? 0 : symtab_hdr->sh_info; - - /* Check for the mips16 stub sections. */ - - name = bfd_get_section_name (abfd, sec); - if (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0) - { - unsigned long r_symndx; - - /* Look at the relocation information to figure out which symbol - this is for. */ - - r_symndx = ELF32_R_SYM (relocs->r_info); - - if (r_symndx < extsymoff - || sym_hashes[r_symndx - extsymoff] == NULL) - { - asection *o; - - /* This stub is for a local symbol. This stub will only be - needed if there is some relocation in this BFD, other - than a 16 bit function call, which refers to this symbol. */ - for (o = abfd->sections; o != NULL; o = o->next) - { - Elf_Internal_Rela *sec_relocs; - const Elf_Internal_Rela *r, *rend; - - /* We can ignore stub sections when looking for relocs. */ - if ((o->flags & SEC_RELOC) == 0 - || o->reloc_count == 0 - || strncmp (bfd_get_section_name (abfd, o), FN_STUB, - sizeof FN_STUB - 1) == 0 - || strncmp (bfd_get_section_name (abfd, o), CALL_STUB, - sizeof CALL_STUB - 1) == 0 - || strncmp (bfd_get_section_name (abfd, o), CALL_FP_STUB, - sizeof CALL_FP_STUB - 1) == 0) - continue; - - sec_relocs = (_bfd_elf32_link_read_relocs - (abfd, o, (PTR) NULL, - (Elf_Internal_Rela *) NULL, - info->keep_memory)); - if (sec_relocs == NULL) - return false; - - rend = sec_relocs + o->reloc_count; - for (r = sec_relocs; r < rend; r++) - if (ELF32_R_SYM (r->r_info) == r_symndx - && ELF32_R_TYPE (r->r_info) != R_MIPS16_26) - break; - - if (! info->keep_memory) - free (sec_relocs); - - if (r < rend) - break; - } - - if (o == NULL) - { - /* There is no non-call reloc for this stub, so we do - not need it. Since this function is called before - the linker maps input sections to output sections, we - can easily discard it by setting the SEC_EXCLUDE - flag. */ - sec->flags |= SEC_EXCLUDE; - return true; - } - - /* Record this stub in an array of local symbol stubs for - this BFD. */ - if (elf_tdata (abfd)->local_stubs == NULL) - { - unsigned long symcount; - asection **n; - - if (elf_bad_symtab (abfd)) - symcount = symtab_hdr->sh_size / symtab_hdr->sh_entsize; - else - symcount = symtab_hdr->sh_info; - n = (asection **) bfd_zalloc (abfd, - symcount * sizeof (asection *)); - if (n == NULL) - return false; - elf_tdata (abfd)->local_stubs = n; - } - - elf_tdata (abfd)->local_stubs[r_symndx] = sec; - - /* We don't need to set mips16_stubs_seen in this case. - That flag is used to see whether we need to look through - the global symbol table for stubs. We don't need to set - it here, because we just have a local stub. */ - } - else - { - struct mips_elf_link_hash_entry *h; - - h = ((struct mips_elf_link_hash_entry *) - sym_hashes[r_symndx - extsymoff]); - - /* H is the symbol this stub is for. */ - - h->fn_stub = sec; - mips_elf_hash_table (info)->mips16_stubs_seen = true; - } - } - else if (strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0 - || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0) - { - unsigned long r_symndx; - struct mips_elf_link_hash_entry *h; - asection **loc; - - /* Look at the relocation information to figure out which symbol - this is for. */ - - r_symndx = ELF32_R_SYM (relocs->r_info); - - if (r_symndx < extsymoff - || sym_hashes[r_symndx - extsymoff] == NULL) - { - /* This stub was actually built for a static symbol defined - in the same file. We assume that all static symbols in - mips16 code are themselves mips16, so we can simply - discard this stub. Since this function is called before - the linker maps input sections to output sections, we can - easily discard it by setting the SEC_EXCLUDE flag. */ - sec->flags |= SEC_EXCLUDE; - return true; - } - - h = ((struct mips_elf_link_hash_entry *) - sym_hashes[r_symndx - extsymoff]); - - /* H is the symbol this stub is for. */ - - if (strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0) - loc = &h->call_fp_stub; - else - loc = &h->call_stub; - - /* If we already have an appropriate stub for this function, we - don't need another one, so we can discard this one. Since - this function is called before the linker maps input sections - to output sections, we can easily discard it by setting the - SEC_EXCLUDE flag. We can also discard this section if we - happen to already know that this is a mips16 function; it is - not necessary to check this here, as it is checked later, but - it is slightly faster to check now. */ - if (*loc != NULL || h->root.other == STO_MIPS16) - { - sec->flags |= SEC_EXCLUDE; - return true; - } - - *loc = sec; - mips_elf_hash_table (info)->mips16_stubs_seen = true; - } - - if (dynobj == NULL) - { - sgot = NULL; - g = NULL; - } - else - { - sgot = mips_elf_got_section (dynobj); - if (sgot == NULL) - g = NULL; - else - { - BFD_ASSERT (elf_section_data (sgot) != NULL); - g = (struct mips_got_info *) elf_section_data (sgot)->tdata; - BFD_ASSERT (g != NULL); - } - } - - sreloc = NULL; - bed = get_elf_backend_data (abfd); - rel_end = relocs + sec->reloc_count * bed->s->int_rels_per_ext_rel; - for (rel = relocs; rel < rel_end; ++rel) - { - unsigned long r_symndx; - int r_type; - struct elf_link_hash_entry *h; - - r_symndx = ELF32_R_SYM (rel->r_info); - r_type = ELF32_R_TYPE (rel->r_info); - - if (r_symndx < extsymoff) - h = NULL; - else - { - h = sym_hashes[r_symndx - extsymoff]; - - /* This may be an indirect symbol created because of a version. */ - if (h != NULL) - { - while (h->root.type == bfd_link_hash_indirect) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - } - } - - /* Some relocs require a global offset table. */ - if (dynobj == NULL || sgot == NULL) - { - switch (r_type) - { - case R_MIPS_GOT16: - case R_MIPS_CALL16: - case R_MIPS_CALL_HI16: - case R_MIPS_CALL_LO16: - case R_MIPS_GOT_HI16: - case R_MIPS_GOT_LO16: - case R_MIPS_GOT_PAGE: - case R_MIPS_GOT_OFST: - case R_MIPS_GOT_DISP: - if (dynobj == NULL) - elf_hash_table (info)->dynobj = dynobj = abfd; - if (! mips_elf_create_got_section (dynobj, info)) - return false; - g = mips_elf_got_info (dynobj, &sgot); - break; - - case R_MIPS_32: - case R_MIPS_REL32: - case R_MIPS_64: - if (dynobj == NULL - && (info->shared || h != NULL) - && (sec->flags & SEC_ALLOC) != 0) - elf_hash_table (info)->dynobj = dynobj = abfd; - break; - - default: - break; - } - } - - if (!h && (r_type == R_MIPS_CALL_LO16 - || r_type == R_MIPS_GOT_LO16 - || r_type == R_MIPS_GOT_DISP)) - { - /* We may need a local GOT entry for this relocation. We - don't count R_MIPS_GOT_PAGE because we can estimate the - maximum number of pages needed by looking at the size of - the segment. Similar comments apply to R_MIPS_GOT16. We - don't count R_MIPS_GOT_HI16, or R_MIPS_CALL_HI16 because - these are always followed by an R_MIPS_GOT_LO16 or - R_MIPS_CALL_LO16. - - This estimation is very conservative since we can merge - duplicate entries in the GOT. In order to be less - conservative, we could actually build the GOT here, - rather than in relocate_section. */ - g->local_gotno++; - sgot->_raw_size += MIPS_ELF_GOT_SIZE (dynobj); - } - - switch (r_type) - { - case R_MIPS_CALL16: - if (h == NULL) - { - (*_bfd_error_handler) - (_("%s: CALL16 reloc at 0x%lx not against global symbol"), - bfd_get_filename (abfd), (unsigned long) rel->r_offset); - bfd_set_error (bfd_error_bad_value); - return false; - } - /* Fall through. */ - - case R_MIPS_CALL_HI16: - case R_MIPS_CALL_LO16: - if (h != NULL) - { - /* This symbol requires a global offset table entry. */ - if (!mips_elf_record_global_got_symbol (h, info, g)) - return false; - - /* We need a stub, not a plt entry for the undefined - function. But we record it as if it needs plt. See - elf_adjust_dynamic_symbol in elflink.h. */ - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - h->type = STT_FUNC; - } - break; - - case R_MIPS_GOT16: - case R_MIPS_GOT_HI16: - case R_MIPS_GOT_LO16: - case R_MIPS_GOT_DISP: - /* This symbol requires a global offset table entry. */ - if (h && !mips_elf_record_global_got_symbol (h, info, g)) - return false; - break; - - case R_MIPS_32: - case R_MIPS_REL32: - case R_MIPS_64: - if ((info->shared || h != NULL) - && (sec->flags & SEC_ALLOC) != 0) - { - if (sreloc == NULL) - { - const char *name = MIPS_ELF_REL_DYN_SECTION_NAME (dynobj); - - sreloc = bfd_get_section_by_name (dynobj, name); - if (sreloc == NULL) - { - sreloc = bfd_make_section (dynobj, name); - if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || ! bfd_set_section_alignment (dynobj, sreloc, - 4)) - return false; - } - } - if (info->shared) - /* When creating a shared object, we must copy these - reloc types into the output file as R_MIPS_REL32 - relocs. We make room for this reloc in the - .rel.dyn reloc section. */ - mips_elf_allocate_dynamic_relocations (dynobj, 1); - else - { - struct mips_elf_link_hash_entry *hmips; - - /* We only need to copy this reloc if the symbol is - defined in a dynamic object. */ - hmips = (struct mips_elf_link_hash_entry *) h; - ++hmips->possibly_dynamic_relocs; - } - - /* Even though we don't directly need a GOT entry for - this symbol, a symbol must have a dynamic symbol - table index greater that DT_MIPS_GOTSYM if there are - dynamic relocations against it. */ - if (h != NULL - && !mips_elf_record_global_got_symbol (h, info, g)) - return false; - } - - if (SGI_COMPAT (dynobj)) - mips_elf_hash_table (info)->compact_rel_size += - sizeof (Elf32_External_crinfo); - break; - - case R_MIPS_26: - case R_MIPS_GPREL16: - case R_MIPS_LITERAL: - case R_MIPS_GPREL32: - if (SGI_COMPAT (dynobj)) - mips_elf_hash_table (info)->compact_rel_size += - sizeof (Elf32_External_crinfo); - break; - - /* This relocation describes the C++ object vtable hierarchy. - Reconstruct it for later use during GC. */ - case R_MIPS_GNU_VTINHERIT: - if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) - return false; - break; - - /* This relocation describes which C++ vtable entries are actually - used. Record for later use during GC. */ - case R_MIPS_GNU_VTENTRY: - if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_offset)) - return false; - break; - - default: - break; - } - - /* If this reloc is not a 16 bit call, and it has a global - symbol, then we will need the fn_stub if there is one. - References from a stub section do not count. */ - if (h != NULL - && r_type != R_MIPS16_26 - && strncmp (bfd_get_section_name (abfd, sec), FN_STUB, - sizeof FN_STUB - 1) != 0 - && strncmp (bfd_get_section_name (abfd, sec), CALL_STUB, - sizeof CALL_STUB - 1) != 0 - && strncmp (bfd_get_section_name (abfd, sec), CALL_FP_STUB, - sizeof CALL_FP_STUB - 1) != 0) - { - struct mips_elf_link_hash_entry *mh; - - mh = (struct mips_elf_link_hash_entry *) h; - mh->need_fn_stub = true; - } - } - - return true; -} - -/* Return the section that should be marked against GC for a given - relocation. */ - -asection * -_bfd_mips_elf_gc_mark_hook (abfd, info, rel, h, sym) - bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; -{ - /* ??? Do mips16 stub sections need to be handled special? */ - - if (h != NULL) - { - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_MIPS_GNU_VTINHERIT: - case R_MIPS_GNU_VTENTRY: - break; - - default: - switch (h->root.type) - { - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - return h->root.u.def.section; - - case bfd_link_hash_common: - return h->root.u.c.p->section; - - default: - break; - } - } - } - else - { - if (!(elf_bad_symtab (abfd) - && ELF_ST_BIND (sym->st_info) != STB_LOCAL) - && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE) - && sym->st_shndx != SHN_COMMON)) - { - return bfd_section_from_elf_index (abfd, sym->st_shndx); - } - } - - return NULL; -} - -/* Update the got entry reference counts for the section being removed. */ - -boolean -_bfd_mips_elf_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - asection *sec ATTRIBUTE_UNUSED; - const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; -{ -#if 0 - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - bfd_signed_vma *local_got_refcounts; - const Elf_Internal_Rela *rel, *relend; - unsigned long r_symndx; - struct elf_link_hash_entry *h; - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (abfd); - local_got_refcounts = elf_local_got_refcounts (abfd); - - relend = relocs + sec->reloc_count; - for (rel = relocs; rel < relend; rel++) - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_MIPS_GOT16: - case R_MIPS_CALL16: - case R_MIPS_CALL_HI16: - case R_MIPS_CALL_LO16: - case R_MIPS_GOT_HI16: - case R_MIPS_GOT_LO16: - /* ??? It would seem that the existing MIPS code does no sort - of reference counting or whatnot on its GOT and PLT entries, - so it is not possible to garbage collect them at this time. */ - break; - - default: - break; - } -#endif - - return true; -} - - -/* Adjust a symbol defined by a dynamic object and referenced by a - regular object. The current definition is in some section of the - dynamic object, but we're not including those sections. We have to - change the definition to something the rest of the link can - understand. */ - -boolean -_bfd_mips_elf_adjust_dynamic_symbol (info, h) - struct bfd_link_info *info; - struct elf_link_hash_entry *h; -{ - bfd *dynobj; - struct mips_elf_link_hash_entry *hmips; - asection *s; - - dynobj = elf_hash_table (info)->dynobj; - - /* Make sure we know what is going on here. */ - BFD_ASSERT (dynobj != NULL - && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) - || h->weakdef != NULL - || ((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))); - - /* If this symbol is defined in a dynamic object, we need to copy - any R_MIPS_32 or R_MIPS_REL32 relocs against it into the output - file. */ - hmips = (struct mips_elf_link_hash_entry *) h; - if (! info->relocateable - && hmips->possibly_dynamic_relocs != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - mips_elf_allocate_dynamic_relocations (dynobj, - hmips->possibly_dynamic_relocs); - - /* For a function, create a stub, if needed. */ - if (h->type == STT_FUNC - || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) - { - if (! elf_hash_table (info)->dynamic_sections_created) - return true; - - /* If this symbol is not defined in a regular file, then set - the symbol to the stub location. This is required to make - function pointers compare as equal between the normal - executable and the shared library. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - /* We need .stub section. */ - s = bfd_get_section_by_name (dynobj, - MIPS_ELF_STUB_SECTION_NAME (dynobj)); - BFD_ASSERT (s != NULL); - - h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; - - /* XXX Write this stub address somewhere. */ - h->plt.offset = s->_raw_size; - - /* Make room for this stub code. */ - s->_raw_size += MIPS_FUNCTION_STUB_SIZE; - - /* The last half word of the stub will be filled with the index - of this symbol in .dynsym section. */ - return true; - } - } - - /* If this is a weak symbol, and there is a real definition, the - processor independent code will have arranged for us to see the - real definition first, and we can just use the same value. */ - if (h->weakdef != NULL) - { - BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined - || h->weakdef->root.type == bfd_link_hash_defweak); - h->root.u.def.section = h->weakdef->root.u.def.section; - h->root.u.def.value = h->weakdef->root.u.def.value; - return true; - } - - /* This is a reference to a symbol defined by a dynamic object which - is not a function. */ - - return true; -} - -/* This function is called after all the input files have been read, - and the input sections have been assigned to output sections. We - check for any mips16 stub sections that we can discard. */ - -static boolean mips_elf_check_mips16_stubs - PARAMS ((struct mips_elf_link_hash_entry *, PTR)); - -boolean -_bfd_mips_elf_always_size_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - asection *ri; - - /* The .reginfo section has a fixed size. */ - ri = bfd_get_section_by_name (output_bfd, ".reginfo"); - if (ri != NULL) - bfd_set_section_size (output_bfd, ri, sizeof (Elf32_External_RegInfo)); - - if (info->relocateable - || ! mips_elf_hash_table (info)->mips16_stubs_seen) - return true; - - mips_elf_link_hash_traverse (mips_elf_hash_table (info), - mips_elf_check_mips16_stubs, - (PTR) NULL); - - return true; -} - -/* Check the mips16 stubs for a particular symbol, and see if we can - discard them. */ - -/*ARGSUSED*/ -static boolean -mips_elf_check_mips16_stubs (h, data) - struct mips_elf_link_hash_entry *h; - PTR data ATTRIBUTE_UNUSED; -{ - if (h->fn_stub != NULL - && ! h->need_fn_stub) - { - /* We don't need the fn_stub; the only references to this symbol - are 16 bit calls. Clobber the size to 0 to prevent it from - being included in the link. */ - h->fn_stub->_raw_size = 0; - h->fn_stub->_cooked_size = 0; - h->fn_stub->flags &= ~ SEC_RELOC; - h->fn_stub->reloc_count = 0; - h->fn_stub->flags |= SEC_EXCLUDE; - } - - if (h->call_stub != NULL - && h->root.other == STO_MIPS16) - { - /* We don't need the call_stub; this is a 16 bit function, so - calls from other 16 bit functions are OK. Clobber the size - to 0 to prevent it from being included in the link. */ - h->call_stub->_raw_size = 0; - h->call_stub->_cooked_size = 0; - h->call_stub->flags &= ~ SEC_RELOC; - h->call_stub->reloc_count = 0; - h->call_stub->flags |= SEC_EXCLUDE; - } - - if (h->call_fp_stub != NULL - && h->root.other == STO_MIPS16) - { - /* We don't need the call_stub; this is a 16 bit function, so - calls from other 16 bit functions are OK. Clobber the size - to 0 to prevent it from being included in the link. */ - h->call_fp_stub->_raw_size = 0; - h->call_fp_stub->_cooked_size = 0; - h->call_fp_stub->flags &= ~ SEC_RELOC; - h->call_fp_stub->reloc_count = 0; - h->call_fp_stub->flags |= SEC_EXCLUDE; - } - - return true; -} - -/* Set the sizes of the dynamic sections. */ - -boolean -_bfd_mips_elf_size_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - bfd *dynobj; - asection *s; - boolean reltext; - struct mips_got_info *g = NULL; - - dynobj = elf_hash_table (info)->dynobj; - BFD_ASSERT (dynobj != NULL); - - if (elf_hash_table (info)->dynamic_sections_created) - { - /* Set the contents of the .interp section to the interpreter. */ - if (! info->shared) - { - s = bfd_get_section_by_name (dynobj, ".interp"); - BFD_ASSERT (s != NULL); - s->_raw_size - = strlen (ELF_DYNAMIC_INTERPRETER (output_bfd)) + 1; - s->contents - = (bfd_byte *) ELF_DYNAMIC_INTERPRETER (output_bfd); - } - } - - /* The check_relocs and adjust_dynamic_symbol entry points have - determined the sizes of the various dynamic sections. Allocate - memory for them. */ - reltext = false; - for (s = dynobj->sections; s != NULL; s = s->next) - { - const char *name; - boolean strip; - - /* It's OK to base decisions on the section name, because none - of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); - - if ((s->flags & SEC_LINKER_CREATED) == 0) - continue; - - strip = false; - - if (strncmp (name, ".rel", 4) == 0) - { - if (s->_raw_size == 0) - { - /* We only strip the section if the output section name - has the same name. Otherwise, there might be several - input sections for this output section. FIXME: This - code is probably not needed these days anyhow, since - the linker now does not create empty output sections. */ - if (s->output_section != NULL - && strcmp (name, - bfd_get_section_name (s->output_section->owner, - s->output_section)) == 0) - strip = true; - } - else - { - const char *outname; - asection *target; - - /* If this relocation section applies to a read only - section, then we probably need a DT_TEXTREL entry. - If the relocation section is .rel.dyn, we always - assert a DT_TEXTREL entry rather than testing whether - there exists a relocation to a read only section or - not. */ - outname = bfd_get_section_name (output_bfd, - s->output_section); - target = bfd_get_section_by_name (output_bfd, outname + 4); - if ((target != NULL - && (target->flags & SEC_READONLY) != 0 - && (target->flags & SEC_ALLOC) != 0) - || strcmp (outname, - MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)) == 0) - reltext = true; - - /* We use the reloc_count field as a counter if we need - to copy relocs into the output file. */ - if (strcmp (name, - MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)) != 0) - s->reloc_count = 0; - } - } - else if (strncmp (name, ".got", 4) == 0) - { - int i; - bfd_size_type loadable_size = 0; - bfd_size_type local_gotno; - struct _bfd *sub; - - BFD_ASSERT (elf_section_data (s) != NULL); - g = (struct mips_got_info *) elf_section_data (s)->tdata; - BFD_ASSERT (g != NULL); - - /* Calculate the total loadable size of the output. That - will give us the maximum number of GOT_PAGE entries - required. */ - for (sub = info->input_bfds; sub; sub = sub->link_next) - { - asection *subsection; - - for (subsection = sub->sections; - subsection; - subsection = subsection->next) - { - if ((subsection->flags & SEC_ALLOC) == 0) - continue; - loadable_size += (subsection->_raw_size + 0xf) & ~0xf; - } - } - loadable_size += MIPS_FUNCTION_STUB_SIZE; - - /* Assume there are two loadable segments consisting of - contiguous sections. Is 5 enough? */ - local_gotno = (loadable_size >> 16) + 5; - if (IRIX_COMPAT (output_bfd) == ict_irix6) - /* It's possible we will need GOT_PAGE entries as well as - GOT16 entries. Often, these will be able to share GOT - entries, but not always. */ - local_gotno *= 2; - - g->local_gotno += local_gotno; - s->_raw_size += local_gotno * MIPS_ELF_GOT_SIZE (dynobj); - - /* There has to be a global GOT entry for every symbol with - a dynamic symbol table index of DT_MIPS_GOTSYM or - higher. Therefore, it make sense to put those symbols - that need GOT entries at the end of the symbol table. We - do that here. */ - if (!mips_elf_sort_hash_table (info, 1)) - return false; - - if (g->global_gotsym != NULL) - i = elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx; - else - /* If there are no global symbols, or none requiring - relocations, then GLOBAL_GOTSYM will be NULL. */ - i = 0; - g->global_gotno = i; - s->_raw_size += i * MIPS_ELF_GOT_SIZE (dynobj); - } - else if (strcmp (name, MIPS_ELF_STUB_SECTION_NAME (output_bfd)) == 0) - { - /* Irix rld assumes that the function stub isn't at the end - of .text section. So put a dummy. XXX */ - s->_raw_size += MIPS_FUNCTION_STUB_SIZE; - } - else if (! info->shared - && ! mips_elf_hash_table (info)->use_rld_obj_head - && strncmp (name, ".rld_map", 8) == 0) - { - /* We add a room for __rld_map. It will be filled in by the - rtld to contain a pointer to the _r_debug structure. */ - s->_raw_size += 4; - } - else if (SGI_COMPAT (output_bfd) - && strncmp (name, ".compact_rel", 12) == 0) - s->_raw_size += mips_elf_hash_table (info)->compact_rel_size; - else if (strcmp (name, MIPS_ELF_MSYM_SECTION_NAME (output_bfd)) - == 0) - s->_raw_size = (sizeof (Elf32_External_Msym) - * (elf_hash_table (info)->dynsymcount - + bfd_count_sections (output_bfd))); - else if (strncmp (name, ".init", 5) != 0) - { - /* It's not one of our sections, so don't allocate space. */ - continue; - } - - if (strip) - { - _bfd_strip_section_from_output (info, s); - continue; - } - - /* Allocate memory for the section contents. */ - s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - } - - if (elf_hash_table (info)->dynamic_sections_created) - { - /* Add some entries to the .dynamic section. We fill in the - values later, in elf_mips_finish_dynamic_sections, but we - must add the entries now so that we get the correct size for - the .dynamic section. The DT_DEBUG entry is filled in by the - dynamic linker and used by the debugger. */ - if (! info->shared) - { - if (SGI_COMPAT (output_bfd)) - { - /* SGI object has the equivalence of DT_DEBUG in the - DT_MIPS_RLD_MAP entry. */ - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0)) - return false; - } - else - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0)) - return false; - } - - if (reltext) - { - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0)) - return false; - } - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTGOT, 0)) - return false; - - if (bfd_get_section_by_name (dynobj, - MIPS_ELF_REL_DYN_SECTION_NAME (dynobj))) - { - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_REL, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELSZ, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELENT, 0)) - return false; - } - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICTNO, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLISTNO, 0)) - return false; - - if (bfd_get_section_by_name (dynobj, ".conflict") != NULL) - { - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICT, 0)) - return false; - - s = bfd_get_section_by_name (dynobj, ".liblist"); - BFD_ASSERT (s != NULL); - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLIST, 0)) - return false; - } - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_VERSION, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_FLAGS, 0)) - return false; - -#if 0 - /* Time stamps in executable files are a bad idea. */ - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_TIME_STAMP, 0)) - return false; -#endif - -#if 0 /* FIXME */ - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_ICHECKSUM, 0)) - return false; -#endif - -#if 0 /* FIXME */ - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_IVERSION, 0)) - return false; -#endif - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_BASE_ADDRESS, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LOCAL_GOTNO, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_SYMTABNO, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_UNREFEXTNO, 0)) - return false; - - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_GOTSYM, 0)) - return false; - - if (IRIX_COMPAT (dynobj) == ict_irix5 - && ! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_HIPAGENO, 0)) - return false; - - if (IRIX_COMPAT (dynobj) == ict_irix6 - && (bfd_get_section_by_name - (dynobj, MIPS_ELF_OPTIONS_SECTION_NAME (dynobj))) - && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_OPTIONS, 0)) - return false; - - if (bfd_get_section_by_name (dynobj, - MIPS_ELF_MSYM_SECTION_NAME (dynobj)) - && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_MSYM, 0)) - return false; - } - - return true; -} - -/* If NAME is one of the special IRIX6 symbols defined by the linker, - adjust it appropriately now. */ - -static void -mips_elf_irix6_finish_dynamic_symbol (abfd, name, sym) - bfd *abfd ATTRIBUTE_UNUSED; - const char *name; - Elf_Internal_Sym *sym; -{ - /* The linker script takes care of providing names and values for - these, but we must place them into the right sections. */ - static const char* const text_section_symbols[] = { - "_ftext", - "_etext", - "__dso_displacement", - "__elf_header", - "__program_header_table", - NULL - }; - - static const char* const data_section_symbols[] = { - "_fdata", - "_edata", - "_end", - "_fbss", - NULL - }; - - const char* const *p; - int i; - - for (i = 0; i < 2; ++i) - for (p = (i == 0) ? text_section_symbols : data_section_symbols; - *p; - ++p) - if (strcmp (*p, name) == 0) - { - /* All of these symbols are given type STT_SECTION by the - IRIX6 linker. */ - sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - - /* The IRIX linker puts these symbols in special sections. */ - if (i == 0) - sym->st_shndx = SHN_MIPS_TEXT; - else - sym->st_shndx = SHN_MIPS_DATA; - - break; - } -} - -/* Finish up dynamic symbol handling. We set the contents of various - dynamic sections here. */ - -boolean -_bfd_mips_elf_finish_dynamic_symbol (output_bfd, info, h, sym) - bfd *output_bfd; - struct bfd_link_info *info; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; -{ - bfd *dynobj; - bfd_vma gval; - asection *sgot; - asection *smsym; - struct mips_got_info *g; - const char *name; - struct mips_elf_link_hash_entry *mh; - - dynobj = elf_hash_table (info)->dynobj; - gval = sym->st_value; - mh = (struct mips_elf_link_hash_entry *) h; - - if (h->plt.offset != (bfd_vma) -1) - { - asection *s; - bfd_byte *p; - bfd_byte stub[MIPS_FUNCTION_STUB_SIZE]; - - /* This symbol has a stub. Set it up. */ - - BFD_ASSERT (h->dynindx != -1); - - s = bfd_get_section_by_name (dynobj, - MIPS_ELF_STUB_SECTION_NAME (dynobj)); - BFD_ASSERT (s != NULL); - - /* Fill the stub. */ - p = stub; - bfd_put_32 (output_bfd, STUB_LW(output_bfd), p); - p += 4; - bfd_put_32 (output_bfd, STUB_MOVE, p); - p += 4; - - /* FIXME: Can h->dynindex be more than 64K? */ - if (h->dynindx & 0xffff0000) - return false; - - bfd_put_32 (output_bfd, STUB_JALR, p); - p += 4; - bfd_put_32 (output_bfd, STUB_LI16 + h->dynindx, p); - - BFD_ASSERT (h->plt.offset <= s->_raw_size); - memcpy (s->contents + h->plt.offset, stub, MIPS_FUNCTION_STUB_SIZE); - - /* Mark the symbol as undefined. plt.offset != -1 occurs - only for the referenced symbol. */ - sym->st_shndx = SHN_UNDEF; - - /* The run-time linker uses the st_value field of the symbol - to reset the global offset table entry for this external - to its stub address when unlinking a shared object. */ - gval = s->output_section->vma + s->output_offset + h->plt.offset; - sym->st_value = gval; - } - - BFD_ASSERT (h->dynindx != -1); - - sgot = mips_elf_got_section (dynobj); - BFD_ASSERT (sgot != NULL); - BFD_ASSERT (elf_section_data (sgot) != NULL); - g = (struct mips_got_info *) elf_section_data (sgot)->tdata; - BFD_ASSERT (g != NULL); - - /* Run through the global symbol table, creating GOT entries for all - the symbols that need them. */ - if (g->global_gotsym != NULL - && h->dynindx >= g->global_gotsym->dynindx) - { - bfd_vma offset; - bfd_vma value; - - if (sym->st_value) - value = sym->st_value; - else - /* For an entity defined in a shared object, this will be - NULL. (For functions in shared objects for - which we have created stubs, ST_VALUE will be non-NULL. - That's because such the functions are now no longer defined - in a shared object.) */ - value = h->root.u.def.value; - - offset = mips_elf_global_got_index (dynobj, h); - MIPS_ELF_PUT_WORD (output_bfd, value, sgot->contents + offset); - } - - /* Create a .msym entry, if appropriate. */ - smsym = bfd_get_section_by_name (dynobj, - MIPS_ELF_MSYM_SECTION_NAME (dynobj)); - if (smsym) - { - Elf32_Internal_Msym msym; - - msym.ms_hash_value = bfd_elf_hash (h->root.root.string); - /* It is undocumented what the `1' indicates, but IRIX6 uses - this value. */ - msym.ms_info = ELF32_MS_INFO (mh->min_dyn_reloc_index, 1); - bfd_mips_elf_swap_msym_out - (dynobj, &msym, - ((Elf32_External_Msym *) smsym->contents) + h->dynindx); - } - - /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ - name = h->root.root.string; - if (strcmp (name, "_DYNAMIC") == 0 - || strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0) - sym->st_shndx = SHN_ABS; - else if (strcmp (name, "_DYNAMIC_LINK") == 0) - { - sym->st_shndx = SHN_ABS; - sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - sym->st_value = 1; - } - else if (SGI_COMPAT (output_bfd)) - { - if (strcmp (name, "_gp_disp") == 0) - { - sym->st_shndx = SHN_ABS; - sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - sym->st_value = elf_gp (output_bfd); - } - else if (strcmp (name, mips_elf_dynsym_rtproc_names[0]) == 0 - || strcmp (name, mips_elf_dynsym_rtproc_names[1]) == 0) - { - sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - sym->st_other = STO_PROTECTED; - sym->st_value = 0; - sym->st_shndx = SHN_MIPS_DATA; - } - else if (strcmp (name, mips_elf_dynsym_rtproc_names[2]) == 0) - { - sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION); - sym->st_other = STO_PROTECTED; - sym->st_value = mips_elf_hash_table (info)->procedure_count; - sym->st_shndx = SHN_ABS; - } - else if (sym->st_shndx != SHN_UNDEF && sym->st_shndx != SHN_ABS) - { - if (h->type == STT_FUNC) - sym->st_shndx = SHN_MIPS_TEXT; - else if (h->type == STT_OBJECT) - sym->st_shndx = SHN_MIPS_DATA; - } - } - - /* Handle the IRIX6-specific symbols. */ - if (IRIX_COMPAT (output_bfd) == ict_irix6) - mips_elf_irix6_finish_dynamic_symbol (output_bfd, name, sym); - - if (SGI_COMPAT (output_bfd) - && ! info->shared) - { - if (! mips_elf_hash_table (info)->use_rld_obj_head - && strcmp (name, "__rld_map") == 0) - { - asection *s = bfd_get_section_by_name (dynobj, ".rld_map"); - BFD_ASSERT (s != NULL); - sym->st_value = s->output_section->vma + s->output_offset; - bfd_put_32 (output_bfd, (bfd_vma) 0, s->contents); - if (mips_elf_hash_table (info)->rld_value == 0) - mips_elf_hash_table (info)->rld_value = sym->st_value; - } - else if (mips_elf_hash_table (info)->use_rld_obj_head - && strcmp (name, "__rld_obj_head") == 0) - { - /* IRIX6 does not use a .rld_map section. */ - if (IRIX_COMPAT (output_bfd) == ict_irix5) - BFD_ASSERT (bfd_get_section_by_name (dynobj, ".rld_map") - != NULL); - mips_elf_hash_table (info)->rld_value = sym->st_value; - } - } - - /* If this is a mips16 symbol, force the value to be even. */ - if (sym->st_other == STO_MIPS16 - && (sym->st_value & 1) != 0) - --sym->st_value; - - return true; -} - -/* Finish up the dynamic sections. */ - -boolean -_bfd_mips_elf_finish_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - bfd *dynobj; - asection *sdyn; - asection *sgot; - struct mips_got_info *g; - - dynobj = elf_hash_table (info)->dynobj; - - sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); - - sgot = mips_elf_got_section (dynobj); - if (sgot == NULL) - g = NULL; - else - { - BFD_ASSERT (elf_section_data (sgot) != NULL); - g = (struct mips_got_info *) elf_section_data (sgot)->tdata; - BFD_ASSERT (g != NULL); - } - - if (elf_hash_table (info)->dynamic_sections_created) - { - bfd_byte *b; - - BFD_ASSERT (sdyn != NULL); - BFD_ASSERT (g != NULL); - - for (b = sdyn->contents; - b < sdyn->contents + sdyn->_raw_size; - b += MIPS_ELF_DYN_SIZE (dynobj)) - { - Elf_Internal_Dyn dyn; - const char *name; - size_t elemsize; - asection *s; - boolean swap_out_p; - - /* Read in the current dynamic entry. */ - (*get_elf_backend_data (dynobj)->s->swap_dyn_in) (dynobj, b, &dyn); - - /* Assume that we're going to modify it and write it out. */ - swap_out_p = true; - - switch (dyn.d_tag) - { - case DT_RELENT: - s = (bfd_get_section_by_name - (dynobj, - MIPS_ELF_REL_DYN_SECTION_NAME (dynobj))); - BFD_ASSERT (s != NULL); - dyn.d_un.d_val = MIPS_ELF_REL_SIZE (dynobj); - break; - - case DT_STRSZ: - /* Rewrite DT_STRSZ. */ - dyn.d_un.d_val = - _bfd_stringtab_size (elf_hash_table (info)->dynstr); - break; - - case DT_PLTGOT: - name = ".got"; - goto get_vma; - case DT_MIPS_CONFLICT: - name = ".conflict"; - goto get_vma; - case DT_MIPS_LIBLIST: - name = ".liblist"; - get_vma: - s = bfd_get_section_by_name (output_bfd, name); - BFD_ASSERT (s != NULL); - dyn.d_un.d_ptr = s->vma; - break; - - case DT_MIPS_RLD_VERSION: - dyn.d_un.d_val = 1; /* XXX */ - break; - - case DT_MIPS_FLAGS: - dyn.d_un.d_val = RHF_NOTPOT; /* XXX */ - break; - - case DT_MIPS_CONFLICTNO: - name = ".conflict"; - elemsize = sizeof (Elf32_Conflict); - goto set_elemno; - - case DT_MIPS_LIBLISTNO: - name = ".liblist"; - elemsize = sizeof (Elf32_Lib); - set_elemno: - s = bfd_get_section_by_name (output_bfd, name); - if (s != NULL) - { - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size / elemsize; - else - dyn.d_un.d_val = s->_raw_size / elemsize; - } - else - dyn.d_un.d_val = 0; - break; - - case DT_MIPS_TIME_STAMP: - time ((time_t *) &dyn.d_un.d_val); - break; - - case DT_MIPS_ICHECKSUM: - /* XXX FIXME: */ - swap_out_p = false; - break; - - case DT_MIPS_IVERSION: - /* XXX FIXME: */ - swap_out_p = false; - break; - - case DT_MIPS_BASE_ADDRESS: - s = output_bfd->sections; - BFD_ASSERT (s != NULL); - dyn.d_un.d_ptr = s->vma & ~(0xffff); - break; - - case DT_MIPS_LOCAL_GOTNO: - dyn.d_un.d_val = g->local_gotno; - break; - - case DT_MIPS_UNREFEXTNO: - /* The index into the dynamic symbol table which is the - entry of the first external symbol that is not - referenced within the same object. */ - dyn.d_un.d_val = bfd_count_sections (output_bfd) + 1; - break; - - case DT_MIPS_GOTSYM: - if (g->global_gotsym) - { - dyn.d_un.d_val = g->global_gotsym->dynindx; - break; - } - /* In case if we don't have global got symbols we default - to setting DT_MIPS_GOTSYM to the same value as - DT_MIPS_SYMTABNO, so we just fall through. */ - - case DT_MIPS_SYMTABNO: - name = ".dynsym"; - elemsize = MIPS_ELF_SYM_SIZE (output_bfd); - s = bfd_get_section_by_name (output_bfd, name); - BFD_ASSERT (s != NULL); - - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size / elemsize; - else - dyn.d_un.d_val = s->_raw_size / elemsize; - break; - - case DT_MIPS_HIPAGENO: - dyn.d_un.d_val = g->local_gotno - MIPS_RESERVED_GOTNO; - break; - - case DT_MIPS_RLD_MAP: - dyn.d_un.d_ptr = mips_elf_hash_table (info)->rld_value; - break; - - case DT_MIPS_OPTIONS: - s = (bfd_get_section_by_name - (output_bfd, MIPS_ELF_OPTIONS_SECTION_NAME (output_bfd))); - dyn.d_un.d_ptr = s->vma; - break; - - case DT_MIPS_MSYM: - s = (bfd_get_section_by_name - (output_bfd, MIPS_ELF_MSYM_SECTION_NAME (output_bfd))); - dyn.d_un.d_ptr = s->vma; - break; - - default: - swap_out_p = false; - break; - } - - if (swap_out_p) - (*get_elf_backend_data (dynobj)->s->swap_dyn_out) - (dynobj, &dyn, b); - } - } - - /* The first entry of the global offset table will be filled at - runtime. The second entry will be used by some runtime loaders. - This isn't the case of Irix rld. */ - if (sgot != NULL && sgot->_raw_size > 0) - { - MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0, sgot->contents); - MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000, - sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd)); - } - - if (sgot != NULL) - elf_section_data (sgot->output_section)->this_hdr.sh_entsize - = MIPS_ELF_GOT_SIZE (output_bfd); - - { - asection *smsym; - asection *s; - Elf32_compact_rel cpt; - - /* ??? The section symbols for the output sections were set up in - _bfd_elf_final_link. SGI sets the STT_NOTYPE attribute for these - symbols. Should we do so? */ - - smsym = bfd_get_section_by_name (dynobj, - MIPS_ELF_MSYM_SECTION_NAME (dynobj)); - if (smsym != NULL) - { - Elf32_Internal_Msym msym; - - msym.ms_hash_value = 0; - msym.ms_info = ELF32_MS_INFO (0, 1); - - for (s = output_bfd->sections; s != NULL; s = s->next) - { - long dynindx = elf_section_data (s)->dynindx; - - bfd_mips_elf_swap_msym_out - (output_bfd, &msym, - (((Elf32_External_Msym *) smsym->contents) - + dynindx)); - } - } - - if (SGI_COMPAT (output_bfd)) - { - /* Write .compact_rel section out. */ - s = bfd_get_section_by_name (dynobj, ".compact_rel"); - if (s != NULL) - { - cpt.id1 = 1; - cpt.num = s->reloc_count; - cpt.id2 = 2; - cpt.offset = (s->output_section->filepos - + sizeof (Elf32_External_compact_rel)); - cpt.reserved0 = 0; - cpt.reserved1 = 0; - bfd_elf32_swap_compact_rel_out (output_bfd, &cpt, - ((Elf32_External_compact_rel *) - s->contents)); - - /* Clean up a dummy stub function entry in .text. */ - s = bfd_get_section_by_name (dynobj, - MIPS_ELF_STUB_SECTION_NAME (dynobj)); - if (s != NULL) - { - file_ptr dummy_offset; - - BFD_ASSERT (s->_raw_size >= MIPS_FUNCTION_STUB_SIZE); - dummy_offset = s->_raw_size - MIPS_FUNCTION_STUB_SIZE; - memset (s->contents + dummy_offset, 0, - MIPS_FUNCTION_STUB_SIZE); - } - } - } - - /* Clean up a first relocation in .rel.dyn. */ - s = bfd_get_section_by_name (dynobj, - MIPS_ELF_REL_DYN_SECTION_NAME (dynobj)); - if (s != NULL && s->_raw_size > 0) - memset (s->contents, 0, MIPS_ELF_REL_SIZE (dynobj)); - } - - return true; -} - -/* This is almost identical to bfd_generic_get_... except that some - MIPS relocations need to be handled specially. Sigh. */ - -static bfd_byte * -elf32_mips_get_relocated_section_contents (abfd, link_info, link_order, data, - relocateable, symbols) - bfd *abfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - bfd_byte *data; - boolean relocateable; - asymbol **symbols; -{ - /* Get enough memory to hold the stuff */ - bfd *input_bfd = link_order->u.indirect.section->owner; - asection *input_section = link_order->u.indirect.section; - - long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section); - arelent **reloc_vector = NULL; - long reloc_count; - - if (reloc_size < 0) - goto error_return; - - reloc_vector = (arelent **) bfd_malloc (reloc_size); - if (reloc_vector == NULL && reloc_size != 0) - goto error_return; - - /* read in the section */ - if (!bfd_get_section_contents (input_bfd, - input_section, - (PTR) data, - 0, - input_section->_raw_size)) - goto error_return; - - /* We're not relaxing the section, so just copy the size info */ - input_section->_cooked_size = input_section->_raw_size; - input_section->reloc_done = true; - - reloc_count = bfd_canonicalize_reloc (input_bfd, - input_section, - reloc_vector, - symbols); - if (reloc_count < 0) - goto error_return; - - if (reloc_count > 0) - { - arelent **parent; - /* for mips */ - int gp_found; - bfd_vma gp = 0x12345678; /* initialize just to shut gcc up */ - - { - struct bfd_hash_entry *h; - struct bfd_link_hash_entry *lh; - /* Skip all this stuff if we aren't mixing formats. */ - if (abfd && input_bfd - && abfd->xvec == input_bfd->xvec) - lh = 0; - else - { - h = bfd_hash_lookup (&link_info->hash->table, "_gp", false, false); - lh = (struct bfd_link_hash_entry *) h; - } - lookup: - if (lh) - { - switch (lh->type) - { - case bfd_link_hash_undefined: - case bfd_link_hash_undefweak: - case bfd_link_hash_common: - gp_found = 0; - break; - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - gp_found = 1; - gp = lh->u.def.value; - break; - case bfd_link_hash_indirect: - case bfd_link_hash_warning: - lh = lh->u.i.link; - /* @@FIXME ignoring warning for now */ - goto lookup; - case bfd_link_hash_new: - default: - abort (); - } - } - else - gp_found = 0; - } - /* end mips */ - for (parent = reloc_vector; *parent != (arelent *) NULL; - parent++) - { - char *error_message = (char *) NULL; - bfd_reloc_status_type r; - - /* Specific to MIPS: Deal with relocation types that require - knowing the gp of the output bfd. */ - asymbol *sym = *(*parent)->sym_ptr_ptr; - if (bfd_is_abs_section (sym->section) && abfd) - { - /* The special_function wouldn't get called anyways. */ - } - else if (!gp_found) - { - /* The gp isn't there; let the special function code - fall over on its own. */ - } - else if ((*parent)->howto->special_function - == _bfd_mips_elf_gprel16_reloc) - { - /* bypass special_function call */ - r = gprel16_with_gp (input_bfd, sym, *parent, input_section, - relocateable, (PTR) data, gp); - goto skip_bfd_perform_relocation; - } - /* end mips specific stuff */ - - r = bfd_perform_relocation (input_bfd, - *parent, - (PTR) data, - input_section, - relocateable ? abfd : (bfd *) NULL, - &error_message); - skip_bfd_perform_relocation: - - if (relocateable) - { - asection *os = input_section->output_section; - - /* A partial link, so keep the relocs */ - os->orelocation[os->reloc_count] = *parent; - os->reloc_count++; - } - - if (r != bfd_reloc_ok) - { - switch (r) - { - case bfd_reloc_undefined: - if (!((*link_info->callbacks->undefined_symbol) - (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr), - input_bfd, input_section, (*parent)->address, - true))) - goto error_return; - break; - case bfd_reloc_dangerous: - BFD_ASSERT (error_message != (char *) NULL); - if (!((*link_info->callbacks->reloc_dangerous) - (link_info, error_message, input_bfd, input_section, - (*parent)->address))) - goto error_return; - break; - case bfd_reloc_overflow: - if (!((*link_info->callbacks->reloc_overflow) - (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr), - (*parent)->howto->name, (*parent)->addend, - input_bfd, input_section, (*parent)->address))) - goto error_return; - break; - case bfd_reloc_outofrange: - default: - abort (); - break; - } - - } - } - } - if (reloc_vector != NULL) - free (reloc_vector); - return data; - -error_return: - if (reloc_vector != NULL) - free (reloc_vector); - return NULL; -} -#define bfd_elf32_bfd_get_relocated_section_contents \ - elf32_mips_get_relocated_section_contents - -/* ECOFF swapping routines. These are used when dealing with the - .mdebug section, which is in the ECOFF debugging format. */ -static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = -{ - /* Symbol table magic number. */ - magicSym, - /* Alignment of debugging information. E.g., 4. */ - 4, - /* Sizes of external symbolic information. */ - sizeof (struct hdr_ext), - sizeof (struct dnr_ext), - sizeof (struct pdr_ext), - sizeof (struct sym_ext), - sizeof (struct opt_ext), - sizeof (struct fdr_ext), - sizeof (struct rfd_ext), - sizeof (struct ext_ext), - /* Functions to swap in external symbolic data. */ - ecoff_swap_hdr_in, - ecoff_swap_dnr_in, - ecoff_swap_pdr_in, - ecoff_swap_sym_in, - ecoff_swap_opt_in, - ecoff_swap_fdr_in, - ecoff_swap_rfd_in, - ecoff_swap_ext_in, - _bfd_ecoff_swap_tir_in, - _bfd_ecoff_swap_rndx_in, - /* Functions to swap out external symbolic data. */ - ecoff_swap_hdr_out, - ecoff_swap_dnr_out, - ecoff_swap_pdr_out, - ecoff_swap_sym_out, - ecoff_swap_opt_out, - ecoff_swap_fdr_out, - ecoff_swap_rfd_out, - ecoff_swap_ext_out, - _bfd_ecoff_swap_tir_out, - _bfd_ecoff_swap_rndx_out, - /* Function to read in symbolic data. */ - _bfd_mips_elf_read_ecoff_info -}; - -#define TARGET_LITTLE_SYM bfd_elf32_littlemips_vec -#define TARGET_LITTLE_NAME "elf32-littlemips" -#define TARGET_BIG_SYM bfd_elf32_bigmips_vec -#define TARGET_BIG_NAME "elf32-bigmips" -#define ELF_ARCH bfd_arch_mips -#define ELF_MACHINE_CODE EM_MIPS - -/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses - a value of 0x1000, and we are compatible. */ -#define ELF_MAXPAGESIZE 0x1000 - -#define elf_backend_collect true -#define elf_backend_type_change_ok true -#define elf_backend_can_gc_sections true -#define elf_backend_sign_extend_vma true -#define elf_info_to_howto mips_info_to_howto_rela -#define elf_info_to_howto_rel mips_info_to_howto_rel -#define elf_backend_sym_is_global mips_elf_sym_is_global -#define elf_backend_object_p _bfd_mips_elf_object_p -#define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr -#define elf_backend_fake_sections _bfd_mips_elf_fake_sections -#define elf_backend_section_from_bfd_section \ - _bfd_mips_elf_section_from_bfd_section -#define elf_backend_section_processing _bfd_mips_elf_section_processing -#define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing -#define elf_backend_additional_program_headers \ - _bfd_mips_elf_additional_program_headers -#define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map -#define elf_backend_final_write_processing \ - _bfd_mips_elf_final_write_processing -#define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap -#define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook -#define elf_backend_create_dynamic_sections \ - _bfd_mips_elf_create_dynamic_sections -#define elf_backend_check_relocs _bfd_mips_elf_check_relocs -#define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol -#define elf_backend_always_size_sections \ - _bfd_mips_elf_always_size_sections -#define elf_backend_size_dynamic_sections \ - _bfd_mips_elf_size_dynamic_sections -#define elf_backend_relocate_section _bfd_mips_elf_relocate_section -#define elf_backend_link_output_symbol_hook \ - _bfd_mips_elf_link_output_symbol_hook -#define elf_backend_finish_dynamic_symbol \ - _bfd_mips_elf_finish_dynamic_symbol -#define elf_backend_finish_dynamic_sections \ - _bfd_mips_elf_finish_dynamic_sections -#define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook -#define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook - -#define elf_backend_got_header_size (4*MIPS_RESERVED_GOTNO) -#define elf_backend_plt_header_size 0 - -#define bfd_elf32_bfd_is_local_label_name \ - mips_elf_is_local_label_name -#define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line -#define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents -#define bfd_elf32_bfd_link_hash_table_create \ - _bfd_mips_elf_link_hash_table_create -#define bfd_elf32_bfd_final_link _bfd_mips_elf_final_link -#define bfd_elf32_bfd_copy_private_bfd_data \ - _bfd_mips_elf_copy_private_bfd_data -#define bfd_elf32_bfd_merge_private_bfd_data \ - _bfd_mips_elf_merge_private_bfd_data -#define bfd_elf32_bfd_set_private_flags _bfd_mips_elf_set_private_flags -#define bfd_elf32_bfd_print_private_bfd_data \ - _bfd_mips_elf_print_private_bfd_data -#include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf32-sh.c b/contrib/binutils/bfd/elf32-sh.c deleted file mode 100644 index 71538036453e..000000000000 --- a/contrib/binutils/bfd/elf32-sh.c +++ /dev/null @@ -1,1909 +0,0 @@ -/* Hitachi SH specific support for 32-bit ELF - Copyright 1996, 1997, 1998 Free Software Foundation, Inc. - Contributed by Ian Lance Taylor, Cygnus Support. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" -#include "libbfd.h" -#include "elf-bfd.h" - -static bfd_reloc_status_type sh_elf_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type sh_elf_ignore_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static reloc_howto_type *sh_elf_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static void sh_elf_info_to_howto - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); -static boolean sh_elf_relax_section - PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *)); -static boolean sh_elf_relax_delete_bytes - PARAMS ((bfd *, asection *, bfd_vma, int)); -static boolean sh_elf_align_loads - PARAMS ((bfd *, asection *, Elf_Internal_Rela *, bfd_byte *, boolean *)); -static boolean sh_elf_swap_insns - PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma)); -static boolean sh_elf_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); -static bfd_byte *sh_elf_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, boolean, asymbol **)); - -enum sh_reloc_type -{ - R_SH_NONE = 0, - R_SH_DIR32, - R_SH_REL32, - R_SH_DIR8WPN, - R_SH_IND12W, - R_SH_DIR8WPL, - R_SH_DIR8WPZ, - R_SH_DIR8BP, - R_SH_DIR8W, - R_SH_DIR8L, - FIRST_INVALID_RELOC, - LAST_INVALID_RELOC = 24, - /* The remaining relocs are a GNU extension used for relaxation. We - use the same constants as COFF uses, not that it really matters. */ - R_SH_SWITCH16 = 25, - R_SH_SWITCH32, - R_SH_USES, - R_SH_COUNT, - R_SH_ALIGN, - R_SH_CODE, - R_SH_DATA, - R_SH_LABEL, - R_SH_max -}; - -static reloc_howto_type sh_elf_howto_table[] = -{ - /* No relocation. */ - HOWTO (R_SH_NONE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_NONE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit absolute relocation. Setting partial_inplace to true and - src_mask to a non-zero value is similar to the COFF toolchain. */ - HOWTO (R_SH_DIR32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_DIR32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit PC relative relocation. */ - HOWTO (R_SH_REL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_REL32", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 8 bit PC relative branch divided by 2. */ - HOWTO (R_SH_DIR8WPN, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_DIR8WPN", /* name */ - true, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 12 bit PC relative branch divided by 2. */ - HOWTO (R_SH_IND12W, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 12, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_IND12W", /* name */ - true, /* partial_inplace */ - 0xfff, /* src_mask */ - 0xfff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 8 bit unsigned PC relative divided by 4. */ - HOWTO (R_SH_DIR8WPL, /* type */ - 2, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_DIR8WPL", /* name */ - true, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 8 bit unsigned PC relative divided by 2. */ - HOWTO (R_SH_DIR8WPZ, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_DIR8WPZ", /* name */ - true, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 8 bit GBR relative. FIXME: This only makes sense if we have some - special symbol for the GBR relative area, and that is not - implemented. */ - HOWTO (R_SH_DIR8BP, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_DIR8BP", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 8 bit GBR relative divided by 2. FIXME: This only makes sense if - we have some special symbol for the GBR relative area, and that - is not implemented. */ - HOWTO (R_SH_DIR8W, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_DIR8W", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - /* 8 bit GBR relative divided by 4. FIXME: This only makes sense if - we have some special symbol for the GBR relative area, and that - is not implemented. */ - HOWTO (R_SH_DIR8L, /* type */ - 2, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_reloc, /* special_function */ - "R_SH_DIR8L", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xff, /* dst_mask */ - true), /* pcrel_offset */ - - { 10 }, - { 11 }, - { 12 }, - { 13 }, - { 14 }, - { 15 }, - { 16 }, - { 17 }, - { 18 }, - { 19 }, - { 20 }, - { 21 }, - { 22 }, - { 23 }, - { 24 }, - - /* The remaining relocs are a GNU extension used for relaxing. The - final pass of the linker never needs to do anything with any of - these relocs. Any required operations are handled by the - relaxation code. */ - - /* A 16 bit switch table entry. This is generated for an expression - such as ``.word L1 - L2''. The offset holds the difference - between the reloc address and L2. */ - HOWTO (R_SH_SWITCH16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_SWITCH16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ - - /* A 32 bit switch table entry. This is generated for an expression - such as ``.long L1 - L2''. The offset holds the difference - between the reloc address and L2. */ - HOWTO (R_SH_SWITCH32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_SWITCH32", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ - - /* Indicates a .uses pseudo-op. The compiler will generate .uses - pseudo-ops when it finds a function call which can be relaxed. - The offset field holds the PC relative offset to the instruction - which loads the register used in the function call. */ - HOWTO (R_SH_USES, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_USES", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ - - /* The assembler will generate this reloc for addresses referred to - by the register loads associated with USES relocs. The offset - field holds the number of times the address is referenced in the - object file. */ - HOWTO (R_SH_COUNT, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_COUNT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ - - /* Indicates an alignment statement. The offset field is the power - of 2 to which subsequent portions of the object file must be - aligned. */ - HOWTO (R_SH_ALIGN, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_ALIGN", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ - - /* The assembler will generate this reloc before a block of - instructions. A section should be processed as assumining it - contains data, unless this reloc is seen. */ - HOWTO (R_SH_CODE, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_CODE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ - - /* The assembler will generate this reloc after a block of - instructions when it sees data that is not instructions. */ - HOWTO (R_SH_DATA, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_DATA", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true), /* pcrel_offset */ - - /* The assembler generates this reloc for each label within a block - of instructions. This permits the linker to avoid swapping - instructions which are the targets of branches. */ - HOWTO (R_SH_LABEL, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_unsigned, /* complain_on_overflow */ - sh_elf_ignore_reloc, /* special_function */ - "R_SH_LABEL", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - true) /* pcrel_offset */ -}; - -/* This function is used for normal relocs. This is like the COFF - function, and is almost certainly incorrect for other ELF targets. */ - -static bfd_reloc_status_type -sh_elf_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol_in; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - unsigned long insn; - bfd_vma sym_value; - enum sh_reloc_type r_type; - bfd_vma addr = reloc_entry->address; - bfd_byte *hit_data = addr + (bfd_byte *) data; - - r_type = (enum sh_reloc_type) reloc_entry->howto->type; - - if (output_bfd != NULL) - { - /* Partial linking--do nothing. */ - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* Almost all relocs have to do with relaxing. If any work must be - done for them, it has been done in sh_relax_section. */ - if (r_type != R_SH_DIR32 - && (r_type != R_SH_IND12W - || (symbol_in->flags & BSF_LOCAL) != 0)) - return bfd_reloc_ok; - - if (symbol_in != NULL - && bfd_is_und_section (symbol_in->section)) - return bfd_reloc_undefined; - - if (bfd_is_com_section (symbol_in->section)) - sym_value = 0; - else - sym_value = (symbol_in->value + - symbol_in->section->output_section->vma + - symbol_in->section->output_offset); - - switch (r_type) - { - case R_SH_DIR32: - insn = bfd_get_32 (abfd, hit_data); - insn += sym_value + reloc_entry->addend; - bfd_put_32 (abfd, insn, hit_data); - break; - case R_SH_IND12W: - insn = bfd_get_16 (abfd, hit_data); - sym_value += reloc_entry->addend; - sym_value -= (input_section->output_section->vma - + input_section->output_offset - + addr - + 4); - sym_value += (insn & 0xfff) << 1; - if (insn & 0x800) - sym_value -= 0x1000; - insn = (insn & 0xf000) | (sym_value & 0xfff); - bfd_put_16 (abfd, insn, hit_data); - if (sym_value < (bfd_vma) -0x1000 || sym_value >= 0x1000) - return bfd_reloc_overflow; - break; - default: - abort (); - break; - } - - return bfd_reloc_ok; -} - -/* This function is used for relocs which are only used for relaxing, - which the linker should otherwise ignore. */ - -static bfd_reloc_status_type -sh_elf_ignore_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - if (output_bfd != NULL) - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; -} - -/* This structure is used to map BFD reloc codes to SH ELF relocs. */ - -struct elf_reloc_map -{ - unsigned char bfd_reloc_val; - unsigned char elf_reloc_val; -}; - -/* An array mapping BFD reloc codes to SH ELF relocs. */ - -static const struct elf_reloc_map sh_reloc_map[] = -{ - { BFD_RELOC_NONE, R_SH_NONE }, - { BFD_RELOC_32, R_SH_DIR32 }, - { BFD_RELOC_CTOR, R_SH_DIR32 }, - { BFD_RELOC_32_PCREL, R_SH_REL32 }, - { BFD_RELOC_SH_PCDISP8BY2, R_SH_DIR8WPN }, - { BFD_RELOC_SH_PCDISP12BY2, R_SH_IND12W }, - { BFD_RELOC_SH_PCRELIMM8BY2, R_SH_DIR8WPZ }, - { BFD_RELOC_SH_PCRELIMM8BY4, R_SH_DIR8WPL }, - { BFD_RELOC_SH_SWITCH16, R_SH_SWITCH16 }, - { BFD_RELOC_SH_SWITCH32, R_SH_SWITCH32 }, - { BFD_RELOC_SH_USES, R_SH_USES }, - { BFD_RELOC_SH_COUNT, R_SH_COUNT }, - { BFD_RELOC_SH_ALIGN, R_SH_ALIGN }, - { BFD_RELOC_SH_CODE, R_SH_CODE }, - { BFD_RELOC_SH_DATA, R_SH_DATA }, - { BFD_RELOC_SH_LABEL, R_SH_LABEL } -}; - -/* Given a BFD reloc code, return the howto structure for the - corresponding SH ELf reloc. */ - -static reloc_howto_type * -sh_elf_reloc_type_lookup (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; -{ - unsigned int i; - - for (i = 0; i < sizeof (sh_reloc_map) / sizeof (struct elf_reloc_map); i++) - { - if (sh_reloc_map[i].bfd_reloc_val == code) - return &sh_elf_howto_table[(int) sh_reloc_map[i].elf_reloc_val]; - } - - return NULL; -} - -/* Given an ELF reloc, fill in the howto field of a relent. */ - -static void -sh_elf_info_to_howto (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf_Internal_Rela *dst; -{ - unsigned int r; - - r = ELF32_R_TYPE (dst->r_info); - - BFD_ASSERT (r < (unsigned int) R_SH_max); - BFD_ASSERT (r < FIRST_INVALID_RELOC || r > LAST_INVALID_RELOC); - - cache_ptr->howto = &sh_elf_howto_table[r]; -} - -/* This function handles relaxing for SH ELF. See the corresponding - function in coff-sh.c for a description of what this does. FIXME: - There is a lot of duplication here between this code and the COFF - specific code. The format of relocs and symbols is wound deeply - into this code, but it would still be better if the duplication - could be eliminated somehow. Note in particular that although both - functions use symbols like R_SH_CODE, those symbols have different - values; in coff-sh.c they come from include/coff/sh.h, whereas here - they come from enum sh_reloc_type in this file. */ - -static boolean -sh_elf_relax_section (abfd, sec, link_info, again) - bfd *abfd; - asection *sec; - struct bfd_link_info *link_info; - boolean *again; -{ - Elf_Internal_Shdr *symtab_hdr; - Elf_Internal_Rela *internal_relocs; - Elf_Internal_Rela *free_relocs = NULL; - boolean have_code; - Elf_Internal_Rela *irel, *irelend; - bfd_byte *contents = NULL; - bfd_byte *free_contents = NULL; - Elf32_External_Sym *extsyms = NULL; - Elf32_External_Sym *free_extsyms = NULL; - - *again = false; - - if (link_info->relocateable - || (sec->flags & SEC_RELOC) == 0 - || sec->reloc_count == 0) - return true; - - /* If this is the first time we have been called for this section, - initialize the cooked size. */ - if (sec->_cooked_size == 0) - sec->_cooked_size = sec->_raw_size; - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - - internal_relocs = (_bfd_elf32_link_read_relocs - (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, - link_info->keep_memory)); - if (internal_relocs == NULL) - goto error_return; - if (! link_info->keep_memory) - free_relocs = internal_relocs; - - have_code = false; - - irelend = internal_relocs + sec->reloc_count; - for (irel = internal_relocs; irel < irelend; irel++) - { - bfd_vma laddr, paddr, symval; - unsigned short insn; - Elf_Internal_Rela *irelfn, *irelscan, *irelcount; - bfd_signed_vma foff; - - if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_CODE) - have_code = true; - - if (ELF32_R_TYPE (irel->r_info) != (int) R_SH_USES) - continue; - - /* Get the section contents. */ - if (contents == NULL) - { - if (elf_section_data (sec)->this_hdr.contents != NULL) - contents = elf_section_data (sec)->this_hdr.contents; - else - { - contents = (bfd_byte *) bfd_malloc (sec->_raw_size); - if (contents == NULL) - goto error_return; - free_contents = contents; - - if (! bfd_get_section_contents (abfd, sec, contents, - (file_ptr) 0, sec->_raw_size)) - goto error_return; - } - } - - /* The r_addend field of the R_SH_USES reloc will point us to - the register load. The 4 is because the r_addend field is - computed as though it were a jump offset, which are based - from 4 bytes after the jump instruction. */ - laddr = irel->r_offset + 4 + irel->r_addend; - if (laddr >= sec->_raw_size) - { - (*_bfd_error_handler) ("%s: 0x%lx: warning: bad R_SH_USES offset", - bfd_get_filename (abfd), - (unsigned long) irel->r_offset); - continue; - } - insn = bfd_get_16 (abfd, contents + laddr); - - /* If the instruction is not mov.l NN,rN, we don't know what to - do. */ - if ((insn & 0xf000) != 0xd000) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x", - bfd_get_filename (abfd), (unsigned long) irel->r_offset, insn)); - continue; - } - - /* Get the address from which the register is being loaded. The - displacement in the mov.l instruction is quadrupled. It is a - displacement from four bytes after the movl instruction, but, - before adding in the PC address, two least significant bits - of the PC are cleared. We assume that the section is aligned - on a four byte boundary. */ - paddr = insn & 0xff; - paddr *= 4; - paddr += (laddr + 4) &~ 3; - if (paddr >= sec->_raw_size) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: bad R_SH_USES load offset", - bfd_get_filename (abfd), (unsigned long) irel->r_offset)); - continue; - } - - /* Get the reloc for the address from which the register is - being loaded. This reloc will tell us which function is - actually being called. */ - for (irelfn = internal_relocs; irelfn < irelend; irelfn++) - if (irelfn->r_offset == paddr - && ELF32_R_TYPE (irelfn->r_info) == (int) R_SH_DIR32) - break; - if (irelfn >= irelend) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: could not find expected reloc", - bfd_get_filename (abfd), (unsigned long) paddr)); - continue; - } - - /* Read this BFD's symbols if we haven't done so already. */ - if (extsyms == NULL) - { - if (symtab_hdr->contents != NULL) - extsyms = (Elf32_External_Sym *) symtab_hdr->contents; - else - { - extsyms = ((Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_size)); - if (extsyms == NULL) - goto error_return; - free_extsyms = extsyms; - if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd) - != symtab_hdr->sh_size)) - goto error_return; - } - } - - /* Get the value of the symbol referred to by the reloc. */ - if (ELF32_R_SYM (irelfn->r_info) < symtab_hdr->sh_info) - { - Elf_Internal_Sym isym; - - /* A local symbol. */ - bfd_elf32_swap_symbol_in (abfd, - extsyms + ELF32_R_SYM (irelfn->r_info), - &isym); - - if (isym.st_shndx != _bfd_elf_section_from_bfd_section (abfd, sec)) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: symbol in unexpected section", - bfd_get_filename (abfd), (unsigned long) paddr)); - continue; - } - - symval = (isym.st_value - + sec->output_section->vma - + sec->output_offset); - } - else - { - unsigned long indx; - struct elf_link_hash_entry *h; - - indx = ELF32_R_SYM (irelfn->r_info) - symtab_hdr->sh_info; - h = elf_sym_hashes (abfd)[indx]; - BFD_ASSERT (h != NULL); - if (h->root.type != bfd_link_hash_defined - && h->root.type != bfd_link_hash_defweak) - { - /* This appears to be a reference to an undefined - symbol. Just ignore it--it will be caught by the - regular reloc processing. */ - continue; - } - - symval = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - } - - symval += bfd_get_32 (abfd, contents + paddr); - - /* See if this function call can be shortened. */ - foff = (symval - - (irel->r_offset - + sec->output_section->vma - + sec->output_offset - + 4)); - if (foff < -0x1000 || foff >= 0x1000) - { - /* After all that work, we can't shorten this function call. */ - continue; - } - - /* Shorten the function call. */ - - /* For simplicity of coding, we are going to modify the section - contents, the section relocs, and the BFD symbol table. We - must tell the rest of the code not to free up this - information. It would be possible to instead create a table - of changes which have to be made, as is done in coff-mips.c; - that would be more work, but would require less memory when - the linker is run. */ - - elf_section_data (sec)->relocs = internal_relocs; - free_relocs = NULL; - - elf_section_data (sec)->this_hdr.contents = contents; - free_contents = NULL; - - symtab_hdr->contents = (bfd_byte *) extsyms; - free_extsyms = NULL; - - /* Replace the jsr with a bsr. */ - - /* Change the R_SH_USES reloc into an R_SH_IND12W reloc, and - replace the jsr with a bsr. */ - irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irelfn->r_info), R_SH_IND12W); - if (ELF32_R_SYM (irelfn->r_info) < symtab_hdr->sh_info) - { - /* If this needs to be changed because of future relaxing, - it will be handled here like other internal IND12W - relocs. */ - bfd_put_16 (abfd, - 0xb000 | ((foff >> 1) & 0xfff), - contents + irel->r_offset); - } - else - { - /* We can't fully resolve this yet, because the external - symbol value may be changed by future relaxing. We let - the final link phase handle it. */ - bfd_put_16 (abfd, 0xb000, contents + irel->r_offset); - } - - /* See if there is another R_SH_USES reloc referring to the same - register load. */ - for (irelscan = internal_relocs; irelscan < irelend; irelscan++) - if (ELF32_R_TYPE (irelscan->r_info) == (int) R_SH_USES - && laddr == irelscan->r_offset + 4 + irelscan->r_addend) - break; - if (irelscan < irelend) - { - /* Some other function call depends upon this register load, - and we have not yet converted that function call. - Indeed, we may never be able to convert it. There is - nothing else we can do at this point. */ - continue; - } - - /* Look for a R_SH_COUNT reloc on the location where the - function address is stored. Do this before deleting any - bytes, to avoid confusion about the address. */ - for (irelcount = internal_relocs; irelcount < irelend; irelcount++) - if (irelcount->r_offset == paddr - && ELF32_R_TYPE (irelcount->r_info) == (int) R_SH_COUNT) - break; - - /* Delete the register load. */ - if (! sh_elf_relax_delete_bytes (abfd, sec, laddr, 2)) - goto error_return; - - /* That will change things, so, just in case it permits some - other function call to come within range, we should relax - again. Note that this is not required, and it may be slow. */ - *again = true; - - /* Now check whether we got a COUNT reloc. */ - if (irelcount >= irelend) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: warning: could not find expected COUNT reloc", - bfd_get_filename (abfd), (unsigned long) paddr)); - continue; - } - - /* The number of uses is stored in the r_addend field. We've - just deleted one. */ - if (irelcount->r_addend == 0) - { - ((*_bfd_error_handler) ("%s: 0x%lx: warning: bad count", - bfd_get_filename (abfd), - (unsigned long) paddr)); - continue; - } - - --irelcount->r_addend; - - /* If there are no more uses, we can delete the address. Reload - the address from irelfn, in case it was changed by the - previous call to sh_elf_relax_delete_bytes. */ - if (irelcount->r_addend == 0) - { - if (! sh_elf_relax_delete_bytes (abfd, sec, irelfn->r_offset, 4)) - goto error_return; - } - - /* We've done all we can with that function call. */ - } - - /* Look for load and store instructions that we can align on four - byte boundaries. */ - if (have_code) - { - boolean swapped; - - /* Get the section contents. */ - if (contents == NULL) - { - if (elf_section_data (sec)->this_hdr.contents != NULL) - contents = elf_section_data (sec)->this_hdr.contents; - else - { - contents = (bfd_byte *) bfd_malloc (sec->_raw_size); - if (contents == NULL) - goto error_return; - free_contents = contents; - - if (! bfd_get_section_contents (abfd, sec, contents, - (file_ptr) 0, sec->_raw_size)) - goto error_return; - } - } - - if (! sh_elf_align_loads (abfd, sec, internal_relocs, contents, - &swapped)) - goto error_return; - - if (swapped) - { - elf_section_data (sec)->relocs = internal_relocs; - free_relocs = NULL; - - elf_section_data (sec)->this_hdr.contents = contents; - free_contents = NULL; - - symtab_hdr->contents = (bfd_byte *) extsyms; - free_extsyms = NULL; - } - } - - if (free_relocs != NULL) - { - free (free_relocs); - free_relocs = NULL; - } - - if (free_contents != NULL) - { - if (! link_info->keep_memory) - free (free_contents); - else - { - /* Cache the section contents for elf_link_input_bfd. */ - elf_section_data (sec)->this_hdr.contents = contents; - } - free_contents = NULL; - } - - if (free_extsyms != NULL) - { - if (! link_info->keep_memory) - free (free_extsyms); - else - { - /* Cache the symbols for elf_link_input_bfd. */ - symtab_hdr->contents = extsyms; - } - free_extsyms = NULL; - } - - return true; - - error_return: - if (free_relocs != NULL) - free (free_relocs); - if (free_contents != NULL) - free (free_contents); - if (free_extsyms != NULL) - free (free_extsyms); - return false; -} - -/* Delete some bytes from a section while relaxing. FIXME: There is a - lot of duplication between this function and sh_relax_delete_bytes - in coff-sh.c. */ - -static boolean -sh_elf_relax_delete_bytes (abfd, sec, addr, count) - bfd *abfd; - asection *sec; - bfd_vma addr; - int count; -{ - Elf_Internal_Shdr *symtab_hdr; - Elf32_External_Sym *extsyms; - int shndx, index; - bfd_byte *contents; - Elf_Internal_Rela *irel, *irelend; - Elf_Internal_Rela *irelalign; - bfd_vma toaddr; - Elf32_External_Sym *esym, *esymend; - struct elf_link_hash_entry *sym_hash; - asection *o; - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - extsyms = (Elf32_External_Sym *) symtab_hdr->contents; - - shndx = _bfd_elf_section_from_bfd_section (abfd, sec); - - contents = elf_section_data (sec)->this_hdr.contents; - - /* The deletion must stop at the next ALIGN reloc for an aligment - power larger than the number of bytes we are deleting. */ - - irelalign = NULL; - toaddr = sec->_cooked_size; - - irel = elf_section_data (sec)->relocs; - irelend = irel + sec->reloc_count; - for (; irel < irelend; irel++) - { - if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_ALIGN - && irel->r_offset > addr - && count < (1 << irel->r_addend)) - { - irelalign = irel; - toaddr = irel->r_offset; - break; - } - } - - /* Actually delete the bytes. */ - memmove (contents + addr, contents + addr + count, toaddr - addr - count); - if (irelalign == NULL) - sec->_cooked_size -= count; - else - { - int i; - -#define NOP_OPCODE (0x0009) - - BFD_ASSERT ((count & 1) == 0); - for (i = 0; i < count; i += 2) - bfd_put_16 (abfd, NOP_OPCODE, contents + toaddr - count + i); - } - - /* Adjust all the relocs. */ - for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) - { - bfd_vma nraddr, stop; - bfd_vma start = 0; - int insn = 0; - Elf_Internal_Sym sym; - int off, adjust, oinsn; - bfd_signed_vma voff = 0; - boolean overflow; - - /* Get the new reloc address. */ - nraddr = irel->r_offset; - if ((irel->r_offset > addr - && irel->r_offset < toaddr) - || (ELF32_R_TYPE (irel->r_info) == (int) R_SH_ALIGN - && irel->r_offset == toaddr)) - nraddr -= count; - - /* See if this reloc was for the bytes we have deleted, in which - case we no longer care about it. Don't delete relocs which - represent addresses, though. */ - if (irel->r_offset >= addr - && irel->r_offset < addr + count - && ELF32_R_TYPE (irel->r_info) != (int) R_SH_ALIGN - && ELF32_R_TYPE (irel->r_info) != (int) R_SH_CODE - && ELF32_R_TYPE (irel->r_info) != (int) R_SH_DATA - && ELF32_R_TYPE (irel->r_info) != (int) R_SH_LABEL) - irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), - (int) R_SH_NONE); - - /* If this is a PC relative reloc, see if the range it covers - includes the bytes we have deleted. */ - switch ((enum sh_reloc_type) ELF32_R_TYPE (irel->r_info)) - { - default: - break; - - case R_SH_DIR8WPN: - case R_SH_IND12W: - case R_SH_DIR8WPZ: - case R_SH_DIR8WPL: - start = irel->r_offset; - insn = bfd_get_16 (abfd, contents + nraddr); - break; - } - - switch ((enum sh_reloc_type) ELF32_R_TYPE (irel->r_info)) - { - default: - start = stop = addr; - break; - - case R_SH_DIR32: - /* If this reloc is against a symbol defined in this - section, and the symbol will not be adjusted below, we - must check the addend to see it will put the value in - range to be adjusted, and hence must be changed. */ - if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) - { - bfd_elf32_swap_symbol_in (abfd, - extsyms + ELF32_R_SYM (irel->r_info), - &sym); - if (sym.st_shndx == shndx - && (sym.st_value <= addr - || sym.st_value >= toaddr)) - { - bfd_vma val; - - val = bfd_get_32 (abfd, contents + nraddr); - val += sym.st_value; - if (val >= addr && val < toaddr) - bfd_put_32 (abfd, val - count, contents + nraddr); - } - } - start = stop = addr; - break; - - case R_SH_DIR8WPN: - off = insn & 0xff; - if (off & 0x80) - off -= 0x100; - stop = (bfd_vma) ((bfd_signed_vma) start + 4 + off * 2); - break; - - case R_SH_IND12W: - if (ELF32_R_SYM (irel->r_info) >= symtab_hdr->sh_info) - start = stop = addr; - else - { - off = insn & 0xfff; - if (off & 0x800) - off -= 0x1000; - stop = (bfd_vma) ((bfd_signed_vma) start + 4 + off * 2); - } - break; - - case R_SH_DIR8WPZ: - off = insn & 0xff; - stop = start + 4 + off * 2; - break; - - case R_SH_DIR8WPL: - off = insn & 0xff; - stop = (start &~ (bfd_vma) 3) + 4 + off * 4; - break; - - case R_SH_SWITCH16: - case R_SH_SWITCH32: - /* These relocs types represent - .word L2-L1 - The r_offset field holds the difference between the reloc - address and L1. That is the start of the reloc, and - adding in the contents gives us the top. We must adjust - both the r_offset field and the section contents. */ - - start = irel->r_offset; - stop = (bfd_vma) ((bfd_signed_vma) start - (long) irel->r_addend); - - if (start > addr - && start < toaddr - && (stop <= addr || stop >= toaddr)) - irel->r_addend += count; - else if (stop > addr - && stop < toaddr - && (start <= addr || start >= toaddr)) - irel->r_addend -= count; - - start = stop; - - if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_SWITCH16) - voff = bfd_get_signed_16 (abfd, contents + nraddr); - else - voff = bfd_get_signed_32 (abfd, contents + nraddr); - stop = (bfd_vma) ((bfd_signed_vma) start + voff); - - break; - - case R_SH_USES: - start = irel->r_offset; - stop = (bfd_vma) ((bfd_signed_vma) start - + (long) irel->r_addend - + 4); - break; - } - - if (start > addr - && start < toaddr - && (stop <= addr || stop >= toaddr)) - adjust = count; - else if (stop > addr - && stop < toaddr - && (start <= addr || start >= toaddr)) - adjust = - count; - else - adjust = 0; - - if (adjust != 0) - { - oinsn = insn; - overflow = false; - switch ((enum sh_reloc_type) ELF32_R_TYPE (irel->r_info)) - { - default: - abort (); - break; - - case R_SH_DIR8WPN: - case R_SH_DIR8WPZ: - insn += adjust / 2; - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); - break; - - case R_SH_IND12W: - insn += adjust / 2; - if ((oinsn & 0xf000) != (insn & 0xf000)) - overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); - break; - - case R_SH_DIR8WPL: - BFD_ASSERT (adjust == count || count >= 4); - if (count >= 4) - insn += adjust / 4; - else - { - if ((irel->r_offset & 3) == 0) - ++insn; - } - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, contents + nraddr); - break; - - case R_SH_SWITCH16: - voff += adjust; - if (voff < - 0x8000 || voff >= 0x8000) - overflow = true; - bfd_put_signed_16 (abfd, voff, contents + nraddr); - break; - - case R_SH_SWITCH32: - voff += adjust; - bfd_put_signed_32 (abfd, voff, contents + nraddr); - break; - - case R_SH_USES: - irel->r_addend += adjust; - break; - } - - if (overflow) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: fatal: reloc overflow while relaxing", - bfd_get_filename (abfd), (unsigned long) irel->r_offset)); - bfd_set_error (bfd_error_bad_value); - return false; - } - } - - irel->r_offset = nraddr; - } - - /* Look through all the other sections. If there contain any IMM32 - relocs against internal symbols which we are not going to adjust - below, we may need to adjust the addends. */ - for (o = abfd->sections; o != NULL; o = o->next) - { - Elf_Internal_Rela *internal_relocs; - Elf_Internal_Rela *irelscan, *irelscanend; - bfd_byte *ocontents; - - if (o == sec - || (o->flags & SEC_RELOC) == 0 - || o->reloc_count == 0) - continue; - - /* We always cache the relocs. Perhaps, if info->keep_memory is - false, we should free them, if we are permitted to, when we - leave sh_coff_relax_section. */ - internal_relocs = (_bfd_elf32_link_read_relocs - (abfd, o, (PTR) NULL, (Elf_Internal_Rela *) NULL, - true)); - if (internal_relocs == NULL) - return false; - - ocontents = NULL; - irelscanend = internal_relocs + o->reloc_count; - for (irelscan = internal_relocs; irelscan < irelscanend; irelscan++) - { - Elf_Internal_Sym sym; - - if (ELF32_R_TYPE (irelscan->r_info) != (int) R_SH_DIR32) - continue; - - if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info) - continue; - - bfd_elf32_swap_symbol_in (abfd, - extsyms + ELF32_R_SYM (irelscan->r_info), - &sym); - - if (sym.st_shndx == shndx - && (sym.st_value <= addr - || sym.st_value >= toaddr)) - { - bfd_vma val; - - if (ocontents == NULL) - { - if (elf_section_data (o)->this_hdr.contents != NULL) - ocontents = elf_section_data (o)->this_hdr.contents; - else - { - /* We always cache the section contents. - Perhaps, if info->keep_memory is false, we - should free them, if we are permitted to, - when we leave sh_coff_relax_section. */ - ocontents = (bfd_byte *) bfd_malloc (o->_raw_size); - if (ocontents == NULL) - return false; - if (! bfd_get_section_contents (abfd, o, ocontents, - (file_ptr) 0, - o->_raw_size)) - return false; - elf_section_data (o)->this_hdr.contents = ocontents; - } - } - - val = bfd_get_32 (abfd, ocontents + irelscan->r_offset); - val += sym.st_value; - if (val >= addr && val < toaddr) - bfd_put_32 (abfd, val - count, - ocontents + irelscan->r_offset); - } - } - } - - /* Adjust the local symbols defined in this section. */ - esym = extsyms; - esymend = esym + symtab_hdr->sh_info; - for (; esym < esymend; esym++) - { - Elf_Internal_Sym isym; - - bfd_elf32_swap_symbol_in (abfd, esym, &isym); - - if (isym.st_shndx == shndx - && isym.st_value > addr - && isym.st_value < toaddr) - { - isym.st_value -= count; - bfd_elf32_swap_symbol_out (abfd, &isym, esym); - } - } - - /* Now adjust the global symbols defined in this section. */ - esym = extsyms + symtab_hdr->sh_info; - esymend = extsyms + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)); - for (index = 0; esym < esymend; esym++, index++) - { - Elf_Internal_Sym isym; - - bfd_elf32_swap_symbol_in (abfd, esym, &isym); - sym_hash = elf_sym_hashes (abfd)[index]; - if (isym.st_shndx == shndx - && ((sym_hash)->root.type == bfd_link_hash_defined - || (sym_hash)->root.type == bfd_link_hash_defweak) - && (sym_hash)->root.u.def.section == sec - && (sym_hash)->root.u.def.value > addr - && (sym_hash)->root.u.def.value < toaddr) - { - (sym_hash)->root.u.def.value -= count; - } - } - - /* See if we can move the ALIGN reloc forward. We have adjusted - r_offset for it already. */ - if (irelalign != NULL) - { - bfd_vma alignto, alignaddr; - - alignto = BFD_ALIGN (toaddr, 1 << irelalign->r_addend); - alignaddr = BFD_ALIGN (irelalign->r_offset, - 1 << irelalign->r_addend); - if (alignto != alignaddr) - { - /* Tail recursion. */ - return sh_elf_relax_delete_bytes (abfd, sec, alignaddr, - alignto - alignaddr); - } - } - - return true; -} - -/* Look for loads and stores which we can align to four byte - boundaries. This is like sh_align_loads in coff-sh.c. */ - -static boolean -sh_elf_align_loads (abfd, sec, internal_relocs, contents, pswapped) - bfd *abfd; - asection *sec; - Elf_Internal_Rela *internal_relocs; - bfd_byte *contents; - boolean *pswapped; -{ - Elf_Internal_Rela *irel, *irelend; - bfd_vma *labels = NULL; - bfd_vma *label, *label_end; - - *pswapped = false; - - irelend = internal_relocs + sec->reloc_count; - - /* Get all the addresses with labels on them. */ - labels = (bfd_vma *) bfd_malloc (sec->reloc_count * sizeof (bfd_vma)); - if (labels == NULL) - goto error_return; - label_end = labels; - for (irel = internal_relocs; irel < irelend; irel++) - { - if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_LABEL) - { - *label_end = irel->r_offset; - ++label_end; - } - } - - /* Note that the assembler currently always outputs relocs in - address order. If that ever changes, this code will need to sort - the label values and the relocs. */ - - label = labels; - - for (irel = internal_relocs; irel < irelend; irel++) - { - bfd_vma start, stop; - - if (ELF32_R_TYPE (irel->r_info) != (int) R_SH_CODE) - continue; - - start = irel->r_offset; - - for (irel++; irel < irelend; irel++) - if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_DATA) - break; - if (irel < irelend) - stop = irel->r_offset; - else - stop = sec->_cooked_size; - - if (! _bfd_sh_align_load_span (abfd, sec, contents, sh_elf_swap_insns, - (PTR) internal_relocs, &label, - label_end, start, stop, pswapped)) - goto error_return; - } - - free (labels); - - return true; - - error_return: - if (labels != NULL) - free (labels); - return false; -} - -/* Swap two SH instructions. This is like sh_swap_insns in coff-sh.c. */ - -static boolean -sh_elf_swap_insns (abfd, sec, relocs, contents, addr) - bfd *abfd; - asection *sec; - PTR relocs; - bfd_byte *contents; - bfd_vma addr; -{ - Elf_Internal_Rela *internal_relocs = (Elf_Internal_Rela *) relocs; - unsigned short i1, i2; - Elf_Internal_Rela *irel, *irelend; - - /* Swap the instructions themselves. */ - i1 = bfd_get_16 (abfd, contents + addr); - i2 = bfd_get_16 (abfd, contents + addr + 2); - bfd_put_16 (abfd, i2, contents + addr); - bfd_put_16 (abfd, i1, contents + addr + 2); - - /* Adjust all reloc addresses. */ - irelend = internal_relocs + sec->reloc_count; - for (irel = internal_relocs; irel < irelend; irel++) - { - enum sh_reloc_type type; - int add; - - /* There are a few special types of relocs that we don't want to - adjust. These relocs do not apply to the instruction itself, - but are only associated with the address. */ - type = (enum sh_reloc_type) ELF32_R_TYPE (irel->r_info); - if (type == R_SH_ALIGN - || type == R_SH_CODE - || type == R_SH_DATA - || type == R_SH_LABEL) - continue; - - /* If an R_SH_USES reloc points to one of the addresses being - swapped, we must adjust it. It would be incorrect to do this - for a jump, though, since we want to execute both - instructions after the jump. (We have avoided swapping - around a label, so the jump will not wind up executing an - instruction it shouldn't). */ - if (type == R_SH_USES) - { - bfd_vma off; - - off = irel->r_offset + 4 + irel->r_addend; - if (off == addr) - irel->r_offset += 2; - else if (off == addr + 2) - irel->r_offset -= 2; - } - - if (irel->r_offset == addr) - { - irel->r_offset += 2; - add = -2; - } - else if (irel->r_offset == addr + 2) - { - irel->r_offset -= 2; - add = 2; - } - else - add = 0; - - if (add != 0) - { - bfd_byte *loc; - unsigned short insn, oinsn; - boolean overflow; - - loc = contents + irel->r_offset; - overflow = false; - switch (type) - { - default: - break; - - case R_SH_DIR8WPN: - case R_SH_DIR8WPZ: - insn = bfd_get_16 (abfd, loc); - oinsn = insn; - insn += add / 2; - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, loc); - break; - - case R_SH_IND12W: - insn = bfd_get_16 (abfd, loc); - oinsn = insn; - insn += add / 2; - if ((oinsn & 0xf000) != (insn & 0xf000)) - overflow = true; - bfd_put_16 (abfd, insn, loc); - break; - - case R_SH_DIR8WPL: - /* This reloc ignores the least significant 3 bits of - the program counter before adding in the offset. - This means that if ADDR is at an even address, the - swap will not affect the offset. If ADDR is an at an - odd address, then the instruction will be crossing a - four byte boundary, and must be adjusted. */ - if ((addr & 3) != 0) - { - insn = bfd_get_16 (abfd, loc); - oinsn = insn; - insn += add / 2; - if ((oinsn & 0xff00) != (insn & 0xff00)) - overflow = true; - bfd_put_16 (abfd, insn, loc); - } - - break; - } - - if (overflow) - { - ((*_bfd_error_handler) - ("%s: 0x%lx: fatal: reloc overflow while relaxing", - bfd_get_filename (abfd), (unsigned long) irel->r_offset)); - bfd_set_error (bfd_error_bad_value); - return false; - } - } - } - - return true; -} - -/* Relocate an SH ELF section. */ - -static boolean -sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, - contents, relocs, local_syms, local_sections) - bfd *output_bfd; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - Elf_Internal_Rela *relocs; - Elf_Internal_Sym *local_syms; - asection **local_sections; -{ - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - Elf_Internal_Rela *rel, *relend; - - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (input_bfd); - - rel = relocs; - relend = relocs + input_section->reloc_count; - for (; rel < relend; rel++) - { - int r_type; - reloc_howto_type *howto; - unsigned long r_symndx; - Elf_Internal_Sym *sym; - asection *sec; - struct elf_link_hash_entry *h; - bfd_vma relocation; - bfd_reloc_status_type r; - - r_symndx = ELF32_R_SYM (rel->r_info); - - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - r_type = ELF32_R_TYPE (rel->r_info); - - /* Many of the relocs are only used for relaxing, and are - handled entirely by the relaxation code. */ - if (r_type > (int) LAST_INVALID_RELOC) - continue; - - if (r_type < 0 - || r_type >= (int) FIRST_INVALID_RELOC) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - /* FIXME: This is certainly incorrect. However, it is how the - COFF linker works. */ - if (r_type != (int) R_SH_DIR32 - && r_type != (int) R_SH_IND12W) - continue; - - howto = sh_elf_howto_table + r_type; - - /* This is a final link. */ - h = NULL; - sym = NULL; - sec = NULL; - if (r_symndx < symtab_hdr->sh_info) - { - /* There is nothing to be done for an internal IND12W - relocation. FIXME: This is probably wrong, but it's how - the COFF relocations work. */ - if (r_type == (int) R_SH_IND12W) - continue; - sym = local_syms + r_symndx; - sec = local_sections[r_symndx]; - relocation = (sec->output_section->vma - + sec->output_offset - + sym->st_value); - } - else - { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } - else if (h->root.type == bfd_link_hash_undefweak) - relocation = 0; - else - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) - return false; - relocation = 0; - } - } - - /* FIXME: This is how the COFF relocations work. */ - if (r_type == (int) R_SH_IND12W) - relocation -= 4; - - /* FIXME: We should use the addend, but the COFF relocations - don't. */ - r = _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, rel->r_offset, - relocation, 0); - - if (r != bfd_reloc_ok) - { - switch (r) - { - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - { - const char *name; - - if (h != NULL) - name = h->root.root.string; - else - { - name = (bfd_elf_string_from_elf_section - (input_bfd, symtab_hdr->sh_link, sym->st_name)); - if (name == NULL) - return false; - if (*name == '\0') - name = bfd_section_name (input_bfd, sec); - } - if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rel->r_offset))) - return false; - } - break; - } - } - } - - return true; -} - -/* This is a version of bfd_generic_get_relocated_section_contents - which uses sh_elf_relocate_section. */ - -static bfd_byte * -sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order, - data, relocateable, symbols) - bfd *output_bfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - bfd_byte *data; - boolean relocateable; - asymbol **symbols; -{ - Elf_Internal_Shdr *symtab_hdr; - asection *input_section = link_order->u.indirect.section; - bfd *input_bfd = input_section->owner; - asection **sections = NULL; - Elf_Internal_Rela *internal_relocs = NULL; - Elf32_External_Sym *external_syms = NULL; - Elf_Internal_Sym *internal_syms = NULL; - - /* We only need to handle the case of relaxing, or of having a - particular set of section contents, specially. */ - if (relocateable - || elf_section_data (input_section)->this_hdr.contents == NULL) - return bfd_generic_get_relocated_section_contents (output_bfd, link_info, - link_order, data, - relocateable, - symbols); - - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - - memcpy (data, elf_section_data (input_section)->this_hdr.contents, - input_section->_raw_size); - - if ((input_section->flags & SEC_RELOC) != 0 - && input_section->reloc_count > 0) - { - Elf_Internal_Sym *isymp; - asection **secpp; - Elf32_External_Sym *esym, *esymend; - - if (symtab_hdr->contents != NULL) - external_syms = (Elf32_External_Sym *) symtab_hdr->contents; - else - { - external_syms = ((Elf32_External_Sym *) - bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf32_External_Sym))); - if (external_syms == NULL && symtab_hdr->sh_info > 0) - goto error_return; - if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (external_syms, sizeof (Elf32_External_Sym), - symtab_hdr->sh_info, input_bfd) - != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)))) - goto error_return; - } - - internal_relocs = (_bfd_elf32_link_read_relocs - (input_bfd, input_section, (PTR) NULL, - (Elf_Internal_Rela *) NULL, false)); - if (internal_relocs == NULL) - goto error_return; - - internal_syms = ((Elf_Internal_Sym *) - bfd_malloc (symtab_hdr->sh_info - * sizeof (Elf_Internal_Sym))); - if (internal_syms == NULL && symtab_hdr->sh_info > 0) - goto error_return; - - sections = (asection **) bfd_malloc (symtab_hdr->sh_info - * sizeof (asection *)); - if (sections == NULL && symtab_hdr->sh_info > 0) - goto error_return; - - isymp = internal_syms; - secpp = sections; - esym = external_syms; - esymend = esym + symtab_hdr->sh_info; - for (; esym < esymend; ++esym, ++isymp, ++secpp) - { - asection *isec; - - bfd_elf32_swap_symbol_in (input_bfd, esym, isymp); - - if (isymp->st_shndx == SHN_UNDEF) - isec = bfd_und_section_ptr; - else if (isymp->st_shndx > 0 && isymp->st_shndx < SHN_LORESERVE) - isec = bfd_section_from_elf_index (input_bfd, isymp->st_shndx); - else if (isymp->st_shndx == SHN_ABS) - isec = bfd_abs_section_ptr; - else if (isymp->st_shndx == SHN_COMMON) - isec = bfd_com_section_ptr; - else - { - /* Who knows? */ - isec = NULL; - } - - *secpp = isec; - } - - if (! sh_elf_relocate_section (output_bfd, link_info, input_bfd, - input_section, data, internal_relocs, - internal_syms, sections)) - goto error_return; - - if (sections != NULL) - free (sections); - sections = NULL; - if (internal_syms != NULL) - free (internal_syms); - internal_syms = NULL; - if (external_syms != NULL && symtab_hdr->contents == NULL) - free (external_syms); - external_syms = NULL; - if (internal_relocs != elf_section_data (input_section)->relocs) - free (internal_relocs); - internal_relocs = NULL; - } - - return data; - - error_return: - if (internal_relocs != NULL - && internal_relocs != elf_section_data (input_section)->relocs) - free (internal_relocs); - if (external_syms != NULL && symtab_hdr->contents == NULL) - free (external_syms); - if (internal_syms != NULL) - free (internal_syms); - if (sections != NULL) - free (sections); - return NULL; -} - -#define TARGET_BIG_SYM bfd_elf32_sh_vec -#define TARGET_BIG_NAME "elf32-sh" -#define TARGET_LITTLE_SYM bfd_elf32_shl_vec -#define TARGET_LITTLE_NAME "elf32-shl" -#define ELF_ARCH bfd_arch_sh -#define ELF_MACHINE_CODE EM_SH -#define ELF_MAXPAGESIZE 0x1 - -#define elf_symbol_leading_char '_' - -#define bfd_elf32_bfd_reloc_type_lookup sh_elf_reloc_type_lookup -#define elf_info_to_howto sh_elf_info_to_howto -#define bfd_elf32_bfd_relax_section sh_elf_relax_section -#define elf_backend_relocate_section sh_elf_relocate_section -#define bfd_elf32_bfd_get_relocated_section_contents \ - sh_elf_get_relocated_section_contents - -#include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf32-v850.c b/contrib/binutils/bfd/elf32-v850.c deleted file mode 100644 index 3df09143d322..000000000000 --- a/contrib/binutils/bfd/elf32-v850.c +++ /dev/null @@ -1,2235 +0,0 @@ -/* V850-specific support for 32-bit ELF - Copyright 1996, 1997, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* XXX FIXME: This code is littered with 32bit int, 16bit short, 8bit char - dependencies. As is the gas & simulator code or the v850. */ - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" -#include "libbfd.h" -#include "elf-bfd.h" -#include "elf/v850.h" - -/* sign-extend a 24-bit number */ -#define SEXT24(x) ((((x) & 0xffffff) ^ (~ 0x7fffff)) + 0x800000) - -static reloc_howto_type *v850_elf_reloc_type_lookup - PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); -static void v850_elf_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); -static void v850_elf_info_to_howto_rela - PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); -static bfd_reloc_status_type v850_elf_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static boolean v850_elf_is_local_label_name - PARAMS ((bfd *, const char *)); -static boolean v850_elf_relocate_section - PARAMS((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); -static bfd_reloc_status_type v850_elf_perform_relocation - PARAMS ((bfd *, int, bfd_vma, bfd_byte *)); -static boolean v850_elf_check_relocs - PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); -static void remember_hi16s_reloc - PARAMS ((bfd *, bfd_vma, bfd_byte *)); -static bfd_byte * find_remembered_hi16s_reloc - PARAMS ((bfd_vma, boolean *)); -static bfd_reloc_status_type v850_elf_final_link_relocate - PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *, bfd_byte *, bfd_vma, - bfd_vma, bfd_vma, struct bfd_link_info *, asection *, int)); -static boolean v850_elf_object_p - PARAMS ((bfd *)); -static boolean v850_elf_fake_sections - PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *)); -static void v850_elf_final_write_processing - PARAMS ((bfd *, boolean)); -static boolean v850_elf_set_private_flags - PARAMS ((bfd *, flagword)); -static boolean v850_elf_copy_private_bfd_data - PARAMS ((bfd *, bfd *)); -static boolean v850_elf_merge_private_bfd_data - PARAMS ((bfd *, bfd *)); -static boolean v850_elf_print_private_bfd_data - PARAMS ((bfd *, PTR)); -static boolean v850_elf_section_from_bfd_section - PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *)); -static void v850_elf_symbol_processing - PARAMS ((bfd *, asymbol *)); -static boolean v850_elf_add_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, - const char **, flagword *, asection **, bfd_vma *)); -static boolean v850_elf_link_output_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const char *, - Elf_Internal_Sym *, asection *)); -static boolean v850_elf_section_from_shdr - PARAMS ((bfd *, Elf_Internal_Shdr *, char *)); - -/* Note: It is REQUIRED that the 'type' value of each entry in this array - match the index of the entry in the array. */ -static reloc_howto_type v850_elf_howto_table[] = -{ - /* This reloc does nothing. */ - HOWTO (R_V850_NONE, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_V850_NONE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* A PC relative 9 bit branch. */ - HOWTO (R_V850_9_PCREL, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_9_PCREL", /* name */ - false, /* partial_inplace */ - 0x00ffffff, /* src_mask */ - 0x00ffffff, /* dst_mask */ - true), /* pcrel_offset */ - - /* A PC relative 22 bit branch. */ - HOWTO (R_V850_22_PCREL, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 22, /* bitsize */ - true, /* pc_relative */ - 7, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_22_PCREL", /* name */ - false, /* partial_inplace */ - 0x07ffff80, /* src_mask */ - 0x07ffff80, /* dst_mask */ - true), /* pcrel_offset */ - - /* High 16 bits of symbol value. */ - HOWTO (R_V850_HI16_S, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_HI16_S", /* name */ - false, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of symbol value. */ - HOWTO (R_V850_HI16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_HI16", /* name */ - false, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of symbol value. */ - HOWTO (R_V850_LO16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_LO16", /* name */ - false, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Simple 32bit reloc. */ - HOWTO (R_V850_32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_32", /* name */ - false, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Simple 16bit reloc. */ - HOWTO (R_V850_16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_V850_16", /* name */ - false, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Simple 8bit reloc. */ - HOWTO (R_V850_8, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_V850_8", /* name */ - false, /* partial_inplace */ - 0xff, /* src_mask */ - 0xff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit offset from the short data area pointer. */ - HOWTO (R_V850_SDA_16_16_OFFSET, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_SDA_16_16_OFFSET", /* name */ - false, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 15 bit offset from the short data area pointer. */ - HOWTO (R_V850_SDA_15_16_OFFSET, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 1, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_SDA_15_16_OFFSET", /* name */ - false, /* partial_inplace */ - 0xfffe, /* src_mask */ - 0xfffe, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit offset from the zero data area pointer. */ - HOWTO (R_V850_ZDA_16_16_OFFSET, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_ZDA_16_16_OFFSET", /* name */ - false, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 15 bit offset from the zero data area pointer. */ - HOWTO (R_V850_ZDA_15_16_OFFSET, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 1, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_ZDA_15_16_OFFSET", /* name */ - false, /* partial_inplace */ - 0xfffe, /* src_mask */ - 0xfffe, /* dst_mask */ - false), /* pcrel_offset */ - - /* 6 bit offset from the tiny data area pointer. */ - HOWTO (R_V850_TDA_6_8_OFFSET, /* type */ - 2, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 1, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_TDA_6_8_OFFSET", /* name */ - false, /* partial_inplace */ - 0x7e, /* src_mask */ - 0x7e, /* dst_mask */ - false), /* pcrel_offset */ - - /* 8 bit offset from the tiny data area pointer. */ - HOWTO (R_V850_TDA_7_8_OFFSET, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_TDA_7_8_OFFSET", /* name */ - false, /* partial_inplace */ - 0x7f, /* src_mask */ - 0x7f, /* dst_mask */ - false), /* pcrel_offset */ - - /* 7 bit offset from the tiny data area pointer. */ - HOWTO (R_V850_TDA_7_7_OFFSET, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 7, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_TDA_7_7_OFFSET", /* name */ - false, /* partial_inplace */ - 0x7f, /* src_mask */ - 0x7f, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit offset from the tiny data area pointer! */ - HOWTO (R_V850_TDA_16_16_OFFSET, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_TDA_16_16_OFFSET", /* name */ - false, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xfff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 5 bit offset from the tiny data area pointer. */ - HOWTO (R_V850_TDA_4_5_OFFSET, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 5, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_TDA_4_5_OFFSET", /* name */ - false, /* partial_inplace */ - 0x0f, /* src_mask */ - 0x0f, /* dst_mask */ - false), /* pcrel_offset */ - - /* 4 bit offset from the tiny data area pointer. */ - HOWTO (R_V850_TDA_4_4_OFFSET, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 4, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_TDA_4_4_OFFSET", /* name */ - false, /* partial_inplace */ - 0x0f, /* src_mask */ - 0x0f, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit offset from the short data area pointer. */ - HOWTO (R_V850_SDA_16_16_SPLIT_OFFSET, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_SDA_16_16_SPLIT_OFFSET",/* name */ - false, /* partial_inplace */ - 0xfffe0020, /* src_mask */ - 0xfffe0020, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit offset from the zero data area pointer. */ - HOWTO (R_V850_ZDA_16_16_SPLIT_OFFSET, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_ZDA_16_16_SPLIT_OFFSET",/* name */ - false, /* partial_inplace */ - 0xfffe0020, /* src_mask */ - 0xfffe0020, /* dst_mask */ - false), /* pcrel_offset */ - - /* 6 bit offset from the call table base pointer. */ - HOWTO (R_V850_CALLT_6_7_OFFSET, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 7, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_CALLT_6_7_OFFSET", /* name */ - false, /* partial_inplace */ - 0x3f, /* src_mask */ - 0x3f, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit offset from the call table base pointer. */ - HOWTO (R_V850_CALLT_16_16_OFFSET, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - v850_elf_reloc, /* special_function */ - "R_V850_CALLT_16_16_OFFSET", /* name */ - false, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* GNU extension to record C++ vtable hierarchy */ - HOWTO (R_V850_GNU_VTINHERIT, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - NULL, /* special_function */ - "R_V850_GNU_VTINHERIT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* GNU extension to record C++ vtable member usage */ - HOWTO (R_V850_GNU_VTENTRY, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_elf_rel_vtable_reloc_fn, /* special_function */ - "R_V850_GNU_VTENTRY", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - -}; - -/* Map BFD reloc types to V850 ELF reloc types. */ - -struct v850_elf_reloc_map -{ - /* BFD_RELOC_V850_CALLT_16_16_OFFSET is 258, which will not fix in an - unsigned char. */ - bfd_reloc_code_real_type bfd_reloc_val; - unsigned char elf_reloc_val; -}; - -static const struct v850_elf_reloc_map v850_elf_reloc_map[] = -{ - { BFD_RELOC_NONE, R_V850_NONE }, - { BFD_RELOC_V850_9_PCREL, R_V850_9_PCREL }, - { BFD_RELOC_V850_22_PCREL, R_V850_22_PCREL }, - { BFD_RELOC_HI16_S, R_V850_HI16_S }, - { BFD_RELOC_HI16, R_V850_HI16 }, - { BFD_RELOC_LO16, R_V850_LO16 }, - { BFD_RELOC_32, R_V850_32 }, - { BFD_RELOC_16, R_V850_16 }, - { BFD_RELOC_8, R_V850_8 }, - { BFD_RELOC_V850_SDA_16_16_OFFSET, R_V850_SDA_16_16_OFFSET }, - { BFD_RELOC_V850_SDA_15_16_OFFSET, R_V850_SDA_15_16_OFFSET }, - { BFD_RELOC_V850_ZDA_16_16_OFFSET, R_V850_ZDA_16_16_OFFSET }, - { BFD_RELOC_V850_ZDA_15_16_OFFSET, R_V850_ZDA_15_16_OFFSET }, - { BFD_RELOC_V850_TDA_6_8_OFFSET, R_V850_TDA_6_8_OFFSET }, - { BFD_RELOC_V850_TDA_7_8_OFFSET, R_V850_TDA_7_8_OFFSET }, - { BFD_RELOC_V850_TDA_7_7_OFFSET, R_V850_TDA_7_7_OFFSET }, - { BFD_RELOC_V850_TDA_16_16_OFFSET, R_V850_TDA_16_16_OFFSET }, - { BFD_RELOC_V850_TDA_4_5_OFFSET, R_V850_TDA_4_5_OFFSET }, - { BFD_RELOC_V850_TDA_4_4_OFFSET, R_V850_TDA_4_4_OFFSET }, - { BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET, R_V850_SDA_16_16_SPLIT_OFFSET }, - { BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET, R_V850_ZDA_16_16_SPLIT_OFFSET }, - { BFD_RELOC_V850_CALLT_6_7_OFFSET, R_V850_CALLT_6_7_OFFSET }, - { BFD_RELOC_V850_CALLT_16_16_OFFSET, R_V850_CALLT_16_16_OFFSET }, - { BFD_RELOC_VTABLE_INHERIT, R_V850_GNU_VTINHERIT }, - { BFD_RELOC_VTABLE_ENTRY, R_V850_GNU_VTENTRY }, - -}; - -/* Map a bfd relocation into the appropriate howto structure */ -static reloc_howto_type * -v850_elf_reloc_type_lookup (abfd, code) - bfd * abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; -{ - unsigned int i; - - for (i = 0; - i < sizeof (v850_elf_reloc_map) / sizeof (struct v850_elf_reloc_map); - i++) - { - if (v850_elf_reloc_map[i].bfd_reloc_val == code) - { - BFD_ASSERT (v850_elf_howto_table[v850_elf_reloc_map[i].elf_reloc_val].type == v850_elf_reloc_map[i].elf_reloc_val); - - return & v850_elf_howto_table[v850_elf_reloc_map[i].elf_reloc_val]; - } - } - - return NULL; -} - -/* Set the howto pointer for an V850 ELF reloc. */ -static void -v850_elf_info_to_howto_rel (abfd, cache_ptr, dst) - bfd * abfd ATTRIBUTE_UNUSED; - arelent * cache_ptr; - Elf32_Internal_Rel * dst; -{ - unsigned int r_type; - - r_type = ELF32_R_TYPE (dst->r_info); - BFD_ASSERT (r_type < (unsigned int) R_V850_max); - cache_ptr->howto = &v850_elf_howto_table[r_type]; -} - -/* Set the howto pointer for a V850 ELF reloc (type RELA). */ -static void -v850_elf_info_to_howto_rela (abfd, cache_ptr, dst) - bfd * abfd ATTRIBUTE_UNUSED; - arelent * cache_ptr; - Elf32_Internal_Rela *dst; -{ - unsigned int r_type; - - r_type = ELF32_R_TYPE (dst->r_info); - BFD_ASSERT (r_type < (unsigned int) R_V850_max); - cache_ptr->howto = &v850_elf_howto_table[r_type]; -} - -/* Look through the relocs for a section during the first phase, and - allocate space in the global offset table or procedure linkage - table. */ - -static boolean -v850_elf_check_relocs (abfd, info, sec, relocs) - bfd * abfd; - struct bfd_link_info * info; - asection * sec; - const Elf_Internal_Rela * relocs; -{ - boolean ret = true; - bfd *dynobj; - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - const Elf_Internal_Rela *rel; - const Elf_Internal_Rela *rel_end; - asection *sreloc; - enum v850_reloc_type r_type; - int other = 0; - const char *common = (const char *)0; - - if (info->relocateable) - return true; - -#ifdef DEBUG - fprintf (stderr, "v850_elf_check_relocs called for section %s in %s\n", - bfd_get_section_name (abfd, sec), - bfd_get_filename (abfd)); -#endif - - dynobj = elf_hash_table (info)->dynobj; - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (abfd); - sreloc = NULL; - - rel_end = relocs + sec->reloc_count; - for (rel = relocs; rel < rel_end; rel++) - { - unsigned long r_symndx; - struct elf_link_hash_entry *h; - - r_symndx = ELF32_R_SYM (rel->r_info); - if (r_symndx < symtab_hdr->sh_info) - h = NULL; - else - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - - r_type = (enum v850_reloc_type) ELF32_R_TYPE (rel->r_info); - switch (r_type) - { - default: - case R_V850_NONE: - case R_V850_9_PCREL: - case R_V850_22_PCREL: - case R_V850_HI16_S: - case R_V850_HI16: - case R_V850_LO16: - case R_V850_32: - case R_V850_16: - case R_V850_8: - case R_V850_CALLT_6_7_OFFSET: - case R_V850_CALLT_16_16_OFFSET: - break; - - /* This relocation describes the C++ object vtable hierarchy. - Reconstruct it for later use during GC. */ - case R_V850_GNU_VTINHERIT: - if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) - return false; - break; - - /* This relocation describes which C++ vtable entries are actually - used. Record for later use during GC. */ - case R_V850_GNU_VTENTRY: - if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend)) - return false; - break; - - case R_V850_SDA_16_16_SPLIT_OFFSET: - case R_V850_SDA_16_16_OFFSET: - case R_V850_SDA_15_16_OFFSET: - other = V850_OTHER_SDA; - common = ".scommon"; - goto small_data_common; - - case R_V850_ZDA_16_16_SPLIT_OFFSET: - case R_V850_ZDA_16_16_OFFSET: - case R_V850_ZDA_15_16_OFFSET: - other = V850_OTHER_ZDA; - common = ".zcommon"; - goto small_data_common; - - case R_V850_TDA_4_5_OFFSET: - case R_V850_TDA_4_4_OFFSET: - case R_V850_TDA_6_8_OFFSET: - case R_V850_TDA_7_8_OFFSET: - case R_V850_TDA_7_7_OFFSET: - case R_V850_TDA_16_16_OFFSET: - other = V850_OTHER_TDA; - common = ".tcommon"; - /* fall through */ - -#define V850_OTHER_MASK (V850_OTHER_TDA | V850_OTHER_SDA | V850_OTHER_ZDA) - - small_data_common: - if (h) - { - h->other |= other; /* flag which type of relocation was used */ - if ((h->other & V850_OTHER_MASK) != (other & V850_OTHER_MASK) - && (h->other & V850_OTHER_ERROR) == 0) - { - const char * msg; - static char buff[200]; /* XXX */ - - switch (h->other & V850_OTHER_MASK) - { - default: - msg = _("Variable `%s' cannot occupy in multiple small data regions"); - break; - case V850_OTHER_SDA | V850_OTHER_ZDA | V850_OTHER_TDA: - msg = _("Variable `%s' can only be in one of the small, zero, and tiny data regions"); - break; - case V850_OTHER_SDA | V850_OTHER_ZDA: - msg = _("Variable `%s' cannot be in both small and zero data regions simultaneously"); - break; - case V850_OTHER_SDA | V850_OTHER_TDA: - msg = _("Variable `%s' cannot be in both small and tiny data regions simultaneously"); - break; - case V850_OTHER_ZDA | V850_OTHER_TDA: - msg = _("Variable `%s' cannot be in both zero and tiny data regions simultaneously"); - break; - } - - sprintf (buff, msg, h->root.root.string); - info->callbacks->warning (info, buff, h->root.root.string, - abfd, h->root.u.def.section, 0); - - bfd_set_error (bfd_error_bad_value); - h->other |= V850_OTHER_ERROR; - ret = false; - } - } - - if (h && h->root.type == bfd_link_hash_common - && h->root.u.c.p - && !strcmp (bfd_get_section_name (abfd, h->root.u.c.p->section), "COMMON")) - { - asection *section = h->root.u.c.p->section = bfd_make_section_old_way (abfd, common); - section->flags |= SEC_IS_COMMON; - } - -#ifdef DEBUG - fprintf (stderr, "v850_elf_check_relocs, found %s relocation for %s%s\n", - v850_elf_howto_table[ (int)r_type ].name, - (h && h->root.root.string) ? h->root.root.string : "<unknown>", - (h->root.type == bfd_link_hash_common) ? ", symbol is common" : ""); -#endif - break; - } - } - - return ret; -} - -/* - * In the old version, when an entry was checked out from the table, - * it was deleted. This produced an error if the entry was needed - * more than once, as the second attempted retry failed. - * - * In the current version, the entry is not deleted, instead we set - * the field 'found' to true. If a second lookup matches the same - * entry, then we know that the hi16s reloc has already been updated - * and does not need to be updated a second time. - * - * TODO - TOFIX: If it is possible that we need to restore 2 different - * addresses from the same table entry, where the first generates an - * overflow, whilst the second do not, then this code will fail. - */ - -typedef struct hi16s_location -{ - bfd_vma addend; - bfd_byte * address; - unsigned long counter; - boolean found; - struct hi16s_location * next; -} -hi16s_location; - -static hi16s_location * previous_hi16s; -static hi16s_location * free_hi16s; -static unsigned long hi16s_counter; - -static void -remember_hi16s_reloc (abfd, addend, address) - bfd * abfd; - bfd_vma addend; - bfd_byte * address; -{ - hi16s_location * entry = NULL; - - /* Find a free structure. */ - if (free_hi16s == NULL) - free_hi16s = (hi16s_location *) bfd_zalloc (abfd, sizeof (* free_hi16s)); - - entry = free_hi16s; - free_hi16s = free_hi16s->next; - - entry->addend = addend; - entry->address = address; - entry->counter = hi16s_counter ++; - entry->found = false; - entry->next = previous_hi16s; - previous_hi16s = entry; - - /* Cope with wrap around of our counter. */ - if (hi16s_counter == 0) - { - /* XXX - Assume that all counter entries differ only in their low 16 bits. */ - for (entry = previous_hi16s; entry != NULL; entry = entry->next) - entry->counter &= 0xffff; - - hi16s_counter = 0x10000; - } - - return; -} - -static bfd_byte * -find_remembered_hi16s_reloc (addend, already_found) - bfd_vma addend; - boolean * already_found; -{ - hi16s_location * match = NULL; - hi16s_location * entry; - hi16s_location * previous = NULL; - hi16s_location * prev; - bfd_byte * addr; - - /* Search the table. Record the most recent entry that matches. */ - for (entry = previous_hi16s; entry; entry = entry->next) - { - if (entry->addend == addend - && (match == NULL || match->counter < entry->counter)) - { - previous = prev; - match = entry; - } - - prev = entry; - } - - if (match == NULL) - return NULL; - - /* Extract the address. */ - addr = match->address; - - /* Remeber if this entry has already been used before. */ - if (already_found) - * already_found = match->found; - - /* Note that this entry has now been used. */ - match->found = true; - - return addr; -} - -/* FIXME: The code here probably ought to be removed and the code in reloc.c - allowed to do its stuff instead. At least for most of the relocs, anwyay. */ -static bfd_reloc_status_type -v850_elf_perform_relocation (abfd, r_type, addend, address) - bfd * abfd; - int r_type; - bfd_vma addend; - bfd_byte * address; -{ - unsigned long insn; - bfd_signed_vma saddend = (bfd_signed_vma) addend; - - switch (r_type) - { - default: - /* fprintf (stderr, "reloc type %d not SUPPORTED\n", r_type ); */ - return bfd_reloc_notsupported; - - case R_V850_32: - bfd_put_32 (abfd, addend, address); - return bfd_reloc_ok; - - case R_V850_22_PCREL: - if (saddend > 0x1fffff || saddend < -0x200000) - return bfd_reloc_overflow; - - if ((addend % 2) != 0) - return bfd_reloc_dangerous; - - insn = bfd_get_32 (abfd, address); - insn &= ~0xfffe003f; - insn |= (((addend & 0xfffe) << 16) | ((addend & 0x3f0000) >> 16)); - bfd_put_32 (abfd, insn, address); - return bfd_reloc_ok; - - case R_V850_9_PCREL: - if (saddend > 0xff || saddend < -0x100) - return bfd_reloc_overflow; - - if ((addend % 2) != 0) - return bfd_reloc_dangerous; - - insn = bfd_get_16 (abfd, address); - insn &= ~ 0xf870; - insn |= ((addend & 0x1f0) << 7) | ((addend & 0x0e) << 3); - break; - - case R_V850_HI16: - addend += (bfd_get_16 (abfd, address) << 16); - addend = (addend >> 16); - insn = addend; - break; - - case R_V850_HI16_S: - /* Remember where this relocation took place. */ - remember_hi16s_reloc (abfd, addend, address); - - addend += (bfd_get_16 (abfd, address) << 16); - addend = (addend >> 16) + ((addend & 0x8000) != 0); - - /* This relocation cannot overflow. */ - if (addend > 0x7fff) - addend = 0; - - insn = addend; - break; - - case R_V850_LO16: - /* Calculate the sum of the value stored in the instruction and the - addend and check for overflow from the low 16 bits into the high - 16 bits. The assembler has already done some of this: If the - value stored in the instruction has its 15th bit set, (counting - from zero) then the assembler will have added 1 to the value - stored in the associated HI16S reloc. So for example, these - relocations: - - movhi hi( fred ), r0, r1 - movea lo( fred ), r1, r1 - - will store 0 in the value fields for the MOVHI and MOVEA instructions - and addend will be the address of fred, but for these instructions: - - movhi hi( fred + 0x123456), r0, r1 - movea lo( fred + 0x123456), r1, r1 - - the value stored in the MOVHI instruction will be 0x12 and the value - stored in the MOVEA instruction will be 0x3456. If however the - instructions were: - - movhi hi( fred + 0x10ffff), r0, r1 - movea lo( fred + 0x10ffff), r1, r1 - - then the value stored in the MOVHI instruction would be 0x11 (not - 0x10) and the value stored in the MOVEA instruction would be 0xffff. - Thus (assuming for the moment that the addend is 0), at run time the - MOVHI instruction loads 0x110000 into r1, then the MOVEA instruction - adds 0xffffffff (sign extension!) producing 0x10ffff. Similarly if - the instructions were: - - movhi hi( fred - 1), r0, r1 - movea lo( fred - 1), r1, r1 - - then 0 is stored in the MOVHI instruction and -1 is stored in the - MOVEA instruction. - - Overflow can occur if the addition of the value stored in the - instruction plus the addend sets the 15th bit when before it was clear. - This is because the 15th bit will be sign extended into the high part, - thus reducing its value by one, but since the 15th bit was originally - clear, the assembler will not have added 1 to the previous HI16S reloc - to compensate for this effect. For example: - - movhi hi( fred + 0x123456), r0, r1 - movea lo( fred + 0x123456), r1, r1 - - The value stored in HI16S reloc is 0x12, the value stored in the LO16 - reloc is 0x3456. If we assume that the address of fred is 0x00007000 - then the relocations become: - - HI16S: 0x0012 + (0x00007000 >> 16) = 0x12 - LO16: 0x3456 + (0x00007000 & 0xffff) = 0xa456 - - but when the instructions are executed, the MOVEA instruction's value - is signed extended, so the sum becomes: - - 0x00120000 - + 0xffffa456 - ------------ - 0x0011a456 but 'fred + 0x123456' = 0x0012a456 - - Note that if the 15th bit was set in the value stored in the LO16 - reloc, then we do not have to do anything: - - movhi hi( fred + 0x10ffff), r0, r1 - movea lo( fred + 0x10ffff), r1, r1 - - HI16S: 0x0011 + (0x00007000 >> 16) = 0x11 - LO16: 0xffff + (0x00007000 & 0xffff) = 0x6fff - - 0x00110000 - + 0x00006fff - ------------ - 0x00116fff = fred + 0x10ffff = 0x7000 + 0x10ffff - - Overflow can also occur if the computation carries into the 16th bit - and it also results in the 15th bit having the same value as the 15th - bit of the original value. What happens is that the HI16S reloc - will have already examined the 15th bit of the original value and - added 1 to the high part if the bit is set. This compensates for the - sign extension of 15th bit of the result of the computation. But now - there is a carry into the 16th bit, and this has not been allowed for. - - So, for example if fred is at address 0xf000: - - movhi hi( fred + 0xffff), r0, r1 [bit 15 of the offset is set] - movea lo( fred + 0xffff), r1, r1 - - HI16S: 0x0001 + (0x0000f000 >> 16) = 0x0001 - LO16: 0xffff + (0x0000f000 & 0xffff) = 0xefff (carry into bit 16 is lost) - - 0x00010000 - + 0xffffefff - ------------ - 0x0000efff but 'fred + 0xffff' = 0x0001efff - - Similarly, if the 15th bit remains clear, but overflow occurs into - the 16th bit then (assuming the address of fred is 0xf000): - - movhi hi( fred + 0x7000), r0, r1 [bit 15 of the offset is clear] - movea lo( fred + 0x7000), r1, r1 - - HI16S: 0x0000 + (0x0000f000 >> 16) = 0x0000 - LO16: 0x7000 + (0x0000f000 & 0xffff) = 0x6fff (carry into bit 16 is lost) - - 0x00000000 - + 0x00006fff - ------------ - 0x00006fff but 'fred + 0x7000' = 0x00016fff - - Note - there is no need to change anything if a carry occurs, and the - 15th bit changes its value from being set to being clear, as the HI16S - reloc will have already added in 1 to the high part for us: - - movhi hi( fred + 0xffff), r0, r1 [bit 15 of the offset is set] - movea lo( fred + 0xffff), r1, r1 - - HI16S: 0x0001 + (0x00007000 >> 16) - LO16: 0xffff + (0x00007000 & 0xffff) = 0x6fff (carry into bit 16 is lost) - - 0x00010000 - + 0x00006fff (bit 15 not set, so the top half is zero) - ------------ - 0x00016fff which is right (assuming that fred is at 0x7000) - - but if the 15th bit goes from being clear to being set, then we must - once again handle overflow: - - movhi hi( fred + 0x7000), r0, r1 [bit 15 of the offset is clear] - movea lo( fred + 0x7000), r1, r1 - - HI16S: 0x0000 + (0x0000ffff >> 16) - LO16: 0x7000 + (0x0000ffff & 0xffff) = 0x6fff (carry into bit 16) - - 0x00000000 - + 0x00006fff (bit 15 not set, so the top half is zero) - ------------ - 0x00006fff which is wrong (assuming that fred is at 0xffff) - */ - - { - long result; - - insn = bfd_get_16 (abfd, address); - result = insn + addend; - -#define BIT15_SET(x) ((x) & 0x8000) -#define OVERFLOWS(a,i) ((((a) & 0xffff) + (i)) > 0xffff) - - if ((BIT15_SET (result) && ! BIT15_SET (addend)) - || (OVERFLOWS (addend, insn) - && ((! BIT15_SET (insn)) || (BIT15_SET (addend))))) - { - boolean already_updated; - bfd_byte * hi16s_address = find_remembered_hi16s_reloc - (addend, & already_updated); - - /* Amend the matching HI16_S relocation. */ - if (hi16s_address != NULL) - { - if (! already_updated) - { - insn = bfd_get_16 (abfd, hi16s_address); - insn += 1; - bfd_put_16 (abfd, insn, hi16s_address); - } - } - else - { - fprintf (stderr, _("FAILED to find previous HI16 reloc\n")); - return bfd_reloc_overflow; - } - } - - /* Do not complain if value has top bit set, as this has been anticipated. */ - insn = result & 0xffff; - break; - } - - case R_V850_8: - addend += (char) bfd_get_8 (abfd, address); - - saddend = (bfd_signed_vma) addend; - - if (saddend > 0x7f || saddend < -0x80) - return bfd_reloc_overflow; - - bfd_put_8 (abfd, addend, address); - return bfd_reloc_ok; - - case R_V850_CALLT_16_16_OFFSET: - addend += bfd_get_16 (abfd, address); - - saddend = (bfd_signed_vma) addend; - - if (saddend > 0xffff || saddend < 0) - return bfd_reloc_overflow; - - insn = addend; - break; - - case R_V850_16: - - /* drop through */ - case R_V850_SDA_16_16_OFFSET: - case R_V850_ZDA_16_16_OFFSET: - case R_V850_TDA_16_16_OFFSET: - addend += bfd_get_16 (abfd, address); - - saddend = (bfd_signed_vma) addend; - - if (saddend > 0x7fff || saddend < -0x8000) - return bfd_reloc_overflow; - - insn = addend; - break; - - case R_V850_SDA_15_16_OFFSET: - case R_V850_ZDA_15_16_OFFSET: - insn = bfd_get_16 (abfd, address); - addend += (insn & 0xfffe); - - saddend = (bfd_signed_vma) addend; - - if (saddend > 0x7ffe || saddend < -0x8000) - return bfd_reloc_overflow; - - if (addend & 1) - return bfd_reloc_dangerous; - - insn = (addend & ~1) | (insn & 1); - break; - - case R_V850_TDA_6_8_OFFSET: - insn = bfd_get_16 (abfd, address); - addend += ((insn & 0x7e) << 1); - - saddend = (bfd_signed_vma) addend; - - if (saddend > 0xfc || saddend < 0) - return bfd_reloc_overflow; - - if (addend & 3) - return bfd_reloc_dangerous; - - insn &= 0xff81; - insn |= (addend >> 1); - break; - - case R_V850_TDA_7_8_OFFSET: - insn = bfd_get_16 (abfd, address); - addend += ((insn & 0x7f) << 1); - - saddend = (bfd_signed_vma) addend; - - if (saddend > 0xfe || saddend < 0) - return bfd_reloc_overflow; - - if (addend & 1) - return bfd_reloc_dangerous; - - insn &= 0xff80; - insn |= (addend >> 1); - break; - - case R_V850_TDA_7_7_OFFSET: - insn = bfd_get_16 (abfd, address); - addend += insn & 0x7f; - - saddend = (bfd_signed_vma) addend; - - if (saddend > 0x7f || saddend < 0) - return bfd_reloc_overflow; - - insn &= 0xff80; - insn |= addend; - break; - - case R_V850_TDA_4_5_OFFSET: - insn = bfd_get_16 (abfd, address); - addend += ((insn & 0xf) << 1); - - saddend = (bfd_signed_vma) addend; - - if (saddend > 0x1e || saddend < 0) - return bfd_reloc_overflow; - - if (addend & 1) - return bfd_reloc_dangerous; - - insn &= 0xfff0; - insn |= (addend >> 1); - break; - - case R_V850_TDA_4_4_OFFSET: - insn = bfd_get_16 (abfd, address); - addend += insn & 0xf; - - saddend = (bfd_signed_vma) addend; - - if (saddend > 0xf || saddend < 0) - return bfd_reloc_overflow; - - insn &= 0xfff0; - insn |= addend; - break; - - case R_V850_ZDA_16_16_SPLIT_OFFSET: - case R_V850_SDA_16_16_SPLIT_OFFSET: - insn = bfd_get_32 (abfd, address); - addend += ((insn & 0xfffe0000) >> 16) + ((insn & 0x20) >> 5); - - saddend = (bfd_signed_vma) addend; - - if (saddend > 0x7fff || saddend < -0x8000) - return bfd_reloc_overflow; - - insn &= 0x0001ffdf; - insn |= (addend & 1) << 5; - insn |= (addend & ~1) << 16; - - bfd_put_32 (abfd, insn, address); - return bfd_reloc_ok; - - case R_V850_CALLT_6_7_OFFSET: - insn = bfd_get_16 (abfd, address); - addend += ((insn & 0x3f) << 1); - - saddend = (bfd_signed_vma) addend; - - if (saddend > 0x7e || saddend < 0) - return bfd_reloc_overflow; - - if (addend & 1) - return bfd_reloc_dangerous; - - insn &= 0xff80; - insn |= (addend >> 1); - break; - - case R_V850_GNU_VTINHERIT: - case R_V850_GNU_VTENTRY: - return bfd_reloc_ok; - - } - - bfd_put_16 (abfd, insn, address); - return bfd_reloc_ok; -} - -/* Insert the addend into the instruction. */ -static bfd_reloc_status_type -v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err) - bfd * abfd ATTRIBUTE_UNUSED; - arelent * reloc; - asymbol * symbol; - PTR data ATTRIBUTE_UNUSED; - asection * isection; - bfd * obfd; - char ** err ATTRIBUTE_UNUSED; -{ - long relocation; - - /* If there is an output BFD, - and the symbol is not a section name (which is only defined at final link time), - and either we are not putting the addend into the instruction - or the addend is zero, so there is nothing to add into the instruction - then just fixup the address and return. */ - if (obfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && (! reloc->howto->partial_inplace - || reloc->addend == 0)) - { - reloc->address += isection->output_offset; - return bfd_reloc_ok; - } -#if 0 - else if (obfd != NULL) - { - return bfd_reloc_continue; - } -#endif - - /* Catch relocs involving undefined symbols. */ - if (bfd_is_und_section (symbol->section) - && (symbol->flags & BSF_WEAK) == 0 - && obfd == NULL) - return bfd_reloc_undefined; - - /* We handle final linking of some relocs ourselves. */ - - /* Is the address of the relocation really within the section? */ - if (reloc->address > isection->_cooked_size) - return bfd_reloc_outofrange; - - /* Work out which section the relocation is targetted at and the - initial relocation command value. */ - - /* Get symbol value. (Common symbols are special.) */ - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - /* Convert input-section-relative symbol value to absolute + addend. */ - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc->addend; - -#if 0 /* Since this reloc is going to be processed later on, we should - not make it pc-relative here. To test this, try assembling and - linking this program: - - .text - .globl _start - nop - _start: - jr foo - - .section ".foo","ax" - nop - foo: - nop - */ - if (reloc->howto->pc_relative == true) - { - /* Here the variable relocation holds the final address of the - symbol we are relocating against, plus any addend. */ - relocation -= isection->output_section->vma + isection->output_offset; - - /* Deal with pcrel_offset */ - relocation -= reloc->address; - } -#endif - reloc->addend = relocation; - return bfd_reloc_ok; -} - -static boolean -v850_elf_is_local_label_name (abfd, name) - bfd * abfd ATTRIBUTE_UNUSED; - const char * name; -{ - return ( (name[0] == '.' && (name[1] == 'L' || name[1] == '.')) - || (name[0] == '_' && name[1] == '.' && name[2] == 'L' && name[3] == '_')); -} - -/* Perform a relocation as part of a final link. */ -static bfd_reloc_status_type -v850_elf_final_link_relocate (howto, input_bfd, output_bfd, - input_section, contents, offset, value, - addend, info, sym_sec, is_local) - reloc_howto_type * howto; - bfd * input_bfd; - bfd * output_bfd ATTRIBUTE_UNUSED; - asection * input_section; - bfd_byte * contents; - bfd_vma offset; - bfd_vma value; - bfd_vma addend; - struct bfd_link_info * info; - asection * sym_sec; - int is_local ATTRIBUTE_UNUSED; -{ - unsigned long r_type = howto->type; - bfd_byte * hit_data = contents + offset; - - /* Adjust the value according to the relocation. */ - switch (r_type) - { - case R_V850_9_PCREL: - value -= (input_section->output_section->vma - + input_section->output_offset); - value -= offset; - break; - - case R_V850_22_PCREL: - value -= (input_section->output_section->vma - + input_section->output_offset - + offset); - - /* If the sign extension will corrupt the value then we have overflowed. */ - if (((value & 0xff000000) != 0x0) && ((value & 0xff000000) != 0xff000000)) - return bfd_reloc_overflow; - - value = SEXT24 (value); /* Only the bottom 24 bits of the PC are valid */ - break; - - case R_V850_HI16_S: - case R_V850_HI16: - case R_V850_LO16: - case R_V850_16: - case R_V850_32: - case R_V850_8: - break; - - case R_V850_ZDA_15_16_OFFSET: - case R_V850_ZDA_16_16_OFFSET: - case R_V850_ZDA_16_16_SPLIT_OFFSET: - if (sym_sec == NULL) - return bfd_reloc_undefined; - - value -= sym_sec->output_section->vma; - break; - - case R_V850_SDA_15_16_OFFSET: - case R_V850_SDA_16_16_OFFSET: - case R_V850_SDA_16_16_SPLIT_OFFSET: - { - unsigned long gp; - struct bfd_link_hash_entry * h; - - if (sym_sec == NULL) - return bfd_reloc_undefined; - - /* Get the value of __gp. */ - h = bfd_link_hash_lookup (info->hash, "__gp", false, false, true); - if (h == (struct bfd_link_hash_entry *) NULL - || h->type != bfd_link_hash_defined) - return bfd_reloc_other; - - gp = (h->u.def.value - + h->u.def.section->output_section->vma - + h->u.def.section->output_offset); - - value -= sym_sec->output_section->vma; - value -= (gp - sym_sec->output_section->vma); - } - break; - - case R_V850_TDA_4_4_OFFSET: - case R_V850_TDA_4_5_OFFSET: - case R_V850_TDA_16_16_OFFSET: - case R_V850_TDA_7_7_OFFSET: - case R_V850_TDA_7_8_OFFSET: - case R_V850_TDA_6_8_OFFSET: - { - unsigned long ep; - struct bfd_link_hash_entry * h; - - /* Get the value of __ep. */ - h = bfd_link_hash_lookup (info->hash, "__ep", false, false, true); - if (h == (struct bfd_link_hash_entry *) NULL - || h->type != bfd_link_hash_defined) - return bfd_reloc_continue; /* Actually this indicates that __ep could not be found. */ - - ep = (h->u.def.value - + h->u.def.section->output_section->vma - + h->u.def.section->output_offset); - - value -= ep; - } - break; - - case R_V850_CALLT_6_7_OFFSET: - { - unsigned long ctbp; - struct bfd_link_hash_entry * h; - - /* Get the value of __ctbp. */ - h = bfd_link_hash_lookup (info->hash, "__ctbp", false, false, true); - if (h == (struct bfd_link_hash_entry *) NULL - || h->type != bfd_link_hash_defined) - return (bfd_reloc_dangerous + 1); /* Actually this indicates that __ctbp could not be found. */ - - ctbp = (h->u.def.value - + h->u.def.section->output_section->vma - + h->u.def.section->output_offset); - value -= ctbp; - } - break; - - case R_V850_CALLT_16_16_OFFSET: - { - unsigned long ctbp; - struct bfd_link_hash_entry * h; - - if (sym_sec == NULL) - return bfd_reloc_undefined; - - /* Get the value of __ctbp. */ - h = bfd_link_hash_lookup (info->hash, "__ctbp", false, false, true); - if (h == (struct bfd_link_hash_entry *) NULL - || h->type != bfd_link_hash_defined) - return (bfd_reloc_dangerous + 1); - - ctbp = (h->u.def.value - + h->u.def.section->output_section->vma - + h->u.def.section->output_offset); - - value -= sym_sec->output_section->vma; - value -= (ctbp - sym_sec->output_section->vma); - } - break; - - case R_V850_NONE: - case R_V850_GNU_VTINHERIT: - case R_V850_GNU_VTENTRY: - return bfd_reloc_ok; - - default: - return bfd_reloc_notsupported; - } - - /* Perform the relocation. */ - return v850_elf_perform_relocation (input_bfd, r_type, value + addend, hit_data); -} - -/* Relocate an V850 ELF section. */ -static boolean -v850_elf_relocate_section (output_bfd, info, input_bfd, input_section, - contents, relocs, local_syms, local_sections) - bfd * output_bfd; - struct bfd_link_info * info; - bfd * input_bfd; - asection * input_section; - bfd_byte * contents; - Elf_Internal_Rela * relocs; - Elf_Internal_Sym * local_syms; - asection ** local_sections; -{ - Elf_Internal_Shdr * symtab_hdr; - struct elf_link_hash_entry ** sym_hashes; - Elf_Internal_Rela * rel; - Elf_Internal_Rela * relend; - - symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (input_bfd); - - if (sym_hashes == NULL) - { - info->callbacks->warning - (info, "no hash table available", NULL, input_bfd, input_section, 0); - - return false; - } - - /* Reset the list of remembered HI16S relocs to empty. */ - free_hi16s = previous_hi16s; - previous_hi16s = NULL; - hi16s_counter = 0; - - rel = relocs; - relend = relocs + input_section->reloc_count; - for (; rel < relend; rel++) - { - int r_type; - reloc_howto_type * howto; - unsigned long r_symndx; - Elf_Internal_Sym * sym; - asection * sec; - struct elf_link_hash_entry * h; - bfd_vma relocation; - bfd_reloc_status_type r; - - r_symndx = ELF32_R_SYM (rel->r_info); - r_type = ELF32_R_TYPE (rel->r_info); - - if (r_type == R_V850_GNU_VTENTRY - || r_type == R_V850_GNU_VTINHERIT) - continue; - - howto = v850_elf_howto_table + r_type; - - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ - h = NULL; - sym = NULL; - sec = NULL; - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - sec = local_sections[r_symndx]; - relocation = (sec->output_section->vma - + sec->output_offset - + sym->st_value); -#if 0 - { - char * name; - name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? "<none>" : name; -fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n", - sec->name, name, sym->st_name, - sec->output_section->vma, sec->output_offset, sym->st_value, rel->r_addend); - } -#endif - } - else - { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); -#if 0 -fprintf (stderr, "defined: sec: %s, name: %s, value: %x + %x + %x gives: %x\n", - sec->name, h->root.root.string, h->root.u.def.value, sec->output_section->vma, sec->output_offset, relocation); -#endif - } - else if (h->root.type == bfd_link_hash_undefweak) - { -#if 0 -fprintf (stderr, "undefined: sec: %s, name: %s\n", - sec->name, h->root.root.string); -#endif - relocation = 0; - } - else - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, true))) - return false; -#if 0 -fprintf (stderr, "unknown: name: %s\n", h->root.root.string); -#endif - relocation = 0; - } - } - - /* FIXME: We should use the addend, but the COFF relocations - don't. */ - r = v850_elf_final_link_relocate (howto, input_bfd, output_bfd, - input_section, - contents, rel->r_offset, - relocation, rel->r_addend, - info, sec, h == NULL); - - if (r != bfd_reloc_ok) - { - const char * name; - const char * msg = (const char *)0; - - if (h != NULL) - name = h->root.root.string; - else - { - name = (bfd_elf_string_from_elf_section - (input_bfd, symtab_hdr->sh_link, sym->st_name)); - if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); - } - - switch (r) - { - case bfd_reloc_overflow: - if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rel->r_offset))) - return false; - break; - - case bfd_reloc_undefined: - if (! ((*info->callbacks->undefined_symbol) - (info, name, input_bfd, input_section, - rel->r_offset, true))) - return false; - break; - - case bfd_reloc_outofrange: - msg = _("internal error: out of range error"); - goto common_error; - - case bfd_reloc_notsupported: - msg = _("internal error: unsupported relocation error"); - goto common_error; - - case bfd_reloc_dangerous: - msg = _("internal error: dangerous relocation"); - goto common_error; - - case bfd_reloc_other: - msg = _("could not locate special linker symbol __gp"); - goto common_error; - - case bfd_reloc_continue: - msg = _("could not locate special linker symbol __ep"); - goto common_error; - - case (bfd_reloc_dangerous + 1): - msg = _("could not locate special linker symbol __ctbp"); - goto common_error; - - default: - msg = _("internal error: unknown error"); - /* fall through */ - - common_error: - if (!((*info->callbacks->warning) - (info, msg, name, input_bfd, input_section, - rel->r_offset))) - return false; - break; - } - } - } - - return true; -} - -static boolean -v850_elf_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - asection *sec ATTRIBUTE_UNUSED; - const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; -{ - /* No got and plt entries for v850-elf */ - return true; -} - -static asection * -v850_elf_gc_mark_hook (abfd, info, rel, h, sym) - bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; -{ - if (h != NULL) - { - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_V850_GNU_VTINHERIT: - case R_V850_GNU_VTENTRY: - break; - - default: - switch (h->root.type) - { - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - return h->root.u.def.section; - - case bfd_link_hash_common: - return h->root.u.c.p->section; - - default: - break; - } - } - } - else - { - if (!(elf_bad_symtab (abfd) - && ELF_ST_BIND (sym->st_info) != STB_LOCAL) - && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE) - && sym->st_shndx != SHN_COMMON)) - { - return bfd_section_from_elf_index (abfd, sym->st_shndx); - } - } - return NULL; -} -/* Set the right machine number. */ -static boolean -v850_elf_object_p (abfd) - bfd *abfd; -{ - switch (elf_elfheader (abfd)->e_flags & EF_V850_ARCH) - { - default: - case E_V850_ARCH: (void) bfd_default_set_arch_mach (abfd, bfd_arch_v850, 0); break; - case E_V850E_ARCH: (void) bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850e); break; - case E_V850EA_ARCH: (void) bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850ea); break; - } - return true; -} - -/* Store the machine number in the flags field. */ -static void -v850_elf_final_write_processing (abfd, linker) - bfd * abfd; - boolean linker ATTRIBUTE_UNUSED; -{ - unsigned long val; - - switch (bfd_get_mach (abfd)) - { - default: - case 0: val = E_V850_ARCH; break; - case bfd_mach_v850e: val = E_V850E_ARCH; break; - case bfd_mach_v850ea: val = E_V850EA_ARCH; break; - } - - elf_elfheader (abfd)->e_flags &=~ EF_V850_ARCH; - elf_elfheader (abfd)->e_flags |= val; -} - -/* Function to keep V850 specific file flags. */ -static boolean -v850_elf_set_private_flags (abfd, flags) - bfd * abfd; - flagword flags; -{ - BFD_ASSERT (!elf_flags_init (abfd) - || elf_elfheader (abfd)->e_flags == flags); - - elf_elfheader (abfd)->e_flags = flags; - elf_flags_init (abfd) = true; - return true; -} - -/* Copy backend specific data from one object module to another */ -static boolean -v850_elf_copy_private_bfd_data (ibfd, obfd) - bfd * ibfd; - bfd * obfd; -{ - if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return true; - - BFD_ASSERT (!elf_flags_init (obfd) - || (elf_elfheader (obfd)->e_flags - == elf_elfheader (ibfd)->e_flags)); - - elf_gp (obfd) = elf_gp (ibfd); - elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags; - elf_flags_init (obfd) = true; - return true; -} - -/* Merge backend specific data from an object file to the output - object file when linking. */ -static boolean -v850_elf_merge_private_bfd_data (ibfd, obfd) - bfd * ibfd; - bfd * obfd; -{ - flagword out_flags; - flagword in_flags; - - if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return true; - - in_flags = elf_elfheader (ibfd)->e_flags; - out_flags = elf_elfheader (obfd)->e_flags; - - if (! elf_flags_init (obfd)) - { - /* If the input is the default architecture then do not - bother setting the flags for the output architecture, - instead allow future merges to do this. If no future - merges ever set these flags then they will retain their - unitialised values, which surprise surprise, correspond - to the default values. */ - if (bfd_get_arch_info (ibfd)->the_default) - return true; - - elf_flags_init (obfd) = true; - elf_elfheader (obfd)->e_flags = in_flags; - - if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) - && bfd_get_arch_info (obfd)->the_default) - { - return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd)); - } - - return true; - } - - /* Check flag compatibility. */ - if (in_flags == out_flags) - return true; - - if ((in_flags & EF_V850_ARCH) != (out_flags & EF_V850_ARCH) - && (in_flags & EF_V850_ARCH) != E_V850_ARCH) - _bfd_error_handler (_("%s: Architecture mismatch with previous modules"), - bfd_get_filename (ibfd)); - - return true; -} -/* Display the flags field */ - -static boolean -v850_elf_print_private_bfd_data (abfd, ptr) - bfd * abfd; - PTR ptr; -{ - FILE * file = (FILE *) ptr; - - BFD_ASSERT (abfd != NULL && ptr != NULL); - - _bfd_elf_print_private_bfd_data (abfd, ptr); - - /* xgettext:c-format */ - fprintf (file, _("private flags = %lx: "), elf_elfheader (abfd)->e_flags); - - switch (elf_elfheader (abfd)->e_flags & EF_V850_ARCH) - { - default: - case E_V850_ARCH: fprintf (file, _("v850 architecture")); break; - case E_V850E_ARCH: fprintf (file, _("v850e architecture")); break; - case E_V850EA_ARCH: fprintf (file, _("v850ea architecture")); break; - } - - fputc ('\n', file); - - return true; -} - -/* V850 ELF uses four common sections. One is the usual one, and the - others are for (small) objects in one of the special data areas: - small, tiny and zero. All the objects are kept together, and then - referenced via the gp register, the ep register or the r0 register - respectively, which yields smaller, faster assembler code. This - approach is copied from elf32-mips.c. */ - -static asection v850_elf_scom_section; -static asymbol v850_elf_scom_symbol; -static asymbol * v850_elf_scom_symbol_ptr; -static asection v850_elf_tcom_section; -static asymbol v850_elf_tcom_symbol; -static asymbol * v850_elf_tcom_symbol_ptr; -static asection v850_elf_zcom_section; -static asymbol v850_elf_zcom_symbol; -static asymbol * v850_elf_zcom_symbol_ptr; - -/* Given a BFD section, try to locate the corresponding ELF section - index. */ - -static boolean -v850_elf_section_from_bfd_section (abfd, hdr, sec, retval) - bfd * abfd ATTRIBUTE_UNUSED; - Elf32_Internal_Shdr * hdr ATTRIBUTE_UNUSED; - asection * sec; - int * retval; -{ - if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) - *retval = SHN_V850_SCOMMON; - else if (strcmp (bfd_get_section_name (abfd, sec), ".tcommon") == 0) - *retval = SHN_V850_TCOMMON; - else if (strcmp (bfd_get_section_name (abfd, sec), ".zcommon") == 0) - *retval = SHN_V850_ZCOMMON; - else - return false; - - return true; -} - -/* Handle the special V850 section numbers that a symbol may use. */ - -static void -v850_elf_symbol_processing (abfd, asym) - bfd * abfd; - asymbol * asym; -{ - elf_symbol_type * elfsym = (elf_symbol_type *) asym; - unsigned short index; - - index = elfsym->internal_elf_sym.st_shndx; - - /* If the section index is an "ordinary" index, then it may - refer to a v850 specific section created by the assembler. - Check the section's type and change the index it matches. - - FIXME: Should we alter the st_shndx field as well ? */ - - if (index < elf_elfheader(abfd)[0].e_shnum) - switch (elf_elfsections(abfd)[index]->sh_type) - { - case SHT_V850_SCOMMON: - index = SHN_V850_SCOMMON; - break; - - case SHT_V850_TCOMMON: - index = SHN_V850_TCOMMON; - break; - - case SHT_V850_ZCOMMON: - index = SHN_V850_ZCOMMON; - break; - - default: - break; - } - - switch (index) - { - case SHN_V850_SCOMMON: - if (v850_elf_scom_section.name == NULL) - { - /* Initialize the small common section. */ - v850_elf_scom_section.name = ".scommon"; - v850_elf_scom_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA; - v850_elf_scom_section.output_section = & v850_elf_scom_section; - v850_elf_scom_section.symbol = & v850_elf_scom_symbol; - v850_elf_scom_section.symbol_ptr_ptr = & v850_elf_scom_symbol_ptr; - v850_elf_scom_symbol.name = ".scommon"; - v850_elf_scom_symbol.flags = BSF_SECTION_SYM; - v850_elf_scom_symbol.section = & v850_elf_scom_section; - v850_elf_scom_symbol_ptr = & v850_elf_scom_symbol; - } - asym->section = & v850_elf_scom_section; - asym->value = elfsym->internal_elf_sym.st_size; - break; - - case SHN_V850_TCOMMON: - if (v850_elf_tcom_section.name == NULL) - { - /* Initialize the tcommon section. */ - v850_elf_tcom_section.name = ".tcommon"; - v850_elf_tcom_section.flags = SEC_IS_COMMON; - v850_elf_tcom_section.output_section = & v850_elf_tcom_section; - v850_elf_tcom_section.symbol = & v850_elf_tcom_symbol; - v850_elf_tcom_section.symbol_ptr_ptr = & v850_elf_tcom_symbol_ptr; - v850_elf_tcom_symbol.name = ".tcommon"; - v850_elf_tcom_symbol.flags = BSF_SECTION_SYM; - v850_elf_tcom_symbol.section = & v850_elf_tcom_section; - v850_elf_tcom_symbol_ptr = & v850_elf_tcom_symbol; - } - asym->section = & v850_elf_tcom_section; - asym->value = elfsym->internal_elf_sym.st_size; - break; - - case SHN_V850_ZCOMMON: - if (v850_elf_zcom_section.name == NULL) - { - /* Initialize the zcommon section. */ - v850_elf_zcom_section.name = ".zcommon"; - v850_elf_zcom_section.flags = SEC_IS_COMMON; - v850_elf_zcom_section.output_section = & v850_elf_zcom_section; - v850_elf_zcom_section.symbol = & v850_elf_zcom_symbol; - v850_elf_zcom_section.symbol_ptr_ptr = & v850_elf_zcom_symbol_ptr; - v850_elf_zcom_symbol.name = ".zcommon"; - v850_elf_zcom_symbol.flags = BSF_SECTION_SYM; - v850_elf_zcom_symbol.section = & v850_elf_zcom_section; - v850_elf_zcom_symbol_ptr = & v850_elf_zcom_symbol; - } - asym->section = & v850_elf_zcom_section; - asym->value = elfsym->internal_elf_sym.st_size; - break; - } -} - -/* Hook called by the linker routine which adds symbols from an object - file. We must handle the special v850 section numbers here. */ - -static boolean -v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) - bfd * abfd; - struct bfd_link_info * info ATTRIBUTE_UNUSED; - const Elf_Internal_Sym * sym; - const char ** namep ATTRIBUTE_UNUSED; - flagword * flagsp ATTRIBUTE_UNUSED; - asection ** secp; - bfd_vma * valp; -{ - int index = sym->st_shndx; - - /* If the section index is an "ordinary" index, then it may - refer to a v850 specific section created by the assembler. - Check the section's type and change the index it matches. - - FIXME: Should we alter the st_shndx field as well ? */ - - if (index < elf_elfheader(abfd)[0].e_shnum) - switch (elf_elfsections(abfd)[index]->sh_type) - { - case SHT_V850_SCOMMON: - index = SHN_V850_SCOMMON; - break; - - case SHT_V850_TCOMMON: - index = SHN_V850_TCOMMON; - break; - - case SHT_V850_ZCOMMON: - index = SHN_V850_ZCOMMON; - break; - - default: - break; - } - - switch (index) - { - case SHN_V850_SCOMMON: - *secp = bfd_make_section_old_way (abfd, ".scommon"); - (*secp)->flags |= SEC_IS_COMMON; - *valp = sym->st_size; - break; - - case SHN_V850_TCOMMON: - *secp = bfd_make_section_old_way (abfd, ".tcommon"); - (*secp)->flags |= SEC_IS_COMMON; - *valp = sym->st_size; - break; - - case SHN_V850_ZCOMMON: - *secp = bfd_make_section_old_way (abfd, ".zcommon"); - (*secp)->flags |= SEC_IS_COMMON; - *valp = sym->st_size; - break; - } - - return true; -} - -/*ARGSIGNORED*/ -static boolean -v850_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec) - bfd * abfd ATTRIBUTE_UNUSED; - struct bfd_link_info * info ATTRIBUTE_UNUSED; - const char * name ATTRIBUTE_UNUSED; - Elf_Internal_Sym * sym; - asection * input_sec; -{ - /* If we see a common symbol, which implies a relocatable link, then - if a symbol was in a special common section in an input file, mark - it as a special common in the output file. */ - - if (sym->st_shndx == SHN_COMMON) - { - if (strcmp (input_sec->name, ".scommon") == 0) - sym->st_shndx = SHN_V850_SCOMMON; - else if (strcmp (input_sec->name, ".tcommon") == 0) - sym->st_shndx = SHN_V850_TCOMMON; - else if (strcmp (input_sec->name, ".zcommon") == 0) - sym->st_shndx = SHN_V850_ZCOMMON; - } - - return true; -} - -static boolean -v850_elf_section_from_shdr (abfd, hdr, name) - bfd * abfd; - Elf_Internal_Shdr * hdr; - char * name; -{ - /* There ought to be a place to keep ELF backend specific flags, but - at the moment there isn't one. We just keep track of the - sections by their name, instead. */ - - if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) - return false; - - switch (hdr->sh_type) - { - case SHT_V850_SCOMMON: - case SHT_V850_TCOMMON: - case SHT_V850_ZCOMMON: - if (! bfd_set_section_flags (abfd, hdr->bfd_section, - (bfd_get_section_flags (abfd, - hdr->bfd_section) - | SEC_IS_COMMON))) - return false; - } - - return true; -} - -/* Set the correct type for a V850 ELF section. We do this by the - section name, which is a hack, but ought to work. */ -static boolean -v850_elf_fake_sections (abfd, hdr, sec) - bfd * abfd ATTRIBUTE_UNUSED; - Elf32_Internal_Shdr * hdr; - asection * sec; -{ - register const char * name; - - name = bfd_get_section_name (abfd, sec); - - if (strcmp (name, ".scommon") == 0) - { - hdr->sh_type = SHT_V850_SCOMMON; - } - else if (strcmp (name, ".tcommon") == 0) - { - hdr->sh_type = SHT_V850_TCOMMON; - } - else if (strcmp (name, ".zcommon") == 0) - hdr->sh_type = SHT_V850_ZCOMMON; - - return true; -} - -#define TARGET_LITTLE_SYM bfd_elf32_v850_vec -#define TARGET_LITTLE_NAME "elf32-v850" -#define ELF_ARCH bfd_arch_v850 -#define ELF_MACHINE_CODE EM_CYGNUS_V850 -#define ELF_MAXPAGESIZE 0x1000 - -#define elf_info_to_howto v850_elf_info_to_howto_rela -#define elf_info_to_howto_rel v850_elf_info_to_howto_rel - -#define elf_backend_check_relocs v850_elf_check_relocs -#define elf_backend_relocate_section v850_elf_relocate_section -#define elf_backend_object_p v850_elf_object_p -#define elf_backend_final_write_processing v850_elf_final_write_processing -#define elf_backend_section_from_bfd_section v850_elf_section_from_bfd_section -#define elf_backend_symbol_processing v850_elf_symbol_processing -#define elf_backend_add_symbol_hook v850_elf_add_symbol_hook -#define elf_backend_link_output_symbol_hook v850_elf_link_output_symbol_hook -#define elf_backend_section_from_shdr v850_elf_section_from_shdr -#define elf_backend_fake_sections v850_elf_fake_sections -#define elf_backend_gc_mark_hook v850_elf_gc_mark_hook -#define elf_backend_gc_sweep_hook v850_elf_gc_sweep_hook - -#define elf_backend_can_gc_sections 1 - -#define bfd_elf32_bfd_is_local_label_name v850_elf_is_local_label_name -#define bfd_elf32_bfd_reloc_type_lookup v850_elf_reloc_type_lookup -#define bfd_elf32_bfd_copy_private_bfd_data v850_elf_copy_private_bfd_data -#define bfd_elf32_bfd_merge_private_bfd_data v850_elf_merge_private_bfd_data -#define bfd_elf32_bfd_set_private_flags v850_elf_set_private_flags -#define bfd_elf32_bfd_print_private_bfd_data v850_elf_print_private_bfd_data - -#define elf_symbol_leading_char '_' - -#include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf64-mips.c b/contrib/binutils/bfd/elf64-mips.c deleted file mode 100644 index 6fc0dcdf0e4b..000000000000 --- a/contrib/binutils/bfd/elf64-mips.c +++ /dev/null @@ -1,2190 +0,0 @@ -/* MIPS-specific support for 64-bit ELF - Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc. - Ian Lance Taylor, Cygnus Support - Linker support added by Mark Mitchell, CodeSourcery, LLC. - <mark@codesourcery.com> - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file supports the 64-bit MIPS ELF ABI. - - The MIPS 64-bit ELF ABI uses an unusual reloc format. This file - overrides the usual ELF reloc handling, and handles reading and - writing the relocations here. - - The MIPS 64-bit ELF ABI also uses an unusual archive map format. */ - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "aout/ar.h" -#include "bfdlink.h" -#include "genlink.h" -#include "elf-bfd.h" -#include "elf/mips.h" - -/* Get the ECOFF swapping routines. The 64-bit ABI is not supposed to - use ECOFF. However, we support it anyhow for an easier changeover. */ -#include "coff/sym.h" -#include "coff/symconst.h" -#include "coff/internal.h" -#include "coff/ecoff.h" -/* The 64 bit versions of the mdebug data structures are in alpha.h. */ -#include "coff/alpha.h" -#define ECOFF_64 -#include "ecoffswap.h" - -static void mips_elf64_swap_reloc_in - PARAMS ((bfd *, const Elf64_Mips_External_Rel *, - Elf64_Mips_Internal_Rel *)); -static void mips_elf64_swap_reloca_in - PARAMS ((bfd *, const Elf64_Mips_External_Rela *, - Elf64_Mips_Internal_Rela *)); -static void mips_elf64_swap_reloc_out - PARAMS ((bfd *, const Elf64_Mips_Internal_Rel *, - Elf64_Mips_External_Rel *)); -static void mips_elf64_swap_reloca_out - PARAMS ((bfd *, const Elf64_Mips_Internal_Rela *, - Elf64_Mips_External_Rela *)); -static void mips_elf64_be_swap_reloc_in - PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rel *)); -static void mips_elf64_be_swap_reloc_out - PARAMS ((bfd *, const Elf_Internal_Rel *, bfd_byte *)); -static void mips_elf64_be_swap_reloca_in - PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *)); -static void mips_elf64_be_swap_reloca_out - PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *)); -static reloc_howto_type *mips_elf64_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static long mips_elf64_get_reloc_upper_bound PARAMS ((bfd *, asection *)); -static boolean mips_elf64_slurp_one_reloc_table - PARAMS ((bfd *, asection *, asymbol **, const Elf_Internal_Shdr *)); -static boolean mips_elf64_slurp_reloc_table - PARAMS ((bfd *, asection *, asymbol **, boolean)); -static void mips_elf64_write_relocs PARAMS ((bfd *, asection *, PTR)); -static boolean mips_elf64_slurp_armap PARAMS ((bfd *)); -static boolean mips_elf64_write_armap - PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); - -/* In case we're on a 32-bit machine, construct a 64-bit "-1" value - from smaller values. Start with zero, widen, *then* decrement. */ -#define MINUS_ONE (((bfd_vma)0) - 1) - -/* The number of local .got entries we reserve. */ -#define MIPS_RESERVED_GOTNO (2) - -/* The relocation table used for SHT_REL sections. */ - -static reloc_howto_type mips_elf64_howto_table_rel[] = -{ - /* No relocation. */ - HOWTO (R_MIPS_NONE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_NONE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit relocation. */ - HOWTO (R_MIPS_16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit relocation. */ - HOWTO (R_MIPS_32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit symbol relative relocation. */ - HOWTO (R_MIPS_REL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_REL32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 26 bit branch address. */ - HOWTO (R_MIPS_26, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - /* This needs complex overflow - detection, because the upper four - bits must match the PC. */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_26", /* name */ - true, /* partial_inplace */ - 0x3ffffff, /* src_mask */ - 0x3ffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of symbol value. */ - HOWTO (R_MIPS_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_hi16_reloc, /* special_function */ - "R_MIPS_HI16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of symbol value. */ - HOWTO (R_MIPS_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_lo16_reloc, /* special_function */ - "R_MIPS_LO16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* GP relative reference. */ - HOWTO (R_MIPS_GPREL16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_gprel16_reloc, /* special_function */ - "R_MIPS_GPREL16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Reference to literal section. */ - HOWTO (R_MIPS_LITERAL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_gprel16_reloc, /* special_function */ - "R_MIPS_LITERAL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Reference to global offset table. */ - HOWTO (R_MIPS_GOT16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_got16_reloc, /* special_function */ - "R_MIPS_GOT16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit PC relative reference. */ - HOWTO (R_MIPS_PC16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PC16", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit call through global offset table. */ - /* FIXME: This is not handled correctly. */ - HOWTO (R_MIPS_CALL16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit GP relative reference. */ - HOWTO (R_MIPS_GPREL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - _bfd_mips_elf_gprel32_reloc, /* special_function */ - "R_MIPS_GPREL32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - { 13 }, - { 14 }, - { 15 }, - - /* A 5 bit shift field. */ - HOWTO (R_MIPS_SHIFT5, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 5, /* bitsize */ - false, /* pc_relative */ - 6, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SHIFT5", /* name */ - true, /* partial_inplace */ - 0x000007c0, /* src_mask */ - 0x000007c0, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 6 bit shift field. */ - /* FIXME: This is not handled correctly; a special function is - needed to put the most significant bit in the right place. */ - HOWTO (R_MIPS_SHIFT6, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 6, /* bitsize */ - false, /* pc_relative */ - 6, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SHIFT6", /* name */ - true, /* partial_inplace */ - 0x000007c4, /* src_mask */ - 0x000007c4, /* dst_mask */ - false), /* pcrel_offset */ - - /* 64 bit relocation. */ - HOWTO (R_MIPS_64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_64", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* Displacement in the global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_DISP, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_DISP", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Displacement to page pointer in the global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_PAGE, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_PAGE", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Offset from page pointer in the global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_OFST, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_OFST", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_HI16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_LO16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 64 bit substraction. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_SUB, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SUB", /* name */ - true, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* Insert the addend as an instruction. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_INSERT_A, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_INSERT_A", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Insert the addend as an instruction, and change all relocations - to refer to the old instruction at the address. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_INSERT_B, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_INSERT_B", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Delete a 32 bit instruction. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_DELETE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_DELETE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Get the higher value of a 64 bit addend. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_HIGHER, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HIGHER", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Get the highest value of a 64 bit addend. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_HIGHEST, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HIGHEST", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_CALL_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL_HI16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_CALL_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL_LO16", /* name */ - true, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* I'm not sure what the remaining relocs are, but they are defined - on Irix 6. */ - - HOWTO (R_MIPS_SCN_DISP, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SCN_DISP", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_REL16, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_REL16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_ADD_IMMEDIATE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_ADD_IMMEDIATE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_PJUMP, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PJUMP", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_RELGOT, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_RELGOT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Protected jump conversion. This is an optimization hint. No - relocation is required for correctness. */ - HOWTO (R_MIPS_JALR, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_JALR", /* name */ - false, /* partial_inplace */ - 0x00000000, /* src_mask */ - 0x00000000, /* dst_mask */ - false), /* pcrel_offset */ -}; - -/* The relocation table used for SHT_RELA sections. */ - -static reloc_howto_type mips_elf64_howto_table_rela[] = -{ - /* No relocation. */ - HOWTO (R_MIPS_NONE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_NONE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit relocation. */ - HOWTO (R_MIPS_16, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit relocation. */ - HOWTO (R_MIPS_32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_32", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit symbol relative relocation. */ - HOWTO (R_MIPS_REL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_REL32", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 26 bit branch address. */ - HOWTO (R_MIPS_26, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - /* This needs complex overflow - detection, because the upper four - bits must match the PC. */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_26", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x3ffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of symbol value. */ - HOWTO (R_MIPS_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HI16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of symbol value. */ - HOWTO (R_MIPS_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_LO16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* GP relative reference. */ - HOWTO (R_MIPS_GPREL16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_gprel16_reloc, /* special_function */ - "R_MIPS_GPREL16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Reference to literal section. */ - HOWTO (R_MIPS_LITERAL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_gprel16_reloc, /* special_function */ - "R_MIPS_LITERAL", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Reference to global offset table. */ - /* FIXME: This is not handled correctly. */ - HOWTO (R_MIPS_GOT16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit PC relative reference. */ - HOWTO (R_MIPS_PC16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - true, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PC16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 16 bit call through global offset table. */ - /* FIXME: This is not handled correctly. */ - HOWTO (R_MIPS_CALL16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 32 bit GP relative reference. */ - HOWTO (R_MIPS_GPREL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - _bfd_mips_elf_gprel32_reloc, /* special_function */ - "R_MIPS_GPREL32", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - { 13 }, - { 14 }, - { 15 }, - - /* A 5 bit shift field. */ - HOWTO (R_MIPS_SHIFT5, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 5, /* bitsize */ - false, /* pc_relative */ - 6, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SHIFT5", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x000007c0, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 6 bit shift field. */ - /* FIXME: This is not handled correctly; a special function is - needed to put the most significant bit in the right place. */ - HOWTO (R_MIPS_SHIFT6, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 6, /* bitsize */ - false, /* pc_relative */ - 6, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SHIFT6", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x000007c4, /* dst_mask */ - false), /* pcrel_offset */ - - /* 64 bit relocation. */ - HOWTO (R_MIPS_64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_64", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* Displacement in the global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_DISP, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_DISP", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Displacement to page pointer in the global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_PAGE, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_PAGE", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Offset from page pointer in the global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_OFST, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_OFST", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_HI16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_GOT_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_GOT_LO16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* 64 bit substraction. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_SUB, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SUB", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - - /* Insert the addend as an instruction. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_INSERT_A, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_INSERT_A", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Insert the addend as an instruction, and change all relocations - to refer to the old instruction at the address. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_INSERT_B, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_INSERT_B", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Delete a 32 bit instruction. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_DELETE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_DELETE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Get the higher value of a 64 bit addend. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_HIGHER, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HIGHER", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Get the highest value of a 64 bit addend. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_HIGHEST, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_HIGHEST", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* High 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_CALL_HI16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL_HI16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Low 16 bits of displacement in global offset table. */ - /* FIXME: Not handled correctly. */ - HOWTO (R_MIPS_CALL_LO16, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_CALL_LO16", /* name */ - true, /* partial_inplace */ - 0, /* src_mask */ - 0x0000ffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* I'm not sure what the remaining relocs are, but they are defined - on Irix 6. */ - - HOWTO (R_MIPS_SCN_DISP, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_SCN_DISP", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_REL16, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_REL16", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_ADD_IMMEDIATE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_ADD_IMMEDIATE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_PJUMP, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_PJUMP", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - HOWTO (R_MIPS_RELGOT, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_RELGOT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* Protected jump conversion. This is an optimization hint. No - relocation is required for correctness. */ - HOWTO (R_MIPS_JALR, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_MIPS_JALR", /* name */ - false, /* partial_inplace */ - 0x00000000, /* src_mask */ - 0x00000000, /* dst_mask */ - false), /* pcrel_offset */ -}; - -/* Swap in a MIPS 64-bit Rel reloc. */ - -static void -mips_elf64_swap_reloc_in (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_External_Rel *src; - Elf64_Mips_Internal_Rel *dst; -{ - dst->r_offset = bfd_h_get_64 (abfd, (bfd_byte *) src->r_offset); - dst->r_sym = bfd_h_get_32 (abfd, (bfd_byte *) src->r_sym); - dst->r_ssym = bfd_h_get_8 (abfd, (bfd_byte *) src->r_ssym); - dst->r_type3 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type3); - dst->r_type2 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type2); - dst->r_type = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type); -} - -/* Swap in a MIPS 64-bit Rela reloc. */ - -static void -mips_elf64_swap_reloca_in (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_External_Rela *src; - Elf64_Mips_Internal_Rela *dst; -{ - dst->r_offset = bfd_h_get_64 (abfd, (bfd_byte *) src->r_offset); - dst->r_sym = bfd_h_get_32 (abfd, (bfd_byte *) src->r_sym); - dst->r_ssym = bfd_h_get_8 (abfd, (bfd_byte *) src->r_ssym); - dst->r_type3 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type3); - dst->r_type2 = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type2); - dst->r_type = bfd_h_get_8 (abfd, (bfd_byte *) src->r_type); - dst->r_addend = bfd_h_get_signed_64 (abfd, (bfd_byte *) src->r_addend); -} - -/* Swap out a MIPS 64-bit Rel reloc. */ - -static void -mips_elf64_swap_reloc_out (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_Internal_Rel *src; - Elf64_Mips_External_Rel *dst; -{ - bfd_h_put_64 (abfd, src->r_offset, (bfd_byte *) dst->r_offset); - bfd_h_put_32 (abfd, src->r_sym, (bfd_byte *) dst->r_sym); - bfd_h_put_8 (abfd, src->r_ssym, (bfd_byte *) dst->r_ssym); - bfd_h_put_8 (abfd, src->r_type3, (bfd_byte *) dst->r_type3); - bfd_h_put_8 (abfd, src->r_type2, (bfd_byte *) dst->r_type2); - bfd_h_put_8 (abfd, src->r_type, (bfd_byte *) dst->r_type); -} - -/* Swap out a MIPS 64-bit Rela reloc. */ - -static void -mips_elf64_swap_reloca_out (abfd, src, dst) - bfd *abfd; - const Elf64_Mips_Internal_Rela *src; - Elf64_Mips_External_Rela *dst; -{ - bfd_h_put_64 (abfd, src->r_offset, (bfd_byte *) dst->r_offset); - bfd_h_put_32 (abfd, src->r_sym, (bfd_byte *) dst->r_sym); - bfd_h_put_8 (abfd, src->r_ssym, (bfd_byte *) dst->r_ssym); - bfd_h_put_8 (abfd, src->r_type3, (bfd_byte *) dst->r_type3); - bfd_h_put_8 (abfd, src->r_type2, (bfd_byte *) dst->r_type2); - bfd_h_put_8 (abfd, src->r_type, (bfd_byte *) dst->r_type); - bfd_h_put_64 (abfd, src->r_addend, (bfd_byte *) dst->r_addend); -} - -/* Swap in a MIPS 64-bit Rel reloc. */ - -static void -mips_elf64_be_swap_reloc_in (abfd, src, dst) - bfd *abfd; - const bfd_byte *src; - Elf_Internal_Rel *dst; -{ - Elf64_Mips_Internal_Rel mirel; - - mips_elf64_swap_reloc_in (abfd, - (const Elf64_Mips_External_Rel *) src, - &mirel); - - dst[0].r_offset = mirel.r_offset; - dst[0].r_info = ELF32_R_INFO (mirel.r_sym, mirel.r_type); - dst[1].r_offset = mirel.r_offset; - dst[1].r_info = ELF32_R_INFO (mirel.r_ssym, mirel.r_type2); - dst[2].r_offset = mirel.r_offset; - dst[2].r_info = ELF32_R_INFO (STN_UNDEF, mirel.r_type3); -} - -/* Swap in a MIPS 64-bit Rela reloc. */ - -static void -mips_elf64_be_swap_reloca_in (abfd, src, dst) - bfd *abfd; - const bfd_byte *src; - Elf_Internal_Rela *dst; -{ - Elf64_Mips_Internal_Rela mirela; - - mips_elf64_swap_reloca_in (abfd, - (const Elf64_Mips_External_Rela *) src, - &mirela); - - dst[0].r_offset = mirela.r_offset; - dst[0].r_info = ELF32_R_INFO (mirela.r_sym, mirela.r_type); - dst[0].r_addend = mirela.r_addend; - dst[1].r_offset = mirela.r_offset; - dst[1].r_info = ELF32_R_INFO (mirela.r_ssym, mirela.r_type2); - dst[1].r_addend = 0; - dst[2].r_offset = mirela.r_offset; - dst[2].r_info = ELF32_R_INFO (STN_UNDEF, mirela.r_type3); - dst[2].r_addend = 0; -} - -/* Swap out a MIPS 64-bit Rel reloc. */ - -static void -mips_elf64_be_swap_reloc_out (abfd, src, dst) - bfd *abfd; - const Elf_Internal_Rel *src; - bfd_byte *dst; -{ - Elf64_Mips_Internal_Rel mirel; - - mirel.r_offset = src->r_offset; - mirel.r_type = ELF32_R_TYPE (src->r_info); - mirel.r_sym = ELF32_R_SYM (src->r_info); - mirel.r_type2 = R_MIPS_NONE; - mirel.r_ssym = STN_UNDEF; - mirel.r_type3 = R_MIPS_NONE; - - mips_elf64_swap_reloc_out (abfd, &mirel, - (Elf64_Mips_External_Rel *) dst); -} - -/* Swap out a MIPS 64-bit Rela reloc. */ - -static void -mips_elf64_be_swap_reloca_out (abfd, src, dst) - bfd *abfd; - const Elf_Internal_Rela *src; - bfd_byte *dst; -{ - Elf64_Mips_Internal_Rela mirela; - - mirela.r_offset = src->r_offset; - mirela.r_type = ELF32_R_TYPE (src->r_info); - mirela.r_addend = src->r_addend; - mirela.r_sym = ELF32_R_SYM (src->r_info); - mirela.r_type2 = R_MIPS_NONE; - mirela.r_ssym = STN_UNDEF; - mirela.r_type3 = R_MIPS_NONE; - - mips_elf64_swap_reloca_out (abfd, &mirela, - (Elf64_Mips_External_Rela *) dst); -} - -/* A mapping from BFD reloc types to MIPS ELF reloc types. */ - -struct elf_reloc_map -{ - bfd_reloc_code_real_type bfd_reloc_val; - enum elf_mips_reloc_type elf_reloc_val; -}; - -static CONST struct elf_reloc_map mips_reloc_map[] = -{ - { BFD_RELOC_NONE, R_MIPS_NONE, }, - { BFD_RELOC_16, R_MIPS_16 }, - { BFD_RELOC_32, R_MIPS_32 }, - { BFD_RELOC_64, R_MIPS_64 }, - { BFD_RELOC_CTOR, R_MIPS_64 }, - { BFD_RELOC_32_PCREL, R_MIPS_REL32 }, - { BFD_RELOC_MIPS_JMP, R_MIPS_26 }, - { BFD_RELOC_HI16_S, R_MIPS_HI16 }, - { BFD_RELOC_LO16, R_MIPS_LO16 }, - { BFD_RELOC_MIPS_GPREL, R_MIPS_GPREL16 }, - { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL }, - { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 }, - { BFD_RELOC_16_PCREL, R_MIPS_PC16 }, - { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 }, - { BFD_RELOC_MIPS_GPREL32, R_MIPS_GPREL32 }, - { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 }, - { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 }, - { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 }, - { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 }, - { BFD_RELOC_MIPS_SUB, R_MIPS_SUB }, - { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE }, - { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST }, - { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP } -}; - -/* Given a BFD reloc type, return a howto structure. */ - -static reloc_howto_type * -mips_elf64_reloc_type_lookup (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; -{ - unsigned int i; - - for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); i++) - { - if (mips_reloc_map[i].bfd_reloc_val == code) - { - int v; - - v = (int) mips_reloc_map[i].elf_reloc_val; - return &mips_elf64_howto_table_rel[v]; - } - } - - return NULL; -} - -/* Since each entry in an SHT_REL or SHT_RELA section can represent up - to three relocs, we must tell the user to allocate more space. */ - -static long -mips_elf64_get_reloc_upper_bound (abfd, sec) - bfd *abfd; - asection *sec; -{ - return (sec->reloc_count * 3 + 1) * sizeof (arelent *); -} - -/* Read the relocations from one reloc section. */ - -static boolean -mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, rel_hdr) - bfd *abfd; - asection *asect; - asymbol **symbols; - const Elf_Internal_Shdr *rel_hdr; -{ - PTR allocated = NULL; - bfd_byte *native_relocs; - arelent *relents; - arelent *relent; - unsigned int count; - unsigned int i; - int entsize; - reloc_howto_type *howto_table; - - allocated = (PTR) bfd_malloc (rel_hdr->sh_size); - if (allocated == NULL) - goto error_return; - - if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_read (allocated, 1, rel_hdr->sh_size, abfd) != rel_hdr->sh_size)) - goto error_return; - - native_relocs = (bfd_byte *) allocated; - - relents = asect->relocation + asect->reloc_count; - - entsize = rel_hdr->sh_entsize; - BFD_ASSERT (entsize == sizeof (Elf64_Mips_External_Rel) - || entsize == sizeof (Elf64_Mips_External_Rela)); - - count = rel_hdr->sh_size / entsize; - - if (entsize == sizeof (Elf64_Mips_External_Rel)) - howto_table = mips_elf64_howto_table_rel; - else - howto_table = mips_elf64_howto_table_rela; - - relent = relents; - for (i = 0; i < count; i++, native_relocs += entsize) - { - Elf64_Mips_Internal_Rela rela; - boolean used_sym, used_ssym; - int ir; - - if (entsize == sizeof (Elf64_Mips_External_Rela)) - mips_elf64_swap_reloca_in (abfd, - (Elf64_Mips_External_Rela *) native_relocs, - &rela); - else - { - Elf64_Mips_Internal_Rel rel; - - mips_elf64_swap_reloc_in (abfd, - (Elf64_Mips_External_Rel *) native_relocs, - &rel); - rela.r_offset = rel.r_offset; - rela.r_sym = rel.r_sym; - rela.r_ssym = rel.r_ssym; - rela.r_type3 = rel.r_type3; - rela.r_type2 = rel.r_type2; - rela.r_type = rel.r_type; - rela.r_addend = 0; - } - - /* Each entry represents up to three actual relocations. */ - - used_sym = false; - used_ssym = false; - for (ir = 0; ir < 3; ir++) - { - enum elf_mips_reloc_type type; - - switch (ir) - { - default: - abort (); - case 0: - type = (enum elf_mips_reloc_type) rela.r_type; - break; - case 1: - type = (enum elf_mips_reloc_type) rela.r_type2; - break; - case 2: - type = (enum elf_mips_reloc_type) rela.r_type3; - break; - } - - if (type == R_MIPS_NONE) - { - /* There are no more relocations in this entry. If this - is the first entry, we need to generate a dummy - relocation so that the generic linker knows that - there has been a break in the sequence of relocations - applying to a particular address. */ - if (ir == 0) - { - relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) - relent->address = rela.r_offset; - else - relent->address = rela.r_offset - asect->vma; - relent->addend = 0; - relent->howto = &howto_table[(int) R_MIPS_NONE]; - ++relent; - } - break; - } - - /* Some types require symbols, whereas some do not. */ - switch (type) - { - case R_MIPS_NONE: - case R_MIPS_LITERAL: - case R_MIPS_INSERT_A: - case R_MIPS_INSERT_B: - case R_MIPS_DELETE: - relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - break; - - default: - if (! used_sym) - { - if (rela.r_sym == 0) - relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - else - { - asymbol **ps, *s; - - ps = symbols + rela.r_sym - 1; - s = *ps; - if ((s->flags & BSF_SECTION_SYM) == 0) - relent->sym_ptr_ptr = ps; - else - relent->sym_ptr_ptr = s->section->symbol_ptr_ptr; - } - - used_sym = true; - } - else if (! used_ssym) - { - switch (rela.r_ssym) - { - case RSS_UNDEF: - relent->sym_ptr_ptr = - bfd_abs_section_ptr->symbol_ptr_ptr; - break; - - case RSS_GP: - case RSS_GP0: - case RSS_LOC: - /* FIXME: I think these need to be handled using - special howto structures. */ - BFD_ASSERT (0); - break; - - default: - BFD_ASSERT (0); - break; - } - - used_ssym = true; - } - else - relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - - break; - } - - /* The address of an ELF reloc is section relative for an - object file, and absolute for an executable file or - shared library. The address of a BFD reloc is always - section relative. */ - if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) - relent->address = rela.r_offset; - else - relent->address = rela.r_offset - asect->vma; - - relent->addend = rela.r_addend; - - relent->howto = &howto_table[(int) type]; - - ++relent; - } - } - - asect->reloc_count += relent - relents; - - if (allocated != NULL) - free (allocated); - - return true; - - error_return: - if (allocated != NULL) - free (allocated); - return false; -} - -/* Read the relocations. On Irix 6, there can be two reloc sections - associated with a single data section. */ - -static boolean -mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic) - bfd *abfd; - asection *asect; - asymbol **symbols; - boolean dynamic; -{ - struct bfd_elf_section_data * const d = elf_section_data (asect); - - if (dynamic) - { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - if (asect->relocation != NULL - || (asect->flags & SEC_RELOC) == 0 - || asect->reloc_count == 0) - return true; - - /* Allocate space for 3 arelent structures for each Rel structure. */ - asect->relocation = ((arelent *) - bfd_alloc (abfd, - asect->reloc_count * 3 * sizeof (arelent))); - if (asect->relocation == NULL) - return false; - - /* The slurp_one_reloc_table routine increments reloc_count. */ - asect->reloc_count = 0; - - if (! mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, &d->rel_hdr)) - return false; - if (d->rel_hdr2 != NULL) - { - if (! mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, - d->rel_hdr2)) - return false; - } - - return true; -} - -/* Write out the relocations. */ - -static void -mips_elf64_write_relocs (abfd, sec, data) - bfd *abfd; - asection *sec; - PTR data; -{ - boolean *failedp = (boolean *) data; - unsigned int count; - Elf_Internal_Shdr *rela_hdr; - Elf64_Mips_External_Rela *ext_rela; - unsigned int idx; - asymbol *last_sym = 0; - int last_sym_idx = 0; - - /* If we have already failed, don't do anything. */ - if (*failedp) - return; - - if ((sec->flags & SEC_RELOC) == 0) - return; - - /* The linker backend writes the relocs out itself, and sets the - reloc_count field to zero to inhibit writing them here. Also, - sometimes the SEC_RELOC flag gets set even when there aren't any - relocs. */ - if (sec->reloc_count == 0) - return; - - /* We can combine up to three relocs that refer to the same address - if the latter relocs have no associated symbol. */ - count = 0; - for (idx = 0; idx < sec->reloc_count; idx++) - { - bfd_vma addr; - unsigned int i; - - ++count; - - addr = sec->orelocation[idx]->address; - for (i = 0; i < 2; i++) - { - arelent *r; - - if (idx + 1 >= sec->reloc_count) - break; - r = sec->orelocation[idx + 1]; - if (r->address != addr - || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section) - || (*r->sym_ptr_ptr)->value != 0) - break; - - /* We can merge the reloc at IDX + 1 with the reloc at IDX. */ - - ++idx; - } - } - - rela_hdr = &elf_section_data (sec)->rel_hdr; - - rela_hdr->sh_size = rela_hdr->sh_entsize * count; - rela_hdr->contents = (PTR) bfd_alloc (abfd, rela_hdr->sh_size); - if (rela_hdr->contents == NULL) - { - *failedp = true; - return; - } - - ext_rela = (Elf64_Mips_External_Rela *) rela_hdr->contents; - for (idx = 0; idx < sec->reloc_count; idx++, ext_rela++) - { - arelent *ptr; - Elf64_Mips_Internal_Rela int_rela; - asymbol *sym; - int n; - unsigned int i; - - ptr = sec->orelocation[idx]; - - /* The address of an ELF reloc is section relative for an object - file, and absolute for an executable file or shared library. - The address of a BFD reloc is always section relative. */ - if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) - int_rela.r_offset = ptr->address; - else - int_rela.r_offset = ptr->address + sec->vma; - - sym = *ptr->sym_ptr_ptr; - if (sym == last_sym) - n = last_sym_idx; - else - { - last_sym = sym; - n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym); - if (n < 0) - { - *failedp = true; - return; - } - last_sym_idx = n; - } - - int_rela.r_sym = n; - - int_rela.r_addend = ptr->addend; - - int_rela.r_ssym = RSS_UNDEF; - - if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec - && ! _bfd_elf_validate_reloc (abfd, ptr)) - { - *failedp = true; - return; - } - - int_rela.r_type = ptr->howto->type; - int_rela.r_type2 = (int) R_MIPS_NONE; - int_rela.r_type3 = (int) R_MIPS_NONE; - - for (i = 0; i < 2; i++) - { - arelent *r; - - if (idx + 1 >= sec->reloc_count) - break; - r = sec->orelocation[idx + 1]; - if (r->address != ptr->address - || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section) - || (*r->sym_ptr_ptr)->value != 0) - break; - - /* We can merge the reloc at IDX + 1 with the reloc at IDX. */ - - if (i == 0) - int_rela.r_type2 = r->howto->type; - else - int_rela.r_type3 = r->howto->type; - - ++idx; - } - - mips_elf64_swap_reloca_out (abfd, &int_rela, ext_rela); - } - - BFD_ASSERT (ext_rela - (Elf64_Mips_External_Rela *) rela_hdr->contents - == count); -} - -/* Irix 6 defines a brand new archive map format, so that they can - have archives more than 4 GB in size. */ - -/* Read an Irix 6 armap. */ - -static boolean -mips_elf64_slurp_armap (abfd) - bfd *abfd; -{ - struct artdata *ardata = bfd_ardata (abfd); - char nextname[17]; - file_ptr arhdrpos; - bfd_size_type i, parsed_size, nsymz, stringsize, carsym_size, ptrsize; - struct areltdata *mapdata; - bfd_byte int_buf[8]; - char *stringbase; - bfd_byte *raw_armap = NULL; - carsym *carsyms; - - ardata->symdefs = NULL; - - /* Get the name of the first element. */ - arhdrpos = bfd_tell (abfd); - i = bfd_read ((PTR) nextname, 1, 16, abfd); - if (i == 0) - return true; - if (i != 16) - return false; - - if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0) - return false; - - /* Archives with traditional armaps are still permitted. */ - if (strncmp (nextname, "/ ", 16) == 0) - return bfd_slurp_armap (abfd); - - if (strncmp (nextname, "/SYM64/ ", 16) != 0) - { - bfd_has_map (abfd) = false; - return true; - } - - mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd); - if (mapdata == NULL) - return false; - parsed_size = mapdata->parsed_size; - bfd_release (abfd, (PTR) mapdata); - - if (bfd_read (int_buf, 1, 8, abfd) != 8) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_malformed_archive); - return false; - } - - nsymz = bfd_getb64 (int_buf); - stringsize = parsed_size - 8 * nsymz - 8; - - carsym_size = nsymz * sizeof (carsym); - ptrsize = 8 * nsymz; - - ardata->symdefs = (carsym *) bfd_zalloc (abfd, carsym_size + stringsize + 1); - if (ardata->symdefs == NULL) - return false; - carsyms = ardata->symdefs; - stringbase = ((char *) ardata->symdefs) + carsym_size; - - raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize); - if (raw_armap == NULL) - goto error_return; - - if (bfd_read (raw_armap, 1, ptrsize, abfd) != ptrsize - || bfd_read (stringbase, 1, stringsize, abfd) != stringsize) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_malformed_archive); - goto error_return; - } - - for (i = 0; i < nsymz; i++) - { - carsyms->file_offset = bfd_getb64 (raw_armap + i * 8); - carsyms->name = stringbase; - stringbase += strlen (stringbase) + 1; - ++carsyms; - } - *stringbase = '\0'; - - ardata->symdef_count = nsymz; - ardata->first_file_filepos = arhdrpos + sizeof (struct ar_hdr) + parsed_size; - - bfd_has_map (abfd) = true; - bfd_release (abfd, raw_armap); - - return true; - - error_return: - if (raw_armap != NULL) - bfd_release (abfd, raw_armap); - if (ardata->symdefs != NULL) - bfd_release (abfd, ardata->symdefs); - return false; -} - -/* Write out an Irix 6 armap. The Irix 6 tools are supposed to be - able to handle ordinary ELF armaps, but at least on Irix 6.2 the - linker crashes. */ - -static boolean -mips_elf64_write_armap (arch, elength, map, symbol_count, stridx) - bfd *arch; - unsigned int elength; - struct orl *map; - unsigned int symbol_count; - int stridx; -{ - unsigned int ranlibsize = (symbol_count * 8) + 8; - unsigned int stringsize = stridx; - unsigned int mapsize = stringsize + ranlibsize; - file_ptr archive_member_file_ptr; - bfd *current = arch->archive_head; - unsigned int count; - struct ar_hdr hdr; - unsigned int i; - int padding; - bfd_byte buf[8]; - - padding = BFD_ALIGN (mapsize, 8) - mapsize; - mapsize += padding; - - /* work out where the first object file will go in the archive */ - archive_member_file_ptr = (mapsize - + elength - + sizeof (struct ar_hdr) - + SARMAG); - - memset ((char *) (&hdr), 0, sizeof (struct ar_hdr)); - strcpy (hdr.ar_name, "/SYM64/"); - sprintf (hdr.ar_size, "%-10d", (int) mapsize); - sprintf (hdr.ar_date, "%ld", (long) time (NULL)); - /* This, at least, is what Intel coff sets the values to.: */ - sprintf ((hdr.ar_uid), "%d", 0); - sprintf ((hdr.ar_gid), "%d", 0); - sprintf ((hdr.ar_mode), "%-7o", (unsigned) 0); - strncpy (hdr.ar_fmag, ARFMAG, 2); - - for (i = 0; i < sizeof (struct ar_hdr); i++) - if (((char *) (&hdr))[i] == '\0') - (((char *) (&hdr))[i]) = ' '; - - /* Write the ar header for this item and the number of symbols */ - - if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), arch) - != sizeof (struct ar_hdr)) - return false; - - bfd_putb64 (symbol_count, buf); - if (bfd_write (buf, 1, 8, arch) != 8) - return false; - - /* Two passes, first write the file offsets for each symbol - - remembering that each offset is on a two byte boundary. */ - - /* Write out the file offset for the file associated with each - symbol, and remember to keep the offsets padded out. */ - - current = arch->archive_head; - count = 0; - while (current != (bfd *) NULL && count < symbol_count) - { - /* For each symbol which is used defined in this object, write out - the object file's address in the archive */ - - while (((bfd *) (map[count]).pos) == current) - { - bfd_putb64 (archive_member_file_ptr, buf); - if (bfd_write (buf, 1, 8, arch) != 8) - return false; - count++; - } - /* Add size of this archive entry */ - archive_member_file_ptr += (arelt_size (current) - + sizeof (struct ar_hdr)); - /* remember about the even alignment */ - archive_member_file_ptr += archive_member_file_ptr % 2; - current = current->next; - } - - /* now write the strings themselves */ - for (count = 0; count < symbol_count; count++) - { - size_t len = strlen (*map[count].name) + 1; - - if (bfd_write (*map[count].name, 1, len, arch) != len) - return false; - } - - /* The spec says that this should be padded to an 8 byte boundary. - However, the Irix 6.2 tools do not appear to do this. */ - while (padding != 0) - { - if (bfd_write ("", 1, 1, arch) != 1) - return false; - --padding; - } - - return true; -} - -/* ECOFF swapping routines. These are used when dealing with the - .mdebug section, which is in the ECOFF debugging format. */ -static const struct ecoff_debug_swap mips_elf64_ecoff_debug_swap = -{ - /* Symbol table magic number. */ - magicSym2, - /* Alignment of debugging information. E.g., 4. */ - 8, - /* Sizes of external symbolic information. */ - sizeof (struct hdr_ext), - sizeof (struct dnr_ext), - sizeof (struct pdr_ext), - sizeof (struct sym_ext), - sizeof (struct opt_ext), - sizeof (struct fdr_ext), - sizeof (struct rfd_ext), - sizeof (struct ext_ext), - /* Functions to swap in external symbolic data. */ - ecoff_swap_hdr_in, - ecoff_swap_dnr_in, - ecoff_swap_pdr_in, - ecoff_swap_sym_in, - ecoff_swap_opt_in, - ecoff_swap_fdr_in, - ecoff_swap_rfd_in, - ecoff_swap_ext_in, - _bfd_ecoff_swap_tir_in, - _bfd_ecoff_swap_rndx_in, - /* Functions to swap out external symbolic data. */ - ecoff_swap_hdr_out, - ecoff_swap_dnr_out, - ecoff_swap_pdr_out, - ecoff_swap_sym_out, - ecoff_swap_opt_out, - ecoff_swap_fdr_out, - ecoff_swap_rfd_out, - ecoff_swap_ext_out, - _bfd_ecoff_swap_tir_out, - _bfd_ecoff_swap_rndx_out, - /* Function to read in symbolic data. */ - _bfd_mips_elf_read_ecoff_info -}; - -/* Relocations in the 64 bit MIPS ELF ABI are more complex than in - standard ELF. This structure is used to redirect the relocation - handling routines. */ - -const struct elf_size_info mips_elf64_size_info = -{ - sizeof (Elf64_External_Ehdr), - sizeof (Elf64_External_Phdr), - sizeof (Elf64_External_Shdr), - sizeof (Elf64_Mips_External_Rel), - sizeof (Elf64_Mips_External_Rela), - sizeof (Elf64_External_Sym), - sizeof (Elf64_External_Dyn), - sizeof (Elf_External_Note), - 4, /* hash-table entry size */ - 3, /* internal relocations per external relocations */ - 64, /* arch_size */ - 8, /* file_align */ - ELFCLASS64, - EV_CURRENT, - bfd_elf64_write_out_phdrs, - bfd_elf64_write_shdrs_and_ehdr, - mips_elf64_write_relocs, - bfd_elf64_swap_symbol_out, - mips_elf64_slurp_reloc_table, - bfd_elf64_slurp_symbol_table, - bfd_elf64_swap_dyn_in, - bfd_elf64_swap_dyn_out, - mips_elf64_be_swap_reloc_in, - mips_elf64_be_swap_reloc_out, - mips_elf64_be_swap_reloca_in, - mips_elf64_be_swap_reloca_out -}; - -#define TARGET_LITTLE_SYM bfd_elf64_littlemips_vec -#define TARGET_LITTLE_NAME "elf64-littlemips" -#define TARGET_BIG_SYM bfd_elf64_bigmips_vec -#define TARGET_BIG_NAME "elf64-bigmips" -#define ELF_ARCH bfd_arch_mips -#define ELF_MACHINE_CODE EM_MIPS - -#define ELF_MAXPAGESIZE 0x1000 - -#define elf_backend_collect true -#define elf_backend_type_change_ok true -#define elf_backend_can_gc_sections true -#define elf_backend_size_info mips_elf64_size_info -#define elf_backend_object_p _bfd_mips_elf_object_p -#define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr -#define elf_backend_fake_sections _bfd_mips_elf_fake_sections -#define elf_backend_section_from_bfd_section \ - _bfd_mips_elf_section_from_bfd_section -#define elf_backend_section_processing _bfd_mips_elf_section_processing -#define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing -#define elf_backend_additional_program_headers \ - _bfd_mips_elf_additional_program_headers -#define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map -#define elf_backend_final_write_processing \ - _bfd_mips_elf_final_write_processing -#define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap -#define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook -#define elf_backend_create_dynamic_sections \ - _bfd_mips_elf_create_dynamic_sections -#define elf_backend_check_relocs _bfd_mips_elf_check_relocs -#define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol -#define elf_backend_always_size_sections \ - _bfd_mips_elf_always_size_sections -#define elf_backend_size_dynamic_sections \ - _bfd_mips_elf_size_dynamic_sections -#define elf_backend_relocate_section _bfd_mips_elf_relocate_section -#define elf_backend_link_output_symbol_hook \ - _bfd_mips_elf_link_output_symbol_hook -#define elf_backend_finish_dynamic_symbol \ - _bfd_mips_elf_finish_dynamic_symbol -#define elf_backend_finish_dynamic_sections \ - _bfd_mips_elf_finish_dynamic_sections -#define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook -#define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook -#define elf_backend_got_header_size (4*MIPS_RESERVED_GOTNO) -#define elf_backend_plt_header_size 0 -#define elf_backend_may_use_rel_p 1 - -/* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit - MIPS-specific function only applies to IRIX5, which had no 64-bit - ABI. */ -#define bfd_elf64_find_nearest_line _bfd_mips_elf_find_nearest_line -#define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents -#define bfd_elf64_bfd_link_hash_table_create \ - _bfd_mips_elf_link_hash_table_create -#define bfd_elf64_bfd_final_link _bfd_mips_elf_final_link -#define bfd_elf64_bfd_copy_private_bfd_data \ - _bfd_mips_elf_copy_private_bfd_data -#define bfd_elf64_bfd_merge_private_bfd_data \ - _bfd_mips_elf_merge_private_bfd_data -#define bfd_elf64_bfd_set_private_flags _bfd_mips_elf_set_private_flags -#define bfd_elf64_bfd_print_private_bfd_data \ - _bfd_mips_elf_print_private_bfd_data - -#define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound -#define bfd_elf64_bfd_reloc_type_lookup mips_elf64_reloc_type_lookup -#define bfd_elf64_archive_functions -#define bfd_elf64_archive_slurp_armap mips_elf64_slurp_armap -#define bfd_elf64_archive_slurp_extended_name_table \ - _bfd_archive_coff_slurp_extended_name_table -#define bfd_elf64_archive_construct_extended_name_table \ - _bfd_archive_coff_construct_extended_name_table -#define bfd_elf64_archive_truncate_arname \ - _bfd_archive_coff_truncate_arname -#define bfd_elf64_archive_write_armap mips_elf64_write_armap -#define bfd_elf64_archive_read_ar_hdr _bfd_archive_coff_read_ar_hdr -#define bfd_elf64_archive_openr_next_archived_file \ - _bfd_archive_coff_openr_next_archived_file -#define bfd_elf64_archive_get_elt_at_index \ - _bfd_archive_coff_get_elt_at_index -#define bfd_elf64_archive_generic_stat_arch_elt \ - _bfd_archive_coff_generic_stat_arch_elt -#define bfd_elf64_archive_update_armap_timestamp \ - _bfd_archive_coff_update_armap_timestamp - -#include "elf64-target.h" diff --git a/contrib/binutils/bfd/filemode.c b/contrib/binutils/bfd/filemode.c deleted file mode 100644 index 6f4596872ca8..000000000000 --- a/contrib/binutils/bfd/filemode.c +++ /dev/null @@ -1,194 +0,0 @@ -/* filemode.c -- make a string describing file modes - Copyright (C) 1985, 1990 Free Software Foundation, Inc. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "sysdep.h" -#include <sys/types.h> -#include <sys/stat.h> - -void mode_string (); -static char ftypelet (); -static void rwx (); -static void setst (); - -/* filemodestring - fill in string STR with an ls-style ASCII - representation of the st_mode field of file stats block STATP. - 10 characters are stored in STR; no terminating null is added. - The characters stored in STR are: - - 0 File type. 'd' for directory, 'c' for character - special, 'b' for block special, 'm' for multiplex, - 'l' for symbolic link, 's' for socket, 'p' for fifo, - '-' for any other file type - - 1 'r' if the owner may read, '-' otherwise. - - 2 'w' if the owner may write, '-' otherwise. - - 3 'x' if the owner may execute, 's' if the file is - set-user-id, '-' otherwise. - 'S' if the file is set-user-id, but the execute - bit isn't set. - - 4 'r' if group members may read, '-' otherwise. - - 5 'w' if group members may write, '-' otherwise. - - 6 'x' if group members may execute, 's' if the file is - set-group-id, '-' otherwise. - 'S' if it is set-group-id but not executable. - - 7 'r' if any user may read, '-' otherwise. - - 8 'w' if any user may write, '-' otherwise. - - 9 'x' if any user may execute, 't' if the file is "sticky" - (will be retained in swap space after execution), '-' - otherwise. - 'T' if the file is sticky but not executable. */ - -void -filemodestring (statp, str) - struct stat *statp; - char *str; -{ - mode_string (statp->st_mode, str); -} - -/* Like filemodestring, but only the relevant part of the `struct stat' - is given as an argument. */ - -void -mode_string (mode, str) - unsigned short mode; - char *str; -{ - str[0] = ftypelet (mode); - rwx ((mode & 0700) << 0, &str[1]); - rwx ((mode & 0070) << 3, &str[4]); - rwx ((mode & 0007) << 6, &str[7]); - setst (mode, str); -} - -/* Return a character indicating the type of file described by - file mode BITS: - 'd' for directories - 'b' for block special files - 'c' for character special files - 'm' for multiplexor files - 'l' for symbolic links - 's' for sockets - 'p' for fifos - '-' for any other file type. */ - -static char -ftypelet (bits) - unsigned short bits; -{ - switch (bits & S_IFMT) - { - default: - return '-'; - case S_IFDIR: - return 'd'; -#ifdef S_IFLNK - case S_IFLNK: - return 'l'; -#endif -#ifdef S_IFCHR - case S_IFCHR: - return 'c'; -#endif -#ifdef S_IFBLK - case S_IFBLK: - return 'b'; -#endif -#ifdef S_IFMPC - case S_IFMPC: - case S_IFMPB: - return 'm'; -#endif -#ifdef S_IFSOCK - case S_IFSOCK: - return 's'; -#endif -#ifdef S_IFIFO -#if S_IFIFO != S_IFSOCK - case S_IFIFO: - return 'p'; -#endif -#endif -#ifdef S_IFNWK /* HP-UX */ - case S_IFNWK: - return 'n'; -#endif - } -} - -/* Look at read, write, and execute bits in BITS and set - flags in CHARS accordingly. */ - -static void -rwx (bits, chars) - unsigned short bits; - char *chars; -{ - chars[0] = (bits & S_IREAD) ? 'r' : '-'; - chars[1] = (bits & S_IWRITE) ? 'w' : '-'; - chars[2] = (bits & S_IEXEC) ? 'x' : '-'; -} - -/* Set the 's' and 't' flags in file attributes string CHARS, - according to the file mode BITS. */ - -static void -setst (bits, chars) - unsigned short bits; - char *chars; -{ -#ifdef S_ISUID - if (bits & S_ISUID) - { - if (chars[3] != 'x') - /* Set-uid, but not executable by owner. */ - chars[3] = 'S'; - else - chars[3] = 's'; - } -#endif -#ifdef S_ISGID - if (bits & S_ISGID) - { - if (chars[6] != 'x') - /* Set-gid, but not executable by group. */ - chars[6] = 'S'; - else - chars[6] = 's'; - } -#endif -#ifdef S_ISVTX - if (bits & S_ISVTX) - { - if (chars[9] != 'x') - /* Sticky, but not executable by others. */ - chars[9] = 'T'; - else - chars[9] = 't'; - } -#endif -} - - diff --git a/contrib/binutils/bfd/libpei.h b/contrib/binutils/bfd/libpei.h deleted file mode 100644 index 5b9cc045cc97..000000000000 --- a/contrib/binutils/bfd/libpei.h +++ /dev/null @@ -1,321 +0,0 @@ -/* Support for the generic parts of PE/PEI; common header information. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. - Written by Cygnus Solutions. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* -Most of this hacked by Steve Chamberlain, - sac@cygnus.com - -PE/PEI rearrangement (and code added): Donn Terry - Softway Systems, Inc. -*/ - -/* Hey look, some documentation [and in a place you expect to find it]! - - The main reference for the pei format is "Microsoft Portable Executable - and Common Object File Format Specification 4.1". Get it if you need to - do some serious hacking on this code. - - Another reference: - "Peering Inside the PE: A Tour of the Win32 Portable Executable - File Format", MSJ 1994, Volume 9. - - The *sole* difference between the pe format and the pei format is that the - latter has an MSDOS 2.0 .exe header on the front that prints the message - "This app must be run under Windows." (or some such). - (FIXME: Whether that statement is *really* true or not is unknown. - Are there more subtle differences between pe and pei formats? - For now assume there aren't. If you find one, then for God sakes - document it here!) - - The Microsoft docs use the word "image" instead of "executable" because - the former can also refer to a DLL (shared library). Confusion can arise - because the `i' in `pei' also refers to "image". The `pe' format can - also create images (i.e. executables), it's just that to run on a win32 - system you need to use the pei format. - - FIXME: Please add more docs here so the next poor fool that has to hack - on this code has a chance of getting something accomplished without - wasting too much time. -*/ - -#ifndef GET_FCN_LNNOPTR -#define GET_FCN_LNNOPTR(abfd, ext) \ - bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) -#endif - -#ifndef GET_FCN_ENDNDX -#define GET_FCN_ENDNDX(abfd, ext) \ - bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) -#endif - -#ifndef PUT_FCN_LNNOPTR -#define PUT_FCN_LNNOPTR(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) -#endif -#ifndef PUT_FCN_ENDNDX -#define PUT_FCN_ENDNDX(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) -#endif -#ifndef GET_LNSZ_LNNO -#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno) -#endif -#ifndef GET_LNSZ_SIZE -#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size) -#endif -#ifndef PUT_LNSZ_LNNO -#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno) -#endif -#ifndef PUT_LNSZ_SIZE -#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size) -#endif -#ifndef GET_SCN_SCNLEN -#define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen) -#endif -#ifndef GET_SCN_NRELOC -#define GET_SCN_NRELOC(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nreloc) -#endif -#ifndef GET_SCN_NLINNO -#define GET_SCN_NLINNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nlinno) -#endif -#ifndef PUT_SCN_SCNLEN -#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen) -#endif -#ifndef PUT_SCN_NRELOC -#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc) -#endif -#ifndef PUT_SCN_NLINNO -#define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_16(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno) -#endif -#ifndef GET_LINENO_LNNO -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno)); -#endif -#ifndef PUT_LINENO_LNNO -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno)); -#endif - -/* The f_symptr field in the filehdr is sometimes 64 bits. */ -#ifndef GET_FILEHDR_SYMPTR -#define GET_FILEHDR_SYMPTR bfd_h_get_32 -#endif -#ifndef PUT_FILEHDR_SYMPTR -#define PUT_FILEHDR_SYMPTR bfd_h_put_32 -#endif - -/* Some fields in the aouthdr are sometimes 64 bits. */ -#ifndef GET_AOUTHDR_TSIZE -#define GET_AOUTHDR_TSIZE bfd_h_get_32 -#endif -#ifndef PUT_AOUTHDR_TSIZE -#define PUT_AOUTHDR_TSIZE bfd_h_put_32 -#endif -#ifndef GET_AOUTHDR_DSIZE -#define GET_AOUTHDR_DSIZE bfd_h_get_32 -#endif -#ifndef PUT_AOUTHDR_DSIZE -#define PUT_AOUTHDR_DSIZE bfd_h_put_32 -#endif -#ifndef GET_AOUTHDR_BSIZE -#define GET_AOUTHDR_BSIZE bfd_h_get_32 -#endif -#ifndef PUT_AOUTHDR_BSIZE -#define PUT_AOUTHDR_BSIZE bfd_h_put_32 -#endif -#ifndef GET_AOUTHDR_ENTRY -#define GET_AOUTHDR_ENTRY bfd_h_get_32 -#endif -#ifndef PUT_AOUTHDR_ENTRY -#define PUT_AOUTHDR_ENTRY bfd_h_put_32 -#endif -#ifndef GET_AOUTHDR_TEXT_START -#define GET_AOUTHDR_TEXT_START bfd_h_get_32 -#endif -#ifndef PUT_AOUTHDR_TEXT_START -#define PUT_AOUTHDR_TEXT_START bfd_h_put_32 -#endif -#ifndef GET_AOUTHDR_DATA_START -#define GET_AOUTHDR_DATA_START bfd_h_get_32 -#endif -#ifndef PUT_AOUTHDR_DATA_START -#define PUT_AOUTHDR_DATA_START bfd_h_put_32 -#endif - -/* Some fields in the scnhdr are sometimes 64 bits. */ -#ifndef GET_SCNHDR_PADDR -#define GET_SCNHDR_PADDR bfd_h_get_32 -#endif -#ifndef PUT_SCNHDR_PADDR -#define PUT_SCNHDR_PADDR bfd_h_put_32 -#endif -#ifndef GET_SCNHDR_VADDR -#define GET_SCNHDR_VADDR bfd_h_get_32 -#endif -#ifndef PUT_SCNHDR_VADDR -#define PUT_SCNHDR_VADDR bfd_h_put_32 -#endif -#ifndef GET_SCNHDR_SIZE -#define GET_SCNHDR_SIZE bfd_h_get_32 -#endif -#ifndef PUT_SCNHDR_SIZE -#define PUT_SCNHDR_SIZE bfd_h_put_32 -#endif -#ifndef GET_SCNHDR_SCNPTR -#define GET_SCNHDR_SCNPTR bfd_h_get_32 -#endif -#ifndef PUT_SCNHDR_SCNPTR -#define PUT_SCNHDR_SCNPTR bfd_h_put_32 -#endif -#ifndef GET_SCNHDR_RELPTR -#define GET_SCNHDR_RELPTR bfd_h_get_32 -#endif -#ifndef PUT_SCNHDR_RELPTR -#define PUT_SCNHDR_RELPTR bfd_h_put_32 -#endif -#ifndef GET_SCNHDR_LNNOPTR -#define GET_SCNHDR_LNNOPTR bfd_h_get_32 -#endif -#ifndef PUT_SCNHDR_LNNOPTR -#define PUT_SCNHDR_LNNOPTR bfd_h_put_32 -#endif - -#ifdef COFF_WITH_pep - -#define GET_OPTHDR_IMAGE_BASE bfd_h_get_64 -#define PUT_OPTHDR_IMAGE_BASE bfd_h_put_64 -#define GET_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_get_64 -#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_put_64 -#define GET_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_get_64 -#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_put_64 -#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_get_64 -#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_put_64 -#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_get_64 -#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_put_64 -#define GET_PDATA_ENTRY bfd_get_64 - -#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pep_bfd_copy_private_bfd_data_common -#define _bfd_XX_bfd_copy_private_section_data _bfd_pep_bfd_copy_private_section_data -#define _bfd_XX_get_symbol_info _bfd_pep_get_symbol_info -#define _bfd_XX_only_swap_filehdr_out _bfd_pep_only_swap_filehdr_out -#define _bfd_XX_print_private_bfd_data_common _bfd_pep_print_private_bfd_data_common -#define _bfd_XXi_final_link_postscript _bfd_pepi_final_link_postscript -#define _bfd_XXi_final_link_postscript _bfd_pepi_final_link_postscript -#define _bfd_XXi_only_swap_filehdr_out _bfd_pepi_only_swap_filehdr_out -#define _bfd_XXi_swap_aouthdr_in _bfd_pepi_swap_aouthdr_in -#define _bfd_XXi_swap_aouthdr_out _bfd_pepi_swap_aouthdr_out -#define _bfd_XXi_swap_aux_in _bfd_pepi_swap_aux_in -#define _bfd_XXi_swap_aux_out _bfd_pepi_swap_aux_out -#define _bfd_XXi_swap_lineno_in _bfd_pepi_swap_lineno_in -#define _bfd_XXi_swap_lineno_out _bfd_pepi_swap_lineno_out -#define _bfd_XXi_swap_scnhdr_out _bfd_pepi_swap_scnhdr_out -#define _bfd_XXi_swap_sym_in _bfd_pepi_swap_sym_in -#define _bfd_XXi_swap_sym_out _bfd_pepi_swap_sym_out - -#else /* !COFF_WITH_pep */ - -#define GET_OPTHDR_IMAGE_BASE bfd_h_get_32 -#define PUT_OPTHDR_IMAGE_BASE bfd_h_put_32 -#define GET_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_get_32 -#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_put_32 -#define GET_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_get_32 -#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_put_32 -#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_get_32 -#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_put_32 -#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_get_32 -#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_put_32 -#define GET_PDATA_ENTRY bfd_get_32 - -#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pe_bfd_copy_private_bfd_data_common -#define _bfd_XX_bfd_copy_private_section_data _bfd_pe_bfd_copy_private_section_data -#define _bfd_XX_get_symbol_info _bfd_pe_get_symbol_info -#define _bfd_XX_only_swap_filehdr_out _bfd_pe_only_swap_filehdr_out -#define _bfd_XX_print_private_bfd_data_common _bfd_pe_print_private_bfd_data_common -#define _bfd_XXi_final_link_postscript _bfd_pei_final_link_postscript -#define _bfd_XXi_final_link_postscript _bfd_pei_final_link_postscript -#define _bfd_XXi_only_swap_filehdr_out _bfd_pei_only_swap_filehdr_out -#define _bfd_XXi_swap_aouthdr_in _bfd_pei_swap_aouthdr_in -#define _bfd_XXi_swap_aouthdr_out _bfd_pei_swap_aouthdr_out -#define _bfd_XXi_swap_aux_in _bfd_pei_swap_aux_in -#define _bfd_XXi_swap_aux_out _bfd_pei_swap_aux_out -#define _bfd_XXi_swap_lineno_in _bfd_pei_swap_lineno_in -#define _bfd_XXi_swap_lineno_out _bfd_pei_swap_lineno_out -#define _bfd_XXi_swap_scnhdr_out _bfd_pei_swap_scnhdr_out -#define _bfd_XXi_swap_sym_in _bfd_pei_swap_sym_in -#define _bfd_XXi_swap_sym_out _bfd_pei_swap_sym_out - -#endif /* !COFF_WITH_pep */ - -/* These functions are architecture dependent, and are in peicode.h: - coff_swap_reloc_in - int coff_swap_reloc_out - coff_swap_filehdr_in - coff_swap_scnhdr_in - pe_mkobject - pe_mkobject_hook */ - -/* The functions described below are common across all PE/PEI - implementations architecture types, and actually appear in - peigen.c. */ - -void _bfd_XXi_swap_sym_in PARAMS ((bfd*, PTR, PTR)); -#define coff_swap_sym_in _bfd_XXi_swap_sym_in - -unsigned int _bfd_XXi_swap_sym_out PARAMS ((bfd*, PTR, PTR)); -#define coff_swap_sym_out _bfd_XXi_swap_sym_out - -void _bfd_XXi_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR)); -#define coff_swap_aux_in _bfd_XXi_swap_aux_in - -unsigned int _bfd_XXi_swap_aux_out \ - PARAMS ((bfd *, PTR, int, int, int, int, PTR)); -#define coff_swap_aux_out _bfd_XXi_swap_aux_out - -void _bfd_XXi_swap_lineno_in PARAMS ((bfd*, PTR, PTR)); -#define coff_swap_lineno_in _bfd_XXi_swap_lineno_in - -unsigned int _bfd_XXi_swap_lineno_out PARAMS ((bfd*, PTR, PTR)); -#define coff_swap_lineno_out _bfd_XXi_swap_lineno_out - -void _bfd_XXi_swap_aouthdr_in PARAMS ((bfd*, PTR, PTR)); -#define coff_swap_aouthdr_in _bfd_XXi_swap_aouthdr_in - -unsigned int _bfd_XXi_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR)); -#define coff_swap_aouthdr_out _bfd_XXi_swap_aouthdr_out - -unsigned int _bfd_XXi_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR)); -#define coff_swap_scnhdr_out _bfd_XXi_swap_scnhdr_out - -boolean _bfd_XX_print_private_bfd_data_common PARAMS ((bfd *, PTR)); - -boolean _bfd_XX_bfd_copy_private_bfd_data_common PARAMS ((bfd *, bfd *)); - -void _bfd_XX_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); - -boolean _bfd_XXi_final_link_postscript - PARAMS ((bfd *, struct coff_final_link_info *)); - -#ifndef coff_final_link_postscript -#define coff_final_link_postscript _bfd_XXi_final_link_postscript -#endif -/* The following are needed only for ONE of pe or pei, but don't - otherwise vary; peicode.h fixes up ifdefs but we provide the - prototype. */ - -unsigned int _bfd_XX_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR)); -unsigned int _bfd_XXi_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR)); -boolean _bfd_XX_bfd_copy_private_section_data - PARAMS ((bfd *, asection *, bfd *, asection *)); diff --git a/contrib/binutils/bfd/mipsbsd.c b/contrib/binutils/bfd/mipsbsd.c deleted file mode 100644 index 7a680fb38949..000000000000 --- a/contrib/binutils/bfd/mipsbsd.c +++ /dev/null @@ -1,474 +0,0 @@ -/* BFD backend for MIPS BSD (a.out) binaries. - Copyright (C) 1993, 94, 95, 97, 98, 1999 Free Software Foundation, Inc. - Written by Ralph Campbell. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define BYTES_IN_WORD 4 -/* #define ENTRY_CAN_BE_ZERO */ -#define N_HEADER_IN_TEXT(x) 1 -#define N_SHARED_LIB(x) 0 -#define N_TXTADDR(x) \ - (N_MAGIC(x) != ZMAGIC ? (x).a_entry : /* object file or NMAGIC */\ - TEXT_START_ADDR + EXEC_BYTES_SIZE /* no padding */\ - ) -#define N_DATADDR(x) (N_TXTADDR(x)+N_TXTSIZE(x)) -#define TEXT_START_ADDR 4096 -#define TARGET_PAGE_SIZE 4096 -#define SEGMENT_SIZE TARGET_PAGE_SIZE -#define DEFAULT_ARCH bfd_arch_mips -#define MACHTYPE_OK(mtype) ((mtype) == M_UNKNOWN \ - || (mtype) == M_MIPS1 || (mtype) == M_MIPS2) -#define MY_symbol_leading_char '\0' - -#define MY(OP) CAT(mipsbsd_,OP) - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "libaout.h" - -#define SET_ARCH_MACH(ABFD, EXEC) \ - MY(set_arch_mach)(ABFD, N_MACHTYPE (EXEC)); \ - MY(choose_reloc_size)(ABFD); -static void MY(set_arch_mach) PARAMS ((bfd *abfd, int machtype)); -static void MY(choose_reloc_size) PARAMS ((bfd *abfd)); - -#define MY_write_object_contents MY(write_object_contents) -static boolean MY(write_object_contents) PARAMS ((bfd *abfd)); - -/* We can't use MY(x) here because it leads to a recursive call to CAT - when expanded inside JUMP_TABLE. */ -#define MY_bfd_reloc_type_lookup mipsbsd_reloc_howto_type_lookup -#define MY_canonicalize_reloc mipsbsd_canonicalize_reloc - -#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols -#define MY_final_link_callback unused -#define MY_bfd_final_link _bfd_generic_final_link - -#define MY_backend_data &MY(backend_data) -#define MY_BFD_TARGET - -#include "aout-target.h" - -static void -MY(set_arch_mach) (abfd, machtype) - bfd *abfd; - int machtype; -{ - enum bfd_architecture arch; - long machine; - - /* Determine the architecture and machine type of the object file. */ - switch (machtype) { - - case M_MIPS1: - arch = bfd_arch_mips; - machine = 3000; - break; - - case M_MIPS2: - arch = bfd_arch_mips; - machine = 4000; - break; - - default: - arch = bfd_arch_obscure; - machine = 0; - break; - } - bfd_set_arch_mach(abfd, arch, machine); -} - -/* Determine the size of a relocation entry, based on the architecture */ -static void -MY(choose_reloc_size) (abfd) - bfd *abfd; -{ - switch (bfd_get_arch(abfd)) { - case bfd_arch_sparc: - case bfd_arch_a29k: - case bfd_arch_mips: - obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; - break; - default: - obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; - break; - } -} - -/* Write an object file in BSD a.out format. - Section contents have already been written. We write the - file header, symbols, and relocation. */ - -static boolean -MY(write_object_contents) (abfd) - bfd *abfd; -{ - struct external_exec exec_bytes; - struct internal_exec *execp = exec_hdr (abfd); - - /* Magic number, maestro, please! */ - switch (bfd_get_arch(abfd)) { - case bfd_arch_m68k: - switch (bfd_get_mach(abfd)) { - case bfd_mach_m68010: - N_SET_MACHTYPE(*execp, M_68010); - break; - default: - case bfd_mach_m68020: - N_SET_MACHTYPE(*execp, M_68020); - break; - } - break; - case bfd_arch_sparc: - N_SET_MACHTYPE(*execp, M_SPARC); - break; - case bfd_arch_i386: - N_SET_MACHTYPE(*execp, M_386); - break; - case bfd_arch_a29k: - N_SET_MACHTYPE(*execp, M_29K); - break; - case bfd_arch_mips: - switch (bfd_get_mach(abfd)) { - case 4000: - case 6000: - N_SET_MACHTYPE(*execp, M_MIPS2); - break; - default: - N_SET_MACHTYPE(*execp, M_MIPS1); - break; - } - break; - default: - N_SET_MACHTYPE(*execp, M_UNKNOWN); - } - - MY(choose_reloc_size)(abfd); - - WRITE_HEADERS(abfd, execp); - - return true; -} - -/* - * MIPS relocation types. - */ -#define MIPS_RELOC_32 0 -#define MIPS_RELOC_JMP 1 -#define MIPS_RELOC_WDISP16 2 -#define MIPS_RELOC_HI16 3 -#define MIPS_RELOC_HI16_S 4 -#define MIPS_RELOC_LO16 5 - -/* - * This is only called when performing a BFD_RELOC_MIPS_JMP relocation. - * The jump destination address is formed from the upper 4 bits of the - * "current" program counter concatenated with the jump instruction's - * 26 bit field and two trailing zeros. - * If the destination address is not in the same segment as the "current" - * program counter, then we need to signal an error. - */ -static bfd_reloc_status_type -mips_fix_jmp_addr (abfd,reloc_entry,symbol,data,input_section,output_bfd) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - struct symbol_cache_entry *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; -{ - bfd_vma relocation, pc; - - /* If this is a partial relocation, just continue. */ - if (output_bfd != (bfd *)NULL) - return bfd_reloc_continue; - - /* If this is an undefined symbol, return error */ - if (bfd_is_und_section (symbol->section) - && (symbol->flags & BSF_WEAK) == 0) - return bfd_reloc_undefined; - - /* - * Work out which section the relocation is targetted at and the - * initial relocation command value. - */ - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - pc = input_section->output_section->vma + input_section->output_offset + - reloc_entry->address + 4; - - if ((relocation & 0xF0000000) != (pc & 0xF0000000)) - return bfd_reloc_overflow; - - return bfd_reloc_continue; -} - -/* - * This is only called when performing a BFD_RELOC_HI16_S relocation. - * We need to see if bit 15 is set in the result. If it is, we add - * 0x10000 and continue normally. This will compensate for the sign extension - * when the low bits are added at run time. - */ -static bfd_reloc_status_type -mips_fix_hi16_s PARAMS ((bfd *, arelent *, asymbol *, PTR, - asection *, bfd *, char **)); - -static bfd_reloc_status_type -mips_fix_hi16_s (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section ATTRIBUTE_UNUSED; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - bfd_vma relocation; - - /* If this is a partial relocation, just continue. */ - if (output_bfd != (bfd *)NULL) - return bfd_reloc_continue; - - /* If this is an undefined symbol, return error */ - if (bfd_is_und_section (symbol->section) - && (symbol->flags & BSF_WEAK) == 0) - return bfd_reloc_undefined; - - /* - * Work out which section the relocation is targetted at and the - * initial relocation command value. - */ - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - relocation += reloc_entry->addend; - - if (relocation & 0x8000) - reloc_entry->addend += 0x10000; - - return bfd_reloc_continue; -} - -static reloc_howto_type mips_howto_table_ext[] = { - {MIPS_RELOC_32, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, - "32", false, 0, 0xffffffff, false}, - {MIPS_RELOC_JMP, 2, 2, 26, false, 0, complain_overflow_dont, - mips_fix_jmp_addr, - "MIPS_JMP", false, 0, 0x03ffffff, false}, - {MIPS_RELOC_WDISP16, 2, 2, 16, true, 0, complain_overflow_signed, 0, - "WDISP16", false, 0, 0x0000ffff, false}, - {MIPS_RELOC_HI16, 16, 2, 16, false, 0, complain_overflow_bitfield, 0, - "HI16", false, 0, 0x0000ffff, false}, - {MIPS_RELOC_HI16_S, 16, 2, 16, false, 0, complain_overflow_bitfield, - mips_fix_hi16_s, - "HI16_S", false, 0, 0x0000ffff, false}, - {MIPS_RELOC_LO16, 0, 2, 16, false, 0, complain_overflow_dont, 0, - "LO16", false, 0, 0x0000ffff, false}, -}; - -static reloc_howto_type * -MY(reloc_howto_type_lookup) (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; -{ - - if (bfd_get_arch (abfd) != bfd_arch_mips) - return 0; - - switch (code) - { - case BFD_RELOC_CTOR: - case BFD_RELOC_32: - return (&mips_howto_table_ext[MIPS_RELOC_32]); - case BFD_RELOC_MIPS_JMP: - return (&mips_howto_table_ext[MIPS_RELOC_JMP]); - case BFD_RELOC_16_PCREL_S2: - return (&mips_howto_table_ext[MIPS_RELOC_WDISP16]); - case BFD_RELOC_HI16: - return (&mips_howto_table_ext[MIPS_RELOC_HI16]); - case BFD_RELOC_HI16_S: - return (&mips_howto_table_ext[MIPS_RELOC_HI16_S]); - case BFD_RELOC_LO16: - return (&mips_howto_table_ext[MIPS_RELOC_LO16]); - default: - return 0; - } -} - -/* - * This is just like the standard aoutx.h version but we need to do our - * own mapping of external reloc type values to howto entries. - */ -long -MY(canonicalize_reloc)(abfd, section, relptr, symbols) - bfd *abfd; - sec_ptr section; - arelent **relptr; - asymbol **symbols; -{ - arelent *tblptr = section->relocation; - unsigned int count, c; - extern reloc_howto_type NAME(aout,ext_howto_table)[]; - - /* If we have already read in the relocation table, return the values. */ - if (section->flags & SEC_CONSTRUCTOR) { - arelent_chain *chain = section->constructor_chain; - - for (count = 0; count < section->reloc_count; count++) { - *relptr++ = &chain->relent; - chain = chain->next; - } - *relptr = 0; - return section->reloc_count; - } - if (tblptr && section->reloc_count) { - for (count = 0; count++ < section->reloc_count;) - *relptr++ = tblptr++; - *relptr = 0; - return section->reloc_count; - } - - if (!NAME(aout,slurp_reloc_table)(abfd, section, symbols)) - return -1; - tblptr = section->relocation; - - /* fix up howto entries */ - for (count = 0; count++ < section->reloc_count;) - { - c = tblptr->howto - NAME(aout,ext_howto_table); - tblptr->howto = &mips_howto_table_ext[c]; - - *relptr++ = tblptr++; - } - *relptr = 0; - return section->reloc_count; -} - -static CONST struct aout_backend_data MY(backend_data) = { - 0, /* zmagic contiguous */ - 1, /* text incl header */ - 0, /* entry is text address */ - 0, /* exec_hdr_flags */ - TARGET_PAGE_SIZE, /* text vma */ - MY_set_sizes, - 0, /* text size includes exec header */ - 0, /* add_dynamic_symbols */ - 0, /* add_one_symbol */ - 0, /* link_dynamic_object */ - 0, /* write_dynamic_symbol */ - 0, /* check_dynamic_reloc */ - 0 /* finish_dynamic_link */ -}; - -extern const bfd_target aout_mips_big_vec; - -const bfd_target aout_mips_little_vec = -{ - "a.out-mips-little", /* name */ - bfd_target_aout_flavour, - BFD_ENDIAN_LITTLE, /* target byte order (little) */ - BFD_ENDIAN_LITTLE, /* target headers byte order (little) */ - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), - MY_symbol_leading_char, - ' ', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ - {_bfd_dummy_target, MY_object_p, /* bfd_check_format */ - bfd_generic_archive_p, MY_core_file_p}, - {bfd_false, MY_mkobject, /* bfd_set_format */ - _bfd_generic_mkarchive, bfd_false}, - {bfd_false, MY_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (MY), - BFD_JUMP_TABLE_COPY (MY), - BFD_JUMP_TABLE_CORE (MY), - BFD_JUMP_TABLE_ARCHIVE (MY), - BFD_JUMP_TABLE_SYMBOLS (MY), - BFD_JUMP_TABLE_RELOCS (MY), - BFD_JUMP_TABLE_WRITE (MY), - BFD_JUMP_TABLE_LINK (MY), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - & aout_mips_big_vec, - - (PTR) MY_backend_data -}; - -const bfd_target aout_mips_big_vec = -{ - "a.out-mips-big", /* name */ - bfd_target_aout_flavour, - BFD_ENDIAN_BIG, /* target byte order (big) */ - BFD_ENDIAN_BIG, /* target headers byte order (big) */ - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), - MY_symbol_leading_char, - ' ', /* ar_pad_char */ - 15, /* ar_max_namelen */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ - {_bfd_dummy_target, MY_object_p, /* bfd_check_format */ - bfd_generic_archive_p, MY_core_file_p}, - {bfd_false, MY_mkobject, /* bfd_set_format */ - _bfd_generic_mkarchive, bfd_false}, - {bfd_false, MY_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (MY), - BFD_JUMP_TABLE_COPY (MY), - BFD_JUMP_TABLE_CORE (MY), - BFD_JUMP_TABLE_ARCHIVE (MY), - BFD_JUMP_TABLE_SYMBOLS (MY), - BFD_JUMP_TABLE_RELOCS (MY), - BFD_JUMP_TABLE_WRITE (MY), - BFD_JUMP_TABLE_LINK (MY), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - & aout_mips_little_vec, - - (PTR) MY_backend_data -}; diff --git a/contrib/binutils/bfd/pe-mips.c b/contrib/binutils/bfd/pe-mips.c deleted file mode 100644 index 9b89369b37b6..000000000000 --- a/contrib/binutils/bfd/pe-mips.c +++ /dev/null @@ -1,998 +0,0 @@ -/* BFD back-end for MIPS PE COFF files. - Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. - Modified from coff-i386.c by DJ Delorie, dj@cygnus.com - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define COFF_WITH_PE -#define COFF_LONG_SECTION_NAMES -#define PCRELOFFSET true - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" - -#include "coff/mipspe.h" - -#include "coff/internal.h" - -#include "coff/pe.h" - -#include "libcoff.h" - -static bfd_reloc_status_type coff_mips_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static reloc_howto_type *coff_mips_rtype_to_howto - PARAMS ((bfd *, asection *, struct internal_reloc *, - struct coff_link_hash_entry *, struct internal_syment *, - - bfd_vma *)); -#if 0 -static void mips_ecoff_swap_reloc_in PARAMS ((bfd *, PTR, - struct internal_reloc *)); -static void mips_ecoff_swap_reloc_out PARAMS ((bfd *, - const struct internal_reloc *, - PTR)); -static void mips_adjust_reloc_in PARAMS ((bfd *, - const struct internal_reloc *, - arelent *)); -static void mips_adjust_reloc_out PARAMS ((bfd *, const arelent *, - struct internal_reloc *)); -#endif -#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) -/* The page size is a guess based on ELF. */ - -#define COFF_PAGE_SIZE 0x1000 - -/* For some reason when using mips COFF the value stored in the .text - section for a reference to a common symbol is the value itself plus - any desired offset. Ian Taylor, Cygnus Support. */ - -/* If we are producing relocateable output, we need to do some - adjustments to the object file that are not done by the - bfd_perform_relocation function. This function is called by every - reloc type to make any required adjustments. */ - -static bfd_reloc_status_type -coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section ATTRIBUTE_UNUSED; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - symvalue diff; - - if (output_bfd == (bfd *) NULL) - return bfd_reloc_continue; - - if (bfd_is_com_section (symbol->section)) - { -#ifndef COFF_WITH_PE - /* We are relocating a common symbol. The current value in the - object file is ORIG + OFFSET, where ORIG is the value of the - common symbol as seen by the object file when it was compiled - (this may be zero if the symbol was undefined) and OFFSET is - the offset into the common symbol (normally zero, but may be - non-zero when referring to a field in a common structure). - ORIG is the negative of reloc_entry->addend, which is set by - the CALC_ADDEND macro below. We want to replace the value in - the object file with NEW + OFFSET, where NEW is the value of - the common symbol which we are going to put in the final - object file. NEW is symbol->value. */ - diff = symbol->value + reloc_entry->addend; -#else - /* In PE mode, we do not offset the common symbol. */ - diff = reloc_entry->addend; -#endif - } - else - { - /* For some reason bfd_perform_relocation always effectively - ignores the addend for a COFF target when producing - relocateable output. This seems to be always wrong for 386 - COFF, so we handle the addend here instead. */ - diff = reloc_entry->addend; - } - -#ifdef COFF_WITH_PE -#if 0 - /* dj - handle it like any other reloc? */ - /* FIXME: How should this case be handled? */ - if (reloc_entry->howto->type == MIPS_R_RVA && diff != 0) - abort (); -#endif -#endif - -#define DOIT(x) \ - x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + (diff >> howto->rightshift)) & howto->dst_mask)) - - if (diff != 0) - { - reloc_howto_type *howto = reloc_entry->howto; - unsigned char *addr = (unsigned char *) data + reloc_entry->address; - - switch (howto->size) - { - case 0: - { - char x = bfd_get_8 (abfd, addr); - DOIT (x); - bfd_put_8 (abfd, x, addr); - } - break; - - case 1: - { - short x = bfd_get_16 (abfd, addr); - DOIT (x); - bfd_put_16 (abfd, x, addr); - } - break; - - case 2: - { - long x = bfd_get_32 (abfd, addr); - DOIT (x); - bfd_put_32 (abfd, x, addr); - } - break; - - default: - abort (); - } - } - - /* Now let bfd_perform_relocation finish everything up. */ - return bfd_reloc_continue; -} - -#ifdef COFF_WITH_PE -/* Return true if this relocation should - appear in the output .reloc section. */ - -static boolean in_reloc_p(abfd, howto) - bfd * abfd ATTRIBUTE_UNUSED; - reloc_howto_type *howto; -{ - return ! howto->pc_relative && howto->type != MIPS_R_RVA; -} -#endif - -#ifndef PCRELOFFSET -#define PCRELOFFSET false -#endif - -static reloc_howto_type howto_table[] = -{ - /* Reloc type 0 is ignored. The reloc reading code ensures that - this is a reference to the .abs section, which will cause - bfd_perform_relocation to do nothing. */ - HOWTO (MIPS_R_ABSOLUTE, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - 0, /* special_function */ - "IGNORE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 16 bit reference to a symbol, normally from a data section. */ - HOWTO (MIPS_R_REFHALF, /* type */ - 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - coff_mips_reloc, /* special_function */ - "REFHALF", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 32 bit reference to a symbol, normally from a data section. */ - HOWTO (MIPS_R_REFWORD, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - coff_mips_reloc, /* special_function */ - "REFWORD", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A 26 bit absolute jump address. */ - HOWTO (MIPS_R_JMPADDR, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - /* This needs complex overflow - detection, because the upper four - bits must match the PC. */ - coff_mips_reloc, /* special_function */ - "JMPADDR", /* name */ - true, /* partial_inplace */ - 0x3ffffff, /* src_mask */ - 0x3ffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* The high 16 bits of a symbol value. Handled by the function - mips_refhi_reloc. */ - HOWTO (MIPS_R_REFHI, /* type */ - 16, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - coff_mips_reloc, /* special_function */ - "REFHI", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* The low 16 bits of a symbol value. */ - HOWTO (MIPS_R_REFLO, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - coff_mips_reloc, /* special_function */ - "REFLO", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A reference to an offset from the gp register. Handled by the - function mips_gprel_reloc. */ - HOWTO (MIPS_R_GPREL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - coff_mips_reloc, /* special_function */ - "GPREL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* A reference to a literal using an offset from the gp register. - Handled by the function mips_gprel_reloc. */ - HOWTO (MIPS_R_LITERAL, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 16, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - coff_mips_reloc, /* special_function */ - "LITERAL", /* name */ - true, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - false), /* pcrel_offset */ - - EMPTY_HOWTO (8), - EMPTY_HOWTO (9), - EMPTY_HOWTO (10), - EMPTY_HOWTO (11), - EMPTY_HOWTO (12), - EMPTY_HOWTO (13), - EMPTY_HOWTO (14), - EMPTY_HOWTO (15), - EMPTY_HOWTO (16), - EMPTY_HOWTO (17), - EMPTY_HOWTO (18), - EMPTY_HOWTO (19), - EMPTY_HOWTO (20), - EMPTY_HOWTO (21), - EMPTY_HOWTO (22), - EMPTY_HOWTO (23), - EMPTY_HOWTO (24), - EMPTY_HOWTO (25), - EMPTY_HOWTO (26), - EMPTY_HOWTO (27), - EMPTY_HOWTO (28), - EMPTY_HOWTO (29), - EMPTY_HOWTO (30), - EMPTY_HOWTO (31), - EMPTY_HOWTO (32), - EMPTY_HOWTO (33), - HOWTO (MIPS_R_RVA, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - coff_mips_reloc, /* special_function */ - "rva32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - EMPTY_HOWTO (35), - EMPTY_HOWTO (36), - HOWTO (MIPS_R_PAIR, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - coff_mips_reloc, /* special_function */ - "PAIR", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ -}; - -/* Turn a howto into a reloc nunmber */ - -#define SELECT_RELOC(x,howto) { x.r_type = howto->type; } -#define BADMAG(x) MIPSBADMAG(x) -#define MIPS 1 /* Customize coffcode.h */ - -#define RTYPE2HOWTO(cache_ptr, dst) \ - (cache_ptr)->howto = howto_table + (dst)->r_type; - -/* Compute the addend of a reloc. If the reloc is to a common symbol, - the object file contains the value of the common symbol. By the - time this is called, the linker may be using a different symbol - from a different object file with a different value. Therefore, we - hack wildly to locate the original symbol from this file so that we - can make the correct adjustment. This macro sets coffsym to the - symbol from the original file, and uses it to set the addend value - correctly. If this is not a common symbol, the usual addend - calculation is done, except that an additional tweak is needed for - PC relative relocs. - FIXME: This macro refers to symbols and asect; these are from the - calling function, not the macro arguments. */ - -#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ - { \ - coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ - if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ - coffsym = (obj_symbols (abfd) \ - + (cache_ptr->sym_ptr_ptr - symbols)); \ - else if (ptr) \ - coffsym = coff_symbol_from (abfd, ptr); \ - if (coffsym != (coff_symbol_type *) NULL \ - && coffsym->native->u.syment.n_scnum == 0) \ - cache_ptr->addend = - coffsym->native->u.syment.n_value; \ - else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ - && ptr->section != (asection *) NULL) \ - cache_ptr->addend = - (ptr->section->vma + ptr->value); \ - else \ - cache_ptr->addend = 0; \ - if (ptr && howto_table[reloc.r_type].pc_relative) \ - cache_ptr->addend += asect->vma; \ - } - - -/* Convert an rtype to howto for the COFF backend linker. */ - -static reloc_howto_type * -coff_mips_rtype_to_howto (abfd, sec, rel, h, sym, addendp) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec; - struct internal_reloc *rel; - struct coff_link_hash_entry *h; - struct internal_syment *sym; - bfd_vma *addendp; -{ - - reloc_howto_type *howto; - - howto = howto_table + rel->r_type; - -#ifdef COFF_WITH_PE - *addendp = 0; -#endif - - if (howto->pc_relative) - *addendp += sec->vma; - - if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0) - { - /* This is a common symbol. The section contents include the - size (sym->n_value) as an addend. The relocate_section - function will be adding in the final value of the symbol. We - need to subtract out the current size in order to get the - correct result. */ - - BFD_ASSERT (h != NULL); - -#ifndef COFF_WITH_PE - /* I think we *do* want to bypass this. If we don't, I have - seen some data parameters get the wrong relocation address. - If I link two versions with and without this section bypassed - and then do a binary comparison, the addresses which are - different can be looked up in the map. The case in which - this section has been bypassed has addresses which correspond - to values I can find in the map. */ - *addendp -= sym->n_value; -#endif - } - -#ifndef COFF_WITH_PE - /* If the output symbol is common (in which case this must be a - relocateable link), we need to add in the final size of the - common symbol. */ - if (h != NULL && h->root.type == bfd_link_hash_common) - *addendp += h->root.u.c.size; -#endif - -#ifdef COFF_WITH_PE - if (howto->pc_relative) - { - *addendp -= 4; - - /* If the symbol is defined, then the generic code is going to - add back the symbol value in order to cancel out an - adjustment it made to the addend. However, we set the addend - to 0 at the start of this function. We need to adjust here, - to avoid the adjustment the generic code will make. FIXME: - This is getting a bit hackish. */ - if (sym != NULL && sym->n_scnum != 0) - *addendp -= sym->n_value; - } - - if (rel->r_type == MIPS_R_RVA) - { - *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase; - } -#endif - - return howto; -} - -#define coff_rtype_to_howto coff_mips_rtype_to_howto - - -#define coff_bfd_reloc_type_lookup coff_mips_reloc_type_lookup - - - -/* Get the howto structure for a generic reloc type. */ - -static reloc_howto_type * -coff_mips_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; -{ - int mips_type; - - switch (code) - { - case BFD_RELOC_16: - mips_type = MIPS_R_REFHALF; - break; - case BFD_RELOC_32: - case BFD_RELOC_CTOR: - mips_type = MIPS_R_REFWORD; - break; - case BFD_RELOC_MIPS_JMP: - mips_type = MIPS_R_JMPADDR; - break; - case BFD_RELOC_HI16_S: - mips_type = MIPS_R_REFHI; - break; - case BFD_RELOC_LO16: - mips_type = MIPS_R_REFLO; - break; - case BFD_RELOC_MIPS_GPREL: - mips_type = MIPS_R_GPREL; - break; - case BFD_RELOC_MIPS_LITERAL: - mips_type = MIPS_R_LITERAL; - break; -/* FIXME? - case BFD_RELOC_16_PCREL_S2: - mips_type = MIPS_R_PCREL16; - break; - case BFD_RELOC_PCREL_HI16_S: - mips_type = MIPS_R_RELHI; - break; - case BFD_RELOC_PCREL_LO16: - mips_type = MIPS_R_RELLO; - break; - case BFD_RELOC_GPREL32: - mips_type = MIPS_R_SWITCH; - break; -*/ - case BFD_RELOC_RVA: - mips_type = MIPS_R_RVA; - break; - default: - return (reloc_howto_type *) NULL; - } - - return &howto_table[mips_type]; -} - -static void -mips_swap_reloc_in (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; -{ - static struct internal_reloc pair_prev; - RELOC *reloc_src = (RELOC *) src; - struct internal_reloc *reloc_dst = (struct internal_reloc *) dst; - - reloc_dst->r_vaddr = bfd_h_get_32(abfd, (bfd_byte *)reloc_src->r_vaddr); - reloc_dst->r_symndx = - bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx); - reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type); - reloc_dst->r_size = 0; - reloc_dst->r_extern = 0; - reloc_dst->r_offset = 0; - - switch (reloc_dst->r_type) - { - case MIPS_R_REFHI: - pair_prev = *reloc_dst; - break; - case MIPS_R_PAIR: - reloc_dst->r_offset = reloc_dst->r_symndx; - if (reloc_dst->r_offset & 0x8000) - reloc_dst->r_offset -= 0x10000; - /*printf("dj: pair offset is %08x\n", reloc_dst->r_offset);*/ - reloc_dst->r_symndx = pair_prev.r_symndx; - break; - } -} - -static unsigned int -mips_swap_reloc_out (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; -{ - static int prev_offset = 1; - static bfd_vma prev_addr = 0; - struct internal_reloc *reloc_src = (struct internal_reloc *)src; - struct external_reloc *reloc_dst = (struct external_reloc *)dst; - - switch (reloc_src->r_type) - { - case MIPS_R_REFHI: - prev_addr = reloc_src->r_vaddr; - prev_offset = reloc_src->r_offset; - break; - case MIPS_R_REFLO: - if (reloc_src->r_vaddr == prev_addr) - { - /* FIXME: only slightly hackish. If we see a REFLO pointing to - the same address as a REFHI, we assume this is the matching - PAIR reloc and output it accordingly. The symndx is really - the low 16 bits of the addend */ - bfd_h_put_32 (abfd, reloc_src->r_vaddr, - (bfd_byte *) reloc_dst->r_vaddr); - bfd_h_put_32 (abfd, reloc_src->r_symndx, - (bfd_byte *) reloc_dst->r_symndx); - - bfd_h_put_16(abfd, MIPS_R_PAIR, (bfd_byte *) - reloc_dst->r_type); - return RELSZ; - } - break; - } - - bfd_h_put_32(abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr); - bfd_h_put_32(abfd, reloc_src->r_symndx, (bfd_byte *) reloc_dst->r_symndx); - - bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *) - reloc_dst->r_type); - return RELSZ; -} - -#define coff_swap_reloc_in mips_swap_reloc_in -#define coff_swap_reloc_out mips_swap_reloc_out -#define NO_COFF_RELOCS - -static boolean -coff_pe_mips_relocate_section (output_bfd, info, input_bfd, - input_section, contents, relocs, syms, - sections) - bfd *output_bfd; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - struct internal_reloc *relocs; - struct internal_syment *syms; - asection **sections; -{ - bfd_vma gp; - boolean gp_undefined; - size_t adjust; - struct internal_reloc *rel; - struct internal_reloc *rel_end; - unsigned int i; - boolean got_lo; - - if (info->relocateable) - { - (*_bfd_error_handler)(_("\ -%s: `ld -r' not supported with PE MIPS objects\n"), - bfd_get_filename (input_bfd)); - bfd_set_error (bfd_error_bad_value); - return false; - } - - BFD_ASSERT (input_bfd->xvec->byteorder - == output_bfd->xvec->byteorder); - -#if 0 - printf("dj: relocate %s(%s) %08x\n", - input_bfd->filename, input_section->name, - input_section->output_section->vma + input_section->output_offset); -#endif - - gp = _bfd_get_gp_value (output_bfd); - if (gp == 0) - gp_undefined = true; - else - gp_undefined = false; - - got_lo = false; - - adjust = 0; - - rel = relocs; - rel_end = rel + input_section->reloc_count; - for (i = 0; rel < rel_end; rel++, i++) - { - long symndx; - struct coff_link_hash_entry *h; - struct internal_syment *sym; - bfd_vma addend = 0; - bfd_vma val, tmp, targ, src, low; - reloc_howto_type *howto; - unsigned char *mem = contents + rel->r_vaddr; - - symndx = rel->r_symndx; - - if (symndx == -1) - { - h = NULL; - sym = NULL; - } - else - { - h = obj_coff_sym_hashes (input_bfd)[symndx]; - sym = syms + symndx; - } - - /* COFF treats common symbols in one of two ways. Either the - size of the symbol is included in the section contents, or it - is not. We assume that the size is not included, and force - the rtype_to_howto function to adjust the addend as needed. */ - - if (sym != NULL && sym->n_scnum != 0) - addend = - sym->n_value; - else - addend = 0; - - - howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h, - sym, &addend); - if (howto == NULL) - return false; - - /* If we are doing a relocateable link, then we can just ignore - a PC relative reloc that is pcrel_offset. It will already - have the correct value. If this is not a relocateable link, - then we should ignore the symbol value. */ - if (howto->pc_relative && howto->pcrel_offset) - { - if (info->relocateable) - continue; - if (sym != NULL && sym->n_scnum != 0) - addend += sym->n_value; - } - - val = 0; - - if (h == NULL) - { - asection *sec; - - if (symndx == -1) - { - sec = bfd_abs_section_ptr; - val = 0; - } - else - { - sec = sections[symndx]; - val = (sec->output_section->vma - + sec->output_offset - + sym->n_value); - if (! obj_pe (input_bfd)) - val -= sec->vma; - } - } - else - { - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - asection *sec; - - sec = h->root.u.def.section; - val = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } - - else if (! info->relocateable) - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma, true))) - return false; - } - } - - src = rel->r_vaddr + input_section->output_section->vma - + input_section->output_offset; -#if 0 - printf("dj: reloc %02x %-8s a=%08x/%08x(%08x) v=%08x+%08x %s\n", - rel->r_type, howto_table[rel->r_type].name, - src, rel->r_vaddr, *(unsigned long *)mem, val, rel->r_offset, - h?h->root.root.string:"(none)"); -#endif - - /* OK, at this point the following variables are set up: - src = VMA of the memory we're fixing up - mem = pointer to memory we're fixing up - val = VMA of what we need to refer to - */ - -#define UI(x) (*_bfd_error_handler)(_("%s: unimplemented %s\n"), \ - bfd_get_filename (input_bfd), x); \ - bfd_set_error (bfd_error_bad_value); - - switch (rel->r_type) - { - case MIPS_R_ABSOLUTE: - /* ignore these */ - break; - - case MIPS_R_REFHALF: - UI("refhalf"); - break; - - case MIPS_R_REFWORD: - tmp = bfd_get_32(input_bfd, mem); - /* printf("refword: src=%08x targ=%08x+%08x\n", src, tmp, val); */ - tmp += val; - bfd_put_32(input_bfd, tmp, mem); - break; - - case MIPS_R_JMPADDR: - tmp = bfd_get_32(input_bfd, mem); - targ = val + (tmp&0x03ffffff)*4; - if ((src & 0xf0000000) != (targ & 0xf0000000)) - { - (*_bfd_error_handler)(_("%s: jump too far away\n"), - bfd_get_filename (input_bfd)); - bfd_set_error (bfd_error_bad_value); - return false; - } - tmp &= 0xfc000000; - tmp |= (targ/4) & 0x3ffffff; - bfd_put_32(input_bfd, tmp, mem); - break; - - case MIPS_R_REFHI: - tmp = bfd_get_32(input_bfd, mem); - switch (rel[1].r_type) - { - case MIPS_R_PAIR: - /* MS PE object */ - targ = val + rel[1].r_offset + ((tmp & 0xffff) << 16); - break; - case MIPS_R_REFLO: - /* GNU COFF object */ - low = bfd_get_32(input_bfd, contents + rel[1].r_vaddr); - low &= 0xffff; - if (low & 0x8000) - low -= 0x10000; - targ = val + low + ((tmp & 0xffff) << 16); - break; - default: - (*_bfd_error_handler)(_("%s: bad pair/reflo after refhi\n"), - bfd_get_filename (input_bfd)); - bfd_set_error (bfd_error_bad_value); - return false; - } - tmp &= 0xffff0000; - tmp |= (targ >> 16) & 0xffff; - bfd_put_32(input_bfd, tmp, mem); - break; - - case MIPS_R_REFLO: - tmp = bfd_get_32(input_bfd, mem); - targ = val + (tmp & 0xffff); - /* printf("refword: src=%08x targ=%08x\n", src, targ); */ - tmp &= 0xffff0000; - tmp |= targ & 0xffff; - bfd_put_32(input_bfd, tmp, mem); - break; - - case MIPS_R_GPREL: - case MIPS_R_LITERAL: - UI("gprel"); - break; - - case MIPS_R_SECTION: - UI("section"); - break; - - case MIPS_R_SECREL: - UI("secrel"); - break; - - case MIPS_R_SECRELLO: - UI("secrello"); - break; - - case MIPS_R_SECRELHI: - UI("secrelhi"); - break; - - case MIPS_R_RVA: - tmp = bfd_get_32 (input_bfd, mem); - /* printf("rva: src=%08x targ=%08x+%08x\n", src, tmp, val); */ - tmp += val - - pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase; - bfd_put_32 (input_bfd, tmp, mem); - break; - - case MIPS_R_PAIR: - /* ignore these */ - break; - } - } - - return true; -} - -#define coff_relocate_section coff_pe_mips_relocate_section - -#ifdef TARGET_UNDERSCORE - -/* If mips gcc uses underscores for symbol names, then it does not use - a leading dot for local labels, so if TARGET_UNDERSCORE is defined - we treat all symbols starting with L as local. */ - -static boolean coff_mips_is_local_label_name PARAMS ((bfd *, const char *)); - -static boolean -coff_mips_is_local_label_name (abfd, name) - bfd *abfd; - const char *name; -{ - if (name[0] == 'L') - return true; - - return _bfd_coff_is_local_label_name (abfd, name); -} - -#define coff_bfd_is_local_label_name coff_mips_is_local_label_name - -#endif /* TARGET_UNDERSCORE */ - -#define COFF_NO_HACK_SCNHDR_SIZE - -#include "coffcode.h" - -const bfd_target -#ifdef TARGET_SYM - TARGET_SYM = -#else - mipslpe_vec = -#endif -{ -#ifdef TARGET_NAME - TARGET_NAME, -#else - "pe-mips", /* name */ -#endif - bfd_target_coff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_LITTLE, /* header byte order is little */ - - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), - -#ifndef COFF_WITH_PE - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */ - | SEC_CODE | SEC_DATA), -#else - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */ - | SEC_CODE | SEC_DATA - | SEC_LINK_ONCE | SEC_LINK_DUPLICATES), -#endif - -#ifdef TARGET_UNDERSCORE - TARGET_UNDERSCORE, /* leading underscore */ -#else - 0, /* leading underscore */ -#endif - '/', /* ar_pad_char */ - 15, /* ar_max_namelen */ - - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ - bfd_getl64, bfd_getl_signed_64, bfd_putl64, - bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ - -/* Note that we allow an object file to be treated as a core file as well. */ - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - bfd_generic_archive_p, coff_object_p}, - {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ - bfd_false}, - {bfd_false, coff_write_object_contents, /* bfd_write_contents */ - _bfd_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (coff), - BFD_JUMP_TABLE_COPY (coff), - BFD_JUMP_TABLE_CORE (_bfd_nocore), - BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), - BFD_JUMP_TABLE_SYMBOLS (coff), - BFD_JUMP_TABLE_RELOCS (coff), - BFD_JUMP_TABLE_WRITE (coff), - BFD_JUMP_TABLE_LINK (coff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), - - NULL, - - COFF_SWAP_TABLE -}; diff --git a/contrib/binutils/bfd/peicode.h b/contrib/binutils/bfd/peicode.h deleted file mode 100644 index 20fe01cba65a..000000000000 --- a/contrib/binutils/bfd/peicode.h +++ /dev/null @@ -1,1324 +0,0 @@ -/* Support for the generic parts of PE/PEI, for BFD. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. - Written by Cygnus Solutions. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* -Most of this hacked by Steve Chamberlain, - sac@cygnus.com - -PE/PEI rearrangement (and code added): Donn Terry - Softway Systems, Inc. -*/ - -/* Hey look, some documentation [and in a place you expect to find it]! - - The main reference for the pei format is "Microsoft Portable Executable - and Common Object File Format Specification 4.1". Get it if you need to - do some serious hacking on this code. - - Another reference: - "Peering Inside the PE: A Tour of the Win32 Portable Executable - File Format", MSJ 1994, Volume 9. - - The *sole* difference between the pe format and the pei format is that the - latter has an MSDOS 2.0 .exe header on the front that prints the message - "This app must be run under Windows." (or some such). - (FIXME: Whether that statement is *really* true or not is unknown. - Are there more subtle differences between pe and pei formats? - For now assume there aren't. If you find one, then for God sakes - document it here!) - - The Microsoft docs use the word "image" instead of "executable" because - the former can also refer to a DLL (shared library). Confusion can arise - because the `i' in `pei' also refers to "image". The `pe' format can - also create images (i.e. executables), it's just that to run on a win32 - system you need to use the pei format. - - FIXME: Please add more docs here so the next poor fool that has to hack - on this code has a chance of getting something accomplished without - wasting too much time. -*/ - -#include "libpei.h" - -static boolean (*pe_saved_coff_bfd_print_private_bfd_data) - PARAMS ((bfd *, PTR)) = -#ifndef coff_bfd_print_private_bfd_data - NULL; -#else - coff_bfd_print_private_bfd_data; -#undef coff_bfd_print_private_bfd_data -#endif - -static boolean pe_print_private_bfd_data PARAMS ((bfd *, PTR)); -#define coff_bfd_print_private_bfd_data pe_print_private_bfd_data - -static boolean (*pe_saved_coff_bfd_copy_private_bfd_data) - PARAMS ((bfd *, bfd *)) = -#ifndef coff_bfd_copy_private_bfd_data - NULL; -#else - coff_bfd_copy_private_bfd_data; -#undef coff_bfd_copy_private_bfd_data -#endif - -static boolean pe_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *)); -#define coff_bfd_copy_private_bfd_data pe_bfd_copy_private_bfd_data - -#define coff_mkobject pe_mkobject -#define coff_mkobject_hook pe_mkobject_hook - -#ifndef NO_COFF_RELOCS -static void coff_swap_reloc_in PARAMS ((bfd *, PTR, PTR)); -static unsigned int coff_swap_reloc_out PARAMS ((bfd *, PTR, PTR)); -#endif -static void coff_swap_filehdr_in PARAMS ((bfd *, PTR, PTR)); -static void coff_swap_scnhdr_in PARAMS ((bfd *, PTR, PTR)); -static boolean pe_mkobject PARAMS ((bfd *)); -static PTR pe_mkobject_hook PARAMS ((bfd *, PTR, PTR)); - -#ifdef COFF_IMAGE_WITH_PE -/* This structure contains static variables used by the ILF code. */ -typedef asection * asection_ptr; - -typedef struct -{ - bfd * abfd; - bfd_byte * data; - struct bfd_in_memory * bim; - unsigned short magic; - - arelent * reltab; - unsigned int relcount; - - coff_symbol_type * sym_cache; - coff_symbol_type * sym_ptr; - unsigned int sym_index; - - unsigned int * sym_table; - unsigned int * table_ptr; - - combined_entry_type * native_syms; - combined_entry_type * native_ptr; - - coff_symbol_type ** sym_ptr_table; - coff_symbol_type ** sym_ptr_ptr; - - unsigned int sec_index; - - char * string_table; - char * string_ptr; - char * end_string_ptr; - - SYMENT * esym_table; - SYMENT * esym_ptr; - - struct internal_reloc * int_reltab; -} -pe_ILF_vars; - -static asection_ptr pe_ILF_make_a_section PARAMS ((pe_ILF_vars *, const char *, unsigned int, flagword)); -static void pe_ILF_make_a_reloc PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type, asection_ptr)); -static void pe_ILF_make_a_symbol PARAMS ((pe_ILF_vars *, const char *, const char *, asection_ptr, flagword)); -static void pe_ILF_save_relocs PARAMS ((pe_ILF_vars *, asection_ptr)); -static void pe_ILF_make_a_symbol_reloc PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type, struct symbol_cache_entry **, unsigned int)); -static boolean pe_ILF_build_a_bfd PARAMS ((bfd *, unsigned short, bfd_byte *, bfd_byte *, unsigned int, unsigned int)); -static const bfd_target * pe_ILF_object_p PARAMS ((bfd *)); -static const bfd_target * pe_bfd_object_p PARAMS ((bfd *)); -#endif /* COFF_IMAGE_WITH_PE */ - -/**********************************************************************/ - -#ifndef NO_COFF_RELOCS -static void -coff_swap_reloc_in (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; -{ - RELOC *reloc_src = (RELOC *) src; - struct internal_reloc *reloc_dst = (struct internal_reloc *) dst; - - reloc_dst->r_vaddr = bfd_h_get_32(abfd, (bfd_byte *)reloc_src->r_vaddr); - reloc_dst->r_symndx = bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx); - - reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type); - -#ifdef SWAP_IN_RELOC_OFFSET - reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET(abfd, - (bfd_byte *) reloc_src->r_offset); -#endif -} - -static unsigned int -coff_swap_reloc_out (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; -{ - struct internal_reloc *reloc_src = (struct internal_reloc *)src; - struct external_reloc *reloc_dst = (struct external_reloc *)dst; - bfd_h_put_32(abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr); - bfd_h_put_32(abfd, reloc_src->r_symndx, (bfd_byte *) reloc_dst->r_symndx); - - bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *) - reloc_dst->r_type); - -#ifdef SWAP_OUT_RELOC_OFFSET - SWAP_OUT_RELOC_OFFSET(abfd, - reloc_src->r_offset, - (bfd_byte *) reloc_dst->r_offset); -#endif -#ifdef SWAP_OUT_RELOC_EXTRA - SWAP_OUT_RELOC_EXTRA(abfd,reloc_src, reloc_dst); -#endif - return RELSZ; -} -#endif /* not NO_COFF_RELOCS */ - -static void -coff_swap_filehdr_in (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; -{ - FILHDR *filehdr_src = (FILHDR *) src; - struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst; - filehdr_dst->f_magic = bfd_h_get_16(abfd, (bfd_byte *) filehdr_src->f_magic); - filehdr_dst->f_nscns = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_nscns); - filehdr_dst->f_timdat = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_timdat); - - filehdr_dst->f_nsyms = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_nsyms); - filehdr_dst->f_flags = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_flags); - filehdr_dst->f_symptr = bfd_h_get_32 (abfd, (bfd_byte *) filehdr_src->f_symptr); - - /* Other people's tools sometimes generate headers with an nsyms but - a zero symptr. */ - if (filehdr_dst->f_nsyms != 0 && filehdr_dst->f_symptr == 0) - { - filehdr_dst->f_nsyms = 0; - filehdr_dst->f_flags |= F_LSYMS; - } - - filehdr_dst->f_opthdr = bfd_h_get_16(abfd, - (bfd_byte *)filehdr_src-> f_opthdr); -} - -#ifdef COFF_IMAGE_WITH_PE -# define coff_swap_filehdr_out _bfd_XXi_only_swap_filehdr_out -#else -# define coff_swap_filehdr_out _bfd_pe_only_swap_filehdr_out -#endif - -static void -coff_swap_scnhdr_in (abfd, ext, in) - bfd *abfd; - PTR ext; - PTR in; -{ - SCNHDR *scnhdr_ext = (SCNHDR *) ext; - struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; - - memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name)); - scnhdr_int->s_vaddr = - GET_SCNHDR_VADDR (abfd, (bfd_byte *) scnhdr_ext->s_vaddr); - scnhdr_int->s_paddr = - GET_SCNHDR_PADDR (abfd, (bfd_byte *) scnhdr_ext->s_paddr); - scnhdr_int->s_size = - GET_SCNHDR_SIZE (abfd, (bfd_byte *) scnhdr_ext->s_size); - scnhdr_int->s_scnptr = - GET_SCNHDR_SCNPTR (abfd, (bfd_byte *) scnhdr_ext->s_scnptr); - scnhdr_int->s_relptr = - GET_SCNHDR_RELPTR (abfd, (bfd_byte *) scnhdr_ext->s_relptr); - scnhdr_int->s_lnnoptr = - GET_SCNHDR_LNNOPTR (abfd, (bfd_byte *) scnhdr_ext->s_lnnoptr); - scnhdr_int->s_flags = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_flags); - - /* MS handles overflow of line numbers by carrying into the reloc - field (it appears). Since it's supposed to be zero for PE - *IMAGE* format, that's safe. This is still a bit iffy. */ -#ifdef COFF_IMAGE_WITH_PE - scnhdr_int->s_nlnno = - (bfd_h_get_16 (abfd, (bfd_byte *) scnhdr_ext->s_nlnno) - + (bfd_h_get_16 (abfd, (bfd_byte *) scnhdr_ext->s_nreloc) << 16)); - scnhdr_int->s_nreloc = 0; -#else - scnhdr_int->s_nreloc = bfd_h_get_16 (abfd, - (bfd_byte *) scnhdr_ext->s_nreloc); - scnhdr_int->s_nlnno = bfd_h_get_16 (abfd, - (bfd_byte *) scnhdr_ext->s_nlnno); -#endif - - if (scnhdr_int->s_vaddr != 0) - { - scnhdr_int->s_vaddr += pe_data (abfd)->pe_opthdr.ImageBase; - scnhdr_int->s_vaddr &= 0xffffffff; - } - -#ifndef COFF_NO_HACK_SCNHDR_SIZE - /* If this section holds uninitialized data, use the virtual size - (stored in s_paddr) instead of the physical size. */ - if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0 - && (scnhdr_int->s_paddr > 0)) - { - scnhdr_int->s_size = scnhdr_int->s_paddr; - /* This code used to set scnhdr_int->s_paddr to 0. However, - coff_set_alignment_hook stores s_paddr in virt_size, which - only works if it correctly holds the virtual size of the - section. */ - } -#endif -} - -static boolean -pe_mkobject (abfd) - bfd * abfd; -{ - pe_data_type *pe; - abfd->tdata.pe_obj_data = - (struct pe_tdata *) bfd_zalloc (abfd, sizeof (pe_data_type)); - - if (abfd->tdata.pe_obj_data == 0) - return false; - - pe = pe_data (abfd); - - pe->coff.pe = 1; - - /* in_reloc_p is architecture dependent. */ - pe->in_reloc_p = in_reloc_p; - -#ifdef PEI_FORCE_MINIMUM_ALIGNMENT - pe->force_minimum_alignment = 1; -#endif -#ifdef PEI_TARGET_SUBSYSTEM - pe->target_subsystem = PEI_TARGET_SUBSYSTEM; -#endif - - return true; -} - -/* Create the COFF backend specific information. */ -static PTR -pe_mkobject_hook (abfd, filehdr, aouthdr) - bfd * abfd; - PTR filehdr; - PTR aouthdr ATTRIBUTE_UNUSED; -{ - struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; - pe_data_type *pe; - - if (pe_mkobject (abfd) == false) - return NULL; - - pe = pe_data (abfd); - pe->coff.sym_filepos = internal_f->f_symptr; - /* These members communicate important constants about the symbol - table to GDB's symbol-reading code. These `constants' - unfortunately vary among coff implementations... */ - pe->coff.local_n_btmask = N_BTMASK; - pe->coff.local_n_btshft = N_BTSHFT; - pe->coff.local_n_tmask = N_TMASK; - pe->coff.local_n_tshift = N_TSHIFT; - pe->coff.local_symesz = SYMESZ; - pe->coff.local_auxesz = AUXESZ; - pe->coff.local_linesz = LINESZ; - - pe->coff.timestamp = internal_f->f_timdat; - - obj_raw_syment_count (abfd) = - obj_conv_table_size (abfd) = - internal_f->f_nsyms; - - pe->real_flags = internal_f->f_flags; - - if ((internal_f->f_flags & F_DLL) != 0) - pe->dll = 1; - - if ((internal_f->f_flags & IMAGE_FILE_DEBUG_STRIPPED) == 0) - abfd->flags |= HAS_DEBUG; - -#ifdef COFF_IMAGE_WITH_PE - if (aouthdr) - pe->pe_opthdr = ((struct internal_aouthdr *)aouthdr)->pe; -#endif - -#ifdef ARM - if (! _bfd_coff_arm_set_private_flags (abfd, internal_f->f_flags)) - coff_data (abfd) ->flags = 0; -#endif - - return (PTR) pe; -} - -static boolean -pe_print_private_bfd_data (abfd, vfile) - bfd *abfd; - PTR vfile; -{ - FILE *file = (FILE *) vfile; - - if (!_bfd_XX_print_private_bfd_data_common (abfd, vfile)) - return false; - - if (pe_saved_coff_bfd_print_private_bfd_data != NULL) - { - fputc ('\n', file); - - return pe_saved_coff_bfd_print_private_bfd_data (abfd, vfile); - } - - return true; -} - -/* Copy any private info we understand from the input bfd - to the output bfd. */ - -static boolean -pe_bfd_copy_private_bfd_data (ibfd, obfd) - bfd *ibfd, *obfd; -{ - if (!_bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd)) - return false; - - if (pe_saved_coff_bfd_copy_private_bfd_data) - return pe_saved_coff_bfd_copy_private_bfd_data (ibfd, obfd); - - return true; -} - -#define coff_bfd_copy_private_section_data \ - _bfd_XX_bfd_copy_private_section_data - -#define coff_get_symbol_info _bfd_XX_get_symbol_info - -#ifdef COFF_IMAGE_WITH_PE - -/* Code to handle Microsoft's Image Library Format. - Also known as LINK6 format. - Documentation about this format can be found at: - - http://msdn.microsoft.com/library/specs/pecoff_section8.htm */ - -/* The following constants specify the sizes of the various data - structures that we have to create in order to build a bfd describing - an ILF object file. The final "+ 1" in the definitions of SIZEOF_IDATA6 - and SIZEOF_IDATA7 below is to allow for the possibility that we might - need a padding byte in order to ensure 16 bit alignment for the section's - contents. - - The value for SIZEOF_ILF_STRINGS is computed as follows: - - There will be NUM_ILF_SECTIONS section symbols. Allow 9 characters - per symbol for their names (longest section name is .idata$x). - - There will be two symbols for the imported value, one the symbol name - and one with _imp__ prefixed. Allowing for the terminating nul's this - is strlen (symbol_name) * 2 + 8 + 21 + strlen (source_dll). - - The strings in the string table must start STRING__SIZE_SIZE bytes into - the table in order to for the string lookup code in coffgen/coffcode to - work. */ -#define NUM_ILF_RELOCS 8 -#define NUM_ILF_SECTIONS 6 -#define NUM_ILF_SYMS (2 + NUM_ILF_SECTIONS) - -#define SIZEOF_ILF_SYMS (NUM_ILF_SYMS * sizeof (* vars.sym_cache)) -#define SIZEOF_ILF_SYM_TABLE (NUM_ILF_SYMS * sizeof (* vars.sym_table)) -#define SIZEOF_ILF_NATIVE_SYMS (NUM_ILF_SYMS * sizeof (* vars.native_syms)) -#define SIZEOF_ILF_SYM_PTR_TABLE (NUM_ILF_SYMS * sizeof (* vars.sym_ptr_table)) -#define SIZEOF_ILF_EXT_SYMS (NUM_ILF_SYMS * sizeof (* vars.esym_table)) -#define SIZEOF_ILF_RELOCS (NUM_ILF_RELOCS * sizeof (* vars.reltab)) -#define SIZEOF_ILF_INT_RELOCS (NUM_ILF_RELOCS * sizeof (* vars.int_reltab)) -#define SIZEOF_ILF_STRINGS (strlen (symbol_name) * 2 + 8 \ - + 21 + strlen (source_dll) \ - + NUM_ILF_SECTIONS * 9 \ - + STRING_SIZE_SIZE) -#define SIZEOF_IDATA2 (5 * 4) -#define SIZEOF_IDATA4 (1 * 4) -#define SIZEOF_IDATA5 (1 * 4) -#define SIZEOF_IDATA6 (2 + strlen (symbol_name) + 1 + 1) -#define SIZEOF_IDATA7 (strlen (source_dll) + 1 + 1) -#define SIZEOF_ILF_SECTIONS (NUM_ILF_SECTIONS * sizeof (struct coff_section_tdata)) - -#define ILF_DATA_SIZE \ - sizeof (* vars.bim) \ - + SIZEOF_ILF_SYMS \ - + SIZEOF_ILF_SYM_TABLE \ - + SIZEOF_ILF_NATIVE_SYMS \ - + SIZEOF_ILF_SYM_PTR_TABLE \ - + SIZEOF_ILF_EXT_SYMS \ - + SIZEOF_ILF_RELOCS \ - + SIZEOF_ILF_INT_RELOCS \ - + SIZEOF_ILF_STRINGS \ - + SIZEOF_IDATA2 \ - + SIZEOF_IDATA4 \ - + SIZEOF_IDATA5 \ - + SIZEOF_IDATA6 \ - + SIZEOF_IDATA7 \ - + SIZEOF_ILF_SECTIONS \ - + MAX_TEXT_SECTION_SIZE - -/* Create an empty relocation against the given symbol. */ -static void -pe_ILF_make_a_symbol_reloc (pe_ILF_vars * vars, - bfd_vma address, - bfd_reloc_code_real_type reloc, - struct symbol_cache_entry ** sym, - unsigned int sym_index) -{ - arelent * entry; - struct internal_reloc * internal; - - entry = vars->reltab + vars->relcount; - internal = vars->int_reltab + vars->relcount; - - entry->address = address; - entry->addend = 0; - entry->howto = bfd_reloc_type_lookup (vars->abfd, reloc); - entry->sym_ptr_ptr = sym; - - internal->r_vaddr = address; - internal->r_symndx = sym_index; - internal->r_type = entry->howto->type; -#if 0 /* These fields do not need to be initialised. */ - internal->r_size = 0; - internal->r_extern = 0; - internal->r_offset = 0; -#endif - - vars->relcount ++; - - BFD_ASSERT (vars->relcount <= NUM_ILF_RELOCS); -} - -/* Create an empty relocation against the given section. */ -static void -pe_ILF_make_a_reloc (pe_ILF_vars * vars, - bfd_vma address, - bfd_reloc_code_real_type reloc, - asection_ptr sec) -{ - pe_ILF_make_a_symbol_reloc (vars, address, reloc, sec->symbol_ptr_ptr, - coff_section_data (vars->abfd, sec)->i); -} - -/* Move the queued relocs into the given section. */ -static void -pe_ILF_save_relocs (pe_ILF_vars * vars, - asection_ptr sec) -{ - /* Make sure that there is somewhere to store the internal relocs. */ - if (coff_section_data (vars->abfd, sec) == NULL) - /* We should probably return an error indication here. */ - abort (); - - coff_section_data (vars->abfd, sec)->relocs = vars->int_reltab; - coff_section_data (vars->abfd, sec)->keep_relocs = true; - - sec->relocation = vars->reltab; - sec->reloc_count = vars->relcount; - sec->flags |= SEC_RELOC; - - vars->reltab += vars->relcount; - vars->int_reltab += vars->relcount; - vars->relcount = 0; - - BFD_ASSERT ((bfd_byte *)vars->int_reltab < (bfd_byte *)vars->string_table); -} - -/* Create a global symbol and add it to the relevant tables. */ -static void -pe_ILF_make_a_symbol (pe_ILF_vars * vars, - const char * prefix, - const char * symbol_name, - asection_ptr section, - flagword extra_flags) -{ - coff_symbol_type * sym; - combined_entry_type * ent; - SYMENT * esym; - unsigned short sclass; - - if (extra_flags & BSF_LOCAL) - sclass = C_STAT; - else - sclass = C_EXT; - -#ifdef THUMBPEMAGIC - if (vars->magic == THUMBPEMAGIC) - { - if (extra_flags & BSF_FUNCTION) - sclass = C_THUMBEXTFUNC; - else if (extra_flags & BSF_LOCAL) - sclass = C_THUMBSTAT; - else - sclass = C_THUMBEXT; - } -#endif - - BFD_ASSERT (vars->sym_index < NUM_ILF_SYMS); - - sym = vars->sym_ptr; - ent = vars->native_ptr; - esym = vars->esym_ptr; - - /* Copy the symbol's name into the string table. */ - sprintf (vars->string_ptr, "%s%s", prefix, symbol_name); - - if (section == NULL) - section = (asection_ptr) & bfd_und_section; - - /* Initialise the external symbol. */ - bfd_h_put_32 (vars->abfd, vars->string_ptr - vars->string_table, (bfd_byte *) esym->e.e.e_offset); - bfd_h_put_16 (vars->abfd, section->target_index, (bfd_byte *) esym->e_scnum); - esym->e_sclass[0] = sclass; - - /* The following initialisations are unnecessary - the memory is - zero initialised. They are just kept here as reminders. */ -#if 0 - esym->e.e.e_zeroes = 0; - esym->e_value = 0; - esym->e_type = T_NULL; - esym->e_numaux = 0; -#endif - - /* Initialise the internal symbol structure. */ - ent->u.syment.n_sclass = sclass; - ent->u.syment.n_scnum = section->target_index; - ent->u.syment._n._n_n._n_offset = (long) sym; - -#if 0 /* See comment above. */ - ent->u.syment.n_value = 0; - ent->u.syment.n_flags = 0; - ent->u.syment.n_type = T_NULL; - ent->u.syment.n_numaux = 0; - ent->fix_value = 0; -#endif - - sym->symbol.the_bfd = vars->abfd; - sym->symbol.name = vars->string_ptr; - sym->symbol.flags = BSF_EXPORT | BSF_GLOBAL | extra_flags; - sym->symbol.section = section; - sym->native = ent; - -#if 0 /* See comment above. */ - sym->symbol.value = 0; - sym->symbol.udata.i = 0; - sym->done_lineno = false; - sym->lineno = NULL; -#endif - - * vars->table_ptr = vars->sym_index; - * vars->sym_ptr_ptr = sym; - - /* Adjust pointers for the next symbol. */ - vars->sym_index ++; - vars->sym_ptr ++; - vars->sym_ptr_ptr ++; - vars->table_ptr ++; - vars->native_ptr ++; - vars->esym_ptr ++; - vars->string_ptr += strlen (symbol_name) + strlen (prefix) + 1; - - BFD_ASSERT (vars->string_ptr < vars->end_string_ptr); -} - -/* Create a section. */ -static asection_ptr -pe_ILF_make_a_section (pe_ILF_vars * vars, - const char * name, - unsigned int size, - flagword extra_flags) -{ - asection_ptr sec; - flagword flags; - - sec = bfd_make_section_old_way (vars->abfd, name); - if (sec == NULL) - return NULL; - - flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_KEEP | SEC_IN_MEMORY; - - bfd_set_section_flags (vars->abfd, sec, flags | extra_flags); - - bfd_set_section_alignment (vars->abfd, sec, 2); - - /* Check that we will not run out of space. */ - BFD_ASSERT (vars->data + size < vars->bim->buffer + vars->bim->size); - - /* Set the section size and contents. The actual - contents are filled in by our parent. */ - bfd_set_section_size (vars->abfd, sec, size); - sec->contents = vars->data; - sec->target_index = vars->sec_index ++; - - /* Advance data pointer in the vars structure. */ - vars->data += size; - - /* Skip the padding byte if it was not needed. - The logic here is that if the string length is odd, - then the entire string length, including the null byte, - is even and so the extra, padding byte, is not needed. */ - if (size & 1) - vars->data --; - - /* Create a coff_section_tdata structure for our use. */ - sec->used_by_bfd = (struct coff_section_tdata *) vars->data; - vars->data += sizeof (struct coff_section_tdata); - - BFD_ASSERT (vars->data <= vars->bim->buffer + vars->bim->size); - - /* Create a symbol to refer to this section. */ - pe_ILF_make_a_symbol (vars, "", name, sec, BSF_LOCAL); - - /* Cache the index to the symbol in the coff_section_data structure. */ - coff_section_data (vars->abfd, sec)->i = vars->sym_index - 1; - - return sec; -} - -/* This structure contains the code that goes into the .text section - in order to perform a jump into the DLL lookup table. The entries - in the table are index by the magic number used to represent the - machine type in the PE file. The contents of the data[] arrays in - these entries are stolen from the jtab[] arrays in ld/pe-dll.c. - The SIZE field says how many bytes in the DATA array are actually - used. The OFFSET field says where in the data array the address - of the .idata$5 section should be placed. */ -#define MAX_TEXT_SECTION_SIZE 32 - -typedef struct -{ - unsigned short magic; - unsigned char data[MAX_TEXT_SECTION_SIZE]; - unsigned int size; - unsigned int offset; -} -jump_table; - -static jump_table jtab[] = -{ -#ifdef I386MAGIC - { I386MAGIC, - { 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90 }, - 8, 2 - }, -#endif - -#ifdef MC68MAGIC - { MC68MAGIC, { /* XXX fill me in */ }, 0, 0 }, -#endif -#ifdef MIPS_ARCH_MAGIC_WINCE - { MIPS_ARCH_MAGIC_WINCE, - { 0x00, 0x00, 0x08, 0x3c, 0x00, 0x00, 0x08, 0x8d, - 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 }, - 16, 0 - }, -#endif - -#ifdef SH_ARCH_MAGIC_WINCE - { SH_ARCH_MAGIC_WINCE, - { 0x01, 0xd0, 0x02, 0x60, 0x2b, 0x40, - 0x09, 0x00, 0x00, 0x00, 0x00, 0x00 }, - 12, 8 - }, -#endif - -#ifdef ARMPEMAGIC - { ARMPEMAGIC, - { 0x00, 0xc0, 0x9f, 0xe5, 0x00, 0xf0, - 0x9c, 0xe5, 0x00, 0x00, 0x00, 0x00}, - 12, 8 - }, -#endif - -#ifdef THUMBPEMAGIC - { THUMBPEMAGIC, - { 0x40, 0xb4, 0x02, 0x4e, 0x36, 0x68, 0xb4, 0x46, - 0x40, 0xbc, 0x60, 0x47, 0x00, 0x00, 0x00, 0x00 }, - 16, 12 - }, -#endif - { 0, { 0 }, 0, 0 } -}; - -#ifndef NUM_ENTRIES -#define NUM_ENTRIES(a) (sizeof (a) / sizeof (a)[0]) -#endif - -/* Build a full BFD from the information supplied in a ILF object. */ -static boolean -pe_ILF_build_a_bfd (bfd * abfd, - unsigned short magic, - bfd_byte * symbol_name, - bfd_byte * source_dll, - unsigned int ordinal, - unsigned int types) -{ - bfd_byte * ptr; - pe_ILF_vars vars; - struct internal_filehdr internal_f; - unsigned int import_type; - unsigned int import_name_type; - asection_ptr id4, id5, id6 = NULL, text = NULL; - coff_symbol_type ** imp_sym; - unsigned int imp_index; - - /* Decode and verify the types field of the ILF structure. */ - import_type = types & 0x3; - import_name_type = (types & 0x1c) >> 2; - - switch (import_type) - { - case IMPORT_CODE: - case IMPORT_DATA: - break; - - case IMPORT_CONST: - /* XXX code yet to be written. */ - _bfd_error_handler (_("%s: Unhandled import type; %x"), - bfd_get_filename (abfd), import_type); - return false; - - default: - _bfd_error_handler (_("%s: Unrecognised import type; %x"), - bfd_get_filename (abfd), import_type); - return false; - } - - switch (import_name_type) - { - case IMPORT_ORDINAL: - case IMPORT_NAME: - case IMPORT_NAME_NOPREFIX: - case IMPORT_NAME_UNDECORATE: - break; - - default: - _bfd_error_handler (_("%s: Unrecognised import name type; %x"), - bfd_get_filename (abfd), import_name_type); - return false; - } - - /* Initialise local variables. - - Note these are kept in a structure rather than being - declared as statics since bfd frowns on global variables. - - We are going to construct the contents of the BFD in memory, - so allocate all the space that we will need right now. */ - ptr = bfd_zalloc (abfd, ILF_DATA_SIZE); - if (ptr == NULL) - return false; - - /* Create a bfd_in_memory structure. */ - vars.bim = (struct bfd_in_memory *) ptr; - vars.bim->buffer = ptr; - vars.bim->size = ILF_DATA_SIZE; - ptr += sizeof (* vars.bim); - - /* Initialise the pointers to regions of the memory and the - other contents of the pe_ILF_vars structure as well. */ - vars.sym_cache = (coff_symbol_type *) ptr; - vars.sym_ptr = (coff_symbol_type *) ptr; - vars.sym_index = 0; - ptr += SIZEOF_ILF_SYMS; - - vars.sym_table = (unsigned int *) ptr; - vars.table_ptr = (unsigned int *) ptr; - ptr += SIZEOF_ILF_SYM_TABLE; - - vars.native_syms = (combined_entry_type *) ptr; - vars.native_ptr = (combined_entry_type *) ptr; - ptr += SIZEOF_ILF_NATIVE_SYMS; - - vars.sym_ptr_table = (coff_symbol_type **) ptr; - vars.sym_ptr_ptr = (coff_symbol_type **) ptr; - ptr += SIZEOF_ILF_SYM_PTR_TABLE; - - vars.esym_table = (SYMENT *) ptr; - vars.esym_ptr = (SYMENT *) ptr; - ptr += SIZEOF_ILF_EXT_SYMS; - - vars.reltab = (arelent *) ptr; - vars.relcount = 0; - ptr += SIZEOF_ILF_RELOCS; - - vars.int_reltab = (struct internal_reloc *) ptr; - ptr += SIZEOF_ILF_INT_RELOCS; - - vars.string_table = ptr; - vars.string_ptr = ptr + STRING_SIZE_SIZE; - ptr += SIZEOF_ILF_STRINGS; - vars.end_string_ptr = ptr; - - /* The remaining space in bim->buffer is used - by the pe_ILF_make_a_section() function. */ - vars.data = ptr; - vars.abfd = abfd; - vars.sec_index = 0; - vars.magic = magic; - - /* Create the initial .idata$<n> sections: - [.idata$2: Import Directory Table -- not needed] - .idata$4: Import Lookup Table - .idata$5: Import Address Table - - Note we do not create a .idata$3 section as this is - created for us by the linker script. */ - id4 = pe_ILF_make_a_section (& vars, ".idata$4", SIZEOF_IDATA4, 0); - id5 = pe_ILF_make_a_section (& vars, ".idata$5", SIZEOF_IDATA5, 0); - if (id4 == NULL || id5 == NULL) - return false; - - /* Fill in the contents of these sections. */ - if (import_name_type == IMPORT_ORDINAL) - { - if (ordinal == 0) - /* XXX - treat as IMPORT_NAME ??? */ - abort (); - - * (unsigned int *) id4->contents = ordinal | 0x80000000; - * (unsigned int *) id5->contents = ordinal | 0x80000000; - } - else - { - char * symbol; - - /* Create .idata$6 - the Hint Name Table. */ - id6 = pe_ILF_make_a_section (& vars, ".idata$6", SIZEOF_IDATA6, 0); - if (id6 == NULL) - return false; - - /* If necessary, trim the import symbol name. */ - symbol = symbol_name; - - if (import_name_type != IMPORT_NAME) - /* Skip any prefix in symbol_name. */ - while (*symbol == '@' || * symbol == '?' || * symbol == '_') - ++ symbol; - - if (import_name_type == IMPORT_NAME_UNDECORATE) - { - /* Truncate at the first '@' */ - while (* symbol != 0 && * symbol != '@') - symbol ++; - - * symbol = 0; - } - - id6->contents[0] = ordinal & 0xff; - id6->contents[1] = ordinal >> 8; - - strcpy (id6->contents + 2, symbol); - } - - if (import_name_type != IMPORT_ORDINAL) - { - pe_ILF_make_a_reloc (& vars, 0, BFD_RELOC_RVA, id6); - pe_ILF_save_relocs (& vars, id4); - - pe_ILF_make_a_reloc (& vars, 0, BFD_RELOC_RVA, id6); - pe_ILF_save_relocs (& vars, id5); - } - - /* Create extra sections depending upon the type of import we are dealing with. */ - switch (import_type) - { - int i; - - case IMPORT_CODE: - /* Create a .text section. - First we need to look up its contents in the jump table. */ - for (i = NUM_ENTRIES (jtab); i--;) - { - if (jtab[i].size == 0) - continue; - if (jtab[i].magic == magic) - break; - } - /* If we did not find a matching entry something is wrong. */ - if (i < 0) - abort (); - - /* Create the .text section. */ - text = pe_ILF_make_a_section (& vars, ".text", jtab[i].size, SEC_CODE); - if (text == NULL) - return false; - - /* Copy in the jump code. */ - memcpy (text->contents, jtab[i].data, jtab[i].size); - - /* Create an import symbol. */ - pe_ILF_make_a_symbol (& vars, "__imp_", symbol_name, id5, 0); - imp_sym = vars.sym_ptr_ptr - 1; - imp_index = vars.sym_index - 1; - - /* Create a reloc for the data in the text section. */ -#ifdef MIPS_ARCH_MAGIC_WINCE - if (magic == MIPS_ARCH_MAGIC_WINCE) - { - pe_ILF_make_a_symbol_reloc (& vars, 0, BFD_RELOC_HI16_S, - (struct symbol_cache_entry **) imp_sym, imp_index); - pe_ILF_make_a_reloc (& vars, 0, BFD_RELOC_LO16, text); - pe_ILF_make_a_symbol_reloc (& vars, 4, BFD_RELOC_LO16, - (struct symbol_cache_entry **) imp_sym, imp_index); - } - else -#endif - pe_ILF_make_a_symbol_reloc (& vars, jtab[i].offset, BFD_RELOC_32, - (asymbol **) imp_sym, imp_index); - - pe_ILF_save_relocs (& vars, text); - break; - - case IMPORT_DATA: - break; - - default: - /* XXX code not yet written. */ - abort (); - } - - /* Initialise the bfd. */ - memset (& internal_f, 0, sizeof (internal_f)); - - internal_f.f_magic = magic; - internal_f.f_symptr = 0; - internal_f.f_nsyms = 0; - internal_f.f_flags = F_AR32WR | F_LNNO; /* XXX is this correct ? */ - - if ( ! bfd_set_start_address (abfd, 0) - || ! bfd_coff_set_arch_mach_hook (abfd, & internal_f)) - return false; - - if (bfd_coff_mkobject_hook (abfd, (PTR) & internal_f, NULL) == NULL) - return false; - - coff_data (abfd)->pe = 1; -#ifdef THUMBPEMAGIC - if (vars.magic == THUMBPEMAGIC) - /* Stop some linker warnings about thumb code not supporting interworking. */ - coff_data (abfd)->flags |= F_INTERWORK | F_INTERWORK_SET; -#endif - - /* Switch from file contents to memory contents. */ - bfd_cache_close (abfd); - - abfd->iostream = (PTR) vars.bim; - abfd->flags |= BFD_IN_MEMORY /* | HAS_LOCALS */; - abfd->where = 0; - obj_sym_filepos (abfd) = 0; - - /* Now create a symbol describing the imported value. */ - switch (import_type) - { - bfd_byte * ptr; - - case IMPORT_CODE: - pe_ILF_make_a_symbol (& vars, "", symbol_name, text, - BSF_NOT_AT_END | BSF_FUNCTION); - - /* Create an import symbol for the DLL, without the - .dll suffix. */ - ptr = strrchr (source_dll, '.'); - if (ptr) - * ptr = 0; - pe_ILF_make_a_symbol (& vars, "__IMPORT_DESCRIPTOR_", source_dll, NULL, 0); - if (ptr) - * ptr = '.'; - break; - - case IMPORT_DATA: - /* Nothing to do here. */ - break; - - default: - /* XXX code not yet written. */ - abort (); - } - - /* Point the bfd at the symbol table. */ - obj_symbols (abfd) = vars.sym_cache; - bfd_get_symcount (abfd) = vars.sym_index; - - obj_raw_syments (abfd) = vars.native_syms; - obj_raw_syment_count (abfd) = vars.sym_index; - - obj_coff_external_syms (abfd) = (PTR) vars.esym_table; - obj_coff_keep_syms (abfd) = true; - - obj_convert (abfd) = vars.sym_table; - obj_conv_table_size (abfd) = vars.sym_index; - - obj_coff_strings (abfd) = vars.string_table; - obj_coff_keep_strings (abfd) = true; - - abfd->flags |= HAS_SYMS; - - return true; -} - -/* We have detected a Image Library Format archive element. - Decode the element and return the appropriate target. */ -static const bfd_target * -pe_ILF_object_p (bfd * abfd) -{ - bfd_byte buffer[16]; - bfd_byte * ptr; - bfd_byte * symbol_name; - bfd_byte * source_dll; - unsigned int machine; - unsigned long size; - unsigned int ordinal; - unsigned int types; - unsigned short magic; - - /* Upon entry the first four buyes of the ILF header have - already been read. Now read the rest of the header. */ - if (bfd_read (buffer, 1, 16, abfd) != 16) - return NULL; - - ptr = buffer; - - /* We do not bother to check the version number. - version = bfd_h_get_16 (abfd, ptr); */ - ptr += 2; - - machine = bfd_h_get_16 (abfd, ptr); - ptr += 2; - - /* Check that the machine type is recognised. */ - magic = 0; - - switch (machine) - { - case IMAGE_FILE_MACHINE_UNKNOWN: - case IMAGE_FILE_MACHINE_ALPHA: - case IMAGE_FILE_MACHINE_ALPHA64: - case IMAGE_FILE_MACHINE_IA64: - break; - - case IMAGE_FILE_MACHINE_I386: -#ifdef I386MAGIC - magic = I386MAGIC; -#endif - break; - - case IMAGE_FILE_MACHINE_M68K: -#ifdef MC68AGIC - magic = MC68MAGIC; -#endif - break; - - case IMAGE_FILE_MACHINE_R3000: - case IMAGE_FILE_MACHINE_R4000: - case IMAGE_FILE_MACHINE_R10000: - - case IMAGE_FILE_MACHINE_MIPS16: - case IMAGE_FILE_MACHINE_MIPSFPU: - case IMAGE_FILE_MACHINE_MIPSFPU16: -#ifdef MIPS_ARCH_MAGIC_WINCE - magic = MIPS_ARCH_MAGIC_WINCE; -#endif - break; - - case IMAGE_FILE_MACHINE_SH3: - case IMAGE_FILE_MACHINE_SH4: -#ifdef SH_ARCH_MAGIC_WINCE - magic = SH_ARCH_MAGIC_WINCE; -#endif - break; - - case IMAGE_FILE_MACHINE_ARM: -#ifdef ARMPEMAGIC - magic = ARMPEMAGIC; -#endif - break; - - case IMAGE_FILE_MACHINE_THUMB: -#ifdef THUMBPEMAGIC - { - extern const bfd_target TARGET_LITTLE_SYM; - - if (abfd->xvec == & TARGET_LITTLE_SYM) - magic = THUMBPEMAGIC; - } -#endif - break; - - case IMAGE_FILE_MACHINE_POWERPC: - /* We no longer support PowerPC. */ - default: - _bfd_error_handler - ( -_("%s: Unrecognised machine type (0x%x) in Import Library Format archive"), - bfd_get_filename (abfd), machine); - bfd_set_error (bfd_error_malformed_archive); - - return NULL; - break; - } - - if (magic == 0) - { - _bfd_error_handler - ( -_("%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive"), - bfd_get_filename (abfd), machine); - bfd_set_error (bfd_error_wrong_format); - - return NULL; - } - - /* We do not bother to check the date. - date = bfd_h_get_32 (abfd, ptr); */ - ptr += 4; - - size = bfd_h_get_32 (abfd, ptr); - ptr += 4; - - if (size == 0) - { - _bfd_error_handler - (_("%s: size field is zero in Import Library Format header"), - bfd_get_filename (abfd)); - bfd_set_error (bfd_error_malformed_archive); - - return NULL; - } - - ordinal = bfd_h_get_16 (abfd, ptr); - ptr += 2; - - types = bfd_h_get_16 (abfd, ptr); - /* ptr += 2; */ - - /* Now read in the two strings that follow. */ - ptr = bfd_alloc (abfd, size); - if (ptr == NULL) - return NULL; - - if (bfd_read (ptr, 1, size, abfd) != size) - return NULL; - - symbol_name = ptr; - source_dll = ptr + strlen (ptr) + 1; - - /* Verify that the strings are null terminated. */ - if (ptr[size - 1] != 0 || ((unsigned long) (source_dll - ptr) >= size)) - { - _bfd_error_handler - (_("%s: string not null terminated in ILF object file."), - bfd_get_filename (abfd)); - bfd_set_error (bfd_error_malformed_archive); - - return NULL; - } - - /* Now construct the bfd. */ - if (! pe_ILF_build_a_bfd (abfd, magic, symbol_name, - source_dll, ordinal, types)) - return NULL; - - return abfd->xvec; -} - -static const bfd_target * -pe_bfd_object_p (bfd * abfd) -{ - bfd_byte buffer[4]; - struct external_PEI_DOS_hdr dos_hdr; - struct external_PEI_IMAGE_hdr image_hdr; - file_ptr offset; - - /* Detect if this a Microsoft Import Library Format element. */ - if (bfd_seek (abfd, 0x00, SEEK_SET) != 0 - || bfd_read (buffer, 1, 4, abfd) != 4) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - if (bfd_h_get_32 (abfd, buffer) == 0xffff0000) - return pe_ILF_object_p (abfd); - - if (bfd_seek (abfd, 0x00, SEEK_SET) != 0 - || bfd_read (&dos_hdr, 1, sizeof (dos_hdr), abfd) - != sizeof (dos_hdr)) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - /* There are really two magic numbers involved; the magic number - that says this is a NT executable (PEI) and the magic number that - determines the architecture. The former is DOSMAGIC, stored in - the e_magic field. The latter is stored in the f_magic field. - If the NT magic number isn't valid, the architecture magic number - could be mimicked by some other field (specifically, the number - of relocs in section 3). Since this routine can only be called - correctly for a PEI file, check the e_magic number here, and, if - it doesn't match, clobber the f_magic number so that we don't get - a false match. */ - if (bfd_h_get_16 (abfd, (bfd_byte *) dos_hdr.e_magic) != DOSMAGIC) - { - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - offset = bfd_h_get_32 (abfd, (bfd_byte *) dos_hdr.e_lfanew); - if (bfd_seek (abfd, (file_ptr) offset, SEEK_SET) != 0 - || bfd_read (&image_hdr, 1, sizeof (image_hdr), abfd) - != sizeof (image_hdr)) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - if (bfd_h_get_32 (abfd, (bfd_byte *) image_hdr.nt_signature) - != 0x4550) - { - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - /* Here is the hack. coff_object_p wants to read filhsz bytes to - pick up the COFF header for PE, see "struct external_PEI_filehdr" - in include/coff/pe.h. We adjust so that that will work. */ - if (bfd_seek (abfd, - (file_ptr) (offset - sizeof (dos_hdr)), - SEEK_SET) - != 0) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - return coff_object_p (abfd); -} - -#define coff_object_p pe_bfd_object_p -#endif /* COFF_IMAGE_WITH_PE */ diff --git a/contrib/binutils/bfd/po/POTFILES.in b/contrib/binutils/bfd/po/POTFILES.in deleted file mode 100644 index f75b4caec898..000000000000 --- a/contrib/binutils/bfd/po/POTFILES.in +++ /dev/null @@ -1,255 +0,0 @@ -aix386-core.c -aout0.c -aout32.c -aout64.c -aout-adobe.c -aout-arm.c -aout-cris.c -aoutf1.h -aout-ns32k.c -aout-sparcle.c -aout-target.h -aout-tic30.c -aoutx.h -archive.c -archures.c -armnetbsd.c -bfd.c -binary.c -bout.c -cache.c -cf-i386lynx.c -cf-m68klynx.c -cf-sparclynx.c -cisco-core.c -coff64-rs6000.c -coff-a29k.c -coff-alpha.c -coff-apollo.c -coff-arm.c -coff-aux.c -coffcode.h -coffgen.c -coff-go32.c -coff-h8300.c -coff-h8500.c -coff-i386.c -coff-i860.c -coff-i960.c -cofflink.c -coff-m68k.c -coff-m88k.c -coff-mips.c -coff-pmac.c -coff-rs6000.c -coff-sh.c -coff-sparc.c -coff-stgo32.c -coff-svm68k.c -coffswap.h -coff-tic30.c -coff-tic54x.c -coff-tic80.c -coff-u68k.c -coff-w65.c -coff-we32k.c -coff-z8k.c -corefile.c -cpu-a29k.c -cpu-alpha.c -cpu-arc.c -cpu-arm.c -cpu-avr.c -cpu-cris.c -cpu-d10v.c -cpu-d30v.c -cpu-fr30.c -cpu-h8300.c -cpu-h8500.c -cpu-hppa.c -cpu-i370.c -cpu-i386.c -cpu-i860.c -cpu-i960.c -cpu-ia64.c -cpu-m10200.c -cpu-m10300.c -cpu-m32r.c -cpu-m68hc11.c -cpu-m68hc12.c -cpu-m68k.c -cpu-m88k.c -cpu-mcore.c -cpu-mips.c -cpu-ns32k.c -cpu-pj.c -cpu-powerpc.c -cpu-rs6000.c -cpu-sh.c -cpu-sparc.c -cpu-tic30.c -cpu-tic54x.c -cpu-tic80.c -cpu-v850.c -cpu-vax.c -cpu-w65.c -cpu-we32k.c -cpu-z8k.c -demo64.c -dwarf1.c -dwarf2.c -ecoff.c -ecofflink.c -ecoffswap.h -efi-app-ia32.c -efi-app-ia64.c -elf32-arc.c -elf32-arm.h -elf32-avr.c -elf32.c -elf32-cris.c -elf32-d10v.c -elf32-d30v.c -elf32-fr30.c -elf32-gen.c -elf32-hppa.c -elf32-hppa.h -elf32-i370.c -elf32-i386.c -elf32-i860.c -elf32-i960.c -elf32-m32r.c -elf32-m68hc11.c -elf32-m68hc12.c -elf32-m68k.c -elf32-m88k.c -elf32-mcore.c -elf32-mips.c -elf32-pj.c -elf32-ppc.c -elf32-sh.c -elf32-sh-lin.c -elf32-sparc.c -elf32-v850.c -elf64-alpha.c -elf64.c -elf64-gen.c -elf64-hppa.c -elf64-hppa.h -elf64-mips.c -elf64-sparc.c -elf64-x86-64.c -elfarm-nabi.c -elfarm-oabi.c -elf-bfd.h -elf.c -elfcode.h -elfcore.h -elf-hppa.h -elflink.c -elflink.h -elf-m10200.c -elf-m10300.c -epoc-pe-arm.c -epoc-pei-arm.c -format.c -freebsd.h -genlink.h -go32stub.h -hash.c -hp300bsd.c -hp300hpux.c -hpux-core.c -i386aout.c -i386bsd.c -i386dynix.c -i386freebsd.c -i386linux.c -i386lynx.c -i386mach3.c -i386msdos.c -i386netbsd.c -i386os9k.c -ieee.c -ihex.c -init.c -irix-core.c -libaout.h -libbfd.c -libbfd.h -libcoff.h -libecoff.h -libhppa.h -libieee.h -libnlm.h -liboasys.h -libpei.h -linker.c -lynx-core.c -m68k4knetbsd.c -m68klinux.c -m68klynx.c -m68knetbsd.c -m88kmach3.c -mipsbsd.c -netbsd.h -newsos3.c -nlm32-alpha.c -nlm32.c -nlm32-i386.c -nlm32-ppc.c -nlm32-sparc.c -nlm64.c -nlm.c -nlmcode.h -nlmswap.h -nlm-target.h -ns32k.h -ns32knetbsd.c -oasys.c -opncls.c -osf-core.c -pc532-mach.c -pe-arm.c -pe-i386.c -pei-arm.c -peicode.h -peigen.c -pei-i386.c -pei-mcore.c -pei-mips.c -pei-ppc.c -pei-sh.c -pe-mcore.c -pe-mips.c -pe-ppc.c -pe-sh.c -ppcboot.c -reloc16.c -reloc.c -riscix.c -sco5-core.c -section.c -som.c -som.h -sparclinux.c -sparclynx.c -sparcnetbsd.c -srec.c -stabs.c -stab-syms.c -sunos.c -syms.c -targets.c -tekhex.c -trad-core.c -vaxnetbsd.c -versados.c -vms.c -vms-gsd.c -vms.h -vms-hdr.c -vms-misc.c -vms-tir.c -xcofflink.c -xcoff-target.h diff --git a/contrib/binutils/bfd/sunos.c b/contrib/binutils/bfd/sunos.c deleted file mode 100644 index f4ada70a47d0..000000000000 --- a/contrib/binutils/bfd/sunos.c +++ /dev/null @@ -1,2948 +0,0 @@ -/* BFD backend for SunOS binaries. - Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000 - Free Software Foundation, Inc. - Written by Cygnus Support. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define TARGETNAME "a.out-sunos-big" -#define MY(OP) CAT(sunos_big_,OP) - -#include "bfd.h" -#include "bfdlink.h" -#include "libaout.h" - -/* Static routines defined in this file. */ - -static boolean sunos_read_dynamic_info PARAMS ((bfd *)); -static long sunos_get_dynamic_symtab_upper_bound PARAMS ((bfd *)); -static boolean sunos_slurp_dynamic_symtab PARAMS ((bfd *)); -static long sunos_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **)); -static long sunos_get_dynamic_reloc_upper_bound PARAMS ((bfd *)); -static long sunos_canonicalize_dynamic_reloc - PARAMS ((bfd *, arelent **, asymbol **)); -static struct bfd_hash_entry *sunos_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static struct bfd_link_hash_table *sunos_link_hash_table_create - PARAMS ((bfd *)); -static boolean sunos_create_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *, boolean)); -static boolean sunos_add_dynamic_symbols - PARAMS ((bfd *, struct bfd_link_info *, struct external_nlist **, - bfd_size_type *, char **)); -static boolean sunos_add_one_symbol - PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *, - bfd_vma, const char *, boolean, boolean, - struct bfd_link_hash_entry **)); -static boolean sunos_scan_relocs - PARAMS ((struct bfd_link_info *, bfd *, asection *, bfd_size_type)); -static boolean sunos_scan_std_relocs - PARAMS ((struct bfd_link_info *, bfd *, asection *, - const struct reloc_std_external *, bfd_size_type)); -static boolean sunos_scan_ext_relocs - PARAMS ((struct bfd_link_info *, bfd *, asection *, - const struct reloc_ext_external *, bfd_size_type)); -static boolean sunos_link_dynamic_object - PARAMS ((struct bfd_link_info *, bfd *)); -static boolean sunos_write_dynamic_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct aout_link_hash_entry *)); -static boolean sunos_check_dynamic_reloc - PARAMS ((struct bfd_link_info *, bfd *, asection *, - struct aout_link_hash_entry *, PTR, bfd_byte *, boolean *, - bfd_vma *)); -static boolean sunos_finish_dynamic_link - PARAMS ((bfd *, struct bfd_link_info *)); - -#define MY_get_dynamic_symtab_upper_bound sunos_get_dynamic_symtab_upper_bound -#define MY_canonicalize_dynamic_symtab sunos_canonicalize_dynamic_symtab -#define MY_get_dynamic_reloc_upper_bound sunos_get_dynamic_reloc_upper_bound -#define MY_canonicalize_dynamic_reloc sunos_canonicalize_dynamic_reloc -#define MY_bfd_link_hash_table_create sunos_link_hash_table_create -#define MY_add_dynamic_symbols sunos_add_dynamic_symbols -#define MY_add_one_symbol sunos_add_one_symbol -#define MY_link_dynamic_object sunos_link_dynamic_object -#define MY_write_dynamic_symbol sunos_write_dynamic_symbol -#define MY_check_dynamic_reloc sunos_check_dynamic_reloc -#define MY_finish_dynamic_link sunos_finish_dynamic_link - -/* ??? Where should this go? */ -#define MACHTYPE_OK(mtype) \ - (((mtype) == M_SPARC && bfd_lookup_arch (bfd_arch_sparc, 0) != NULL) \ - || ((mtype) == M_SPARCLET \ - && bfd_lookup_arch (bfd_arch_sparc, bfd_mach_sparc_sparclet) != NULL) \ - || ((mtype) == M_SPARCLITE_LE \ - && bfd_lookup_arch (bfd_arch_sparc, bfd_mach_sparc_sparclet) != NULL) \ - || (((mtype) == M_UNKNOWN || (mtype) == M_68010 || (mtype) == M_68020) \ - && bfd_lookup_arch (bfd_arch_m68k, 0) != NULL)) - -/* Include the usual a.out support. */ -#include "aoutf1.h" - -/* The SunOS 4.1.4 /usr/include/locale.h defines valid as a macro. */ -#undef valid - -/* SunOS shared library support. We store a pointer to this structure - in obj_aout_dynamic_info (abfd). */ - -struct sunos_dynamic_info -{ - /* Whether we found any dynamic information. */ - boolean valid; - /* Dynamic information. */ - struct internal_sun4_dynamic_link dyninfo; - /* Number of dynamic symbols. */ - unsigned long dynsym_count; - /* Read in nlists for dynamic symbols. */ - struct external_nlist *dynsym; - /* asymbol structures for dynamic symbols. */ - aout_symbol_type *canonical_dynsym; - /* Read in dynamic string table. */ - char *dynstr; - /* Number of dynamic relocs. */ - unsigned long dynrel_count; - /* Read in dynamic relocs. This may be reloc_std_external or - reloc_ext_external. */ - PTR dynrel; - /* arelent structures for dynamic relocs. */ - arelent *canonical_dynrel; -}; - -/* The hash table of dynamic symbols is composed of two word entries. - See include/aout/sun4.h for details. */ - -#define HASH_ENTRY_SIZE (2 * BYTES_IN_WORD) - -/* Read in the basic dynamic information. This locates the __DYNAMIC - structure and uses it to find the dynamic_link structure. It - creates and saves a sunos_dynamic_info structure. If it can't find - __DYNAMIC, it sets the valid field of the sunos_dynamic_info - structure to false to avoid doing this work again. */ - -static boolean -sunos_read_dynamic_info (abfd) - bfd *abfd; -{ - struct sunos_dynamic_info *info; - asection *dynsec; - bfd_vma dynoff; - struct external_sun4_dynamic dyninfo; - unsigned long dynver; - struct external_sun4_dynamic_link linkinfo; - - if (obj_aout_dynamic_info (abfd) != (PTR) NULL) - return true; - - if ((abfd->flags & DYNAMIC) == 0) - { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - info = ((struct sunos_dynamic_info *) - bfd_zalloc (abfd, sizeof (struct sunos_dynamic_info))); - if (!info) - return false; - info->valid = false; - info->dynsym = NULL; - info->dynstr = NULL; - info->canonical_dynsym = NULL; - info->dynrel = NULL; - info->canonical_dynrel = NULL; - obj_aout_dynamic_info (abfd) = (PTR) info; - - /* This code used to look for the __DYNAMIC symbol to locate the dynamic - linking information. - However this inhibits recovering the dynamic symbols from a - stripped object file, so blindly assume that the dynamic linking - information is located at the start of the data section. - We could verify this assumption later by looking through the dynamic - symbols for the __DYNAMIC symbol. */ - if ((abfd->flags & DYNAMIC) == 0) - return true; - if (! bfd_get_section_contents (abfd, obj_datasec (abfd), (PTR) &dyninfo, - (file_ptr) 0, sizeof dyninfo)) - return true; - - dynver = GET_WORD (abfd, dyninfo.ld_version); - if (dynver != 2 && dynver != 3) - return true; - - dynoff = GET_WORD (abfd, dyninfo.ld); - - /* dynoff is a virtual address. It is probably always in the .data - section, but this code should work even if it moves. */ - if (dynoff < bfd_get_section_vma (abfd, obj_datasec (abfd))) - dynsec = obj_textsec (abfd); - else - dynsec = obj_datasec (abfd); - dynoff -= bfd_get_section_vma (abfd, dynsec); - if (dynoff > bfd_section_size (abfd, dynsec)) - return true; - - /* This executable appears to be dynamically linked in a way that we - can understand. */ - if (! bfd_get_section_contents (abfd, dynsec, (PTR) &linkinfo, dynoff, - (bfd_size_type) sizeof linkinfo)) - return true; - - /* Swap in the dynamic link information. */ - info->dyninfo.ld_loaded = GET_WORD (abfd, linkinfo.ld_loaded); - info->dyninfo.ld_need = GET_WORD (abfd, linkinfo.ld_need); - info->dyninfo.ld_rules = GET_WORD (abfd, linkinfo.ld_rules); - info->dyninfo.ld_got = GET_WORD (abfd, linkinfo.ld_got); - info->dyninfo.ld_plt = GET_WORD (abfd, linkinfo.ld_plt); - info->dyninfo.ld_rel = GET_WORD (abfd, linkinfo.ld_rel); - info->dyninfo.ld_hash = GET_WORD (abfd, linkinfo.ld_hash); - info->dyninfo.ld_stab = GET_WORD (abfd, linkinfo.ld_stab); - info->dyninfo.ld_stab_hash = GET_WORD (abfd, linkinfo.ld_stab_hash); - info->dyninfo.ld_buckets = GET_WORD (abfd, linkinfo.ld_buckets); - info->dyninfo.ld_symbols = GET_WORD (abfd, linkinfo.ld_symbols); - info->dyninfo.ld_symb_size = GET_WORD (abfd, linkinfo.ld_symb_size); - info->dyninfo.ld_text = GET_WORD (abfd, linkinfo.ld_text); - info->dyninfo.ld_plt_sz = GET_WORD (abfd, linkinfo.ld_plt_sz); - - /* Reportedly the addresses need to be offset by the size of the - exec header in an NMAGIC file. */ - if (adata (abfd).magic == n_magic) - { - unsigned long exec_bytes_size = adata (abfd).exec_bytes_size; - - info->dyninfo.ld_need += exec_bytes_size; - info->dyninfo.ld_rules += exec_bytes_size; - info->dyninfo.ld_rel += exec_bytes_size; - info->dyninfo.ld_hash += exec_bytes_size; - info->dyninfo.ld_stab += exec_bytes_size; - info->dyninfo.ld_symbols += exec_bytes_size; - } - - /* The only way to get the size of the symbol information appears to - be to determine the distance between it and the string table. */ - info->dynsym_count = ((info->dyninfo.ld_symbols - info->dyninfo.ld_stab) - / EXTERNAL_NLIST_SIZE); - BFD_ASSERT (info->dynsym_count * EXTERNAL_NLIST_SIZE - == (unsigned long) (info->dyninfo.ld_symbols - - info->dyninfo.ld_stab)); - - /* Similarly, the relocs end at the hash table. */ - info->dynrel_count = ((info->dyninfo.ld_hash - info->dyninfo.ld_rel) - / obj_reloc_entry_size (abfd)); - BFD_ASSERT (info->dynrel_count * obj_reloc_entry_size (abfd) - == (unsigned long) (info->dyninfo.ld_hash - - info->dyninfo.ld_rel)); - - info->valid = true; - - return true; -} - -/* Return the amount of memory required for the dynamic symbols. */ - -static long -sunos_get_dynamic_symtab_upper_bound (abfd) - bfd *abfd; -{ - struct sunos_dynamic_info *info; - - if (! sunos_read_dynamic_info (abfd)) - return -1; - - info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd); - if (! info->valid) - { - bfd_set_error (bfd_error_no_symbols); - return -1; - } - - return (info->dynsym_count + 1) * sizeof (asymbol *); -} - -/* Read the external dynamic symbols. */ - -static boolean -sunos_slurp_dynamic_symtab (abfd) - bfd *abfd; -{ - struct sunos_dynamic_info *info; - - /* Get the general dynamic information. */ - if (obj_aout_dynamic_info (abfd) == NULL) - { - if (! sunos_read_dynamic_info (abfd)) - return false; - } - - info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd); - if (! info->valid) - { - bfd_set_error (bfd_error_no_symbols); - return false; - } - - /* Get the dynamic nlist structures. */ - if (info->dynsym == (struct external_nlist *) NULL) - { - info->dynsym = ((struct external_nlist *) - bfd_alloc (abfd, - (info->dynsym_count - * EXTERNAL_NLIST_SIZE))); - if (info->dynsym == NULL && info->dynsym_count != 0) - return false; - if (bfd_seek (abfd, info->dyninfo.ld_stab, SEEK_SET) != 0 - || (bfd_read ((PTR) info->dynsym, info->dynsym_count, - EXTERNAL_NLIST_SIZE, abfd) - != info->dynsym_count * EXTERNAL_NLIST_SIZE)) - { - if (info->dynsym != NULL) - { - bfd_release (abfd, info->dynsym); - info->dynsym = NULL; - } - return false; - } - } - - /* Get the dynamic strings. */ - if (info->dynstr == (char *) NULL) - { - info->dynstr = (char *) bfd_alloc (abfd, info->dyninfo.ld_symb_size); - if (info->dynstr == NULL && info->dyninfo.ld_symb_size != 0) - return false; - if (bfd_seek (abfd, info->dyninfo.ld_symbols, SEEK_SET) != 0 - || (bfd_read ((PTR) info->dynstr, 1, info->dyninfo.ld_symb_size, - abfd) - != info->dyninfo.ld_symb_size)) - { - if (info->dynstr != NULL) - { - bfd_release (abfd, info->dynstr); - info->dynstr = NULL; - } - return false; - } - } - - return true; -} - -/* Read in the dynamic symbols. */ - -static long -sunos_canonicalize_dynamic_symtab (abfd, storage) - bfd *abfd; - asymbol **storage; -{ - struct sunos_dynamic_info *info; - unsigned long i; - - if (! sunos_slurp_dynamic_symtab (abfd)) - return -1; - - info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd); - -#ifdef CHECK_DYNAMIC_HASH - /* Check my understanding of the dynamic hash table by making sure - that each symbol can be located in the hash table. */ - { - bfd_size_type table_size; - bfd_byte *table; - bfd_size_type i; - - if (info->dyninfo.ld_buckets > info->dynsym_count) - abort (); - table_size = info->dyninfo.ld_stab - info->dyninfo.ld_hash; - table = (bfd_byte *) bfd_malloc (table_size); - if (table == NULL && table_size != 0) - abort (); - if (bfd_seek (abfd, info->dyninfo.ld_hash, SEEK_SET) != 0 - || bfd_read ((PTR) table, 1, table_size, abfd) != table_size) - abort (); - for (i = 0; i < info->dynsym_count; i++) - { - unsigned char *name; - unsigned long hash; - - name = ((unsigned char *) info->dynstr - + GET_WORD (abfd, info->dynsym[i].e_strx)); - hash = 0; - while (*name != '\0') - hash = (hash << 1) + *name++; - hash &= 0x7fffffff; - hash %= info->dyninfo.ld_buckets; - while (GET_WORD (abfd, table + hash * HASH_ENTRY_SIZE) != i) - { - hash = GET_WORD (abfd, - table + hash * HASH_ENTRY_SIZE + BYTES_IN_WORD); - if (hash == 0 || hash >= table_size / HASH_ENTRY_SIZE) - abort (); - } - } - free (table); - } -#endif /* CHECK_DYNAMIC_HASH */ - - /* Get the asymbol structures corresponding to the dynamic nlist - structures. */ - if (info->canonical_dynsym == (aout_symbol_type *) NULL) - { - info->canonical_dynsym = ((aout_symbol_type *) - bfd_alloc (abfd, - (info->dynsym_count - * sizeof (aout_symbol_type)))); - if (info->canonical_dynsym == NULL && info->dynsym_count != 0) - return -1; - - if (! aout_32_translate_symbol_table (abfd, info->canonical_dynsym, - info->dynsym, info->dynsym_count, - info->dynstr, - info->dyninfo.ld_symb_size, - true)) - { - if (info->canonical_dynsym != NULL) - { - bfd_release (abfd, info->canonical_dynsym); - info->canonical_dynsym = NULL; - } - return -1; - } - } - - /* Return pointers to the dynamic asymbol structures. */ - for (i = 0; i < info->dynsym_count; i++) - *storage++ = (asymbol *) (info->canonical_dynsym + i); - *storage = NULL; - - return info->dynsym_count; -} - -/* Return the amount of memory required for the dynamic relocs. */ - -static long -sunos_get_dynamic_reloc_upper_bound (abfd) - bfd *abfd; -{ - struct sunos_dynamic_info *info; - - if (! sunos_read_dynamic_info (abfd)) - return -1; - - info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd); - if (! info->valid) - { - bfd_set_error (bfd_error_no_symbols); - return -1; - } - - return (info->dynrel_count + 1) * sizeof (arelent *); -} - -/* Read in the dynamic relocs. */ - -static long -sunos_canonicalize_dynamic_reloc (abfd, storage, syms) - bfd *abfd; - arelent **storage; - asymbol **syms; -{ - struct sunos_dynamic_info *info; - unsigned long i; - - /* Get the general dynamic information. */ - if (obj_aout_dynamic_info (abfd) == (PTR) NULL) - { - if (! sunos_read_dynamic_info (abfd)) - return -1; - } - - info = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd); - if (! info->valid) - { - bfd_set_error (bfd_error_no_symbols); - return -1; - } - - /* Get the dynamic reloc information. */ - if (info->dynrel == NULL) - { - info->dynrel = (PTR) bfd_alloc (abfd, - (info->dynrel_count - * obj_reloc_entry_size (abfd))); - if (info->dynrel == NULL && info->dynrel_count != 0) - return -1; - if (bfd_seek (abfd, info->dyninfo.ld_rel, SEEK_SET) != 0 - || (bfd_read ((PTR) info->dynrel, info->dynrel_count, - obj_reloc_entry_size (abfd), abfd) - != info->dynrel_count * obj_reloc_entry_size (abfd))) - { - if (info->dynrel != NULL) - { - bfd_release (abfd, info->dynrel); - info->dynrel = NULL; - } - return -1; - } - } - - /* Get the arelent structures corresponding to the dynamic reloc - information. */ - if (info->canonical_dynrel == (arelent *) NULL) - { - arelent *to; - - info->canonical_dynrel = ((arelent *) - bfd_alloc (abfd, - (info->dynrel_count - * sizeof (arelent)))); - if (info->canonical_dynrel == NULL && info->dynrel_count != 0) - return -1; - - to = info->canonical_dynrel; - - if (obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE) - { - register struct reloc_ext_external *p; - struct reloc_ext_external *pend; - - p = (struct reloc_ext_external *) info->dynrel; - pend = p + info->dynrel_count; - for (; p < pend; p++, to++) - NAME(aout,swap_ext_reloc_in) (abfd, p, to, syms, - info->dynsym_count); - } - else - { - register struct reloc_std_external *p; - struct reloc_std_external *pend; - - p = (struct reloc_std_external *) info->dynrel; - pend = p + info->dynrel_count; - for (; p < pend; p++, to++) - NAME(aout,swap_std_reloc_in) (abfd, p, to, syms, - info->dynsym_count); - } - } - - /* Return pointers to the dynamic arelent structures. */ - for (i = 0; i < info->dynrel_count; i++) - *storage++ = info->canonical_dynrel + i; - *storage = NULL; - - return info->dynrel_count; -} - -/* Code to handle linking of SunOS shared libraries. */ - -/* A SPARC procedure linkage table entry is 12 bytes. The first entry - in the table is a jump which is filled in by the runtime linker. - The remaining entries are branches back to the first entry, - followed by an index into the relocation table encoded to look like - a sethi of %g0. */ - -#define SPARC_PLT_ENTRY_SIZE (12) - -static const bfd_byte sparc_plt_first_entry[SPARC_PLT_ENTRY_SIZE] = -{ - /* sethi %hi(0),%g1; address filled in by runtime linker. */ - 0x3, 0, 0, 0, - /* jmp %g1; offset filled in by runtime linker. */ - 0x81, 0xc0, 0x60, 0, - /* nop */ - 0x1, 0, 0, 0 -}; - -/* save %sp, -96, %sp */ -#define SPARC_PLT_ENTRY_WORD0 0x9de3bfa0 -/* call; address filled in later. */ -#define SPARC_PLT_ENTRY_WORD1 0x40000000 -/* sethi; reloc index filled in later. */ -#define SPARC_PLT_ENTRY_WORD2 0x01000000 - -/* This sequence is used when for the jump table entry to a defined - symbol in a complete executable. It is used when linking PIC - compiled code which is not being put into a shared library. */ -/* sethi <address to be filled in later>, %g1 */ -#define SPARC_PLT_PIC_WORD0 0x03000000 -/* jmp %g1 + <address to be filled in later> */ -#define SPARC_PLT_PIC_WORD1 0x81c06000 -/* nop */ -#define SPARC_PLT_PIC_WORD2 0x01000000 - -/* An m68k procedure linkage table entry is 8 bytes. The first entry - in the table is a jump which is filled in the by the runtime - linker. The remaining entries are branches back to the first - entry, followed by a two byte index into the relocation table. */ - -#define M68K_PLT_ENTRY_SIZE (8) - -static const bfd_byte m68k_plt_first_entry[M68K_PLT_ENTRY_SIZE] = -{ - /* jmps @# */ - 0x4e, 0xf9, - /* Filled in by runtime linker with a magic address. */ - 0, 0, 0, 0, - /* Not used? */ - 0, 0 -}; - -/* bsrl */ -#define M68K_PLT_ENTRY_WORD0 (0x61ff) -/* Remaining words filled in later. */ - -/* An entry in the SunOS linker hash table. */ - -struct sunos_link_hash_entry -{ - struct aout_link_hash_entry root; - - /* If this is a dynamic symbol, this is its index into the dynamic - symbol table. This is initialized to -1. As the linker looks at - the input files, it changes this to -2 if it will be added to the - dynamic symbol table. After all the input files have been seen, - the linker will know whether to build a dynamic symbol table; if - it does build one, this becomes the index into the table. */ - long dynindx; - - /* If this is a dynamic symbol, this is the index of the name in the - dynamic symbol string table. */ - long dynstr_index; - - /* The offset into the global offset table used for this symbol. If - the symbol does not require a GOT entry, this is 0. */ - bfd_vma got_offset; - - /* The offset into the procedure linkage table used for this symbol. - If the symbol does not require a PLT entry, this is 0. */ - bfd_vma plt_offset; - - /* Some linker flags. */ - unsigned char flags; - /* Symbol is referenced by a regular object. */ -#define SUNOS_REF_REGULAR 01 - /* Symbol is defined by a regular object. */ -#define SUNOS_DEF_REGULAR 02 - /* Symbol is referenced by a dynamic object. */ -#define SUNOS_REF_DYNAMIC 04 - /* Symbol is defined by a dynamic object. */ -#define SUNOS_DEF_DYNAMIC 010 - /* Symbol is a constructor symbol in a regular object. */ -#define SUNOS_CONSTRUCTOR 020 -}; - -/* The SunOS linker hash table. */ - -struct sunos_link_hash_table -{ - struct aout_link_hash_table root; - - /* The object which holds the dynamic sections. */ - bfd *dynobj; - - /* Whether we have created the dynamic sections. */ - boolean dynamic_sections_created; - - /* Whether we need the dynamic sections. */ - boolean dynamic_sections_needed; - - /* Whether we need the .got table. */ - boolean got_needed; - - /* The number of dynamic symbols. */ - size_t dynsymcount; - - /* The number of buckets in the hash table. */ - size_t bucketcount; - - /* The list of dynamic objects needed by dynamic objects included in - the link. */ - struct bfd_link_needed_list *needed; - - /* The offset of __GLOBAL_OFFSET_TABLE_ into the .got section. */ - bfd_vma got_base; -}; - -/* Routine to create an entry in an SunOS link hash table. */ - -static struct bfd_hash_entry * -sunos_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct sunos_link_hash_entry *ret = (struct sunos_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct sunos_link_hash_entry *) NULL) - ret = ((struct sunos_link_hash_entry *) - bfd_hash_allocate (table, sizeof (struct sunos_link_hash_entry))); - if (ret == (struct sunos_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; - - /* Call the allocation method of the superclass. */ - ret = ((struct sunos_link_hash_entry *) - NAME(aout,link_hash_newfunc) ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != NULL) - { - /* Set local fields. */ - ret->dynindx = -1; - ret->dynstr_index = -1; - ret->got_offset = 0; - ret->plt_offset = 0; - ret->flags = 0; - } - - return (struct bfd_hash_entry *) ret; -} - -/* Create a SunOS link hash table. */ - -static struct bfd_link_hash_table * -sunos_link_hash_table_create (abfd) - bfd *abfd; -{ - struct sunos_link_hash_table *ret; - - ret = ((struct sunos_link_hash_table *) - bfd_alloc (abfd, sizeof (struct sunos_link_hash_table))); - if (ret == (struct sunos_link_hash_table *) NULL) - return (struct bfd_link_hash_table *) NULL; - if (! NAME(aout,link_hash_table_init) (&ret->root, abfd, - sunos_link_hash_newfunc)) - { - bfd_release (abfd, ret); - return (struct bfd_link_hash_table *) NULL; - } - - ret->dynobj = NULL; - ret->dynamic_sections_created = false; - ret->dynamic_sections_needed = false; - ret->got_needed = false; - ret->dynsymcount = 0; - ret->bucketcount = 0; - ret->needed = NULL; - ret->got_base = 0; - - return &ret->root.root; -} - -/* Look up an entry in an SunOS link hash table. */ - -#define sunos_link_hash_lookup(table, string, create, copy, follow) \ - ((struct sunos_link_hash_entry *) \ - aout_link_hash_lookup (&(table)->root, (string), (create), (copy),\ - (follow))) - -/* Traverse a SunOS link hash table. */ - -#define sunos_link_hash_traverse(table, func, info) \ - (aout_link_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \ - (info))) - -/* Get the SunOS link hash table from the info structure. This is - just a cast. */ - -#define sunos_hash_table(p) ((struct sunos_link_hash_table *) ((p)->hash)) - -static boolean sunos_scan_dynamic_symbol - PARAMS ((struct sunos_link_hash_entry *, PTR)); - -/* Create the dynamic sections needed if we are linking against a - dynamic object, or if we are linking PIC compiled code. ABFD is a - bfd we can attach the dynamic sections to. The linker script will - look for these special sections names and put them in the right - place in the output file. See include/aout/sun4.h for more details - of the dynamic linking information. */ - -static boolean -sunos_create_dynamic_sections (abfd, info, needed) - bfd *abfd; - struct bfd_link_info *info; - boolean needed; -{ - asection *s; - - if (! sunos_hash_table (info)->dynamic_sections_created) - { - flagword flags; - - sunos_hash_table (info)->dynobj = abfd; - - flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED); - - /* The .dynamic section holds the basic dynamic information: the - sun4_dynamic structure, the dynamic debugger information, and - the sun4_dynamic_link structure. */ - s = bfd_make_section (abfd, ".dynamic"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) - || ! bfd_set_section_alignment (abfd, s, 2)) - return false; - - /* The .got section holds the global offset table. The address - is put in the ld_got field. */ - s = bfd_make_section (abfd, ".got"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) - || ! bfd_set_section_alignment (abfd, s, 2)) - return false; - - /* The .plt section holds the procedure linkage table. The - address is put in the ld_plt field. */ - s = bfd_make_section (abfd, ".plt"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_CODE) - || ! bfd_set_section_alignment (abfd, s, 2)) - return false; - - /* The .dynrel section holds the dynamic relocs. The address is - put in the ld_rel field. */ - s = bfd_make_section (abfd, ".dynrel"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, 2)) - return false; - - /* The .hash section holds the dynamic hash table. The address - is put in the ld_hash field. */ - s = bfd_make_section (abfd, ".hash"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, 2)) - return false; - - /* The .dynsym section holds the dynamic symbols. The address - is put in the ld_stab field. */ - s = bfd_make_section (abfd, ".dynsym"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, 2)) - return false; - - /* The .dynstr section holds the dynamic symbol string table. - The address is put in the ld_symbols field. */ - s = bfd_make_section (abfd, ".dynstr"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, 2)) - return false; - - sunos_hash_table (info)->dynamic_sections_created = true; - } - - if ((needed && ! sunos_hash_table (info)->dynamic_sections_needed) - || info->shared) - { - bfd *dynobj; - - dynobj = sunos_hash_table (info)->dynobj; - - s = bfd_get_section_by_name (dynobj, ".got"); - if (s->_raw_size == 0) - s->_raw_size = BYTES_IN_WORD; - - sunos_hash_table (info)->dynamic_sections_needed = true; - sunos_hash_table (info)->got_needed = true; - } - - return true; -} - -/* Add dynamic symbols during a link. This is called by the a.out - backend linker for each object it encounters. */ - -static boolean -sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp) - bfd *abfd; - struct bfd_link_info *info; - struct external_nlist **symsp; - bfd_size_type *sym_countp; - char **stringsp; -{ - asection *s; - bfd *dynobj; - struct sunos_dynamic_info *dinfo; - unsigned long need; - - /* Make sure we have all the required sections. */ - if (info->hash->creator == abfd->xvec) - { - if (! sunos_create_dynamic_sections (abfd, info, - (((abfd->flags & DYNAMIC) != 0 - && ! info->relocateable) - ? true - : false))) - return false; - } - - /* There is nothing else to do for a normal object. */ - if ((abfd->flags & DYNAMIC) == 0) - return true; - - dynobj = sunos_hash_table (info)->dynobj; - - /* We do not want to include the sections in a dynamic object in the - output file. We hack by simply clobbering the list of sections - in the BFD. This could be handled more cleanly by, say, a new - section flag; the existing SEC_NEVER_LOAD flag is not the one we - want, because that one still implies that the section takes up - space in the output file. If this is the first object we have - seen, we must preserve the dynamic sections we just created. */ - if (abfd != dynobj) - abfd->sections = NULL; - else - { - asection *s; - - for (s = abfd->sections; - (s->flags & SEC_LINKER_CREATED) == 0; - s = s->next) - ; - abfd->sections = s; - } - - /* The native linker seems to just ignore dynamic objects when -r is - used. */ - if (info->relocateable) - return true; - - /* There's no hope of using a dynamic object which does not exactly - match the format of the output file. */ - if (info->hash->creator != abfd->xvec) - { - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - /* Make sure we have a .need and a .rules sections. These are only - needed if there really is a dynamic object in the link, so they - are not added by sunos_create_dynamic_sections. */ - if (bfd_get_section_by_name (dynobj, ".need") == NULL) - { - /* The .need section holds the list of names of shared objets - which must be included at runtime. The address of this - section is put in the ld_need field. */ - s = bfd_make_section (dynobj, ".need"); - if (s == NULL - || ! bfd_set_section_flags (dynobj, s, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_READONLY)) - || ! bfd_set_section_alignment (dynobj, s, 2)) - return false; - } - - if (bfd_get_section_by_name (dynobj, ".rules") == NULL) - { - /* The .rules section holds the path to search for shared - objects. The address of this section is put in the ld_rules - field. */ - s = bfd_make_section (dynobj, ".rules"); - if (s == NULL - || ! bfd_set_section_flags (dynobj, s, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_READONLY)) - || ! bfd_set_section_alignment (dynobj, s, 2)) - return false; - } - - /* Pick up the dynamic symbols and return them to the caller. */ - if (! sunos_slurp_dynamic_symtab (abfd)) - return false; - - dinfo = (struct sunos_dynamic_info *) obj_aout_dynamic_info (abfd); - *symsp = dinfo->dynsym; - *sym_countp = dinfo->dynsym_count; - *stringsp = dinfo->dynstr; - - /* Record information about any other objects needed by this one. */ - need = dinfo->dyninfo.ld_need; - while (need != 0) - { - bfd_byte buf[16]; - unsigned long name, flags; - unsigned short major_vno, minor_vno; - struct bfd_link_needed_list *needed, **pp; - char *namebuf, *p; - size_t alc; - bfd_byte b; - char *namecopy; - - if (bfd_seek (abfd, need, SEEK_SET) != 0 - || bfd_read (buf, 1, 16, abfd) != 16) - return false; - - /* For the format of an ld_need entry, see aout/sun4.h. We - should probably define structs for this manipulation. */ - - name = bfd_get_32 (abfd, buf); - flags = bfd_get_32 (abfd, buf + 4); - major_vno = (unsigned short)bfd_get_16 (abfd, buf + 8); - minor_vno = (unsigned short)bfd_get_16 (abfd, buf + 10); - need = bfd_get_32 (abfd, buf + 12); - - needed = ((struct bfd_link_needed_list *) - bfd_alloc (abfd, sizeof (struct bfd_link_needed_list))); - if (needed == NULL) - return false; - needed->by = abfd; - - /* We return the name as [-l]name[.maj][.min]. */ - alc = 30; - namebuf = (char *) bfd_malloc (alc + 1); - if (namebuf == NULL) - return false; - p = namebuf; - - if ((flags & 0x80000000) != 0) - { - *p++ = '-'; - *p++ = 'l'; - } - if (bfd_seek (abfd, name, SEEK_SET) != 0) - { - free (namebuf); - return false; - } - - do - { - if (bfd_read (&b, 1, 1, abfd) != 1) - { - free (namebuf); - return false; - } - - if ((size_t) (p - namebuf) >= alc) - { - char *n; - - alc *= 2; - n = (char *) bfd_realloc (namebuf, alc + 1); - if (n == NULL) - { - free (namebuf); - return false; - } - p = n + (p - namebuf); - namebuf = n; - } - - *p++ = b; - } - while (b != '\0'); - - if (major_vno == 0) - *p = '\0'; - else - { - char majbuf[30]; - char minbuf[30]; - - sprintf (majbuf, ".%d", major_vno); - if (minor_vno == 0) - minbuf[0] = '\0'; - else - sprintf (minbuf, ".%d", minor_vno); - - if ((p - namebuf) + strlen (majbuf) + strlen (minbuf) >= alc) - { - char *n; - - alc = (p - namebuf) + strlen (majbuf) + strlen (minbuf); - n = (char *) bfd_realloc (namebuf, alc + 1); - if (n == NULL) - { - free (namebuf); - return false; - } - p = n + (p - namebuf); - namebuf = n; - } - - strcpy (p, majbuf); - strcat (p, minbuf); - } - - namecopy = bfd_alloc (abfd, strlen (namebuf) + 1); - if (namecopy == NULL) - { - free (namebuf); - return false; - } - strcpy (namecopy, namebuf); - free (namebuf); - needed->name = namecopy; - - needed->next = NULL; - - for (pp = &sunos_hash_table (info)->needed; - *pp != NULL; - pp = &(*pp)->next) - ; - *pp = needed; - } - - return true; -} - -/* Function to add a single symbol to the linker hash table. This is - a wrapper around _bfd_generic_link_add_one_symbol which handles the - tweaking needed for dynamic linking support. */ - -static boolean -sunos_add_one_symbol (info, abfd, name, flags, section, value, string, - copy, collect, hashp) - struct bfd_link_info *info; - bfd *abfd; - const char *name; - flagword flags; - asection *section; - bfd_vma value; - const char *string; - boolean copy; - boolean collect; - struct bfd_link_hash_entry **hashp; -{ - struct sunos_link_hash_entry *h; - int new_flag; - - if ((flags & (BSF_INDIRECT | BSF_WARNING | BSF_CONSTRUCTOR)) != 0 - || ! bfd_is_und_section (section)) - h = sunos_link_hash_lookup (sunos_hash_table (info), name, true, copy, - false); - else - h = ((struct sunos_link_hash_entry *) - bfd_wrapped_link_hash_lookup (abfd, info, name, true, copy, false)); - if (h == NULL) - return false; - - if (hashp != NULL) - *hashp = (struct bfd_link_hash_entry *) h; - - /* Treat a common symbol in a dynamic object as defined in the .bss - section of the dynamic object. We don't want to allocate space - for it in our process image. */ - if ((abfd->flags & DYNAMIC) != 0 - && bfd_is_com_section (section)) - section = obj_bsssec (abfd); - - if (! bfd_is_und_section (section) - && h->root.root.type != bfd_link_hash_new - && h->root.root.type != bfd_link_hash_undefined - && h->root.root.type != bfd_link_hash_defweak) - { - /* We are defining the symbol, and it is already defined. This - is a potential multiple definition error. */ - if ((abfd->flags & DYNAMIC) != 0) - { - /* The definition we are adding is from a dynamic object. - We do not want this new definition to override the - existing definition, so we pretend it is just a - reference. */ - section = bfd_und_section_ptr; - } - else if (h->root.root.type == bfd_link_hash_defined - && h->root.root.u.def.section->owner != NULL - && (h->root.root.u.def.section->owner->flags & DYNAMIC) != 0) - { - /* The existing definition is from a dynamic object. We - want to override it with the definition we just found. - Clobber the existing definition. */ - h->root.root.type = bfd_link_hash_undefined; - h->root.root.u.undef.abfd = h->root.root.u.def.section->owner; - } - else if (h->root.root.type == bfd_link_hash_common - && (h->root.root.u.c.p->section->owner->flags & DYNAMIC) != 0) - { - /* The existing definition is from a dynamic object. We - want to override it with the definition we just found. - Clobber the existing definition. We can't set it to new, - because it is on the undefined list. */ - h->root.root.type = bfd_link_hash_undefined; - h->root.root.u.undef.abfd = h->root.root.u.c.p->section->owner; - } - } - - if ((abfd->flags & DYNAMIC) != 0 - && abfd->xvec == info->hash->creator - && (h->flags & SUNOS_CONSTRUCTOR) != 0) - { - /* The existing symbol is a constructor symbol, and this symbol - is from a dynamic object. A constructor symbol is actually a - definition, although the type will be bfd_link_hash_undefined - at this point. We want to ignore the definition from the - dynamic object. */ - section = bfd_und_section_ptr; - } - else if ((flags & BSF_CONSTRUCTOR) != 0 - && (abfd->flags & DYNAMIC) == 0 - && h->root.root.type == bfd_link_hash_defined - && h->root.root.u.def.section->owner != NULL - && (h->root.root.u.def.section->owner->flags & DYNAMIC) != 0) - { - /* The existing symbol is defined by a dynamic object, and this - is a constructor symbol. As above, we want to force the use - of the constructor symbol from the regular object. */ - h->root.root.type = bfd_link_hash_new; - } - - /* Do the usual procedure for adding a symbol. */ - if (! _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, - value, string, copy, collect, - hashp)) - return false; - - if (abfd->xvec == info->hash->creator) - { - /* Set a flag in the hash table entry indicating the type of - reference or definition we just found. Keep a count of the - number of dynamic symbols we find. A dynamic symbol is one - which is referenced or defined by both a regular object and a - shared object. */ - if ((abfd->flags & DYNAMIC) == 0) - { - if (bfd_is_und_section (section)) - new_flag = SUNOS_REF_REGULAR; - else - new_flag = SUNOS_DEF_REGULAR; - } - else - { - if (bfd_is_und_section (section)) - new_flag = SUNOS_REF_DYNAMIC; - else - new_flag = SUNOS_DEF_DYNAMIC; - } - h->flags |= new_flag; - - if (h->dynindx == -1 - && (h->flags & (SUNOS_DEF_REGULAR | SUNOS_REF_REGULAR)) != 0) - { - ++sunos_hash_table (info)->dynsymcount; - h->dynindx = -2; - } - - if ((flags & BSF_CONSTRUCTOR) != 0 - && (abfd->flags & DYNAMIC) == 0) - h->flags |= SUNOS_CONSTRUCTOR; - } - - return true; -} - -/* Return the list of objects needed by BFD. */ - -/*ARGSUSED*/ -struct bfd_link_needed_list * -bfd_sunos_get_needed_list (abfd, info) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info; -{ - if (info->hash->creator != &MY(vec)) - return NULL; - return sunos_hash_table (info)->needed; -} - -/* Record an assignment made to a symbol by a linker script. We need - this in case some dynamic object refers to this symbol. */ - -boolean -bfd_sunos_record_link_assignment (output_bfd, info, name) - bfd *output_bfd; - struct bfd_link_info *info; - const char *name; -{ - struct sunos_link_hash_entry *h; - - if (output_bfd->xvec != &MY(vec)) - return true; - - /* This is called after we have examined all the input objects. If - the symbol does not exist, it merely means that no object refers - to it, and we can just ignore it at this point. */ - h = sunos_link_hash_lookup (sunos_hash_table (info), name, - false, false, false); - if (h == NULL) - return true; - - /* In a shared library, the __DYNAMIC symbol does not appear in the - dynamic symbol table. */ - if (! info->shared || strcmp (name, "__DYNAMIC") != 0) - { - h->flags |= SUNOS_DEF_REGULAR; - - if (h->dynindx == -1) - { - ++sunos_hash_table (info)->dynsymcount; - h->dynindx = -2; - } - } - - return true; -} - -/* Set up the sizes and contents of the dynamic sections created in - sunos_add_dynamic_symbols. This is called by the SunOS linker - emulation before_allocation routine. We must set the sizes of the - sections before the linker sets the addresses of the various - sections. This unfortunately requires reading all the relocs so - that we can work out which ones need to become dynamic relocs. If - info->keep_memory is true, we keep the relocs in memory; otherwise, - we discard them, and will read them again later. */ - -boolean -bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr, - srulesptr) - bfd *output_bfd; - struct bfd_link_info *info; - asection **sdynptr; - asection **sneedptr; - asection **srulesptr; -{ - bfd *dynobj; - size_t dynsymcount; - struct sunos_link_hash_entry *h; - asection *s; - size_t bucketcount; - size_t hashalloc; - size_t i; - bfd *sub; - - *sdynptr = NULL; - *sneedptr = NULL; - *srulesptr = NULL; - - if (info->relocateable) - return true; - - if (output_bfd->xvec != &MY(vec)) - return true; - - /* Look through all the input BFD's and read their relocs. It would - be better if we didn't have to do this, but there is no other way - to determine the number of dynamic relocs we need, and, more - importantly, there is no other way to know which symbols should - get an entry in the procedure linkage table. */ - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - { - if ((sub->flags & DYNAMIC) == 0 - && sub->xvec == output_bfd->xvec) - { - if (! sunos_scan_relocs (info, sub, obj_textsec (sub), - exec_hdr (sub)->a_trsize) - || ! sunos_scan_relocs (info, sub, obj_datasec (sub), - exec_hdr (sub)->a_drsize)) - return false; - } - } - - dynobj = sunos_hash_table (info)->dynobj; - dynsymcount = sunos_hash_table (info)->dynsymcount; - - /* If there were no dynamic objects in the link, and we don't need - to build a global offset table, there is nothing to do here. */ - if (! sunos_hash_table (info)->dynamic_sections_needed - && ! sunos_hash_table (info)->got_needed) - return true; - - /* If __GLOBAL_OFFSET_TABLE_ was mentioned, define it. */ - h = sunos_link_hash_lookup (sunos_hash_table (info), - "__GLOBAL_OFFSET_TABLE_", false, false, false); - if (h != NULL && (h->flags & SUNOS_REF_REGULAR) != 0) - { - h->flags |= SUNOS_DEF_REGULAR; - if (h->dynindx == -1) - { - ++sunos_hash_table (info)->dynsymcount; - h->dynindx = -2; - } - h->root.root.type = bfd_link_hash_defined; - h->root.root.u.def.section = bfd_get_section_by_name (dynobj, ".got"); - - /* If the .got section is more than 0x1000 bytes, we set - __GLOBAL_OFFSET_TABLE_ to be 0x1000 bytes into the section, - so that 13 bit relocations have a greater chance of working. */ - s = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (s != NULL); - if (s->_raw_size >= 0x1000) - h->root.root.u.def.value = 0x1000; - else - h->root.root.u.def.value = 0; - - sunos_hash_table (info)->got_base = h->root.root.u.def.value; - } - - /* If there are any shared objects in the link, then we need to set - up the dynamic linking information. */ - if (sunos_hash_table (info)->dynamic_sections_needed) - { - *sdynptr = bfd_get_section_by_name (dynobj, ".dynamic"); - - /* The .dynamic section is always the same size. */ - s = *sdynptr; - BFD_ASSERT (s != NULL); - s->_raw_size = (sizeof (struct external_sun4_dynamic) - + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE - + sizeof (struct external_sun4_dynamic_link)); - - /* Set the size of the .dynsym and .hash sections. We counted - the number of dynamic symbols as we read the input files. We - will build the dynamic symbol table (.dynsym) and the hash - table (.hash) when we build the final symbol table, because - until then we do not know the correct value to give the - symbols. We build the dynamic symbol string table (.dynstr) - in a traversal of the symbol table using - sunos_scan_dynamic_symbol. */ - s = bfd_get_section_by_name (dynobj, ".dynsym"); - BFD_ASSERT (s != NULL); - s->_raw_size = dynsymcount * sizeof (struct external_nlist); - s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - return false; - - /* The number of buckets is just the number of symbols divided - by four. To compute the final size of the hash table, we - must actually compute the hash table. Normally we need - exactly as many entries in the hash table as there are - dynamic symbols, but if some of the buckets are not used we - will need additional entries. In the worst case, every - symbol will hash to the same bucket, and we will need - BUCKETCOUNT - 1 extra entries. */ - if (dynsymcount >= 4) - bucketcount = dynsymcount / 4; - else if (dynsymcount > 0) - bucketcount = dynsymcount; - else - bucketcount = 1; - s = bfd_get_section_by_name (dynobj, ".hash"); - BFD_ASSERT (s != NULL); - hashalloc = (dynsymcount + bucketcount - 1) * HASH_ENTRY_SIZE; - s->contents = (bfd_byte *) bfd_alloc (dynobj, hashalloc); - if (s->contents == NULL && dynsymcount > 0) - return false; - memset (s->contents, 0, hashalloc); - for (i = 0; i < bucketcount; i++) - PUT_WORD (output_bfd, (bfd_vma) -1, s->contents + i * HASH_ENTRY_SIZE); - s->_raw_size = bucketcount * HASH_ENTRY_SIZE; - - sunos_hash_table (info)->bucketcount = bucketcount; - - /* Scan all the symbols, place them in the dynamic symbol table, - and build the dynamic hash table. We reuse dynsymcount as a - counter for the number of symbols we have added so far. */ - sunos_hash_table (info)->dynsymcount = 0; - sunos_link_hash_traverse (sunos_hash_table (info), - sunos_scan_dynamic_symbol, - (PTR) info); - BFD_ASSERT (sunos_hash_table (info)->dynsymcount == dynsymcount); - - /* The SunOS native linker seems to align the total size of the - symbol strings to a multiple of 8. I don't know if this is - important, but it can't hurt much. */ - s = bfd_get_section_by_name (dynobj, ".dynstr"); - BFD_ASSERT (s != NULL); - if ((s->_raw_size & 7) != 0) - { - bfd_size_type add; - bfd_byte *contents; - - add = 8 - (s->_raw_size & 7); - contents = (bfd_byte *) bfd_realloc (s->contents, - (size_t) (s->_raw_size + add)); - if (contents == NULL) - return false; - memset (contents + s->_raw_size, 0, (size_t) add); - s->contents = contents; - s->_raw_size += add; - } - } - - /* Now that we have worked out the sizes of the procedure linkage - table and the dynamic relocs, allocate storage for them. */ - s = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (s != NULL); - if (s->_raw_size != 0) - { - s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size); - if (s->contents == NULL) - return false; - - /* Fill in the first entry in the table. */ - switch (bfd_get_arch (dynobj)) - { - case bfd_arch_sparc: - memcpy (s->contents, sparc_plt_first_entry, SPARC_PLT_ENTRY_SIZE); - break; - - case bfd_arch_m68k: - memcpy (s->contents, m68k_plt_first_entry, M68K_PLT_ENTRY_SIZE); - break; - - default: - abort (); - } - } - - s = bfd_get_section_by_name (dynobj, ".dynrel"); - if (s->_raw_size != 0) - { - s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size); - if (s->contents == NULL) - return false; - } - /* We use the reloc_count field to keep track of how many of the - relocs we have output so far. */ - s->reloc_count = 0; - - /* Make space for the global offset table. */ - s = bfd_get_section_by_name (dynobj, ".got"); - s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size); - if (s->contents == NULL) - return false; - - *sneedptr = bfd_get_section_by_name (dynobj, ".need"); - *srulesptr = bfd_get_section_by_name (dynobj, ".rules"); - - return true; -} - -/* Scan the relocs for an input section. */ - -static boolean -sunos_scan_relocs (info, abfd, sec, rel_size) - struct bfd_link_info *info; - bfd *abfd; - asection *sec; - bfd_size_type rel_size; -{ - PTR relocs; - PTR free_relocs = NULL; - - if (rel_size == 0) - return true; - - if (! info->keep_memory) - relocs = free_relocs = bfd_malloc ((size_t) rel_size); - else - { - struct aout_section_data_struct *n; - - n = ((struct aout_section_data_struct *) - bfd_alloc (abfd, sizeof (struct aout_section_data_struct))); - if (n == NULL) - relocs = NULL; - else - { - set_aout_section_data (sec, n); - relocs = bfd_malloc ((size_t) rel_size); - aout_section_data (sec)->relocs = relocs; - } - } - if (relocs == NULL) - return false; - - if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0 - || bfd_read (relocs, 1, rel_size, abfd) != rel_size) - goto error_return; - - if (obj_reloc_entry_size (abfd) == RELOC_STD_SIZE) - { - if (! sunos_scan_std_relocs (info, abfd, sec, - (struct reloc_std_external *) relocs, - rel_size)) - goto error_return; - } - else - { - if (! sunos_scan_ext_relocs (info, abfd, sec, - (struct reloc_ext_external *) relocs, - rel_size)) - goto error_return; - } - - if (free_relocs != NULL) - free (free_relocs); - - return true; - - error_return: - if (free_relocs != NULL) - free (free_relocs); - return false; -} - -/* Scan the relocs for an input section using standard relocs. We - need to figure out what to do for each reloc against a dynamic - symbol. If the symbol is in the .text section, an entry is made in - the procedure linkage table. Note that this will do the wrong - thing if the symbol is actually data; I don't think the Sun 3 - native linker handles this case correctly either. If the symbol is - not in the .text section, we must preserve the reloc as a dynamic - reloc. FIXME: We should also handle the PIC relocs here by - building global offset table entries. */ - -static boolean -sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size) - struct bfd_link_info *info; - bfd *abfd; - asection *sec ATTRIBUTE_UNUSED; - const struct reloc_std_external *relocs; - bfd_size_type rel_size; -{ - bfd *dynobj; - asection *splt = NULL; - asection *srel = NULL; - struct sunos_link_hash_entry **sym_hashes; - const struct reloc_std_external *rel, *relend; - - /* We only know how to handle m68k plt entries. */ - if (bfd_get_arch (abfd) != bfd_arch_m68k) - { - bfd_set_error (bfd_error_invalid_target); - return false; - } - - dynobj = NULL; - - sym_hashes = (struct sunos_link_hash_entry **) obj_aout_sym_hashes (abfd); - - relend = relocs + rel_size / RELOC_STD_SIZE; - for (rel = relocs; rel < relend; rel++) - { - int r_index; - struct sunos_link_hash_entry *h; - - /* We only want relocs against external symbols. */ - if (bfd_header_big_endian (abfd)) - { - if ((rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG) == 0) - continue; - } - else - { - if ((rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE) == 0) - continue; - } - - /* Get the symbol index. */ - if (bfd_header_big_endian (abfd)) - r_index = ((rel->r_index[0] << 16) - | (rel->r_index[1] << 8) - | rel->r_index[2]); - else - r_index = ((rel->r_index[2] << 16) - | (rel->r_index[1] << 8) - | rel->r_index[0]); - - /* Get the hash table entry. */ - h = sym_hashes[r_index]; - if (h == NULL) - { - /* This should not normally happen, but it will in any case - be caught in the relocation phase. */ - continue; - } - - /* At this point common symbols have already been allocated, so - we don't have to worry about them. We need to consider that - we may have already seen this symbol and marked it undefined; - if the symbol is really undefined, then SUNOS_DEF_DYNAMIC - will be zero. */ - if (h->root.root.type != bfd_link_hash_defined - && h->root.root.type != bfd_link_hash_defweak - && h->root.root.type != bfd_link_hash_undefined) - continue; - - if ((h->flags & SUNOS_DEF_DYNAMIC) == 0 - || (h->flags & SUNOS_DEF_REGULAR) != 0) - continue; - - if (dynobj == NULL) - { - asection *sgot; - - if (! sunos_create_dynamic_sections (abfd, info, false)) - return false; - dynobj = sunos_hash_table (info)->dynobj; - splt = bfd_get_section_by_name (dynobj, ".plt"); - srel = bfd_get_section_by_name (dynobj, ".dynrel"); - BFD_ASSERT (splt != NULL && srel != NULL); - - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - if (sgot->_raw_size == 0) - sgot->_raw_size = BYTES_IN_WORD; - sunos_hash_table (info)->got_needed = true; - } - - BFD_ASSERT ((h->flags & SUNOS_REF_REGULAR) != 0); - BFD_ASSERT (h->plt_offset != 0 - || ((h->root.root.type == bfd_link_hash_defined - || h->root.root.type == bfd_link_hash_defweak) - ? (h->root.root.u.def.section->owner->flags - & DYNAMIC) != 0 - : (h->root.root.u.undef.abfd->flags & DYNAMIC) != 0)); - - /* This reloc is against a symbol defined only by a dynamic - object. */ - - if (h->root.root.type == bfd_link_hash_undefined) - { - /* Presumably this symbol was marked as being undefined by - an earlier reloc. */ - srel->_raw_size += RELOC_STD_SIZE; - } - else if ((h->root.root.u.def.section->flags & SEC_CODE) == 0) - { - bfd *sub; - - /* This reloc is not in the .text section. It must be - copied into the dynamic relocs. We mark the symbol as - being undefined. */ - srel->_raw_size += RELOC_STD_SIZE; - sub = h->root.root.u.def.section->owner; - h->root.root.type = bfd_link_hash_undefined; - h->root.root.u.undef.abfd = sub; - } - else - { - /* This symbol is in the .text section. We must give it an - entry in the procedure linkage table, if we have not - already done so. We change the definition of the symbol - to the .plt section; this will cause relocs against it to - be handled correctly. */ - if (h->plt_offset == 0) - { - if (splt->_raw_size == 0) - splt->_raw_size = M68K_PLT_ENTRY_SIZE; - h->plt_offset = splt->_raw_size; - - if ((h->flags & SUNOS_DEF_REGULAR) == 0) - { - h->root.root.u.def.section = splt; - h->root.root.u.def.value = splt->_raw_size; - } - - splt->_raw_size += M68K_PLT_ENTRY_SIZE; - - /* We may also need a dynamic reloc entry. */ - if ((h->flags & SUNOS_DEF_REGULAR) == 0) - srel->_raw_size += RELOC_STD_SIZE; - } - } - } - - return true; -} - -/* Scan the relocs for an input section using extended relocs. We - need to figure out what to do for each reloc against a dynamic - symbol. If the reloc is a WDISP30, and the symbol is in the .text - section, an entry is made in the procedure linkage table. - Otherwise, we must preserve the reloc as a dynamic reloc. */ - -static boolean -sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size) - struct bfd_link_info *info; - bfd *abfd; - asection *sec ATTRIBUTE_UNUSED; - const struct reloc_ext_external *relocs; - bfd_size_type rel_size; -{ - bfd *dynobj; - struct sunos_link_hash_entry **sym_hashes; - const struct reloc_ext_external *rel, *relend; - asection *splt = NULL; - asection *sgot = NULL; - asection *srel = NULL; - - /* We only know how to handle SPARC plt entries. */ - if (bfd_get_arch (abfd) != bfd_arch_sparc) - { - bfd_set_error (bfd_error_invalid_target); - return false; - } - - dynobj = NULL; - - sym_hashes = (struct sunos_link_hash_entry **) obj_aout_sym_hashes (abfd); - - relend = relocs + rel_size / RELOC_EXT_SIZE; - for (rel = relocs; rel < relend; rel++) - { - unsigned int r_index; - int r_extern; - int r_type; - struct sunos_link_hash_entry *h = NULL; - - /* Swap in the reloc information. */ - if (bfd_header_big_endian (abfd)) - { - r_index = ((rel->r_index[0] << 16) - | (rel->r_index[1] << 8) - | rel->r_index[2]); - r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG)); - r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_BIG) - >> RELOC_EXT_BITS_TYPE_SH_BIG); - } - else - { - r_index = ((rel->r_index[2] << 16) - | (rel->r_index[1] << 8) - | rel->r_index[0]); - r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE)); - r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE) - >> RELOC_EXT_BITS_TYPE_SH_LITTLE); - } - - if (r_extern) - { - h = sym_hashes[r_index]; - if (h == NULL) - { - /* This should not normally happen, but it will in any - case be caught in the relocation phase. */ - continue; - } - } - - /* If this is a base relative reloc, we need to make an entry in - the .got section. */ - if (r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22) - { - if (dynobj == NULL) - { - if (! sunos_create_dynamic_sections (abfd, info, false)) - return false; - dynobj = sunos_hash_table (info)->dynobj; - splt = bfd_get_section_by_name (dynobj, ".plt"); - sgot = bfd_get_section_by_name (dynobj, ".got"); - srel = bfd_get_section_by_name (dynobj, ".dynrel"); - BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL); - - /* Make sure we have an initial entry in the .got table. */ - if (sgot->_raw_size == 0) - sgot->_raw_size = BYTES_IN_WORD; - sunos_hash_table (info)->got_needed = true; - } - - if (r_extern) - { - if (h->got_offset != 0) - continue; - - h->got_offset = sgot->_raw_size; - } - else - { - if (r_index >= bfd_get_symcount (abfd)) - { - /* This is abnormal, but should be caught in the - relocation phase. */ - continue; - } - - if (adata (abfd).local_got_offsets == NULL) - { - adata (abfd).local_got_offsets = - (bfd_vma *) bfd_zalloc (abfd, - (bfd_get_symcount (abfd) - * sizeof (bfd_vma))); - if (adata (abfd).local_got_offsets == NULL) - return false; - } - - if (adata (abfd).local_got_offsets[r_index] != 0) - continue; - - adata (abfd).local_got_offsets[r_index] = sgot->_raw_size; - } - - sgot->_raw_size += BYTES_IN_WORD; - - /* If we are making a shared library, or if the symbol is - defined by a dynamic object, we will need a dynamic reloc - entry. */ - if (info->shared - || (h != NULL - && (h->flags & SUNOS_DEF_DYNAMIC) != 0 - && (h->flags & SUNOS_DEF_REGULAR) == 0)) - srel->_raw_size += RELOC_EXT_SIZE; - - continue; - } - - /* Otherwise, we are only interested in relocs against symbols - defined in dynamic objects but not in regular objects. We - only need to consider relocs against external symbols. */ - if (! r_extern) - { - /* But, if we are creating a shared library, we need to - generate an absolute reloc. */ - if (info->shared) - { - if (dynobj == NULL) - { - if (! sunos_create_dynamic_sections (abfd, info, true)) - return false; - dynobj = sunos_hash_table (info)->dynobj; - splt = bfd_get_section_by_name (dynobj, ".plt"); - sgot = bfd_get_section_by_name (dynobj, ".got"); - srel = bfd_get_section_by_name (dynobj, ".dynrel"); - BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL); - } - - srel->_raw_size += RELOC_EXT_SIZE; - } - - continue; - } - - /* At this point common symbols have already been allocated, so - we don't have to worry about them. We need to consider that - we may have already seen this symbol and marked it undefined; - if the symbol is really undefined, then SUNOS_DEF_DYNAMIC - will be zero. */ - if (h->root.root.type != bfd_link_hash_defined - && h->root.root.type != bfd_link_hash_defweak - && h->root.root.type != bfd_link_hash_undefined) - continue; - - if (r_type != RELOC_JMP_TBL - && ! info->shared - && ((h->flags & SUNOS_DEF_DYNAMIC) == 0 - || (h->flags & SUNOS_DEF_REGULAR) != 0)) - continue; - - if (r_type == RELOC_JMP_TBL - && ! info->shared - && (h->flags & SUNOS_DEF_DYNAMIC) == 0 - && (h->flags & SUNOS_DEF_REGULAR) == 0) - { - /* This symbol is apparently undefined. Don't do anything - here; just let the relocation routine report an undefined - symbol. */ - continue; - } - - if (strcmp (h->root.root.root.string, "__GLOBAL_OFFSET_TABLE_") == 0) - continue; - - if (dynobj == NULL) - { - if (! sunos_create_dynamic_sections (abfd, info, false)) - return false; - dynobj = sunos_hash_table (info)->dynobj; - splt = bfd_get_section_by_name (dynobj, ".plt"); - sgot = bfd_get_section_by_name (dynobj, ".got"); - srel = bfd_get_section_by_name (dynobj, ".dynrel"); - BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL); - - /* Make sure we have an initial entry in the .got table. */ - if (sgot->_raw_size == 0) - sgot->_raw_size = BYTES_IN_WORD; - sunos_hash_table (info)->got_needed = true; - } - - BFD_ASSERT (r_type == RELOC_JMP_TBL - || info->shared - || (h->flags & SUNOS_REF_REGULAR) != 0); - BFD_ASSERT (r_type == RELOC_JMP_TBL - || info->shared - || h->plt_offset != 0 - || ((h->root.root.type == bfd_link_hash_defined - || h->root.root.type == bfd_link_hash_defweak) - ? (h->root.root.u.def.section->owner->flags - & DYNAMIC) != 0 - : (h->root.root.u.undef.abfd->flags & DYNAMIC) != 0)); - - /* This reloc is against a symbol defined only by a dynamic - object, or it is a jump table reloc from PIC compiled code. */ - - if (r_type != RELOC_JMP_TBL - && h->root.root.type == bfd_link_hash_undefined) - { - /* Presumably this symbol was marked as being undefined by - an earlier reloc. */ - srel->_raw_size += RELOC_EXT_SIZE; - } - else if (r_type != RELOC_JMP_TBL - && (h->root.root.u.def.section->flags & SEC_CODE) == 0) - { - bfd *sub; - - /* This reloc is not in the .text section. It must be - copied into the dynamic relocs. We mark the symbol as - being undefined. */ - srel->_raw_size += RELOC_EXT_SIZE; - if ((h->flags & SUNOS_DEF_REGULAR) == 0) - { - sub = h->root.root.u.def.section->owner; - h->root.root.type = bfd_link_hash_undefined; - h->root.root.u.undef.abfd = sub; - } - } - else - { - /* This symbol is in the .text section. We must give it an - entry in the procedure linkage table, if we have not - already done so. We change the definition of the symbol - to the .plt section; this will cause relocs against it to - be handled correctly. */ - if (h->plt_offset == 0) - { - if (splt->_raw_size == 0) - splt->_raw_size = SPARC_PLT_ENTRY_SIZE; - h->plt_offset = splt->_raw_size; - - if ((h->flags & SUNOS_DEF_REGULAR) == 0) - { - if (h->root.root.type == bfd_link_hash_undefined) - h->root.root.type = bfd_link_hash_defined; - h->root.root.u.def.section = splt; - h->root.root.u.def.value = splt->_raw_size; - } - - splt->_raw_size += SPARC_PLT_ENTRY_SIZE; - - /* We will also need a dynamic reloc entry, unless this - is a JMP_TBL reloc produced by linking PIC compiled - code, and we are not making a shared library. */ - if (info->shared || (h->flags & SUNOS_DEF_REGULAR) == 0) - srel->_raw_size += RELOC_EXT_SIZE; - } - - /* If we are creating a shared library, we need to copy over - any reloc other than a jump table reloc. */ - if (info->shared && r_type != RELOC_JMP_TBL) - srel->_raw_size += RELOC_EXT_SIZE; - } - } - - return true; -} - -/* Build the hash table of dynamic symbols, and to mark as written all - symbols from dynamic objects which we do not plan to write out. */ - -static boolean -sunos_scan_dynamic_symbol (h, data) - struct sunos_link_hash_entry *h; - PTR data; -{ - struct bfd_link_info *info = (struct bfd_link_info *) data; - - /* Set the written flag for symbols we do not want to write out as - part of the regular symbol table. This is all symbols which are - not defined in a regular object file. For some reason symbols - which are referenced by a regular object and defined by a dynamic - object do not seem to show up in the regular symbol table. It is - possible for a symbol to have only SUNOS_REF_REGULAR set here, it - is an undefined symbol which was turned into a common symbol - because it was found in an archive object which was not included - in the link. */ - if ((h->flags & SUNOS_DEF_REGULAR) == 0 - && (h->flags & SUNOS_DEF_DYNAMIC) != 0 - && strcmp (h->root.root.root.string, "__DYNAMIC") != 0) - h->root.written = true; - - /* If this symbol is defined by a dynamic object and referenced by a - regular object, see whether we gave it a reasonable value while - scanning the relocs. */ - - if ((h->flags & SUNOS_DEF_REGULAR) == 0 - && (h->flags & SUNOS_DEF_DYNAMIC) != 0 - && (h->flags & SUNOS_REF_REGULAR) != 0) - { - if ((h->root.root.type == bfd_link_hash_defined - || h->root.root.type == bfd_link_hash_defweak) - && ((h->root.root.u.def.section->owner->flags & DYNAMIC) != 0) - && h->root.root.u.def.section->output_section == NULL) - { - bfd *sub; - - /* This symbol is currently defined in a dynamic section - which is not being put into the output file. This - implies that there is no reloc against the symbol. I'm - not sure why this case would ever occur. In any case, we - change the symbol to be undefined. */ - sub = h->root.root.u.def.section->owner; - h->root.root.type = bfd_link_hash_undefined; - h->root.root.u.undef.abfd = sub; - } - } - - /* If this symbol is defined or referenced by a regular file, add it - to the dynamic symbols. */ - if ((h->flags & (SUNOS_DEF_REGULAR | SUNOS_REF_REGULAR)) != 0) - { - asection *s; - size_t len; - bfd_byte *contents; - unsigned char *name; - unsigned long hash; - bfd *dynobj; - - BFD_ASSERT (h->dynindx == -2); - - dynobj = sunos_hash_table (info)->dynobj; - - h->dynindx = sunos_hash_table (info)->dynsymcount; - ++sunos_hash_table (info)->dynsymcount; - - len = strlen (h->root.root.root.string); - - /* We don't bother to construct a BFD hash table for the strings - which are the names of the dynamic symbols. Using a hash - table for the regular symbols is beneficial, because the - regular symbols includes the debugging symbols, which have - long names and are often duplicated in several object files. - There are no debugging symbols in the dynamic symbols. */ - s = bfd_get_section_by_name (dynobj, ".dynstr"); - BFD_ASSERT (s != NULL); - contents = (bfd_byte *) bfd_realloc (s->contents, - s->_raw_size + len + 1); - if (contents == NULL) - return false; - s->contents = contents; - - h->dynstr_index = s->_raw_size; - strcpy ((char *) contents + s->_raw_size, h->root.root.root.string); - s->_raw_size += len + 1; - - /* Add it to the dynamic hash table. */ - name = (unsigned char *) h->root.root.root.string; - hash = 0; - while (*name != '\0') - hash = (hash << 1) + *name++; - hash &= 0x7fffffff; - hash %= sunos_hash_table (info)->bucketcount; - - s = bfd_get_section_by_name (dynobj, ".hash"); - BFD_ASSERT (s != NULL); - - if (GET_SWORD (dynobj, s->contents + hash * HASH_ENTRY_SIZE) == -1) - PUT_WORD (dynobj, h->dynindx, s->contents + hash * HASH_ENTRY_SIZE); - else - { - bfd_vma next; - - next = GET_WORD (dynobj, - (s->contents - + hash * HASH_ENTRY_SIZE - + BYTES_IN_WORD)); - PUT_WORD (dynobj, s->_raw_size / HASH_ENTRY_SIZE, - s->contents + hash * HASH_ENTRY_SIZE + BYTES_IN_WORD); - PUT_WORD (dynobj, h->dynindx, s->contents + s->_raw_size); - PUT_WORD (dynobj, next, s->contents + s->_raw_size + BYTES_IN_WORD); - s->_raw_size += HASH_ENTRY_SIZE; - } - } - - return true; -} - -/* Link a dynamic object. We actually don't have anything to do at - this point. This entry point exists to prevent the regular linker - code from doing anything with the object. */ - -/*ARGSUSED*/ -static boolean -sunos_link_dynamic_object (info, abfd) - struct bfd_link_info *info ATTRIBUTE_UNUSED; - bfd *abfd ATTRIBUTE_UNUSED; -{ - return true; -} - -/* Write out a dynamic symbol. This is called by the final traversal - over the symbol table. */ - -static boolean -sunos_write_dynamic_symbol (output_bfd, info, harg) - bfd *output_bfd; - struct bfd_link_info *info; - struct aout_link_hash_entry *harg; -{ - struct sunos_link_hash_entry *h = (struct sunos_link_hash_entry *) harg; - int type; - bfd_vma val; - asection *s; - struct external_nlist *outsym; - - /* If this symbol is in the procedure linkage table, fill in the - table entry. */ - if (h->plt_offset != 0) - { - bfd *dynobj; - asection *splt; - bfd_byte *p; - asection *s; - bfd_vma r_address; - - dynobj = sunos_hash_table (info)->dynobj; - splt = bfd_get_section_by_name (dynobj, ".plt"); - p = splt->contents + h->plt_offset; - - s = bfd_get_section_by_name (dynobj, ".dynrel"); - - r_address = (splt->output_section->vma - + splt->output_offset - + h->plt_offset); - - switch (bfd_get_arch (output_bfd)) - { - case bfd_arch_sparc: - if (info->shared || (h->flags & SUNOS_DEF_REGULAR) == 0) - { - bfd_put_32 (output_bfd, SPARC_PLT_ENTRY_WORD0, p); - bfd_put_32 (output_bfd, - (SPARC_PLT_ENTRY_WORD1 - + (((- (h->plt_offset + 4) >> 2) - & 0x3fffffff))), - p + 4); - bfd_put_32 (output_bfd, SPARC_PLT_ENTRY_WORD2 + s->reloc_count, - p + 8); - } - else - { - bfd_vma val; - - val = (h->root.root.u.def.section->output_section->vma - + h->root.root.u.def.section->output_offset - + h->root.root.u.def.value); - bfd_put_32 (output_bfd, - SPARC_PLT_PIC_WORD0 + ((val >> 10) & 0x3fffff), - p); - bfd_put_32 (output_bfd, - SPARC_PLT_PIC_WORD1 + (val & 0x3ff), - p + 4); - bfd_put_32 (output_bfd, SPARC_PLT_PIC_WORD2, p + 8); - } - break; - - case bfd_arch_m68k: - if (! info->shared && (h->flags & SUNOS_DEF_REGULAR) != 0) - abort (); - bfd_put_16 (output_bfd, M68K_PLT_ENTRY_WORD0, p); - bfd_put_32 (output_bfd, (- (h->plt_offset + 2)), p + 2); - bfd_put_16 (output_bfd, s->reloc_count, p + 6); - r_address += 2; - break; - - default: - abort (); - } - - /* We also need to add a jump table reloc, unless this is the - result of a JMP_TBL reloc from PIC compiled code. */ - if (info->shared || (h->flags & SUNOS_DEF_REGULAR) == 0) - { - BFD_ASSERT (h->dynindx >= 0); - BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) - < s->_raw_size); - p = s->contents + s->reloc_count * obj_reloc_entry_size (output_bfd); - if (obj_reloc_entry_size (output_bfd) == RELOC_STD_SIZE) - { - struct reloc_std_external *srel; - - srel = (struct reloc_std_external *) p; - PUT_WORD (output_bfd, r_address, srel->r_address); - if (bfd_header_big_endian (output_bfd)) - { - srel->r_index[0] = (bfd_byte) (h->dynindx >> 16); - srel->r_index[1] = (bfd_byte) (h->dynindx >> 8); - srel->r_index[2] = (bfd_byte) (h->dynindx); - srel->r_type[0] = (RELOC_STD_BITS_EXTERN_BIG - | RELOC_STD_BITS_JMPTABLE_BIG); - } - else - { - srel->r_index[2] = (bfd_byte) (h->dynindx >> 16); - srel->r_index[1] = (bfd_byte) (h->dynindx >> 8); - srel->r_index[0] = (bfd_byte)h->dynindx; - srel->r_type[0] = (RELOC_STD_BITS_EXTERN_LITTLE - | RELOC_STD_BITS_JMPTABLE_LITTLE); - } - } - else - { - struct reloc_ext_external *erel; - - erel = (struct reloc_ext_external *) p; - PUT_WORD (output_bfd, r_address, erel->r_address); - if (bfd_header_big_endian (output_bfd)) - { - erel->r_index[0] = (bfd_byte) (h->dynindx >> 16); - erel->r_index[1] = (bfd_byte) (h->dynindx >> 8); - erel->r_index[2] = (bfd_byte)h->dynindx; - erel->r_type[0] = - (RELOC_EXT_BITS_EXTERN_BIG - | (RELOC_JMP_SLOT << RELOC_EXT_BITS_TYPE_SH_BIG)); - } - else - { - erel->r_index[2] = (bfd_byte) (h->dynindx >> 16); - erel->r_index[1] = (bfd_byte) (h->dynindx >> 8); - erel->r_index[0] = (bfd_byte)h->dynindx; - erel->r_type[0] = - (RELOC_EXT_BITS_EXTERN_LITTLE - | (RELOC_JMP_SLOT << RELOC_EXT_BITS_TYPE_SH_LITTLE)); - } - PUT_WORD (output_bfd, (bfd_vma) 0, erel->r_addend); - } - - ++s->reloc_count; - } - } - - /* If this is not a dynamic symbol, we don't have to do anything - else. We only check this after handling the PLT entry, because - we can have a PLT entry for a nondynamic symbol when linking PIC - compiled code from a regular object. */ - if (h->dynindx < 0) - return true; - - switch (h->root.root.type) - { - default: - case bfd_link_hash_new: - abort (); - /* Avoid variable not initialized warnings. */ - return true; - case bfd_link_hash_undefined: - type = N_UNDF | N_EXT; - val = 0; - break; - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - { - asection *sec; - asection *output_section; - - sec = h->root.root.u.def.section; - output_section = sec->output_section; - BFD_ASSERT (bfd_is_abs_section (output_section) - || output_section->owner == output_bfd); - if (h->plt_offset != 0 - && (h->flags & SUNOS_DEF_REGULAR) == 0) - { - type = N_UNDF | N_EXT; - val = 0; - } - else - { - if (output_section == obj_textsec (output_bfd)) - type = (h->root.root.type == bfd_link_hash_defined - ? N_TEXT - : N_WEAKT); - else if (output_section == obj_datasec (output_bfd)) - type = (h->root.root.type == bfd_link_hash_defined - ? N_DATA - : N_WEAKD); - else if (output_section == obj_bsssec (output_bfd)) - type = (h->root.root.type == bfd_link_hash_defined - ? N_BSS - : N_WEAKB); - else - type = (h->root.root.type == bfd_link_hash_defined - ? N_ABS - : N_WEAKA); - type |= N_EXT; - val = (h->root.root.u.def.value - + output_section->vma - + sec->output_offset); - } - } - break; - case bfd_link_hash_common: - type = N_UNDF | N_EXT; - val = h->root.root.u.c.size; - break; - case bfd_link_hash_undefweak: - type = N_WEAKU; - val = 0; - break; - case bfd_link_hash_indirect: - case bfd_link_hash_warning: - /* FIXME: Ignore these for now. The circumstances under which - they should be written out are not clear to me. */ - return true; - } - - s = bfd_get_section_by_name (sunos_hash_table (info)->dynobj, ".dynsym"); - BFD_ASSERT (s != NULL); - outsym = ((struct external_nlist *) - (s->contents + h->dynindx * EXTERNAL_NLIST_SIZE)); - - bfd_h_put_8 (output_bfd, type, outsym->e_type); - bfd_h_put_8 (output_bfd, 0, outsym->e_other); - - /* FIXME: The native linker doesn't use 0 for desc. It seems to use - one less than the desc value in the shared library, although that - seems unlikely. */ - bfd_h_put_16 (output_bfd, 0, outsym->e_desc); - - PUT_WORD (output_bfd, h->dynstr_index, outsym->e_strx); - PUT_WORD (output_bfd, val, outsym->e_value); - - return true; -} - -/* This is called for each reloc against an external symbol. If this - is a reloc which are are going to copy as a dynamic reloc, then - copy it over, and tell the caller to not bother processing this - reloc. */ - -/*ARGSUSED*/ -static boolean -sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc, - contents, skip, relocationp) - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - struct aout_link_hash_entry *harg; - PTR reloc; - bfd_byte *contents ATTRIBUTE_UNUSED; - boolean *skip; - bfd_vma *relocationp; -{ - struct sunos_link_hash_entry *h = (struct sunos_link_hash_entry *) harg; - bfd *dynobj; - boolean baserel; - boolean jmptbl; - boolean pcrel; - asection *s; - bfd_byte *p; - long indx; - - *skip = false; - - dynobj = sunos_hash_table (info)->dynobj; - - if (h != NULL - && h->plt_offset != 0 - && (info->shared - || (h->flags & SUNOS_DEF_REGULAR) == 0)) - { - asection *splt; - - /* Redirect the relocation to the PLT entry. */ - splt = bfd_get_section_by_name (dynobj, ".plt"); - *relocationp = (splt->output_section->vma - + splt->output_offset - + h->plt_offset); - } - - if (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE) - { - struct reloc_std_external *srel; - - srel = (struct reloc_std_external *) reloc; - if (bfd_header_big_endian (input_bfd)) - { - baserel = (0 != (srel->r_type[0] & RELOC_STD_BITS_BASEREL_BIG)); - jmptbl = (0 != (srel->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG)); - pcrel = (0 != (srel->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); - } - else - { - baserel = (0 != (srel->r_type[0] & RELOC_STD_BITS_BASEREL_LITTLE)); - jmptbl = (0 != (srel->r_type[0] & RELOC_STD_BITS_JMPTABLE_LITTLE)); - pcrel = (0 != (srel->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); - } - } - else - { - struct reloc_ext_external *erel; - int r_type; - - erel = (struct reloc_ext_external *) reloc; - if (bfd_header_big_endian (input_bfd)) - r_type = ((erel->r_type[0] & RELOC_EXT_BITS_TYPE_BIG) - >> RELOC_EXT_BITS_TYPE_SH_BIG); - else - r_type = ((erel->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE) - >> RELOC_EXT_BITS_TYPE_SH_LITTLE); - baserel = (r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22); - jmptbl = r_type == RELOC_JMP_TBL; - pcrel = (r_type == RELOC_DISP8 - || r_type == RELOC_DISP16 - || r_type == RELOC_DISP32 - || r_type == RELOC_WDISP30 - || r_type == RELOC_WDISP22); - /* We don't consider the PC10 and PC22 types to be PC relative, - because they are pcrel_offset. */ - } - - if (baserel) - { - bfd_vma *got_offsetp; - asection *sgot; - - if (h != NULL) - got_offsetp = &h->got_offset; - else if (adata (input_bfd).local_got_offsets == NULL) - got_offsetp = NULL; - else - { - struct reloc_std_external *srel; - int r_index; - - srel = (struct reloc_std_external *) reloc; - if (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE) - { - if (bfd_header_big_endian (input_bfd)) - r_index = ((srel->r_index[0] << 16) - | (srel->r_index[1] << 8) - | srel->r_index[2]); - else - r_index = ((srel->r_index[2] << 16) - | (srel->r_index[1] << 8) - | srel->r_index[0]); - } - else - { - struct reloc_ext_external *erel; - - erel = (struct reloc_ext_external *) reloc; - if (bfd_header_big_endian (input_bfd)) - r_index = ((erel->r_index[0] << 16) - | (erel->r_index[1] << 8) - | erel->r_index[2]); - else - r_index = ((erel->r_index[2] << 16) - | (erel->r_index[1] << 8) - | erel->r_index[0]); - } - - got_offsetp = adata (input_bfd).local_got_offsets + r_index; - } - - BFD_ASSERT (got_offsetp != NULL && *got_offsetp != 0); - - sgot = bfd_get_section_by_name (dynobj, ".got"); - - /* We set the least significant bit to indicate whether we have - already initialized the GOT entry. */ - if ((*got_offsetp & 1) == 0) - { - if (h == NULL - || (! info->shared - && ((h->flags & SUNOS_DEF_DYNAMIC) == 0 - || (h->flags & SUNOS_DEF_REGULAR) != 0))) - PUT_WORD (dynobj, *relocationp, sgot->contents + *got_offsetp); - else - PUT_WORD (dynobj, 0, sgot->contents + *got_offsetp); - - if (info->shared - || (h != NULL - && (h->flags & SUNOS_DEF_DYNAMIC) != 0 - && (h->flags & SUNOS_DEF_REGULAR) == 0)) - { - /* We need to create a GLOB_DAT or 32 reloc to tell the - dynamic linker to fill in this entry in the table. */ - - s = bfd_get_section_by_name (dynobj, ".dynrel"); - BFD_ASSERT (s != NULL); - BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) - < s->_raw_size); - - p = (s->contents - + s->reloc_count * obj_reloc_entry_size (dynobj)); - - if (h != NULL) - indx = h->dynindx; - else - indx = 0; - - if (obj_reloc_entry_size (dynobj) == RELOC_STD_SIZE) - { - struct reloc_std_external *srel; - - srel = (struct reloc_std_external *) p; - PUT_WORD (dynobj, - (*got_offsetp - + sgot->output_section->vma - + sgot->output_offset), - srel->r_address); - if (bfd_header_big_endian (dynobj)) - { - srel->r_index[0] = (bfd_byte) (indx >> 16); - srel->r_index[1] = (bfd_byte) (indx >> 8); - srel->r_index[2] = (bfd_byte)indx; - if (h == NULL) - srel->r_type[0] = 2 << RELOC_STD_BITS_LENGTH_SH_BIG; - else - srel->r_type[0] = - (RELOC_STD_BITS_EXTERN_BIG - | RELOC_STD_BITS_BASEREL_BIG - | RELOC_STD_BITS_RELATIVE_BIG - | (2 << RELOC_STD_BITS_LENGTH_SH_BIG)); - } - else - { - srel->r_index[2] = (bfd_byte) (indx >> 16); - srel->r_index[1] = (bfd_byte) (indx >> 8); - srel->r_index[0] = (bfd_byte)indx; - if (h == NULL) - srel->r_type[0] = 2 << RELOC_STD_BITS_LENGTH_SH_LITTLE; - else - srel->r_type[0] = - (RELOC_STD_BITS_EXTERN_LITTLE - | RELOC_STD_BITS_BASEREL_LITTLE - | RELOC_STD_BITS_RELATIVE_LITTLE - | (2 << RELOC_STD_BITS_LENGTH_SH_LITTLE)); - } - } - else - { - struct reloc_ext_external *erel; - - erel = (struct reloc_ext_external *) p; - PUT_WORD (dynobj, - (*got_offsetp - + sgot->output_section->vma - + sgot->output_offset), - erel->r_address); - if (bfd_header_big_endian (dynobj)) - { - erel->r_index[0] = (bfd_byte) (indx >> 16); - erel->r_index[1] = (bfd_byte) (indx >> 8); - erel->r_index[2] = (bfd_byte)indx; - if (h == NULL) - erel->r_type[0] = - RELOC_32 << RELOC_EXT_BITS_TYPE_SH_BIG; - else - erel->r_type[0] = - (RELOC_EXT_BITS_EXTERN_BIG - | (RELOC_GLOB_DAT << RELOC_EXT_BITS_TYPE_SH_BIG)); - } - else - { - erel->r_index[2] = (bfd_byte) (indx >> 16); - erel->r_index[1] = (bfd_byte) (indx >> 8); - erel->r_index[0] = (bfd_byte)indx; - if (h == NULL) - erel->r_type[0] = - RELOC_32 << RELOC_EXT_BITS_TYPE_SH_LITTLE; - else - erel->r_type[0] = - (RELOC_EXT_BITS_EXTERN_LITTLE - | (RELOC_GLOB_DAT - << RELOC_EXT_BITS_TYPE_SH_LITTLE)); - } - PUT_WORD (dynobj, 0, erel->r_addend); - } - - ++s->reloc_count; - } - - *got_offsetp |= 1; - } - - *relocationp = (sgot->vma - + (*got_offsetp &~ 1) - - sunos_hash_table (info)->got_base); - - /* There is nothing else to do for a base relative reloc. */ - return true; - } - - if (! sunos_hash_table (info)->dynamic_sections_needed) - return true; - if (! info->shared) - { - if (h == NULL - || h->dynindx == -1 - || h->root.root.type != bfd_link_hash_undefined - || (h->flags & SUNOS_DEF_REGULAR) != 0 - || (h->flags & SUNOS_DEF_DYNAMIC) == 0 - || (h->root.root.u.undef.abfd->flags & DYNAMIC) == 0) - return true; - } - else - { - if (h != NULL - && (h->dynindx == -1 - || jmptbl - || strcmp (h->root.root.root.string, - "__GLOBAL_OFFSET_TABLE_") == 0)) - return true; - } - - /* It looks like this is a reloc we are supposed to copy. */ - - s = bfd_get_section_by_name (dynobj, ".dynrel"); - BFD_ASSERT (s != NULL); - BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) < s->_raw_size); - - p = s->contents + s->reloc_count * obj_reloc_entry_size (dynobj); - - /* Copy the reloc over. */ - memcpy (p, reloc, obj_reloc_entry_size (dynobj)); - - if (h != NULL) - indx = h->dynindx; - else - indx = 0; - - /* Adjust the address and symbol index. */ - if (obj_reloc_entry_size (dynobj) == RELOC_STD_SIZE) - { - struct reloc_std_external *srel; - - srel = (struct reloc_std_external *) p; - PUT_WORD (dynobj, - (GET_WORD (dynobj, srel->r_address) - + input_section->output_section->vma - + input_section->output_offset), - srel->r_address); - if (bfd_header_big_endian (dynobj)) - { - srel->r_index[0] = (bfd_byte) (indx >> 16); - srel->r_index[1] = (bfd_byte) (indx >> 8); - srel->r_index[2] = (bfd_byte)indx; - } - else - { - srel->r_index[2] = (bfd_byte) (indx >> 16); - srel->r_index[1] = (bfd_byte) (indx >> 8); - srel->r_index[0] = (bfd_byte)indx; - } - /* FIXME: We may have to change the addend for a PC relative - reloc. */ - } - else - { - struct reloc_ext_external *erel; - - erel = (struct reloc_ext_external *) p; - PUT_WORD (dynobj, - (GET_WORD (dynobj, erel->r_address) - + input_section->output_section->vma - + input_section->output_offset), - erel->r_address); - if (bfd_header_big_endian (dynobj)) - { - erel->r_index[0] = (bfd_byte) (indx >> 16); - erel->r_index[1] = (bfd_byte) (indx >> 8); - erel->r_index[2] = (bfd_byte)indx; - } - else - { - erel->r_index[2] = (bfd_byte) (indx >> 16); - erel->r_index[1] = (bfd_byte) (indx >> 8); - erel->r_index[0] = (bfd_byte)indx; - } - if (pcrel && h != NULL) - { - /* Adjust the addend for the change in address. */ - PUT_WORD (dynobj, - (GET_WORD (dynobj, erel->r_addend) - - (input_section->output_section->vma - + input_section->output_offset - - input_section->vma)), - erel->r_addend); - } - } - - ++s->reloc_count; - - if (h != NULL) - *skip = true; - - return true; -} - -/* Finish up the dynamic linking information. */ - -static boolean -sunos_finish_dynamic_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - bfd *dynobj; - asection *o; - asection *s; - asection *sdyn; - - if (! sunos_hash_table (info)->dynamic_sections_needed - && ! sunos_hash_table (info)->got_needed) - return true; - - dynobj = sunos_hash_table (info)->dynobj; - - sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); - BFD_ASSERT (sdyn != NULL); - - /* Finish up the .need section. The linker emulation code filled it - in, but with offsets from the start of the section instead of - real addresses. Now that we know the section location, we can - fill in the final values. */ - s = bfd_get_section_by_name (dynobj, ".need"); - if (s != NULL && s->_raw_size != 0) - { - file_ptr filepos; - bfd_byte *p; - - filepos = s->output_section->filepos + s->output_offset; - p = s->contents; - while (1) - { - bfd_vma val; - - PUT_WORD (dynobj, GET_WORD (dynobj, p) + filepos, p); - val = GET_WORD (dynobj, p + 12); - if (val == 0) - break; - PUT_WORD (dynobj, val + filepos, p + 12); - p += 16; - } - } - - /* The first entry in the .got section is the address of the - dynamic information, unless this is a shared library. */ - s = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (s != NULL); - if (info->shared || sdyn->_raw_size == 0) - PUT_WORD (dynobj, 0, s->contents); - else - PUT_WORD (dynobj, sdyn->output_section->vma + sdyn->output_offset, - s->contents); - - for (o = dynobj->sections; o != NULL; o = o->next) - { - if ((o->flags & SEC_HAS_CONTENTS) != 0 - && o->contents != NULL) - { - BFD_ASSERT (o->output_section != NULL - && o->output_section->owner == abfd); - if (! bfd_set_section_contents (abfd, o->output_section, - o->contents, o->output_offset, - o->_raw_size)) - return false; - } - } - - if (sdyn->_raw_size > 0) - { - struct external_sun4_dynamic esd; - struct external_sun4_dynamic_link esdl; - - /* Finish up the dynamic link information. */ - PUT_WORD (dynobj, (bfd_vma) 3, esd.ld_version); - PUT_WORD (dynobj, - sdyn->output_section->vma + sdyn->output_offset + sizeof esd, - esd.ldd); - PUT_WORD (dynobj, - (sdyn->output_section->vma - + sdyn->output_offset - + sizeof esd - + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE), - esd.ld); - - if (! bfd_set_section_contents (abfd, sdyn->output_section, &esd, - sdyn->output_offset, sizeof esd)) - return false; - - PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_loaded); - - s = bfd_get_section_by_name (dynobj, ".need"); - if (s == NULL || s->_raw_size == 0) - PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_need); - else - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_need); - - s = bfd_get_section_by_name (dynobj, ".rules"); - if (s == NULL || s->_raw_size == 0) - PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_rules); - else - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_rules); - - s = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (s != NULL); - PUT_WORD (dynobj, s->output_section->vma + s->output_offset, - esdl.ld_got); - - s = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (s != NULL); - PUT_WORD (dynobj, s->output_section->vma + s->output_offset, - esdl.ld_plt); - PUT_WORD (dynobj, s->_raw_size, esdl.ld_plt_sz); - - s = bfd_get_section_by_name (dynobj, ".dynrel"); - BFD_ASSERT (s != NULL); - BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) - == s->_raw_size); - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_rel); - - s = bfd_get_section_by_name (dynobj, ".hash"); - BFD_ASSERT (s != NULL); - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_hash); - - s = bfd_get_section_by_name (dynobj, ".dynsym"); - BFD_ASSERT (s != NULL); - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_stab); - - PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_stab_hash); - - PUT_WORD (dynobj, (bfd_vma) sunos_hash_table (info)->bucketcount, - esdl.ld_buckets); - - s = bfd_get_section_by_name (dynobj, ".dynstr"); - BFD_ASSERT (s != NULL); - PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, - esdl.ld_symbols); - PUT_WORD (dynobj, s->_raw_size, esdl.ld_symb_size); - - /* The size of the text area is the size of the .text section - rounded up to a page boundary. FIXME: Should the page size be - conditional on something? */ - PUT_WORD (dynobj, - BFD_ALIGN (obj_textsec (abfd)->_raw_size, 0x2000), - esdl.ld_text); - - if (! bfd_set_section_contents (abfd, sdyn->output_section, &esdl, - (sdyn->output_offset - + sizeof esd - + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE), - sizeof esdl)) - return false; - - abfd->flags |= DYNAMIC; - } - - return true; -} diff --git a/contrib/binutils/bfd/xcoff-target.h b/contrib/binutils/bfd/xcoff-target.h deleted file mode 100644 index a3cc0c07e2eb..000000000000 --- a/contrib/binutils/bfd/xcoff-target.h +++ /dev/null @@ -1,194 +0,0 @@ -/* Common definitions for backends based on IBM RS/6000 "XCOFF64" files. - Copyright 2000, 2001 - Free Software Foundation, Inc. - Contributed by Cygnus Support. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* Internalcoff.h and coffcode.h modify themselves based on this flag. */ -#define RS6000COFF_C 1 - -#define SELECT_RELOC(internal, howto) \ - { \ - internal.r_type = howto->type; \ - internal.r_size = \ - ((howto->complain_on_overflow == complain_overflow_signed \ - ? 0x80 \ - : 0) \ - | (howto->bitsize - 1)); \ - } - -#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) - -#define COFF_LONG_FILENAMES - -#define NO_COFF_SYMBOLS - -#define RTYPE2HOWTO(cache_ptr, dst) _bfd_xcoff_rtype2howto (cache_ptr, dst) - -#define coff_mkobject _bfd_xcoff_mkobject -#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data -#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name -#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup -#define coff_relocate_section _bfd_ppc_xcoff_relocate_section - -#define CORE_FILE_P _bfd_dummy_target - -#define coff_core_file_failing_command _bfd_nocore_core_file_failing_command -#define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal -#define coff_core_file_matches_executable_p \ - _bfd_nocore_core_file_matches_executable_p - -#ifdef AIX_CORE -#undef CORE_FILE_P -#define CORE_FILE_P rs6000coff_core_p -extern const bfd_target * rs6000coff_core_p (); -extern boolean rs6000coff_core_file_matches_executable_p (); - -#undef coff_core_file_matches_executable_p -#define coff_core_file_matches_executable_p \ - rs6000coff_core_file_matches_executable_p - -extern char *rs6000coff_core_file_failing_command PARAMS ((bfd *abfd)); -#undef coff_core_file_failing_command -#define coff_core_file_failing_command rs6000coff_core_file_failing_command - -extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd)); -#undef coff_core_file_failing_signal -#define coff_core_file_failing_signal rs6000coff_core_file_failing_signal -#endif /* AIX_CORE */ - -#ifdef LYNX_CORE - -#undef CORE_FILE_P -#define CORE_FILE_P lynx_core_file_p -extern const bfd_target *lynx_core_file_p PARAMS ((bfd *abfd)); - -extern boolean lynx_core_file_matches_executable_p PARAMS ((bfd *core_bfd, - bfd *exec_bfd)); -#undef coff_core_file_matches_executable_p -#define coff_core_file_matches_executable_p lynx_core_file_matches_executable_p - -extern char *lynx_core_file_failing_command PARAMS ((bfd *abfd)); -#undef coff_core_file_failing_command -#define coff_core_file_failing_command lynx_core_file_failing_command - -extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd)); -#undef coff_core_file_failing_signal -#define coff_core_file_failing_signal lynx_core_file_failing_signal - -#endif /* LYNX_CORE */ - -#define _bfd_xcoff_bfd_get_relocated_section_contents \ - coff_bfd_get_relocated_section_contents -#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section -#define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections -#define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section - -/* XCOFF archives do not have anything which corresponds to an - extended name table. */ - -#define _bfd_xcoff_slurp_extended_name_table bfd_false -#define _bfd_xcoff_construct_extended_name_table \ - ((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \ - bfd_false) -#define _bfd_xcoff_truncate_arname bfd_dont_truncate_arname - -/* We can use the standard get_elt_at_index routine. */ - -#define _bfd_xcoff_get_elt_at_index _bfd_generic_get_elt_at_index - -/* XCOFF archives do not have a timestamp. */ - -#define _bfd_xcoff_update_armap_timestamp bfd_true - -extern boolean _bfd_xcoff_mkobject PARAMS ((bfd *)); -extern boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *)); -extern boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *)); -extern void _bfd_xcoff_rtype2howto - PARAMS ((arelent *, struct internal_reloc *)); -extern reloc_howto_type *_bfd_xcoff_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -extern boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *)); -extern const bfd_target *_bfd_xcoff_archive_p PARAMS ((bfd *)); -extern PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *)); -extern bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *)); -extern int _bfd_xcoff_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); -extern boolean _bfd_xcoff_write_armap - PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); -extern boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *)); -extern int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, boolean)); -extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR)); -extern unsigned int _bfd_xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR)); -extern void _bfd_xcoff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR)); -extern unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR)); - -#ifndef coff_SWAP_sym_in -#define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in -#define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out -#define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in -#define coff_SWAP_aux_out _bfd_xcoff_swap_aux_out -#endif - -#include "coffcode.h" - -/* The transfer vector that leads the outside world to all of the above. */ - -const bfd_target TARGET_SYM = -{ - TARGET_NAME, - bfd_target_xcoff_flavour, - BFD_ENDIAN_BIG, /* data byte order is big */ - BFD_ENDIAN_BIG, /* header byte order is big */ - - (HAS_RELOC | EXEC_P | /* object flags */ - HAS_LINENO | HAS_DEBUG | DYNAMIC | - HAS_SYMS | HAS_LOCALS | WP_TEXT), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - 0, /* leading char */ - '/', /* ar_pad_char */ - 15, /* ar_max_namelen??? FIXMEmgo */ - - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ - bfd_getb64, bfd_getb_signed_64, bfd_putb64, - bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ - - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ - _bfd_xcoff_archive_p, CORE_FILE_P}, - {bfd_false, coff_mkobject, /* bfd_set_format */ - _bfd_generic_mkarchive, bfd_false}, - {bfd_false, coff_write_object_contents, /* bfd_write_contents */ - _bfd_xcoff_write_archive_contents, bfd_false}, - - BFD_JUMP_TABLE_GENERIC (coff), - BFD_JUMP_TABLE_COPY (coff), - BFD_JUMP_TABLE_CORE (coff), - BFD_JUMP_TABLE_ARCHIVE (_bfd_xcoff), - BFD_JUMP_TABLE_SYMBOLS (coff), - BFD_JUMP_TABLE_RELOCS (coff), - BFD_JUMP_TABLE_WRITE (coff), - BFD_JUMP_TABLE_LINK (_bfd_xcoff), - BFD_JUMP_TABLE_DYNAMIC (_bfd_xcoff), - - NULL, - - COFF_SWAP_TABLE -}; diff --git a/contrib/binutils/bfd/xcofflink.c b/contrib/binutils/bfd/xcofflink.c deleted file mode 100644 index 5580e9b35439..000000000000 --- a/contrib/binutils/bfd/xcofflink.c +++ /dev/null @@ -1,6631 +0,0 @@ -/* POWER/PowerPC XCOFF linker support. - Copyright 1995, 1996, 1997, 1998, 1999, 2000 - Free Software Foundation, Inc. - Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" -#include "libbfd.h" -#include "coff/internal.h" -#include "libcoff.h" - -/* This file holds the XCOFF linker code. */ - -#define STRING_SIZE_SIZE (4) - -/* Get the XCOFF hash table entries for a BFD. */ -#define obj_xcoff_sym_hashes(bfd) \ - ((struct xcoff_link_hash_entry **) obj_coff_sym_hashes (bfd)) - -/* XCOFF relocation types. These probably belong in a header file - somewhere. The relocations are described in the function - _bfd_ppc_xcoff_relocate_section in this file. */ - -#define R_POS (0x00) -#define R_NEG (0x01) -#define R_REL (0x02) -#define R_TOC (0x03) -#define R_RTB (0x04) -#define R_GL (0x05) -#define R_TCL (0x06) -#define R_BA (0x08) -#define R_BR (0x0a) -#define R_RL (0x0c) -#define R_RLA (0x0d) -#define R_REF (0x0f) -#define R_TRL (0x12) -#define R_TRLA (0x13) -#define R_RRTBI (0x14) -#define R_RRTBA (0x15) -#define R_CAI (0x16) -#define R_CREL (0x17) -#define R_RBA (0x18) -#define R_RBAC (0x19) -#define R_RBR (0x1a) -#define R_RBRC (0x1b) - -/* The first word of global linkage code. This must be modified by - filling in the correct TOC offset. */ - -#define XCOFF_GLINK_FIRST (0x81820000) /* lwz r12,0(r2) */ - -/* The remaining words of global linkage code. */ - -static unsigned long xcoff_glink_code[] = { - 0x90410014, /* stw r2,20(r1) */ - 0x800c0000, /* lwz r0,0(r12) */ - 0x804c0004, /* lwz r2,4(r12) */ - 0x7c0903a6, /* mtctr r0 */ - 0x4e800420, /* bctr */ - 0x0, /* start of traceback table */ - 0x000c8000, /* traceback table */ - 0x0 /* traceback table */ -}; - -#define XCOFF_GLINK_SIZE \ - (((sizeof xcoff_glink_code / sizeof xcoff_glink_code[0]) * 4) + 4) - -/* We reuse the SEC_ROM flag as a mark flag for garbage collection. - This flag will only be used on input sections. */ - -#define SEC_MARK (SEC_ROM) - -/* The ldhdr structure. This appears at the start of the .loader - section. */ - -struct internal_ldhdr { - /* The version number: currently always 1. */ - unsigned long l_version; - /* The number of symbol table entries. */ - bfd_size_type l_nsyms; - /* The number of relocation table entries. */ - bfd_size_type l_nreloc; - /* The length of the import file string table. */ - bfd_size_type l_istlen; - /* The number of import files. */ - bfd_size_type l_nimpid; - /* The offset from the start of the .loader section to the first - entry in the import file table. */ - bfd_size_type l_impoff; - /* The length of the string table. */ - bfd_size_type l_stlen; - /* The offset from the start of the .loader section to the first - entry in the string table. */ - bfd_size_type l_stoff; -}; - -struct external_ldhdr { - bfd_byte l_version[4]; - bfd_byte l_nsyms[4]; - bfd_byte l_nreloc[4]; - bfd_byte l_istlen[4]; - bfd_byte l_nimpid[4]; - bfd_byte l_impoff[4]; - bfd_byte l_stlen[4]; - bfd_byte l_stoff[4]; -}; - -#define LDHDRSZ (8 * 4) - -/* The ldsym structure. This is used to represent a symbol in the - .loader section. */ - -struct internal_ldsym { - union { - /* The symbol name if <= SYMNMLEN characters. */ - char _l_name[SYMNMLEN]; - struct { - /* Zero if the symbol name is more than SYMNMLEN characters. */ - long _l_zeroes; - /* The offset in the string table if the symbol name is more - than SYMNMLEN characters. */ - long _l_offset; - } _l_l; - } _l; - /* The symbol value. */ - bfd_vma l_value; - /* The symbol section number. */ - short l_scnum; - /* The symbol type and flags. */ - char l_smtype; - /* The symbol storage class. */ - char l_smclas; - /* The import file ID. */ - bfd_size_type l_ifile; - /* Offset to the parameter type check string. */ - bfd_size_type l_parm; -}; - -struct external_ldsym { - union { - bfd_byte _l_name[SYMNMLEN]; - struct { - bfd_byte _l_zeroes[4]; - bfd_byte _l_offset[4]; - } _l_l; - } _l; - bfd_byte l_value[4]; - bfd_byte l_scnum[2]; - bfd_byte l_smtype[1]; - bfd_byte l_smclas[1]; - bfd_byte l_ifile[4]; - bfd_byte l_parm[4]; -}; - -#define LDSYMSZ (8 + 3 * 4 + 2 + 2) - -/* These flags are for the l_smtype field (the lower three bits are an - XTY_* value). */ - -/* Imported symbol. */ -#define L_IMPORT (0x40) -/* Entry point. */ -#define L_ENTRY (0x20) -/* Exported symbol. */ -#define L_EXPORT (0x10) - -/* The ldrel structure. This is used to represent a reloc in the - .loader section. */ - -struct internal_ldrel { - /* The reloc address. */ - bfd_vma l_vaddr; - /* The symbol table index in the .loader section symbol table. */ - bfd_size_type l_symndx; - /* The relocation type and size. */ - short l_rtype; - /* The section number this relocation applies to. */ - short l_rsecnm; -}; - -struct external_ldrel { - bfd_byte l_vaddr[4]; - bfd_byte l_symndx[4]; - bfd_byte l_rtype[2]; - bfd_byte l_rsecnm[2]; -}; - -#define LDRELSZ (2 * 4 + 2 * 2) - -/* The list of import files. */ - -struct xcoff_import_file { - /* The next entry in the list. */ - struct xcoff_import_file *next; - /* The path. */ - const char *path; - /* The file name. */ - const char *file; - /* The member name. */ - const char *member; -}; - -/* An entry in the XCOFF linker hash table. */ - -struct xcoff_link_hash_entry { - struct bfd_link_hash_entry root; - - /* Symbol index in output file. Set to -1 initially. Set to -2 if - there is a reloc against this symbol. */ - long indx; - - /* If we have created a TOC entry for this symbol, this is the .tc - section which holds it. */ - asection *toc_section; - - union { - /* If we have created a TOC entry (the XCOFF_SET_TOC flag is set), - this is the offset in toc_section. */ - bfd_vma toc_offset; - /* If the TOC entry comes from an input file, this is set to the - symbol index of the C_HIDEXT XMC_TC or XMC_TD symbol. */ - long toc_indx; - } u; - - /* If this symbol is a function entry point which is called, this - field holds a pointer to the function descriptor. If this symbol - is a function descriptor, this field holds a pointer to the - function entry point. */ - struct xcoff_link_hash_entry *descriptor; - - /* The .loader symbol table entry, if there is one. */ - struct internal_ldsym *ldsym; - - /* If XCOFF_BUILT_LDSYM is set, this is the .loader symbol table - index. If XCOFF_BUILD_LDSYM is clear, and XCOFF_IMPORT is set, - this is the l_ifile value. */ - long ldindx; - - /* Some linker flags. */ - unsigned short flags; - /* Symbol is referenced by a regular object. */ -#define XCOFF_REF_REGULAR (01) - /* Symbol is defined by a regular object. */ -#define XCOFF_DEF_REGULAR (02) - /* Symbol is defined by a dynamic object. */ -#define XCOFF_DEF_DYNAMIC (04) - /* Symbol is used in a reloc being copied into the .loader section. */ -#define XCOFF_LDREL (010) - /* Symbol is the entry point. */ -#define XCOFF_ENTRY (020) - /* Symbol is called; this is, it appears in a R_BR reloc. */ -#define XCOFF_CALLED (040) - /* Symbol needs the TOC entry filled in. */ -#define XCOFF_SET_TOC (0100) - /* Symbol is explicitly imported. */ -#define XCOFF_IMPORT (0200) - /* Symbol is explicitly exported. */ -#define XCOFF_EXPORT (0400) - /* Symbol has been processed by xcoff_build_ldsyms. */ -#define XCOFF_BUILT_LDSYM (01000) - /* Symbol is mentioned by a section which was not garbage collected. */ -#define XCOFF_MARK (02000) - /* Symbol size is recorded in size_list list from hash table. */ -#define XCOFF_HAS_SIZE (04000) - /* Symbol is a function descriptor. */ -#define XCOFF_DESCRIPTOR (010000) - /* Multiple definitions have been for the symbol. */ -#define XCOFF_MULTIPLY_DEFINED (020000) - - /* The storage mapping class. */ - unsigned char smclas; -}; - -/* The XCOFF linker hash table. */ - -struct xcoff_link_hash_table { - struct bfd_link_hash_table root; - - /* The .debug string hash table. We need to compute this while - reading the input files, so that we know how large the .debug - section will be before we assign section positions. */ - struct bfd_strtab_hash *debug_strtab; - - /* The .debug section we will use for the final output. */ - asection *debug_section; - - /* The .loader section we will use for the final output. */ - asection *loader_section; - - /* A count of non TOC relative relocs which will need to be - allocated in the .loader section. */ - size_t ldrel_count; - - /* The .loader section header. */ - struct internal_ldhdr ldhdr; - - /* The .gl section we use to hold global linkage code. */ - asection *linkage_section; - - /* The .tc section we use to hold toc entries we build for global - linkage code. */ - asection *toc_section; - - /* The .ds section we use to hold function descriptors which we - create for exported symbols. */ - asection *descriptor_section; - - /* The list of import files. */ - struct xcoff_import_file *imports; - - /* Required alignment of sections within the output file. */ - unsigned long file_align; - - /* Whether the .text section must be read-only. */ - boolean textro; - - /* Whether garbage collection was done. */ - boolean gc; - - /* A linked list of symbols for which we have size information. */ - struct xcoff_link_size_list { - struct xcoff_link_size_list *next; - struct xcoff_link_hash_entry *h; - bfd_size_type size; - } *size_list; - - /* Magic sections: _text, _etext, _data, _edata, _end, end. */ - asection *special_sections[6]; -}; - -/* Information we keep for each section in the output file during the - final link phase. */ - -struct xcoff_link_section_info { - /* The relocs to be output. */ - struct internal_reloc *relocs; - /* For each reloc against a global symbol whose index was not known - when the reloc was handled, the global hash table entry. */ - struct xcoff_link_hash_entry **rel_hashes; - /* If there is a TOC relative reloc against a global symbol, and the - index of the TOC symbol is not known when the reloc was handled, - an entry is added to this linked list. This is not an array, - like rel_hashes, because this case is quite uncommon. */ - struct xcoff_toc_rel_hash { - struct xcoff_toc_rel_hash *next; - struct xcoff_link_hash_entry *h; - struct internal_reloc *rel; - } *toc_rel_hashes; -}; - -/* Information that we pass around while doing the final link step. */ - -struct xcoff_final_link_info { - /* General link information. */ - struct bfd_link_info *info; - /* Output BFD. */ - bfd *output_bfd; - /* Hash table for long symbol names. */ - struct bfd_strtab_hash *strtab; - /* Array of information kept for each output section, indexed by the - target_index field. */ - struct xcoff_link_section_info *section_info; - /* Symbol index of last C_FILE symbol (-1 if none). */ - long last_file_index; - /* Contents of last C_FILE symbol. */ - struct internal_syment last_file; - /* Symbol index of TOC symbol. */ - long toc_symindx; - /* Start of .loader symbols. */ - struct external_ldsym *ldsym; - /* Next .loader reloc to swap out. */ - struct external_ldrel *ldrel; - /* File position of start of line numbers. */ - file_ptr line_filepos; - /* Buffer large enough to hold swapped symbols of any input file. */ - struct internal_syment *internal_syms; - /* Buffer large enough to hold output indices of symbols of any - input file. */ - long *sym_indices; - /* Buffer large enough to hold output symbols for any input file. */ - bfd_byte *outsyms; - /* Buffer large enough to hold external line numbers for any input - section. */ - bfd_byte *linenos; - /* Buffer large enough to hold any input section. */ - bfd_byte *contents; - /* Buffer large enough to hold external relocs of any input section. */ - bfd_byte *external_relocs; -}; - -static void xcoff_swap_ldhdr_in - PARAMS ((bfd *, const struct external_ldhdr *, struct internal_ldhdr *)); -static void xcoff_swap_ldhdr_out - PARAMS ((bfd *, const struct internal_ldhdr *, struct external_ldhdr *)); -static void xcoff_swap_ldsym_in - PARAMS ((bfd *, const struct external_ldsym *, struct internal_ldsym *)); -static void xcoff_swap_ldsym_out - PARAMS ((bfd *, const struct internal_ldsym *, struct external_ldsym *)); -static void xcoff_swap_ldrel_in - PARAMS ((bfd *, const struct external_ldrel *, struct internal_ldrel *)); -static void xcoff_swap_ldrel_out - PARAMS ((bfd *, const struct internal_ldrel *, struct external_ldrel *)); -static struct bfd_hash_entry *xcoff_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static boolean xcoff_get_section_contents PARAMS ((bfd *, asection *)); -static struct internal_reloc *xcoff_read_internal_relocs - PARAMS ((bfd *, asection *, boolean, bfd_byte *, boolean, - struct internal_reloc *)); -static boolean xcoff_link_add_object_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -static boolean xcoff_link_check_archive_element - PARAMS ((bfd *, struct bfd_link_info *, boolean *)); -static boolean xcoff_link_check_ar_symbols - PARAMS ((bfd *, struct bfd_link_info *, boolean *)); -static boolean xcoff_link_check_dynamic_ar_symbols - PARAMS ((bfd *, struct bfd_link_info *, boolean *)); -static bfd_size_type xcoff_find_reloc - PARAMS ((struct internal_reloc *, bfd_size_type, bfd_vma)); -static boolean xcoff_link_add_symbols PARAMS ((bfd *, struct bfd_link_info *)); -static boolean xcoff_link_add_dynamic_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -static boolean xcoff_mark_symbol - PARAMS ((struct bfd_link_info *, struct xcoff_link_hash_entry *)); -static boolean xcoff_mark PARAMS ((struct bfd_link_info *, asection *)); -static void xcoff_sweep PARAMS ((struct bfd_link_info *)); -static boolean xcoff_build_ldsyms - PARAMS ((struct xcoff_link_hash_entry *, PTR)); -static boolean xcoff_link_input_bfd - PARAMS ((struct xcoff_final_link_info *, bfd *)); -static boolean xcoff_write_global_symbol - PARAMS ((struct xcoff_link_hash_entry *, PTR)); -static boolean xcoff_reloc_link_order - PARAMS ((bfd *, struct xcoff_final_link_info *, asection *, - struct bfd_link_order *)); -static int xcoff_sort_relocs PARAMS ((const PTR, const PTR)); - -/* Routines to swap information in the XCOFF .loader section. If we - ever need to write an XCOFF loader, this stuff will need to be - moved to another file shared by the linker (which XCOFF calls the - ``binder'') and the loader. */ - -/* Swap in the ldhdr structure. */ - -static void -xcoff_swap_ldhdr_in (abfd, src, dst) - bfd *abfd; - const struct external_ldhdr *src; - struct internal_ldhdr *dst; -{ - dst->l_version = bfd_get_32 (abfd, src->l_version); - dst->l_nsyms = bfd_get_32 (abfd, src->l_nsyms); - dst->l_nreloc = bfd_get_32 (abfd, src->l_nreloc); - dst->l_istlen = bfd_get_32 (abfd, src->l_istlen); - dst->l_nimpid = bfd_get_32 (abfd, src->l_nimpid); - dst->l_impoff = bfd_get_32 (abfd, src->l_impoff); - dst->l_stlen = bfd_get_32 (abfd, src->l_stlen); - dst->l_stoff = bfd_get_32 (abfd, src->l_stoff); -} - -/* Swap out the ldhdr structure. */ - -static void -xcoff_swap_ldhdr_out (abfd, src, dst) - bfd *abfd; - const struct internal_ldhdr *src; - struct external_ldhdr *dst; -{ - bfd_put_32 (abfd, src->l_version, dst->l_version); - bfd_put_32 (abfd, src->l_nsyms, dst->l_nsyms); - bfd_put_32 (abfd, src->l_nreloc, dst->l_nreloc); - bfd_put_32 (abfd, src->l_istlen, dst->l_istlen); - bfd_put_32 (abfd, src->l_nimpid, dst->l_nimpid); - bfd_put_32 (abfd, src->l_impoff, dst->l_impoff); - bfd_put_32 (abfd, src->l_stlen, dst->l_stlen); - bfd_put_32 (abfd, src->l_stoff, dst->l_stoff); -} - -/* Swap in the ldsym structure. */ - -static void -xcoff_swap_ldsym_in (abfd, src, dst) - bfd *abfd; - const struct external_ldsym *src; - struct internal_ldsym *dst; -{ - if (bfd_get_32 (abfd, src->_l._l_l._l_zeroes) != 0) - memcpy (dst->_l._l_name, src->_l._l_name, SYMNMLEN); - else - { - dst->_l._l_l._l_zeroes = 0; - dst->_l._l_l._l_offset = bfd_get_32 (abfd, src->_l._l_l._l_offset); - } - dst->l_value = bfd_get_32 (abfd, src->l_value); - dst->l_scnum = bfd_get_16 (abfd, src->l_scnum); - dst->l_smtype = bfd_get_8 (abfd, src->l_smtype); - dst->l_smclas = bfd_get_8 (abfd, src->l_smclas); - dst->l_ifile = bfd_get_32 (abfd, src->l_ifile); - dst->l_parm = bfd_get_32 (abfd, src->l_parm); -} - -/* Swap out the ldsym structure. */ - -static void -xcoff_swap_ldsym_out (abfd, src, dst) - bfd *abfd; - const struct internal_ldsym *src; - struct external_ldsym *dst; -{ - if (src->_l._l_l._l_zeroes != 0) - memcpy (dst->_l._l_name, src->_l._l_name, SYMNMLEN); - else - { - bfd_put_32 (abfd, 0, dst->_l._l_l._l_zeroes); - bfd_put_32 (abfd, src->_l._l_l._l_offset, dst->_l._l_l._l_offset); - } - bfd_put_32 (abfd, src->l_value, dst->l_value); - bfd_put_16 (abfd, src->l_scnum, dst->l_scnum); - bfd_put_8 (abfd, src->l_smtype, dst->l_smtype); - bfd_put_8 (abfd, src->l_smclas, dst->l_smclas); - bfd_put_32 (abfd, src->l_ifile, dst->l_ifile); - bfd_put_32 (abfd, src->l_parm, dst->l_parm); -} - -/* Swap in the ldrel structure. */ - -static void -xcoff_swap_ldrel_in (abfd, src, dst) - bfd *abfd; - const struct external_ldrel *src; - struct internal_ldrel *dst; -{ - dst->l_vaddr = bfd_get_32 (abfd, src->l_vaddr); - dst->l_symndx = bfd_get_32 (abfd, src->l_symndx); - dst->l_rtype = bfd_get_16 (abfd, src->l_rtype); - dst->l_rsecnm = bfd_get_16 (abfd, src->l_rsecnm); -} - -/* Swap out the ldrel structure. */ - -static void -xcoff_swap_ldrel_out (abfd, src, dst) - bfd *abfd; - const struct internal_ldrel *src; - struct external_ldrel *dst; -{ - bfd_put_32 (abfd, src->l_vaddr, dst->l_vaddr); - bfd_put_32 (abfd, src->l_symndx, dst->l_symndx); - bfd_put_16 (abfd, src->l_rtype, dst->l_rtype); - bfd_put_16 (abfd, src->l_rsecnm, dst->l_rsecnm); -} - -/* Routines to read XCOFF dynamic information. This don't really - belong here, but we already have the ldsym manipulation routines - here. */ - -/* Read the contents of a section. */ - -static boolean -xcoff_get_section_contents (abfd, sec) - bfd *abfd; - asection *sec; -{ - if (coff_section_data (abfd, sec) == NULL) - { - sec->used_by_bfd = bfd_zalloc (abfd, - sizeof (struct coff_section_tdata)); - if (sec->used_by_bfd == NULL) - return false; - } - - if (coff_section_data (abfd, sec)->contents == NULL) - { - coff_section_data (abfd, sec)->contents = - (bfd_byte *) bfd_malloc (sec->_raw_size); - if (coff_section_data (abfd, sec)->contents == NULL) - return false; - - if (! bfd_get_section_contents (abfd, sec, - coff_section_data (abfd, sec)->contents, - (file_ptr) 0, sec->_raw_size)) - return false; - } - - return true; -} - -/* Get the size required to hold the dynamic symbols. */ - -long -_bfd_xcoff_get_dynamic_symtab_upper_bound (abfd) - bfd *abfd; -{ - asection *lsec; - bfd_byte *contents; - struct internal_ldhdr ldhdr; - - if ((abfd->flags & DYNAMIC) == 0) - { - bfd_set_error (bfd_error_invalid_operation); - return -1; - } - - lsec = bfd_get_section_by_name (abfd, ".loader"); - if (lsec == NULL) - { - bfd_set_error (bfd_error_no_symbols); - return -1; - } - - if (! xcoff_get_section_contents (abfd, lsec)) - return -1; - contents = coff_section_data (abfd, lsec)->contents; - - xcoff_swap_ldhdr_in (abfd, (struct external_ldhdr *) contents, &ldhdr); - - return (ldhdr.l_nsyms + 1) * sizeof (asymbol *); -} - -/* Get the dynamic symbols. */ - -long -_bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms) - bfd *abfd; - asymbol **psyms; -{ - asection *lsec; - bfd_byte *contents; - struct internal_ldhdr ldhdr; - const char *strings; - struct external_ldsym *elsym, *elsymend; - coff_symbol_type *symbuf; - - if ((abfd->flags & DYNAMIC) == 0) - { - bfd_set_error (bfd_error_invalid_operation); - return -1; - } - - lsec = bfd_get_section_by_name (abfd, ".loader"); - if (lsec == NULL) - { - bfd_set_error (bfd_error_no_symbols); - return -1; - } - - if (! xcoff_get_section_contents (abfd, lsec)) - return -1; - contents = coff_section_data (abfd, lsec)->contents; - - coff_section_data (abfd, lsec)->keep_contents = true; - - xcoff_swap_ldhdr_in (abfd, (struct external_ldhdr *) contents, &ldhdr); - - strings = (char *) contents + ldhdr.l_stoff; - - symbuf = ((coff_symbol_type *) - bfd_zalloc (abfd, ldhdr.l_nsyms * sizeof (coff_symbol_type))); - if (symbuf == NULL) - return -1; - - elsym = (struct external_ldsym *) (contents + LDHDRSZ); - elsymend = elsym + ldhdr.l_nsyms; - for (; elsym < elsymend; elsym++, symbuf++, psyms++) - { - struct internal_ldsym ldsym; - - xcoff_swap_ldsym_in (abfd, elsym, &ldsym); - - symbuf->symbol.the_bfd = abfd; - - if (ldsym._l._l_l._l_zeroes == 0) - symbuf->symbol.name = strings + ldsym._l._l_l._l_offset; - else - { - int i; - - for (i = 0; i < SYMNMLEN; i++) - if (ldsym._l._l_name[i] == '\0') - break; - if (i < SYMNMLEN) - symbuf->symbol.name = (char *) elsym->_l._l_name; - else - { - char *c; - - c = bfd_alloc (abfd, SYMNMLEN + 1); - if (c == NULL) - return -1; - memcpy (c, ldsym._l._l_name, SYMNMLEN); - c[SYMNMLEN] = '\0'; - symbuf->symbol.name = c; - } - } - - if (ldsym.l_smclas == XMC_XO) - symbuf->symbol.section = bfd_abs_section_ptr; - else - symbuf->symbol.section = coff_section_from_bfd_index (abfd, - ldsym.l_scnum); - symbuf->symbol.value = ldsym.l_value - symbuf->symbol.section->vma; - - symbuf->symbol.flags = BSF_NO_FLAGS; - if ((ldsym.l_smtype & L_EXPORT) != 0) - symbuf->symbol.flags |= BSF_GLOBAL; - - /* FIXME: We have no way to record the other information stored - with the loader symbol. */ - - *psyms = (asymbol *) symbuf; - } - - *psyms = NULL; - - return ldhdr.l_nsyms; -} - -/* Get the size required to hold the dynamic relocs. */ - -long -_bfd_xcoff_get_dynamic_reloc_upper_bound (abfd) - bfd *abfd; -{ - asection *lsec; - bfd_byte *contents; - struct internal_ldhdr ldhdr; - - if ((abfd->flags & DYNAMIC) == 0) - { - bfd_set_error (bfd_error_invalid_operation); - return -1; - } - - lsec = bfd_get_section_by_name (abfd, ".loader"); - if (lsec == NULL) - { - bfd_set_error (bfd_error_no_symbols); - return -1; - } - - if (! xcoff_get_section_contents (abfd, lsec)) - return -1; - contents = coff_section_data (abfd, lsec)->contents; - - xcoff_swap_ldhdr_in (abfd, (struct external_ldhdr *) contents, &ldhdr); - - return (ldhdr.l_nreloc + 1) * sizeof (arelent *); -} - -/* The typical dynamic reloc. */ - -static reloc_howto_type xcoff_dynamic_reloc = - HOWTO (0, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - 0, /* special_function */ - "R_POS", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false); /* pcrel_offset */ - -/* Get the dynamic relocs. */ - -long -_bfd_xcoff_canonicalize_dynamic_reloc (abfd, prelocs, syms) - bfd *abfd; - arelent **prelocs; - asymbol **syms; -{ - asection *lsec; - bfd_byte *contents; - struct internal_ldhdr ldhdr; - arelent *relbuf; - struct external_ldrel *elrel, *elrelend; - - if ((abfd->flags & DYNAMIC) == 0) - { - bfd_set_error (bfd_error_invalid_operation); - return -1; - } - - lsec = bfd_get_section_by_name (abfd, ".loader"); - if (lsec == NULL) - { - bfd_set_error (bfd_error_no_symbols); - return -1; - } - - if (! xcoff_get_section_contents (abfd, lsec)) - return -1; - contents = coff_section_data (abfd, lsec)->contents; - - xcoff_swap_ldhdr_in (abfd, (struct external_ldhdr *) contents, &ldhdr); - - relbuf = (arelent *) bfd_alloc (abfd, ldhdr.l_nreloc * sizeof (arelent)); - if (relbuf == NULL) - return -1; - - elrel = ((struct external_ldrel *) - (contents + LDHDRSZ + ldhdr.l_nsyms * LDSYMSZ)); - elrelend = elrel + ldhdr.l_nreloc; - for (; elrel < elrelend; elrel++, relbuf++, prelocs++) - { - struct internal_ldrel ldrel; - - xcoff_swap_ldrel_in (abfd, elrel, &ldrel); - - if (ldrel.l_symndx >= 3) - relbuf->sym_ptr_ptr = syms + (ldrel.l_symndx - 3); - else - { - const char *name; - asection *sec; - - switch (ldrel.l_symndx) - { - case 0: - name = ".text"; - break; - case 1: - name = ".data"; - break; - case 2: - name = ".bss"; - break; - default: - abort (); - break; - } - - sec = bfd_get_section_by_name (abfd, name); - if (sec == NULL) - { - bfd_set_error (bfd_error_bad_value); - return -1; - } - - relbuf->sym_ptr_ptr = sec->symbol_ptr_ptr; - } - - relbuf->address = ldrel.l_vaddr; - relbuf->addend = 0; - - /* Most dynamic relocs have the same type. FIXME: This is only - correct if ldrel.l_rtype == 0. In other cases, we should use - a different howto. */ - relbuf->howto = &xcoff_dynamic_reloc; - - /* FIXME: We have no way to record the l_rsecnm field. */ - - *prelocs = relbuf; - } - - *prelocs = NULL; - - return ldhdr.l_nreloc; -} - -/* Routine to create an entry in an XCOFF link hash table. */ - -static struct bfd_hash_entry * -xcoff_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - struct xcoff_link_hash_entry *ret = (struct xcoff_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct xcoff_link_hash_entry *) NULL) - ret = ((struct xcoff_link_hash_entry *) - bfd_hash_allocate (table, sizeof (struct xcoff_link_hash_entry))); - if (ret == (struct xcoff_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; - - /* Call the allocation method of the superclass. */ - ret = ((struct xcoff_link_hash_entry *) - _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != NULL) - { - /* Set local fields. */ - ret->indx = -1; - ret->toc_section = NULL; - ret->u.toc_indx = -1; - ret->descriptor = NULL; - ret->ldsym = NULL; - ret->ldindx = -1; - ret->flags = 0; - ret->smclas = XMC_UA; - } - - return (struct bfd_hash_entry *) ret; -} - -/* Create a XCOFF link hash table. */ - -struct bfd_link_hash_table * -_bfd_xcoff_bfd_link_hash_table_create (abfd) - bfd *abfd; -{ - struct xcoff_link_hash_table *ret; - - ret = ((struct xcoff_link_hash_table *) - bfd_alloc (abfd, sizeof (struct xcoff_link_hash_table))); - if (ret == (struct xcoff_link_hash_table *) NULL) - return (struct bfd_link_hash_table *) NULL; - if (! _bfd_link_hash_table_init (&ret->root, abfd, xcoff_link_hash_newfunc)) - { - bfd_release (abfd, ret); - return (struct bfd_link_hash_table *) NULL; - } - - ret->debug_strtab = _bfd_xcoff_stringtab_init (); - ret->debug_section = NULL; - ret->loader_section = NULL; - ret->ldrel_count = 0; - memset (&ret->ldhdr, 0, sizeof (struct internal_ldhdr)); - ret->linkage_section = NULL; - ret->toc_section = NULL; - ret->descriptor_section = NULL; - ret->imports = NULL; - ret->file_align = 0; - ret->textro = false; - ret->gc = false; - memset (ret->special_sections, 0, sizeof ret->special_sections); - - /* The linker will always generate a full a.out header. We need to - record that fact now, before the sizeof_headers routine could be - called. */ - xcoff_data (abfd)->full_aouthdr = true; - - return &ret->root; -} - -/* Look up an entry in an XCOFF link hash table. */ - -#define xcoff_link_hash_lookup(table, string, create, copy, follow) \ - ((struct xcoff_link_hash_entry *) \ - bfd_link_hash_lookup (&(table)->root, (string), (create), (copy),\ - (follow))) - -/* Traverse an XCOFF link hash table. */ - -#define xcoff_link_hash_traverse(table, func, info) \ - (bfd_link_hash_traverse \ - (&(table)->root, \ - (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ - (info))) - -/* Get the XCOFF link hash table from the info structure. This is - just a cast. */ - -#define xcoff_hash_table(p) ((struct xcoff_link_hash_table *) ((p)->hash)) - -/* Read internal relocs for an XCOFF csect. This is a wrapper around - _bfd_coff_read_internal_relocs which tries to take advantage of any - relocs which may have been cached for the enclosing section. */ - -static struct internal_reloc * -xcoff_read_internal_relocs (abfd, sec, cache, external_relocs, - require_internal, internal_relocs) - bfd *abfd; - asection *sec; - boolean cache; - bfd_byte *external_relocs; - boolean require_internal; - struct internal_reloc *internal_relocs; -{ - if (coff_section_data (abfd, sec) != NULL - && coff_section_data (abfd, sec)->relocs == NULL - && xcoff_section_data (abfd, sec) != NULL) - { - asection *enclosing; - - enclosing = xcoff_section_data (abfd, sec)->enclosing; - - if (enclosing != NULL - && (coff_section_data (abfd, enclosing) == NULL - || coff_section_data (abfd, enclosing)->relocs == NULL) - && cache - && enclosing->reloc_count > 0) - { - if (_bfd_coff_read_internal_relocs (abfd, enclosing, true, - external_relocs, false, - (struct internal_reloc *) NULL) - == NULL) - return NULL; - } - - if (enclosing != NULL - && coff_section_data (abfd, enclosing) != NULL - && coff_section_data (abfd, enclosing)->relocs != NULL) - { - size_t off; - - off = ((sec->rel_filepos - enclosing->rel_filepos) - / bfd_coff_relsz (abfd)); - if (! require_internal) - return coff_section_data (abfd, enclosing)->relocs + off; - memcpy (internal_relocs, - coff_section_data (abfd, enclosing)->relocs + off, - sec->reloc_count * sizeof (struct internal_reloc)); - return internal_relocs; - } - } - - return _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs, - require_internal, internal_relocs); -} - -/* Given an XCOFF BFD, add symbols to the global hash table as - appropriate. */ - -boolean -_bfd_xcoff_bfd_link_add_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - switch (bfd_get_format (abfd)) - { - case bfd_object: - return xcoff_link_add_object_symbols (abfd, info); - - case bfd_archive: - /* If the archive has a map, do the usual search. We then need - to check the archive for stripped dynamic objects, because - they will not appear in the archive map even though they - should, perhaps, be included. If the archive has no map, we - just consider each object file in turn, since that apparently - is what the AIX native linker does. */ - if (bfd_has_map (abfd)) - { - if (! (_bfd_generic_link_add_archive_symbols - (abfd, info, xcoff_link_check_archive_element))) - return false; - } - - { - bfd *member; - - member = bfd_openr_next_archived_file (abfd, (bfd *) NULL); - while (member != NULL) - { - if (bfd_check_format (member, bfd_object) - && (! bfd_has_map (abfd) - || ((member->flags & DYNAMIC) != 0 - && (member->flags & HAS_SYMS) == 0))) - { - boolean needed; - - if (! xcoff_link_check_archive_element (member, info, &needed)) - return false; - if (needed) - member->archive_pass = -1; - } - member = bfd_openr_next_archived_file (abfd, member); - } - } - - return true; - - default: - bfd_set_error (bfd_error_wrong_format); - return false; - } -} - -/* Add symbols from an XCOFF object file. */ - -static boolean -xcoff_link_add_object_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - if (! _bfd_coff_get_external_symbols (abfd)) - return false; - if (! xcoff_link_add_symbols (abfd, info)) - return false; - if (! info->keep_memory) - { - if (! _bfd_coff_free_symbols (abfd)) - return false; - } - return true; -} - -/* Check a single archive element to see if we need to include it in - the link. *PNEEDED is set according to whether this element is - needed in the link or not. This is called via - _bfd_generic_link_add_archive_symbols. */ - -static boolean -xcoff_link_check_archive_element (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - boolean *pneeded; -{ - if (! _bfd_coff_get_external_symbols (abfd)) - return false; - - if (! xcoff_link_check_ar_symbols (abfd, info, pneeded)) - return false; - - if (*pneeded) - { - if (! xcoff_link_add_symbols (abfd, info)) - return false; - } - - if (! info->keep_memory || ! *pneeded) - { - if (! _bfd_coff_free_symbols (abfd)) - return false; - } - - return true; -} - -/* Look through the symbols to see if this object file should be - included in the link. */ - -static boolean -xcoff_link_check_ar_symbols (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - boolean *pneeded; -{ - bfd_size_type symesz; - bfd_byte *esym; - bfd_byte *esym_end; - - *pneeded = false; - - if ((abfd->flags & DYNAMIC) != 0 - && ! info->static_link - && info->hash->creator == abfd->xvec) - return xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded); - - symesz = bfd_coff_symesz (abfd); - esym = (bfd_byte *) obj_coff_external_syms (abfd); - esym_end = esym + obj_raw_syment_count (abfd) * symesz; - while (esym < esym_end) - { - struct internal_syment sym; - - bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym); - - if (sym.n_sclass == C_EXT && sym.n_scnum != N_UNDEF) - { - const char *name; - char buf[SYMNMLEN + 1]; - struct bfd_link_hash_entry *h; - - /* This symbol is externally visible, and is defined by this - object file. */ - - name = _bfd_coff_internal_syment_name (abfd, &sym, buf); - if (name == NULL) - return false; - h = bfd_link_hash_lookup (info->hash, name, false, false, true); - - /* We are only interested in symbols that are currently - undefined. If a symbol is currently known to be common, - XCOFF linkers do not bring in an object file which - defines it. We also don't bring in symbols to satisfy - undefined references in shared objects. */ - if (h != (struct bfd_link_hash_entry *) NULL - && h->type == bfd_link_hash_undefined - && (info->hash->creator != abfd->xvec - || (((struct xcoff_link_hash_entry *) h)->flags - & XCOFF_DEF_DYNAMIC) == 0)) - { - if (! (*info->callbacks->add_archive_element) (info, abfd, name)) - return false; - *pneeded = true; - return true; - } - } - - esym += (sym.n_numaux + 1) * symesz; - } - - /* We do not need this object file. */ - return true; -} - -/* Look through the loader symbols to see if this dynamic object - should be included in the link. The native linker uses the loader - symbols, not the normal symbol table, so we do too. */ - -static boolean -xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - boolean *pneeded; -{ - asection *lsec; - bfd_byte *buf; - struct internal_ldhdr ldhdr; - const char *strings; - struct external_ldsym *elsym, *elsymend; - - *pneeded = false; - - lsec = bfd_get_section_by_name (abfd, ".loader"); - if (lsec == NULL) - { - /* There are no symbols, so don't try to include it. */ - return true; - } - - if (! xcoff_get_section_contents (abfd, lsec)) - return false; - buf = coff_section_data (abfd, lsec)->contents; - - xcoff_swap_ldhdr_in (abfd, (struct external_ldhdr *) buf, &ldhdr); - - strings = (char *) buf + ldhdr.l_stoff; - - elsym = (struct external_ldsym *) (buf + LDHDRSZ); - elsymend = elsym + ldhdr.l_nsyms; - for (; elsym < elsymend; elsym++) - { - struct internal_ldsym ldsym; - char nambuf[SYMNMLEN + 1]; - const char *name; - struct bfd_link_hash_entry *h; - - xcoff_swap_ldsym_in (abfd, elsym, &ldsym); - - /* We are only interested in exported symbols. */ - if ((ldsym.l_smtype & L_EXPORT) == 0) - continue; - - if (ldsym._l._l_l._l_zeroes == 0) - name = strings + ldsym._l._l_l._l_offset; - else - { - memcpy (nambuf, ldsym._l._l_name, SYMNMLEN); - nambuf[SYMNMLEN] = '\0'; - name = nambuf; - } - - h = bfd_link_hash_lookup (info->hash, name, false, false, true); - - /* We are only interested in symbols that are currently - undefined. At this point we know that we are using an XCOFF - hash table. */ - if (h != NULL - && h->type == bfd_link_hash_undefined - && (((struct xcoff_link_hash_entry *) h)->flags - & XCOFF_DEF_DYNAMIC) == 0) - { - if (! (*info->callbacks->add_archive_element) (info, abfd, name)) - return false; - *pneeded = true; - return true; - } - } - - /* We do not need this shared object. */ - - if (buf != NULL && ! coff_section_data (abfd, lsec)->keep_contents) - { - free (coff_section_data (abfd, lsec)->contents); - coff_section_data (abfd, lsec)->contents = NULL; - } - - return true; -} - -/* Returns the index of reloc in RELOCS with the least address greater - than or equal to ADDRESS. The relocs are sorted by address. */ - -static bfd_size_type -xcoff_find_reloc (relocs, count, address) - struct internal_reloc *relocs; - bfd_size_type count; - bfd_vma address; -{ - bfd_size_type min, max, this; - - if (count < 2) - { - if (count == 1 && relocs[0].r_vaddr < address) - return 1; - else - return 0; - } - - min = 0; - max = count; - - /* Do a binary search over (min,max]. */ - while (min + 1 < max) - { - bfd_vma raddr; - - this = (max + min) / 2; - raddr = relocs[this].r_vaddr; - if (raddr > address) - max = this; - else if (raddr < address) - min = this; - else - { - min = this; - break; - } - } - - if (relocs[min].r_vaddr < address) - return min + 1; - - while (min > 0 - && relocs[min - 1].r_vaddr == address) - --min; - - return min; -} - -/* Add all the symbols from an object file to the hash table. - - XCOFF is a weird format. A normal XCOFF .o files will have three - COFF sections--.text, .data, and .bss--but each COFF section will - contain many csects. These csects are described in the symbol - table. From the linker's point of view, each csect must be - considered a section in its own right. For example, a TOC entry is - handled as a small XMC_TC csect. The linker must be able to merge - different TOC entries together, which means that it must be able to - extract the XMC_TC csects from the .data section of the input .o - file. - - From the point of view of our linker, this is, of course, a hideous - nightmare. We cope by actually creating sections for each csect, - and discarding the original sections. We then have to handle the - relocation entries carefully, since the only way to tell which - csect they belong to is to examine the address. */ - -static boolean -xcoff_link_add_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - unsigned int n_tmask; - unsigned int n_btshft; - boolean default_copy; - bfd_size_type symcount; - struct xcoff_link_hash_entry **sym_hash; - asection **csect_cache; - bfd_size_type linesz; - asection *o; - asection *last_real; - boolean keep_syms; - asection *csect; - unsigned int csect_index; - asection *first_csect; - bfd_size_type symesz; - bfd_byte *esym; - bfd_byte *esym_end; - struct reloc_info_struct - { - struct internal_reloc *relocs; - asection **csects; - bfd_byte *linenos; - } *reloc_info = NULL; - - keep_syms = obj_coff_keep_syms (abfd); - - if ((abfd->flags & DYNAMIC) != 0 - && ! info->static_link) - { - if (! xcoff_link_add_dynamic_symbols (abfd, info)) - return false; - } - - if (info->hash->creator == abfd->xvec) - { - /* We need to build a .loader section, so we do it here. This - won't work if we're producing an XCOFF output file with no - XCOFF input files. FIXME. */ - if (xcoff_hash_table (info)->loader_section == NULL) - { - asection *lsec; - - lsec = bfd_make_section_anyway (abfd, ".loader"); - if (lsec == NULL) - goto error_return; - xcoff_hash_table (info)->loader_section = lsec; - lsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY; - } - /* Likewise for the linkage section. */ - if (xcoff_hash_table (info)->linkage_section == NULL) - { - asection *lsec; - - lsec = bfd_make_section_anyway (abfd, ".gl"); - if (lsec == NULL) - goto error_return; - xcoff_hash_table (info)->linkage_section = lsec; - lsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY); - lsec->alignment_power = 2; - } - /* Likewise for the TOC section. */ - if (xcoff_hash_table (info)->toc_section == NULL) - { - asection *tsec; - - tsec = bfd_make_section_anyway (abfd, ".tc"); - if (tsec == NULL) - goto error_return; - xcoff_hash_table (info)->toc_section = tsec; - tsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY); - tsec->alignment_power = 2; - } - /* Likewise for the descriptor section. */ - if (xcoff_hash_table (info)->descriptor_section == NULL) - { - asection *dsec; - - dsec = bfd_make_section_anyway (abfd, ".ds"); - if (dsec == NULL) - goto error_return; - xcoff_hash_table (info)->descriptor_section = dsec; - dsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY); - dsec->alignment_power = 2; - } - /* Likewise for the .debug section. */ - if (xcoff_hash_table (info)->debug_section == NULL - && info->strip != strip_all) - { - asection *dsec; - - dsec = bfd_make_section_anyway (abfd, ".debug"); - if (dsec == NULL) - goto error_return; - xcoff_hash_table (info)->debug_section = dsec; - dsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY; - } - } - - if ((abfd->flags & DYNAMIC) != 0 - && ! info->static_link) - return true; - - n_tmask = coff_data (abfd)->local_n_tmask; - n_btshft = coff_data (abfd)->local_n_btshft; - - /* Define macros so that ISFCN, et. al., macros work correctly. */ -#define N_TMASK n_tmask -#define N_BTSHFT n_btshft - - if (info->keep_memory) - default_copy = false; - else - default_copy = true; - - symcount = obj_raw_syment_count (abfd); - - /* We keep a list of the linker hash table entries that correspond - to each external symbol. */ - sym_hash = ((struct xcoff_link_hash_entry **) - bfd_alloc (abfd, - (symcount - * sizeof (struct xcoff_link_hash_entry *)))); - if (sym_hash == NULL && symcount != 0) - goto error_return; - coff_data (abfd)->sym_hashes = (struct coff_link_hash_entry **) sym_hash; - memset (sym_hash, 0, - (size_t) symcount * sizeof (struct xcoff_link_hash_entry *)); - - /* Because of the weird stuff we are doing with XCOFF csects, we can - not easily determine which section a symbol is in, so we store - the information in the tdata for the input file. */ - csect_cache = ((asection **) - bfd_alloc (abfd, symcount * sizeof (asection *))); - if (csect_cache == NULL && symcount != 0) - goto error_return; - xcoff_data (abfd)->csects = csect_cache; - memset (csect_cache, 0, (size_t) symcount * sizeof (asection *)); - - /* While splitting sections into csects, we need to assign the - relocs correctly. The relocs and the csects must both be in - order by VMA within a given section, so we handle this by - scanning along the relocs as we process the csects. We index - into reloc_info using the section target_index. */ - reloc_info = ((struct reloc_info_struct *) - bfd_malloc ((abfd->section_count + 1) - * sizeof (struct reloc_info_struct))); - if (reloc_info == NULL) - goto error_return; - memset ((PTR) reloc_info, 0, - (abfd->section_count + 1) * sizeof (struct reloc_info_struct)); - - /* Read in the relocs and line numbers for each section. */ - linesz = bfd_coff_linesz (abfd); - last_real = NULL; - for (o = abfd->sections; o != NULL; o = o->next) - { - last_real = o; - if ((o->flags & SEC_RELOC) != 0) - { - reloc_info[o->target_index].relocs = - xcoff_read_internal_relocs (abfd, o, true, (bfd_byte *) NULL, - false, (struct internal_reloc *) NULL); - reloc_info[o->target_index].csects = - (asection **) bfd_malloc (o->reloc_count * sizeof (asection *)); - if (reloc_info[o->target_index].csects == NULL) - goto error_return; - memset (reloc_info[o->target_index].csects, 0, - o->reloc_count * sizeof (asection *)); - } - - if ((info->strip == strip_none || info->strip == strip_some) - && o->lineno_count > 0) - { - bfd_byte *linenos; - - linenos = (bfd_byte *) bfd_malloc (o->lineno_count * linesz); - if (linenos == NULL) - goto error_return; - reloc_info[o->target_index].linenos = linenos; - if (bfd_seek (abfd, o->line_filepos, SEEK_SET) != 0 - || (bfd_read (linenos, linesz, o->lineno_count, abfd) - != linesz * o->lineno_count)) - goto error_return; - } - } - - /* Don't let the linker relocation routines discard the symbols. */ - obj_coff_keep_syms (abfd) = true; - - csect = NULL; - csect_index = 0; - first_csect = NULL; - - symesz = bfd_coff_symesz (abfd); - BFD_ASSERT (symesz == bfd_coff_auxesz (abfd)); - esym = (bfd_byte *) obj_coff_external_syms (abfd); - esym_end = esym + symcount * symesz; - while (esym < esym_end) - { - struct internal_syment sym; - union internal_auxent aux; - const char *name; - char buf[SYMNMLEN + 1]; - int smtyp; - flagword flags; - asection *section; - bfd_vma value; - struct xcoff_link_hash_entry *set_toc; - - bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym); - - /* In this pass we are only interested in symbols with csect - information. */ - if (sym.n_sclass != C_EXT && sym.n_sclass != C_HIDEXT) - { - if (sym.n_sclass == C_FILE && csect != NULL) - { - xcoff_section_data (abfd, csect)->last_symndx = - ((esym - - (bfd_byte *) obj_coff_external_syms (abfd)) - / symesz); - csect = NULL; - } - - if (csect != NULL) - *csect_cache = csect; - else if (first_csect == NULL || sym.n_sclass == C_FILE) - *csect_cache = coff_section_from_bfd_index (abfd, sym.n_scnum); - else - *csect_cache = NULL; - esym += (sym.n_numaux + 1) * symesz; - sym_hash += sym.n_numaux + 1; - csect_cache += sym.n_numaux + 1; - continue; - } - - name = _bfd_coff_internal_syment_name (abfd, &sym, buf); - if (name == NULL) - goto error_return; - - /* If this symbol has line number information attached to it, - and we're not stripping it, count the number of entries and - add them to the count for this csect. In the final link pass - we are going to attach line number information by symbol, - rather than by section, in order to more easily handle - garbage collection. */ - if ((info->strip == strip_none || info->strip == strip_some) - && sym.n_numaux > 1 - && csect != NULL - && ISFCN (sym.n_type)) - { - union internal_auxent auxlin; - - bfd_coff_swap_aux_in (abfd, (PTR) (esym + symesz), - sym.n_type, sym.n_sclass, - 0, sym.n_numaux, (PTR) &auxlin); - if (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr != 0) - { - asection *enclosing; - bfd_size_type linoff; - - enclosing = xcoff_section_data (abfd, csect)->enclosing; - if (enclosing == NULL) - { - (*_bfd_error_handler) - (_("%s: `%s' has line numbers but no enclosing section"), - bfd_get_filename (abfd), name); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - linoff = (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr - - enclosing->line_filepos); - if (linoff < enclosing->lineno_count * linesz) - { - struct internal_lineno lin; - bfd_byte *linpstart; - - linpstart = (reloc_info[enclosing->target_index].linenos - + linoff); - bfd_coff_swap_lineno_in (abfd, (PTR) linpstart, (PTR) &lin); - if (lin.l_lnno == 0 - && ((bfd_size_type) lin.l_addr.l_symndx - == ((esym - - (bfd_byte *) obj_coff_external_syms (abfd)) - / symesz))) - { - bfd_byte *linpend, *linp; - - linpend = (reloc_info[enclosing->target_index].linenos - + enclosing->lineno_count * linesz); - for (linp = linpstart + linesz; - linp < linpend; - linp += linesz) - { - bfd_coff_swap_lineno_in (abfd, (PTR) linp, - (PTR) &lin); - if (lin.l_lnno == 0) - break; - } - csect->lineno_count += (linp - linpstart) / linesz; - /* The setting of line_filepos will only be - useful if all the line number entries for a - csect are contiguous; this only matters for - error reporting. */ - if (csect->line_filepos == 0) - csect->line_filepos = - auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr; - } - } - } - } - - /* Pick up the csect auxiliary information. */ - - if (sym.n_numaux == 0) - { - (*_bfd_error_handler) - (_("%s: class %d symbol `%s' has no aux entries"), - bfd_get_filename (abfd), sym.n_sclass, name); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - bfd_coff_swap_aux_in (abfd, - (PTR) (esym + symesz * sym.n_numaux), - sym.n_type, sym.n_sclass, - sym.n_numaux - 1, sym.n_numaux, - (PTR) &aux); - - smtyp = SMTYP_SMTYP (aux.x_csect.x_smtyp); - - flags = BSF_GLOBAL; - section = NULL; - value = 0; - set_toc = NULL; - - switch (smtyp) - { - default: - (*_bfd_error_handler) - (_("%s: symbol `%s' has unrecognized csect type %d"), - bfd_get_filename (abfd), name, smtyp); - bfd_set_error (bfd_error_bad_value); - goto error_return; - - case XTY_ER: - /* This is an external reference. */ - if (sym.n_sclass == C_HIDEXT - || sym.n_scnum != N_UNDEF - || aux.x_csect.x_scnlen.l != 0) - { - (*_bfd_error_handler) - (_("%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"), - bfd_get_filename (abfd), name, sym.n_sclass, sym.n_scnum, - aux.x_csect.x_scnlen.l); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - /* An XMC_XO external reference is actually a reference to - an absolute location. */ - if (aux.x_csect.x_smclas != XMC_XO) - section = bfd_und_section_ptr; - else - { - section = bfd_abs_section_ptr; - value = sym.n_value; - } - break; - - case XTY_SD: - /* This is a csect definition. */ - - if (csect != NULL) - { - xcoff_section_data (abfd, csect)->last_symndx = - ((esym - - (bfd_byte *) obj_coff_external_syms (abfd)) - / symesz); - } - - csect = NULL; - csect_index = -1; - - /* When we see a TOC anchor, we record the TOC value. */ - if (aux.x_csect.x_smclas == XMC_TC0) - { - if (sym.n_sclass != C_HIDEXT - || aux.x_csect.x_scnlen.l != 0) - { - (*_bfd_error_handler) - (_("%s: XMC_TC0 symbol `%s' is class %d scnlen %d"), - bfd_get_filename (abfd), name, sym.n_sclass, - aux.x_csect.x_scnlen.l); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - xcoff_data (abfd)->toc = sym.n_value; - } - - /* We must merge TOC entries for the same symbol. We can - merge two TOC entries if they are both C_HIDEXT, they - both have the same name, they are both 4 bytes long, and - they both have a relocation table entry for an external - symbol with the same name. Unfortunately, this means - that we must look through the relocations. Ick. */ - if (aux.x_csect.x_smclas == XMC_TC - && sym.n_sclass == C_HIDEXT - && aux.x_csect.x_scnlen.l == 4 - && info->hash->creator == abfd->xvec) - { - asection *enclosing; - struct internal_reloc *relocs; - bfd_size_type relindx; - struct internal_reloc *rel; - - enclosing = coff_section_from_bfd_index (abfd, sym.n_scnum); - if (enclosing == NULL) - goto error_return; - - relocs = reloc_info[enclosing->target_index].relocs; - relindx = xcoff_find_reloc (relocs, enclosing->reloc_count, - sym.n_value); - rel = relocs + relindx; - if (relindx < enclosing->reloc_count - && rel->r_vaddr == (bfd_vma) sym.n_value - && rel->r_size == 31 - && rel->r_type == R_POS) - { - bfd_byte *erelsym; - struct internal_syment relsym; - - erelsym = ((bfd_byte *) obj_coff_external_syms (abfd) - + rel->r_symndx * symesz); - bfd_coff_swap_sym_in (abfd, (PTR) erelsym, (PTR) &relsym); - if (relsym.n_sclass == C_EXT) - { - const char *relname; - char relbuf[SYMNMLEN + 1]; - boolean copy; - struct xcoff_link_hash_entry *h; - - /* At this point we know that the TOC entry is - for an externally visible symbol. */ - relname = _bfd_coff_internal_syment_name (abfd, &relsym, - relbuf); - if (relname == NULL) - goto error_return; - - /* We only merge TOC entries if the TC name is - the same as the symbol name. This handles - the normal case, but not common cases like - SYM.P4 which gcc generates to store SYM + 4 - in the TOC. FIXME. */ - if (strcmp (name, relname) == 0) - { - copy = (! info->keep_memory - || relsym._n._n_n._n_zeroes != 0 - || relsym._n._n_n._n_offset == 0); - h = xcoff_link_hash_lookup (xcoff_hash_table (info), - relname, true, copy, - false); - if (h == NULL) - goto error_return; - - /* At this point h->root.type could be - bfd_link_hash_new. That should be OK, - since we know for sure that we will come - across this symbol as we step through the - file. */ - - /* We store h in *sym_hash for the - convenience of the relocate_section - function. */ - *sym_hash = h; - - if (h->toc_section != NULL) - { - asection **rel_csects; - - /* We already have a TOC entry for this - symbol, so we can just ignore this - one. */ - rel_csects = - reloc_info[enclosing->target_index].csects; - rel_csects[relindx] = bfd_und_section_ptr; - break; - } - - /* We are about to create a TOC entry for - this symbol. */ - set_toc = h; - } - } - } - } - - /* We need to create a new section. We get the name from - the csect storage mapping class, so that the linker can - accumulate similar csects together. */ - { - static const char *csect_name_by_class[] = { - ".pr", ".ro", ".db", ".tc", ".ua", ".rw", ".gl", ".xo", - ".sv", ".bs", ".ds", ".uc", ".ti", ".tb", NULL, ".tc0", - ".td" - }; - const char *csect_name; - asection *enclosing; - - if ((aux.x_csect.x_smclas >= - sizeof csect_name_by_class / sizeof csect_name_by_class[0]) - || csect_name_by_class[aux.x_csect.x_smclas] == NULL) - { - (*_bfd_error_handler) - (_("%s: symbol `%s' has unrecognized smclas %d"), - bfd_get_filename (abfd), name, aux.x_csect.x_smclas); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - csect_name = csect_name_by_class[aux.x_csect.x_smclas]; - csect = bfd_make_section_anyway (abfd, csect_name); - if (csect == NULL) - goto error_return; - enclosing = coff_section_from_bfd_index (abfd, sym.n_scnum); - if (enclosing == NULL) - goto error_return; - if (! bfd_is_abs_section (enclosing) - && ((bfd_vma) sym.n_value < enclosing->vma - || ((bfd_vma) sym.n_value + aux.x_csect.x_scnlen.l - > enclosing->vma + enclosing->_raw_size))) - { - (*_bfd_error_handler) - (_("%s: csect `%s' not in enclosing section"), - bfd_get_filename (abfd), name); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - csect->vma = sym.n_value; - csect->filepos = (enclosing->filepos - + sym.n_value - - enclosing->vma); - csect->_raw_size = aux.x_csect.x_scnlen.l; - csect->flags |= SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; - csect->alignment_power = SMTYP_ALIGN (aux.x_csect.x_smtyp); - - /* Record the enclosing section in the tdata for this new - section. */ - csect->used_by_bfd = - (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)); - if (csect->used_by_bfd == NULL) - goto error_return; - coff_section_data (abfd, csect)->tdata = - bfd_zalloc (abfd, sizeof (struct xcoff_section_tdata)); - if (coff_section_data (abfd, csect)->tdata == NULL) - goto error_return; - xcoff_section_data (abfd, csect)->enclosing = enclosing; - xcoff_section_data (abfd, csect)->lineno_count = - enclosing->lineno_count; - - if (enclosing->owner == abfd) - { - struct internal_reloc *relocs; - bfd_size_type relindx; - struct internal_reloc *rel; - asection **rel_csect; - - relocs = reloc_info[enclosing->target_index].relocs; - relindx = xcoff_find_reloc (relocs, enclosing->reloc_count, - csect->vma); - rel = relocs + relindx; - rel_csect = (reloc_info[enclosing->target_index].csects - + relindx); - csect->rel_filepos = (enclosing->rel_filepos - + relindx * bfd_coff_relsz (abfd)); - while (relindx < enclosing->reloc_count - && *rel_csect == NULL - && rel->r_vaddr < csect->vma + csect->_raw_size) - { - *rel_csect = csect; - csect->flags |= SEC_RELOC; - ++csect->reloc_count; - ++relindx; - ++rel; - ++rel_csect; - } - } - - /* There are a number of other fields and section flags - which we do not bother to set. */ - - csect_index = ((esym - - (bfd_byte *) obj_coff_external_syms (abfd)) - / symesz); - - xcoff_section_data (abfd, csect)->first_symndx = csect_index; - - if (first_csect == NULL) - first_csect = csect; - - /* If this symbol is C_EXT, we treat it as starting at the - beginning of the newly created section. */ - if (sym.n_sclass == C_EXT) - { - section = csect; - value = 0; - } - - /* If this is a TOC section for a symbol, record it. */ - if (set_toc != NULL) - set_toc->toc_section = csect; - } - break; - - case XTY_LD: - /* This is a label definition. The x_scnlen field is the - symbol index of the csect. I believe that this must - always follow the appropriate XTY_SD symbol, so I will - insist on it. */ - { - boolean bad; - - bad = false; - if (aux.x_csect.x_scnlen.l < 0 - || (aux.x_csect.x_scnlen.l - >= esym - (bfd_byte *) obj_coff_external_syms (abfd))) - bad = true; - if (! bad) - { - section = xcoff_data (abfd)->csects[aux.x_csect.x_scnlen.l]; - if (section == NULL - || (section->flags & SEC_HAS_CONTENTS) == 0) - bad = true; - } - if (bad) - { - (*_bfd_error_handler) - (_("%s: misplaced XTY_LD `%s'"), - bfd_get_filename (abfd), name); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - value = sym.n_value - csect->vma; - } - break; - - case XTY_CM: - /* This is an unitialized csect. We could base the name on - the storage mapping class, but we don't bother except for - an XMC_TD symbol. If this csect is externally visible, - it is a common symbol. We put XMC_TD symbols in sections - named .tocbss, and rely on the linker script to put that - in the TOC area. */ - - if (csect != NULL) - { - xcoff_section_data (abfd, csect)->last_symndx = - ((esym - - (bfd_byte *) obj_coff_external_syms (abfd)) - / symesz); - } - - if (aux.x_csect.x_smclas == XMC_TD) - csect = bfd_make_section_anyway (abfd, ".tocbss"); - else - csect = bfd_make_section_anyway (abfd, ".bss"); - if (csect == NULL) - goto error_return; - csect->vma = sym.n_value; - csect->_raw_size = aux.x_csect.x_scnlen.l; - csect->flags |= SEC_ALLOC; - csect->alignment_power = SMTYP_ALIGN (aux.x_csect.x_smtyp); - /* There are a number of other fields and section flags - which we do not bother to set. */ - - csect_index = ((esym - - (bfd_byte *) obj_coff_external_syms (abfd)) - / symesz); - - csect->used_by_bfd = - (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)); - if (csect->used_by_bfd == NULL) - goto error_return; - coff_section_data (abfd, csect)->tdata = - bfd_zalloc (abfd, sizeof (struct xcoff_section_tdata)); - if (coff_section_data (abfd, csect)->tdata == NULL) - goto error_return; - xcoff_section_data (abfd, csect)->first_symndx = csect_index; - - if (first_csect == NULL) - first_csect = csect; - - if (sym.n_sclass == C_EXT) - { - csect->flags |= SEC_IS_COMMON; - csect->_raw_size = 0; - section = csect; - value = aux.x_csect.x_scnlen.l; - } - - break; - } - - /* Check for magic symbol names. */ - if ((smtyp == XTY_SD || smtyp == XTY_CM) - && aux.x_csect.x_smclas != XMC_TC - && aux.x_csect.x_smclas != XMC_TD) - { - int i; - - i = -1; - if (name[0] == '_') - { - if (strcmp (name, "_text") == 0) - i = 0; - else if (strcmp (name, "_etext") == 0) - i = 1; - else if (strcmp (name, "_data") == 0) - i = 2; - else if (strcmp (name, "_edata") == 0) - i = 3; - else if (strcmp (name, "_end") == 0) - i = 4; - } - else if (name[0] == 'e' && strcmp (name, "end") == 0) - i = 5; - - if (i != -1) - xcoff_hash_table (info)->special_sections[i] = csect; - } - - /* Now we have enough information to add the symbol to the - linker hash table. */ - - if (sym.n_sclass == C_EXT) - { - boolean copy; - - BFD_ASSERT (section != NULL); - - /* We must copy the name into memory if we got it from the - syment itself, rather than the string table. */ - copy = default_copy; - if (sym._n._n_n._n_zeroes != 0 - || sym._n._n_n._n_offset == 0) - copy = true; - - /* The AIX linker appears to only detect multiple symbol - definitions when there is a reference to the symbol. If - a symbol is defined multiple times, and the only - references are from the same object file, the AIX linker - appears to permit it. It does not merge the different - definitions, but handles them independently. On the - other hand, if there is a reference, the linker reports - an error. - - This matters because the AIX <net/net_globals.h> header - file actually defines an initialized array, so we have to - actually permit that to work. - - Just to make matters even more confusing, the AIX linker - appears to permit multiple symbol definitions whenever - the second definition is in an archive rather than an - object file. This may be a consequence of the manner in - which it handles archives: I think it may load the entire - archive in as separate csects, and then let garbage - collection discard symbols. - - We also have to handle the case of statically linking a - shared object, which will cause symbol redefinitions, - although this is an easier case to detect. */ - - if (info->hash->creator == abfd->xvec) - { - if (! bfd_is_und_section (section)) - *sym_hash = xcoff_link_hash_lookup (xcoff_hash_table (info), - name, true, copy, false); - else - *sym_hash = ((struct xcoff_link_hash_entry *) - bfd_wrapped_link_hash_lookup (abfd, info, name, - true, copy, false)); - if (*sym_hash == NULL) - goto error_return; - if (((*sym_hash)->root.type == bfd_link_hash_defined - || (*sym_hash)->root.type == bfd_link_hash_defweak) - && ! bfd_is_und_section (section) - && ! bfd_is_com_section (section)) - { - /* This is a second definition of a defined symbol. */ - if ((abfd->flags & DYNAMIC) != 0 - && ((*sym_hash)->smclas != XMC_GL - || aux.x_csect.x_smclas == XMC_GL - || ((*sym_hash)->root.u.def.section->owner->flags - & DYNAMIC) == 0)) - { - /* The new symbol is from a shared library, and - either the existing symbol is not global - linkage code or this symbol is global linkage - code. If the existing symbol is global - linkage code and the new symbol is not, then - we want to use the new symbol. */ - section = bfd_und_section_ptr; - value = 0; - } - else if (((*sym_hash)->root.u.def.section->owner->flags - & DYNAMIC) != 0) - { - /* The existing symbol is from a shared library. - Replace it. */ - (*sym_hash)->root.type = bfd_link_hash_undefined; - (*sym_hash)->root.u.undef.abfd = - (*sym_hash)->root.u.def.section->owner; - } - else if (abfd->my_archive != NULL) - { - /* This is a redefinition in an object contained - in an archive. Just ignore it. See the - comment above. */ - section = bfd_und_section_ptr; - value = 0; - } - else if ((*sym_hash)->root.next != NULL - || info->hash->undefs_tail == &(*sym_hash)->root) - { - /* This symbol has been referenced. In this - case, we just continue and permit the - multiple definition error. See the comment - above about the behaviour of the AIX linker. */ - } - else if ((*sym_hash)->smclas == aux.x_csect.x_smclas) - { - /* The symbols are both csects of the same - class. There is at least a chance that this - is a semi-legitimate redefinition. */ - section = bfd_und_section_ptr; - value = 0; - (*sym_hash)->flags |= XCOFF_MULTIPLY_DEFINED; - } - } - else if (((*sym_hash)->flags & XCOFF_MULTIPLY_DEFINED) != 0 - && ((*sym_hash)->root.type == bfd_link_hash_defined - || (*sym_hash)->root.type == bfd_link_hash_defweak) - && (bfd_is_und_section (section) - || bfd_is_com_section (section))) - { - /* This is a reference to a multiply defined symbol. - Report the error now. See the comment above - about the behaviour of the AIX linker. We could - also do this with warning symbols, but I'm not - sure the XCOFF linker is wholly prepared to - handle them, and that would only be a warning, - not an error. */ - if (! ((*info->callbacks->multiple_definition) - (info, (*sym_hash)->root.root.string, - (bfd *) NULL, (asection *) NULL, 0, - (*sym_hash)->root.u.def.section->owner, - (*sym_hash)->root.u.def.section, - (*sym_hash)->root.u.def.value))) - goto error_return; - /* Try not to give this error too many times. */ - (*sym_hash)->flags &= ~XCOFF_MULTIPLY_DEFINED; - } - } - - /* _bfd_generic_link_add_one_symbol may call the linker to - generate an error message, and the linker may try to read - the symbol table to give a good error. Right now, the - line numbers are in an inconsistent state, since they are - counted both in the real sections and in the new csects. - We need to leave the count in the real sections so that - the linker can report the line number of the error - correctly, so temporarily clobber the link to the csects - so that the linker will not try to read the line numbers - a second time from the csects. */ - BFD_ASSERT (last_real->next == first_csect); - last_real->next = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, name, flags, section, value, - (const char *) NULL, copy, true, - (struct bfd_link_hash_entry **) sym_hash))) - goto error_return; - last_real->next = first_csect; - - if (smtyp == XTY_CM) - { - if ((*sym_hash)->root.type != bfd_link_hash_common - || (*sym_hash)->root.u.c.p->section != csect) - { - /* We don't need the common csect we just created. */ - csect->_raw_size = 0; - } - else - { - (*sym_hash)->root.u.c.p->alignment_power - = csect->alignment_power; - } - } - - if (info->hash->creator == abfd->xvec) - { - int flag; - - if (smtyp == XTY_ER || smtyp == XTY_CM) - flag = XCOFF_REF_REGULAR; - else - flag = XCOFF_DEF_REGULAR; - (*sym_hash)->flags |= flag; - - if ((*sym_hash)->smclas == XMC_UA - || flag == XCOFF_DEF_REGULAR) - (*sym_hash)->smclas = aux.x_csect.x_smclas; - } - } - - *csect_cache = csect; - - esym += (sym.n_numaux + 1) * symesz; - sym_hash += sym.n_numaux + 1; - csect_cache += sym.n_numaux + 1; - } - - BFD_ASSERT (last_real == NULL || last_real->next == first_csect); - - /* Make sure that we have seen all the relocs. */ - for (o = abfd->sections; o != first_csect; o = o->next) - { - /* Reset the section size and the line number count, since the - data is now attached to the csects. Don't reset the size of - the .debug section, since we need to read it below in - bfd_xcoff_size_dynamic_sections. */ - if (strcmp (bfd_get_section_name (abfd, o), ".debug") != 0) - o->_raw_size = 0; - o->lineno_count = 0; - - if ((o->flags & SEC_RELOC) != 0) - { - bfd_size_type i; - struct internal_reloc *rel; - asection **rel_csect; - - rel = reloc_info[o->target_index].relocs; - rel_csect = reloc_info[o->target_index].csects; - for (i = 0; i < o->reloc_count; i++, rel++, rel_csect++) - { - if (*rel_csect == NULL) - { - (*_bfd_error_handler) - (_("%s: reloc %s:%d not in csect"), - bfd_get_filename (abfd), o->name, i); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - /* We identify all symbols which are called, so that we - can create glue code for calls to functions imported - from dynamic objects. */ - if (info->hash->creator == abfd->xvec - && *rel_csect != bfd_und_section_ptr - && (rel->r_type == R_BR - || rel->r_type == R_RBR) - && obj_xcoff_sym_hashes (abfd)[rel->r_symndx] != NULL) - { - struct xcoff_link_hash_entry *h; - - h = obj_xcoff_sym_hashes (abfd)[rel->r_symndx]; - h->flags |= XCOFF_CALLED; - /* If the symbol name starts with a period, it is - the code of a function. If the symbol is - currently undefined, then add an undefined symbol - for the function descriptor. This should do no - harm, because any regular object that defines the - function should also define the function - descriptor. It helps, because it means that we - will identify the function descriptor with a - dynamic object if a dynamic object defines it. */ - if (h->root.root.string[0] == '.' - && h->descriptor == NULL) - { - struct xcoff_link_hash_entry *hds; - - hds = xcoff_link_hash_lookup (xcoff_hash_table (info), - h->root.root.string + 1, - true, false, true); - if (hds == NULL) - goto error_return; - if (hds->root.type == bfd_link_hash_new) - { - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, hds->root.root.string, - (flagword) 0, bfd_und_section_ptr, - (bfd_vma) 0, (const char *) NULL, false, - true, - (struct bfd_link_hash_entry **) &hds))) - goto error_return; - } - hds->flags |= XCOFF_DESCRIPTOR; - BFD_ASSERT ((hds->flags & XCOFF_CALLED) == 0 - && (h->flags & XCOFF_DESCRIPTOR) == 0); - hds->descriptor = h; - h->descriptor = hds; - } - } - } - - free (reloc_info[o->target_index].csects); - reloc_info[o->target_index].csects = NULL; - - /* Reset SEC_RELOC and the reloc_count, since the reloc - information is now attached to the csects. */ - o->flags &= ~SEC_RELOC; - o->reloc_count = 0; - - /* If we are not keeping memory, free the reloc information. */ - if (! info->keep_memory - && coff_section_data (abfd, o) != NULL - && coff_section_data (abfd, o)->relocs != NULL - && ! coff_section_data (abfd, o)->keep_relocs) - { - free (coff_section_data (abfd, o)->relocs); - coff_section_data (abfd, o)->relocs = NULL; - } - } - - /* Free up the line numbers. FIXME: We could cache these - somewhere for the final link, to avoid reading them again. */ - if (reloc_info[o->target_index].linenos != NULL) - { - free (reloc_info[o->target_index].linenos); - reloc_info[o->target_index].linenos = NULL; - } - } - - free (reloc_info); - - obj_coff_keep_syms (abfd) = keep_syms; - - return true; - - error_return: - if (reloc_info != NULL) - { - for (o = abfd->sections; o != NULL; o = o->next) - { - if (reloc_info[o->target_index].csects != NULL) - free (reloc_info[o->target_index].csects); - if (reloc_info[o->target_index].linenos != NULL) - free (reloc_info[o->target_index].linenos); - } - free (reloc_info); - } - obj_coff_keep_syms (abfd) = keep_syms; - return false; -} - -#undef N_TMASK -#undef N_BTSHFT - -/* This function is used to add symbols from a dynamic object to the - global symbol table. */ - -static boolean -xcoff_link_add_dynamic_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - asection *lsec; - bfd_byte *buf; - struct internal_ldhdr ldhdr; - const char *strings; - struct external_ldsym *elsym, *elsymend; - struct xcoff_import_file *n; - const char *bname; - const char *mname; - const char *s; - unsigned int c; - struct xcoff_import_file **pp; - - /* We can only handle a dynamic object if we are generating an XCOFF - output file. */ - if (info->hash->creator != abfd->xvec) - { - (*_bfd_error_handler) - (_("%s: XCOFF shared object when not producing XCOFF output"), - bfd_get_filename (abfd)); - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - /* The symbols we use from a dynamic object are not the symbols in - the normal symbol table, but, rather, the symbols in the export - table. If there is a global symbol in a dynamic object which is - not in the export table, the loader will not be able to find it, - so we don't want to find it either. Also, on AIX 4.1.3, shr.o in - libc.a has symbols in the export table which are not in the - symbol table. */ - - /* Read in the .loader section. FIXME: We should really use the - o_snloader field in the a.out header, rather than grabbing the - section by name. */ - lsec = bfd_get_section_by_name (abfd, ".loader"); - if (lsec == NULL) - { - (*_bfd_error_handler) - (_("%s: dynamic object with no .loader section"), - bfd_get_filename (abfd)); - bfd_set_error (bfd_error_no_symbols); - return false; - } - - if (! xcoff_get_section_contents (abfd, lsec)) - return false; - buf = coff_section_data (abfd, lsec)->contents; - - /* Remove the sections from this object, so that they do not get - included in the link. */ - abfd->sections = NULL; - - xcoff_swap_ldhdr_in (abfd, (struct external_ldhdr *) buf, &ldhdr); - - strings = (char *) buf + ldhdr.l_stoff; - - elsym = (struct external_ldsym *) (buf + LDHDRSZ); - elsymend = elsym + ldhdr.l_nsyms; - BFD_ASSERT (sizeof (struct external_ldsym) == LDSYMSZ); - for (; elsym < elsymend; elsym++) - { - struct internal_ldsym ldsym; - char nambuf[SYMNMLEN + 1]; - const char *name; - struct xcoff_link_hash_entry *h; - - xcoff_swap_ldsym_in (abfd, elsym, &ldsym); - - /* We are only interested in exported symbols. */ - if ((ldsym.l_smtype & L_EXPORT) == 0) - continue; - - if (ldsym._l._l_l._l_zeroes == 0) - name = strings + ldsym._l._l_l._l_offset; - else - { - memcpy (nambuf, ldsym._l._l_name, SYMNMLEN); - nambuf[SYMNMLEN] = '\0'; - name = nambuf; - } - - /* Normally we could not call xcoff_link_hash_lookup in an add - symbols routine, since we might not be using an XCOFF hash - table. However, we verified above that we are using an XCOFF - hash table. */ - - h = xcoff_link_hash_lookup (xcoff_hash_table (info), name, true, - true, true); - if (h == NULL) - return false; - - h->flags |= XCOFF_DEF_DYNAMIC; - - /* If the symbol is undefined, and the BFD it was found in is - not a dynamic object, change the BFD to this dynamic object, - so that we can get the correct import file ID. */ - if ((h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak) - && (h->root.u.undef.abfd == NULL - || (h->root.u.undef.abfd->flags & DYNAMIC) == 0)) - h->root.u.undef.abfd = abfd; - - if (h->root.type == bfd_link_hash_new) - { - h->root.type = bfd_link_hash_undefined; - h->root.u.undef.abfd = abfd; - /* We do not want to add this to the undefined symbol list. */ - } - - if (h->smclas == XMC_UA - || h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak) - h->smclas = ldsym.l_smclas; - - /* Unless this is an XMC_XO symbol, we don't bother to actually - define it, since we don't have a section to put it in anyhow. - Instead, the relocation routines handle the DEF_DYNAMIC flag - correctly. */ - - if (h->smclas == XMC_XO - && (h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak)) - { - /* This symbol has an absolute value. */ - h->root.type = bfd_link_hash_defined; - h->root.u.def.section = bfd_abs_section_ptr; - h->root.u.def.value = ldsym.l_value; - } - - /* If this symbol defines a function descriptor, then it - implicitly defines the function code as well. */ - if (h->smclas == XMC_DS - || (h->smclas == XMC_XO && name[0] != '.')) - h->flags |= XCOFF_DESCRIPTOR; - if ((h->flags & XCOFF_DESCRIPTOR) != 0) - { - struct xcoff_link_hash_entry *hds; - - hds = h->descriptor; - if (hds == NULL) - { - char *dsnm; - - dsnm = bfd_malloc (strlen (name) + 2); - if (dsnm == NULL) - return false; - dsnm[0] = '.'; - strcpy (dsnm + 1, name); - hds = xcoff_link_hash_lookup (xcoff_hash_table (info), dsnm, - true, true, true); - free (dsnm); - if (hds == NULL) - return false; - - if (hds->root.type == bfd_link_hash_new) - { - hds->root.type = bfd_link_hash_undefined; - hds->root.u.undef.abfd = abfd; - /* We do not want to add this to the undefined - symbol list. */ - } - - hds->descriptor = h; - h->descriptor = hds; - } - - hds->flags |= XCOFF_DEF_DYNAMIC; - if (hds->smclas == XMC_UA) - hds->smclas = XMC_PR; - - /* An absolute symbol appears to actually define code, not a - function descriptor. This is how some math functions are - implemented on AIX 4.1. */ - if (h->smclas == XMC_XO - && (hds->root.type == bfd_link_hash_undefined - || hds->root.type == bfd_link_hash_undefweak)) - { - hds->smclas = XMC_XO; - hds->root.type = bfd_link_hash_defined; - hds->root.u.def.section = bfd_abs_section_ptr; - hds->root.u.def.value = ldsym.l_value; - } - } - } - - if (buf != NULL && ! coff_section_data (abfd, lsec)->keep_contents) - { - free (coff_section_data (abfd, lsec)->contents); - coff_section_data (abfd, lsec)->contents = NULL; - } - - /* Record this file in the import files. */ - - n = ((struct xcoff_import_file *) - bfd_alloc (abfd, sizeof (struct xcoff_import_file))); - if (n == NULL) - return false; - n->next = NULL; - - /* For some reason, the path entry in the import file list for a - shared object appears to always be empty. The file name is the - base name. */ - n->path = ""; - if (abfd->my_archive == NULL) - { - bname = bfd_get_filename (abfd); - mname = ""; - } - else - { - bname = bfd_get_filename (abfd->my_archive); - mname = bfd_get_filename (abfd); - } - s = strrchr (bname, '/'); - if (s != NULL) - bname = s + 1; - n->file = bname; - n->member = mname; - - /* We start c at 1 because the first import file number is reserved - for LIBPATH. */ - for (pp = &xcoff_hash_table (info)->imports, c = 1; - *pp != NULL; - pp = &(*pp)->next, ++c) - ; - *pp = n; - - xcoff_data (abfd)->import_file_id = c; - - return true; -} - -/* Routines that are called after all the input files have been - handled, but before the sections are laid out in memory. */ - -/* Mark a symbol as not being garbage, including the section in which - it is defined. */ - -static INLINE boolean -xcoff_mark_symbol (info, h) - struct bfd_link_info *info; - struct xcoff_link_hash_entry *h; -{ - if ((h->flags & XCOFF_MARK) != 0) - return true; - - h->flags |= XCOFF_MARK; - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - asection *hsec; - - hsec = h->root.u.def.section; - if (! bfd_is_abs_section (hsec) - && (hsec->flags & SEC_MARK) == 0) - { - if (! xcoff_mark (info, hsec)) - return false; - } - } - - if (h->toc_section != NULL - && (h->toc_section->flags & SEC_MARK) == 0) - { - if (! xcoff_mark (info, h->toc_section)) - return false; - } - - return true; -} - -/* The mark phase of garbage collection. For a given section, mark - it, and all the sections which define symbols to which it refers. - Because this function needs to look at the relocs, we also count - the number of relocs which need to be copied into the .loader - section. */ - -static boolean -xcoff_mark (info, sec) - struct bfd_link_info *info; - asection *sec; -{ - if (bfd_is_abs_section (sec) - || (sec->flags & SEC_MARK) != 0) - return true; - - sec->flags |= SEC_MARK; - - if (sec->owner->xvec == info->hash->creator - && coff_section_data (sec->owner, sec) != NULL - && xcoff_section_data (sec->owner, sec) != NULL) - { - register struct xcoff_link_hash_entry **hp, **hpend; - struct internal_reloc *rel, *relend; - - /* Mark all the symbols in this section. */ - - hp = (obj_xcoff_sym_hashes (sec->owner) - + xcoff_section_data (sec->owner, sec)->first_symndx); - hpend = (obj_xcoff_sym_hashes (sec->owner) - + xcoff_section_data (sec->owner, sec)->last_symndx); - for (; hp < hpend; hp++) - { - register struct xcoff_link_hash_entry *h; - - h = *hp; - if (h != NULL - && (h->flags & XCOFF_MARK) == 0) - { - if (! xcoff_mark_symbol (info, h)) - return false; - } - } - - /* Look through the section relocs. */ - - if ((sec->flags & SEC_RELOC) != 0 - && sec->reloc_count > 0) - { - rel = xcoff_read_internal_relocs (sec->owner, sec, true, - (bfd_byte *) NULL, false, - (struct internal_reloc *) NULL); - if (rel == NULL) - return false; - relend = rel + sec->reloc_count; - for (; rel < relend; rel++) - { - asection *rsec; - struct xcoff_link_hash_entry *h; - - if ((unsigned int) rel->r_symndx - > obj_raw_syment_count (sec->owner)) - continue; - - h = obj_xcoff_sym_hashes (sec->owner)[rel->r_symndx]; - if (h != NULL - && (h->flags & XCOFF_MARK) == 0) - { - if (! xcoff_mark_symbol (info, h)) - return false; - } - - rsec = xcoff_data (sec->owner)->csects[rel->r_symndx]; - if (rsec != NULL - && (rsec->flags & SEC_MARK) == 0) - { - if (! xcoff_mark (info, rsec)) - return false; - } - - /* See if this reloc needs to be copied into the .loader - section. */ - switch (rel->r_type) - { - default: - if (h == NULL - || h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak - || h->root.type == bfd_link_hash_common - || ((h->flags & XCOFF_CALLED) != 0 - && (h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak) - && h->root.root.string[0] == '.' - && h->descriptor != NULL - && ((h->descriptor->flags & XCOFF_DEF_DYNAMIC) != 0 - || ((h->descriptor->flags & XCOFF_IMPORT) != 0 - && (h->descriptor->flags - & XCOFF_DEF_REGULAR) == 0)))) - break; - /* Fall through. */ - case R_POS: - case R_NEG: - case R_RL: - case R_RLA: - ++xcoff_hash_table (info)->ldrel_count; - if (h != NULL) - h->flags |= XCOFF_LDREL; - break; - case R_TOC: - case R_GL: - case R_TCL: - case R_TRL: - case R_TRLA: - /* We should never need a .loader reloc for a TOC - relative reloc. */ - break; - } - } - - if (! info->keep_memory - && coff_section_data (sec->owner, sec) != NULL - && coff_section_data (sec->owner, sec)->relocs != NULL - && ! coff_section_data (sec->owner, sec)->keep_relocs) - { - free (coff_section_data (sec->owner, sec)->relocs); - coff_section_data (sec->owner, sec)->relocs = NULL; - } - } - } - - return true; -} - -/* The sweep phase of garbage collection. Remove all garbage - sections. */ - -static void -xcoff_sweep (info) - struct bfd_link_info *info; -{ - bfd *sub; - - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - { - asection *o; - - for (o = sub->sections; o != NULL; o = o->next) - { - if ((o->flags & SEC_MARK) == 0) - { - /* Keep all sections from non-XCOFF input files. Keep - special sections. Keep .debug sections for the - moment. */ - if (sub->xvec != info->hash->creator - || o == xcoff_hash_table (info)->debug_section - || o == xcoff_hash_table (info)->loader_section - || o == xcoff_hash_table (info)->linkage_section - || o == xcoff_hash_table (info)->toc_section - || o == xcoff_hash_table (info)->descriptor_section - || strcmp (o->name, ".debug") == 0) - o->flags |= SEC_MARK; - else - { - o->_raw_size = 0; - o->reloc_count = 0; - o->lineno_count = 0; - } - } - } - } -} - -/* Record the number of elements in a set. This is used to output the - correct csect length. */ - -boolean -bfd_xcoff_link_record_set (output_bfd, info, harg, size) - bfd *output_bfd; - struct bfd_link_info *info; - struct bfd_link_hash_entry *harg; - bfd_size_type size; -{ - struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg; - struct xcoff_link_size_list *n; - - if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) - return true; - - /* This will hardly ever be called. I don't want to burn four bytes - per global symbol, so instead the size is kept on a linked list - attached to the hash table. */ - - n = ((struct xcoff_link_size_list *) - bfd_alloc (output_bfd, sizeof (struct xcoff_link_size_list))); - if (n == NULL) - return false; - n->next = xcoff_hash_table (info)->size_list; - n->h = h; - n->size = size; - xcoff_hash_table (info)->size_list = n; - - h->flags |= XCOFF_HAS_SIZE; - - return true; -} - -/* Import a symbol. */ - -boolean -bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile, - impmember) - bfd *output_bfd; - struct bfd_link_info *info; - struct bfd_link_hash_entry *harg; - bfd_vma val; - const char *imppath; - const char *impfile; - const char *impmember; -{ - struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg; - - if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) - return true; - - /* A symbol name which starts with a period is the code for a - function. If the symbol is undefined, then add an undefined - symbol for the function descriptor, and import that instead. */ - if (h->root.root.string[0] == '.' - && h->root.type == bfd_link_hash_undefined - && val == (bfd_vma) -1) - { - struct xcoff_link_hash_entry *hds; - - hds = h->descriptor; - if (hds == NULL) - { - hds = xcoff_link_hash_lookup (xcoff_hash_table (info), - h->root.root.string + 1, - true, false, true); - if (hds == NULL) - return false; - if (hds->root.type == bfd_link_hash_new) - { - hds->root.type = bfd_link_hash_undefined; - hds->root.u.undef.abfd = h->root.u.undef.abfd; - } - hds->flags |= XCOFF_DESCRIPTOR; - BFD_ASSERT ((hds->flags & XCOFF_CALLED) == 0 - && (h->flags & XCOFF_DESCRIPTOR) == 0); - hds->descriptor = h; - h->descriptor = hds; - } - - /* Now, if the descriptor is undefined, import the descriptor - rather than the symbol we were told to import. FIXME: Is - this correct in all cases? */ - if (hds->root.type == bfd_link_hash_undefined) - h = hds; - } - - h->flags |= XCOFF_IMPORT; - - if (val != (bfd_vma) -1) - { - if (h->root.type == bfd_link_hash_defined - && (! bfd_is_abs_section (h->root.u.def.section) - || h->root.u.def.value != val)) - { - if (! ((*info->callbacks->multiple_definition) - (info, h->root.root.string, h->root.u.def.section->owner, - h->root.u.def.section, h->root.u.def.value, - output_bfd, bfd_abs_section_ptr, val))) - return false; - } - - h->root.type = bfd_link_hash_defined; - h->root.u.def.section = bfd_abs_section_ptr; - h->root.u.def.value = val; - } - - /* We overload the ldindx field to hold the l_ifile value for this - symbol. */ - BFD_ASSERT (h->ldsym == NULL); - BFD_ASSERT ((h->flags & XCOFF_BUILT_LDSYM) == 0); - if (imppath == NULL) - h->ldindx = -1; - else - { - unsigned int c; - struct xcoff_import_file **pp; - - /* We start c at 1 because the first entry in the import list is - reserved for the library search path. */ - for (pp = &xcoff_hash_table (info)->imports, c = 1; - *pp != NULL; - pp = &(*pp)->next, ++c) - { - if (strcmp ((*pp)->path, imppath) == 0 - && strcmp ((*pp)->file, impfile) == 0 - && strcmp ((*pp)->member, impmember) == 0) - break; - } - - if (*pp == NULL) - { - struct xcoff_import_file *n; - - n = ((struct xcoff_import_file *) - bfd_alloc (output_bfd, sizeof (struct xcoff_import_file))); - if (n == NULL) - return false; - n->next = NULL; - n->path = imppath; - n->file = impfile; - n->member = impmember; - *pp = n; - } - - h->ldindx = c; - } - - return true; -} - -/* Export a symbol. */ - -boolean -bfd_xcoff_export_symbol (output_bfd, info, harg, syscall) - bfd *output_bfd; - struct bfd_link_info *info; - struct bfd_link_hash_entry *harg; - boolean syscall ATTRIBUTE_UNUSED; -{ - struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg; - - if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) - return true; - - h->flags |= XCOFF_EXPORT; - - /* FIXME: I'm not at all sure what syscall is supposed to mean, so - I'm just going to ignore it until somebody explains it. */ - - /* See if this is a function descriptor. It may be one even though - it is not so marked. */ - if ((h->flags & XCOFF_DESCRIPTOR) == 0 - && h->root.root.string[0] != '.') - { - char *fnname; - struct xcoff_link_hash_entry *hfn; - - fnname = (char *) bfd_malloc (strlen (h->root.root.string) + 2); - if (fnname == NULL) - return false; - fnname[0] = '.'; - strcpy (fnname + 1, h->root.root.string); - hfn = xcoff_link_hash_lookup (xcoff_hash_table (info), - fnname, false, false, true); - free (fnname); - if (hfn != NULL - && hfn->smclas == XMC_PR - && (hfn->root.type == bfd_link_hash_defined - || hfn->root.type == bfd_link_hash_defweak)) - { - h->flags |= XCOFF_DESCRIPTOR; - h->descriptor = hfn; - hfn->descriptor = h; - } - } - - /* Make sure we don't garbage collect this symbol. */ - if (! xcoff_mark_symbol (info, h)) - return false; - - /* If this is a function descriptor, make sure we don't garbage - collect the associated function code. We normally don't have to - worry about this, because the descriptor will be attached to a - section with relocs, but if we are creating the descriptor - ourselves those relocs will not be visible to the mark code. */ - if ((h->flags & XCOFF_DESCRIPTOR) != 0) - { - if (! xcoff_mark_symbol (info, h->descriptor)) - return false; - } - - return true; -} - -/* Count a reloc against a symbol. This is called for relocs - generated by the linker script, typically for global constructors - and destructors. */ - -boolean -bfd_xcoff_link_count_reloc (output_bfd, info, name) - bfd *output_bfd; - struct bfd_link_info *info; - const char *name; -{ - struct xcoff_link_hash_entry *h; - - if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) - return true; - - h = ((struct xcoff_link_hash_entry *) - bfd_wrapped_link_hash_lookup (output_bfd, info, name, false, false, - false)); - if (h == NULL) - { - (*_bfd_error_handler) (_("%s: no such symbol"), name); - bfd_set_error (bfd_error_no_symbols); - return false; - } - - h->flags |= XCOFF_REF_REGULAR | XCOFF_LDREL; - ++xcoff_hash_table (info)->ldrel_count; - - /* Mark the symbol to avoid garbage collection. */ - if (! xcoff_mark_symbol (info, h)) - return false; - - return true; -} - -/* This function is called for each symbol to which the linker script - assigns a value. */ - -boolean -bfd_xcoff_record_link_assignment (output_bfd, info, name) - bfd *output_bfd; - struct bfd_link_info *info; - const char *name; -{ - struct xcoff_link_hash_entry *h; - - if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) - return true; - - h = xcoff_link_hash_lookup (xcoff_hash_table (info), name, true, true, - false); - if (h == NULL) - return false; - - h->flags |= XCOFF_DEF_REGULAR; - - return true; -} - -/* This structure is used to pass information through - xcoff_link_hash_traverse. */ - -struct xcoff_loader_info { - /* Set if a problem occurred. */ - boolean failed; - /* Output BFD. */ - bfd *output_bfd; - /* Link information structure. */ - struct bfd_link_info *info; - /* Whether all defined symbols should be exported. */ - boolean export_defineds; - /* Number of ldsym structures. */ - size_t ldsym_count; - /* Size of string table. */ - size_t string_size; - /* String table. */ - bfd_byte *strings; - /* Allocated size of string table. */ - size_t string_alc; -}; - -/* Build the .loader section. This is called by the XCOFF linker - emulation before_allocation routine. We must set the size of the - .loader section before the linker lays out the output file. - LIBPATH is the library path to search for shared objects; this is - normally built from the -L arguments passed to the linker. ENTRY - is the name of the entry point symbol (the -e linker option). - FILE_ALIGN is the alignment to use for sections within the file - (the -H linker option). MAXSTACK is the maximum stack size (the - -bmaxstack linker option). MAXDATA is the maximum data size (the - -bmaxdata linker option). GC is whether to do garbage collection - (the -bgc linker option). MODTYPE is the module type (the - -bmodtype linker option). TEXTRO is whether the text section must - be read only (the -btextro linker option). EXPORT_DEFINEDS is - whether all defined symbols should be exported (the -unix linker - option). SPECIAL_SECTIONS is set by this routine to csects with - magic names like _end. */ - -boolean -bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, - file_align, maxstack, maxdata, gc, - modtype, textro, export_defineds, - special_sections) - bfd *output_bfd; - struct bfd_link_info *info; - const char *libpath; - const char *entry; - unsigned long file_align; - unsigned long maxstack; - unsigned long maxdata; - boolean gc; - int modtype; - boolean textro; - boolean export_defineds; - asection **special_sections; -{ - struct xcoff_link_hash_entry *hentry; - asection *lsec; - struct xcoff_loader_info ldinfo; - int i; - size_t impsize, impcount; - struct xcoff_import_file *fl; - struct internal_ldhdr *ldhdr; - bfd_size_type stoff; - register char *out; - asection *sec; - bfd *sub; - struct bfd_strtab_hash *debug_strtab; - bfd_byte *debug_contents = NULL; - - if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) - { - for (i = 0; i < 6; i++) - special_sections[i] = NULL; - return true; - } - - ldinfo.failed = false; - ldinfo.output_bfd = output_bfd; - ldinfo.info = info; - ldinfo.export_defineds = export_defineds; - ldinfo.ldsym_count = 0; - ldinfo.string_size = 0; - ldinfo.strings = NULL; - ldinfo.string_alc = 0; - - xcoff_data (output_bfd)->maxstack = maxstack; - xcoff_data (output_bfd)->maxdata = maxdata; - xcoff_data (output_bfd)->modtype = modtype; - - xcoff_hash_table (info)->file_align = file_align; - xcoff_hash_table (info)->textro = textro; - - if (entry == NULL) - hentry = NULL; - else - { - hentry = xcoff_link_hash_lookup (xcoff_hash_table (info), entry, - false, false, true); - if (hentry != NULL) - hentry->flags |= XCOFF_ENTRY; - } - - /* Garbage collect unused sections. */ - if (info->relocateable - || ! gc - || hentry == NULL - || (hentry->root.type != bfd_link_hash_defined - && hentry->root.type != bfd_link_hash_defweak)) - { - gc = false; - xcoff_hash_table (info)->gc = false; - - /* We still need to call xcoff_mark, in order to set ldrel_count - correctly. */ - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - { - asection *o; - - for (o = sub->sections; o != NULL; o = o->next) - { - if ((o->flags & SEC_MARK) == 0) - { - if (! xcoff_mark (info, o)) - goto error_return; - } - } - } - } - else - { - if (! xcoff_mark (info, hentry->root.u.def.section)) - goto error_return; - xcoff_sweep (info); - xcoff_hash_table (info)->gc = true; - } - - /* Return special sections to the caller. */ - for (i = 0; i < 6; i++) - { - asection *sec; - - sec = xcoff_hash_table (info)->special_sections[i]; - if (sec != NULL - && gc - && (sec->flags & SEC_MARK) == 0) - sec = NULL; - special_sections[i] = sec; - } - - if (info->input_bfds == NULL) - { - /* I'm not sure what to do in this bizarre case. */ - return true; - } - - xcoff_link_hash_traverse (xcoff_hash_table (info), xcoff_build_ldsyms, - (PTR) &ldinfo); - if (ldinfo.failed) - goto error_return; - - /* Work out the size of the import file names. Each import file ID - consists of three null terminated strings: the path, the file - name, and the archive member name. The first entry in the list - of names is the path to use to find objects, which the linker has - passed in as the libpath argument. For some reason, the path - entry in the other import file names appears to always be empty. */ - impsize = strlen (libpath) + 3; - impcount = 1; - for (fl = xcoff_hash_table (info)->imports; fl != NULL; fl = fl->next) - { - ++impcount; - impsize += (strlen (fl->path) - + strlen (fl->file) - + strlen (fl->member) - + 3); - } - - /* Set up the .loader section header. */ - ldhdr = &xcoff_hash_table (info)->ldhdr; - ldhdr->l_version = 1; - ldhdr->l_nsyms = ldinfo.ldsym_count; - ldhdr->l_nreloc = xcoff_hash_table (info)->ldrel_count; - ldhdr->l_istlen = impsize; - ldhdr->l_nimpid = impcount; - ldhdr->l_impoff = (LDHDRSZ - + ldhdr->l_nsyms * LDSYMSZ - + ldhdr->l_nreloc * LDRELSZ); - ldhdr->l_stlen = ldinfo.string_size; - stoff = ldhdr->l_impoff + impsize; - if (ldinfo.string_size == 0) - ldhdr->l_stoff = 0; - else - ldhdr->l_stoff = stoff; - - /* We now know the final size of the .loader section. Allocate - space for it. */ - lsec = xcoff_hash_table (info)->loader_section; - lsec->_raw_size = stoff + ldhdr->l_stlen; - lsec->contents = (bfd_byte *) bfd_zalloc (output_bfd, lsec->_raw_size); - if (lsec->contents == NULL) - goto error_return; - - /* Set up the header. */ - xcoff_swap_ldhdr_out (output_bfd, ldhdr, - (struct external_ldhdr *) lsec->contents); - - /* Set up the import file names. */ - out = (char *) lsec->contents + ldhdr->l_impoff; - strcpy (out, libpath); - out += strlen (libpath) + 1; - *out++ = '\0'; - *out++ = '\0'; - for (fl = xcoff_hash_table (info)->imports; fl != NULL; fl = fl->next) - { - register const char *s; - - s = fl->path; - while ((*out++ = *s++) != '\0') - ; - s = fl->file; - while ((*out++ = *s++) != '\0') - ; - s = fl->member; - while ((*out++ = *s++) != '\0') - ; - } - - BFD_ASSERT ((bfd_size_type) ((bfd_byte *) out - lsec->contents) == stoff); - - /* Set up the symbol string table. */ - if (ldinfo.string_size > 0) - { - memcpy (out, ldinfo.strings, ldinfo.string_size); - free (ldinfo.strings); - ldinfo.strings = NULL; - } - - /* We can't set up the symbol table or the relocs yet, because we - don't yet know the final position of the various sections. The - .loader symbols are written out when the corresponding normal - symbols are written out in xcoff_link_input_bfd or - xcoff_write_global_symbol. The .loader relocs are written out - when the corresponding normal relocs are handled in - xcoff_link_input_bfd. */ - - /* Allocate space for the magic sections. */ - sec = xcoff_hash_table (info)->linkage_section; - if (sec->_raw_size > 0) - { - sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size); - if (sec->contents == NULL) - goto error_return; - } - sec = xcoff_hash_table (info)->toc_section; - if (sec->_raw_size > 0) - { - sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size); - if (sec->contents == NULL) - goto error_return; - } - sec = xcoff_hash_table (info)->descriptor_section; - if (sec->_raw_size > 0) - { - sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size); - if (sec->contents == NULL) - goto error_return; - } - - /* Now that we've done garbage collection, figure out the contents - of the .debug section. */ - debug_strtab = xcoff_hash_table (info)->debug_strtab; - - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - { - asection *subdeb; - bfd_size_type symcount; - unsigned long *debug_index; - asection **csectpp; - bfd_byte *esym, *esymend; - bfd_size_type symesz; - - if (sub->xvec != info->hash->creator) - continue; - subdeb = bfd_get_section_by_name (sub, ".debug"); - if (subdeb == NULL || subdeb->_raw_size == 0) - continue; - - if (info->strip == strip_all - || info->strip == strip_debugger - || info->discard == discard_all) - { - subdeb->_raw_size = 0; - continue; - } - - if (! _bfd_coff_get_external_symbols (sub)) - goto error_return; - - symcount = obj_raw_syment_count (sub); - debug_index = ((unsigned long *) - bfd_zalloc (sub, symcount * sizeof (unsigned long))); - if (debug_index == NULL) - goto error_return; - xcoff_data (sub)->debug_indices = debug_index; - - /* Grab the contents of the .debug section. We use malloc and - copy the names into the debug stringtab, rather than - bfd_alloc, because I expect that, when linking many files - together, many of the strings will be the same. Storing the - strings in the hash table should save space in this case. */ - debug_contents = (bfd_byte *) bfd_malloc (subdeb->_raw_size); - if (debug_contents == NULL) - goto error_return; - if (! bfd_get_section_contents (sub, subdeb, (PTR) debug_contents, - (file_ptr) 0, subdeb->_raw_size)) - goto error_return; - - csectpp = xcoff_data (sub)->csects; - - symesz = bfd_coff_symesz (sub); - esym = (bfd_byte *) obj_coff_external_syms (sub); - esymend = esym + symcount * symesz; - while (esym < esymend) - { - struct internal_syment sym; - - bfd_coff_swap_sym_in (sub, (PTR) esym, (PTR) &sym); - - *debug_index = (unsigned long) -1; - - if (sym._n._n_n._n_zeroes == 0 - && *csectpp != NULL - && (! gc - || ((*csectpp)->flags & SEC_MARK) != 0 - || *csectpp == bfd_abs_section_ptr) - && bfd_coff_symname_in_debug (sub, &sym)) - { - char *name; - bfd_size_type indx; - - name = (char *) debug_contents + sym._n._n_n._n_offset; - indx = _bfd_stringtab_add (debug_strtab, name, true, true); - if (indx == (bfd_size_type) -1) - goto error_return; - *debug_index = indx; - } - - esym += (sym.n_numaux + 1) * symesz; - csectpp += sym.n_numaux + 1; - debug_index += sym.n_numaux + 1; - } - - free (debug_contents); - debug_contents = NULL; - - /* Clear the size of subdeb, so that it is not included directly - in the output file. */ - subdeb->_raw_size = 0; - - if (! info->keep_memory) - { - if (! _bfd_coff_free_symbols (sub)) - goto error_return; - } - } - - if (info->strip != strip_all) - xcoff_hash_table (info)->debug_section->_raw_size = - _bfd_stringtab_size (debug_strtab); - - return true; - - error_return: - if (ldinfo.strings != NULL) - free (ldinfo.strings); - if (debug_contents != NULL) - free (debug_contents); - return false; -} - -/* Add a symbol to the .loader symbols, if necessary. */ - -static boolean -xcoff_build_ldsyms (h, p) - struct xcoff_link_hash_entry *h; - PTR p; -{ - struct xcoff_loader_info *ldinfo = (struct xcoff_loader_info *) p; - size_t len; - - /* If this is a final link, and the symbol was defined as a common - symbol in a regular object file, and there was no definition in - any dynamic object, then the linker will have allocated space for - the symbol in a common section but the XCOFF_DEF_REGULAR flag - will not have been set. */ - if (h->root.type == bfd_link_hash_defined - && (h->flags & XCOFF_DEF_REGULAR) == 0 - && (h->flags & XCOFF_REF_REGULAR) != 0 - && (h->flags & XCOFF_DEF_DYNAMIC) == 0 - && (bfd_is_abs_section (h->root.u.def.section) - || (h->root.u.def.section->owner->flags & DYNAMIC) == 0)) - h->flags |= XCOFF_DEF_REGULAR; - - /* If all defined symbols should be exported, mark them now. We - don't want to export the actual functions, just the function - descriptors. */ - if (ldinfo->export_defineds - && (h->flags & XCOFF_DEF_REGULAR) != 0 - && h->root.root.string[0] != '.') - { - boolean export; - - /* We don't export a symbol which is being defined by an object - included from an archive which contains a shared object. The - rationale is that if an archive contains both an unshared and - a shared object, then there must be some reason that the - unshared object is unshared, and we don't want to start - providing a shared version of it. In particular, this solves - a bug involving the _savefNN set of functions. gcc will call - those functions without providing a slot to restore the TOC, - so it is essential that these functions be linked in directly - and not from a shared object, which means that a shared - object which also happens to link them in must not export - them. This is confusing, but I haven't been able to think of - a different approach. Note that the symbols can, of course, - be exported explicitly. */ - export = true; - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && h->root.u.def.section->owner != NULL - && h->root.u.def.section->owner->my_archive != NULL) - { - bfd *arbfd, *member; - - arbfd = h->root.u.def.section->owner->my_archive; - member = bfd_openr_next_archived_file (arbfd, (bfd *) NULL); - while (member != NULL) - { - if ((member->flags & DYNAMIC) != 0) - { - export = false; - break; - } - member = bfd_openr_next_archived_file (arbfd, member); - } - } - - if (export) - h->flags |= XCOFF_EXPORT; - } - - /* We don't want to garbage collect symbols which are not defined in - XCOFF files. This is a convenient place to mark them. */ - if (xcoff_hash_table (ldinfo->info)->gc - && (h->flags & XCOFF_MARK) == 0 - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && (h->root.u.def.section->owner == NULL - || (h->root.u.def.section->owner->xvec - != ldinfo->info->hash->creator))) - h->flags |= XCOFF_MARK; - - /* If this symbol is called and defined in a dynamic object, or it - is imported, then we need to set up global linkage code for it. - (Unless we did garbage collection and we didn't need this - symbol.) */ - if ((h->flags & XCOFF_CALLED) != 0 - && (h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak) - && h->root.root.string[0] == '.' - && h->descriptor != NULL - && ((h->descriptor->flags & XCOFF_DEF_DYNAMIC) != 0 - || ((h->descriptor->flags & XCOFF_IMPORT) != 0 - && (h->descriptor->flags & XCOFF_DEF_REGULAR) == 0)) - && (! xcoff_hash_table (ldinfo->info)->gc - || (h->flags & XCOFF_MARK) != 0)) - { - asection *sec; - struct xcoff_link_hash_entry *hds; - - sec = xcoff_hash_table (ldinfo->info)->linkage_section; - h->root.type = bfd_link_hash_defined; - h->root.u.def.section = sec; - h->root.u.def.value = sec->_raw_size; - h->smclas = XMC_GL; - h->flags |= XCOFF_DEF_REGULAR; - sec->_raw_size += XCOFF_GLINK_SIZE; - - /* The global linkage code requires a TOC entry for the - descriptor. */ - hds = h->descriptor; - BFD_ASSERT ((hds->root.type == bfd_link_hash_undefined - || hds->root.type == bfd_link_hash_undefweak) - && (hds->flags & XCOFF_DEF_REGULAR) == 0); - hds->flags |= XCOFF_MARK; - if (hds->toc_section == NULL) - { - hds->toc_section = xcoff_hash_table (ldinfo->info)->toc_section; - hds->u.toc_offset = hds->toc_section->_raw_size; - hds->toc_section->_raw_size += 4; - ++xcoff_hash_table (ldinfo->info)->ldrel_count; - ++hds->toc_section->reloc_count; - hds->indx = -2; - hds->flags |= XCOFF_SET_TOC | XCOFF_LDREL; - - /* We need to call xcoff_build_ldsyms recursively here, - because we may already have passed hds on the traversal. */ - xcoff_build_ldsyms (hds, p); - } - } - - /* If this symbol is exported, but not defined, we need to try to - define it. */ - if ((h->flags & XCOFF_EXPORT) != 0 - && (h->flags & XCOFF_IMPORT) == 0 - && (h->flags & XCOFF_DEF_REGULAR) == 0 - && (h->flags & XCOFF_DEF_DYNAMIC) == 0 - && (h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak)) - { - if ((h->flags & XCOFF_DESCRIPTOR) != 0 - && (h->descriptor->root.type == bfd_link_hash_defined - || h->descriptor->root.type == bfd_link_hash_defweak)) - { - asection *sec; - - /* This is an undefined function descriptor associated with - a defined entry point. We can build up a function - descriptor ourselves. Believe it or not, the AIX linker - actually does this, and there are cases where we need to - do it as well. */ - sec = xcoff_hash_table (ldinfo->info)->descriptor_section; - h->root.type = bfd_link_hash_defined; - h->root.u.def.section = sec; - h->root.u.def.value = sec->_raw_size; - h->smclas = XMC_DS; - h->flags |= XCOFF_DEF_REGULAR; - sec->_raw_size += 12; - - /* A function descriptor uses two relocs: one for the - associated code, and one for the TOC address. */ - xcoff_hash_table (ldinfo->info)->ldrel_count += 2; - sec->reloc_count += 2; - - /* We handle writing out the contents of the descriptor in - xcoff_write_global_symbol. */ - } - else - { - (*_bfd_error_handler) - (_("warning: attempt to export undefined symbol `%s'"), - h->root.root.string); - h->ldsym = NULL; - return true; - } - } - - /* If this is still a common symbol, and it wasn't garbage - collected, we need to actually allocate space for it in the .bss - section. */ - if (h->root.type == bfd_link_hash_common - && (! xcoff_hash_table (ldinfo->info)->gc - || (h->flags & XCOFF_MARK) != 0) - && h->root.u.c.p->section->_raw_size == 0) - { - BFD_ASSERT (bfd_is_com_section (h->root.u.c.p->section)); - h->root.u.c.p->section->_raw_size = h->root.u.c.size; - } - - /* We need to add a symbol to the .loader section if it is mentioned - in a reloc which we are copying to the .loader section and it was - not defined or common, or if it is the entry point, or if it is - being exported. */ - - if (((h->flags & XCOFF_LDREL) == 0 - || h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak - || h->root.type == bfd_link_hash_common) - && (h->flags & XCOFF_ENTRY) == 0 - && (h->flags & XCOFF_EXPORT) == 0) - { - h->ldsym = NULL; - return true; - } - - /* We don't need to add this symbol if we did garbage collection and - we did not mark this symbol. */ - if (xcoff_hash_table (ldinfo->info)->gc - && (h->flags & XCOFF_MARK) == 0) - { - h->ldsym = NULL; - return true; - } - - /* We may have already processed this symbol due to the recursive - call above. */ - if ((h->flags & XCOFF_BUILT_LDSYM) != 0) - return true; - - /* We need to add this symbol to the .loader symbols. */ - - BFD_ASSERT (h->ldsym == NULL); - h->ldsym = ((struct internal_ldsym *) - bfd_zalloc (ldinfo->output_bfd, - sizeof (struct internal_ldsym))); - if (h->ldsym == NULL) - { - ldinfo->failed = true; - return false; - } - - if ((h->flags & XCOFF_IMPORT) != 0) - h->ldsym->l_ifile = h->ldindx; - - /* The first 3 symbol table indices are reserved to indicate the - sections. */ - h->ldindx = ldinfo->ldsym_count + 3; - - ++ldinfo->ldsym_count; - - len = strlen (h->root.root.string); - if (len <= SYMNMLEN) - strncpy (h->ldsym->_l._l_name, h->root.root.string, SYMNMLEN); - else - { - if (ldinfo->string_size + len + 3 > ldinfo->string_alc) - { - size_t newalc; - bfd_byte *newstrings; - - newalc = ldinfo->string_alc * 2; - if (newalc == 0) - newalc = 32; - while (ldinfo->string_size + len + 3 > newalc) - newalc *= 2; - - newstrings = ((bfd_byte *) - bfd_realloc ((PTR) ldinfo->strings, newalc)); - if (newstrings == NULL) - { - ldinfo->failed = true; - return false; - } - ldinfo->string_alc = newalc; - ldinfo->strings = newstrings; - } - - bfd_put_16 (ldinfo->output_bfd, len + 1, - ldinfo->strings + ldinfo->string_size); - strcpy (ldinfo->strings + ldinfo->string_size + 2, h->root.root.string); - h->ldsym->_l._l_l._l_zeroes = 0; - h->ldsym->_l._l_l._l_offset = ldinfo->string_size + 2; - ldinfo->string_size += len + 3; - } - - h->flags |= XCOFF_BUILT_LDSYM; - - return true; -} - -/* Do the final link step. */ - -boolean -_bfd_xcoff_bfd_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - bfd_size_type symesz; - struct xcoff_final_link_info finfo; - asection *o; - struct bfd_link_order *p; - size_t max_contents_size; - size_t max_sym_count; - size_t max_lineno_count; - size_t max_reloc_count; - size_t max_output_reloc_count; - file_ptr rel_filepos; - unsigned int relsz; - file_ptr line_filepos; - unsigned int linesz; - bfd *sub; - bfd_byte *external_relocs = NULL; - char strbuf[STRING_SIZE_SIZE]; - - if (info->shared) - abfd->flags |= DYNAMIC; - - symesz = bfd_coff_symesz (abfd); - - finfo.info = info; - finfo.output_bfd = abfd; - finfo.strtab = NULL; - finfo.section_info = NULL; - finfo.last_file_index = -1; - finfo.toc_symindx = -1; - finfo.internal_syms = NULL; - finfo.sym_indices = NULL; - finfo.outsyms = NULL; - finfo.linenos = NULL; - finfo.contents = NULL; - finfo.external_relocs = NULL; - - finfo.ldsym = ((struct external_ldsym *) - (xcoff_hash_table (info)->loader_section->contents - + LDHDRSZ)); - finfo.ldrel = ((struct external_ldrel *) - (xcoff_hash_table (info)->loader_section->contents - + LDHDRSZ - + xcoff_hash_table (info)->ldhdr.l_nsyms * LDSYMSZ)); - - xcoff_data (abfd)->coff.link_info = info; - - finfo.strtab = _bfd_stringtab_init (); - if (finfo.strtab == NULL) - goto error_return; - - /* Count the line number and relocation entries required for the - output file. Determine a few maximum sizes. */ - max_contents_size = 0; - max_lineno_count = 0; - max_reloc_count = 0; - for (o = abfd->sections; o != NULL; o = o->next) - { - o->reloc_count = 0; - o->lineno_count = 0; - for (p = o->link_order_head; p != NULL; p = p->next) - { - if (p->type == bfd_indirect_link_order) - { - asection *sec; - - sec = p->u.indirect.section; - - /* Mark all sections which are to be included in the - link. This will normally be every section. We need - to do this so that we can identify any sections which - the linker has decided to not include. */ - sec->linker_mark = true; - - if (info->strip == strip_none - || info->strip == strip_some) - o->lineno_count += sec->lineno_count; - - o->reloc_count += sec->reloc_count; - - if (sec->_raw_size > max_contents_size) - max_contents_size = sec->_raw_size; - if (sec->lineno_count > max_lineno_count) - max_lineno_count = sec->lineno_count; - if (coff_section_data (sec->owner, sec) != NULL - && xcoff_section_data (sec->owner, sec) != NULL - && (xcoff_section_data (sec->owner, sec)->lineno_count - > max_lineno_count)) - max_lineno_count = - xcoff_section_data (sec->owner, sec)->lineno_count; - if (sec->reloc_count > max_reloc_count) - max_reloc_count = sec->reloc_count; - } - else if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - ++o->reloc_count; - } - } - - /* Compute the file positions for all the sections. */ - if (abfd->output_has_begun) - { - if (xcoff_hash_table (info)->file_align != 0) - abort (); - } - else - { - bfd_vma file_align; - - file_align = xcoff_hash_table (info)->file_align; - if (file_align != 0) - { - boolean saw_contents; - int indx; - asection **op; - file_ptr sofar; - - /* Insert .pad sections before every section which has - contents and is loaded, if it is preceded by some other - section which has contents and is loaded. */ - saw_contents = true; - for (op = &abfd->sections; *op != NULL; op = &(*op)->next) - { - if (strcmp ((*op)->name, ".pad") == 0) - saw_contents = false; - else if (((*op)->flags & SEC_HAS_CONTENTS) != 0 - && ((*op)->flags & SEC_LOAD) != 0) - { - if (! saw_contents) - saw_contents = true; - else - { - asection *n, *hold; - - hold = *op; - *op = NULL; - n = bfd_make_section_anyway (abfd, ".pad"); - BFD_ASSERT (*op == n); - n->next = hold; - n->flags = SEC_HAS_CONTENTS; - n->alignment_power = 0; - saw_contents = false; - } - } - } - - /* Reset the section indices after inserting the new - sections. */ - indx = 0; - for (o = abfd->sections; o != NULL; o = o->next) - { - ++indx; - o->target_index = indx; - } - BFD_ASSERT ((unsigned int) indx == abfd->section_count); - - /* Work out appropriate sizes for the .pad sections to force - each section to land on a page boundary. This bit of - code knows what compute_section_file_positions is going - to do. */ - sofar = bfd_coff_filhsz (abfd); - sofar += bfd_coff_aoutsz (abfd); - sofar += abfd->section_count * bfd_coff_scnhsz (abfd); - for (o = abfd->sections; o != NULL; o = o->next) - if (o->reloc_count >= 0xffff || o->lineno_count >= 0xffff) - sofar += bfd_coff_scnhsz (abfd); - - for (o = abfd->sections; o != NULL; o = o->next) - { - if (strcmp (o->name, ".pad") == 0) - { - bfd_vma pageoff; - - BFD_ASSERT (o->_raw_size == 0); - pageoff = sofar & (file_align - 1); - if (pageoff != 0) - { - o->_raw_size = file_align - pageoff; - sofar += file_align - pageoff; - o->flags |= SEC_HAS_CONTENTS; - } - } - else - { - if ((o->flags & SEC_HAS_CONTENTS) != 0) - sofar += BFD_ALIGN (o->_raw_size, - 1 << o->alignment_power); - } - } - } - - if (! bfd_coff_compute_section_file_positions (abfd)) - goto error_return; - } - - /* Allocate space for the pointers we need to keep for the relocs. */ - { - unsigned int i; - - /* We use section_count + 1, rather than section_count, because - the target_index fields are 1 based. */ - finfo.section_info = - ((struct xcoff_link_section_info *) - bfd_malloc ((abfd->section_count + 1) - * sizeof (struct xcoff_link_section_info))); - if (finfo.section_info == NULL) - goto error_return; - for (i = 0; i <= abfd->section_count; i++) - { - finfo.section_info[i].relocs = NULL; - finfo.section_info[i].rel_hashes = NULL; - finfo.section_info[i].toc_rel_hashes = NULL; - } - } - - /* Set the file positions for the relocs. */ - rel_filepos = obj_relocbase (abfd); - relsz = bfd_coff_relsz (abfd); - max_output_reloc_count = 0; - for (o = abfd->sections; o != NULL; o = o->next) - { - if (o->reloc_count == 0) - o->rel_filepos = 0; - else - { - /* A stripped file has no relocs. However, we still - allocate the buffers, so that later code doesn't have to - worry about whether we are stripping or not. */ - if (info->strip == strip_all) - o->rel_filepos = 0; - else - { - o->flags |= SEC_RELOC; - o->rel_filepos = rel_filepos; - rel_filepos += o->reloc_count * relsz; - } - - /* We don't know the indices of global symbols until we have - written out all the local symbols. For each section in - the output file, we keep an array of pointers to hash - table entries. Each entry in the array corresponds to a - reloc. When we find a reloc against a global symbol, we - set the corresponding entry in this array so that we can - fix up the symbol index after we have written out all the - local symbols. - - Because of this problem, we also keep the relocs in - memory until the end of the link. This wastes memory. - We could backpatch the file later, I suppose, although it - would be slow. */ - finfo.section_info[o->target_index].relocs = - ((struct internal_reloc *) - bfd_malloc (o->reloc_count * sizeof (struct internal_reloc))); - finfo.section_info[o->target_index].rel_hashes = - ((struct xcoff_link_hash_entry **) - bfd_malloc (o->reloc_count - * sizeof (struct xcoff_link_hash_entry *))); - if (finfo.section_info[o->target_index].relocs == NULL - || finfo.section_info[o->target_index].rel_hashes == NULL) - goto error_return; - - if (o->reloc_count > max_output_reloc_count) - max_output_reloc_count = o->reloc_count; - } - } - - /* We now know the size of the relocs, so we can determine the file - positions of the line numbers. */ - line_filepos = rel_filepos; - finfo.line_filepos = line_filepos; - linesz = bfd_coff_linesz (abfd); - for (o = abfd->sections; o != NULL; o = o->next) - { - if (o->lineno_count == 0) - o->line_filepos = 0; - else - { - o->line_filepos = line_filepos; - line_filepos += o->lineno_count * linesz; - } - - /* Reset the reloc and lineno counts, so that we can use them to - count the number of entries we have output so far. */ - o->reloc_count = 0; - o->lineno_count = 0; - } - - obj_sym_filepos (abfd) = line_filepos; - - /* Figure out the largest number of symbols in an input BFD. Take - the opportunity to clear the output_has_begun fields of all the - input BFD's. We want at least 6 symbols, since that is the - number which xcoff_write_global_symbol may need. */ - max_sym_count = 6; - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - { - size_t sz; - - sub->output_has_begun = false; - sz = obj_raw_syment_count (sub); - if (sz > max_sym_count) - max_sym_count = sz; - } - - /* Allocate some buffers used while linking. */ - finfo.internal_syms = ((struct internal_syment *) - bfd_malloc (max_sym_count - * sizeof (struct internal_syment))); - finfo.sym_indices = (long *) bfd_malloc (max_sym_count * sizeof (long)); - finfo.outsyms = ((bfd_byte *) - bfd_malloc ((size_t) ((max_sym_count + 1) * symesz))); - finfo.linenos = (bfd_byte *) bfd_malloc (max_lineno_count - * bfd_coff_linesz (abfd)); - finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size); - finfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz); - if ((finfo.internal_syms == NULL && max_sym_count > 0) - || (finfo.sym_indices == NULL && max_sym_count > 0) - || finfo.outsyms == NULL - || (finfo.linenos == NULL && max_lineno_count > 0) - || (finfo.contents == NULL && max_contents_size > 0) - || (finfo.external_relocs == NULL && max_reloc_count > 0)) - goto error_return; - - obj_raw_syment_count (abfd) = 0; - xcoff_data (abfd)->toc = (bfd_vma) -1; - - /* We now know the position of everything in the file, except that - we don't know the size of the symbol table and therefore we don't - know where the string table starts. We just build the string - table in memory as we go along. We process all the relocations - for a single input file at once. */ - for (o = abfd->sections; o != NULL; o = o->next) - { - for (p = o->link_order_head; p != NULL; p = p->next) - { - if (p->type == bfd_indirect_link_order - && p->u.indirect.section->owner->xvec == abfd->xvec) - { - sub = p->u.indirect.section->owner; - if (! sub->output_has_begun) - { - if (! xcoff_link_input_bfd (&finfo, sub)) - goto error_return; - sub->output_has_begun = true; - } - } - else if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - { - if (! xcoff_reloc_link_order (abfd, &finfo, o, p)) - goto error_return; - } - else - { - if (! _bfd_default_link_order (abfd, info, o, p)) - goto error_return; - } - } - } - - /* Free up the buffers used by xcoff_link_input_bfd. */ - - if (finfo.internal_syms != NULL) - { - free (finfo.internal_syms); - finfo.internal_syms = NULL; - } - if (finfo.sym_indices != NULL) - { - free (finfo.sym_indices); - finfo.sym_indices = NULL; - } - if (finfo.linenos != NULL) - { - free (finfo.linenos); - finfo.linenos = NULL; - } - if (finfo.contents != NULL) - { - free (finfo.contents); - finfo.contents = NULL; - } - if (finfo.external_relocs != NULL) - { - free (finfo.external_relocs); - finfo.external_relocs = NULL; - } - - /* The value of the last C_FILE symbol is supposed to be -1. Write - it out again. */ - if (finfo.last_file_index != -1) - { - finfo.last_file.n_value = -1; - bfd_coff_swap_sym_out (abfd, (PTR) &finfo.last_file, - (PTR) finfo.outsyms); - if (bfd_seek (abfd, - (obj_sym_filepos (abfd) - + finfo.last_file_index * symesz), - SEEK_SET) != 0 - || bfd_write (finfo.outsyms, symesz, 1, abfd) != symesz) - goto error_return; - } - - /* Write out all the global symbols which do not come from XCOFF - input files. */ - xcoff_link_hash_traverse (xcoff_hash_table (info), - xcoff_write_global_symbol, - (PTR) &finfo); - - if (finfo.outsyms != NULL) - { - free (finfo.outsyms); - finfo.outsyms = NULL; - } - - /* Now that we have written out all the global symbols, we know the - symbol indices to use for relocs against them, and we can finally - write out the relocs. */ - external_relocs = (bfd_byte *) bfd_malloc (max_output_reloc_count * relsz); - if (external_relocs == NULL && max_output_reloc_count != 0) - goto error_return; - - for (o = abfd->sections; o != NULL; o = o->next) - { - struct internal_reloc *irel; - struct internal_reloc *irelend; - struct xcoff_link_hash_entry **rel_hash; - struct xcoff_toc_rel_hash *toc_rel_hash; - bfd_byte *erel; - - /* A stripped file has no relocs. */ - if (info->strip == strip_all) - { - o->reloc_count = 0; - continue; - } - - if (o->reloc_count == 0) - continue; - - irel = finfo.section_info[o->target_index].relocs; - irelend = irel + o->reloc_count; - rel_hash = finfo.section_info[o->target_index].rel_hashes; - for (; irel < irelend; irel++, rel_hash++, erel += relsz) - { - if (*rel_hash != NULL) - { - if ((*rel_hash)->indx < 0) - { - if (! ((*info->callbacks->unattached_reloc) - (info, (*rel_hash)->root.root.string, - (bfd *) NULL, o, irel->r_vaddr))) - goto error_return; - (*rel_hash)->indx = 0; - } - irel->r_symndx = (*rel_hash)->indx; - } - } - - for (toc_rel_hash = finfo.section_info[o->target_index].toc_rel_hashes; - toc_rel_hash != NULL; - toc_rel_hash = toc_rel_hash->next) - { - if (toc_rel_hash->h->u.toc_indx < 0) - { - if (! ((*info->callbacks->unattached_reloc) - (info, toc_rel_hash->h->root.root.string, - (bfd *) NULL, o, toc_rel_hash->rel->r_vaddr))) - goto error_return; - toc_rel_hash->h->u.toc_indx = 0; - } - toc_rel_hash->rel->r_symndx = toc_rel_hash->h->u.toc_indx; - } - - /* XCOFF requires that the relocs be sorted by address. We tend - to produce them in the order in which their containing csects - appear in the symbol table, which is not necessarily by - address. So we sort them here. There may be a better way to - do this. */ - qsort ((PTR) finfo.section_info[o->target_index].relocs, - o->reloc_count, sizeof (struct internal_reloc), - xcoff_sort_relocs); - - irel = finfo.section_info[o->target_index].relocs; - irelend = irel + o->reloc_count; - erel = external_relocs; - for (; irel < irelend; irel++, rel_hash++, erel += relsz) - bfd_coff_swap_reloc_out (abfd, (PTR) irel, (PTR) erel); - - if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0 - || bfd_write ((PTR) external_relocs, relsz, o->reloc_count, - abfd) != relsz * o->reloc_count) - goto error_return; - } - - if (external_relocs != NULL) - { - free (external_relocs); - external_relocs = NULL; - } - - /* Free up the section information. */ - if (finfo.section_info != NULL) - { - unsigned int i; - - for (i = 0; i < abfd->section_count; i++) - { - if (finfo.section_info[i].relocs != NULL) - free (finfo.section_info[i].relocs); - if (finfo.section_info[i].rel_hashes != NULL) - free (finfo.section_info[i].rel_hashes); - } - free (finfo.section_info); - finfo.section_info = NULL; - } - - /* Write out the loader section contents. */ - BFD_ASSERT ((bfd_byte *) finfo.ldrel - == (xcoff_hash_table (info)->loader_section->contents - + xcoff_hash_table (info)->ldhdr.l_impoff)); - o = xcoff_hash_table (info)->loader_section; - if (! bfd_set_section_contents (abfd, o->output_section, - o->contents, o->output_offset, - o->_raw_size)) - goto error_return; - - /* Write out the magic sections. */ - o = xcoff_hash_table (info)->linkage_section; - if (o->_raw_size > 0 - && ! bfd_set_section_contents (abfd, o->output_section, o->contents, - o->output_offset, o->_raw_size)) - goto error_return; - o = xcoff_hash_table (info)->toc_section; - if (o->_raw_size > 0 - && ! bfd_set_section_contents (abfd, o->output_section, o->contents, - o->output_offset, o->_raw_size)) - goto error_return; - o = xcoff_hash_table (info)->descriptor_section; - if (o->_raw_size > 0 - && ! bfd_set_section_contents (abfd, o->output_section, o->contents, - o->output_offset, o->_raw_size)) - goto error_return; - - /* Write out the string table. */ - if (bfd_seek (abfd, - (obj_sym_filepos (abfd) - + obj_raw_syment_count (abfd) * symesz), - SEEK_SET) != 0) - goto error_return; - bfd_h_put_32 (abfd, - _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE, - (bfd_byte *) strbuf); - if (bfd_write (strbuf, 1, STRING_SIZE_SIZE, abfd) != STRING_SIZE_SIZE) - goto error_return; - if (! _bfd_stringtab_emit (abfd, finfo.strtab)) - goto error_return; - - _bfd_stringtab_free (finfo.strtab); - - /* Write out the debugging string table. */ - o = xcoff_hash_table (info)->debug_section; - if (o != NULL) - { - struct bfd_strtab_hash *debug_strtab; - - debug_strtab = xcoff_hash_table (info)->debug_strtab; - BFD_ASSERT (o->output_section->_raw_size - o->output_offset - >= _bfd_stringtab_size (debug_strtab)); - if (bfd_seek (abfd, - o->output_section->filepos + o->output_offset, - SEEK_SET) != 0) - goto error_return; - if (! _bfd_stringtab_emit (abfd, debug_strtab)) - goto error_return; - } - - /* Setting bfd_get_symcount to 0 will cause write_object_contents to - not try to write out the symbols. */ - bfd_get_symcount (abfd) = 0; - - return true; - - error_return: - if (finfo.strtab != NULL) - _bfd_stringtab_free (finfo.strtab); - if (finfo.section_info != NULL) - { - unsigned int i; - - for (i = 0; i < abfd->section_count; i++) - { - if (finfo.section_info[i].relocs != NULL) - free (finfo.section_info[i].relocs); - if (finfo.section_info[i].rel_hashes != NULL) - free (finfo.section_info[i].rel_hashes); - } - free (finfo.section_info); - } - if (finfo.internal_syms != NULL) - free (finfo.internal_syms); - if (finfo.sym_indices != NULL) - free (finfo.sym_indices); - if (finfo.outsyms != NULL) - free (finfo.outsyms); - if (finfo.linenos != NULL) - free (finfo.linenos); - if (finfo.contents != NULL) - free (finfo.contents); - if (finfo.external_relocs != NULL) - free (finfo.external_relocs); - if (external_relocs != NULL) - free (external_relocs); - return false; -} - -/* Link an input file into the linker output file. This function - handles all the sections and relocations of the input file at once. */ - -static boolean -xcoff_link_input_bfd (finfo, input_bfd) - struct xcoff_final_link_info *finfo; - bfd *input_bfd; -{ - bfd *output_bfd; - const char *strings; - bfd_size_type syment_base; - unsigned int n_tmask; - unsigned int n_btshft; - boolean copy, hash; - bfd_size_type isymesz; - bfd_size_type osymesz; - bfd_size_type linesz; - bfd_byte *esym; - bfd_byte *esym_end; - struct xcoff_link_hash_entry **sym_hash; - struct internal_syment *isymp; - asection **csectpp; - unsigned long *debug_index; - long *indexp; - unsigned long output_index; - bfd_byte *outsym; - unsigned int incls; - asection *oline; - boolean keep_syms; - asection *o; - - /* We can just skip DYNAMIC files, unless this is a static link. */ - if ((input_bfd->flags & DYNAMIC) != 0 - && ! finfo->info->static_link) - return true; - - /* Move all the symbols to the output file. */ - - output_bfd = finfo->output_bfd; - strings = NULL; - syment_base = obj_raw_syment_count (output_bfd); - isymesz = bfd_coff_symesz (input_bfd); - osymesz = bfd_coff_symesz (output_bfd); - linesz = bfd_coff_linesz (input_bfd); - BFD_ASSERT (linesz == bfd_coff_linesz (output_bfd)); - - n_tmask = coff_data (input_bfd)->local_n_tmask; - n_btshft = coff_data (input_bfd)->local_n_btshft; - - /* Define macros so that ISFCN, et. al., macros work correctly. */ -#define N_TMASK n_tmask -#define N_BTSHFT n_btshft - - copy = false; - if (! finfo->info->keep_memory) - copy = true; - hash = true; - if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0) - hash = false; - - if (! _bfd_coff_get_external_symbols (input_bfd)) - return false; - - esym = (bfd_byte *) obj_coff_external_syms (input_bfd); - esym_end = esym + obj_raw_syment_count (input_bfd) * isymesz; - sym_hash = obj_xcoff_sym_hashes (input_bfd); - csectpp = xcoff_data (input_bfd)->csects; - debug_index = xcoff_data (input_bfd)->debug_indices; - isymp = finfo->internal_syms; - indexp = finfo->sym_indices; - output_index = syment_base; - outsym = finfo->outsyms; - incls = 0; - oline = NULL; - - while (esym < esym_end) - { - struct internal_syment isym; - union internal_auxent aux; - int smtyp = 0; - boolean skip; - boolean require; - int add; - - bfd_coff_swap_sym_in (input_bfd, (PTR) esym, (PTR) isymp); - - /* If this is a C_EXT or C_HIDEXT symbol, we need the csect - information. */ - if (isymp->n_sclass == C_EXT || isymp->n_sclass == C_HIDEXT) - { - BFD_ASSERT (isymp->n_numaux > 0); - bfd_coff_swap_aux_in (input_bfd, - (PTR) (esym + isymesz * isymp->n_numaux), - isymp->n_type, isymp->n_sclass, - isymp->n_numaux - 1, isymp->n_numaux, - (PTR) &aux); - smtyp = SMTYP_SMTYP (aux.x_csect.x_smtyp); - } - - /* Make a copy of *isymp so that the relocate_section function - always sees the original values. This is more reliable than - always recomputing the symbol value even if we are stripping - the symbol. */ - isym = *isymp; - - /* If this symbol is in the .loader section, swap out the - .loader symbol information. If this is an external symbol - reference to a defined symbol, though, then wait until we get - to the definition. */ - if (isym.n_sclass == C_EXT - && *sym_hash != NULL - && (*sym_hash)->ldsym != NULL - && (smtyp != XTY_ER - || (*sym_hash)->root.type == bfd_link_hash_undefined)) - { - struct xcoff_link_hash_entry *h; - struct internal_ldsym *ldsym; - - h = *sym_hash; - ldsym = h->ldsym; - if (isym.n_scnum > 0) - { - ldsym->l_scnum = (*csectpp)->output_section->target_index; - ldsym->l_value = (isym.n_value - + (*csectpp)->output_section->vma - + (*csectpp)->output_offset - - (*csectpp)->vma); - } - else - { - ldsym->l_scnum = isym.n_scnum; - ldsym->l_value = isym.n_value; - } - - ldsym->l_smtype = smtyp; - if (((h->flags & XCOFF_DEF_REGULAR) == 0 - && (h->flags & XCOFF_DEF_DYNAMIC) != 0) - || (h->flags & XCOFF_IMPORT) != 0) - ldsym->l_smtype |= L_IMPORT; - if (((h->flags & XCOFF_DEF_REGULAR) != 0 - && (h->flags & XCOFF_DEF_DYNAMIC) != 0) - || (h->flags & XCOFF_EXPORT) != 0) - ldsym->l_smtype |= L_EXPORT; - if ((h->flags & XCOFF_ENTRY) != 0) - ldsym->l_smtype |= L_ENTRY; - - ldsym->l_smclas = aux.x_csect.x_smclas; - - if (ldsym->l_ifile == (bfd_size_type) -1) - ldsym->l_ifile = 0; - else if (ldsym->l_ifile == 0) - { - if ((ldsym->l_smtype & L_IMPORT) == 0) - ldsym->l_ifile = 0; - else - { - bfd *impbfd; - - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - impbfd = h->root.u.def.section->owner; - else if (h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak) - impbfd = h->root.u.undef.abfd; - else - impbfd = NULL; - - if (impbfd == NULL) - ldsym->l_ifile = 0; - else - { - BFD_ASSERT (impbfd->xvec == finfo->output_bfd->xvec); - ldsym->l_ifile = xcoff_data (impbfd)->import_file_id; - } - } - } - - ldsym->l_parm = 0; - - BFD_ASSERT (h->ldindx >= 0); - BFD_ASSERT (LDSYMSZ == sizeof (struct external_ldsym)); - xcoff_swap_ldsym_out (finfo->output_bfd, ldsym, - finfo->ldsym + h->ldindx - 3); - h->ldsym = NULL; - - /* Fill in snentry now that we know the target_index. */ - if ((h->flags & XCOFF_ENTRY) != 0 - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) - xcoff_data (output_bfd)->snentry = - h->root.u.def.section->output_section->target_index; - } - - *indexp = -1; - - skip = false; - require = false; - add = 1 + isym.n_numaux; - - /* If we are skipping this csect, we want to skip this symbol. */ - if (*csectpp == NULL) - skip = true; - - /* If we garbage collected this csect, we want to skip this - symbol. */ - if (! skip - && xcoff_hash_table (finfo->info)->gc - && ((*csectpp)->flags & SEC_MARK) == 0 - && *csectpp != bfd_abs_section_ptr) - skip = true; - - /* An XCOFF linker always skips C_STAT symbols. */ - if (! skip - && isymp->n_sclass == C_STAT) - skip = true; - - /* We skip all but the first TOC anchor. */ - if (! skip - && isymp->n_sclass == C_HIDEXT - && aux.x_csect.x_smclas == XMC_TC0) - { - if (finfo->toc_symindx != -1) - skip = true; - else - { - bfd_vma tocval, tocend; - bfd *inp; - - tocval = ((*csectpp)->output_section->vma - + (*csectpp)->output_offset - + isym.n_value - - (*csectpp)->vma); - - /* We want to find out if tocval is a good value to use - as the TOC anchor--that is, whether we can access all - of the TOC using a 16 bit offset from tocval. This - test assumes that the TOC comes at the end of the - output section, as it does in the default linker - script. */ - tocend = ((*csectpp)->output_section->vma - + (*csectpp)->output_section->_raw_size); - for (inp = finfo->info->input_bfds; - inp != NULL; - inp = inp->link_next) - { - asection *o; - - for (o = inp->sections; o != NULL; o = o->next) - if (strcmp (o->name, ".tocbss") == 0) - { - bfd_vma new_toc_end; - new_toc_end = (o->output_section->vma - + o->output_offset - + o->_cooked_size); - if (new_toc_end > tocend) - tocend = new_toc_end; - } - - } - - if (tocval + 0x10000 < tocend) - { - (*_bfd_error_handler) - (_("TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling"), - (unsigned long) (tocend - tocval)); - bfd_set_error (bfd_error_file_too_big); - return false; - } - - if (tocval + 0x8000 < tocend) - { - bfd_vma tocadd; - - tocadd = tocend - (tocval + 0x8000); - tocval += tocadd; - isym.n_value += tocadd; - } - - finfo->toc_symindx = output_index; - xcoff_data (finfo->output_bfd)->toc = tocval; - xcoff_data (finfo->output_bfd)->sntoc = - (*csectpp)->output_section->target_index; - require = true; - } - } - - /* If we are stripping all symbols, we want to skip this one. */ - if (! skip - && finfo->info->strip == strip_all) - skip = true; - - /* We can skip resolved external references. */ - if (! skip - && isym.n_sclass == C_EXT - && smtyp == XTY_ER - && (*sym_hash)->root.type != bfd_link_hash_undefined) - skip = true; - - /* We can skip common symbols if they got defined somewhere - else. */ - if (! skip - && isym.n_sclass == C_EXT - && smtyp == XTY_CM - && ((*sym_hash)->root.type != bfd_link_hash_common - || (*sym_hash)->root.u.c.p->section != *csectpp) - && ((*sym_hash)->root.type != bfd_link_hash_defined - || (*sym_hash)->root.u.def.section != *csectpp)) - skip = true; - - /* Skip local symbols if we are discarding them. */ - if (! skip - && finfo->info->discard == discard_all - && isym.n_sclass != C_EXT - && (isym.n_sclass != C_HIDEXT - || smtyp != XTY_SD)) - skip = true; - - /* If we stripping debugging symbols, and this is a debugging - symbol, then skip it. */ - if (! skip - && finfo->info->strip == strip_debugger - && isym.n_scnum == N_DEBUG) - skip = true; - - /* If some symbols are stripped based on the name, work out the - name and decide whether to skip this symbol. We don't handle - this correctly for symbols whose names are in the .debug - section; to get it right we would need a new bfd_strtab_hash - function to return the string given the index. */ - if (! skip - && (finfo->info->strip == strip_some - || finfo->info->discard == discard_l) - && (debug_index == NULL || *debug_index == (unsigned long) -1)) - { - const char *name; - char buf[SYMNMLEN + 1]; - - name = _bfd_coff_internal_syment_name (input_bfd, &isym, buf); - if (name == NULL) - return false; - - if ((finfo->info->strip == strip_some - && (bfd_hash_lookup (finfo->info->keep_hash, name, false, - false) == NULL)) - || (finfo->info->discard == discard_l - && (isym.n_sclass != C_EXT - && (isym.n_sclass != C_HIDEXT - || smtyp != XTY_SD)) - && bfd_is_local_label_name (input_bfd, name))) - skip = true; - } - - /* We can not skip the first TOC anchor. */ - if (skip - && require - && finfo->info->strip != strip_all) - skip = false; - - /* We now know whether we are to skip this symbol or not. */ - if (! skip) - { - /* Adjust the symbol in order to output it. */ - - if (isym._n._n_n._n_zeroes == 0 - && isym._n._n_n._n_offset != 0) - { - /* This symbol has a long name. Enter it in the string - table we are building. If *debug_index != -1, the - name has already been entered in the .debug section. */ - if (debug_index != NULL && *debug_index != (unsigned long) -1) - isym._n._n_n._n_offset = *debug_index; - else - { - const char *name; - bfd_size_type indx; - - name = _bfd_coff_internal_syment_name (input_bfd, &isym, - (char *) NULL); - if (name == NULL) - return false; - indx = _bfd_stringtab_add (finfo->strtab, name, hash, copy); - if (indx == (bfd_size_type) -1) - return false; - isym._n._n_n._n_offset = STRING_SIZE_SIZE + indx; - } - } - - if (isym.n_sclass != C_BSTAT - && isym.n_sclass != C_ESTAT - && isym.n_sclass != C_DECL - && isym.n_scnum > 0) - { - isym.n_scnum = (*csectpp)->output_section->target_index; - isym.n_value += ((*csectpp)->output_section->vma - + (*csectpp)->output_offset - - (*csectpp)->vma); - } - - /* The value of a C_FILE symbol is the symbol index of the - next C_FILE symbol. The value of the last C_FILE symbol - is -1. We try to get this right, below, just before we - write the symbols out, but in the general case we may - have to write the symbol out twice. */ - if (isym.n_sclass == C_FILE) - { - if (finfo->last_file_index != -1 - && finfo->last_file.n_value != (long) output_index) - { - /* We must correct the value of the last C_FILE entry. */ - finfo->last_file.n_value = output_index; - if ((bfd_size_type) finfo->last_file_index >= syment_base) - { - /* The last C_FILE symbol is in this input file. */ - bfd_coff_swap_sym_out (output_bfd, - (PTR) &finfo->last_file, - (PTR) (finfo->outsyms - + ((finfo->last_file_index - - syment_base) - * osymesz))); - } - else - { - /* We have already written out the last C_FILE - symbol. We need to write it out again. We - borrow *outsym temporarily. */ - bfd_coff_swap_sym_out (output_bfd, - (PTR) &finfo->last_file, - (PTR) outsym); - if (bfd_seek (output_bfd, - (obj_sym_filepos (output_bfd) - + finfo->last_file_index * osymesz), - SEEK_SET) != 0 - || (bfd_write (outsym, osymesz, 1, output_bfd) - != osymesz)) - return false; - } - } - - finfo->last_file_index = output_index; - finfo->last_file = isym; - } - - /* The value of a C_BINCL or C_EINCL symbol is a file offset - into the line numbers. We update the symbol values when - we handle the line numbers. */ - if (isym.n_sclass == C_BINCL - || isym.n_sclass == C_EINCL) - { - isym.n_value = finfo->line_filepos; - ++incls; - } - - /* Output the symbol. */ - - bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) outsym); - - *indexp = output_index; - - if (isym.n_sclass == C_EXT) - { - long indx; - struct xcoff_link_hash_entry *h; - - indx = ((esym - (bfd_byte *) obj_coff_external_syms (input_bfd)) - / isymesz); - h = obj_xcoff_sym_hashes (input_bfd)[indx]; - BFD_ASSERT (h != NULL); - h->indx = output_index; - } - - /* If this is a symbol in the TOC which we may have merged - (class XMC_TC), remember the symbol index of the TOC - symbol. */ - if (isym.n_sclass == C_HIDEXT - && aux.x_csect.x_smclas == XMC_TC - && *sym_hash != NULL) - { - BFD_ASSERT (((*sym_hash)->flags & XCOFF_SET_TOC) == 0); - BFD_ASSERT ((*sym_hash)->toc_section != NULL); - (*sym_hash)->u.toc_indx = output_index; - } - - output_index += add; - outsym += add * osymesz; - } - - esym += add * isymesz; - isymp += add; - csectpp += add; - sym_hash += add; - if (debug_index != NULL) - debug_index += add; - ++indexp; - for (--add; add > 0; --add) - *indexp++ = -1; - } - - /* Fix up the aux entries and the C_BSTAT symbols. This must be - done in a separate pass, because we don't know the correct symbol - indices until we have already decided which symbols we are going - to keep. */ - - esym = (bfd_byte *) obj_coff_external_syms (input_bfd); - esym_end = esym + obj_raw_syment_count (input_bfd) * isymesz; - isymp = finfo->internal_syms; - indexp = finfo->sym_indices; - csectpp = xcoff_data (input_bfd)->csects; - outsym = finfo->outsyms; - while (esym < esym_end) - { - int add; - - add = 1 + isymp->n_numaux; - - if (*indexp < 0) - esym += add * isymesz; - else - { - int i; - - if (isymp->n_sclass == C_BSTAT) - { - struct internal_syment isym; - unsigned long indx; - - /* The value of a C_BSTAT symbol is the symbol table - index of the containing csect. */ - bfd_coff_swap_sym_in (output_bfd, (PTR) outsym, (PTR) &isym); - indx = isym.n_value; - if (indx < obj_raw_syment_count (input_bfd)) - { - long symindx; - - symindx = finfo->sym_indices[indx]; - if (symindx < 0) - isym.n_value = 0; - else - isym.n_value = symindx; - bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, - (PTR) outsym); - } - } - - esym += isymesz; - outsym += osymesz; - - for (i = 0; i < isymp->n_numaux && esym < esym_end; i++) - { - union internal_auxent aux; - - bfd_coff_swap_aux_in (input_bfd, (PTR) esym, isymp->n_type, - isymp->n_sclass, i, isymp->n_numaux, - (PTR) &aux); - - if (isymp->n_sclass == C_FILE) - { - /* This is the file name (or some comment put in by - the compiler). If it is long, we must put it in - the string table. */ - if (aux.x_file.x_n.x_zeroes == 0 - && aux.x_file.x_n.x_offset != 0) - { - const char *filename; - bfd_size_type indx; - - BFD_ASSERT (aux.x_file.x_n.x_offset - >= STRING_SIZE_SIZE); - if (strings == NULL) - { - strings = _bfd_coff_read_string_table (input_bfd); - if (strings == NULL) - return false; - } - filename = strings + aux.x_file.x_n.x_offset; - indx = _bfd_stringtab_add (finfo->strtab, filename, - hash, copy); - if (indx == (bfd_size_type) -1) - return false; - aux.x_file.x_n.x_offset = STRING_SIZE_SIZE + indx; - } - } - else if ((isymp->n_sclass == C_EXT - || isymp->n_sclass == C_HIDEXT) - && i + 1 == isymp->n_numaux) - { - /* We don't support type checking. I don't know if - anybody does. */ - aux.x_csect.x_parmhash = 0; - /* I don't think anybody uses these fields, but we'd - better clobber them just in case. */ - aux.x_csect.x_stab = 0; - aux.x_csect.x_snstab = 0; - if (SMTYP_SMTYP (aux.x_csect.x_smtyp) == XTY_LD) - { - unsigned long indx; - - indx = aux.x_csect.x_scnlen.l; - if (indx < obj_raw_syment_count (input_bfd)) - { - long symindx; - - symindx = finfo->sym_indices[indx]; - if (symindx < 0) - aux.x_sym.x_tagndx.l = 0; - else - aux.x_sym.x_tagndx.l = symindx; - } - } - } - else if (isymp->n_sclass != C_STAT || isymp->n_type != T_NULL) - { - unsigned long indx; - - if (ISFCN (isymp->n_type) - || ISTAG (isymp->n_sclass) - || isymp->n_sclass == C_BLOCK - || isymp->n_sclass == C_FCN) - { - indx = aux.x_sym.x_fcnary.x_fcn.x_endndx.l; - if (indx > 0 - && indx < obj_raw_syment_count (input_bfd)) - { - /* We look forward through the symbol for - the index of the next symbol we are going - to include. I don't know if this is - entirely right. */ - while (finfo->sym_indices[indx] < 0 - && indx < obj_raw_syment_count (input_bfd)) - ++indx; - if (indx >= obj_raw_syment_count (input_bfd)) - indx = output_index; - else - indx = finfo->sym_indices[indx]; - aux.x_sym.x_fcnary.x_fcn.x_endndx.l = indx; - } - } - - indx = aux.x_sym.x_tagndx.l; - if (indx > 0 && indx < obj_raw_syment_count (input_bfd)) - { - long symindx; - - symindx = finfo->sym_indices[indx]; - if (symindx < 0) - aux.x_sym.x_tagndx.l = 0; - else - aux.x_sym.x_tagndx.l = symindx; - } - } - - /* Copy over the line numbers, unless we are stripping - them. We do this on a symbol by symbol basis in - order to more easily handle garbage collection. */ - if ((isymp->n_sclass == C_EXT - || isymp->n_sclass == C_HIDEXT) - && i == 0 - && isymp->n_numaux > 1 - && ISFCN (isymp->n_type) - && aux.x_sym.x_fcnary.x_fcn.x_lnnoptr != 0) - { - if (finfo->info->strip != strip_none - && finfo->info->strip != strip_some) - aux.x_sym.x_fcnary.x_fcn.x_lnnoptr = 0; - else - { - asection *enclosing; - unsigned int enc_count; - bfd_size_type linoff; - struct internal_lineno lin; - - o = *csectpp; - enclosing = xcoff_section_data (abfd, o)->enclosing; - enc_count = xcoff_section_data (abfd, o)->lineno_count; - if (oline != enclosing) - { - if (bfd_seek (input_bfd, - enclosing->line_filepos, - SEEK_SET) != 0 - || (bfd_read (finfo->linenos, linesz, - enc_count, input_bfd) - != linesz * enc_count)) - return false; - oline = enclosing; - } - - linoff = (aux.x_sym.x_fcnary.x_fcn.x_lnnoptr - - enclosing->line_filepos); - - bfd_coff_swap_lineno_in (input_bfd, - (PTR) (finfo->linenos + linoff), - (PTR) &lin); - if (lin.l_lnno != 0 - || ((bfd_size_type) lin.l_addr.l_symndx - != ((esym - - isymesz - - ((bfd_byte *) - obj_coff_external_syms (input_bfd))) - / isymesz))) - aux.x_sym.x_fcnary.x_fcn.x_lnnoptr = 0; - else - { - bfd_byte *linpend, *linp; - bfd_vma offset; - bfd_size_type count; - - lin.l_addr.l_symndx = *indexp; - bfd_coff_swap_lineno_out (output_bfd, (PTR) &lin, - (PTR) (finfo->linenos - + linoff)); - - linpend = (finfo->linenos - + enc_count * linesz); - offset = (o->output_section->vma - + o->output_offset - - o->vma); - for (linp = finfo->linenos + linoff + linesz; - linp < linpend; - linp += linesz) - { - bfd_coff_swap_lineno_in (input_bfd, (PTR) linp, - (PTR) &lin); - if (lin.l_lnno == 0) - break; - lin.l_addr.l_paddr += offset; - bfd_coff_swap_lineno_out (output_bfd, - (PTR) &lin, - (PTR) linp); - } - - count = (linp - (finfo->linenos + linoff)) / linesz; - - aux.x_sym.x_fcnary.x_fcn.x_lnnoptr = - (o->output_section->line_filepos - + o->output_section->lineno_count * linesz); - - if (bfd_seek (output_bfd, - aux.x_sym.x_fcnary.x_fcn.x_lnnoptr, - SEEK_SET) != 0 - || (bfd_write (finfo->linenos + linoff, - linesz, count, output_bfd) - != linesz * count)) - return false; - - o->output_section->lineno_count += count; - - if (incls > 0) - { - struct internal_syment *iisp, *iispend; - long *iindp; - bfd_byte *oos; - int iiadd; - - /* Update any C_BINCL or C_EINCL symbols - that refer to a line number in the - range we just output. */ - iisp = finfo->internal_syms; - iispend = (iisp - + obj_raw_syment_count (input_bfd)); - iindp = finfo->sym_indices; - oos = finfo->outsyms; - while (iisp < iispend) - { - if (*iindp >= 0 - && (iisp->n_sclass == C_BINCL - || iisp->n_sclass == C_EINCL) - && ((bfd_size_type) iisp->n_value - >= enclosing->line_filepos + linoff) - && ((bfd_size_type) iisp->n_value - < (enclosing->line_filepos - + enc_count * linesz))) - { - struct internal_syment iis; - - bfd_coff_swap_sym_in (output_bfd, - (PTR) oos, - (PTR) &iis); - iis.n_value = - (iisp->n_value - - enclosing->line_filepos - - linoff - + aux.x_sym.x_fcnary.x_fcn.x_lnnoptr); - bfd_coff_swap_sym_out (output_bfd, - (PTR) &iis, - (PTR) oos); - --incls; - } - - iiadd = 1 + iisp->n_numaux; - if (*iindp >= 0) - oos += iiadd * osymesz; - iisp += iiadd; - iindp += iiadd; - } - } - } - } - } - - bfd_coff_swap_aux_out (output_bfd, (PTR) &aux, isymp->n_type, - isymp->n_sclass, i, isymp->n_numaux, - (PTR) outsym); - outsym += osymesz; - esym += isymesz; - } - } - - indexp += add; - isymp += add; - csectpp += add; - } - - /* If we swapped out a C_FILE symbol, guess that the next C_FILE - symbol will be the first symbol in the next input file. In the - normal case, this will save us from writing out the C_FILE symbol - again. */ - if (finfo->last_file_index != -1 - && (bfd_size_type) finfo->last_file_index >= syment_base) - { - finfo->last_file.n_value = output_index; - bfd_coff_swap_sym_out (output_bfd, (PTR) &finfo->last_file, - (PTR) (finfo->outsyms - + ((finfo->last_file_index - syment_base) - * osymesz))); - } - - /* Write the modified symbols to the output file. */ - if (outsym > finfo->outsyms) - { - if (bfd_seek (output_bfd, - obj_sym_filepos (output_bfd) + syment_base * osymesz, - SEEK_SET) != 0 - || (bfd_write (finfo->outsyms, outsym - finfo->outsyms, 1, - output_bfd) - != (bfd_size_type) (outsym - finfo->outsyms))) - return false; - - BFD_ASSERT ((obj_raw_syment_count (output_bfd) - + (outsym - finfo->outsyms) / osymesz) - == output_index); - - obj_raw_syment_count (output_bfd) = output_index; - } - - /* Don't let the linker relocation routines discard the symbols. */ - keep_syms = obj_coff_keep_syms (input_bfd); - obj_coff_keep_syms (input_bfd) = true; - - /* Relocate the contents of each section. */ - for (o = input_bfd->sections; o != NULL; o = o->next) - { - bfd_byte *contents; - - if (! o->linker_mark) - { - /* This section was omitted from the link. */ - continue; - } - - if ((o->flags & SEC_HAS_CONTENTS) == 0 - || o->_raw_size == 0 - || (o->flags & SEC_IN_MEMORY) != 0) - continue; - - /* We have set filepos correctly for the sections we created to - represent csects, so bfd_get_section_contents should work. */ - if (coff_section_data (input_bfd, o) != NULL - && coff_section_data (input_bfd, o)->contents != NULL) - contents = coff_section_data (input_bfd, o)->contents; - else - { - if (! bfd_get_section_contents (input_bfd, o, finfo->contents, - (file_ptr) 0, o->_raw_size)) - return false; - contents = finfo->contents; - } - - if ((o->flags & SEC_RELOC) != 0) - { - int target_index; - struct internal_reloc *internal_relocs; - struct internal_reloc *irel; - bfd_vma offset; - struct internal_reloc *irelend; - struct xcoff_link_hash_entry **rel_hash; - long r_symndx; - - /* Read in the relocs. */ - target_index = o->output_section->target_index; - internal_relocs = (xcoff_read_internal_relocs - (input_bfd, o, false, finfo->external_relocs, - true, - (finfo->section_info[target_index].relocs - + o->output_section->reloc_count))); - if (internal_relocs == NULL) - return false; - - /* Call processor specific code to relocate the section - contents. */ - if (! bfd_coff_relocate_section (output_bfd, finfo->info, - input_bfd, o, - contents, - internal_relocs, - finfo->internal_syms, - xcoff_data (input_bfd)->csects)) - return false; - - offset = o->output_section->vma + o->output_offset - o->vma; - irel = internal_relocs; - irelend = irel + o->reloc_count; - rel_hash = (finfo->section_info[target_index].rel_hashes - + o->output_section->reloc_count); - for (; irel < irelend; irel++, rel_hash++) - { - struct xcoff_link_hash_entry *h = NULL; - struct internal_ldrel ldrel; - boolean quiet; - - *rel_hash = NULL; - - /* Adjust the reloc address and symbol index. */ - - irel->r_vaddr += offset; - - r_symndx = irel->r_symndx; - - if (r_symndx == -1) - h = NULL; - else - h = obj_xcoff_sym_hashes (input_bfd)[r_symndx]; - - if (r_symndx != -1 && finfo->info->strip != strip_all) - { - if (h != NULL - && h->smclas != XMC_TD - && (irel->r_type == R_TOC - || irel->r_type == R_GL - || irel->r_type == R_TCL - || irel->r_type == R_TRL - || irel->r_type == R_TRLA)) - { - /* This is a TOC relative reloc with a symbol - attached. The symbol should be the one which - this reloc is for. We want to make this - reloc against the TOC address of the symbol, - not the symbol itself. */ - BFD_ASSERT (h->toc_section != NULL); - BFD_ASSERT ((h->flags & XCOFF_SET_TOC) == 0); - if (h->u.toc_indx != -1) - irel->r_symndx = h->u.toc_indx; - else - { - struct xcoff_toc_rel_hash *n; - struct xcoff_link_section_info *si; - - n = ((struct xcoff_toc_rel_hash *) - bfd_alloc (finfo->output_bfd, - sizeof (struct xcoff_toc_rel_hash))); - if (n == NULL) - return false; - si = finfo->section_info + target_index; - n->next = si->toc_rel_hashes; - n->h = h; - n->rel = irel; - si->toc_rel_hashes = n; - } - } - else if (h != NULL) - { - /* This is a global symbol. */ - if (h->indx >= 0) - irel->r_symndx = h->indx; - else - { - /* This symbol is being written at the end - of the file, and we do not yet know the - symbol index. We save the pointer to the - hash table entry in the rel_hash list. - We set the indx field to -2 to indicate - that this symbol must not be stripped. */ - *rel_hash = h; - h->indx = -2; - } - } - else - { - long indx; - - indx = finfo->sym_indices[r_symndx]; - - if (indx == -1) - { - struct internal_syment *is; - - /* Relocations against a TC0 TOC anchor are - automatically transformed to be against - the TOC anchor in the output file. */ - is = finfo->internal_syms + r_symndx; - if (is->n_sclass == C_HIDEXT - && is->n_numaux > 0) - { - PTR auxptr; - union internal_auxent aux; - - auxptr = ((PTR) - (((bfd_byte *) - obj_coff_external_syms (input_bfd)) - + ((r_symndx + is->n_numaux) - * isymesz))); - bfd_coff_swap_aux_in (input_bfd, auxptr, - is->n_type, is->n_sclass, - is->n_numaux - 1, - is->n_numaux, - (PTR) &aux); - if (SMTYP_SMTYP (aux.x_csect.x_smtyp) == XTY_SD - && aux.x_csect.x_smclas == XMC_TC0) - indx = finfo->toc_symindx; - } - } - - if (indx != -1) - irel->r_symndx = indx; - else - { - struct internal_syment *is; - const char *name; - char buf[SYMNMLEN + 1]; - - /* This reloc is against a symbol we are - stripping. It would be possible to handle - this case, but I don't think it's worth it. */ - is = finfo->internal_syms + r_symndx; - - name = (_bfd_coff_internal_syment_name - (input_bfd, is, buf)); - if (name == NULL) - return false; - - if (! ((*finfo->info->callbacks->unattached_reloc) - (finfo->info, name, input_bfd, o, - irel->r_vaddr))) - return false; - } - } - } - - quiet = false; - switch (irel->r_type) - { - default: - if (h == NULL - || h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak - || h->root.type == bfd_link_hash_common) - break; - /* Fall through. */ - case R_POS: - case R_NEG: - case R_RL: - case R_RLA: - /* This reloc needs to be copied into the .loader - section. */ - ldrel.l_vaddr = irel->r_vaddr; - if (r_symndx == -1) - ldrel.l_symndx = -1; - else if (h == NULL - || (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak - || h->root.type == bfd_link_hash_common)) - { - asection *sec; - - if (h == NULL) - sec = xcoff_data (input_bfd)->csects[r_symndx]; - else if (h->root.type == bfd_link_hash_common) - sec = h->root.u.c.p->section; - else - sec = h->root.u.def.section; - sec = sec->output_section; - - if (strcmp (sec->name, ".text") == 0) - ldrel.l_symndx = 0; - else if (strcmp (sec->name, ".data") == 0) - ldrel.l_symndx = 1; - else if (strcmp (sec->name, ".bss") == 0) - ldrel.l_symndx = 2; - else - { - (*_bfd_error_handler) - (_("%s: loader reloc in unrecognized section `%s'"), - bfd_get_filename (input_bfd), - sec->name); - bfd_set_error (bfd_error_nonrepresentable_section); - return false; - } - } - else - { - if (! finfo->info->relocateable - && (h->flags & XCOFF_DEF_DYNAMIC) == 0 - && (h->flags & XCOFF_IMPORT) == 0) - { - /* We already called the undefined_symbol - callback for this relocation, in - _bfd_ppc_xcoff_relocate_section. Don't - issue any more warnings. */ - quiet = true; - } - if (h->ldindx < 0 && ! quiet) - { - (*_bfd_error_handler) - (_("%s: `%s' in loader reloc but not loader sym"), - bfd_get_filename (input_bfd), - h->root.root.string); - bfd_set_error (bfd_error_bad_value); - return false; - } - ldrel.l_symndx = h->ldindx; - } - ldrel.l_rtype = (irel->r_size << 8) | irel->r_type; - ldrel.l_rsecnm = o->output_section->target_index; - if (xcoff_hash_table (finfo->info)->textro - && strcmp (o->output_section->name, ".text") == 0 - && ! quiet) - { - (*_bfd_error_handler) - (_("%s: loader reloc in read-only section %s"), - bfd_get_filename (input_bfd), - bfd_get_section_name (finfo->output_bfd, - o->output_section)); - bfd_set_error (bfd_error_invalid_operation); - return false; - } - xcoff_swap_ldrel_out (output_bfd, &ldrel, - finfo->ldrel); - BFD_ASSERT (sizeof (struct external_ldrel) == LDRELSZ); - ++finfo->ldrel; - break; - - case R_TOC: - case R_GL: - case R_TCL: - case R_TRL: - case R_TRLA: - /* We should never need a .loader reloc for a TOC - relative reloc. */ - break; - } - } - - o->output_section->reloc_count += o->reloc_count; - } - - /* Write out the modified section contents. */ - if (! bfd_set_section_contents (output_bfd, o->output_section, - contents, o->output_offset, - (o->_cooked_size != 0 - ? o->_cooked_size - : o->_raw_size))) - return false; - } - - obj_coff_keep_syms (input_bfd) = keep_syms; - - if (! finfo->info->keep_memory) - { - if (! _bfd_coff_free_symbols (input_bfd)) - return false; - } - - return true; -} - -#undef N_TMASK -#undef N_BTSHFT - -/* Write out a non-XCOFF global symbol. */ - -static boolean -xcoff_write_global_symbol (h, p) - struct xcoff_link_hash_entry *h; - PTR p; -{ - struct xcoff_final_link_info *finfo = (struct xcoff_final_link_info *) p; - bfd *output_bfd; - bfd_byte *outsym; - struct internal_syment isym; - union internal_auxent aux; - - output_bfd = finfo->output_bfd; - outsym = finfo->outsyms; - - /* If this symbol was garbage collected, just skip it. */ - if (xcoff_hash_table (finfo->info)->gc - && (h->flags & XCOFF_MARK) == 0) - return true; - - /* If we need a .loader section entry, write it out. */ - if (h->ldsym != NULL) - { - struct internal_ldsym *ldsym; - bfd *impbfd; - - ldsym = h->ldsym; - - if (h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak) - { - ldsym->l_value = 0; - ldsym->l_scnum = N_UNDEF; - ldsym->l_smtype = XTY_ER; - impbfd = h->root.u.undef.abfd; - } - else if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - asection *sec; - - sec = h->root.u.def.section; - ldsym->l_value = (sec->output_section->vma - + sec->output_offset - + h->root.u.def.value); - ldsym->l_scnum = sec->output_section->target_index; - ldsym->l_smtype = XTY_SD; - impbfd = sec->owner; - } - else - abort (); - - if (((h->flags & XCOFF_DEF_REGULAR) == 0 - && (h->flags & XCOFF_DEF_DYNAMIC) != 0) - || (h->flags & XCOFF_IMPORT) != 0) - ldsym->l_smtype |= L_IMPORT; - if (((h->flags & XCOFF_DEF_REGULAR) != 0 - && (h->flags & XCOFF_DEF_DYNAMIC) != 0) - || (h->flags & XCOFF_EXPORT) != 0) - ldsym->l_smtype |= L_EXPORT; - if ((h->flags & XCOFF_ENTRY) != 0) - ldsym->l_smtype |= L_ENTRY; - - ldsym->l_smclas = h->smclas; - - if (ldsym->l_ifile == (bfd_size_type) -1) - ldsym->l_ifile = 0; - else if (ldsym->l_ifile == 0) - { - if ((ldsym->l_smtype & L_IMPORT) == 0) - ldsym->l_ifile = 0; - else if (impbfd == NULL) - ldsym->l_ifile = 0; - else - { - BFD_ASSERT (impbfd->xvec == output_bfd->xvec); - ldsym->l_ifile = xcoff_data (impbfd)->import_file_id; - } - } - - ldsym->l_parm = 0; - - BFD_ASSERT (h->ldindx >= 0); - BFD_ASSERT (LDSYMSZ == sizeof (struct external_ldsym)); - xcoff_swap_ldsym_out (output_bfd, ldsym, finfo->ldsym + h->ldindx - 3); - h->ldsym = NULL; - } - - /* If this symbol needs global linkage code, write it out. */ - if (h->root.type == bfd_link_hash_defined - && (h->root.u.def.section - == xcoff_hash_table (finfo->info)->linkage_section)) - { - bfd_byte *p; - bfd_vma tocoff; - unsigned int i; - - p = h->root.u.def.section->contents + h->root.u.def.value; - - /* The first instruction in the global linkage code loads a - specific TOC element. */ - tocoff = (h->descriptor->toc_section->output_section->vma - + h->descriptor->toc_section->output_offset - - xcoff_data (output_bfd)->toc); - if ((h->descriptor->flags & XCOFF_SET_TOC) != 0) - tocoff += h->descriptor->u.toc_offset; - bfd_put_32 (output_bfd, XCOFF_GLINK_FIRST | (tocoff & 0xffff), p); - for (i = 0, p += 4; - i < sizeof xcoff_glink_code / sizeof xcoff_glink_code[0]; - i++, p += 4) - bfd_put_32 (output_bfd, xcoff_glink_code[i], p); - } - - /* If we created a TOC entry for this symbol, write out the required - relocs. */ - if ((h->flags & XCOFF_SET_TOC) != 0) - { - asection *tocsec; - asection *osec; - int oindx; - struct internal_reloc *irel; - struct internal_ldrel ldrel; - struct internal_syment irsym; - union internal_auxent iraux; - - tocsec = h->toc_section; - osec = tocsec->output_section; - oindx = osec->target_index; - irel = finfo->section_info[oindx].relocs + osec->reloc_count; - irel->r_vaddr = (osec->vma - + tocsec->output_offset - + h->u.toc_offset); - if (h->indx >= 0) - irel->r_symndx = h->indx; - else - { - h->indx = -2; - irel->r_symndx = obj_raw_syment_count (output_bfd); - } - irel->r_type = R_POS; - irel->r_size = 31; - finfo->section_info[oindx].rel_hashes[osec->reloc_count] = NULL; - ++osec->reloc_count; - - BFD_ASSERT (h->ldindx >= 0); - ldrel.l_vaddr = irel->r_vaddr; - ldrel.l_symndx = h->ldindx; - ldrel.l_rtype = (31 << 8) | R_POS; - ldrel.l_rsecnm = oindx; - xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel); - ++finfo->ldrel; - - /* We need to emit a symbol to define a csect which holds the - reloc. */ - if (finfo->info->strip != strip_all) - { - if (strlen (h->root.root.string) <= SYMNMLEN) - strncpy (irsym._n._n_name, h->root.root.string, SYMNMLEN); - else - { - boolean hash; - bfd_size_type indx; - - hash = true; - if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0) - hash = false; - indx = _bfd_stringtab_add (finfo->strtab, h->root.root.string, - hash, false); - if (indx == (bfd_size_type) -1) - return false; - irsym._n._n_n._n_zeroes = 0; - irsym._n._n_n._n_offset = STRING_SIZE_SIZE + indx; - } - - irsym.n_value = irel->r_vaddr; - irsym.n_scnum = osec->target_index; - irsym.n_sclass = C_HIDEXT; - irsym.n_type = T_NULL; - irsym.n_numaux = 1; - - bfd_coff_swap_sym_out (output_bfd, (PTR) &irsym, (PTR) outsym); - outsym += bfd_coff_symesz (output_bfd); - - memset (&iraux, 0, sizeof iraux); - iraux.x_csect.x_smtyp = XTY_SD; - iraux.x_csect.x_scnlen.l = 4; - iraux.x_csect.x_smclas = XMC_TC; - - bfd_coff_swap_aux_out (output_bfd, (PTR) &iraux, T_NULL, C_HIDEXT, - 0, 1, (PTR) outsym); - outsym += bfd_coff_auxesz (output_bfd); - - if (h->indx >= 0) - { - /* We aren't going to write out the symbols below, so we - need to write them out now. */ - if (bfd_seek (output_bfd, - (obj_sym_filepos (output_bfd) - + (obj_raw_syment_count (output_bfd) - * bfd_coff_symesz (output_bfd))), - SEEK_SET) != 0 - || (bfd_write (finfo->outsyms, outsym - finfo->outsyms, 1, - output_bfd) - != (bfd_size_type) (outsym - finfo->outsyms))) - return false; - obj_raw_syment_count (output_bfd) += - (outsym - finfo->outsyms) / bfd_coff_symesz (output_bfd); - - outsym = finfo->outsyms; - } - } - } - - /* If this symbol is a specially defined function descriptor, write - it out. The first word is the address of the function code - itself, the second word is the address of the TOC, and the third - word is zero. */ - if ((h->flags & XCOFF_DESCRIPTOR) != 0 - && h->root.type == bfd_link_hash_defined - && (h->root.u.def.section - == xcoff_hash_table (finfo->info)->descriptor_section)) - { - asection *sec; - asection *osec; - int oindx; - bfd_byte *p; - struct xcoff_link_hash_entry *hentry; - asection *esec; - struct internal_reloc *irel; - struct internal_ldrel ldrel; - asection *tsec; - - sec = h->root.u.def.section; - osec = sec->output_section; - oindx = osec->target_index; - p = sec->contents + h->root.u.def.value; - - hentry = h->descriptor; - BFD_ASSERT (hentry != NULL - && (hentry->root.type == bfd_link_hash_defined - || hentry->root.type == bfd_link_hash_defweak)); - esec = hentry->root.u.def.section; - bfd_put_32 (output_bfd, - (esec->output_section->vma - + esec->output_offset - + hentry->root.u.def.value), - p); - - irel = finfo->section_info[oindx].relocs + osec->reloc_count; - irel->r_vaddr = (osec->vma - + sec->output_offset - + h->root.u.def.value); - irel->r_symndx = esec->output_section->target_index; - irel->r_type = R_POS; - irel->r_size = 31; - finfo->section_info[oindx].rel_hashes[osec->reloc_count] = NULL; - ++osec->reloc_count; - - ldrel.l_vaddr = irel->r_vaddr; - if (strcmp (esec->output_section->name, ".text") == 0) - ldrel.l_symndx = 0; - else if (strcmp (esec->output_section->name, ".data") == 0) - ldrel.l_symndx = 1; - else if (strcmp (esec->output_section->name, ".bss") == 0) - ldrel.l_symndx = 2; - else - { - (*_bfd_error_handler) - (_("%s: loader reloc in unrecognized section `%s'"), - bfd_get_filename (output_bfd), - esec->output_section->name); - bfd_set_error (bfd_error_nonrepresentable_section); - return false; - } - ldrel.l_rtype = (31 << 8) | R_POS; - ldrel.l_rsecnm = oindx; - xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel); - ++finfo->ldrel; - - bfd_put_32 (output_bfd, xcoff_data (output_bfd)->toc, p + 4); - - tsec = coff_section_from_bfd_index (output_bfd, - xcoff_data (output_bfd)->sntoc); - - ++irel; - irel->r_vaddr = (osec->vma - + sec->output_offset - + h->root.u.def.value - + 4); - irel->r_symndx = tsec->output_section->target_index; - irel->r_type = R_POS; - irel->r_size = 31; - finfo->section_info[oindx].rel_hashes[osec->reloc_count] = NULL; - ++osec->reloc_count; - - ldrel.l_vaddr = irel->r_vaddr; - if (strcmp (tsec->output_section->name, ".text") == 0) - ldrel.l_symndx = 0; - else if (strcmp (tsec->output_section->name, ".data") == 0) - ldrel.l_symndx = 1; - else if (strcmp (tsec->output_section->name, ".bss") == 0) - ldrel.l_symndx = 2; - else - { - (*_bfd_error_handler) - (_("%s: loader reloc in unrecognized section `%s'"), - bfd_get_filename (output_bfd), - tsec->output_section->name); - bfd_set_error (bfd_error_nonrepresentable_section); - return false; - } - ldrel.l_rtype = (31 << 8) | R_POS; - ldrel.l_rsecnm = oindx; - xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel); - ++finfo->ldrel; - } - - if (h->indx >= 0 || finfo->info->strip == strip_all) - { - BFD_ASSERT (outsym == finfo->outsyms); - return true; - } - - if (h->indx != -2 - && (finfo->info->strip == strip_all - || (finfo->info->strip == strip_some - && (bfd_hash_lookup (finfo->info->keep_hash, - h->root.root.string, false, false) - == NULL)))) - { - BFD_ASSERT (outsym == finfo->outsyms); - return true; - } - - if (h->indx != -2 - && (h->flags & (XCOFF_REF_REGULAR | XCOFF_DEF_REGULAR)) == 0) - { - BFD_ASSERT (outsym == finfo->outsyms); - return true; - } - - memset (&aux, 0, sizeof aux); - - h->indx = obj_raw_syment_count (output_bfd); - - if (strlen (h->root.root.string) <= SYMNMLEN) - strncpy (isym._n._n_name, h->root.root.string, SYMNMLEN); - else - { - boolean hash; - bfd_size_type indx; - - hash = true; - if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0) - hash = false; - indx = _bfd_stringtab_add (finfo->strtab, h->root.root.string, hash, - false); - if (indx == (bfd_size_type) -1) - return false; - isym._n._n_n._n_zeroes = 0; - isym._n._n_n._n_offset = STRING_SIZE_SIZE + indx; - } - - if (h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak) - { - isym.n_value = 0; - isym.n_scnum = N_UNDEF; - isym.n_sclass = C_EXT; - aux.x_csect.x_smtyp = XTY_ER; - } - else if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && h->smclas == XMC_XO) - { - BFD_ASSERT (bfd_is_abs_section (h->root.u.def.section)); - isym.n_value = h->root.u.def.value; - isym.n_scnum = N_UNDEF; - isym.n_sclass = C_EXT; - aux.x_csect.x_smtyp = XTY_ER; - } - else if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - struct xcoff_link_size_list *l; - - isym.n_value = (h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset - + h->root.u.def.value); - isym.n_scnum = h->root.u.def.section->output_section->target_index; - isym.n_sclass = C_HIDEXT; - aux.x_csect.x_smtyp = XTY_SD; - - if ((h->flags & XCOFF_HAS_SIZE) != 0) - { - for (l = xcoff_hash_table (finfo->info)->size_list; - l != NULL; - l = l->next) - { - if (l->h == h) - { - aux.x_csect.x_scnlen.l = l->size; - break; - } - } - } - } - else if (h->root.type == bfd_link_hash_common) - { - isym.n_value = (h->root.u.c.p->section->output_section->vma - + h->root.u.c.p->section->output_offset); - isym.n_scnum = h->root.u.c.p->section->output_section->target_index; - isym.n_sclass = C_EXT; - aux.x_csect.x_smtyp = XTY_CM; - aux.x_csect.x_scnlen.l = h->root.u.c.size; - } - else - abort (); - - isym.n_type = T_NULL; - isym.n_numaux = 1; - - bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) outsym); - outsym += bfd_coff_symesz (output_bfd); - - aux.x_csect.x_smclas = h->smclas; - - bfd_coff_swap_aux_out (output_bfd, (PTR) &aux, T_NULL, isym.n_sclass, 0, 1, - (PTR) outsym); - outsym += bfd_coff_auxesz (output_bfd); - - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && h->smclas != XMC_XO) - { - /* We just output an SD symbol. Now output an LD symbol. */ - - h->indx += 2; - - isym.n_sclass = C_EXT; - bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) outsym); - outsym += bfd_coff_symesz (output_bfd); - - aux.x_csect.x_smtyp = XTY_LD; - aux.x_csect.x_scnlen.l = obj_raw_syment_count (output_bfd); - - bfd_coff_swap_aux_out (output_bfd, (PTR) &aux, T_NULL, C_EXT, 0, 1, - (PTR) outsym); - outsym += bfd_coff_auxesz (output_bfd); - } - - if (bfd_seek (output_bfd, - (obj_sym_filepos (output_bfd) - + (obj_raw_syment_count (output_bfd) - * bfd_coff_symesz (output_bfd))), - SEEK_SET) != 0 - || (bfd_write (finfo->outsyms, outsym - finfo->outsyms, 1, output_bfd) - != (bfd_size_type) (outsym - finfo->outsyms))) - return false; - obj_raw_syment_count (output_bfd) += - (outsym - finfo->outsyms) / bfd_coff_symesz (output_bfd); - - return true; -} - -/* Handle a link order which is supposed to generate a reloc. */ - -static boolean -xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order) - bfd *output_bfd; - struct xcoff_final_link_info *finfo; - asection *output_section; - struct bfd_link_order *link_order; -{ - reloc_howto_type *howto; - struct xcoff_link_hash_entry *h; - asection *hsec; - bfd_vma hval; - bfd_vma addend; - struct internal_reloc *irel; - struct xcoff_link_hash_entry **rel_hash_ptr; - struct internal_ldrel ldrel; - - if (link_order->type == bfd_section_reloc_link_order) - { - /* We need to somehow locate a symbol in the right section. The - symbol must either have a value of zero, or we must adjust - the addend by the value of the symbol. FIXME: Write this - when we need it. The old linker couldn't handle this anyhow. */ - abort (); - } - - howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc); - if (howto == NULL) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - h = ((struct xcoff_link_hash_entry *) - bfd_wrapped_link_hash_lookup (output_bfd, finfo->info, - link_order->u.reloc.p->u.name, - false, false, true)); - if (h == NULL) - { - if (! ((*finfo->info->callbacks->unattached_reloc) - (finfo->info, link_order->u.reloc.p->u.name, (bfd *) NULL, - (asection *) NULL, (bfd_vma) 0))) - return false; - return true; - } - - if (h->root.type == bfd_link_hash_common) - { - hsec = h->root.u.c.p->section; - hval = 0; - } - else if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - hsec = h->root.u.def.section; - hval = h->root.u.def.value; - } - else - { - hsec = NULL; - hval = 0; - } - - addend = link_order->u.reloc.p->addend; - if (hsec != NULL) - addend += (hsec->output_section->vma - + hsec->output_offset - + hval); - - if (addend != 0) - { - bfd_size_type size; - bfd_byte *buf; - bfd_reloc_status_type rstat; - boolean ok; - - size = bfd_get_reloc_size (howto); - buf = (bfd_byte *) bfd_zmalloc (size); - if (buf == NULL) - return false; - - rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf); - switch (rstat) - { - case bfd_reloc_ok: - break; - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - if (! ((*finfo->info->callbacks->reloc_overflow) - (finfo->info, link_order->u.reloc.p->u.name, - howto->name, addend, (bfd *) NULL, (asection *) NULL, - (bfd_vma) 0))) - { - free (buf); - return false; - } - break; - } - ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf, - (file_ptr) link_order->offset, size); - free (buf); - if (! ok) - return false; - } - - /* Store the reloc information in the right place. It will get - swapped and written out at the end of the final_link routine. */ - - irel = (finfo->section_info[output_section->target_index].relocs - + output_section->reloc_count); - rel_hash_ptr = (finfo->section_info[output_section->target_index].rel_hashes - + output_section->reloc_count); - - memset (irel, 0, sizeof (struct internal_reloc)); - *rel_hash_ptr = NULL; - - irel->r_vaddr = output_section->vma + link_order->offset; - - if (h->indx >= 0) - irel->r_symndx = h->indx; - else - { - /* Set the index to -2 to force this symbol to get written out. */ - h->indx = -2; - *rel_hash_ptr = h; - irel->r_symndx = 0; - } - - irel->r_type = howto->type; - irel->r_size = howto->bitsize - 1; - if (howto->complain_on_overflow == complain_overflow_signed) - irel->r_size |= 0x80; - - ++output_section->reloc_count; - - /* Now output the reloc to the .loader section. */ - - ldrel.l_vaddr = irel->r_vaddr; - - if (hsec != NULL) - { - const char *secname; - - secname = hsec->output_section->name; - - if (strcmp (secname, ".text") == 0) - ldrel.l_symndx = 0; - else if (strcmp (secname, ".data") == 0) - ldrel.l_symndx = 1; - else if (strcmp (secname, ".bss") == 0) - ldrel.l_symndx = 2; - else - { - (*_bfd_error_handler) - (_("%s: loader reloc in unrecognized section `%s'"), - bfd_get_filename (output_bfd), secname); - bfd_set_error (bfd_error_nonrepresentable_section); - return false; - } - } - else - { - if (h->ldindx < 0) - { - (*_bfd_error_handler) - (_("%s: `%s' in loader reloc but not loader sym"), - bfd_get_filename (output_bfd), - h->root.root.string); - bfd_set_error (bfd_error_bad_value); - return false; - } - ldrel.l_symndx = h->ldindx; - } - - ldrel.l_rtype = (irel->r_size << 8) | irel->r_type; - ldrel.l_rsecnm = output_section->target_index; - xcoff_swap_ldrel_out (output_bfd, &ldrel, finfo->ldrel); - ++finfo->ldrel; - - return true; -} - -/* Sort relocs by VMA. This is called via qsort. */ - -static int -xcoff_sort_relocs (p1, p2) - const PTR p1; - const PTR p2; -{ - const struct internal_reloc *r1 = (const struct internal_reloc *) p1; - const struct internal_reloc *r2 = (const struct internal_reloc *) p2; - - if (r1->r_vaddr > r2->r_vaddr) - return 1; - else if (r1->r_vaddr < r2->r_vaddr) - return -1; - else - return 0; -} - -/* This is the relocation function for the RS/6000/POWER/PowerPC. - This is currently the only processor which uses XCOFF; I hope that - will never change. */ - -boolean -_bfd_ppc_xcoff_relocate_section (output_bfd, info, input_bfd, - input_section, contents, relocs, syms, - sections) - bfd *output_bfd; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - struct internal_reloc *relocs; - struct internal_syment *syms; - asection **sections; -{ - struct internal_reloc *rel; - struct internal_reloc *relend; - - rel = relocs; - relend = rel + input_section->reloc_count; - for (; rel < relend; rel++) - { - long symndx; - struct xcoff_link_hash_entry *h; - struct internal_syment *sym; - bfd_vma addend; - bfd_vma val; - struct reloc_howto_struct howto; - bfd_reloc_status_type rstat; - - /* Relocation type R_REF is a special relocation type which is - merely used to prevent garbage collection from occurring for - the csect including the symbol which it references. */ - if (rel->r_type == R_REF) - continue; - - symndx = rel->r_symndx; - - if (symndx == -1) - { - h = NULL; - sym = NULL; - addend = 0; - } - else - { - h = obj_xcoff_sym_hashes (input_bfd)[symndx]; - sym = syms + symndx; - addend = - sym->n_value; - } - - /* We build the howto information on the fly. */ - - howto.type = rel->r_type; - howto.rightshift = 0; - howto.size = 2; - howto.bitsize = (rel->r_size & 0x1f) + 1; - howto.pc_relative = false; - howto.bitpos = 0; - if ((rel->r_size & 0x80) != 0) - howto.complain_on_overflow = complain_overflow_signed; - else - howto.complain_on_overflow = complain_overflow_bitfield; - howto.special_function = NULL; - howto.name = "internal"; - howto.partial_inplace = true; - if (howto.bitsize == 32) - howto.src_mask = howto.dst_mask = 0xffffffff; - else - { - howto.src_mask = howto.dst_mask = (1 << howto.bitsize) - 1; - if (howto.bitsize == 16) - howto.size = 1; - } - howto.pcrel_offset = false; - - val = 0; - - if (h == NULL) - { - asection *sec; - - if (symndx == -1) - { - sec = bfd_abs_section_ptr; - val = 0; - } - else - { - sec = sections[symndx]; - /* Hack to make sure we use the right TOC anchor value - if this reloc is against the TOC anchor. */ - if (sec->name[3] == '0' - && strcmp (sec->name, ".tc0") == 0) - val = xcoff_data (output_bfd)->toc; - else - val = (sec->output_section->vma - + sec->output_offset - + sym->n_value - - sec->vma); - } - } - else - { - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - asection *sec; - - sec = h->root.u.def.section; - val = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } - else if (h->root.type == bfd_link_hash_common) - { - asection *sec; - - sec = h->root.u.c.p->section; - val = (sec->output_section->vma - + sec->output_offset); - } - else if ((h->flags & XCOFF_DEF_DYNAMIC) != 0 - || (h->flags & XCOFF_IMPORT) != 0) - { - /* Every symbol in a shared object is defined somewhere. */ - val = 0; - } - else if (! info->relocateable) - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma, true))) - return false; - - /* Don't try to process the reloc. It can't help, and - it may generate another error. */ - continue; - } - } - - /* I took the relocation type definitions from two documents: - the PowerPC AIX Version 4 Application Binary Interface, First - Edition (April 1992), and the PowerOpen ABI, Big-Endian - 32-Bit Hardware Implementation (June 30, 1994). Differences - between the documents are noted below. */ - - switch (rel->r_type) - { - case R_RTB: - case R_RRTBI: - case R_RRTBA: - /* These relocs are defined by the PowerPC ABI to be - relative branches which use half of the difference - between the symbol and the program counter. I can't - quite figure out when this is useful. These relocs are - not defined by the PowerOpen ABI. */ - default: - (*_bfd_error_handler) - (_("%s: unsupported relocation type 0x%02x"), - bfd_get_filename (input_bfd), (unsigned int) rel->r_type); - bfd_set_error (bfd_error_bad_value); - return false; - case R_POS: - /* Simple positive relocation. */ - break; - case R_NEG: - /* Simple negative relocation. */ - val = - val; - break; - case R_REL: - /* Simple PC relative relocation. */ - howto.pc_relative = true; - break; - case R_TOC: - /* TOC relative relocation. The value in the instruction in - the input file is the offset from the input file TOC to - the desired location. We want the offset from the final - TOC to the desired location. We have: - isym = iTOC + in - iinsn = in + o - osym = oTOC + on - oinsn = on + o - so we must change insn by on - in. - */ - case R_GL: - /* Global linkage relocation. The value of this relocation - is the address of the entry in the TOC section. */ - case R_TCL: - /* Local object TOC address. I can't figure out the - difference between this and case R_GL. */ - case R_TRL: - /* TOC relative relocation. A TOC relative load instruction - which may be changed to a load address instruction. - FIXME: We don't currently implement this optimization. */ - case R_TRLA: - /* TOC relative relocation. This is a TOC relative load - address instruction which may be changed to a load - instruction. FIXME: I don't know if this is the correct - implementation. */ - if (h != NULL && h->smclas != XMC_TD) - { - if (h->toc_section == NULL) - { - (*_bfd_error_handler) - (_("%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"), - bfd_get_filename (input_bfd), rel->r_vaddr, - h->root.root.string); - bfd_set_error (bfd_error_bad_value); - return false; - } - - BFD_ASSERT ((h->flags & XCOFF_SET_TOC) == 0); - val = (h->toc_section->output_section->vma - + h->toc_section->output_offset); - } - - val = ((val - xcoff_data (output_bfd)->toc) - - (sym->n_value - xcoff_data (input_bfd)->toc)); - addend = 0; - break; - case R_BA: - /* Absolute branch. We don't want to mess with the lower - two bits of the instruction. */ - case R_CAI: - /* The PowerPC ABI defines this as an absolute call which - may be modified to become a relative call. The PowerOpen - ABI does not define this relocation type. */ - case R_RBA: - /* Absolute branch which may be modified to become a - relative branch. */ - case R_RBAC: - /* The PowerPC ABI defines this as an absolute branch to a - fixed address which may be modified to an absolute branch - to a symbol. The PowerOpen ABI does not define this - relocation type. */ - case R_RBRC: - /* The PowerPC ABI defines this as an absolute branch to a - fixed address which may be modified to a relative branch. - The PowerOpen ABI does not define this relocation type. */ - howto.src_mask &= ~3; - howto.dst_mask = howto.src_mask; - break; - case R_BR: - /* Relative branch. We don't want to mess with the lower - two bits of the instruction. */ - case R_CREL: - /* The PowerPC ABI defines this as a relative call which may - be modified to become an absolute call. The PowerOpen - ABI does not define this relocation type. */ - case R_RBR: - /* A relative branch which may be modified to become an - absolute branch. FIXME: We don't implement this, - although we should for symbols of storage mapping class - XMC_XO. */ - howto.pc_relative = true; - howto.src_mask &= ~3; - howto.dst_mask = howto.src_mask; - break; - case R_RL: - /* The PowerPC AIX ABI describes this as a load which may be - changed to a load address. The PowerOpen ABI says this - is the same as case R_POS. */ - break; - case R_RLA: - /* The PowerPC AIX ABI describes this as a load address - which may be changed to a load. The PowerOpen ABI says - this is the same as R_POS. */ - break; - } - - /* If we see an R_BR or R_RBR reloc which is jumping to global - linkage code, and it is followed by an appropriate cror nop - instruction, we replace the cror with lwz r2,20(r1). This - restores the TOC after the glink code. Contrariwise, if the - call is followed by a lwz r2,20(r1), but the call is not - going to global linkage code, we can replace the load with a - cror. */ - if ((rel->r_type == R_BR || rel->r_type == R_RBR) - && h != NULL - && h->root.type == bfd_link_hash_defined - && (rel->r_vaddr - input_section->vma + 8 - <= input_section->_cooked_size)) - { - bfd_byte *pnext; - unsigned long next; - - pnext = contents + (rel->r_vaddr - input_section->vma) + 4; - next = bfd_get_32 (input_bfd, pnext); - - /* The _ptrgl function is magic. It is used by the AIX - compiler to call a function through a pointer. */ - if (h->smclas == XMC_GL - || strcmp (h->root.root.string, "._ptrgl") == 0) - { - if (next == 0x4def7b82 /* cror 15,15,15 */ - || next == 0x4ffffb82 /* cror 31,31,31 */ - || next == 0x60000000) /* ori r0,r0,0 */ - bfd_put_32 (input_bfd, 0x80410014, pnext); /* lwz r1,20(r1) */ - } - else - { - if (next == 0x80410014) /* lwz r1,20(r1) */ - bfd_put_32 (input_bfd, 0x60000000, pnext); /* ori r0,r0,0 */ - } - } - - /* A PC relative reloc includes the section address. */ - if (howto.pc_relative) - addend += input_section->vma; - - rstat = _bfd_final_link_relocate (&howto, input_bfd, input_section, - contents, - rel->r_vaddr - input_section->vma, - val, addend); - - switch (rstat) - { - default: - abort (); - case bfd_reloc_ok: - break; - case bfd_reloc_overflow: - { - const char *name; - char buf[SYMNMLEN + 1]; - char howto_name[10]; - - if (symndx == -1) - name = "*ABS*"; - else if (h != NULL) - name = h->root.root.string; - else - { - name = _bfd_coff_internal_syment_name (input_bfd, sym, buf); - if (name == NULL) - return false; - } - sprintf (howto_name, "0x%02x", rel->r_type); - - if (! ((*info->callbacks->reloc_overflow) - (info, name, howto_name, (bfd_vma) 0, input_bfd, - input_section, rel->r_vaddr - input_section->vma))) - return false; - } - } - } - - return true; -} diff --git a/contrib/binutils/binutils/acconfig.h b/contrib/binutils/binutils/acconfig.h deleted file mode 100644 index c38c529c901c..000000000000 --- a/contrib/binutils/binutils/acconfig.h +++ /dev/null @@ -1,34 +0,0 @@ - -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION - -/* Configured target name. */ -#undef TARGET - -/* Whether strstr must be declared even if <string.h> is included. */ -#undef NEED_DECLARATION_STRSTR - -/* Whether fprintf must be declared even if <stdio.h> is included. */ -#undef NEED_DECLARATION_FPRINTF - -/* Whether sbrk must be declared even if <unistd.h> is included. */ -#undef NEED_DECLARATION_SBRK - -/* Whether getenv must be declared even if <stdlib.h> is included. */ -#undef NEED_DECLARATION_GETENV -@TOP@ - -/* Is the type time_t defined in <time.h>? */ -#undef HAVE_TIME_T_IN_TIME_H - -/* Is the type time_t defined in <sys/types.h>? */ -#undef HAVE_TIME_T_IN_TYPES_H - -/* Does <utime.h> define struct utimbuf? */ -#undef HAVE_GOOD_UTIME_H - -/* Do we need to use the b modifier when opening binary files? */ -#undef USE_BINARY_FOPEN diff --git a/contrib/binutils/binutils/dyn-string.c b/contrib/binutils/binutils/dyn-string.c deleted file mode 100644 index a16401827657..000000000000 --- a/contrib/binutils/binutils/dyn-string.c +++ /dev/null @@ -1,107 +0,0 @@ -/* An abstract string datatype. - Copyright (C) 1998 Free Software Foundation, Inc. - Contributed by Mark Mitchell (mark@markmitchell.com). - - This file is part of GNU CC. - - GNU CC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GNU CC is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file lives in at least two places: binutils and gcc. - Don't change one without the other. */ - -#include "config.h" -#ifdef IN_GCC -#include "system.h" -#include "gansidecl.h" -#else -#include "ansidecl.h" -#endif -#include "dyn-string.h" - -extern char *xmalloc (); -extern char *xrealloc (); - -/* Create a new dynamic string capable of holding at least SPACE - characters, including the terminating NUL. If SPACE is 0, it - will be silently increased to 1. */ - -dyn_string_t -dyn_string_new (space) - int space; -{ - dyn_string_t result = (dyn_string_t) xmalloc (sizeof (struct dyn_string)); - - if (space == 0) - /* We need at least one byte in which to store the terminating - NUL. */ - space = 1; - - result->allocated = space; - result->s = (char*) xmalloc (space); - result->length = 0; - result->s[0] = '\0'; - - return result; -} - -/* Free the memory used by DS. */ - -void -dyn_string_delete (ds) - dyn_string_t ds; -{ - free (ds->s); - free (ds); -} - -/* Append the NUL-terminated string S to DS, resizing DS if - necessary. */ - -dyn_string_t -dyn_string_append (ds, s) - dyn_string_t ds; - char *s; -{ - int len = strlen (s); - dyn_string_resize (ds, ds->length + len + 1 /* '\0' */); - strcpy (ds->s + ds->length, s); - ds->length += len; - - return ds; -} - -/* Increase the capacity of DS so that it can hold at least SPACE - characters, including the terminating NUL. This function will not - (at present) reduce the capacity of DS. */ - -dyn_string_t -dyn_string_resize (ds, space) - dyn_string_t ds; - int space; -{ - int new_allocated = ds->allocated; - - while (space > new_allocated) - new_allocated *= 2; - - if (new_allocated != ds->allocated) - { - /* We actually need more space. */ - ds->allocated = new_allocated; - ds->s = (char*) xrealloc (ds->s, ds->allocated); - } - - return ds; -} diff --git a/contrib/binutils/binutils/dyn-string.h b/contrib/binutils/binutils/dyn-string.h deleted file mode 100644 index cbd25c347344..000000000000 --- a/contrib/binutils/binutils/dyn-string.h +++ /dev/null @@ -1,34 +0,0 @@ -/* An abstract string datatype. - Copyright (C) 1998 Free Software Foundation, Inc. - Contributed by Mark Mitchell (mark@markmitchell.com). - - This file is part of GNU CC. - - GNU CC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GNU CC is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file lives in at least two places: binutils and gcc. - Don't change one without the other. */ - -typedef struct dyn_string -{ - int allocated; /* The amount of space allocated for the string. */ - int length; /* The actual length of the string. */ - char *s; /* The string itself, NUL-terminated. */ -}* dyn_string_t; - -extern dyn_string_t dyn_string_new PARAMS((int)); -extern void dyn_string_delete PARAMS((dyn_string_t)); -extern dyn_string_t dyn_string_append PARAMS((dyn_string_t, char*)); -extern dyn_string_t dyn_string_resize PARAMS((dyn_string_t, int)); diff --git a/contrib/binutils/binutils/unwind-ia64.c b/contrib/binutils/binutils/unwind-ia64.c deleted file mode 100644 index 3b05c77312ed..000000000000 --- a/contrib/binutils/binutils/unwind-ia64.c +++ /dev/null @@ -1,1108 +0,0 @@ -/* unwind-ia64.c -- utility routines to dump IA-64 unwind info for readelf. - Copyright 2000, 2001 Free Software Foundation, Inc. - Contributed by David Mosberger-Tang <davidm@hpl.hp.com> - -This file is part of GNU Binutils. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "unwind-ia64.h" -#include <stdio.h> -#include <string.h> - -#if __GNUC__ >= 2 -/* Define BFD64 here, even if our default architecture is 32 bit ELF - as this will allow us to read in and parse 64bit and 32bit ELF files. - Only do this if we belive that the compiler can support a 64 bit - data type. For now we only rely on GCC being able to do this. */ -#define BFD64 -#endif -#include "bfd.h" - -static bfd_vma unw_rlen = 0; - -static void -unw_print_brmask (cp, mask) - char * cp; - unsigned char mask; -{ - char *sep = ""; - int i; - - for (i = 0; mask && (i < 5); ++i) - { - if (mask & 1) - { - cp += sprintf (cp, "%sb%u", sep, i + 1); - sep = ","; - } - mask >>= 1; - } - *cp = '\0'; -} - -static void -unw_print_grmask (cp, mask) - char * cp; - unsigned char mask; -{ - char *sep = ""; - int i; - - *cp = '\0'; - for (i = 0; i < 4; ++i) - { - if (mask & 1) - { - cp += sprintf (cp, "%sr%u", sep, i + 4); - sep = ","; - } - mask >>= 1; - } -} - -static void -unw_print_frmask (cp, mask) - char * cp; - unsigned long mask; -{ - char *sep = ""; - int i; - - *cp = '\0'; - for (i = 0; i < 20; ++i) - { - if (mask & 1) - { - cp += sprintf (cp, "%sf%u", sep, (i < 4) ? (i + 2) : (i + 12)); - sep = ","; - } - mask >>= 1; - } -} - -static void -unw_print_abreg (cp, abreg) - char * cp; - unsigned char abreg; -{ - static const char *special_reg[16] = - { - "pr", "psp", "@priunat", "rp", "ar.bsp", "ar.bspstore", "ar.rnat", - "ar.unat", "ar.fpsr", "ar.pfs", "ar.lc", - "Unknown11", "Unknown12", "Unknown13", "Unknown14", "Unknown15" - }; - - switch ((abreg >> 5) & 0x3) - { - case 0: /* gr */ - sprintf (cp, "r%u", (abreg & 0x1f)); - break; - - case 1: /* fr */ - sprintf (cp, "f%u", (abreg & 0x1f)); - break; - - case 2: /* br */ - sprintf (cp, "b%u", (abreg & 0x1f)); - break; - - case 3: /* special */ - strcpy (cp, special_reg[abreg & 0xf]); - break; - } -} - -static void -unw_print_xyreg (cp, x, ytreg) - char * cp; - unsigned char x; - unsigned char ytreg; -{ - switch ((x << 1) | ((ytreg >> 7) & 1)) - { - case 0: /* gr */ - sprintf (cp, "r%u", (ytreg & 0x1f)); - break; - - case 1: /* fr */ - sprintf (cp, "f%u", (ytreg & 0x1f)); - break; - - case 2: /* br */ - sprintf (cp, "b%u", (ytreg & 0x1f)); - break; - } -} - -#define UNW_REG_BSP "bsp" -#define UNW_REG_BSPSTORE "bspstore" -#define UNW_REG_FPSR "fpsr" -#define UNW_REG_LC "lc" -#define UNW_REG_PFS "pfs" -#define UNW_REG_PR "pr" -#define UNW_REG_PSP "psp" -#define UNW_REG_RNAT "rnat" -#define UNW_REG_RP "rp" -#define UNW_REG_UNAT "unat" - -typedef bfd_vma unw_word; - -#define UNW_DEC_BAD_CODE(code) \ - printf ("Unknown code 0x%02x\n", code) - -#define UNW_DEC_PROLOGUE(fmt, body, rlen, arg) \ - do \ - { \ - unw_rlen = rlen; \ - *(int *)arg = body; \ - printf (" %s:%s(rlen=%lu)\n", \ - fmt, body ? "body" : "prologue", (unsigned long) rlen); \ - } \ - while (0) - -#define UNW_DEC_PROLOGUE_GR(fmt, rlen, mask, grsave, arg) \ - do \ - { \ - char regname[16], maskstr[64], *sep; \ - \ - unw_rlen = rlen; \ - *(int *)arg = 0; \ - \ - maskstr[0] = '\0'; \ - sep = ""; \ - if (mask & 0x8) \ - { \ - strcat (maskstr, "rp"); \ - sep = ","; \ - } \ - if (mask & 0x4) \ - { \ - strcat (maskstr, sep); \ - strcat (maskstr, "ar.pfs"); \ - sep = ","; \ - } \ - if (mask & 0x2) \ - { \ - strcat (maskstr, sep); \ - strcat (maskstr, "psp"); \ - sep = ","; \ - } \ - if (mask & 0x1) \ - { \ - strcat (maskstr, sep); \ - strcat (maskstr, "pr"); \ - } \ - sprintf (regname, "r%u", grsave); \ - printf (" %s:prologue_gr(mask=[%s],grsave=%s,rlen=%lu)\n", \ - fmt, maskstr, regname, (unsigned long) rlen); \ - } \ - while (0) - -#define UNW_DEC_FR_MEM(fmt, frmask, arg) \ - do \ - { \ - char frstr[200]; \ - \ - unw_print_frmask (frstr, frmask); \ - printf ("\t%s:fr_mem(frmask=[%s])\n", fmt, frstr); \ - } \ - while (0) - -#define UNW_DEC_GR_MEM(fmt, grmask, arg) \ - do \ - { \ - char grstr[200]; \ - \ - unw_print_grmask (grstr, grmask); \ - printf ("\t%s:gr_mem(grmask=[%s])\n", fmt, grstr); \ - } \ - while (0) - -#define UNW_DEC_FRGR_MEM(fmt, grmask, frmask, arg) \ - do \ - { \ - char frstr[200], grstr[20]; \ - \ - unw_print_grmask (grstr, grmask); \ - unw_print_frmask (frstr, frmask); \ - printf ("\t%s:frgr_mem(grmask=[%s],frmask=[%s])\n", fmt, grstr, frstr); \ - } \ - while (0) - -#define UNW_DEC_BR_MEM(fmt, brmask, arg) \ - do \ - { \ - char brstr[20]; \ - \ - unw_print_brmask (brstr, brmask); \ - printf ("\t%s:br_mem(brmask=[%s])\n", fmt, brstr); \ - } \ - while (0) - -#define UNW_DEC_BR_GR(fmt, brmask, gr, arg) \ - do \ - { \ - char brstr[20]; \ - \ - unw_print_brmask (brstr, brmask); \ - printf ("\t%s:br_gr(brmask=[%s],gr=r%u)\n", fmt, brstr, gr); \ - } \ - while (0) - -#define UNW_DEC_REG_GR(fmt, src, dst, arg) \ - printf ("\t%s:%s_gr(reg=r%u)\n", fmt, src, dst) - -#define UNW_DEC_RP_BR(fmt, dst, arg) \ - printf ("\t%s:rp_br(reg=b%u)\n", fmt, dst) - -#define UNW_DEC_REG_WHEN(fmt, reg, t, arg) \ - printf ("\t%s:%s_when(t=%lu)\n", fmt, reg, (unsigned long) t) - -#define UNW_DEC_REG_SPREL(fmt, reg, spoff, arg) \ - printf ("\t%s:%s_sprel(spoff=0x%lx)\n", \ - fmt, reg, 4*(unsigned long)spoff) - -#define UNW_DEC_REG_PSPREL(fmt, reg, pspoff, arg) \ - printf ("\t%s:%s_psprel(pspoff=0x10-0x%lx)\n", \ - fmt, reg, 4*(unsigned long)pspoff) - -#define UNW_DEC_GR_GR(fmt, grmask, gr, arg) \ - do \ - { \ - char grstr[20]; \ - \ - unw_print_grmask (grstr, grmask); \ - printf ("\t%s:gr_gr(grmask=[%s],r%u)\n", fmt, grstr, gr); \ - } \ - while (0) - -#define UNW_DEC_ABI(fmt, abi, context, arg) \ - do \ - { \ - static const char *abiname[] = \ - { \ - "@svr4", "@hpux", "@nt" \ - }; \ - char buf[20]; \ - const char *abistr = buf; \ - \ - if (abi < 3) \ - abistr = abiname[abi]; \ - else \ - sprintf (buf, "0x%x", abi); \ - printf ("\t%s:unwabi(abi=%s,context=0x%02x)\n", \ - fmt, abistr, context); \ - } \ - while (0) - -#define UNW_DEC_PRIUNAT_GR(fmt, r, arg) \ - printf ("\t%s:priunat_gr(reg=r%u)\n", fmt, r) - -#define UNW_DEC_PRIUNAT_WHEN_GR(fmt, t, arg) \ - printf ("\t%s:priunat_when_gr(t=%lu)\n", fmt, (unsigned long) t) - -#define UNW_DEC_PRIUNAT_WHEN_MEM(fmt, t, arg) \ - printf ("\t%s:priunat_when_mem(t=%lu)\n", fmt, (unsigned long) t) - -#define UNW_DEC_PRIUNAT_PSPREL(fmt, pspoff, arg) \ - printf ("\t%s:priunat_psprel(pspoff=0x10-0x%lx)\n", \ - fmt, 4*(unsigned long)pspoff) - -#define UNW_DEC_PRIUNAT_SPREL(fmt, spoff, arg) \ - printf ("\t%s:priunat_sprel(spoff=0x%lx)\n", \ - fmt, 4*(unsigned long)spoff) - -#define UNW_DEC_MEM_STACK_F(fmt, t, size, arg) \ - printf ("\t%s:mem_stack_f(t=%lu,size=%lu)\n", \ - fmt, (unsigned long) t, 16*(unsigned long)size) - -#define UNW_DEC_MEM_STACK_V(fmt, t, arg) \ - printf ("\t%s:mem_stack_v(t=%lu)\n", fmt, (unsigned long) t) - -#define UNW_DEC_SPILL_BASE(fmt, pspoff, arg) \ - printf ("\t%s:spill_base(pspoff=0x10-0x%lx)\n", \ - fmt, 4*(unsigned long)pspoff) - -#define UNW_DEC_SPILL_MASK(fmt, dp, arg) \ - do \ - { \ - static const char * spill_type = "-frb"; \ - unsigned const char * imaskp = dp; \ - unsigned char mask = 0; \ - bfd_vma insn = 0; \ - \ - printf ("\t%s:spill_mask(imask=[", fmt); \ - for (insn = 0; insn < unw_rlen; ++insn) \ - { \ - if ((insn % 4) == 0) \ - mask = *imaskp++; \ - if (insn > 0 && (insn % 3) == 0) \ - putchar (','); \ - putchar (spill_type[(mask >> (2 * (3 - (insn & 0x3)))) & 0x3]); \ - } \ - printf ("])\n"); \ - dp = imaskp; \ - } \ - while (0) - -#define UNW_DEC_SPILL_SPREL(fmt, t, abreg, spoff, arg) \ - do \ - { \ - char regname[10]; \ - \ - unw_print_abreg (regname, abreg); \ - printf ("\t%s:spill_sprel(reg=%s,t=%lu,spoff=0x%lx)\n", \ - fmt, regname, (unsigned long) t, 4*(unsigned long)off); \ - } \ - while (0) - -#define UNW_DEC_SPILL_PSPREL(fmt, t, abreg, pspoff, arg) \ - do \ - { \ - char regname[10]; \ - \ - unw_print_abreg (regname, abreg); \ - printf ("\t%s:spill_psprel(reg=%s,t=%lu,pspoff=0x10-0x%lx)\n", \ - fmt, regname, (unsigned long) t, 4*(unsigned long)pspoff); \ - } \ - while (0) - -#define UNW_DEC_RESTORE(fmt, t, abreg, arg) \ - do \ - { \ - char regname[10]; \ - \ - unw_print_abreg (regname, abreg); \ - printf ("\t%s:restore(t=%lu,reg=%s)\n", \ - fmt, (unsigned long) t, regname); \ - } \ - while (0) - -#define UNW_DEC_SPILL_REG(fmt, t, abreg, x, ytreg, arg) \ - do \ - { \ - char abregname[10], tregname[10]; \ - \ - unw_print_abreg (abregname, abreg); \ - unw_print_xyreg (tregname, x, ytreg); \ - printf ("\t%s:spill_reg(t=%lu,reg=%s,treg=%s)\n", \ - fmt, (unsigned long) t, abregname, tregname); \ - } \ - while (0) - -#define UNW_DEC_SPILL_SPREL_P(fmt, qp, t, abreg, spoff, arg) \ - do \ - { \ - char regname[20]; \ - \ - unw_print_abreg (regname, abreg); \ - printf ("\t%s:spill_sprel_p(qp=p%u,t=%lu,reg=%s,spoff=0x%lx)\n", \ - fmt, qp, (unsigned long) t, regname, 4 * (unsigned long)spoff); \ - } \ - while (0) - -#define UNW_DEC_SPILL_PSPREL_P(fmt, qp, t, abreg, pspoff, arg) \ - do \ - { \ - char regname[20]; \ - \ - unw_print_abreg (regname, abreg); \ - printf ("\t%s:spill_psprel_p(qp=p%u,t=%lu,reg=%s,pspoff=0x10-0x%lx)\n",\ - fmt, qp, (unsigned long) t, regname, 4*(unsigned long)pspoff);\ - } \ - while (0) - -#define UNW_DEC_RESTORE_P(fmt, qp, t, abreg, arg) \ - do \ - { \ - char regname[20]; \ - \ - unw_print_abreg (regname, abreg); \ - printf ("\t%s:restore_p(qp=p%u,t=%lu,reg=%s)\n", \ - fmt, qp, (unsigned long) t, regname); \ - } \ - while (0) - -#define UNW_DEC_SPILL_REG_P(fmt, qp, t, abreg, x, ytreg, arg) \ - do \ - { \ - char regname[20], tregname[20]; \ - \ - unw_print_abreg (regname, abreg); \ - unw_print_xyreg (tregname, x, ytreg); \ - printf ("\t%s:spill_reg_p(qp=p%u,t=%lu,reg=%s,treg=%s)\n", \ - fmt, qp, (unsigned long) t, regname, tregname); \ - } \ - while (0) - -#define UNW_DEC_LABEL_STATE(fmt, label, arg) \ - printf ("\t%s:label_state(label=%lu)\n", fmt, (unsigned long) label) - -#define UNW_DEC_COPY_STATE(fmt, label, arg) \ - printf ("\t%s:copy_state(label=%lu)\n", fmt, (unsigned long) label) - -#define UNW_DEC_EPILOGUE(fmt, t, ecount, arg) \ - printf ("\t%s:epilogue(t=%lu,ecount=%lu)\n", \ - fmt, (unsigned long) t, (unsigned long) ecount) - -/* - * Generic IA-64 unwind info decoder. - * - * This file is used both by the Linux kernel and objdump. Please - * keep the two copies of this file in sync (modulo differences in the - * prototypes...). - * - * You need to customize the decoder by defining the following - * macros/constants before including this file: - * - * Types: - * unw_word Unsigned integer type with at least 64 bits - * - * Register names: - * UNW_REG_BSP - * UNW_REG_BSPSTORE - * UNW_REG_FPSR - * UNW_REG_LC - * UNW_REG_PFS - * UNW_REG_PR - * UNW_REG_RNAT - * UNW_REG_PSP - * UNW_REG_RP - * UNW_REG_UNAT - * - * Decoder action macros: - * UNW_DEC_BAD_CODE(code) - * UNW_DEC_ABI(fmt,abi,context,arg) - * UNW_DEC_BR_GR(fmt,brmask,gr,arg) - * UNW_DEC_BR_MEM(fmt,brmask,arg) - * UNW_DEC_COPY_STATE(fmt,label,arg) - * UNW_DEC_EPILOGUE(fmt,t,ecount,arg) - * UNW_DEC_FRGR_MEM(fmt,grmask,frmask,arg) - * UNW_DEC_FR_MEM(fmt,frmask,arg) - * UNW_DEC_GR_GR(fmt,grmask,gr,arg) - * UNW_DEC_GR_MEM(fmt,grmask,arg) - * UNW_DEC_LABEL_STATE(fmt,label,arg) - * UNW_DEC_MEM_STACK_F(fmt,t,size,arg) - * UNW_DEC_MEM_STACK_V(fmt,t,arg) - * UNW_DEC_PRIUNAT_GR(fmt,r,arg) - * UNW_DEC_PRIUNAT_WHEN_GR(fmt,t,arg) - * UNW_DEC_PRIUNAT_WHEN_MEM(fmt,t,arg) - * UNW_DEC_PRIUNAT_WHEN_PSPREL(fmt,pspoff,arg) - * UNW_DEC_PRIUNAT_WHEN_SPREL(fmt,spoff,arg) - * UNW_DEC_PROLOGUE(fmt,body,rlen,arg) - * UNW_DEC_PROLOGUE_GR(fmt,rlen,mask,grsave,arg) - * UNW_DEC_REG_PSPREL(fmt,reg,pspoff,arg) - * UNW_DEC_REG_REG(fmt,src,dst,arg) - * UNW_DEC_REG_SPREL(fmt,reg,spoff,arg) - * UNW_DEC_REG_WHEN(fmt,reg,t,arg) - * UNW_DEC_RESTORE(fmt,t,abreg,arg) - * UNW_DEC_RESTORE_P(fmt,qp,t,abreg,arg) - * UNW_DEC_SPILL_BASE(fmt,pspoff,arg) - * UNW_DEC_SPILL_MASK(fmt,imaskp,arg) - * UNW_DEC_SPILL_PSPREL(fmt,t,abreg,pspoff,arg) - * UNW_DEC_SPILL_PSPREL_P(fmt,qp,t,abreg,pspoff,arg) - * UNW_DEC_SPILL_REG(fmt,t,abreg,x,ytreg,arg) - * UNW_DEC_SPILL_REG_P(fmt,qp,t,abreg,x,ytreg,arg) - * UNW_DEC_SPILL_SPREL(fmt,t,abreg,spoff,arg) - * UNW_DEC_SPILL_SPREL_P(fmt,qp,t,abreg,pspoff,arg) - */ - -static unw_word unw_decode_uleb128 PARAMS ((const unsigned char **)); -static const unsigned char *unw_decode_x1 PARAMS ((const unsigned char *, - unsigned char, void *)); -static const unsigned char *unw_decode_x2 PARAMS ((const unsigned char *, - unsigned char, void *)); -static const unsigned char *unw_decode_x3 PARAMS ((const unsigned char *, - unsigned char, void *)); -static const unsigned char *unw_decode_x4 PARAMS ((const unsigned char *, - unsigned char, void *)); -static const unsigned char *unw_decode_r1 PARAMS ((const unsigned char *, - unsigned char, void *)); -static const unsigned char *unw_decode_r2 PARAMS ((const unsigned char *, - unsigned char, void *)); -static const unsigned char *unw_decode_r3 PARAMS ((const unsigned char *, - unsigned char, void *)); -static const unsigned char *unw_decode_p1 PARAMS ((const unsigned char *, - unsigned char, void *)); -static const unsigned char *unw_decode_p2_p5 PARAMS ((const unsigned char *, - unsigned char, void *)); -static const unsigned char *unw_decode_p6 PARAMS ((const unsigned char *, - unsigned char, void *)); -static const unsigned char *unw_decode_p7_p10 PARAMS ((const unsigned char *, - unsigned char, void *)); -static const unsigned char *unw_decode_b1 PARAMS ((const unsigned char *, - unsigned char, void *)); -static const unsigned char *unw_decode_b2 PARAMS ((const unsigned char *, - unsigned char, void *)); -static const unsigned char *unw_decode_b3_x4 PARAMS ((const unsigned char *, - unsigned char, void *)); - -static unw_word -unw_decode_uleb128 (dpp) - const unsigned char **dpp; -{ - unsigned shift = 0; - unw_word byte, result = 0; - const unsigned char *bp = *dpp; - - while (1) - { - byte = *bp++; - result |= (byte & 0x7f) << shift; - - if ((byte & 0x80) == 0) - break; - - shift += 7; - } - - *dpp = bp; - - return result; -} - -static const unsigned char * -unw_decode_x1 (dp, code, arg) - const unsigned char * dp; - unsigned char code; - void * arg ATTRIBUTE_UNUSED; -{ - unsigned char byte1, abreg; - unw_word t, off; - - byte1 = *dp++; - t = unw_decode_uleb128 (&dp); - off = unw_decode_uleb128 (&dp); - abreg = (byte1 & 0x7f); - if (byte1 & 0x80) - UNW_DEC_SPILL_SPREL ("X1", t, abreg, off, arg); - else - UNW_DEC_SPILL_PSPREL ("X1", t, abreg, off, arg); - return dp; -} - -static const unsigned char * -unw_decode_x2 (dp, code, arg) - const unsigned char * dp; - unsigned char code; - void * arg ATTRIBUTE_UNUSED; -{ - unsigned char byte1, byte2, abreg, x, ytreg; - unw_word t; - - byte1 = *dp++; - byte2 = *dp++; - t = unw_decode_uleb128 (&dp); - abreg = (byte1 & 0x7f); - ytreg = byte2; - x = (byte1 >> 7) & 1; - if ((byte1 & 0x80) == 0 && ytreg == 0) - UNW_DEC_RESTORE ("X2", t, abreg, arg); - else - UNW_DEC_SPILL_REG ("X2", t, abreg, x, ytreg, arg); - return dp; -} - -static const unsigned char * -unw_decode_x3 (dp, code, arg) - const unsigned char * dp; - unsigned char code; - void * arg ATTRIBUTE_UNUSED; -{ - unsigned char byte1, byte2, abreg, qp; - unw_word t, off; - - byte1 = *dp++; - byte2 = *dp++; - t = unw_decode_uleb128 (&dp); - off = unw_decode_uleb128 (&dp); - - qp = (byte1 & 0x3f); - abreg = (byte2 & 0x7f); - - if (byte1 & 0x80) - UNW_DEC_SPILL_SPREL_P ("X3", qp, t, abreg, off, arg); - else - UNW_DEC_SPILL_PSPREL_P ("X3", qp, t, abreg, off, arg); - return dp; -} - -static const unsigned char * -unw_decode_x4 (dp, code, arg) - const unsigned char * dp; - unsigned char code; - void * arg ATTRIBUTE_UNUSED; -{ - unsigned char byte1, byte2, byte3, qp, abreg, x, ytreg; - unw_word t; - - byte1 = *dp++; - byte2 = *dp++; - byte3 = *dp++; - t = unw_decode_uleb128 (&dp); - - qp = (byte1 & 0x3f); - abreg = (byte2 & 0x7f); - x = (byte2 >> 7) & 1; - ytreg = byte3; - - if ((byte2 & 0x80) == 0 && byte3 == 0) - UNW_DEC_RESTORE_P ("X4", qp, t, abreg, arg); - else - UNW_DEC_SPILL_REG_P ("X4", qp, t, abreg, x, ytreg, arg); - return dp; -} - -static const unsigned char * -unw_decode_r1 (dp, code, arg) - const unsigned char *dp; - unsigned char code; - void *arg; -{ - int body = (code & 0x20) != 0; - unw_word rlen; - - rlen = (code & 0x1f); - UNW_DEC_PROLOGUE ("R1", body, rlen, arg); - return dp; -} - -static const unsigned char * -unw_decode_r2 (dp, code, arg) - const unsigned char *dp; - unsigned char code; - void *arg; -{ - unsigned char byte1, mask, grsave; - unw_word rlen; - - byte1 = *dp++; - - mask = ((code & 0x7) << 1) | ((byte1 >> 7) & 1); - grsave = (byte1 & 0x7f); - rlen = unw_decode_uleb128 (& dp); - UNW_DEC_PROLOGUE_GR ("R2", rlen, mask, grsave, arg); - return dp; -} - -static const unsigned char * -unw_decode_r3 (dp, code, arg) - const unsigned char *dp; - unsigned char code; - void *arg; -{ - unw_word rlen; - - rlen = unw_decode_uleb128 (& dp); - UNW_DEC_PROLOGUE ("R3", ((code & 0x3) == 1), rlen, arg); - return dp; -} - -static const unsigned char * -unw_decode_p1 (dp, code, arg) - const unsigned char * dp; - unsigned char code; - void * arg ATTRIBUTE_UNUSED; -{ - unsigned char brmask = (code & 0x1f); - - UNW_DEC_BR_MEM ("P1", brmask, arg); - return dp; -} - -static const unsigned char * -unw_decode_p2_p5 (dp, code, arg) - const unsigned char * dp; - unsigned char code; - void * arg ATTRIBUTE_UNUSED; -{ - if ((code & 0x10) == 0) - { - unsigned char byte1 = *dp++; - - UNW_DEC_BR_GR ("P2", ((code & 0xf) << 1) | ((byte1 >> 7) & 1), - (byte1 & 0x7f), arg); - } - else if ((code & 0x08) == 0) - { - unsigned char byte1 = *dp++, r, dst; - - r = ((code & 0x7) << 1) | ((byte1 >> 7) & 1); - dst = (byte1 & 0x7f); - switch (r) - { - case 0: - UNW_DEC_REG_GR ("P3", UNW_REG_PSP, dst, arg); - break; - case 1: - UNW_DEC_REG_GR ("P3", UNW_REG_RP, dst, arg); - break; - case 2: - UNW_DEC_REG_GR ("P3", UNW_REG_PFS, dst, arg); - break; - case 3: - UNW_DEC_REG_GR ("P3", UNW_REG_PR, dst, arg); - break; - case 4: - UNW_DEC_REG_GR ("P3", UNW_REG_UNAT, dst, arg); - break; - case 5: - UNW_DEC_REG_GR ("P3", UNW_REG_LC, dst, arg); - break; - case 6: - UNW_DEC_RP_BR ("P3", dst, arg); - break; - case 7: - UNW_DEC_REG_GR ("P3", UNW_REG_RNAT, dst, arg); - break; - case 8: - UNW_DEC_REG_GR ("P3", UNW_REG_BSP, dst, arg); - break; - case 9: - UNW_DEC_REG_GR ("P3", UNW_REG_BSPSTORE, dst, arg); - break; - case 10: - UNW_DEC_REG_GR ("P3", UNW_REG_FPSR, dst, arg); - break; - case 11: - UNW_DEC_PRIUNAT_GR ("P3", dst, arg); - break; - default: - UNW_DEC_BAD_CODE (r); - break; - } - } - else if ((code & 0x7) == 0) - UNW_DEC_SPILL_MASK ("P4", dp, arg); - else if ((code & 0x7) == 1) - { - unw_word grmask, frmask, byte1, byte2, byte3; - - byte1 = *dp++; - byte2 = *dp++; - byte3 = *dp++; - grmask = ((byte1 >> 4) & 0xf); - frmask = ((byte1 & 0xf) << 16) | (byte2 << 8) | byte3; - UNW_DEC_FRGR_MEM ("P5", grmask, frmask, arg); - } - else - UNW_DEC_BAD_CODE (code); - - return dp; -} - -static const unsigned char * -unw_decode_p6 (dp, code, arg) - const unsigned char * dp; - unsigned char code; - void * arg ATTRIBUTE_UNUSED; -{ - int gregs = (code & 0x10) != 0; - unsigned char mask = (code & 0x0f); - - if (gregs) - UNW_DEC_GR_MEM ("P6", mask, arg); - else - UNW_DEC_FR_MEM ("P6", mask, arg); - return dp; -} - -static const unsigned char * -unw_decode_p7_p10 (dp, code, arg) - const unsigned char *dp; - unsigned char code; - void *arg; -{ - unsigned char r, byte1, byte2; - unw_word t, size; - - if ((code & 0x10) == 0) - { - r = (code & 0xf); - t = unw_decode_uleb128 (&dp); - switch (r) - { - case 0: - size = unw_decode_uleb128 (&dp); - UNW_DEC_MEM_STACK_F ("P7", t, size, arg); - break; - - case 1: - UNW_DEC_MEM_STACK_V ("P7", t, arg); - break; - case 2: - UNW_DEC_SPILL_BASE ("P7", t, arg); - break; - case 3: - UNW_DEC_REG_SPREL ("P7", UNW_REG_PSP, t, arg); - break; - case 4: - UNW_DEC_REG_WHEN ("P7", UNW_REG_RP, t, arg); - break; - case 5: - UNW_DEC_REG_PSPREL ("P7", UNW_REG_RP, t, arg); - break; - case 6: - UNW_DEC_REG_WHEN ("P7", UNW_REG_PFS, t, arg); - break; - case 7: - UNW_DEC_REG_PSPREL ("P7", UNW_REG_PFS, t, arg); - break; - case 8: - UNW_DEC_REG_WHEN ("P7", UNW_REG_PR, t, arg); - break; - case 9: - UNW_DEC_REG_PSPREL ("P7", UNW_REG_PR, t, arg); - break; - case 10: - UNW_DEC_REG_WHEN ("P7", UNW_REG_LC, t, arg); - break; - case 11: - UNW_DEC_REG_PSPREL ("P7", UNW_REG_LC, t, arg); - break; - case 12: - UNW_DEC_REG_WHEN ("P7", UNW_REG_UNAT, t, arg); - break; - case 13: - UNW_DEC_REG_PSPREL ("P7", UNW_REG_UNAT, t, arg); - break; - case 14: - UNW_DEC_REG_WHEN ("P7", UNW_REG_FPSR, t, arg); - break; - case 15: - UNW_DEC_REG_PSPREL ("P7", UNW_REG_FPSR, t, arg); - break; - default: - UNW_DEC_BAD_CODE (r); - break; - } - } - else - { - switch (code & 0xf) - { - case 0x0: /* p8 */ - { - r = *dp++; - t = unw_decode_uleb128 (&dp); - switch (r) - { - case 1: - UNW_DEC_REG_SPREL ("P8", UNW_REG_RP, t, arg); - break; - case 2: - UNW_DEC_REG_SPREL ("P8", UNW_REG_PFS, t, arg); - break; - case 3: - UNW_DEC_REG_SPREL ("P8", UNW_REG_PR, t, arg); - break; - case 4: - UNW_DEC_REG_SPREL ("P8", UNW_REG_LC, t, arg); - break; - case 5: - UNW_DEC_REG_SPREL ("P8", UNW_REG_UNAT, t, arg); - break; - case 6: - UNW_DEC_REG_SPREL ("P8", UNW_REG_FPSR, t, arg); - break; - case 7: - UNW_DEC_REG_WHEN ("P8", UNW_REG_BSP, t, arg); - break; - case 8: - UNW_DEC_REG_PSPREL ("P8", UNW_REG_BSP, t, arg); - break; - case 9: - UNW_DEC_REG_SPREL ("P8", UNW_REG_BSP, t, arg); - break; - case 10: - UNW_DEC_REG_WHEN ("P8", UNW_REG_BSPSTORE, t, arg); - break; - case 11: - UNW_DEC_REG_PSPREL ("P8", UNW_REG_BSPSTORE, t, arg); - break; - case 12: - UNW_DEC_REG_SPREL ("P8", UNW_REG_BSPSTORE, t, arg); - break; - case 13: - UNW_DEC_REG_WHEN ("P8", UNW_REG_RNAT, t, arg); - break; - case 14: - UNW_DEC_REG_PSPREL ("P8", UNW_REG_RNAT, t, arg); - break; - case 15: - UNW_DEC_REG_SPREL ("P8", UNW_REG_RNAT, t, arg); - break; - case 16: - UNW_DEC_PRIUNAT_WHEN_GR ("P8", t, arg); - break; - case 17: - UNW_DEC_PRIUNAT_PSPREL ("P8", t, arg); - break; - case 18: - UNW_DEC_PRIUNAT_SPREL ("P8", t, arg); - break; - case 19: - UNW_DEC_PRIUNAT_WHEN_MEM ("P8", t, arg); - break; - default: - UNW_DEC_BAD_CODE (r); - break; - } - } - break; - - case 0x1: - byte1 = *dp++; - byte2 = *dp++; - UNW_DEC_GR_GR ("P9", (byte1 & 0xf), (byte2 & 0x7f), arg); - break; - - case 0xf: /* p10 */ - byte1 = *dp++; - byte2 = *dp++; - UNW_DEC_ABI ("P10", byte1, byte2, arg); - break; - - case 0x9: - return unw_decode_x1 (dp, code, arg); - - case 0xa: - return unw_decode_x2 (dp, code, arg); - - case 0xb: - return unw_decode_x3 (dp, code, arg); - - case 0xc: - return unw_decode_x4 (dp, code, arg); - - default: - UNW_DEC_BAD_CODE (code); - break; - } - } - return dp; -} - -static const unsigned char * -unw_decode_b1 (dp, code, arg) - const unsigned char * dp; - unsigned char code; - void * arg ATTRIBUTE_UNUSED; -{ - unw_word label = (code & 0x1f); - - if ((code & 0x20) != 0) - UNW_DEC_COPY_STATE ("B1", label, arg); - else - UNW_DEC_LABEL_STATE ("B1", label, arg); - return dp; -} - -static const unsigned char * -unw_decode_b2 (dp, code, arg) - const unsigned char * dp; - unsigned char code; - void * arg ATTRIBUTE_UNUSED; -{ - unw_word t; - - t = unw_decode_uleb128 (& dp); - UNW_DEC_EPILOGUE ("B2", t, (code & 0x1f), arg); - return dp; -} - -static const unsigned char * -unw_decode_b3_x4 (dp, code, arg) - const unsigned char *dp; - unsigned char code; - void *arg; -{ - unw_word t, ecount, label; - - if ((code & 0x10) == 0) - { - t = unw_decode_uleb128 (&dp); - ecount = unw_decode_uleb128 (&dp); - UNW_DEC_EPILOGUE ("B3", t, ecount, arg); - } - else if ((code & 0x07) == 0) - { - label = unw_decode_uleb128 (&dp); - if ((code & 0x08) != 0) - UNW_DEC_COPY_STATE ("B4", label, arg); - else - UNW_DEC_LABEL_STATE ("B4", label, arg); - } - else - switch (code & 0x7) - { - case 1: - return unw_decode_x1 (dp, code, arg); - case 2: - return unw_decode_x2 (dp, code, arg); - case 3: - return unw_decode_x3 (dp, code, arg); - case 4: - return unw_decode_x4 (dp, code, arg); - default: - UNW_DEC_BAD_CODE (code); - break; - } - return dp; -} - -typedef const unsigned char *(*unw_decoder) - PARAMS ((const unsigned char *, unsigned char, void *)); - -static unw_decoder unw_decode_table[2][8] = - { - /* prologue table: */ - { - unw_decode_r1, /* 0 */ - unw_decode_r1, - unw_decode_r2, - unw_decode_r3, - unw_decode_p1, /* 4 */ - unw_decode_p2_p5, - unw_decode_p6, - unw_decode_p7_p10 - }, - { - unw_decode_r1, /* 0 */ - unw_decode_r1, - unw_decode_r2, - unw_decode_r3, - unw_decode_b1, /* 4 */ - unw_decode_b1, - unw_decode_b2, - unw_decode_b3_x4 - } - }; - -/* Decode one descriptor and return address of next descriptor. */ -const unsigned char * -unw_decode (dp, inside_body, ptr_inside_body) - const unsigned char * dp; - int inside_body; - void * ptr_inside_body; -{ - unw_decoder decoder; - unsigned char code; - - code = *dp++; - decoder = unw_decode_table[inside_body][code >> 5]; - return (*decoder) (dp, code, ptr_inside_body); -} diff --git a/contrib/binutils/binutils/unwind-ia64.h b/contrib/binutils/binutils/unwind-ia64.h deleted file mode 100644 index d80e46a02581..000000000000 --- a/contrib/binutils/binutils/unwind-ia64.h +++ /dev/null @@ -1,31 +0,0 @@ -/* unwind-ia64.h -- dump IA-64 unwind info. - Copyright 2000, 2001 Free Software Foundation, Inc. - Contributed by David Mosberger-Tang <davidm@hpl.hp.com> - -This file is part of GNU Binutils. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include <elf/ia64.h> -#include <ansidecl.h> - -#define UNW_VER(x) ((x) >> 48) -#define UNW_FLAG_MASK 0x0000ffff00000000 -#define UNW_FLAG_OSMASK 0x0000f00000000000 -#define UNW_FLAG_EHANDLER(x) ((x) & 0x0000000100000000L) -#define UNW_FLAG_UHANDLER(x) ((x) & 0x0000000200000000L) -#define UNW_LENGTH(x) ((x) & 0x00000000ffffffffL) - -extern const unsigned char * unw_decode PARAMS ((const unsigned char *, int, void *)); diff --git a/contrib/binutils/config.if b/contrib/binutils/config.if deleted file mode 100644 index 625a4077ec0e..000000000000 --- a/contrib/binutils/config.if +++ /dev/null @@ -1,93 +0,0 @@ -#! /dev/null -# Don't call it directly. This shell script fragment is called to -# determine: -# -# 1. libstcxx_interface: the interface name for libstdc++. -# 2. cxx_interface: the interface name for c++. -# 3. libc_interface: the interface name for libc. -# - -# Get the top level src dir. -if [ -z "${topsrcdir}" -a -z "${top_srcdir}" ] -then - echo "Undefined top level src dir: topsrcdir and top_srcdir are empty" >&2 - exit 1 -fi - -if [ -n "${topsrcdir}" ] -then - if_topsrcdir=${topsrcdir} -else - if_topsrcdir=${top_srcdir} -fi - -if [ "${enable_libstdcxx_v3}" = "yes" ] ; then - libstdcxx_srcdir=${if_topsrcdir}/libstdc++-v3 -else - libstdcxx_srcdir=${if_topsrcdir}/libstdc++ -fi - -if [ -f ${libstdcxx_srcdir}/Makefile.in ]; then -# We check libstdc++ for libstdcxx_interface. -libstdcxx_interface=`grep "^INTERFACE" ${libstdcxx_srcdir}/Makefile.in | sed 's/INTERFACE[ ]*=[ ]*\(.*\)/\1/'` -else -libstdcxx_interface= -fi - -if [ -f ${if_topsrcdir}/gcc/cp/Makefile.in ]; then -# We check gcc/cp for cxx_interface. -cxx_interface=`grep "^INTERFACE" ${if_topsrcdir}/gcc/cp/Makefile.in | sed 's/INTERFACE[ ]*=[ ]*\(.*\)/\1/'` -else -cxx_interface= -fi - -# The trickiest part is libc_interface. -if [ -z "${libc_interface}" ] -then - case ${target_os} in - *linux*libc1*|*linux*libc5*) - case ${target_alias} in - *alpha*|*powerpc*) - libc_interface=-libc5.9- - ;; - *) - libc_interface=-libc5- - ;; - esac - ;; - *linux*gnu*) - # We have to work harder to figure it out. - if [ ${target_alias} = ${build_alias} ] - then - dummy=if$$ - cat >$dummy.c <<EOF -#include <features.h> -main(argc, argv) - int argc; - char *argv[]; -{ - printf("%d\n", __GLIBC_MINOR__); - return 0; -} -EOF - ${CC-cc} $dummy.c -o $dummy 2>/dev/null - if [ "$?" = 0 ] - then - libc_interface=-libc6.`./$dummy`- - rm -f $dummy.c $dummy - else - # It should never happen. - echo "Cannot find the GNU C library minor version number." >&2 - rm -f $dummy.c $dummy - exit 1 - fi - else - # Cross compiling. Assume glibc 2.1. - libc_interface=-libc6.1- - fi - ;; - *) - libc_interface=- - ;; - esac -fi diff --git a/contrib/binutils/etc/ChangeLog b/contrib/binutils/etc/ChangeLog deleted file mode 100644 index 0453a3e1339a..000000000000 --- a/contrib/binutils/etc/ChangeLog +++ /dev/null @@ -1,507 +0,0 @@ -1999-04-01 Jim Blandy <jimb@zwingli.cygnus.com> - - * add-log.el, add-log.vi: New files. - -Wed Jan 20 01:33:50 1999 Angela Marie Thomas (angela@cygnus.com) - - * comp-tools-verify: Remove some checks that are no longer valid. - -1998-12-03 Nick Clifton <nickc@cygnus.com> - - * targetdoc/fr30.texi: New document. - -Thu Oct 1 21:15:59 1998 Angela Marie Thomas (angela@cygnus.com) - - * comp-tools-fix, cross-tools-fix: Replace /usr/include - with ${FIXINCDIR}. - -Tue Aug 11 19:22:11 1998 Doug Evans <devans@canuck.cygnus.com> - - * make-rel-sym-tree (version): Update calculation. - -Fri Jun 12 21:34:01 1998 Ian Lance Taylor <ian@cygnus.com> - - * configure.texi: Various additions. - * Makefile.in (TEXI2HTML, DVIPS): New variables. - (standards.ps): New target. - (configure.dvi): Copy .tin files in as well. - (configure.ps, configure.html): New targets. - (clean): Remove configdev.jpg and configbuild.jpg. - * configdev.fig: New file. - * configdev.ein: New file (EPS version of configdev.fig). - * configdev.jin: New file (JPEG version of configdev.fig). - * configbuild.fig: New file. - * configbuild.ein: New file (EPS version of configbuild.fig). - * configbuild.jin: New file (JPEG version of configbuild.fig). - -Wed Jun 10 14:41:25 1998 Ian Lance Taylor <ian@cygnus.com> - - * configure.texi: New file. - * configdev.tin: New file. - * configbuild.tin: New file. - * Makefile.in (MAKEINFO): Use makeinfo from texinfo directory if - it exists. - (TEXI2DVI): Likewise for texi2dvi. - (INFOFILES): Add configure.info. - (DVIFILES): Add configure.dvi. - (info): Only build info files if the source files exist. - (install-info): Only install info files if they exist. - (dvi): Only build DVI files if the sources files exist. - (configure.info): New target. - (configure.dvi): New target. - (clean): Remove configdev and configbuild derived files. - - Remove obsolete documentation. - * intro.texi: Remove. - * install.texi: Remove. - * config-names.texi: Remove. - * screen1.eps: Remove. - * screen1.obj: Remove. - * screen2.eps: Remove. - * screen2.obj: Remove. - * Makefile.in: Remove references to the above. - -Thu May 21 14:34:51 1998 Nick Clifton <nickc@cygnus.com> - - * targetdoc/arm-interwork.texi: Add note about ignoring linker - warning message when using --support-old-code. - -Mon May 18 14:27:37 1998 Angela Marie Thomas (angela@cygnus.com) - - * Install.in, comp-tools-fix, comp-tools-verify, cross-tools-fix: - Use $GCCvn rather than substitute everywhere. - -Thu May 14 14:43:10 1998 Nick Clifton <nickc@cygnus.com> - - * targetdoc/arm-interwork.texi: Document dlltool support of - interworking. - -Thu May 7 16:49:38 1998 Jason Molenda (crash@bugshack.cygnus.com) - - * Install.in: Remove references to TCL_LIBRARY, TK_LIBRARY, - and GDBTK_FILENAME. - -Wed Apr 1 17:11:44 1998 Nick Clifton <nickc@cygnus.com> - - * targetdoc/arm-interwork.texi: Document ARM/thumb interworking. - -Tue Mar 31 15:28:20 1998 Ian Lance Taylor <ian@cygnus.com> - - * standards.texi, make-stds.texi: Update to current FSF versions. - * Makefile.in (standards.info): Depend upon make-std.texi. - -Tue Mar 24 16:13:26 1998 Stu Grossman <grossman@bhuna.cygnus.co.uk> - - * configure: Regenerate with autoconf 2.12.1 to fix shell issues - for NT native builds. - -Mon Mar 9 16:41:04 1998 Doug Evans <devans@canuck.cygnus.com> - - * make-rel-sym-tree (binprogs): Add objcopy. - -Tue Feb 24 18:11:58 1998 Doug Evans <devans@canuck.cygnus.com> - - * make-rel-sym-tree: as.new -> as-new, ld.new -> ld-new - nm.new -> nm-new. Make symlinks to crt*.o. - -Fri Nov 21 12:54:58 1997 Manfred Hollstein <manfred@s-direktnet.de> - - * Makefile.in: Add --no-split argument to avoid creating files - with names longer than 14 characters. - -Thu Sep 25 13:13:11 1997 Jason Molenda (crash@pern.cygnus.com) - - * intro.texi: Add closing ifset. - -Mon Sep 1 10:31:32 1997 Angela Marie Thomas (angela@cygnus.com) - - * Install.in: Move setting HOST and TARGET to the beginning - of the file for editing convenience. - -Mon Sep 1 10:28:37 1997 Angela Marie Thomas (angela@cygnus.com) - - * Install.in.: More friendly options/messages when extracting - from a file instead of a tape device. - -Tue Jun 17 15:50:23 1997 Angela Marie Thomas (angela@cygnus.com) - - * Install.in: Add /usr/bsd to PATH for Irix (home of compress) - -Thu Jun 12 13:47:00 1997 Angela Marie Thomas (angela@cygnus.com) - - * Install.in (show_exec_prefix_msg): fix quoting - -Wed Jun 4 15:31:43 1997 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * rebuilding.texi: Removed. - -Sat May 24 18:02:20 1997 Angela Marie Thomas (angela@cygnus.com) - - * cross-tools-fix: Remove host check since it doesn't matter - for this case. - * Install.in (guess_system): clean up more unused hosts. - * Install.in, cross-tools-fix, comp-tools-fix, comp-tools-verify: - Hack for host check to not warn the user for certain cases. - -Fri May 23 23:46:10 1997 Angela Marie Thomas (angela@cygnus.com) - - * subst-strings: Remove a lot of unused code - * Install.in: Remove reference to TAPEdflt, use variables instead of - string substitution when able. - -Fri Apr 11 17:25:52 1997 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Change file named in AC_INIT to Makefile.in. - * configure: Rebuild. - -Fri Apr 11 18:12:42 1997 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * Install.in (guess_system): Back out change to INSTALLHOST to - call all IRIX systems "mips-sgi-irix4" - - * Makefile.in: Remove references to configure.texi and cfg-paper.texi. - -Thu Apr 10 23:26:45 1997 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * srctree.texi, emacs-relnotes.texi, cfg-paper.texi: Remove. - * Install.in: Remove Ultrix-specific hacks. - Update Cygnus phone numbers. - (guess_system): Remove some old systems (Ultrix, OSF1 v1 & 2, - m68k-HPUX, m68k SunOS, etc.) - (show_gnu_root_msg): Remove. - Removed all the remove option code. - -Thu Apr 10 23:23:33 1997 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * configure.man, configure.texi: Remote. - -Mon Apr 7 18:15:00 1997 Brendan Kehoe <brendan@cygnus.com> - - * Fix the version string for OSF1 4.0 to recognize either - V4.* or X4.* - -Mon Apr 7 15:34:47 1997 Ian Lance Taylor <ian@cygnus.com> - - * standards.texi, make-stds.texi: Update to current FSF versions. - -Tue Nov 19 15:36:14 1996 Doug Evans <dje@canuck.cygnus.com> - - * make-rel-sym-tree: New file. - -Wed Oct 23 00:34:07 1996 Angela Marie Thomas (angela@cygnus.com) - - * Lots of patches from progressive... - * Install.in: restore DDOPTS for AIX 4.x - * Install.in, subst-strings: add case for DG Aviion - * subst-strings: fix typo in INSTALLdir var setting - * comp-tools-verify: set SHLIB_PATH for shared libs - * Install.in, subst-strings: add case for solaris2.5 - * Install.in: fix regression for hppa1.1 check - * comp-tools-fix: set LD_LIBRARY_PATH - * comp-tools-fix: If fixincludes fixes /usr/include/limits.h, - install it as syslimits.h. - -Wed Oct 16 19:20:42 1996 Michael Meissner <meissner@tiktok.cygnus.com> - - * Install.in (guess_system): Treat powerpc-ibm-aix4.1 the same as - rs6000-ibm-aix4.1, since the compiler now uses common mode by - default. - -Wed Oct 2 15:39:07 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * configure.in (AC_PROG_INSTALL): Added. - * Makefile.in (distclean): Remove config.cache. - -Wed Oct 2 14:33:58 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * configure.in: Switch to autoconf configure.in. - * configure: New. - * Makefile.in: Use autoconf-substituted values. - -Tue Jun 25 18:56:08 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * Makefile.in (datadir): Changed to $(prefix)/share. - -Fri Mar 29 11:38:01 1996 J.T. Conklin (jtc@lisa.cygnus.com) - - * configure.man: Changed to be recognized by catman -w on Solaris. - -Wed Dec 6 15:40:28 1995 Doug Evans <dje@canuck.cygnus.com> - - * comp-tools-fix (fixincludes): Define FIXPROTO_DEFINES from - .../install-tools/fixproto-defines. - -Sun Nov 12 19:31:27 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * comp-tools-verify (verify_cxx_initializers): delete argv, - argc declarations, add -static to compile line. - (verify_cxx_hello_world): delete argv, argc declarations, add - -static to compile line. - -Wed Sep 20 13:21:52 1995 Ian Lance Taylor <ian@cygnus.com> - - * Makefile.in (maintainer-clean): New target, synonym for - realclean. - -Mon Aug 28 17:25:49 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * Install.in (PATH): add /usr/ucb to $PATH (for SunOS 4.1.x). - -Tue Aug 15 21:51:58 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * Install.in (guess_system): Match OSF/1 v3.x as the same as - v2.x--v2.x binaries are upward compatible. - -Tue Aug 15 21:46:54 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * Install.in (guess_system): recognize HP 9000/800 systems as the - same as HP 9000/700 systems. - -Tue Aug 8 13:11:56 1995 Brendan Kehoe <brendan@lisa.cygnus.com> - - * Install.in: For emacs, run show_emacs_alternate_msg and exit. - (show_emacs_alternate_msg): New message saying how emacs can't be - installed in an alternate prefix. - -Thu Jun 8 00:42:56 1995 Angela Marie Thomas <angela@cirdan.cygnus.com> - - * subst-strings: change du commands to $BINDIR/. & $SRCDIR/. just - in case they are symlinks. - -Tue Apr 18 14:23:10 1995 J.T. Conklin <jtc@rtl.cygnus.com> - - * cdk-fix: Extracted table of targets that don't need their - headers fixed from gcc's configure script. - - * cdk-fix, cdk-verify: Use ${HOST} instead of ||HOSTstr|| - - * cdk-fix, cdk-verify: New files, install script fragments used - for Cygnus Developer's Kit. - - * Install.in (do_mkdir): New function. - - * Install.in: Added support for --with and --without options. - Changed so that tape commands are not run when extracting - from a file. - (do_mt): Changed to take only one argument. - -Wed Mar 29 11:16:38 1995 Jason Molenda (crash@phydeaux.cygnus.com) - - * Install.in: catch UNAME==alpha-dec-osf2.x and correct entry for - alpha-dec-osf1.x - -Fri Jan 27 12:04:29 1995 J.T. Conklin <jtc@rtl.cygnus.com> - - * subst-strings (mips-sgi-irix5): New entry in table. - -Thu Jan 19 12:15:44 1995 J.T. Conklin <jtc@rtl.cygnus.com> - - * Install.in: Major rewrite, bundle dependent code (for example, - fixincludes for comp-tools) will be inserted into the Install - script when it is generated. - -Tue Jan 17 16:51:32 1995 Ian Lance Taylor <ian@sanguine.cygnus.com> - - * Makefile.in (Makefile): Rebuild using $(SHELL). - -Thu Nov 3 19:30:33 1994 Ken Raeburn <raeburn@cujo.cygnus.com> - - * Makefile.in (install-info): Depend on info. - -Fri Aug 19 16:16:38 1994 Jason Molenda (crash@phydeaux.cygnus.com) - - * Install.in: set $FIX_HEADER so fixproto can find fix-header. - -Fri May 6 16:18:58 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Makefile.in (install-info): add a semicolon in the if statement. - -Fri Apr 29 16:56:07 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * cfg-paper.texi: Update some outdated information. - - * Makefile.in (install-info): Pass file, not directory, as last - arg to INSTALL_DATA. - (uninstall): New target. - -Thu Apr 28 14:42:22 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * configure.texi: Comment out @smallbook. - - * Makefile.in: Define TEXI2DVI and TEXIDIR, and use the latter. - Remove info files in realclean, not clean, per coding standards. - Remove TeX output in clean. - -Tue Apr 26 17:18:03 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: fixincludes output is actually put in fixincludes.log, - but echo'ed messages claim it is fixinc.log. This is the same - messages as I logged in March 4 1994, but for some reason we found - the change hadn't been done. I'll have to dig through the logs - and find out what I really did do that day. :) - -Mon Apr 25 20:28:19 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: use eval to call do_mt() for Ultrix brokenness. - -Mon Apr 25 20:00:00 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in(do_mt): exit with error status 1 if # of parameters - != 3. - -Mon Apr 25 19:42:36 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: lose TAPE_FORWARD and TAPE_REWIND, add do_mt() - to do all tape movement operations. Currently untested. Addresses - PR # 4886 from bull. - - * Install.in: add 1994 to the copyright thing. - -Fri Apr 22 19:05:13 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * standards.texi: Update from FSF. - -Fri Apr 22 15:46:10 1994 Jason Molenda (crash@cygnus.com) - - * Install.in: Add $DDOPTS, has ``bs=124b'' for all systems except - AIX (some versions of AIX don't understand bs=124b. Silly OS). - -Mon Apr 4 22:55:05 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: null out $TOOLS before adding stuff to it - non-destructively. - -Wed Mar 30 21:45:35 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * standards.texi: Fix typo. - - * configure.texi, configure.man: Document --disable-. - -Mon Mar 28 13:22:15 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * standards.texi: Update from FSF. - -Sat Mar 26 09:21:44 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * standards.texi, make-stds.texi: Update from FSF. - -Fri Mar 25 22:59:45 1994 David J. Mackenzie (djm@rtl.cygnus.com) - - * configure.texi, configure.man: Document --enable-* options. - -Wed Mar 23 23:38:24 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: set CPP to be gcc -E for fixincludes. - -Wed Mar 23 13:42:48 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: set PATH to $PATH:/bin:/usr/bin so we can pick - up native tools even if the user doesn't have them in his - path. - - * Install.in: ``hppa-1.1-hp-hpux'' -> ``hppa1.1-hp-hpux''. - -Tue Mar 15 22:09:20 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: TAPE_REWIND and TAPE_FORWARD variables for Unixunaware, - added switch statement to detect if system is Unixunaware. - -Fri Mar 4 12:10:30 1994 Jason Molenda (crash@sendai.cygnus.com) - - * Install.in: fixincludes output is actually put in fixincludes.log, - but echo'ed messages claim it is fixinc.log. - -Wed Nov 3 02:58:02 1993 Jeffrey Osier (jeffrey@thepub.cygnus.com) - - * subst-strings: output TEXBUNDLE for more install notes matching - * install-texi.in: PRMS info now exists - -Tue Oct 26 16:57:12 1993 K. Richard Pixley (rich@sendai.cygnus.com) - - * subst-strings: match solaris*. Also, add default case to catch - and error out for unrecognized systems. - -Thu Aug 19 18:21:31 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) - - * Install.in: handle the new fixproto work - -Mon Jul 19 12:05:41 1993 david d `zoo' zuhn (zoo@cirdan.cygnus.com) - - * Install.in: remove "MT=tctl" for AIX (not needed, and barely - worked anyway) - -Mon Jun 14 19:09:22 1993 Jeffrey Osier (jeffrey@cygnus.com) - - * subst-strings: changed HOST to recognize Solaris for install notes - -Thu Jun 10 16:01:25 1993 Jeffrey Osier (jeffrey@cygnus.com) - - * dos-inst.texi: new file. - -Wed Jun 9 19:23:59 1993 Jeffrey Osier (jeffrey@rtl.cygnus.com) - - * install-texi.in: added conditionals (nearly complete) - cleaned up - added support for other releases (not done) - -Wed Jun 9 15:53:58 1993 Jim Kingdon (kingdon@cygnus.com) - - * Makefile.in (install-info): Use INSTALL_DATA. - ({dist,real}clean): Also delete Makefile and config.status. - -Fri Jun 4 17:09:56 1993 Jeffrey Osier (jeffrey@cygnus.com) - - * subst-strings: added data for OS_STRING - - * subst-strings: added support for OS_STRING - -Thu Jun 3 00:37:01 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Install.in: pull COPYING and COPYING.LIB off of the tape - -Tue Jun 1 16:52:08 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * subst-strings: replace RELEASE_DIR too - -Mon Mar 22 23:55:27 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: add installcheck target - -Wed Mar 17 02:21:15 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Install.in: fix 'source only' extraction bug where it looked for - the src dir under H-<host>/src instead of src; also remove stray - reference to EMACSHIBIN - -Mon Mar 15 01:25:45 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * make-stds.texi: added 'installcheck' to the standard targets - -Tue Mar 9 19:48:28 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * standards.texi: added INFO-DIR-ENTRY, updated version from the FSF - -Tue Feb 9 12:40:23 1993 Ian Lance Taylor (ian@cygnus.com) - - * Makefile.in (standards.info): Added -I$(srcdir) to find - make-stds.texi. - -Mon Feb 1 16:32:56 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * standards.texi: updated to latest FSF version, which includes: - - * make-stds.texi: new file - -Mon Nov 30 01:31:40 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * install-texi.in, relnotes.texi, intro.texi: changed Cygnus phone - numbers from the old Palo Alto ones to the new Mtn. View numbers - -Mon Nov 16 16:50:43 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * Makefile.in: define $(RM) to "rm -f" - -Sun Oct 11 16:05:48 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) - - * intro.texi: added INFO-DIR-ENTRY - diff --git a/contrib/binutils/etc/Makefile.in b/contrib/binutils/etc/Makefile.in deleted file mode 100644 index eedc8c9c1ac2..000000000000 --- a/contrib/binutils/etc/Makefile.in +++ /dev/null @@ -1,156 +0,0 @@ -# -# Makefile.in for etc -# - -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -srcdir = @srcdir@ -VPATH = @srcdir@ - -bindir = @bindir@ -libdir = @libdir@ -tooldir = $(libdir) -datadir = @datadir@ - -mandir = @mandir@ -man1dir = $(mandir)/man1 -man2dir = $(mandir)/man2 -man3dir = $(mandir)/man3 -man4dir = $(mandir)/man4 -man5dir = $(mandir)/man5 -man6dir = $(mandir)/man6 -man7dir = $(mandir)/man7 -man8dir = $(mandir)/man8 -man9dir = $(mandir)/man9 -infodir = @infodir@ - -SHELL = /bin/sh - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ - -MAKEINFO = `if [ -f ../texinfo/makeinfo/makeinfo ]; \ - then echo ../texinfo/makeinfo/makeinfo; \ - else echo makeinfo; fi` -TEXI2DVI = `if [ -f ../texinfo/util/texi2dvi ]; \ - then echo ../texinfo/util/texi2dvi; \ - else echo texi2dvi; fi` -TEXI2HTML = texi2html -DVIPS = dvips - -# Where to find texinfo.tex to format documentation with TeX. -TEXIDIR = $(srcdir)/../texinfo - -#### Host, target, and site specific Makefile fragments come in here. -### - -INFOFILES = standards.info configure.info -DVIFILES = standards.dvi configure.dvi - -all: - -install: - -uninstall: - -info: - for f in $(INFOFILES); do \ - if test -f $(srcdir)/`echo $$f | sed -e 's/.info$$/.texi/'`; then \ - if $(MAKE) "MAKEINFO=$(MAKEINFO)" $$f; then \ - true; \ - else \ - exit 1; \ - fi; \ - fi; \ - done - -install-info: info - $(SHELL) $(srcdir)/../mkinstalldirs $(infodir) - if test ! -f standards.info; then cd $(srcdir); fi; \ - if test -f standards.info; then \ - for i in standards.info*; do \ - $(INSTALL_DATA) $$i $(infodir)/$$i; \ - done; \ - fi - if test ! -f configure.info; then cd $(srcdir); fi; \ - if test -f configure.info; then \ - for i in configure.info*; do \ - $(INSTALL_DATA) $$i $(infodir)/$$i; \ - done; \ - fi - -dvi: - for f in $(DVIFILES); do \ - if test -f $(srcdir)/`echo $$f | sed -e 's/.dvi$$/.texi/'`; then \ - if $(MAKE) "TEXI2DVI=$(TEXI2DVI)" $$f; then \ - true; \ - else \ - exit 1; \ - fi; \ - fi; \ - done - -standards.info: $(srcdir)/standards.texi $(srcdir)/make-stds.texi - $(MAKEINFO) --no-split -I$(srcdir) -o standards.info $(srcdir)/standards.texi - -standards.dvi: $(srcdir)/standards.texi - TEXINPUTS=$(TEXIDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/standards.texi - -standards.ps: standards.dvi - $(DVIPS) standards.dvi -o standards.ps - -# makeinfo requires images to be in the current directory. -configure.info: $(srcdir)/configure.texi $(srcdir)/configdev.tin $(srcdir)/configbuild.tin - rm -f configdev.txt configbuild.txt - cp $(srcdir)/configdev.tin configdev.txt - cp $(srcdir)/configbuild.tin configbuild.txt - $(MAKEINFO) -I$(srcdir) -o configure.info $(srcdir)/configure.texi - rm -f configdev.txt configbuild.txt - -# texi2dvi wants both the .txt and the .eps files. -configure.dvi: $(srcdir)/configure.texi $(srcdir)/configdev.tin $(srcdir)/configbuild.tin $(srcdir)/configdev.ein $(srcdir)/configbuild.ein - rm -f configdev.txt configbuild.txt - cp $(srcdir)/configdev.tin configdev.txt - cp $(srcdir)/configbuild.tin configbuild.txt - rm -f configdev.eps configbuild.eps - cp $(srcdir)/configdev.ein configdev.eps - cp $(srcdir)/configbuild.ein configbuild.eps - TEXINPUTS=$(TEXIDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/configure.texi - rm -f configdev.txt configbuild.txt - rm -f configdev.eps configbuild.eps - -# dvips requires images to be in the current directory -configure.ps: configure.dvi $(srcdir)/configdev.ein $(srcdir)/configbuild.ein - rm -f configdev.eps configbuild.eps - cp $(srcdir)/configdev.ein configdev.eps - cp $(srcdir)/configbuild.ein configbuild.eps - $(DVIPS) configure.dvi -o configure.ps - rm -f configdev.eps configbuild.eps - -configure.html: $(srcdir)/configure.texi - $(TEXI2HTML) -split_chapter $(srcdir)/configure.texi - -clean: - rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.log - rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs - rm -f configdev.txt configbuild.txt configdev.eps configbuild.eps - rm -f configdev.jpg configbuild.jpg - -mostlyclean: clean - -distclean: clean - rm -f Makefile config.status config.cache - -maintainer-clean realclean: distclean - rm -f *.info* - -Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) - $(SHELL) ./config.status - -## these last targets are for standards.texi conformance -dist: -check: -installcheck: -TAGS: diff --git a/contrib/binutils/etc/add-log.el b/contrib/binutils/etc/add-log.el deleted file mode 100644 index 60c88e8c9490..000000000000 --- a/contrib/binutils/etc/add-log.el +++ /dev/null @@ -1,573 +0,0 @@ -;;; ============ NOTE WELL! ============= -;;; -;;; You only need to use this file if you're using a version of Emacs -;;; prior to 20.1 to work on GDB. The only difference between this -;;; and the standard add-log.el provided with 19.34 is that it -;;; generates dates using the terser format used by Emacs 20. This is -;;; the format recommended for use in GDB ChangeLogs. -;;; -;;; To use this code, you should create a directory `~/elisp', save the code -;;; below in `~/elisp/add-log.el', and then put something like this in -;;; your `~/.emacs' file, to tell Emacs where to find it: -;;; -;;; (setq load-path -;;; (cons (expand-file-name "~/elisp") -;;; load-path)) -;;; -;;; If you want, you can also byte-compile it --- it'll run a little -;;; faster, and use a little less memory. (Not that those matter much for -;;; this file.) To do that, after you've saved the text as -;;; ~/elisp/add-log.el, bring it up in Emacs, and type -;;; -;;; C-u M-x byte-compile-file -;;; -;;; --- Jim Blandy - -;;; add-log.el --- change log maintenance commands for Emacs - -;; Copyright (C) 1985, 1986, 1988, 1993, 1994 Free Software Foundation, Inc. - -;; Keywords: maint - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;; Commentary: - -;; This facility is documented in the Emacs Manual. - -;;; Code: - -(defvar change-log-default-name nil - "*Name of a change log file for \\[add-change-log-entry].") - -(defvar add-log-current-defun-function nil - "\ -*If non-nil, function to guess name of current function from surrounding text. -\\[add-change-log-entry] calls this function (if nil, `add-log-current-defun' -instead) with no arguments. It returns a string or nil if it cannot guess.") - -;;;###autoload -(defvar add-log-full-name nil - "*Full name of user, for inclusion in ChangeLog daily headers. -This defaults to the value returned by the `user-full-name' function.") - -;;;###autoload -(defvar add-log-mailing-address nil - "*Electronic mail address of user, for inclusion in ChangeLog daily headers. -This defaults to the value of `user-mail-address'.") - -(defvar change-log-font-lock-keywords - '(("^[SMTWF].+" . font-lock-function-name-face) ; Date line. - ("^\t\\* \\([^ :\n]+\\)" 1 font-lock-comment-face) ; File name. - ("(\\([^)\n]+\\)):" 1 font-lock-keyword-face)) ; Function name. - "Additional expressions to highlight in Change Log mode.") - -(defvar change-log-mode-map nil - "Keymap for Change Log major mode.") -(if change-log-mode-map - nil - (setq change-log-mode-map (make-sparse-keymap)) - (define-key change-log-mode-map "\M-q" 'change-log-fill-paragraph)) - -(defun change-log-name () - (or change-log-default-name - (if (eq system-type 'vax-vms) - "$CHANGE_LOG$.TXT" - (if (or (eq system-type 'ms-dos) (eq system-type 'windows-nt)) - "changelo" - "ChangeLog")))) - -;;;###autoload -(defun prompt-for-change-log-name () - "Prompt for a change log name." - (let* ((default (change-log-name)) - (name (expand-file-name - (read-file-name (format "Log file (default %s): " default) - nil default)))) - ;; Handle something that is syntactically a directory name. - ;; Look for ChangeLog or whatever in that directory. - (if (string= (file-name-nondirectory name) "") - (expand-file-name (file-name-nondirectory default) - name) - ;; Handle specifying a file that is a directory. - (if (file-directory-p name) - (expand-file-name (file-name-nondirectory default) - (file-name-as-directory name)) - name)))) - -;;;###autoload -(defun find-change-log (&optional file-name) - "Find a change log file for \\[add-change-log-entry] and return the name. - -Optional arg FILE-NAME specifies the file to use. -If FILE-NAME is nil, use the value of `change-log-default-name'. -If 'change-log-default-name' is nil, behave as though it were 'ChangeLog' -\(or whatever we use on this operating system). - -If 'change-log-default-name' contains a leading directory component, then -simply find it in the current directory. Otherwise, search in the current -directory and its successive parents for a file so named. - -Once a file is found, `change-log-default-name' is set locally in the -current buffer to the complete file name." - ;; If user specified a file name or if this buffer knows which one to use, - ;; just use that. - (or file-name - (setq file-name (and change-log-default-name - (file-name-directory change-log-default-name) - change-log-default-name)) - (progn - ;; Chase links in the source file - ;; and use the change log in the dir where it points. - (setq file-name (or (and buffer-file-name - (file-name-directory - (file-chase-links buffer-file-name))) - default-directory)) - (if (file-directory-p file-name) - (setq file-name (expand-file-name (change-log-name) file-name))) - ;; Chase links before visiting the file. - ;; This makes it easier to use a single change log file - ;; for several related directories. - (setq file-name (file-chase-links file-name)) - (setq file-name (expand-file-name file-name)) - ;; Move up in the dir hierarchy till we find a change log file. - (let ((file1 file-name) - parent-dir) - (while (and (not (or (get-file-buffer file1) (file-exists-p file1))) - (progn (setq parent-dir - (file-name-directory - (directory-file-name - (file-name-directory file1)))) - ;; Give up if we are already at the root dir. - (not (string= (file-name-directory file1) - parent-dir)))) - ;; Move up to the parent dir and try again. - (setq file1 (expand-file-name - (file-name-nondirectory (change-log-name)) - parent-dir))) - ;; If we found a change log in a parent, use that. - (if (or (get-file-buffer file1) (file-exists-p file1)) - (setq file-name file1))))) - ;; Make a local variable in this buffer so we needn't search again. - (set (make-local-variable 'change-log-default-name) file-name) - file-name) - -;;;###autoload -(defun add-change-log-entry (&optional whoami file-name other-window new-entry) - "Find change log file and add an entry for today. -Optional arg (interactive prefix) non-nil means prompt for user name and site. -Second arg is file name of change log. If nil, uses `change-log-default-name'. -Third arg OTHER-WINDOW non-nil means visit in other window. -Fourth arg NEW-ENTRY non-nil means always create a new entry at the front; -never append to an existing entry." - (interactive (list current-prefix-arg - (prompt-for-change-log-name))) - (or add-log-full-name - (setq add-log-full-name (user-full-name))) - (or add-log-mailing-address - (setq add-log-mailing-address user-mail-address)) - (if whoami - (progn - (setq add-log-full-name (read-input "Full name: " add-log-full-name)) - ;; Note that some sites have room and phone number fields in - ;; full name which look silly when inserted. Rather than do - ;; anything about that here, let user give prefix argument so that - ;; s/he can edit the full name field in prompter if s/he wants. - (setq add-log-mailing-address - (read-input "Mailing address: " add-log-mailing-address)))) - (let ((defun (funcall (or add-log-current-defun-function - 'add-log-current-defun))) - paragraph-end entry) - - (setq file-name (expand-file-name (find-change-log file-name))) - - ;; Set ENTRY to the file name to use in the new entry. - (and buffer-file-name - ;; Never want to add a change log entry for the ChangeLog file itself. - (not (string= buffer-file-name file-name)) - (setq entry (if (string-match - (concat "^" (regexp-quote (file-name-directory - file-name))) - buffer-file-name) - (substring buffer-file-name (match-end 0)) - (file-name-nondirectory buffer-file-name)))) - - (if (and other-window (not (equal file-name buffer-file-name))) - (find-file-other-window file-name) - (find-file file-name)) - (or (eq major-mode 'change-log-mode) - (change-log-mode)) - (undo-boundary) - (goto-char (point-min)) - (let ((heading (format "%s %s <%s>" - (format-time-string "%Y-%m-%d") - add-log-full-name - add-log-mailing-address))) - (if (looking-at (regexp-quote heading)) - (forward-line 1) - (insert heading "\n\n"))) - - ;; Search only within the first paragraph. - (if (looking-at "\n*[^\n* \t]") - (skip-chars-forward "\n") - (forward-paragraph 1)) - (setq paragraph-end (point)) - (goto-char (point-min)) - - ;; Now insert the new line for this entry. - (cond ((re-search-forward "^\\s *\\*\\s *$" paragraph-end t) - ;; Put this file name into the existing empty entry. - (if entry - (insert entry))) - ((and (not new-entry) - (let (case-fold-search) - (re-search-forward - (concat (regexp-quote (concat "* " entry)) - ;; Don't accept `foo.bar' when - ;; looking for `foo': - "\\(\\s \\|[(),:]\\)") - paragraph-end t))) - ;; Add to the existing entry for the same file. - (re-search-forward "^\\s *$\\|^\\s \\*") - (goto-char (match-beginning 0)) - ;; Delete excess empty lines; make just 2. - (while (and (not (eobp)) (looking-at "^\\s *$")) - (delete-region (point) (save-excursion (forward-line 1) (point)))) - (insert "\n\n") - (forward-line -2) - (indent-relative-maybe)) - (t - ;; Make a new entry. - (forward-line 1) - (while (looking-at "\\sW") - (forward-line 1)) - (while (and (not (eobp)) (looking-at "^\\s *$")) - (delete-region (point) (save-excursion (forward-line 1) (point)))) - (insert "\n\n\n") - (forward-line -2) - (indent-to left-margin) - (insert "* " (or entry "")))) - ;; Now insert the function name, if we have one. - ;; Point is at the entry for this file, - ;; either at the end of the line or at the first blank line. - (if defun - (progn - ;; Make it easy to get rid of the function name. - (undo-boundary) - (insert (if (save-excursion - (beginning-of-line 1) - (looking-at "\\s *$")) - "" - " ") - "(" defun "): ")) - ;; No function name, so put in a colon unless we have just a star. - (if (not (save-excursion - (beginning-of-line 1) - (looking-at "\\s *\\(\\*\\s *\\)?$"))) - (insert ": "))))) - -;;;###autoload -(defun add-change-log-entry-other-window (&optional whoami file-name) - "Find change log file in other window and add an entry for today. -Optional arg (interactive prefix) non-nil means prompt for user name and site. -Second arg is file name of change log. \ -If nil, uses `change-log-default-name'." - (interactive (if current-prefix-arg - (list current-prefix-arg - (prompt-for-change-log-name)))) - (add-change-log-entry whoami file-name t)) -;;;###autoload (define-key ctl-x-4-map "a" 'add-change-log-entry-other-window) - -;;;###autoload -(defun change-log-mode () - "Major mode for editing change logs; like Indented Text Mode. -Prevents numeric backups and sets `left-margin' to 8 and `fill-column' to 74. -New log entries are usually made with \\[add-change-log-entry] or \\[add-change-log-entry-other-window]. -Each entry behaves as a paragraph, and the entries for one day as a page. -Runs `change-log-mode-hook'." - (interactive) - (kill-all-local-variables) - (indented-text-mode) - (setq major-mode 'change-log-mode - mode-name "Change Log" - left-margin 8 - fill-column 74 - indent-tabs-mode t - tab-width 8) - (use-local-map change-log-mode-map) - ;; Let each entry behave as one paragraph: - ;; We really do want "^" in paragraph-start below: it is only the lines that - ;; begin at column 0 (despite the left-margin of 8) that we are looking for. - (set (make-local-variable 'paragraph-start) "\\s *$\\|\f\\|^\\sw") - (set (make-local-variable 'paragraph-separate) "\\s *$\\|\f\\|^\\sw") - ;; Let all entries for one day behave as one page. - ;; Match null string on the date-line so that the date-line - ;; is grouped with what follows. - (set (make-local-variable 'page-delimiter) "^\\<\\|^\f") - (set (make-local-variable 'version-control) 'never) - (set (make-local-variable 'adaptive-fill-regexp) "\\s *") - (set (make-local-variable 'font-lock-defaults) - '(change-log-font-lock-keywords t)) - (run-hooks 'change-log-mode-hook)) - -;; It might be nice to have a general feature to replace this. The idea I -;; have is a variable giving a regexp matching text which should not be -;; moved from bol by filling. change-log-mode would set this to "^\\s *\\s(". -;; But I don't feel up to implementing that today. -(defun change-log-fill-paragraph (&optional justify) - "Fill the paragraph, but preserve open parentheses at beginning of lines. -Prefix arg means justify as well." - (interactive "P") - (let ((end (save-excursion (forward-paragraph) (point))) - (beg (save-excursion (backward-paragraph)(point))) - (paragraph-start (concat paragraph-start "\\|\\s *\\s("))) - (fill-region beg end justify))) - -(defvar add-log-current-defun-header-regexp - "^\\([A-Z][A-Z_ ]*[A-Z_]\\|[-_a-zA-Z]+\\)[ \t]*[:=]" - "*Heuristic regexp used by `add-log-current-defun' for unknown major modes.") - -;;;###autoload -(defun add-log-current-defun () - "Return name of function definition point is in, or nil. - -Understands C, Lisp, LaTeX (\"functions\" are chapters, sections, ...), -Texinfo (@node titles), Perl, and Fortran. - -Other modes are handled by a heuristic that looks in the 10K before -point for uppercase headings starting in the first column or -identifiers followed by `:' or `=', see variable -`add-log-current-defun-header-regexp'. - -Has a preference of looking backwards." - (condition-case nil - (save-excursion - (let ((location (point))) - (cond ((memq major-mode '(emacs-lisp-mode lisp-mode scheme-mode - lisp-interaction-mode)) - ;; If we are now precisely at the beginning of a defun, - ;; make sure beginning-of-defun finds that one - ;; rather than the previous one. - (or (eobp) (forward-char 1)) - (beginning-of-defun) - ;; Make sure we are really inside the defun found, not after it. - (if (and (looking-at "\\s(") - (progn (end-of-defun) - (< location (point))) - (progn (forward-sexp -1) - (>= location (point)))) - (progn - (if (looking-at "\\s(") - (forward-char 1)) - (forward-sexp 1) - (skip-chars-forward " '") - (buffer-substring (point) - (progn (forward-sexp 1) (point)))))) - ((and (memq major-mode '(c-mode c++-mode c++-c-mode objc-mode)) - (save-excursion (beginning-of-line) - ;; Use eq instead of = here to avoid - ;; error when at bob and char-after - ;; returns nil. - (while (eq (char-after (- (point) 2)) ?\\) - (forward-line -1)) - (looking-at "[ \t]*#[ \t]*define[ \t]"))) - ;; Handle a C macro definition. - (beginning-of-line) - (while (eq (char-after (- (point) 2)) ?\\) ;not =; note above - (forward-line -1)) - (search-forward "define") - (skip-chars-forward " \t") - (buffer-substring (point) - (progn (forward-sexp 1) (point)))) - ((memq major-mode '(c-mode c++-mode c++-c-mode objc-mode)) - (beginning-of-line) - ;; See if we are in the beginning part of a function, - ;; before the open brace. If so, advance forward. - (while (not (looking-at "{\\|\\(\\s *$\\)")) - (forward-line 1)) - (or (eobp) - (forward-char 1)) - (beginning-of-defun) - (if (progn (end-of-defun) - (< location (point))) - (progn - (backward-sexp 1) - (let (beg tem) - - (forward-line -1) - ;; Skip back over typedefs of arglist. - (while (and (not (bobp)) - (looking-at "[ \t\n]")) - (forward-line -1)) - ;; See if this is using the DEFUN macro used in Emacs, - ;; or the DEFUN macro used by the C library. - (if (condition-case nil - (and (save-excursion - (end-of-line) - (while (= (preceding-char) ?\\) - (end-of-line 2)) - (backward-sexp 1) - (beginning-of-line) - (setq tem (point)) - (looking-at "DEFUN\\b")) - (>= location tem)) - (error nil)) - (progn - (goto-char tem) - (down-list 1) - (if (= (char-after (point)) ?\") - (progn - (forward-sexp 1) - (skip-chars-forward " ,"))) - (buffer-substring (point) - (progn (forward-sexp 1) (point)))) - (if (looking-at "^[+-]") - (get-method-definition) - ;; Ordinary C function syntax. - (setq beg (point)) - (if (and (condition-case nil - ;; Protect against "Unbalanced parens" error. - (progn - (down-list 1) ; into arglist - (backward-up-list 1) - (skip-chars-backward " \t") - t) - (error nil)) - ;; Verify initial pos was after - ;; real start of function. - (save-excursion - (goto-char beg) - ;; For this purpose, include the line - ;; that has the decl keywords. This - ;; may also include some of the - ;; comments before the function. - (while (and (not (bobp)) - (save-excursion - (forward-line -1) - (looking-at "[^\n\f]"))) - (forward-line -1)) - (>= location (point))) - ;; Consistency check: going down and up - ;; shouldn't take us back before BEG. - (> (point) beg)) - (let (end middle) - ;; Don't include any final newline - ;; in the name we use. - (if (= (preceding-char) ?\n) - (forward-char -1)) - (setq end (point)) - (backward-sexp 1) - ;; Now find the right beginning of the name. - ;; Include certain keywords if they - ;; precede the name. - (setq middle (point)) - (forward-word -1) - ;; Ignore these subparts of a class decl - ;; and move back to the class name itself. - (while (looking-at "public \\|private ") - (skip-chars-backward " \t:") - (setq end (point)) - (backward-sexp 1) - (setq middle (point)) - (forward-word -1)) - (and (bolp) - (looking-at "struct \\|union \\|class ") - (setq middle (point))) - (buffer-substring middle end))))))))) - ((memq major-mode - '(TeX-mode plain-TeX-mode LaTeX-mode;; tex-mode.el - plain-tex-mode latex-mode;; cmutex.el - )) - (if (re-search-backward - "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)" nil t) - (progn - (goto-char (match-beginning 0)) - (buffer-substring (1+ (point));; without initial backslash - (progn - (end-of-line) - (point)))))) - ((eq major-mode 'texinfo-mode) - (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t) - (buffer-substring (match-beginning 1) - (match-end 1)))) - ((eq major-mode 'perl-mode) - (if (re-search-backward "^sub[ \t]+\\([^ \t\n]+\\)" nil t) - (buffer-substring (match-beginning 1) - (match-end 1)))) - ((eq major-mode 'fortran-mode) - ;; must be inside function body for this to work - (beginning-of-fortran-subprogram) - (let ((case-fold-search t)) ; case-insensitive - ;; search for fortran subprogram start - (if (re-search-forward - "^[ \t]*\\(program\\|subroutine\\|function\ -\\|[ \ta-z0-9*]*[ \t]+function\\)" - nil t) - (progn - ;; move to EOL or before first left paren - (if (re-search-forward "[(\n]" nil t) - (progn (forward-char -1) - (skip-chars-backward " \t")) - (end-of-line)) - ;; Use the name preceding that. - (buffer-substring (point) - (progn (forward-sexp -1) - (point))))))) - (t - ;; If all else fails, try heuristics - (let (case-fold-search) - (end-of-line) - (if (re-search-backward add-log-current-defun-header-regexp - (- (point) 10000) - t) - (buffer-substring (match-beginning 1) - (match-end 1)))))))) - (error nil))) - -(defvar get-method-definition-md) - -;; Subroutine used within get-method-definition. -;; Add the last match in the buffer to the end of `md', -;; followed by the string END; move to the end of that match. -(defun get-method-definition-1 (end) - (setq get-method-definition-md - (concat get-method-definition-md - (buffer-substring (match-beginning 1) (match-end 1)) - end)) - (goto-char (match-end 0))) - -;; For objective C, return the method name if we are in a method. -(defun get-method-definition () - (let ((get-method-definition-md "[")) - (save-excursion - (if (re-search-backward "^@implementation\\s-*\\([A-Za-z_]*\\)" nil t) - (get-method-definition-1 " "))) - (save-excursion - (cond - ((re-search-forward "^\\([-+]\\)[ \t\n\f\r]*\\(([^)]*)\\)?\\s-*" nil t) - (get-method-definition-1 "") - (while (not (looking-at "[{;]")) - (looking-at - "\\([A-Za-z_]*:?\\)\\s-*\\(([^)]*)\\)?[A-Za-z_]*[ \t\n\f\r]*") - (get-method-definition-1 "")) - (concat get-method-definition-md "]")))))) - - -(provide 'add-log) - -;;; add-log.el ends here diff --git a/contrib/binutils/etc/add-log.vi b/contrib/binutils/etc/add-log.vi deleted file mode 100644 index efb8c77aa2b8..000000000000 --- a/contrib/binutils/etc/add-log.vi +++ /dev/null @@ -1,11 +0,0 @@ -Here is a vi macro to create entries in the recommended format for -GDB's ChangeLogs. - -map 1GO:r !date '+\%Y-\%m-\%d'2GA Jason Molenda (:r !whoamikJxA@:r !hostnameA)kJxkddjO
*
k$ - -It contains control and escape sequences, so don't just cut and paste it. -You'll need to change the "Jason Molenda" bit, of course. :-) Put this -in your $HOME/.exrc and when you type control-X in move-around-mode, -you'll have a changelog template inserted. - ---- Jason Molenda diff --git a/contrib/binutils/etc/cfg-paper.texi b/contrib/binutils/etc/cfg-paper.texi deleted file mode 100644 index bcfbb31e13f8..000000000000 --- a/contrib/binutils/etc/cfg-paper.texi +++ /dev/null @@ -1,717 +0,0 @@ -\input texinfo -@c %**start of header -@setfilename cfg-paper.info -@settitle On Configuring Development Tools -@c %**end of header -@setchapternewpage off - -@ifinfo -This document attempts to describe the general concepts behind -configuration of the @sc{gnu} Development Tools. -It also discusses common usage. - -Copyright (C) 1991, 1992, 1994 Cygnus Support -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by Cygnus Support. -@end ifinfo - -@titlepage -@sp 10 -@title{On Configuring Development Tools} -@author{K. Richard Pixley, @code{rich@@cygnus.com}} -@author{Cygnus Support} -@page - -@vskip 0pt plus 1filll -Copyright @copyright{} 1991, 1992, 1994 Cygnus Support - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by Cygnus Support. -@end titlepage - -@ifinfo -@format -START-INFO-DIR-ENTRY -* configuration: (cfg-paper). Some theory on configuring source. -END-INFO-DIR-ENTRY -@end format -@end ifinfo - -@node top, Some Basic Terms, (dir), (dir) - -@ifinfo -This document attempts to describe the general concepts behind -configuration of the @sc{gnu} Development Tools. -It also discusses common usage. -@end ifinfo - -@menu -* Some Basic Terms:: Some Basic Terms -* Specifics.:: Specifics -* Building Development Environments:: Building Development Environments -* A Walk Through:: A Walk Through -* Final Notes:: Final Notes -* Index:: Index - - --- The Detailed Node Listing --- - -Some Basic Terms - -* Host Environments:: Host Environments -* Configuration Time Options:: Configuration Time Options - -A Walk Through - -* Native Development Environments:: Native Development Environments -* Emulation Environments:: Emulation Environments -* Simple Cross Environments:: Simple Cross Environments -* Crossing Into Targets:: Crossing Into Targets -* Canadian Cross:: Canadian Cross - -Final Notes - -* Hacking Configurations:: Hacking Configurations -@end menu - -@node Some Basic Terms, Specifics., top, top -@chapter Some Basic Terms - -There are a lot of terms that are frequently used when discussing -development tools. Most of the common terms have been used for many -different concepts such that their meanings have become ambiguous to the -point of being confusing. Typically, we only guess at their meanings -from context and we frequently guess wrong. - -This document uses very few terms by comparison. The intent is to make -the concepts as clear as possible in order to convey the usage and -intent of these tools. - -@emph{Programs} run on @emph{machines}. Programs are very nearly always -written in @emph{source}. Programs are @emph{built} from source. -@emph{Compilation} is a process that is frequently, but not always, used -when building programs. -@cindex Programs -@cindex Machines -@cindex Source -@cindex Building -@cindex Compilation - -@menu -* Host Environments:: Host Environments -* Configuration Time Options:: Configuration Time Options -@end menu - -@node Host Environments, Configuration Time Options, Some Basic Terms, Some Basic Terms -@section Host Environments - -@cindex host -In this document, the word @emph{host} refers to the environment in -which the source in question will be compiled. @emph{host} and -@emph{host name} have nothing to do with the proper name of your host, -like @emph{ucbvax}, @emph{prep.ai.mit.edu} or @emph{att.com}. Instead -they refer to things like @emph{sun4} and @emph{dec3100}. - -Forget for a moment that this particular directory of source is the -source for a development environment. Instead, pretend that it is the -source for a simpler, more mundane, application, say, a desk calculator. - -Source that can be compiled in more than one environment, generally -needs to be set up for each environment explicitly. Here we refer to -that process as configuration. That is, we configure the source for a -host. - -For example, if we wanted to configure our mythical desk calculator to -compile on a SparcStation, we might configure for host sun4. With our -configuration system: - -@example -cd desk-calculator ; ./configure sun4 -@end example - -@noindent -does the trick. @code{configure} is a shell script that sets up Makefiles, -subdirectories, and symbolic links appropriate for compiling the source -on a sun4. - -The @emph{host} environment does not necessarily refer to the machine on -which the tools are built. It is possible to provide a sun3 development -environment on a sun4. If we wanted to use a cross compiler on the sun4 -to build a program intended to be run on a sun3, we would configure the -source for sun3. - -@example -cd desk-calculator ; ./configure sun3 -@end example - -@noindent -The fact that we are actually building the program on a sun4 makes no -difference if the sun3 cross compiler presents an environment that looks -like a sun3 from the point of view of the desk calculator source code. -Specifically, the environment is a sun3 environment if the header files, -predefined symbols, and libraries appear as they do on a sun3. - -Nor does the host environment refer to the the machine on which the -program to be built will run. It is possible to provide a sun3 -emulation environment on a sun4 such that programs built in a sun3 -development environment actually run on the sun4. This technique is -often used within individual programs to remedy deficiencies in the host -operating system. For example, some operating systems do not provide -the @code{bcopy} function and so it is emulated using the -@code{memcpy} funtion. - -Host environment simply refers to the environment in which the program -will be built from the source. - - -@node Configuration Time Options, , Host Environments, Some Basic Terms -@section Configuration Time Options - -Many programs have compile time options. That is, features of the -program that are either compiled into the program or not based on a -choice made by the person who builds the program. We refer to these as -@emph{configuration options}. For example, our desk calculator might be -capable of being compiled into a program that either uses infix notation -or postfix as a configuration option. For a sun3, to choose infix you -might use: - -@example -./configure sun3 --enable-notation=infix -@end example - -@noindent -while for a sun4 with postfix you might use: - -@example -./configure sun4 --enable-notation=postfix -@end example - -If we wanted to build both at the same time, the intermediate pieces -used in the build process must be kept separate. - -@example -mkdir ../objdir.sun4 -(cd ../objdir.sun4 ; ../configure sun4 --enable-notation=postfix --srcdir=../src) -mkdir ../objdir.sun3 -(cd ../objdir.sun3 ; ../configure sun3 --enable-notation=infix --srcdir=../src) -@end example - -@noindent -will create subdirectories for the intermediate pieces of the sun4 and -sun3 configurations. This is necessary as previous systems were only -capable of one configuration at a time. Otherwise, a second -configuration would write over the first. We've chosen to retain this -behaviour so the obj directories and the @code{--srcdir} configuration -option are necessary to get the new behaviour. The order of the -arguments doesn't matter. There should be exactly one argument without -a leading @samp{-} and that argument will be assumed to be the host -name. - -From here on the examples will assume that you want to build the tools -@emph{in place} and won't show the @code{--srcdir} option, but remember -that it is available. - -In order to actually install the program, the configuration system needs -to know where you would like the program installed. The default -location is @file{/usr/local}. We refer to this location as -@code{$(prefix)}. All user visible programs will be installed in -@file{@code{$(prefix)}/bin}. All other programs and files will be -installed in a subdirectory of @file{@code{$(prefix)}/lib}. - -You can only change @code{$(prefix)} as a configuration time -option. - -@example -./configure sun4 --enable-notation=postfix --prefix=/local -@end example - -@noindent -Will configure the source such that: - -@example -make install -@end example - -@noindent -will put its programs in @file{/local/bin} and @file{/local/lib/gcc}. -If you change @code{$(prefix)} after building the source, you will need -to: - -@example -make clean -@end example - -@noindent -before the change will be propogated properly. This is because some -tools need to know the locations of other tools. - -With these concepts in mind, we can drop the desk calculator example and -move on to the application that resides in these directories, namely, -the source to a development environment. - -@node Specifics., Building Development Environments, Some Basic Terms, top -@chapter Specifics - -The @sc{gnu} Development Tools can be built on a wide variety of hosts. So, -of course, they must be configured. Like the last example, - -@example -./configure sun4 --prefix=/local -./configure sun3 --prefix=/local -@end example - -@noindent -will configure the source to be built in subdirectories, in order to -keep the intermediate pieces separate, and to be installed in -@file{/local}. - -When built with suitable development environments, these will be native -tools. We'll explain the term @emph{native} later. - -@node Building Development Environments, A Walk Through, Specifics., top -@chapter Building Development Environments - -@cindex Target - -The @sc{gnu} development tools can not only be built in a -number of host development environments, they can also be configured to -create a number of different development environments on each of those -hosts. We refer to a specific development environment created as a -@emph{target}. That is, the word @emph{target} refers to the development -environment produced by compiling this source and installing the -resulting programs. - -For the @sc{gnu} development tools, the default target is the -same as the host. That is, the development environment produced is -intended to be compatible with the environment used to build the tools. - -In the example above, we created two configurations, one for sun4 and -one for sun3. The first configuration is expecting to be built in a -sun4 development environment, to create a sun4 development environment. -It doesn't necessarily need to be built on a sun4 if a sun4 development -environment is available elsewhere. Likewise, if the available sun4 -development environment produces executables intended for something -other than sun4, then the development environment built from this sun4 -configuration will run on something other than a sun4. From the point -of view of the configuration system and the @sc{gnu} development tools -source, this doesn't matter. What matters is that they will be built in -a sun4 environment. - -Similarly, the second configuration given above is expecting to be built -in a sun3 development environment, to create a sun3 development -environment. - -The development environment produced is a configuration time option, -just like @code{$(prefix)}. - -@example -./configure sun4 --prefix=/local --target=sun3 -./configure sun3 --prefix=/local --target=sun4 -@end example - -In this example, like before, we create two configurations. The first -is intended to be built in a sun4 environment, in subdirectories, to be -installed in @file{/local}. The second is intended to be built in a -sun3 environment, in subdirectories, to be installed in @file{/local}. - -Unlike the previous example, the first configuration will produce a sun3 -development environment, perhaps even suitable for building the second -configuration. Likewise, the second configuration will produce a sun4 -development environment, perhaps even suitable for building the first -configuration. - -The development environment used to build these configurations will -determine the machines on which the resulting development environments -can be used. - - -@node A Walk Through, Final Notes, Building Development Environments, top -@chapter A Walk Through - - -@menu -* Native Development Environments:: Native Development Environments -* Emulation Environments:: Emulation Environments -* Simple Cross Environments:: Simple Cross Environments -* Crossing Into Targets:: Crossing Into Targets -* Canadian Cross:: Canadian Cross -@end menu - -@node Native Development Environments, Emulation Environments, A Walk Through, A Walk Through -@section Native Development Environments - -Let us assume for a moment that you have a sun4 and that with your sun4 -you received a development environment. This development environment is -intended to be run on your sun4 to build programs that can be run on -your sun4. You could, for instance, run this development environment on -your sun4 to build our example desk calculator program. You could then -run the desk calculator program on your sun4. - -@cindex Native -@cindex Foreign -The resulting desk calculator program is referred to as a @emph{native} -program. The development environment itself is composed of native -programs that, when run, build other native programs. Any other program -is referred to as @emph{foreign}. Programs intended for other machines are -foreign programs. - -This type of development environment, which is by far the most common, -is refered to as @emph{native}. That is, a native development environment -runs on some machine to build programs for that same machine. The -process of using a native development environment to build native -programs is called a @emph{native} build. - -@example -./configure sun4 -@end example - -@noindent -will configure this source such that when built in a sun4 development -environment, with a development environment that builds programs -intended to be run on sun4 machines, the programs built will be native -programs and the resulting development environment will be a native -development environment. - -The development system that came with your sun4 is one such environment. -Using it to build the @sc{gnu} Development Tools is a very common activity -and the resulting development environment is quite popular. - -@example -make all -@end example - -@noindent -will build the tools as configured and will assume that you want to use -the native development environment that came with your machine. - -@cindex Bootstrapping -@cindex Stage1 -Using a development environment to build a development environment is -called @emph{bootstrapping}. The release of the @sc{gnu} -Development Tools is capable of bootstrapping itself. This is a very -powerful feature that we'll return to later. For now, let's pretend -that you used the native development environment that came with your -sun4 to bootstrap the release and let's call the new -development environment @emph{stage1}. - -Why bother? Well, most people find that the @sc{gnu} development -environment builds programs that run faster and take up less space than -the native development environments that came with their machines. Some -people didn't get development environments with their machines and some -people just like using the @sc{gnu} tools better than using other tools. - -@cindex Stage2 -While you're at it, if the @sc{gnu} tools produce better programs, maybe you -should use them to build the @sc{gnu} tools. So let's -pretend that you do. Let's call the new development environment -@emph{stage2}. - -@cindex Stage3 -So far you've built a development environment, stage1, and you've used -stage1 to build a new, faster and smaller development environment, -stage2, but you haven't run any of the programs that the @sc{gnu} tools have -built. You really don't yet know if these tools work. Do you have any -programs built with the @sc{gnu} tools? Yes, you do. stage2. What does -that program do? It builds programs. Ok, do you have any source handy -to build into a program? Yes, you do. The @sc{gnu} tools themselves. In -fact, if you use stage2 to build the @sc{gnu} tools again the resulting -programs should be identical to stage2. Let's pretend that you do and -call the new development environment @emph{stage3}. - -@cindex Three stage boot -You've just completed what's called a @emph{three stage boot}. You now have -a small, fast, somewhat tested, development environment. - -@example -make bootstrap -@end example - -@noindent -will do a three stage boot across all tools and will compare stage2 to -stage3 and complain if they are not identical. - -Once built, - -@example -make install -@end example - -@noindent -will install the development environment in the default location, or in -@code{$(prefix)} if you specified an alternate when you configured. - -@cindex Cross -Any development environment that is not a native development environment -is refered to as a @emph{cross} development environment. There are many -different types of cross development environments but most fall into one -of three basic categories. - - -@node Emulation Environments, Simple Cross Environments, Native Development Environments, A Walk Through -@section Emulation Environments - -@cindex Emulation -The first category of cross development environment is called -@emph{emulation}. There are two primary types of emulation, but both -types result in programs that run on the native host. - -@cindex Software emulation -@cindex Software emulator -The first type is @emph{software emulation}. This form of cross -development environment involves a native program that when run on the -native host, is capable of interpreting, and in most aspects running, a -program intended for some other machine. This technique is typically -used when the other machine is either too expensive, too slow, too fast, -or not available, perhaps because it hasn't yet been built. The native, -interpreting program is called a @emph{software emulator}. - -The @sc{gnu} Development Tools do not currently include any software -emulators. Some do exist and the @sc{gnu} Development Tools can be -configured to create simple cross development environments for with -these emulators. More on this later. - -The second type of emulation is when source intended for some other -development environment is built into a program intended for the native -host. The concepts of operating system universes and hosted operating -systems are two such development environments. - -@node Simple Cross Environments, Crossing Into Targets, Emulation Environments, A Walk Through -@section Simple Cross Environments - -@example -./configure sun4 --target=a29k -@end example - -@noindent -will configure the tools such that when compiled in a sun4 development -environment the resulting development environment can be used to create -programs intended for an a29k. Again, this does not necessarily mean -that the new development environment can be run on a sun4. That would -depend on the development environment used to build these tools. - -Earlier you saw how to configure the tools to build a native development -environment, that is, a development environment that runs on your sun4 -and builds programs for your sun4. Let's pretend that you use stage3 to -build this simple cross configuration and let's call the new development -environment gcc-a29k. Remember that this is a native build. Gcc-a29k -is a collection of native programs intended to run on your sun4. That's -what stage3 builds, programs for your sun4. Gcc-a29k represents an a29k -development environment that builds programs intended to run on an a29k. -But, remember, gcc-a29k runs on your sun4. Programs built with gcc-a29k -will run on your sun4 only with the help of an appropriate software -emulator. - -@cindex Simple cross -@cindex Crossing to -Building gcc-a29k is also a bootstrap but of a slightly different sort. -We call gcc-a29k a @emph{simple cross} environment and using gcc-a29k to -build a program intended for a29k is called @emph{crossing to} a29k. -Simple cross environments are the second category of cross development -environments. - - -@node Crossing Into Targets, Canadian Cross, Simple Cross Environments, A Walk Through -@section Crossing Into Targets - -@example -./configure a29k --target=a29k -@end example - -@noindent -will configure the tools such that when compiled in an a29k development -environment, the resulting development environment can be used to create -programs intended for an a29k. Again, this does not necessarily mean -that the new development environment can be run on an a29k. That would -depend on the development environment used to build these tools. - -If you've been following along this walk through, then you've already -built an a29k environment, namely gcc-a29k. Let's pretend you use -gcc-a29k to build the current configuration. - -Gcc-a29k builds programs intended for the a29k so the new development -environment will be intended for use on an a29k. That is, this new gcc -consists of programs that are foreign to your sun4. They cannot be run -on your sun4. - -@cindex Crossing into -The process of building this configuration is a another bootstrap. This -bootstrap is also a cross to a29k. Because this type of build is both a -bootstrap and a cross to a29k, it is sometimes referred to as a -@emph{cross into} a29k. This new development environment isn't really a -cross development environment at all. It is intended to run on an a29k -to produce programs for an a29k. You'll remember that this makes it, by -definition, an a29k native compiler. @emph{Crossing into} has been -introduced here not because it is a type of cross development -environment, but because it is frequently mistaken as one. The process -is @emph{a cross} but the resulting development environment is a native -development environment. - -You could not have built this configuration with stage3, because stage3 -doesn't provide an a29k environment. Instead it provides a sun4 -environment. - -If you happen to have an a29k lying around, you could now use this fresh -development environment on the a29k to three-stage these tools all over -again. This process would look just like it did when we built the -native sun4 development environment because we would be building another -native development environment, this one on a29k. - - -@node Canadian Cross, , Crossing Into Targets, A Walk Through -@section Canadian Cross - -So far you've seen that our development environment source must be -configured for a specific host and for a specific target. You've also -seen that the resulting development environment depends on the -development environment used in the build process. - -When all four match identically, that is, the configured host, the -configured target, the environment presented by the development -environment used in the build, and the machine on which the resulting -development environment is intended to run, then the new development -environment will be a native development environment. - -When all four match except the configured host, then we can assume that -the development environment used in the build is some form of library -emulation. - -When all four match except for the configured target, then the resulting -development environment will be a simple cross development environment. - -When all four match except for the host on which the development -environment used in the build runs, the build process is a @emph{cross into} -and the resulting development environment will be native to some other -machine. - -Most of the other permutations do exist in some form, but only one more -is interesting to the current discussion. - -@example -./configure a29k --target=sun3 -@end example - -@noindent -will configure the tools such that when compiled in an a29k development -environment, the resulting development environment can be used to create -programs intended for a sun3. Again, this does not necessarily mean -that the new development environment can be run on an a29k. That would -depend on the development environment used to build these tools. - -If you are still following along, then you have two a29k development -environments, the native development environment that runs on a29k, and -the simple cross that runs on your sun4. If you use the a29k native -development environment on the a29k, you will be doing the same thing we -did a while back, namely building a simple cross from a29k to sun3. -Let's pretend that instead, you use gcc-a29k, the simple cross -development environment that runs on sun4 but produces programs for -a29k. - -The resulting development environment will run on a29k because that's -what gcc-a29k builds, a29k programs. This development environment will -produce programs for a sun3 because that is how it was configured. This -means that the resulting development environment is a simple cross. - -@cindex Canadian Cross -@cindex Three party cross -There really isn't a common name for this process because very few -development environments are capable of being configured this -extensively. For the sake of discussion, let's call this process a -@emph{Canadian cross}. It's a three party cross, Canada has a three -party system, hence Canadian Cross. - -@node Final Notes, Index, A Walk Through, top -@chapter Final Notes - -By @emph{configures}, I mean that links, Makefile, .gdbinit, and -config.status are built. Configuration is always done from the source -directory. - -@table @code - -@item ./configure @var{name} -configures this directory, perhaps recursively, for a single host+target -pair where the host and target are both @var{name}. If a previous -configuration existed, it will be overwritten. - -@item ./configure @var{hostname} --target=@var{targetname} -configures this directory, perhaps recursively, for a single host+target -pair where the host is @var{hostname} and target is @var{targetname}. -If a previous configuration existed, it will be overwritten. - -@end table - -@menu -* Hacking Configurations:: Hacking Configurations -@end menu - -@node Hacking Configurations, , Final Notes, Final Notes -@section Hacking Configurations - -The configure scripts essentially do three things, create subdirectories -if appropriate, build a @file{Makefile}, and create links to files, all -based on and tailored to, a specific host+target pair. The scripts also -create a @file{.gdbinit} if appropriate but this is not tailored. - -The Makefile is created by prepending some variable definitions to a -Makefile template called @file{Makefile.in} and then inserting host and -target specific Makefile fragments. The variables are set based on the -chosen host+target pair and build style, that is, if you use -@code{--srcdir} or not. The host and target specific Makefile may or may -not exist. - -@itemize @bullet - -@item -Makefiles can be edited directly, but those changes will eventually be -lost. Changes intended to be permanent for a specific host should be -made to the host specific Makefile fragment. This should be in -@file{./config/mh-@var{host}} if it exists. Changes intended to be -permanent for a specific target should be made to the target specific -Makefile fragment. This should be in @file{./config/mt-@var{target}} if -it exists. Changes intended to be permanent for the directory should be -made in @file{Makefile.in}. To propogate changes to any of these, -either use @code{make Makefile} or @code{./config.status} or -re-configure. - -@end itemize - -@page -@node Index, , Final Notes, top -@appendix Index - -@printindex cp - -@contents -@bye - -@c Local Variables: -@c fill-column: 72 -@c End: diff --git a/contrib/binutils/etc/configbuild.ein b/contrib/binutils/etc/configbuild.ein deleted file mode 100644 index 7a0e214f2d52..000000000000 --- a/contrib/binutils/etc/configbuild.ein +++ /dev/null @@ -1,149 +0,0 @@ -%!PS-Adobe-2.0 EPSF-2.0 -%%Title: configbuild.fig -%%Creator: fig2dev Version 3.1 Patchlevel 1 -%%CreationDate: Fri Jun 12 20:13:16 1998 -%%For: ian@tito.cygnus.com (Ian Lance Taylor) -%%Orientation: Portrait -%%BoundingBox: 0 0 322 173 -%%Pages: 0 -%%BeginSetup -%%IncludeFeature: *PageSize Letter -%%EndSetup -%%EndComments -/$F2psDict 200 dict def -$F2psDict begin -$F2psDict /mtrx matrix put -/col-1 {} def -/col0 {0.000 0.000 0.000 srgb} bind def -/col1 {0.000 0.000 1.000 srgb} bind def -/col2 {0.000 1.000 0.000 srgb} bind def -/col3 {0.000 1.000 1.000 srgb} bind def -/col4 {1.000 0.000 0.000 srgb} bind def -/col5 {1.000 0.000 1.000 srgb} bind def -/col6 {1.000 1.000 0.000 srgb} bind def -/col7 {1.000 1.000 1.000 srgb} bind def -/col8 {0.000 0.000 0.560 srgb} bind def -/col9 {0.000 0.000 0.690 srgb} bind def -/col10 {0.000 0.000 0.820 srgb} bind def -/col11 {0.530 0.810 1.000 srgb} bind def -/col12 {0.000 0.560 0.000 srgb} bind def -/col13 {0.000 0.690 0.000 srgb} bind def -/col14 {0.000 0.820 0.000 srgb} bind def -/col15 {0.000 0.560 0.560 srgb} bind def -/col16 {0.000 0.690 0.690 srgb} bind def -/col17 {0.000 0.820 0.820 srgb} bind def -/col18 {0.560 0.000 0.000 srgb} bind def -/col19 {0.690 0.000 0.000 srgb} bind def -/col20 {0.820 0.000 0.000 srgb} bind def -/col21 {0.560 0.000 0.560 srgb} bind def -/col22 {0.690 0.000 0.690 srgb} bind def -/col23 {0.820 0.000 0.820 srgb} bind def -/col24 {0.500 0.190 0.000 srgb} bind def -/col25 {0.630 0.250 0.000 srgb} bind def -/col26 {0.750 0.380 0.000 srgb} bind def -/col27 {1.000 0.500 0.500 srgb} bind def -/col28 {1.000 0.630 0.630 srgb} bind def -/col29 {1.000 0.750 0.750 srgb} bind def -/col30 {1.000 0.880 0.880 srgb} bind def -/col31 {1.000 0.840 0.000 srgb} bind def - -end -save --62.0 226.0 translate -1 -1 scale - -/clp {closepath} bind def -/ef {eofill} bind def -/gr {grestore} bind def -/gs {gsave} bind def -/l {lineto} bind def -/m {moveto} bind def -/n {newpath} bind def -/s {stroke} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit - 0.06000 0.06000 sc -7.500 slw -% Polyline -n 1050 900 m 2100 900 l 2100 1425 l 1050 1425 l clp gs col-1 s gr -% Polyline -n 1500 1425 m 1500 2100 l gs col-1 s gr -n 1530.00 1980.00 m 1500.00 2100.00 l 1470.00 1980.00 l 1500.50 1980.50 l 1530.00 1980.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 1500 2625 m 1500 3300 l gs col-1 s gr -n 1530.00 3180.00 m 1500.00 3300.00 l 1470.00 3180.00 l 1500.50 3180.50 l 1530.00 3180.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 2925 900 m 3825 900 l 3825 1425 l 2925 1425 l clp gs col-1 s gr -% Polyline -n 1155 2100 m 1050 2100 1050 2520 105 arcto 4 {pop} repeat 1050 2625 2220 2625 105 arcto 4 {pop} repeat 2325 2625 2325 2205 105 arcto 4 {pop} repeat 2325 2100 1155 2100 105 arcto 4 {pop} repeat clp gs col-1 s gr -% Polyline -n 2850 2100 m 4125 2100 l 4125 2625 l 2850 2625 l clp gs col-1 s gr -% Polyline -n 3375 1425 m 3375 2100 l gs col-1 s gr -n 3405.00 1980.00 m 3375.00 2100.00 l 3345.00 1980.00 l 3375.50 1980.50 l 3405.00 1980.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 5100 900 m 6300 900 l 6300 1350 l 5100 1350 l clp gs col-1 s gr -% Polyline -n 5625 1350 m 5625 2100 l gs col-1 s gr -n 5655.00 1980.00 m 5625.00 2100.00 l 5595.00 1980.00 l 5625.50 1980.50 l 5655.00 1980.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 5205 2100 m 5100 2100 5100 2520 105 arcto 4 {pop} repeat 5100 2625 6270 2625 105 arcto 4 {pop} repeat 6375 2625 6375 2205 105 arcto 4 {pop} repeat 6375 2100 5205 2100 105 arcto 4 {pop} repeat clp gs col-1 s gr -% Polyline -n 5625 2625 m 5625 3300 l gs col-1 s gr -n 5655.00 3180.00 m 5625.00 3300.00 l 5595.00 3180.00 l 5625.50 3180.50 l 5655.00 3180.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 5100 3300 m 6225 3300 l 6225 3750 l 5100 3750 l clp gs col-1 s gr -% Polyline - [1 50.0] 50.000000 setdash -n 2850 2400 m 2325 2400 l gs col-1 s gr [] 0 setdash -n 2445.00 2430.00 m 2325.00 2400.00 l 2445.00 2370.00 l 2445.50 2400.50 l 2445.00 2430.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline - [1 50.0] 50.000000 setdash -n 4125 2400 m 5100 2400 l gs col-1 s gr [] 0 setdash -n 4980.00 2370.00 m 5100.00 2400.00 l 4980.00 2430.00 l 4980.50 2400.50 l 4980.00 2370.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 1050 3300 m 1950 3300 l 1950 3750 l 1050 3750 l clp gs col-1 s gr -/Times-Roman findfont 180.00 scalefont setfont -1200 1200 m -gs 1 -1 sc (config.in) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3000 1200 m -gs 1 -1 sc (configure) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3000 2400 m -gs 1 -1 sc (config.status) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -1200 2400 m -gs 1 -1 sc (config.status) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -1200 3600 m -gs 1 -1 sc (config.h) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -5250 1200 m -gs 1 -1 sc (Makefile.in) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -5250 2400 m -gs 1 -1 sc (config.status) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -5250 3600 m -gs 1 -1 sc (Makefile) col-1 show gr -$F2psEnd -restore diff --git a/contrib/binutils/etc/configbuild.fig b/contrib/binutils/etc/configbuild.fig deleted file mode 100644 index 747592d3d623..000000000000 --- a/contrib/binutils/etc/configbuild.fig +++ /dev/null @@ -1,50 +0,0 @@ -#FIG 3.1 -Portrait -Center -Inches -1200 2 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 1050 900 2100 900 2100 1425 1050 1425 1050 900 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 1500 1425 1500 2100 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 1500 2625 1500 3300 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 2925 900 3825 900 3825 1425 2925 1425 2925 900 -2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5 - 2325 2625 2325 2100 1050 2100 1050 2625 2325 2625 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 2850 2100 4125 2100 4125 2625 2850 2625 2850 2100 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 3375 1425 3375 2100 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 5100 900 6300 900 6300 1350 5100 1350 5100 900 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 5625 1350 5625 2100 -2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5 - 6375 2625 6375 2100 5100 2100 5100 2625 6375 2625 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 5625 2625 5625 3300 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 5100 3300 6225 3300 6225 3750 5100 3750 5100 3300 -2 1 2 1 -1 7 0 0 -1 3.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 2850 2400 2325 2400 -2 1 2 1 -1 7 0 0 -1 3.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 4125 2400 5100 2400 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 1050 3300 1950 3300 1950 3750 1050 3750 1050 3300 -4 0 -1 0 0 0 12 0.0000000 4 180 645 1200 1200 config.in\001 -4 0 -1 0 0 0 12 0.0000000 4 180 705 3000 1200 configure\001 -4 0 -1 0 0 0 12 0.0000000 4 180 990 3000 2400 config.status\001 -4 0 -1 0 0 0 12 0.0000000 4 180 990 1200 2400 config.status\001 -4 0 -1 0 0 0 12 0.0000000 4 180 600 1200 3600 config.h\001 -4 0 -1 0 0 0 12 0.0000000 4 135 855 5250 1200 Makefile.in\001 -4 0 -1 0 0 0 12 0.0000000 4 180 990 5250 2400 config.status\001 -4 0 -1 0 0 0 12 0.0000000 4 135 675 5250 3600 Makefile\001 diff --git a/contrib/binutils/etc/configbuild.jin b/contrib/binutils/etc/configbuild.jin Binary files differdeleted file mode 100644 index 44cd9397aa16..000000000000 --- a/contrib/binutils/etc/configbuild.jin +++ /dev/null diff --git a/contrib/binutils/etc/configbuild.tin b/contrib/binutils/etc/configbuild.tin deleted file mode 100644 index cfdd6fe07437..000000000000 --- a/contrib/binutils/etc/configbuild.tin +++ /dev/null @@ -1,9 +0,0 @@ - config.in *configure* Makefile.in - | | | - | v | - | config.status | - | | | - *config.status*<======+==========>*config.status* - | | - v v - config.h Makefile diff --git a/contrib/binutils/etc/configdev.ein b/contrib/binutils/etc/configdev.ein deleted file mode 100644 index 7f837850d695..000000000000 --- a/contrib/binutils/etc/configdev.ein +++ /dev/null @@ -1,185 +0,0 @@ -%!PS-Adobe-2.0 EPSF-2.0 -%%Title: configdev.fig -%%Creator: fig2dev Version 3.1 Patchlevel 1 -%%CreationDate: Mon Jun 15 17:35:19 1998 -%%For: ian@tito.cygnus.com (Ian Lance Taylor) -%%Orientation: Portrait -%%BoundingBox: 0 0 344 317 -%%Pages: 0 -%%BeginSetup -%%IncludeFeature: *PageSize Letter -%%EndSetup -%%EndComments -/$F2psDict 200 dict def -$F2psDict begin -$F2psDict /mtrx matrix put -/col-1 {} def -/col0 {0.000 0.000 0.000 srgb} bind def -/col1 {0.000 0.000 1.000 srgb} bind def -/col2 {0.000 1.000 0.000 srgb} bind def -/col3 {0.000 1.000 1.000 srgb} bind def -/col4 {1.000 0.000 0.000 srgb} bind def -/col5 {1.000 0.000 1.000 srgb} bind def -/col6 {1.000 1.000 0.000 srgb} bind def -/col7 {1.000 1.000 1.000 srgb} bind def -/col8 {0.000 0.000 0.560 srgb} bind def -/col9 {0.000 0.000 0.690 srgb} bind def -/col10 {0.000 0.000 0.820 srgb} bind def -/col11 {0.530 0.810 1.000 srgb} bind def -/col12 {0.000 0.560 0.000 srgb} bind def -/col13 {0.000 0.690 0.000 srgb} bind def -/col14 {0.000 0.820 0.000 srgb} bind def -/col15 {0.000 0.560 0.560 srgb} bind def -/col16 {0.000 0.690 0.690 srgb} bind def -/col17 {0.000 0.820 0.820 srgb} bind def -/col18 {0.560 0.000 0.000 srgb} bind def -/col19 {0.690 0.000 0.000 srgb} bind def -/col20 {0.820 0.000 0.000 srgb} bind def -/col21 {0.560 0.000 0.560 srgb} bind def -/col22 {0.690 0.000 0.690 srgb} bind def -/col23 {0.820 0.000 0.820 srgb} bind def -/col24 {0.500 0.190 0.000 srgb} bind def -/col25 {0.630 0.250 0.000 srgb} bind def -/col26 {0.750 0.380 0.000 srgb} bind def -/col27 {1.000 0.500 0.500 srgb} bind def -/col28 {1.000 0.630 0.630 srgb} bind def -/col29 {1.000 0.750 0.750 srgb} bind def -/col30 {1.000 0.880 0.880 srgb} bind def -/col31 {1.000 0.840 0.000 srgb} bind def - -end -save --62.0 370.0 translate -1 -1 scale - -/clp {closepath} bind def -/ef {eofill} bind def -/gr {grestore} bind def -/gs {gsave} bind def -/l {lineto} bind def -/m {moveto} bind def -/n {newpath} bind def -/s {stroke} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit - 0.06000 0.06000 sc -7.500 slw -% Polyline -n 1050 900 m 2100 900 l 2100 1425 l 1050 1425 l clp gs col-1 s gr -% Polyline -n 2925 900 m 3975 900 l 3975 1425 l 2925 1425 l clp gs col-1 s gr -% Polyline -n 5550 900 m 6750 900 l 6750 1350 l 5550 1350 l clp gs col-1 s gr -% Polyline -n 3750 1800 m 5025 1800 l 5025 2250 l 3750 2250 l clp gs col-1 s gr -% Polyline -n 1155 2100 m 1050 2100 1050 2520 105 arcto 4 {pop} repeat 1050 2625 2070 2625 105 arcto 4 {pop} repeat 2175 2625 2175 2205 105 arcto 4 {pop} repeat 2175 2100 1155 2100 105 arcto 4 {pop} repeat clp gs col-1 s gr -% Polyline -n 5550 3300 m 6675 3300 l 6675 3750 l 5550 3750 l clp gs col-1 s gr -% Polyline -n 5655 2100 m 5550 2100 5550 2520 105 arcto 4 {pop} repeat 5550 2625 6495 2625 105 arcto 4 {pop} repeat 6600 2625 6600 2205 105 arcto 4 {pop} repeat 6600 2100 5655 2100 105 arcto 4 {pop} repeat clp gs col-1 s gr -% Polyline -n 3750 3600 m 4875 3600 l 4875 4050 l 3750 4050 l clp gs col-1 s gr -% Polyline -n 3855 2700 m 3750 2700 3750 3045 105 arcto 4 {pop} repeat 3750 3150 4545 3150 105 arcto 4 {pop} repeat 4650 3150 4650 2805 105 arcto 4 {pop} repeat 4650 2700 3855 2700 105 arcto 4 {pop} repeat clp gs col-1 s gr -% Polyline -n 2850 5700 m 3750 5700 l 3750 6150 l 2850 6150 l clp gs col-1 s gr -% Polyline -n 3030 4800 m 2925 4800 2925 5145 105 arcto 4 {pop} repeat 2925 5250 3645 5250 105 arcto 4 {pop} repeat 3750 5250 3750 4905 105 arcto 4 {pop} repeat 3750 4800 3030 4800 105 arcto 4 {pop} repeat clp gs col-1 s gr -% Polyline -n 1500 1425 m 1500 2100 l gs col-1 s gr -n 1530.00 1980.00 m 1500.00 2100.00 l 1470.00 1980.00 l 1500.50 1980.50 l 1530.00 1980.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 3300 1425 m 3300 4800 l gs col-1 s gr -n 3330.00 4680.00 m 3300.00 4800.00 l 3270.00 4680.00 l 3300.50 4680.50 l 3330.00 4680.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 3300 1575 m 1875 1575 l 1875 2100 l gs col-1 s gr -n 1905.00 1980.00 m 1875.00 2100.00 l 1845.00 1980.00 l 1875.50 1980.50 l 1905.00 1980.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 3300 1575 m 5700 1575 l 5700 2100 l gs col-1 s gr -n 5730.00 1980.00 m 5700.00 2100.00 l 5670.00 1980.00 l 5700.50 1980.50 l 5730.00 1980.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 6225 1350 m 6225 2100 l gs col-1 s gr -n 6255.00 1980.00 m 6225.00 2100.00 l 6195.00 1980.00 l 6225.50 1980.50 l 6255.00 1980.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 6075 2625 m 6075 3300 l gs col-1 s gr -n 6105.00 3180.00 m 6075.00 3300.00 l 6045.00 3180.00 l 6075.50 3180.50 l 6105.00 3180.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 4200 2250 m 4200 2700 l gs col-1 s gr -n 4230.00 2580.00 m 4200.00 2700.00 l 4170.00 2580.00 l 4200.50 2580.50 l 4230.00 2580.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 4200 3150 m 4200 3600 l gs col-1 s gr -n 4230.00 3480.00 m 4200.00 3600.00 l 4170.00 3480.00 l 4200.50 3480.50 l 4230.00 3480.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 4200 4050 m 4200 4500 l 3675 4500 l 3675 4800 l gs col-1 s gr -n 3705.00 4680.00 m 3675.00 4800.00 l 3645.00 4680.00 l 3675.50 4680.50 l 3705.00 4680.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 3375 5250 m 3375 5700 l gs col-1 s gr -n 3405.00 5580.00 m 3375.00 5700.00 l 3345.00 5580.00 l 3375.50 5580.50 l 3405.00 5580.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 3300 2925 m 3750 2925 l gs col-1 s gr -n 3630.00 2895.00 m 3750.00 2925.00 l 3630.00 2955.00 l 3630.50 2925.50 l 3630.00 2895.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 1500 2625 m 1500 3300 l gs col-1 s gr -n 1530.00 3180.00 m 1500.00 3300.00 l 1470.00 3180.00 l 1500.50 3180.50 l 1530.00 3180.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -% Polyline -n 1050 3300 m 2100 3300 l 2100 3750 l 1050 3750 l clp gs col-1 s gr -% Polyline -n 4875 3825 m 5250 3825 l 5250 2400 l 5550 2400 l gs col-1 s gr -n 5430.00 2370.00 m 5550.00 2400.00 l 5430.00 2430.00 l 5430.50 2400.50 l 5430.00 2370.00 l clp gs 0.00 setgray ef gr gs col-1 s gr -/Times-Roman findfont 180.00 scalefont setfont -1200 1200 m -gs 1 -1 sc (acconfig.h) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3000 1200 m -gs 1 -1 sc (configure.in) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -5700 1200 m -gs 1 -1 sc (Makefile.am) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3900 2100 m -gs 1 -1 sc (acinclude.m4) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -1200 2400 m -gs 1 -1 sc (autoheader) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -1200 3600 m -gs 1 -1 sc (config.in) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -5700 3600 m -gs 1 -1 sc (Makefile.in) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -5700 2400 m -gs 1 -1 sc (automake) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3900 3900 m -gs 1 -1 sc (aclocal.m4) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3900 3000 m -gs 1 -1 sc (aclocal) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3000 6000 m -gs 1 -1 sc (configure) col-1 show gr -/Times-Roman findfont 180.00 scalefont setfont -3000 5100 m -gs 1 -1 sc (autoconf) col-1 show gr -$F2psEnd -restore diff --git a/contrib/binutils/etc/configdev.fig b/contrib/binutils/etc/configdev.fig deleted file mode 100644 index 4d386ec4ff7a..000000000000 --- a/contrib/binutils/etc/configdev.fig +++ /dev/null @@ -1,80 +0,0 @@ -#FIG 3.1 -Portrait -Center -Inches -1200 2 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 1050 900 2100 900 2100 1425 1050 1425 1050 900 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 2925 900 3975 900 3975 1425 2925 1425 2925 900 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 5550 900 6750 900 6750 1350 5550 1350 5550 900 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 3750 1800 5025 1800 5025 2250 3750 2250 3750 1800 -2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5 - 2175 2625 2175 2100 1050 2100 1050 2625 2175 2625 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 5550 3300 6675 3300 6675 3750 5550 3750 5550 3300 -2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5 - 6600 2625 6600 2100 5550 2100 5550 2625 6600 2625 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 3750 3600 4875 3600 4875 4050 3750 4050 3750 3600 -2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5 - 4650 3150 4650 2700 3750 2700 3750 3150 4650 3150 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 2850 5700 3750 5700 3750 6150 2850 6150 2850 5700 -2 4 0 1 -1 7 0 0 -1 0.000 0 0 7 0 0 5 - 3750 5250 3750 4800 2925 4800 2925 5250 3750 5250 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 1500 1425 1500 2100 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 3300 1425 3300 4800 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 3 - 1 1 1.00 60.00 120.00 - 3300 1575 1875 1575 1875 2100 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 3 - 1 1 1.00 60.00 120.00 - 3300 1575 5700 1575 5700 2100 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 6225 1350 6225 2100 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 6075 2625 6075 3300 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 4200 2250 4200 2700 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 4200 3150 4200 3600 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 4 - 1 1 1.00 60.00 120.00 - 4200 4050 4200 4500 3675 4500 3675 4800 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 3375 5250 3375 5700 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 3300 2925 3750 2925 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 1500 2625 1500 3300 -2 2 0 1 -1 7 0 0 -1 0.000 0 0 0 0 0 5 - 1050 3300 2100 3300 2100 3750 1050 3750 1050 3300 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 1 0 4 - 1 1 1.00 60.00 120.00 - 4875 3825 5250 3825 5250 2400 5550 2400 -4 0 -1 0 0 0 12 0.0000000 4 180 780 1200 1200 acconfig.h\001 -4 0 -1 0 0 0 12 0.0000000 4 180 885 3000 1200 configure.in\001 -4 0 -1 0 0 0 12 0.0000000 4 135 945 5700 1200 Makefile.am\001 -4 0 -1 0 0 0 12 0.0000000 4 135 990 3900 2100 acinclude.m4\001 -4 0 -1 0 0 0 12 0.0000000 4 135 840 1200 2400 autoheader\001 -4 0 -1 0 0 0 12 0.0000000 4 180 645 1200 3600 config.in\001 -4 0 -1 0 0 0 12 0.0000000 4 135 855 5700 3600 Makefile.in\001 -4 0 -1 0 0 0 12 0.0000000 4 135 735 5700 2400 automake\001 -4 0 -1 0 0 0 12 0.0000000 4 135 810 3900 3900 aclocal.m4\001 -4 0 -1 0 0 0 12 0.0000000 4 135 540 3900 3000 aclocal\001 -4 0 -1 0 0 0 12 0.0000000 4 180 705 3000 6000 configure\001 -4 0 -1 0 0 0 12 0.0000000 4 135 660 3000 5100 autoconf\001 diff --git a/contrib/binutils/etc/configdev.jin b/contrib/binutils/etc/configdev.jin Binary files differdeleted file mode 100644 index 9b11a71acd7d..000000000000 --- a/contrib/binutils/etc/configdev.jin +++ /dev/null diff --git a/contrib/binutils/etc/configdev.tin b/contrib/binutils/etc/configdev.tin deleted file mode 100644 index c9b6f34f4d79..000000000000 --- a/contrib/binutils/etc/configdev.tin +++ /dev/null @@ -1,17 +0,0 @@ - acconfig.h configure.in Makefile.am - | | | - | --------------+---------------------- | - | | | | | - v v | acinclude.m4 | | - *autoheader* | | v v - | | v --->*automake* - v |--->*aclocal* | | - config.in | | | v - | v | Makefile.in - | aclocal.m4--- - | | - v v - *autoconf* - | - v - configure diff --git a/contrib/binutils/etc/configure b/contrib/binutils/etc/configure deleted file mode 100755 index 101fcefecfcc..000000000000 --- a/contrib/binutils/etc/configure +++ /dev/null @@ -1,862 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12.1 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12.1" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=Makefile.in - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - - -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:555: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set) 2>&1 | grep ac_space` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12.1" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" - -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_DATA@%$INSTALL_DATA%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/contrib/binutils/etc/configure.in b/contrib/binutils/etc/configure.in deleted file mode 100644 index b785068009eb..000000000000 --- a/contrib/binutils/etc/configure.in +++ /dev/null @@ -1,7 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_PREREQ(2.5) -AC_INIT(Makefile.in) - -AC_PROG_INSTALL - -AC_OUTPUT(Makefile) diff --git a/contrib/binutils/etc/configure.man b/contrib/binutils/etc/configure.man deleted file mode 100644 index a7699041a711..000000000000 --- a/contrib/binutils/etc/configure.man +++ /dev/null @@ -1,166 +0,0 @@ -.\" -*- nroff -*- -.\" Copyright (c) 1991, 1992, 1996 Cygnus Support -.\" written by K. Richard Pixley -.TH configure 1 "29 March 1996" "cygnus support" "Cygnus Support" -.de BP -.sp -.ti \-.2i -\(** -.. - -.SH NAME -configure \- prepare source code to be built - -.SH SYNOPSIS -configure HOST [--target=TARGET] [--srcdir=DIR] [--rm] - [--site=SITE] [--prefix=DIR] [--exec_prefix=DIR] - [--program_prefix=DIR] [--tmpdir=DIR] - [--with-PACKAGE[=YES/NO]] [--without-PACKAGE] - [--enable-FEATURE[=YES/NO]] [--disable-FEATURE] - [--norecursion] [--nfp] [-s] [-v] [-V | --version] [--help] - -.SH DESCRIPTION -.I configure -is a program used to prepare souce code to be built. It does this by -generating Makefiles and .gdbinit files, creating symlinks, recursing -in subdirectories, and some other miscellaneous file editing. - -.SH OPTIONS -.I configure -accepts the following options: - -.TP -.I \--target=TARGET -Requests that the sources be configured to target the -.I TARGET -machine. If no target is specified explicitly, the target is assumed -to be the same as the host. - -.TP -.I \--srcdir=DIR -tells configure to find the source in -.I DIR. -Object code is always built in the current directory, -.I `.'. - -.TP -.I \--rm -asks configure to remove a configuration rather than create one. - -.TP -.I \--site=SITE -asks configure to use any site-specific Makefile fragments for -.I SITE -when building Makefiles. - -.TP -.I \--prefix=DIR -sets the location in which to install files to -.I DIR. -The default is "/usr/local". - -.TP -.I \--exec_prefix=DIR -sets the root directory for host-dependent files to -.I DIR. -The default location is the value of -.I prefix. - -.TP -.I \--program_prefix=DIR -configures the source to install programs which have the same names as -common Unix programs, such as "make", in -.I DIR. -Also applies to programs which might be used for cross-compilation. - -.TP -.I \--tmpdir=DIR -sets the directory in which configure creates temporary files to -.I DIR. - -.TP -.I \--with-PACKAGE[=YES/NO] -sets a flag for the build to recognize that -.I PACKAGE -is explicitly present or not present. If -.I \=YES/NO -is nonexistent, the default is -.I YES. -.I \--without-PACKAGE -is equivalent to -.IR \--with-PACKAGE=no . - -.TP -.I \--enable-FEATURE[=YES/NO] -sets a flag for the build to recognize that -.I FEATURE -should be included or not included. If -.I \=YES/NO -is nonexistent, the default is -.I YES. -.I \--disable-FEATURE -is equivalent to -.IR --enable-FEATURE=no . - -.TP -.I \--norecursion -asks that only the current directory be configured. Normally -.I configure -recurs on subdirectories. - -.TP -.I \-nfp -Notifies -.I configure -that all of the specified hosts have -.I no floating point -units. - -.TP -.I \-s -used internally by configure to supress status messages on -subdirectory recursions. Override with -.I \-v - -.TP -.I \-v -verbose output. Asks that configure print status lines for each -directory configured. Normally, only the status lines for the current -directory are printed. - -.TP -.I \--version -.I \-V -prints -.I configure -version number. - -.TP -.I \-help -displays a brief usage summary. - - -.SH FILES -configure.in for each directory's individual needs -.br -Makefile.in Makefile template -.br -config.sub for parsing configuration names -.br -config.guess for guessing HOST when not specified -.br -config.status non-recursively rebuilds current directory - -.SH FILES -.ta \w'gmon.sum 'u -a.out the namelist and text space. -.br -gmon.out dynamic call graph and profile. -.br -gmon.sum summarized dynamic call graph and profile. - -.SH "SEE ALSO" -.RB "`\|" configure "\|'" -entry in -.B -info. diff --git a/contrib/binutils/etc/configure.texi b/contrib/binutils/etc/configure.texi deleted file mode 100644 index 91401671f925..000000000000 --- a/contrib/binutils/etc/configure.texi +++ /dev/null @@ -1,2644 +0,0 @@ -\input texinfo -@c %**start of header -@setfilename configure.info -@settitle The GNU configure and build system -@setchapternewpage off -@c %**end of header - -@dircategory GNU admin -@direntry -* configure: (configure). The GNU configure and build system -@end direntry - -@ifinfo -This file documents the GNU configure and build system. - -Copyright (C) 1998 Cygnus Solutions. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph - - -@end ignore -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Foundation. -@end ifinfo - -@titlepage -@title The GNU configure and build system -@author Ian Lance Taylor - -@page -@vskip 0pt plus 1filll -Copyright @copyright{} 1998 Cygnus Solutions - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation -approved by the Free Software Foundation. -@end titlepage - -@ifinfo -@node Top -@top GNU configure and build system - -The GNU configure and build system. - -@menu -* Introduction:: Introduction. -* Getting Started:: Getting Started. -* Files:: Files. -* Configuration Names:: Configuration Names. -* Cross Compilation Tools:: Cross Compilation Tools. -* Canadian Cross:: Canadian Cross. -* Cygnus Configure:: Cygnus Configure. -* Multilibs:: Multilibs. -* FAQ:: Frequently Asked Questions. -* Index:: Index. -@end menu - -@end ifinfo - -@node Introduction -@chapter Introduction - -This document describes the GNU configure and build systems. It -describes how autoconf, automake, libtool, and make fit together. It -also includes a discussion of the older Cygnus configure system. - -This document does not describe in detail how to use each of the tools; -see the respective manuals for that. Instead, it describes which files -the developer must write, which files are machine generated and how they -are generated, and where certain common problems should be addressed. - -@ifnothtml -This document draws on several sources, including the autoconf manual by -David MacKenzie (@pxref{Top, , autoconf overview, autoconf, Autoconf}), -the automake manual by David MacKenzie and Tom Tromey (@pxref{Top, , -automake overview, automake, GNU Automake}), the libtool manual by -Gordon Matzigkeit (@pxref{Top, , libtool overview, libtool, GNU -libtool}), and the Cygnus configure manual by K. Richard Pixley. -@end ifnothtml -@ifhtml -This document draws on several sources, including -@uref{http://www.delorie.com/gnu/docs/autoconf/autoconf_toc.html, the -autoconf manual} by David MacKenzie, -@uref{http://www.delorie.com/gnu/docs/automake/automake_toc.html, the -automake manual} by David MacKenzie and Tom Tromey, -@uref{http://www.delorie.com/gnu/docs/libtool/libtool_toc.html, the -libtool manual} by Gordon Matzigkeit, and the Cygnus configure manual by -K. Richard Pixley. -@end ifhtml - -@menu -* Goals:: Goals. -* Tools:: The tools. -* History:: History. -* Building:: Building. -@end menu - -@node Goals -@section Goals -@cindex goals - -The GNU configure and build system has two main goals. - -The first is to simplify the development of portable programs. The -system permits the developer to concentrate on writing the program, -simplifying many details of portability across Unix and even Windows -systems, and permitting the developer to describe how to build the -program using simple rules rather than complex Makefiles. - -The second is to simplify the building of programs distributed as source -code. All programs are built using a simple, standardized, two step -process. The program builder need not install any special tools in -order to build the program. - -@node Tools -@section Tools - -The GNU configure and build system is comprised of several different -tools. Program developers must build and install all of these tools. - -People who just want to build programs from distributed sources normally -do not need any special tools beyond a Unix shell, a make program, and a -C compiler. - -@table @asis -@item autoconf -provides a general portability framework, based on testing the features -of the host system at build time. -@item automake -a system for describing how to build a program, permitting the developer -to write a simplified @file{Makefile}. -@item libtool -a standardized approach to building shared libraries. -@item gettext -provides a framework for translation of text messages into other -languages; not really discussed in this document. -@item m4 -autoconf requires the GNU version of m4; the standard Unix m4 does not -suffice. -@item perl -automake requires perl. -@end table - -@node History -@section History -@cindex history - -This is a very brief and probably inaccurate history. - -As the number of Unix variants increased during the 1980s, it became -harder to write programs which could run on all variants. While it was -often possible to use @code{#ifdef} to identify particular systems, -developers frequently did not have access to every system, and the -characteristics of some systems changed from version to version. - -By 1992, at least three different approaches had been developed: -@itemize @bullet -@item -The Metaconfig program, by Larry Wall, Harlan Stenn, and Raphael -Manfredi. -@item -The Cygnus configure script, by K. Richard Pixley, and the gcc configure -script, by Richard Stallman. These use essentially the same approach, -and the developers communicated regularly. -@item -The autoconf program, by David MacKenzie. -@end itemize - -The Metaconfig program is still used for Perl and a few other programs. -It is part of the Dist package. I do not know if it is being developed. - -In 1994, David MacKenzie and others modified autoconf to incorporate all -the features of Cygnus configure. Since then, there has been a slow but -steady conversion of GNU programs from Cygnus configure to autoconf. gcc -has been converted, eliminating the gcc configure script. - -GNU autoconf was regularly maintained until late 1996. As of this -writing in June, 1998, it has no public maintainer. - -Most programs are built using the make program, which requires the -developer to write Makefiles describing how to build the programs. -Since most programs are built in pretty much the same way, this led to a -lot of duplication. - -The X Window system is built using the imake tool, which uses a database -of rules to eliminate the duplication. However, building a tool which -was developed using imake requires that the builder have imake -installed, violating one of the goals of the GNU system. - -The new BSD make provides a standard library of Makefile fragments, -which permits developers to write very simple Makefiles. However, this -requires that the builder install the new BSD make program. - -In 1994, David MacKenzie wrote the first version of automake, which -permitted writing a simple build description which was converted into a -Makefile which could be used by the standard make program. In 1995, Tom -Tromey completely rewrote automake in Perl, and he continues to enhance -it. - -Various free packages built libraries, and by around 1995 several -included support to build shared libraries on various platforms. -However, there was no consistent approach. In early 1996, Gordon -Matzigkeit began working on libtool, which provided a standardized -approach to building shared libraries. This was integrated into -automake from the start. - -The development of automake and libtool was driven by the GNITS project, -a group of GNU maintainers who designed standardized tools to help meet -the GNU coding standards. - -@node Building -@section Building - -Most readers of this document should already know how to build a tool by -running @samp{configure} and @samp{make}. This section may serve as a -quick introduction or reminder. - -Building a tool is normally as simple as running @samp{configure} -followed by @samp{make}. You should normally run @samp{configure} from -an empty directory, using some path to refer to the @samp{configure} -script in the source directory. The directory in which you run -@samp{configure} is called the @dfn{object directory}. - -In order to use a object directory which is different from the source -directory, you must be using the GNU version of @samp{make}, which has -the required @samp{VPATH} support. Despite this restriction, using a -different object directory is highly recommended: -@itemize @bullet -@item -It keeps the files generated during the build from cluttering up your -sources. -@item -It permits you to remove the built files by simply removing the entire -build directory. -@item -It permits you to build from the same sources with several sets of -configure options simultaneously. -@end itemize - -If you don't have GNU @samp{make}, you will have to run @samp{configure} -in the source directory. All GNU packages should support this; in -particular, GNU packages should not assume the presence of GNU -@samp{make}. - -After running @samp{configure}, you can build the tools by running -@samp{make}. - -To install the tools, run @samp{make install}. Installing the tools -will copy the programs and any required support files to the -@dfn{installation directory}. The location of the installation -directory is controlled by @samp{configure} options, as described below. - -In the Cygnus tree at present, the info files are built and installed as -a separate step. To build them, run @samp{make info}. To install them, -run @samp{make install-info}. - -All @samp{configure} scripts support a wide variety of options. The -most interesting ones are @samp{--with} and @samp{--enable} options -which are generally specific to particular tools. You can usually use -the @samp{--help} option to get a list of interesting options for a -particular configure script. - -The only generic options you are likely to use are the @samp{--prefix} -and @samp{--exec-prefix} options. These options are used to specify the -installation directory. - -The directory named by the @samp{--prefix} option will hold machine -independent files such as info files. - -The directory named by the @samp{--exec-prefix} option, which is -normally a subdirectory of the @samp{--prefix} directory, will hold -machine dependent files such as executables. - -The default for @samp{--prefix} is @file{/usr/local}. The default for -@samp{--exec-prefix} is the value used for @samp{--prefix}. - -The convention used in Cygnus releases is to use a @samp{--prefix} -option of @file{/usr/cygnus/@var{release}}, where @var{release} is the -name of the release, and to use a @samp{--exec-prefix} option of -@file{/usr/cygnus/@var{release}/H-@var{host}}, where @var{host} is the -configuration name of the host system (@pxref{Configuration Names}). - -Do not use either the source or the object directory as the installation -directory. That will just lead to confusion. - -@node Getting Started -@chapter Getting Started - -To start using the GNU configure and build system with your software -package, you must write three files, and you must run some tools to -manually generate additional files. - -@menu -* Write configure.in:: Write configure.in. -* Write Makefile.am:: Write Makefile.am. -* Write acconfig.h:: Write acconfig.h. -* Generate files:: Generate files. -* Getting Started Example:: Example. -@end menu - -@node Write configure.in -@section Write configure.in -@cindex @file{configure.in}, writing - -You must first write the file @file{configure.in}. This is an autoconf -input file, and the autoconf manual describes in detail what this file -should look like. - -You will write tests in your @file{configure.in} file to check for -conditions that may change from one system to another, such as the -presence of particular header files or functions. - -For example, not all systems support the @samp{gettimeofday} function. -If you want to use the @samp{gettimeofday} function when it is -available, and to use some other function when it is not, you would -check for this by putting @samp{AC_CHECK_FUNCS(gettimeofday)} in -@file{configure.in}. - -When the configure script is run at build time, this will arrange to -define the preprocessor macro @samp{HAVE_GETTIMEOFDAY} to the value 1 if -the @samp{gettimeofday} function is available, and to not define the -macro at all if the function is not available. Your code can then use -@samp{#ifdef} to test whether it is safe to call @samp{gettimeofday}. - -If you have an existing body of code, the @samp{autoscan} program may -help identify potential portability problems, and hence configure tests -that you will want to use. -@ifnothtml -@xref{Invoking autoscan, , , autoconf, the autoconf manual}. -@end ifnothtml -@ifhtml -See @uref{http://www.delorie.com/gnu/docs/autoconf/autoconf_4.html, the -autoscan documentation}. -@end ifhtml - -Another handy tool for an existing body of code is @samp{ifnames}. This -will show you all the preprocessor conditionals that the code already -uses. -@ifnothtml -@xref{Invoking ifnames, , , autoconf, the autoconf manual}. -@end ifnothtml -@ifhtml -See @uref{http://www.delorie.com/gnu/docs/autoconf/autoconf_5.html, the -ifnames documentation}. -@end ifhtml - -Besides the portability tests which are specific to your particular -package, every @file{configure.in} file should contain the following -macros. - -@table @samp -@item AC_INIT -@cindex @samp{AC_INIT} -This macro takes a single argument, which is the name of a file in your -package. For example, @samp{AC_INIT(foo.c)}. - -@item AC_PREREQ(@var{VERSION}) -@cindex @samp{AC_PREREQ} -This macro is optional. It may be used to indicate the version of -@samp{autoconf} that you are using. This will prevent users from -running an earlier version of @samp{autoconf} and perhaps getting an -invalid @file{configure} script. For example, @samp{AC_PREREQ(2.12)}. - -@item AM_INIT_AUTOMAKE -@cindex @samp{AM_INIT_AUTOMAKE} -This macro takes two arguments: the name of the package, and a version -number. For example, @samp{AM_INIT_AUTOMAKE(foo, 1.0)}. (This macro is -not needed if you are not using automake). - -@item AM_CONFIG_HEADER -@cindex @samp{AM_CONFIG_HEADER} -This macro names the header file which will hold the preprocessor macro -definitions at run time. Normally this should be @file{config.h}. Your -sources would then use @samp{#include "config.h"} to include it. - -This macro may optionally name the input file for that header file; by -default, this is @file{config.h.in}, but that file name works poorly on -DOS filesystems. Therefore, it is often better to name it explicitly as -@file{config.in}. - -This is what you should normally put in @file{configure.in}: -@example -AM_CONFIG_HEADER(config.h:config.in) -@end example - -@cindex @samp{AC_CONFIG_HEADER} -(If you are not using automake, use @samp{AC_CONFIG_HEADER} rather than -@samp{AM_CONFIG_HEADER}). - -@item AM_MAINTAINER_MODE -@cindex @samp{AM_MAINTAINER_MODE} -This macro always appears in Cygnus configure scripts. Other programs -may or may not use it. - -If this macro is used, the @samp{--enable-maintainer-mode} option is -required to enable automatic rebuilding of generated files used by the -configure system. This of course requires that developers be aware of, -and use, that option. - -If this macro is not used, then the generated files will always be -rebuilt automatically. This will cause problems if the wrong versions -of autoconf, automake, or others are in the builder's @samp{PATH}. - -(If you are not using automake, you do not need to use this macro). - -@item AC_EXEEXT -@cindex @samp{AC_EXEEXT} -@cindex @samp{AM_EXEEXT} -Either this macro or @samp{AM_EXEEXT} always appears in Cygnus configure -files. Other programs may or may not use one of them. - -This macro looks for the executable suffix used on the host system. On -Unix systems, this is the empty string. On Windows systems, this is -@samp{.exe}. This macro directs automake to use the executable suffix -as appropriate when creating programs. This macro does not take any -arguments. - -The @samp{AC_EXEEXT} form is new, and is part of a Cygnus patch to -autoconf to support compiling with Visual C++. Older programs use -@samp{AM_EXEEXT} instead. - -(Programs which do not use automake use neither @samp{AC_EXEEXT} nor -@samp{AM_EXEEXT}). - -@item AC_PROG_CC -@cindex @samp{AC_PROG_CC} -If you are writing C code, you will normally want to use this macro. It -locates the C compiler to use. It does not take any arguments. - -However, if this @file{configure.in} file is for a library which is to -be compiled by a cross compiler which may not fully work, then you will -not want to use @samp{AC_PROG_CC}. Instead, you will want to use a -variant which does not call the macro @samp{AC_PROG_CC_WORKS}. Examples -can be found in various @file{configure.in} files for libraries that are -compiled with cross compilers, such as libiberty or libgloss. This is -essentially a bug in autoconf, and there will probably be a better -workaround at some point. - -@item AC_PROG_CXX -@cindex @samp{AC_PROG_CXX} -If you are writing C++ code, you will want to use this macro. It -locates the C++ compiler to use. It does not take any arguments. The -same cross compiler comments apply as for @samp{AC_PROG_CC}. - -@item AM_PROG_LIBTOOL -@cindex @samp{AM_PROG_LIBTOOL} -If you want to build libraries, and you want to permit them to be -shared, or you want to link against libraries which were built using -libtool, then you will need this macro. This macro is required in order -to use libtool. - -@cindex @samp{AM_DISABLE_SHARED} -By default, this will cause all libraries to be built as shared -libraries. To prevent this--to change the default--use -@samp{AM_DISABLE_SHARED} before @samp{AM_PROG_LIBTOOL}. The configure -options @samp{--enable-shared} and @samp{--disable-shared} may be used -to override the default at build time. - -@item AC_DEFINE(_GNU_SOURCE) -@cindex @samp{_GNU_SOURCE} -GNU packages should normally include this line before any other feature -tests. This defines the macro @samp{_GNU_SOURCE} when compiling, which -directs the libc header files to provide the standard GNU system -interfaces including all GNU extensions. If this macro is not defined, -certain GNU extensions may not be available. - -@item AC_OUTPUT -@cindex @samp{AC_OUTPUT} -This macro takes a list of file names which the configure process should -produce. This is normally a list of one or more @file{Makefile} files -in different directories. If your package lives entirely in a single -directory, you would use simply @samp{AC_OUTPUT(Makefile)}. If you also -have, for example, a @file{lib} subdirectory, you would use -@samp{AC_OUTPUT(Makefile lib/Makefile)}. -@end table - -If you want to use locally defined macros in your @file{configure.in} -file, then you will need to write a @file{acinclude.m4} file which -defines them (if not using automake, this file is called -@file{aclocal.m4}). Alternatively, you can put separate macros in an -@file{m4} subdirectory, and put @samp{ACLOCAL_AMFLAGS = -I m4} in your -@file{Makefile.am} file so that the @samp{aclocal} program will be able -to find them. - -The different macro prefixes indicate which tool defines the macro. -Macros which start with @samp{AC_} are part of autoconf. Macros which -start with @samp{AM_} are provided by automake or libtool. - -@node Write Makefile.am -@section Write Makefile.am -@cindex @file{Makefile.am}, writing - -You must write the file @file{Makefile.am}. This is an automake input -file, and the automake manual describes in detail what this file should -look like. - -The automake commands in @file{Makefile.am} mostly look like variable -assignments in a @file{Makefile}. automake recognizes special variable -names, and automatically add make rules to the output as needed. - -There will be one @file{Makefile.am} file for each directory in your -package. For each directory with subdirectories, the @file{Makefile.am} -file should contain the line -@smallexample -SUBDIRS = @var{dir} @var{dir} @dots{} -@end smallexample -@noindent -where each @var{dir} is the name of a subdirectory. - -For each @file{Makefile.am}, there should be a corresponding -@file{Makefile} in the @samp{AC_OUTPUT} macro in @file{configure.in}. - -Every @file{Makefile.am} written at Cygnus should contain the line -@smallexample -AUTOMAKE_OPTIONS = cygnus -@end smallexample -@noindent -This puts automake into Cygnus mode. See the automake manual for -details. - -You may to include the version number of @samp{automake} that you are -using on the @samp{AUTOMAKE_OPTIONS} line. For example, -@smallexample -AUTOMAKE_OPTIONS = cygnus 1.3 -@end smallexample -@noindent -This will prevent users from running an earlier version of -@samp{automake} and perhaps getting an invalid @file{Makefile.in}. - -If your package builds a program, then in the directory where that -program is built you will normally want a line like -@smallexample -bin_PROGRAMS = @var{program} -@end smallexample -@noindent -where @var{program} is the name of the program. You will then want a -line like -@smallexample -@var{program}_SOURCES = @var{file} @var{file} @dots{} -@end smallexample -@noindent -where each @var{file} is the name of a source file to link into the -program (e.g., @samp{foo.c}). - -If your package builds a library, and you do not want the library to -ever be built as a shared library, then in the directory where that -library is built you will normally want a line like -@smallexample -lib_LIBRARIES = lib@var{name}.a -@end smallexample -@noindent -where @samp{lib@var{name}.a} is the name of the library. You will then -want a line like -@smallexample -lib@var{name}_a_SOURCES = @var{file} @var{file} @dots{} -@end smallexample -@noindent -where each @var{file} is the name of a source file to add to the -library. - -If your package builds a library, and you want to permit building the -library as a shared library, then in the directory where that library is -built you will normally want a line like -@smallexample -lib_LTLIBRARIES = lib@var{name}.la -@end smallexample -The use of @samp{LTLIBRARIES}, and the @samp{.la} extension, indicate a -library to be built using libtool. As usual, you will then want a line -like -@smallexample -lib@var{name}_la_SOURCES = @var{file} @var{file} @dots{} -@end smallexample - -The strings @samp{bin} and @samp{lib} that appear above in -@samp{bin_PROGRAMS} and @samp{lib_LIBRARIES} are not arbitrary. They -refer to particular directories, which may be set by the @samp{--bindir} -and @samp{--libdir} options to @file{configure}. If those options are -not used, the default values are based on the @samp{--prefix} or -@samp{--exec-prefix} options to @file{configure}. It is possible to use -other names if the program or library should be installed in some other -directory. - -The @file{Makefile.am} file may also contain almost anything that may -appear in a normal @file{Makefile}. automake also supports many other -special variables, as well as conditionals. - -See the automake manual for more information. - -@node Write acconfig.h -@section Write acconfig.h -@cindex @file{acconfig.h}, writing - -If you are generating a portability header file, (i.e., you are using -@samp{AM_CONFIG_HEADER} in @file{configure.in}), then you will have to -write a @file{acconfig.h} file. It will have to contain the following -lines. - -@smallexample -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION -@end smallexample - -This requirement is really a bug in the system, and the requirement may -be eliminated at some later date. - -The @file{acconfig.h} file will also similar comment and @samp{#undef} -lines for any unusual macros in the @file{configure.in} file, including -any macro which appears in a @samp{AC_DEFINE} macro. - -In particular, if you are writing a GNU package and therefore include -@samp{AC_DEFINE(_GNU_SOURCE)} in @file{configure.in} as suggested above, -you will need lines like this in @file{acconfig.h}: -@smallexample -/* Enable GNU extensions. */ -#undef _GNU_SOURCE -@end smallexample - -Normally the @samp{autoheader} program will inform you of any such -requirements by printing an error message when it is run. However, if -you do anything particular odd in your @file{configure.in} file, you -will have to make sure that the right entries appear in -@file{acconfig.h}, since otherwise the results of the tests may not be -available in the @file{config.h} file which your code will use. - -(Thee @samp{PACKAGE} and @samp{VERSION} lines are not required if you -are not using automake, and in that case you may not need a -@file{acconfig.h} file at all). - -@node Generate files -@section Generate files - -Once you have written @file{configure.in}, @file{Makefile.am}, -@file{acconfig.h}, and possibly @file{acinclude.m4}, you must use -autoconf and automake programs to produce the first versions of the -generated files. This is done by executing the following sequence of -commands. - -@smallexample -aclocal -autoconf -autoheader -automake -@end smallexample - -The @samp{aclocal} and @samp{automake} commands are part of the automake -package, and the @samp{autoconf} and @samp{autoheader} commands are part -of the autoconf package. - -If you are using a @file{m4} subdirectory for your macros, you will need -to use the @samp{-I m4} option when you run @samp{aclocal}. - -If you are not using the Cygnus tree, use the @samp{-a} option when -running @samp{automake} command in order to copy the required support -files into your source directory. - -If you are using libtool, you must build and install the libtool package -with the same @samp{--prefix} and @samp{--exec-prefix} options as you -used with the autoconf and automake packages. You must do this before -running any of the above commands. If you are not using the Cygnus -tree, you will need to run the @samp{libtoolize} program to copy the -libtool support files into your directory. - -Once you have managed to run these commands without getting any errors, -you should create a new empty directory, and run the @samp{configure} -script which will have been created by @samp{autoconf} with the -@samp{--enable-maintainer-mode} option. This will give you a set of -Makefiles which will include rules to automatically rebuild all the -generated files. - -After doing that, whenever you have changed some of the input files and -want to regenerated the other files, go to your object directory and run -@samp{make}. Doing this is more reliable than trying to rebuild the -files manually, because there are complex order dependencies and it is -easy to forget something. - -@node Getting Started Example -@section Example - -Let's consider a trivial example. - -Suppose we want to write a simple version of @samp{touch}. Our program, -which we will call @samp{poke}, will take a single file name argument, -and use the @samp{utime} system call to set the modification and access -times of the file to the current time. We want this program to be -highly portable. - -We'll first see what this looks like without using autoconf and -automake, and then see what it looks like with them. - -@menu -* Getting Started Example 1:: First Try. -* Getting Started Example 2:: Second Try. -* Getting Started Example 3:: Third Try. -* Generate Files in Example:: Generate Files. -@end menu - -@node Getting Started Example 1 -@subsection First Try - -Here is our first try at @samp{poke.c}. Note that we've written it -without ANSI/ISO C prototypes, since we want it to be highly portable. - -@example -#include <stdio.h> -#include <stdlib.h> -#include <sys/types.h> -#include <utime.h> - -int -main (argc, argv) - int argc; - char **argv; -@{ - if (argc != 2) - @{ - fprintf (stderr, "Usage: poke file\n"); - exit (1); - @} - - if (utime (argv[1], NULL) < 0) - @{ - perror ("utime"); - exit (1); - @} - - exit (0); -@} -@end example - -We also write a simple @file{Makefile}. - -@example -CC = gcc -CFLAGS = -g -O2 - -all: poke - -poke: poke.o - $(CC) -o poke $(CFLAGS) $(LDFLAGS) poke.o -@end example - -So far, so good. - -Unfortunately, there are a few problems. - -On older Unix systems derived from BSD 4.3, the @samp{utime} system call -does not accept a second argument of @samp{NULL}. On those systems, we -need to pass a pointer to @samp{struct utimbuf} structure. -Unfortunately, even older systems don't define that structure; on those -systems, we need to pass an array of two @samp{long} values. - -The header file @file{stdlib.h} was invented by ANSI C, and older -systems don't have a copy. We included it above to get a declaration of -@samp{exit}. - -We can find some of these portability problems by running -@samp{autoscan}, which will create a @file{configure.scan} file which we -can use as a prototype for our @file{configure.in} file. I won't show -the output, but it will notice the potential problems with @samp{utime} -and @file{stdlib.h}. - -In our @file{Makefile}, we don't provide any way to install the program. -This doesn't matter much for such a simple example, but a real program -will need an @samp{install} target. For that matter, we will also want -a @samp{clean} target. - -@node Getting Started Example 2 -@subsection Second Try - -Here is our second try at this program. - -We modify @file{poke.c} to use preprocessor macros to control what -features are available. (I've cheated a bit by using the same macro -names which autoconf will use). - -@example -#include <stdio.h> - -#ifdef STDC_HEADERS -#include <stdlib.h> -#endif - -#include <sys/types.h> - -#ifdef HAVE_UTIME_H -#include <utime.h> -#endif - -#ifndef HAVE_UTIME_NULL - -#include <time.h> - -#ifndef HAVE_STRUCT_UTIMBUF - -struct utimbuf -@{ - long actime; - long modtime; -@}; - -#endif - -static int -utime_now (file) - char *file; -@{ - struct utimbuf now; - - now.actime = now.modtime = time (NULL); - return utime (file, &now); -@} - -#define utime(f, p) utime_now (f) - -#endif /* HAVE_UTIME_NULL */ - -int -main (argc, argv) - int argc; - char **argv; -@{ - if (argc != 2) - @{ - fprintf (stderr, "Usage: poke file\n"); - exit (1); - @} - - if (utime (argv[1], NULL) < 0) - @{ - perror ("utime"); - exit (1); - @} - - exit (0); -@} -@end example - -Here is the associated @file{Makefile}. We've added support for the -preprocessor flags we use. We've also added @samp{install} and -@samp{clean} targets. - -@example -# Set this to your installation directory. -bindir = /usr/local/bin - -# Uncomment this if you have the standard ANSI/ISO C header files. -# STDC_HDRS = -DSTDC_HEADERS - -# Uncomment this if you have utime.h. -# UTIME_H = -DHAVE_UTIME_H - -# Uncomment this if utime (FILE, NULL) works on your system. -# UTIME_NULL = -DHAVE_UTIME_NULL - -# Uncomment this if struct utimbuf is defined in utime.h. -# UTIMBUF = -DHAVE_STRUCT_UTIMBUF - -CC = gcc -CFLAGS = -g -O2 - -ALL_CFLAGS = $(STDC_HDRS) $(UTIME_H) $(UTIME_NULL) $(UTIMBUF) $(CFLAGS) - -all: poke - -poke: poke.o - $(CC) -o poke $(ALL_CFLAGS) $(LDFLAGS) poke.o - -.c.o: - $(CC) -c $(ALL_CFLAGS) poke.c - -install: poke - cp poke $(bindir)/poke - -clean: - rm poke poke.o -@end example - -Some problems with this approach should be clear. - -Users who want to compile poke will have to know how @samp{utime} works -on their systems, so that they can uncomment the @file{Makefile} -correctly. - -The installation is done using @samp{cp}, but many systems have an -@samp{install} program which may be used, and which supports optional -features such as stripping debugging information out of the installed -binary. - -The use of @file{Makefile} variables like @samp{CC}, @samp{CFLAGS} and -@samp{LDFLAGS} follows the requirements of the GNU standards. This is -convenient for all packages, since it reduces surprises for users. -However, it is easy to get the details wrong, and wind up with a -slightly nonstandard distribution. - -@node Getting Started Example 3 -@subsection Third Try - -For our third try at this program, we will write a @file{configure.in} -script to discover the configuration features on the host system, rather -than requiring the user to edit the @file{Makefile}. We will also write -a @file{Makefile.am} rather than a @file{Makefile}. - -The only change to @file{poke.c} is to add a line at the start of the -file: -@smallexample -#include "config.h" -@end smallexample - -The new @file{configure.in} file is as follows. - -@example -AC_INIT(poke.c) -AM_INIT_AUTOMAKE(poke, 1.0) -AM_CONFIG_HEADER(config.h:config.in) -AC_PROG_CC -AC_HEADER_STDC -AC_CHECK_HEADERS(utime.h) -AC_EGREP_HEADER(utimbuf, utime.h, AC_DEFINE(HAVE_STRUCT_UTIMBUF)) -AC_FUNC_UTIME_NULL -AC_OUTPUT(Makefile) -@end example - -The first four macros in this file, and the last one, were described -above; see @ref{Write configure.in}. If we omit these macros, then when -we run @samp{automake} we will get a reminder that we need them. - -The other macros are standard autoconf macros. - -@table @samp -@item AC_HEADER_STDC -Check for standard C headers. -@item AC_CHECK_HEADERS -Check whether a particular header file exists. -@item AC_EGREP_HEADER -Check for a particular string in a particular header file, in this case -checking for @samp{utimbuf} in @file{utime.h}. -@item AC_FUNC_UTIME_NULL -Check whether @samp{utime} accepts a NULL second argument to set the -file change time to the current time. -@end table - -See the autoconf manual for a more complete description. - -The new @file{Makefile.am} file is as follows. Note how simple this is -compared to our earlier @file{Makefile}. - -@example -bin_PROGRAMS = poke - -poke_SOURCES = poke.c -@end example - -This means that we should build a single program name @samp{poke}. It -should be installed in the binary directory, which we called -@samp{bindir} earlier. The program @samp{poke} is built from the source -file @file{poke.c}. - -We must also write a @file{acconfig.h} file. Besides @samp{PACKAGE} and -@samp{VERSION}, which must be mentioned for all packages which use -automake, we must include @samp{HAVE_STRUCT_UTIMBUF}, since we mentioned -it in an @samp{AC_DEFINE}. - -@example -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION - -/* Whether utime.h defines struct utimbuf. */ -#undef HAVE_STRUCT_UTIMBUF -@end example - -@node Generate Files in Example -@subsection Generate Files - -We must now generate the other files, using the following commands. - -@smallexample -aclocal -autoconf -autoheader -automake -@end smallexample - -When we run @samp{autoheader}, it will remind us of any macros we forgot -to add to @file{acconfig.h}. - -When we run @samp{automake}, it will want to add some files to our -distribution. It will add them automatically if we use the -@samp{--add-missing} option. - -By default, @samp{automake} will run in GNU mode, which means that it -will want us to create certain additional files; as of this writing, it -will want @file{NEWS}, @file{README}, @file{AUTHORS}, and -@file{ChangeLog}, all of which are files which should appear in a -standard GNU distribution. We can either add those files, or run -@samp{automake} with the @samp{--foreign} option. - -Running these tools will generate the following files, all of which are -described in the next chapter. - -@itemize @bullet -@item -@file{aclocal.m4} -@item -@file{configure} -@item -@file{config.in} -@item -@file{Makefile.in} -@item -@file{stamp-h.in} -@end itemize - -@node Files -@chapter Files - -As was seen in the previous chapter, the GNU configure and build system -uses a number of different files. The developer must write a few files. -The others are generated by various tools. - -The system is rather flexible, and can be used in many different ways. -In describing the files that it uses, I will describe the common case, -and mention some other cases that may arise. - -@menu -* Developer Files:: Developer Files. -* Build Files:: Build Files. -* Support Files:: Support Files. -@end menu - -@node Developer Files -@section Developer Files - -This section describes the files written or generated by the developer -of a package. - -@menu -* Developer Files Picture:: Developer Files Picture. -* Written Developer Files:: Written Developer Files. -* Generated Developer Files:: Generated Developer Files. -@end menu - -@node Developer Files Picture -@subsection Developer Files Picture - -Here is a picture of the files which are written by the developer, the -generated files which would be included with a complete source -distribution, and the tools which create those files. -@ifinfo -The file names are plain text and the tool names are enclosed by -@samp{*} characters -@end ifinfo -@ifnotinfo -The file names are in rectangles with square corners and the tool names -are in rectangles with rounded corners -@end ifnotinfo -(e.g., @samp{autoheader} is the name of a tool, not the name of a file). - -@image{configdev} - -@node Written Developer Files -@subsection Written Developer Files - -The following files would be written by the developer. - -@table @file -@item configure.in -@cindex @file{configure.in} -This is the configuration script. This script contains invocations of -autoconf macros. It may also contain ordinary shell script code. This -file will contain feature tests for portability issues. The last thing -in the file will normally be an @samp{AC_OUTPUT} macro listing which -files to create when the builder runs the configure script. This file -is always required when using the GNU configure system. @xref{Write -configure.in}. - -@item Makefile.am -@cindex @file{Makefile.am} -This is the automake input file. It describes how the code should be -built. It consists of definitions of automake variables. It may also -contain ordinary Makefile targets. This file is only needed when using -automake (newer tools normally use automake, but there are still older -tools which have not been converted, in which the developer writes -@file{Makefile.in} directly). @xref{Write Makefile.am}. - -@item acconfig.h -@cindex @file{acconfig.h} -When the configure script creates a portability header file, by using -@samp{AM_CONFIG_HEADER} (or, if not using automake, -@samp{AC_CONFIG_HEADER}), this file is used to describe macros which are -not recognized by the @samp{autoheader} command. This is normally a -fairly uninteresting file, consisting of a collection of @samp{#undef} -lines with comments. Normally any call to @samp{AC_DEFINE} in -@file{configure.in} will require a line in this file. @xref{Write -acconfig.h}. - -@item acinclude.m4 -@cindex @file{acinclude.m4} -This file is not always required. It defines local autoconf macros. -These macros may then be used in @file{configure.in}. If you don't need -any local autoconf macros, then you don't need this file at all. In -fact, in general, you never need local autoconf macros, since you can -put everything in @file{configure.in}, but sometimes a local macro is -convenient. - -Newer tools may omit @file{acinclude.m4}, and instead use a -subdirectory, typically named @file{m4}, and define -@samp{ACLOCAL_AMFLAGS = -I m4} in @file{Makefile.am} to force -@samp{aclocal} to look there for macro definitions. The macro -definitions are then placed in separate files in that directory. - -The @file{acinclude.m4} file is only used when using automake; in older -tools, the developer writes @file{aclocal.m4} directly, if it is needed. -@end table - -@node Generated Developer Files -@subsection Generated Developer Files - -The following files would be generated by the developer. - -When using automake, these files are normally not generated manually -after the first time. Instead, the generated @file{Makefile} contains -rules to automatically rebuild the files as required. When -@samp{AM_MAINTAINER_MODE} is used in @file{configure.in} (the normal -case in Cygnus code), the automatic rebuilding rules will only be -defined if you configure using the @samp{--enable-maintainer-mode} -option. - -When using automatic rebuilding, it is important to ensure that all the -various tools have been built and installed on your @samp{PATH}. Using -automatic rebuilding is highly recommended, so much so that I'm not -going to explain what you have to do if you don't use it. - -@table @file -@item configure -@cindex @file{configure} -This is the configure script which will be run when building the -package. This is generated by @samp{autoconf} from @file{configure.in} -and @file{aclocal.m4}. This is a shell script. - -@item Makefile.in -@cindex @file{Makefile.in} -This is the file which the configure script will turn into the -@file{Makefile} at build time. This file is generated by -@samp{automake} from @file{Makefile.am}. If you aren't using automake, -you must write this file yourself. This file is pretty much a normal -@file{Makefile}, with some configure substitutions for certain -variables. - -@item aclocal.m4 -@cindex @file{aclocal.m4} -This file is created by the @samp{aclocal} program, based on the -contents of @file{configure.in} and @file{acinclude.m4} (or, as noted in -the description of @file{acinclude.m4} above, on the contents of an -@file{m4} subdirectory). This file contains definitions of autoconf -macros which @samp{autoconf} will use when generating the file -@file{configure}. These autoconf macros may be defined by you in -@file{acinclude.m4} or they may be defined by other packages such as -automake, libtool or gettext. If you aren't using automake, you will -normally write this file yourself; in that case, if @file{configure.in} -uses only standard autoconf macros, this file will not be needed at all. - -@item config.in -@cindex @file{config.in} -@cindex @file{config.h.in} -This file is created by @samp{autoheader} based on @file{acconfig.h} and -@file{configure.in}. At build time, the configure script will define -some of the macros in it to create @file{config.h}, which may then be -included by your program. This permits your C code to use preprocessor -conditionals to change its behaviour based on the characteristics of the -host system. This file may also be called @file{config.h.in}. - -@item stamp.h-in -@cindex @file{stamp-h.in} -This rather uninteresting file, which I omitted from the picture, is -generated by @samp{automake}. It always contains the string -@samp{timestamp}. It is used as a timestamp file indicating whether -@file{config.in} is up to date. Using a timestamp file means that -@file{config.in} can be marked as up to date without actually changing -its modification time. This is useful since @file{config.in} depends -upon @file{configure.in}, but it is easy to change @file{configure.in} -in a way which does not affect @file{config.in}. -@end table - -@node Build Files -@section Build Files - -This section describes the files which are created at configure and -build time. These are the files which somebody who builds the package -will see. - -Of course, the developer will also build the package. The distinction -between developer files and build files is not that the developer does -not see the build files, but that somebody who only builds the package -does not have to worry about the developer files. - -@menu -* Build Files Picture:: Build Files Picture. -* Build Files Description:: Build Files Description. -@end menu - -@node Build Files Picture -@subsection Build Files Picture - -Here is a picture of the files which will be created at build time. -@file{config.status} is both a created file and a shell script which is -run to create other files, and the picture attempts to show that. - -@image{configbuild} - -@node Build Files Description -@subsection Build Files Description - -This is a description of the files which are created at build time. - -@table @file -@item config.status -@cindex @file{config.status} -The first step in building a package is to run the @file{configure} -script. The @file{configure} script will create the file -@file{config.status}, which is itself a shell script. When you first -run @file{configure}, it will automatically run @file{config.status}. -An @file{Makefile} derived from an automake generated @file{Makefile.in} -will contain rules to automatically run @file{config.status} again when -necessary to recreate certain files if their inputs change. - -@item Makefile -@cindex @file{Makefile} -This is the file which make will read to build the program. The -@file{config.status} script will transform @file{Makefile.in} into -@file{Makefile}. - -@item config.h -@cindex @file{config.h} -This file defines C preprocessor macros which C code can use to adjust -its behaviour on different systems. The @file{config.status} script -will transform @file{config.in} into @file{config.h}. - -@item config.cache -@cindex @file{config.cache} -This file did not fit neatly into the picture, and I omitted it. It is -used by the @file{configure} script to cache results between runs. This -can be an important speedup. If you modify @file{configure.in} in such -a way that the results of old tests should change (perhaps you have -added a new library to @samp{LDFLAGS}), then you will have to remove -@file{config.cache} to force the tests to be rerun. - -The autoconf manual explains how to set up a site specific cache file. -This can speed up running @file{configure} scripts on your system. - -@item stamp.h -@cindex @file{stamp-h} -This file, which I omitted from the picture, is similar to -@file{stamp-h.in}. It is used as a timestamp file indicating whether -@file{config.h} is up to date. This is useful since @file{config.h} -depends upon @file{config.status}, but it is easy for -@file{config.status} to change in a way which does not affect -@file{config.h}. -@end table - -@node Support Files -@section Support Files - -The GNU configure and build system requires several support files to be -included with your distribution. You do not normally need to concern -yourself with these. If you are using the Cygnus tree, most are already -present. Otherwise, they will be installed with your source by -@samp{automake} (with the @samp{--add-missing} option) and -@samp{libtoolize}. - -You don't have to put the support files in the top level directory. You -can put them in a subdirectory, and use the @samp{AC_CONFIG_AUX_DIR} -macro in @file{configure.in} to tell @samp{automake} and the -@file{configure} script where they are. - -In this section, I describe the support files, so that you can know what -they are and why they are there. - -@table @file -@item ABOUT-NLS -Added by automake if you are using gettext. This is a documentation -file about the gettext project. -@item ansi2knr.c -Used by an automake generated @file{Makefile} if you put @samp{ansi2knr} -in @samp{AUTOMAKE_OPTIONS} in @file{Makefile.am}. This permits -compiling ANSI C code with a K&R C compiler. -@item ansi2knr.1 -The man page which goes with @file{ansi2knr.c}. -@item config.guess -A shell script which determines the configuration name for the system on -which it is run. -@item config.sub -A shell script which canonicalizes a configuration name entered by a -user. -@item elisp-comp -Used to compile Emacs LISP files. -@item install-sh -A shell script which installs a program. This is used if the configure -script can not find an install binary. -@item ltconfig -Used by libtool. This is a shell script which configures libtool for -the particular system on which it is used. -@item ltmain.sh -Used by libtool. This is the actual libtool script which is used, after -it is configured by @file{ltconfig} to build a library. -@item mdate-sh -A shell script used by an automake generated @file{Makefile} to pretty -print the modification time of a file. This is used to maintain version -numbers for texinfo files. -@item missing -A shell script used if some tool is missing entirely. This is used by -an automake generated @file{Makefile} to avoid certain sorts of -timestamp problems. -@item mkinstalldirs -A shell script which creates a directory, including all parent -directories. This is used by an automake generated @file{Makefile} -during installation. -@item texinfo.tex -Required if you have any texinfo files. This is used when converting -Texinfo files into DVI using @samp{texi2dvi} and @TeX{}. -@item ylwrap -A shell script used by an automake generated @file{Makefile} to run -programs like @samp{bison}, @samp{yacc}, @samp{flex}, and @samp{lex}. -These programs default to producing output files with a fixed name, and -the @file{ylwrap} script runs them in a subdirectory to avoid file name -conflicts when using a parallel make program. -@end table - -@node Configuration Names -@chapter Configuration Names -@cindex configuration names -@cindex configuration triplets -@cindex triplets -@cindex host names -@cindex host triplets -@cindex canonical system names -@cindex system names -@cindex system types - -The GNU configure system names all systems using a @dfn{configuration -name}. All such names used to be triplets (they may now contain four -parts in certain cases), and the term @dfn{configuration triplet} is -still seen. - -@menu -* Configuration Name Definition:: Configuration Name Definition. -* Using Configuration Names:: Using Configuration Names. -@end menu - -@node Configuration Name Definition -@section Configuration Name Definition - -This is a string of the form -@var{cpu}-@var{manufacturer}-@var{operating_system}. In some cases, -this is extended to a four part form: -@var{cpu}-@var{manufacturer}-@var{kernel}-@var{operating_system}. - -When using a configuration name in a configure option, it is normally -not necessary to specify an entire name. In particular, the -@var{manufacturer} field is often omitted, leading to strings such as -@samp{i386-linux} or @samp{sparc-sunos}. The shell script -@file{config.sub} will translate these shortened strings into the -canonical form. autoconf will arrange for @file{config.sub} to be run -automatically when it is needed. - -The fields of a configuration name are as follows: - -@table @var -@item cpu -The type of processor. This is typically something like @samp{i386} or -@samp{sparc}. More specific variants are used as well, such as -@samp{mipsel} to indicate a little endian MIPS processor. -@item manufacturer -A somewhat freeform field which indicates the manufacturer of the -system. This is often simply @samp{unknown}. Other common strings are -@samp{pc} for an IBM PC compatible system, or the name of a workstation -vendor, such as @samp{sun}. -@item operating_system -The name of the operating system which is run on the system. This will -be something like @samp{solaris2.5} or @samp{irix6.3}. There is no -particular restriction on the version number, and strings like -@samp{aix4.1.4.0} are seen. For an embedded system, which has no -operating system, this field normally indicates the type of object file -format, such as @samp{elf} or @samp{coff}. -@item kernel -This is used mainly for GNU/Linux. A typical GNU/Linux configuration -name is @samp{i586-pc-linux-gnulibc1}. In this case the kernel, -@samp{linux}, is separated from the operating system, @samp{gnulibc1}. -@end table - -The shell script @file{config.guess} will normally print the correct -configuration name for the system on which it is run. It does by -running @samp{uname} and by examining other characteristics of the -system. - -Because @file{config.guess} can normally determine the configuration -name for a machine, it is normally only necessary to specify a -configuration name when building a cross-compiler or when building using -a cross-compiler. - -@node Using Configuration Names -@section Using Configuration Names - -A configure script will sometimes have to make a decision based on a -configuration name. You will need to do this if you have to compile -code differently based on something which can not be tested using a -standard autoconf feature test. - -It is normally better to test for particular features, rather than to -test for a particular system. This is because as Unix evolves, -different systems copy features from one another. Even if you need to -determine whether the feature is supported based on a configuration -name, you should define a macro which describes the feature, rather than -defining a macro which describes the particular system you are on. - -Testing for a particular system is normally done using a case statement -in @file{configure.in}. The case statement might look something like -the following, assuming that @samp{host} is a shell variable holding a -canonical configuration name (which will be the case if -@file{configure.in} uses the @samp{AC_CANONICAL_HOST} or -@samp{AC_CANONICAL_SYSTEM} macro). - -@smallexample -case "$@{host@}" in -i[3456]86-*-linux-gnu*) do something ;; -sparc*-sun-solaris2.[56789]*) do something ;; -sparc*-sun-solaris*) do something ;; -mips*-*-elf*) do something ;; -esac -@end smallexample - -It is particularly important to use @samp{*} after the operating system -field, in order to match the version number which will be generated by -@file{config.guess}. - -In most cases you must be careful to match a range of processor types. -For most processor families, a trailing @samp{*} suffices, as in -@samp{mips*} above. For the i386 family, something along the lines of -@samp{i[3456]86} suffices at present. For the m68k family, you will -need something like @samp{m68*}. Of course, if you do not need to match -on the processor, it is simpler to just replace the entire field by a -@samp{*}, as in @samp{*-*-irix*}. - -@node Cross Compilation Tools -@chapter Cross Compilation Tools -@cindex cross tools - -The GNU configure and build system can be used to build @dfn{cross -compilation} tools. A cross compilation tool is a tool which runs on -one system and produces code which runs on another system. - -@menu -* Cross Compilation Concepts:: Cross Compilation Concepts. -* Host and Target:: Host and Target. -* Using the Host Type:: Using the Host Type. -* Specifying the Target:: Specifying the Target. -* Using the Target Type:: Using the Target Type. -* Cross Tools in the Cygnus Tree:: Cross Tools in the Cygnus Tree -@end menu - -@node Cross Compilation Concepts -@section Cross Compilation Concepts - -@cindex cross compiler -A compiler which produces programs which run on a different system is a -cross compilation compiler, or simply a @dfn{cross compiler}. -Similarly, we speak of cross assemblers, cross linkers, etc. - -In the normal case, a compiler produces code which runs on the same -system as the one on which the compiler runs. When it is necessary to -distinguish this case from the cross compilation case, such a compiler -is called a @dfn{native compiler}. Similarly, we speak of native -assemblers, etc. - -Although the debugger is not strictly speaking a compilation tool, it is -nevertheless meaningful to speak of a cross debugger: a debugger which -is used to debug code which runs on another system. Everything that is -said below about configuring cross compilation tools applies to the -debugger as well. - -@node Host and Target -@section Host and Target -@cindex host system -@cindex target system - -When building cross compilation tools, there are two different systems -involved: the system on which the tools will run, and the system for -which the tools generate code. - -The system on which the tools will run is called the @dfn{host} system. - -The system for which the tools generate code is called the @dfn{target} -system. - -For example, suppose you have a compiler which runs on a GNU/Linux -system and generates ELF programs for a MIPS embedded system. In this -case the GNU/Linux system is the host, and the MIPS ELF system is the -target. Such a compiler could be called a GNU/Linux cross MIPS ELF -compiler, or, equivalently, a @samp{i386-linux-gnu} cross -@samp{mips-elf} compiler. - -Naturally, most programs are not cross compilation tools. For those -programs, it does not make sense to speak of a target. It only makes -sense to speak of a target for tools like @samp{gcc} or the -@samp{binutils} which actually produce running code. For example, it -does not make sense to speak of the target of a tool like @samp{bison} -or @samp{make}. - -Most cross compilation tools can also serve as native tools. For a -native compilation tool, it is still meaningful to speak of a target. -For a native tool, the target is the same as the host. For example, for -a GNU/Linux native compiler, the host is GNU/Linux, and the target is -also GNU/Linux. - -@node Using the Host Type -@section Using the Host Type - -In almost all cases the host system is the system on which you run the -@samp{configure} script, and on which you build the tools (for the case -when they differ, @pxref{Canadian Cross}). - -@cindex @samp{AC_CANONICAL_HOST} -If your configure script needs to know the configuration name of the -host system, and the package is not a cross compilation tool and -therefore does not have a target, put @samp{AC_CANONICAL_HOST} in -@file{configure.in}. This macro will arrange to define a few shell -variables when the @samp{configure} script is run. - -@table @samp -@item host -The canonical configuration name of the host. This will normally be -determined by running the @file{config.guess} shell script, although the -user is permitted to override this by using an explicit @samp{--host} -option. -@item host_alias -In the unusual case that the user used an explicit @samp{--host} option, -this will be the argument to @samp{--host}. In the normal case, this -will be the same as the @samp{host} variable. -@item host_cpu -@itemx host_vendor -@itemx host_os -The first three parts of the canonical configuration name. -@end table - -The shell variables may be used by putting shell code in -@file{configure.in}. For an example, see @ref{Using Configuration -Names}. - -@node Specifying the Target -@section Specifying the Target - -By default, the @samp{configure} script will assume that the target is -the same as the host. This is the more common case; for example, it -leads to a native compiler rather than a cross compiler. - -@cindex @samp{--target} option -@cindex target option -@cindex configure target -If you want to build a cross compilation tool, you must specify the -target explicitly by using the @samp{--target} option when you run -@samp{configure}. The argument to @samp{--target} is the configuration -name of the system for which you wish to generate code. -@xref{Configuration Names}. - -For example, to build tools which generate code for a MIPS ELF embedded -system, you would use @samp{--target mips-elf}. - -@node Using the Target Type -@section Using the Target Type - -@cindex @samp{AC_CANONICAL_SYSTEM} -When writing @file{configure.in} for a cross compilation tool, you will -need to use information about the target. To do this, put -@samp{AC_CANONICAL_SYSTEM} in @file{configure.in}. - -@samp{AC_CANONICAL_SYSTEM} will look for a @samp{--target} option and -canonicalize it using the @file{config.sub} shell script. It will also -run @samp{AC_CANONICAL_HOST} (@pxref{Using the Host Type}). - -The target type will be recorded in the following shell variables. Note -that the host versions of these variables will also be defined by -@samp{AC_CANONICAL_HOST}. - -@table @samp -@item target -The canonical configuration name of the target. -@item target_alias -The argument to the @samp{--target} option. If the user did not specify -a @samp{--target} option, this will be the same as @samp{host_alias}. -@item target_cpu -@itemx target_vendor -@itemx target_os -The first three parts of the canonical target configuration name. -@end table - -Note that if @samp{host} and @samp{target} are the same string, you can -assume a native configuration. If they are different, you can assume a -cross configuration. - -It is arguably possible for @samp{host} and @samp{target} to represent -the same system, but for the strings to not be identical. For example, -if @samp{config.guess} returns @samp{sparc-sun-sunos4.1.4}, and somebody -configures with @samp{--target sparc-sun-sunos4.1}, then the slight -differences between the two versions of SunOS may be unimportant for -your tool. However, in the general case it can be quite difficult to -determine whether the differences between two configuration names are -significant or not. Therefore, by convention, if the user specifies a -@samp{--target} option without specifying a @samp{--host} option, it is -assumed that the user wants to configure a cross compilation tool. - -The variables @samp{target} and @samp{target_alias} should be handled -differently. - -In general, whenever the user may actually see a string, -@samp{target_alias} should be used. This includes anything which may -appear in the file system, such as a directory name or part of a tool -name. It also includes any tool output, unless it is clearly labelled -as the canonical target configuration name. This permits the user to -use the @samp{--target} option to specify how the tool will appear to -the outside world. - -On the other hand, when checking for characteristics of the target -system, @samp{target} should be used. This is because a wide variety of -@samp{--target} options may map into the same canonical configuration -name. You should not attempt to duplicate the canonicalization done by -@samp{config.sub} in your own code. - -By convention, cross tools are installed with a prefix of the argument -used with the @samp{--target} option, also known as @samp{target_alias} -(@pxref{Using the Target Type}). If the user does not use the -@samp{--target} option, and thus is building a native tool, no prefix is -used. - -For example, if gcc is configured with @samp{--target mips-elf}, then -the installed binary will be named @samp{mips-elf-gcc}. If gcc is -configured without a @samp{--target} option, then the installed binary -will be named @samp{gcc}. - -The autoconf macro @samp{AC_ARG_PROGRAM} will handle this for you. If -you are using automake, no more need be done; the programs will -automatically be installed with the correct prefixes. Otherwise, see -the autoconf documentation for @samp{AC_ARG_PROGRAM}. - -@node Cross Tools in the Cygnus Tree -@section Cross Tools in the Cygnus Tree - -The Cygnus tree is used for various packages including gdb, the GNU -binutils, and egcs. It is also, of course, used for Cygnus releases. - -In the Cygnus tree, the top level @file{configure} script uses the old -Cygnus configure system, not autoconf. The top level @file{Makefile.in} -is written to build packages based on what is in the source tree, and -supports building a large number of tools in a single -@samp{configure}/@samp{make} step. - -The Cygnus tree may be configured with a @samp{--target} option. The -@samp{--target} option applies recursively to every subdirectory, and -permits building an entire set of cross tools at once. - -@menu -* Host and Target Libraries:: Host and Target Libraries. -* Target Library Configure Scripts:: Target Library Configure Scripts. -* Make Targets in Cygnus Tree:: Make Targets in Cygnus Tree. -* Target libiberty:: Target libiberty -@end menu - -@node Host and Target Libraries -@subsection Host and Target Libraries - -The Cygnus tree distinguishes host libraries from target libraries. - -Host libraries are built with the compiler used to build the programs -which run on the host, which is called the host compiler. This includes -libraries such as @samp{bfd} and @samp{tcl}. These libraries are built -with the host compiler, and are linked into programs like the binutils -or gcc which run on the host. - -Target libraries are built with the target compiler. If gcc is present -in the source tree, then the target compiler is the gcc that is built -using the host compiler. Target libraries are libraries such as -@samp{newlib} and @samp{libstdc++}. These libraries are not linked into -the host programs, but are instead made available for use with programs -built with the target compiler. - -For the rest of this section, assume that gcc is present in the source -tree, so that it will be used to build the target libraries. - -There is a complication here. The configure process needs to know which -compiler you are going to use to build a tool; otherwise, the feature -tests will not work correctly. The Cygnus tree handles this by not -configuring the target libraries until the target compiler is built. In -order to permit everything to build using a single -@samp{configure}/@samp{make}, the configuration of the target libraries -is actually triggered during the make step. - -When the target libraries are configured, the @samp{--target} option is -not used. Instead, the @samp{--host} option is used with the argument -of the @samp{--target} option for the overall configuration. If no -@samp{--target} option was used for the overall configuration, the -@samp{--host} option will be passed with the output of the -@file{config.guess} shell script. Any @samp{--build} option is passed -down unchanged. - -This translation of configuration options is done because since the -target libraries are compiled with the target compiler, they are being -built in order to run on the target of the overall configuration. By -the definition of host, this means that their host system is the same as -the target system of the overall configuration. - -The same process is used for both a native configuration and a cross -configuration. Even when using a native configuration, the target -libraries will be configured and built using the newly built compiler. -This is particularly important for the C++ libraries, since there is no -reason to assume that the C++ compiler used to build the host tools (if -there even is one) uses the same ABI as the g++ compiler which will be -used to build the target libraries. - -There is one difference between a native configuration and a cross -configuration. In a native configuration, the target libraries are -normally configured and built as siblings of the host tools. In a cross -configuration, the target libraries are normally built in a subdirectory -whose name is the argument to @samp{--target}. This is mainly for -historical reasons. - -To summarize, running @samp{configure} in the Cygnus tree configures all -the host libraries and tools, but does not configure any of the target -libraries. Running @samp{make} then does the following steps: - -@itemize @bullet -@item -Build the host libraries. -@item -Build the host programs, including gcc. Note that we call gcc both a -host program (since it runs on the host) and a target compiler (since it -generates code for the target). -@item -Using the newly built target compiler, configure the target libraries. -@item -Build the target libraries. -@end itemize - -The steps need not be done in precisely this order, since they are -actually controlled by @file{Makefile} targets. - -@node Target Library Configure Scripts -@subsection Target Library Configure Scripts - -There are a few things you must know in order to write a configure -script for a target library. This is just a quick sketch, and beginners -shouldn't worry if they don't follow everything here. - -The target libraries are configured and built using a newly built target -compiler. There may not be any startup files or libraries for this -target compiler. In fact, those files will probably be built as part of -some target library, which naturally means that they will not exist when -your target library is configured. - -This means that the configure script for a target library may not use -any test which requires doing a link. This unfortunately includes many -useful autoconf macros, such as @samp{AC_CHECK_FUNCS}. autoconf macros -which do a compile but not a link, such as @samp{AC_CHECK_HEADERS}, may -be used. - -This is a severe restriction, but normally not a fatal one, as target -libraries can often assume the presence of other target libraries, and -thus know which functions will be available. - -As of this writing, the autoconf macro @samp{AC_PROG_CC} does a link to -make sure that the compiler works. This may fail in a target library, -so target libraries must use a different set of macros to locate the -compiler. See the @file{configure.in} file in a directory like -@file{libiberty} or @file{libgloss} for an example. - -As noted in the previous section, target libraries are sometimes built -in directories which are siblings to the host tools, and are sometimes -built in a subdirectory. The @samp{--with-target-subdir} configure -option will be passed when the library is configured. Its value will be -an empty string if the target library is a sibling. Its value will be -the name of the subdirectory if the target library is in a subdirectory. - -If the overall build is not a native build (i.e., the overall configure -used the @samp{--target} option), then the library will be configured -with the @samp{--with-cross-host} option. The value of this option will -be the host system of the overall build. Recall that the host system of -the library will be the target of the overall build. If the overall -build is a native build, the @samp{--with-cross-host} option will not be -used. - -A library which can be built both standalone and as a target library may -want to install itself into different directories depending upon the -case. When built standalone, or when built native, the library should -be installed in @samp{$(libdir)}. When built as a target library which -is not native, the library should be installed in @samp{$(tooldir)/lib}. -The @samp{--with-cross-host} option may be used to distinguish these -cases. - -This same test of @samp{--with-cross-host} may be used to see whether it -is OK to use link tests in the configure script. If the -@samp{--with-cross-host} option is not used, then the library is being -built either standalone or native, and a link should work. - -@node Make Targets in Cygnus Tree -@subsection Make Targets in Cygnus Tree - -The top level @file{Makefile} in the Cygnus tree defines targets for -every known subdirectory. - -For every subdirectory @var{dir} which holds a host library or program, -the @file{Makefile} target @samp{all-@var{dir}} will build that library -or program. - -There are dependencies among host tools. For example, building gcc -requires first building gas, because the gcc build process invokes the -target assembler. These dependencies are reflected in the top level -@file{Makefile}. - -For every subdirectory @var{dir} which holds a target library, the -@file{Makefile} target @samp{configure-target-@var{dir}} will configure -that library. The @file{Makefile} target @samp{all-target-@var{dir}} -will build that library. - -Every @samp{configure-target-@var{dir}} target depends upon -@samp{all-gcc}, since gcc, the target compiler, is required to configure -the tool. Every @samp{all-target-@var{dir}} target depends upon the -corresponding @samp{configure-target-@var{dir}} target. - -There are several other targets which may be of interest for each -directory: @samp{install-@var{dir}}, @samp{clean-@var{dir}}, and -@samp{check-@var{dir}}. There are also corresponding @samp{target} -versions of these for the target libraries , such as -@samp{install-target-@var{dir}}. - -@node Target libiberty -@subsection Target libiberty - -The @file{libiberty} subdirectory is currently a special case, in that -it is the only directory which is built both using the host compiler and -using the target compiler. - -This is because the files in @file{libiberty} are used when building the -host tools, and they are also incorporated into the @file{libstdc++} -target library as support code. - -This duality does not pose any particular difficulties. It means that -there are targets for both @samp{all-libiberty} and -@samp{all-target-libiberty}. - -In a native configuration, when target libraries are not built in a -subdirectory, the same objects are normally used as both the host build -and the target build. This is normally OK, since libiberty contains -only C code, and in a native configuration the results of the host -compiler and the target compiler are normally interoperable. - -Irix 6 is again an exception here, since the SGI native compiler -defaults to using the @samp{O32} ABI, and gcc defaults to using the -@samp{N32} ABI. On Irix 6, the target libraries are built in a -subdirectory even for a native configuration, avoiding this problem. - -There are currently no other libraries built for both the host and the -target, but there is no conceptual problem with adding more. - -@node Canadian Cross -@chapter Canadian Cross -@cindex canadian cross -@cindex building with a cross compiler -@cindex cross compiler, building with - -It is possible to use the GNU configure and build system to build a -program which will run on a system which is different from the system on -which the tools are built. In other words, it is possible to build -programs using a cross compiler. - -This is referred to as a @dfn{Canadian Cross}. - -@menu -* Canadian Cross Example:: Canadian Cross Example. -* Canadian Cross Concepts:: Canadian Cross Concepts. -* Build Cross Host Tools:: Build Cross Host Tools. -* Build and Host Options:: Build and Host Options. -* CCross not in Cygnus Tree:: Canadian Cross not in Cygnus Tree. -* CCross in Cygnus Tree:: Canadian Cross in Cygnus Tree. -* Supporting Canadian Cross:: Supporting Canadian Cross. -@end menu - -@node Canadian Cross Example -@section Canadian Cross Example - -Here is an example of a Canadian Cross. - -While running on a GNU/Linux, you can build a program which will run on -a Solaris system. You would use a GNU/Linux cross Solaris compiler to -build the program. - -Of course, you could not run the resulting program on your GNU/Linux -system. You would have to copy it over to a Solaris system before you -would run it. - -Of course, you could also simply build the programs on the Solaris -system in the first place. However, perhaps the Solaris system is not -available for some reason; perhaps you actually don't have one, but you -want to build the tools for somebody else to use. Or perhaps your -GNU/Linux system is much faster than your Solaris system. - -A Canadian Cross build is most frequently used when building programs to -run on a non-Unix system, such as DOS or Windows. It may be simpler to -configure and build on a Unix system than to support the configuration -machinery on a non-Unix system. - -@node Canadian Cross Concepts -@section Canadian Cross Concepts - -When building a Canadian Cross, there are at least two different systems -involved: the system on which the tools are being built, and the system -on which the tools will run. - -The system on which the tools are being built is called the @dfn{build} -system. - -The system on which the tools will run is called the host system. - -For example, if you are building a Solaris program on a GNU/Linux -system, as in the previous section, the build system would be GNU/Linux, -and the host system would be Solaris. - -It is, of course, possible to build a cross compiler using a Canadian -Cross (i.e., build a cross compiler using a cross compiler). In this -case, the system for which the resulting cross compiler generates code -is called the target system. (For a more complete discussion of host -and target systems, @pxref{Host and Target}). - -An example of building a cross compiler using a Canadian Cross would be -building a Windows cross MIPS ELF compiler on a GNU/Linux system. In -this case the build system would be GNU/Linux, the host system would be -Windows, and the target system would be MIPS ELF. - -The name Canadian Cross comes from the case when the build, host, and -target systems are all different. At the time that these issues were -all being hashed out, Canada had three national political parties. - -@node Build Cross Host Tools -@section Build Cross Host Tools - -In order to configure a program for a Canadian Cross build, you must -first build and install the set of cross tools you will use to build the -program. - -These tools will be build cross host tools. That is, they will run on -the build system, and will produce code that runs on the host system. - -It is easy to confuse the meaning of build and host here. Always -remember that the build system is where you are doing the build, and the -host system is where the resulting program will run. Therefore, you -need a build cross host compiler. - -In general, you must have a complete cross environment in order to do -the build. This normally means a cross compiler, cross assembler, and -so forth, as well as libraries and include files for the host system. - -@node Build and Host Options -@section Build and Host Options -@cindex configuring a canadian cross -@cindex canadian cross, configuring - -When you run @file{configure}, you must use both the @samp{--build} and -@samp{--host} options. - -@cindex @samp{--build} option -@cindex build option -@cindex configure build system -The @samp{--build} option is used to specify the configuration name of -the build system. This can normally be the result of running the -@file{config.guess} shell script, and it is reasonable to use -@samp{--build=`config.guess`}. - -@cindex @samp{--host} option -@cindex host option -@cindex configure host -The @samp{--host} option is used to specify the configuration name of -the host system. - -As we explained earlier, @file{config.guess} is used to set the default -value for the @samp{--host} option (@pxref{Using the Host Type}). We -can now see that since @file{config.guess} returns the type of system on -which it is run, it really identifies the build system. Since the host -system is normally the same as the build system (i.e., people do not -normally build using a cross compiler), it is reasonable to use the -result of @file{config.guess} as the default for the host system when -the @samp{--host} option is not used. - -It might seem that if the @samp{--host} option were used without the -@samp{--build} option that the configure script could run -@file{config.guess} to determine the build system, and presume a -Canadian Cross if the result of @file{config.guess} differed from the -@samp{--host} option. However, for historical reasons, some configure -scripts are routinely run using an explicit @samp{--host} option, rather -than using the default from @file{config.guess}. As noted earlier, it -is difficult or impossible to reliably compare configuration names -(@pxref{Using the Target Type}). Therefore, by convention, if the -@samp{--host} option is used, but the @samp{--build} option is not used, -then the build system defaults to the host system. - -@node CCross not in Cygnus Tree -@section Canadian Cross not in Cygnus Tree. - -If you are not using the Cygnus tree, you must explicitly specify the -cross tools which you want to use to build the program. This is done by -setting environment variables before running the @file{configure} -script. - -You must normally set at least the environment variables @samp{CC}, -@samp{AR}, and @samp{RANLIB} to the cross tools which you want to use to -build. - -For some programs, you must set additional cross tools as well, such as -@samp{AS}, @samp{LD}, or @samp{NM}. - -You would set these environment variables to the build cross tools which -you are going to use. - -For example, if you are building a Solaris program on a GNU/Linux -system, and your GNU/Linux cross Solaris compiler were named -@samp{solaris-gcc}, then you would set the environment variable -@samp{CC} to @samp{solaris-gcc}. - -@node CCross in Cygnus Tree -@section Canadian Cross in Cygnus Tree -@cindex canadian cross in cygnus tree - -This section describes configuring and building a Canadian Cross when -using the Cygnus tree. - -@menu -* Standard Cygnus CCross:: Building a Normal Program. -* Cross Cygnus CCross:: Building a Cross Program. -@end menu - -@node Standard Cygnus CCross -@subsection Building a Normal Program - -When configuring a Canadian Cross in the Cygnus tree, all the -appropriate environment variables are automatically set to -@samp{@var{host}-@var{tool}}, where @var{host} is the value used for the -@samp{--host} option, and @var{tool} is the name of the tool (e.g., -@samp{gcc}, @samp{as}, etc.). These tools must be on your @samp{PATH}. - -Adding a prefix of @var{host} will give the usual name for the build -cross host tools. To see this, consider that when these cross tools -were built, they were configured to run on the build system and to -produce code for the host system. That is, they were configured with a -@samp{--target} option that is the same as the system which we are now -calling the host. Recall that the default name for installed cross -tools uses the target system as a prefix (@pxref{Using the Target -Type}). Since that is the system which we are now calling the host, -@var{host} is the right prefix to use. - -For example, if you configure with @samp{--build=i386-linux-gnu} and -@samp{--host=solaris}, then the Cygnus tree will automatically default -to using the compiler @samp{solaris-gcc}. You must have previously -built and installed this compiler, probably by doing a build with no -@samp{--host} option and with a @samp{--target} option of -@samp{solaris}. - -@node Cross Cygnus CCross -@subsection Building a Cross Program - -There are additional considerations if you want to build a cross -compiler, rather than a native compiler, in the Cygnus tree using a -Canadian Cross. - -When you build a cross compiler using the Cygnus tree, then the target -libraries will normally be built with the newly built target compiler -(@pxref{Host and Target Libraries}). However, this will not work when -building with a Canadian Cross. This is because the newly built target -compiler will be a program which runs on the host system, and therefore -will not be able to run on the build system. - -Therefore, when building a cross compiler with the Cygnus tree, you must -first install a set of build cross target tools. These tools will be -used when building the target libraries. - -Note that this is not a requirement of a Canadian Cross in general. For -example, it would be possible to build just the host cross target tools -on the build system, to copy the tools to the host system, and to build -the target libraries on the host system. The requirement for build -cross target tools is imposed by the Cygnus tree, which expects to be -able to build both host programs and target libraries in a single -@samp{configure}/@samp{make} step. Because it builds these in a single -step, it expects to be able to build the target libraries on the build -system, which means that it must use a build cross target toolchain. - -For example, suppose you want to build a Windows cross MIPS ELF compiler -on a GNU/Linux system. You must have previously installed both a -GNU/Linux cross Windows compiler and a GNU/Linux cross MIPS ELF -compiler. - -In order to build the Windows (configuration name @samp{i386-cygwin32}) -cross MIPS ELF (configure name @samp{mips-elf}) compiler, you might -execute the following commands (long command lines are broken across -lines with a trailing backslash as a continuation character). - -@example -mkdir linux-x-cygwin32 -cd linux-x-cygwin32 -@var{srcdir}/configure --target i386-cygwin32 --prefix=@var{installdir} \ - --exec-prefix=@var{installdir}/H-i386-linux -make -make install -cd .. -mkdir linux-x-mips-elf -cd linux-x-mips-elf -@var{srcdir}/configure --target mips-elf --prefix=@var{installdir} \ - --exec-prefix=@var{installdir}/H-i386-linux -make -make install -cd .. -mkdir cygwin32-x-mips-elf -cd cygwin32-x-mips-elf -@var{srcdir}/configure --build=i386-linux-gnu --host=i386-cygwin32 \ - --target=mips-elf --prefix=@var{wininstalldir} \ - --exec-prefix=@var{wininstalldir}/H-i386-cygwin32 -make -make install -@end example - -You would then copy the contents of @var{wininstalldir} over to the -Windows machine, and run the resulting programs. - -@node Supporting Canadian Cross -@section Supporting Canadian Cross - -If you want to make it possible to build a program you are developing -using a Canadian Cross, you must take some care when writing your -configure and make rules. Simple cases will normally work correctly. -However, it is not hard to write configure and make tests which will -fail in a Canadian Cross. - -@menu -* CCross in Configure:: Supporting Canadian Cross in Configure Scripts. -* CCross in Make:: Supporting Canadian Cross in Makefiles. -@end menu - -@node CCross in Configure -@subsection Supporting Canadian Cross in Configure Scripts -@cindex canadian cross in configure - -In a @file{configure.in} file, after calling @samp{AC_PROG_CC}, you can -find out whether this is a Canadian Cross configure by examining the -shell variable @samp{cross_compiling}. In a Canadian Cross, which means -that the compiler is a cross compiler, @samp{cross_compiling} will be -@samp{yes}. In a normal configuration, @samp{cross_compiling} will be -@samp{no}. - -You ordinarily do not need to know the type of the build system in a -configure script. However, if you do need that information, you can get -it by using the macro @samp{AC_CANONICAL_SYSTEM}, the same macro that is -used to determine the target system. This macro will set the variables -@samp{build}, @samp{build_alias}, @samp{build_cpu}, @samp{build_vendor}, -and @samp{build_os}, which correspond to the similar @samp{target} and -@samp{host} variables, except that they describe the build system. - -When writing tests in @file{configure.in}, you must remember that you -want to test the host environment, not the build environment. - -Macros like @samp{AC_CHECK_FUNCS} which use the compiler will test the -host environment. That is because the tests will be done by running the -compiler, which is actually a build cross host compiler. If the -compiler can find the function, that means that the function is present -in the host environment. - -Tests like @samp{test -f /dev/ptyp0}, on the other hand, will test the -build environment. Remember that the configure script is running on the -build system, not the host system. If your configure scripts examines -files, those files will be on the build system. Whatever you determine -based on those files may or may not be the case on the host system. - -Most autoconf macros will work correctly for a Canadian Cross. The main -exception is @samp{AC_TRY_RUN}. This macro tries to compile and run a -test program. This will fail in a Canadian Cross, because the program -will be compiled for the host system, which means that it will not run -on the build system. - -The @samp{AC_TRY_RUN} macro provides an optional argument to tell the -configure script what to do in a Canadian Cross. If that argument is -not present, you will get a warning when you run @samp{autoconf}: -@smallexample -warning: AC_TRY_RUN called without default to allow cross compiling -@end smallexample -@noindent -This tells you that the resulting @file{configure} script will not work -with a Canadian Cross. - -In some cases while it may better to perform a test at configure time, -it is also possible to perform the test at run time. In such a case you -can use the cross compiling argument to @samp{AC_TRY_RUN} to tell your -program that the test could not be performed at configure time. - -There are a few other autoconf macros which will not work correctly with -a Canadian Cross: a partial list is @samp{AC_FUNC_GETPGRP}, -@samp{AC_FUNC_SETPGRP}, @samp{AC_FUNC_SETVBUF_REVERSED}, and -@samp{AC_SYS_RESTARTABLE_SYSCALLS}. The @samp{AC_CHECK_SIZEOF} macro is -generally not very useful with a Canadian Cross; it permits an optional -argument indicating the default size, but there is no way to know what -the correct default should be. - -@node CCross in Make -@subsection Supporting Canadian Cross in Makefiles. -@cindex canadian cross in makefile - -The main Canadian Cross issue in a @file{Makefile} arises when you want -to use a subsidiary program to generate code or data which you will then -include in your real program. - -If you compile this subsidiary program using @samp{$(CC)} in the usual -way, you will not be able to run it. This is because @samp{$(CC)} will -build a program for the host system, but the program is being built on -the build system. - -You must instead use a compiler for the build system, rather than the -host system. In the Cygnus tree, this make variable -@samp{$(CC_FOR_BUILD)} will hold a compiler for the build system. - -Note that you should not include @file{config.h} in a file you are -compiling with @samp{$(CC_FOR_BUILD)}. The @file{configure} script will -build @file{config.h} with information for the host system. However, -you are compiling the file using a compiler for the build system (a -native compiler). Subsidiary programs are normally simple filters which -do no user interaction, and it is normally possible to write them in a -highly portable fashion so that the absence of @file{config.h} is not -crucial. - -@cindex @samp{HOST_CC} -The gcc @file{Makefile.in} shows a complex situation in which certain -files, such as @file{rtl.c}, must be compiled into both subsidiary -programs run on the build system and into the final program. This -approach may be of interest for advanced build system hackers. Note -that the build system compiler is rather confusingly called -@samp{HOST_CC}. - -@node Cygnus Configure -@chapter Cygnus Configure -@cindex cygnus configure - -The Cygnus configure script predates autoconf. All of its interesting -features have been incorporated into autoconf. No new programs should -be written to use the Cygnus configure script. - -However, the Cygnus configure script is still used in a few places: at -the top of the Cygnus tree and in a few target libraries in the Cygnus -tree. Until those uses have been replaced with autoconf, some brief -notes are appropriate here. This is not complete documentation, but it -should be possible to use this as a guide while examining the scripts -themselves. - -@menu -* Cygnus Configure Basics:: Cygnus Configure Basics. -* Cygnus Configure in C++ Libraries:: Cygnus Configure in C++ Libraries. -@end menu - -@node Cygnus Configure Basics -@section Cygnus Configure Basics - -Cygnus configure does not use any generated files; there is no program -corresponding to @samp{autoconf}. Instead, there is a single shell -script named @samp{configure} which may be found at the top of the -Cygnus tree. This shell script was written by hand; it was not -generated by autoconf, and it is incorrect, and indeed harmful, to run -@samp{autoconf} in the top level of a Cygnus tree. - -Cygnus configure works in a particular directory by examining the file -@file{configure.in} in that directory. That file is broken into four -separate shell scripts. - -The first is the contents of @file{configure.in} up to a line that -starts with @samp{# per-host:}. This is the common part. - -The second is the rest of @file{configure.in} up to a line that starts -with @samp{# per-target:}. This is the per host part. - -The third is the rest of @file{configure.in} up to a line that starts -with @samp{# post-target:}. This is the per target part. - -The fourth is the remainder of @file{configure.in}. This is the post -target part. - -If any of these comment lines are missing, the corresponding shell -script is empty. - -Cygnus configure will first execute the common part. This must set the -shell variable @samp{srctrigger} to the name of a source file, to -confirm that Cygnus configure is looking at the right directory. This -may set the shell variables @samp{package_makefile_frag} and -@samp{package_makefile_rules_frag}. - -Cygnus configure will next set the @samp{build} and @samp{host} shell -variables, and execute the per host part. This may set the shell -variable @samp{host_makefile_frag}. - -Cygnus configure will next set the @samp{target} variable, and execute -the per target part. This may set the shell variable -@samp{target_makefile_frag}. - -Any of these scripts may set the @samp{subdirs} shell variable. This -variable is a list of subdirectories where a @file{Makefile.in} file may -be found. Cygnus configure will automatically look for a -@file{Makefile.in} file in the current directory. The @samp{subdirs} -shell variable is not normally used, and I believe that the only -directory which uses it at present is @file{newlib}. - -For each @file{Makefile.in}, Cygnus configure will automatically create -a @file{Makefile} by adding definitions for @samp{make} variables such -as @samp{host} and @samp{target}, and automatically editing the values -of @samp{make} variables such as @samp{prefix} if they are present. - -Also, if any of the @samp{makefile_frag} shell variables are set, Cygnus -configure will interpret them as file names relative to either the -working directory or the source directory, and will read the contents of -the file into the generated @file{Makefile}. The file contents will be -read in after the first line in @file{Makefile.in} which starts with -@samp{####}. - -These @file{Makefile} fragments are used to customize behaviour for a -particular host or target. They serve to select particular files to -compile, and to define particular preprocessor macros by providing -values for @samp{make} variables which are then used during compilation. -Cygnus configure, unlike autoconf, normally does not do feature tests, -and normally requires support to be added manually for each new host. - -The @file{Makefile} fragment support is similar to the autoconf -@samp{AC_SUBST_FILE} macro. - -After creating each @file{Makefile}, the post target script will be run -(i.e., it may be run several times). This script may further customize -the @file{Makefile}. When it is run, the shell variable @samp{Makefile} -will hold the name of the @file{Makefile}, including the appropriate -directory component. - -Like an autoconf generated @file{configure} script, Cygnus configure -will create a file named @file{config.status} which, when run, will -automatically recreate the configuration. The @file{config.status} file -will simply execute the Cygnus configure script again with the -appropriate arguments. - -Any of the parts of @file{configure.in} may set the shell variables -@samp{files} and @samp{links}. Cygnus configure will set up symlinks -from the names in @samp{links} to the files named in @samp{files}. This -is similar to the autoconf @samp{AC_LINK_FILES} macro. - -Finally, any of the parts of @file{configure.in} may set the shell -variable @samp{configdirs} to a set of subdirectories. If it is set, -Cygnus configure will recursively run the configure process in each -subdirectory. If the subdirectory uses Cygnus configure, it will -contain a @file{configure.in} file but no @file{configure} file, in -which case Cygnus configure will invoke itself recursively. If the -subdirectory has a @file{configure} file, Cygnus configure assumes that -it is an autoconf generated @file{configure} script, and simply invokes -it directly. - -@node Cygnus Configure in C++ Libraries -@section Cygnus Configure in C++ Libraries -@cindex @file{libstdc++} configure -@cindex @file{libio} configure -@cindex @file{libg++} configure - -The C++ library configure system, written by Per Bothner, deserves -special mention. It uses Cygnus configure, but it does feature testing -like that done by autoconf generated @file{configure} scripts. This -approach is used in the libraries @file{libio}, @file{libstdc++}, and -@file{libg++}. - -Most of the @file{Makefile} information is written out by the shell -script @file{libio/config.shared}. Each @file{configure.in} file sets -certain shell variables, and then invokes @file{config.shared} to create -two package @file{Makefile} fragments. These fragments are then -incorporated into the resulting @file{Makefile} by the Cygnus configure -script. - -The file @file{_G_config.h} is created in the @file{libio} object -directory by running the shell script @file{libio/gen-params}. This -shell script uses feature tests to define macros and typedefs in -@file{_G_config.h}. - -@node Multilibs -@chapter Multilibs -@cindex multilibs - -For some targets gcc may have different processor requirements depending -upon command line options. An obvious example is the -@samp{-msoft-float} option supported on several processors. This option -means that the floating point registers are not available, which means -that floating point operations must be done by calling an emulation -subroutine rather than by using machine instructions. - -For such options, gcc is often configured to compile target libraries -twice: once with @samp{-msoft-float} and once without. When gcc -compiles target libraries more than once, the resulting libraries are -called @dfn{multilibs}. - -Multilibs are not really part of the GNU configure and build system, but -we discuss them here since they require support in the @file{configure} -scripts and @file{Makefile}s used for target libraries. - -@menu -* Multilibs in gcc:: Multilibs in gcc. -* Multilibs in Target Libraries:: Multilibs in Target Libraries. -@end menu - -@node Multilibs in gcc -@section Multilibs in gcc - -In gcc, multilibs are defined by setting the variable -@samp{MULTILIB_OPTIONS} in the target @file{Makefile} fragment. Several -other @samp{MULTILIB} variables may also be defined there. @xref{Target -Fragment, , The Target Makefile Fragment, gcc, Using and Porting GNU -CC}. - -If you have built gcc, you can see what multilibs it uses by running it -with the @samp{-print-multi-lib} option. The output @samp{.;} means -that no multilibs are used. In general, the output is a sequence of -lines, one per multilib. The first part of each line, up to the -@samp{;}, is the name of the multilib directory. The second part is a -list of compiler options separated by @samp{@@} characters. - -Multilibs are built in a tree of directories. The top of the tree, -represented by @samp{.} in the list of multilib directories, is the -default library to use when no special compiler options are used. The -subdirectories of the tree hold versions of the library to use when -particular compiler options are used. - -@node Multilibs in Target Libraries -@section Multilibs in Target Libraries - -The target libraries in the Cygnus tree are automatically built with -multilibs. That means that each library is built multiple times. - -This default is set in the top level @file{configure.in} file, by adding -@samp{--enable-multilib} to the list of arguments passed to configure -when it is run for the target libraries (@pxref{Host and Target -Libraries}). - -Each target library uses the shell script @file{config-ml.in}, written -by Doug Evans, to prepare to build target libraries. This shell script -is invoked after the @file{Makefile} has been created by the -@file{configure} script. If multilibs are not enabled, it does nothing, -otherwise it modifies the @file{Makefile} to support multilibs. - -The @file{config-ml.in} script makes one copy of the @file{Makefile} for -each multilib in the appropriate subdirectory. When configuring in the -source directory (which is not recommended), it will build a symlink -tree of the sources in each subdirectory. - -The @file{config-ml.in} script sets several variables in the various -@file{Makefile}s. The @file{Makefile.in} must have definitions for -these variables already; @file{config-ml.in} simply changes the existing -values. The @file{Makefile} should use default values for these -variables which will do the right thing in the subdirectories. - -@table @samp -@item MULTISRCTOP -@file{config-ml.in} will set this to a sequence of @samp{../} strings, -where the number of strings is the number of multilib levels in the -source tree. The default value should be the empty string. -@item MULTIBUILDTOP -@file{config-ml.in} will set this to a sequence of @samp{../} strings, -where the number of strings is number of multilib levels in the object -directory. The default value should be the empty string. This will -differ from @samp{MULTISRCTOP} when configuring in the source tree -(which is not recommended). -@item MULTIDIRS -In the top level @file{Makefile} only, @file{config-ml.in} will set this -to the list of multilib subdirectories. The default value should be the -empty string. -@item MULTISUBDIR -@file{config-ml.in} will set this to the installed subdirectory name to -use for this subdirectory, with a leading @samp{/}. The default value -shold be the empty string. -@item MULTIDO -@itemx MULTICLEAN -In the top level @file{Makefile} only, @file{config-ml.in} will set -these variables to commands to use when doing a recursive make. These -variables should both default to the string @samp{true}, so that by -default nothing happens. -@end table - -All references to the parent of the source directory should use the -variable @samp{MULTISRCTOP}. Instead of writing @samp{$(srcdir)/..}, -you must write @samp{$(srcdir)/$(MULTISRCTOP)..}. - -Similarly, references to the parent of the object directory should use -the variable @samp{MULTIBUILDTOP}. - -In the installation target, the libraries should be installed in the -subdirectory @samp{MULTISUBDIR}. Instead of installing -@samp{$(libdir)/libfoo.a}, install -@samp{$(libdir)$(MULTISUBDIR)/libfoo.a}. - -The @file{config-ml.in} script also modifies the top level -@file{Makefile} to add @samp{multi-do} and @samp{multi-clean} targets -which are used when building multilibs. - -The default target of the @file{Makefile} should include the following -command: -@smallexample -@@$(MULTIDO) $(FLAGS_TO_PASS) DO=all multi-do -@end smallexample -@noindent -This assumes that @samp{$(FLAGS_TO_PASS)} is defined as a set of -variables to pass to a recursive invocation of @samp{make}. This will -build all the multilibs. Note that the default value of @samp{MULTIDO} -is @samp{true}, so by default this command will do nothing. It will -only do something in the top level @file{Makefile} if multilibs were -enabled. - -The @samp{install} target of the @file{Makefile} should include the -following command: -@smallexample -@@$(MULTIDO) $(FLAGS_TO_PASS) DO=install multi-do -@end smallexample - -In general, any operation, other than clean, which should be performed -on all the multilibs should use a @samp{$(MULTIDO)} line, setting the -variable @samp{DO} to the target of each recursive call to @samp{make}. - -The @samp{clean} targets (@samp{clean}, @samp{mostlyclean}, etc.) should -use @samp{$(MULTICLEAN)}. For example, the @samp{clean} target should -do this: -@smallexample -@@$(MULTICLEAN) DO=clean multi-clean -@end smallexample - -@node FAQ -@chapter Frequently Asked Questions - -@table @asis -@item Which do I run first, @samp{autoconf} or @samp{automake}? -Except when you first add autoconf or automake support to a package, you -shouldn't run either by hand. Instead, configure with the -@samp{--enable-maintainer-mode} option, and let @samp{make} take care of -it. - -@cindex undefined macros -@item @samp{autoconf} says something about undefined macros. -This means that you have macros in your @file{configure.in} which are -not defined by @samp{autoconf}. You may be using an old version of -@samp{autoconf}; try building and installing a newer one. Make sure the -newly installled @samp{autoconf} is first on your @samp{PATH}. Also, -see the next question. - -@cindex @samp{CY_GNU_GETTEXT} in @file{configure} -@cindex @samp{AM_PROG_LIBTOOL} in @file{configure} -@item My @file{configure} script has stuff like @samp{CY_GNU_GETTEXT} in it. -This means that you have macros in your @file{configure.in} which should -be defined in your @file{aclocal.m4} file, but aren't. This usually -means that @samp{aclocal} was not able to appropriate definitions of the -macros. Make sure that you have installed all the packages you need. -In particular, make sure that you have installed libtool (this is where -@samp{AM_PROG_LIBTOOL} is defined) and gettext (this is where -@samp{CY_GNU_GETTEXT} is defined, at least in the Cygnus version of -gettext). - -@cindex @file{Makefile}, garbage characters -@item My @file{Makefile} has @samp{@@} characters in it. -This may mean that you tried to use an autoconf substitution in your -@file{Makefile.in} without adding the appropriate @samp{AC_SUBST} call -to your @file{configure} script. Or it may just mean that you need to -rebuild @file{Makefile} in your build directory. To rebuild -@file{Makefile} from @file{Makefile.in}, run the shell script -@file{config.status} with no arguments. If you need to force -@file{configure} to run again, first run @samp{config.status --recheck}. -These runs are normally done automatically by @file{Makefile} targets, -but if your @file{Makefile} has gotten messed up you'll need to help -them along. - -@cindex @samp{config.status --recheck} -@item Why do I have to run both @samp{config.status --recheck} and @samp{config.status}? -Normally, you don't; they will be run automatically by @file{Makefile} -targets. If you do need to run them, use @samp{config.status --recheck} -to run the @file{configure} script again with the same arguments as the -first time you ran it. Use @samp{config.status} (with no arguments) to -regenerate all files (@file{Makefile}, @file{config.h}, etc.) based on -the results of the configure script. The two cases are separate because -it isn't always necessary to regenerate all the files after running -@samp{config.status --recheck}. The @file{Makefile} targets generated -by automake will use the environment variables @samp{CONFIG_FILES} and -@samp{CONFIG_HEADERS} to only regenerate files as they are needed. - -@item What is the Cygnus tree? -The Cygnus tree is used for various packages including gdb, the GNU -binutils, and egcs. It is also, of course, used for Cygnus releases. -It is the build system which was developed at Cygnus, using the Cygnus -configure script. It permits building many different packages with a -single configure and make. The configure scripts in the tree are being -converted to autoconf, but the general build structure remains intact. - -@item Why do I have to keep rebuilding and reinstalling the tools? -I know, it's a pain. Unfortunately, there are bugs in the tools -themselves which need to be fixed, and each time that happens everybody -who uses the tools need to reinstall new versions of them. I don't know -if there is going to be a clever fix until the tools stabilize. - -@item Why not just have a Cygnus tree @samp{make} target to update the tools? -The tools unfortunately need to be installed before they can be used. -That means that they must be built using an appropriate prefix, and it -seems unwise to assume that every configuration uses an appropriate -prefix. It might be possible to make them work in place, or it might be -possible to install them in some subdirectory; so far these approaches -have not been implemented. -@end table - -@node Index -@unnumbered Index - -@printindex cp - -@contents -@bye diff --git a/contrib/binutils/etc/make-stds.texi b/contrib/binutils/etc/make-stds.texi deleted file mode 100644 index 2149764b8e9c..000000000000 --- a/contrib/binutils/etc/make-stds.texi +++ /dev/null @@ -1,914 +0,0 @@ -@comment This file is included by both standards.texi and make.texinfo. -@comment It was broken out of standards.texi on 1/6/93 by roland. - -@node Makefile Conventions -@chapter Makefile Conventions -@comment standards.texi does not print an index, but make.texinfo does. -@cindex makefile, conventions for -@cindex conventions for makefiles -@cindex standards for makefiles - -This -@ifinfo -node -@end ifinfo -@iftex -@ifset CODESTD -section -@end ifset -@ifclear CODESTD -chapter -@end ifclear -@end iftex -describes conventions for writing the Makefiles for GNU programs. - -@menu -* Makefile Basics:: General Conventions for Makefiles -* Utilities in Makefiles:: Utilities in Makefiles -* Command Variables:: Variables for Specifying Commands -* Directory Variables:: Variables for Installation Directories -* Standard Targets:: Standard Targets for Users -* Install Command Categories:: Three categories of commands in the `install' - rule: normal, pre-install and post-install. -@end menu - -@node Makefile Basics -@section General Conventions for Makefiles - -Every Makefile should contain this line: - -@example -SHELL = /bin/sh -@end example - -@noindent -to avoid trouble on systems where the @code{SHELL} variable might be -inherited from the environment. (This is never a problem with GNU -@code{make}.) - -Different @code{make} programs have incompatible suffix lists and -implicit rules, and this sometimes creates confusion or misbehavior. So -it is a good idea to set the suffix list explicitly using only the -suffixes you need in the particular Makefile, like this: - -@example -.SUFFIXES: -.SUFFIXES: .c .o -@end example - -@noindent -The first line clears out the suffix list, the second introduces all -suffixes which may be subject to implicit rules in this Makefile. - -Don't assume that @file{.} is in the path for command execution. When -you need to run programs that are a part of your package during the -make, please make sure that it uses @file{./} if the program is built as -part of the make or @file{$(srcdir)/} if the file is an unchanging part -of the source code. Without one of these prefixes, the current search -path is used. - -The distinction between @file{./} (the @dfn{build directory}) and -@file{$(srcdir)/} (the @dfn{source directory}) is important because -users can build in a separate directory using the @samp{--srcdir} option -to @file{configure}. A rule of the form: - -@smallexample -foo.1 : foo.man sedscript - sed -e sedscript foo.man > foo.1 -@end smallexample - -@noindent -will fail when the build directory is not the source directory, because -@file{foo.man} and @file{sedscript} are in the the source directory. - -When using GNU @code{make}, relying on @samp{VPATH} to find the source -file will work in the case where there is a single dependency file, -since the @code{make} automatic variable @samp{$<} will represent the -source file wherever it is. (Many versions of @code{make} set @samp{$<} -only in implicit rules.) A Makefile target like - -@smallexample -foo.o : bar.c - $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o -@end smallexample - -@noindent -should instead be written as - -@smallexample -foo.o : bar.c - $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@@ -@end smallexample - -@noindent -in order to allow @samp{VPATH} to work correctly. When the target has -multiple dependencies, using an explicit @samp{$(srcdir)} is the easiest -way to make the rule work well. For example, the target above for -@file{foo.1} is best written as: - -@smallexample -foo.1 : foo.man sedscript - sed -e $(srcdir)/sedscript $(srcdir)/foo.man > $@@ -@end smallexample - -GNU distributions usually contain some files which are not source -files---for example, Info files, and the output from Autoconf, Automake, -Bison or Flex. Since these files normally appear in the source -directory, they should always appear in the source directory, not in the -build directory. So Makefile rules to update them should put the -updated files in the source directory. - -However, if a file does not appear in the distribution, then the -Makefile should not put it in the source directory, because building a -program in ordinary circumstances should not modify the source directory -in any way. - -Try to make the build and installation targets, at least (and all their -subtargets) work correctly with a parallel @code{make}. - -@node Utilities in Makefiles -@section Utilities in Makefiles - -Write the Makefile commands (and any shell scripts, such as -@code{configure}) to run in @code{sh}, not in @code{csh}. Don't use any -special features of @code{ksh} or @code{bash}. - -The @code{configure} script and the Makefile rules for building and -installation should not use any utilities directly except these: - -@c dd find -@c gunzip gzip md5sum -@c mkfifo mknod tee uname - -@example -cat cmp cp diff echo egrep expr false grep install-info -ln ls mkdir mv pwd rm rmdir sed sleep sort tar test touch true -@end example - -The compression program @code{gzip} can be used in the @code{dist} rule. - -Stick to the generally supported options for these programs. For -example, don't use @samp{mkdir -p}, convenient as it may be, because -most systems don't support it. - -It is a good idea to avoid creating symbolic links in makefiles, since a -few systems don't support them. - -The Makefile rules for building and installation can also use compilers -and related programs, but should do so via @code{make} variables so that the -user can substitute alternatives. Here are some of the programs we -mean: - -@example -ar bison cc flex install ld ldconfig lex -make makeinfo ranlib texi2dvi yacc -@end example - -Use the following @code{make} variables to run those programs: - -@example -$(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX) -$(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC) -@end example - -When you use @code{ranlib} or @code{ldconfig}, you should make sure -nothing bad happens if the system does not have the program in question. -Arrange to ignore an error from that command, and print a message before -the command to tell the user that failure of this command does not mean -a problem. (The Autoconf @samp{AC_PROG_RANLIB} macro can help with -this.) - -If you use symbolic links, you should implement a fallback for systems -that don't have symbolic links. - -Additional utilities that can be used via Make variables are: - -@example -chgrp chmod chown mknod -@end example - -It is ok to use other utilities in Makefile portions (or scripts) -intended only for particular systems where you know those utilities -exist. - -@node Command Variables -@section Variables for Specifying Commands - -Makefiles should provide variables for overriding certain commands, options, -and so on. - -In particular, you should run most utility programs via variables. -Thus, if you use Bison, have a variable named @code{BISON} whose default -value is set with @samp{BISON = bison}, and refer to it with -@code{$(BISON)} whenever you need to use Bison. - -File management utilities such as @code{ln}, @code{rm}, @code{mv}, and -so on, need not be referred to through variables in this way, since users -don't need to replace them with other programs. - -Each program-name variable should come with an options variable that is -used to supply options to the program. Append @samp{FLAGS} to the -program-name variable name to get the options variable name---for -example, @code{BISONFLAGS}. (The names @code{CFLAGS} for the C -compiler, @code{YFLAGS} for yacc, and @code{LFLAGS} for lex, are -exceptions to this rule, but we keep them because they are standard.) -Use @code{CPPFLAGS} in any compilation command that runs the -preprocessor, and use @code{LDFLAGS} in any compilation command that -does linking as well as in any direct use of @code{ld}. - -If there are C compiler options that @emph{must} be used for proper -compilation of certain files, do not include them in @code{CFLAGS}. -Users expect to be able to specify @code{CFLAGS} freely themselves. -Instead, arrange to pass the necessary options to the C compiler -independently of @code{CFLAGS}, by writing them explicitly in the -compilation commands or by defining an implicit rule, like this: - -@smallexample -CFLAGS = -g -ALL_CFLAGS = -I. $(CFLAGS) -.c.o: - $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< -@end smallexample - -Do include the @samp{-g} option in @code{CFLAGS}, because that is not -@emph{required} for proper compilation. You can consider it a default -that is only recommended. If the package is set up so that it is -compiled with GCC by default, then you might as well include @samp{-O} -in the default value of @code{CFLAGS} as well. - -Put @code{CFLAGS} last in the compilation command, after other variables -containing compiler options, so the user can use @code{CFLAGS} to -override the others. - -@code{CFLAGS} should be used in every invocation of the C compiler, -both those which do compilation and those which do linking. - -Every Makefile should define the variable @code{INSTALL}, which is the -basic command for installing a file into the system. - -Every Makefile should also define the variables @code{INSTALL_PROGRAM} -and @code{INSTALL_DATA}. (The default for each of these should be -@code{$(INSTALL)}.) Then it should use those variables as the commands -for actual installation, for executables and nonexecutables -respectively. Use these variables as follows: - -@example -$(INSTALL_PROGRAM) foo $(bindir)/foo -$(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a -@end example - -Optionally, you may prepend the value of @code{DESTDIR} to the target -filename. Doing this allows the installer to create a snapshot of the -installation to be copied onto the real target filesystem later. Do not -set the value of @code{DESTDIR} in your Makefile, and do not include it -in any installed files. With support for @code{DESTDIR}, the above -examples become: - -@example -$(INSTALL_PROGRAM) foo $(DESTDIR)$(bindir)/foo -$(INSTALL_DATA) libfoo.a $(DESTDIR)$(libdir)/libfoo.a -@end example - -@noindent -Always use a file name, not a directory name, as the second argument of -the installation commands. Use a separate command for each file to be -installed. - -@node Directory Variables -@section Variables for Installation Directories - -Installation directories should always be named by variables, so it is -easy to install in a nonstandard place. The standard names for these -variables are described below. They are based on a standard filesystem -layout; variants of it are used in SVR4, 4.4BSD, Linux, Ultrix v4, and -other modern operating systems. - -These two variables set the root for the installation. All the other -installation directories should be subdirectories of one of these two, -and nothing should be directly installed into these two directories. - -@table @samp -@item prefix -A prefix used in constructing the default values of the variables listed -below. The default value of @code{prefix} should be @file{/usr/local}. -When building the complete GNU system, the prefix will be empty and -@file{/usr} will be a symbolic link to @file{/}. -(If you are using Autoconf, write it as @samp{@@prefix@@}.) - -Running @samp{make install} with a different value of @code{prefix} -from the one used to build the program should @var{not} recompile -the program. - -@item exec_prefix -A prefix used in constructing the default values of some of the -variables listed below. The default value of @code{exec_prefix} should -be @code{$(prefix)}. -(If you are using Autoconf, write it as @samp{@@exec_prefix@@}.) - -Generally, @code{$(exec_prefix)} is used for directories that contain -machine-specific files (such as executables and subroutine libraries), -while @code{$(prefix)} is used directly for other directories. - -Running @samp{make install} with a different value of @code{exec_prefix} -from the one used to build the program should @var{not} recompile the -program. -@end table - -Executable programs are installed in one of the following directories. - -@table @samp -@item bindir -The directory for installing executable programs that users can run. -This should normally be @file{/usr/local/bin}, but write it as -@file{$(exec_prefix)/bin}. -(If you are using Autoconf, write it as @samp{@@bindir@@}.) - -@item sbindir -The directory for installing executable programs that can be run from -the shell, but are only generally useful to system administrators. This -should normally be @file{/usr/local/sbin}, but write it as -@file{$(exec_prefix)/sbin}. -(If you are using Autoconf, write it as @samp{@@sbindir@@}.) - -@item libexecdir -@comment This paragraph adjusted to avoid overfull hbox --roland 5jul94 -The directory for installing executable programs to be run by other -programs rather than by users. This directory should normally be -@file{/usr/local/libexec}, but write it as @file{$(exec_prefix)/libexec}. -(If you are using Autoconf, write it as @samp{@@libexecdir@@}.) -@end table - -Data files used by the program during its execution are divided into -categories in two ways. - -@itemize @bullet -@item -Some files are normally modified by programs; others are never normally -modified (though users may edit some of these). - -@item -Some files are architecture-independent and can be shared by all -machines at a site; some are architecture-dependent and can be shared -only by machines of the same kind and operating system; others may never -be shared between two machines. -@end itemize - -This makes for six different possibilities. However, we want to -discourage the use of architecture-dependent files, aside from object -files and libraries. It is much cleaner to make other data files -architecture-independent, and it is generally not hard. - -Therefore, here are the variables Makefiles should use to specify -directories: - -@table @samp -@item datadir -The directory for installing read-only architecture independent data -files. This should normally be @file{/usr/local/share}, but write it as -@file{$(prefix)/share}. -(If you are using Autoconf, write it as @samp{@@datadir@@}.) -As a special exception, see @file{$(infodir)} -and @file{$(includedir)} below. - -@item sysconfdir -The directory for installing read-only data files that pertain to a -single machine--that is to say, files for configuring a host. Mailer -and network configuration files, @file{/etc/passwd}, and so forth belong -here. All the files in this directory should be ordinary ASCII text -files. This directory should normally be @file{/usr/local/etc}, but -write it as @file{$(prefix)/etc}. -(If you are using Autoconf, write it as @samp{@@sysconfdir@@}.) - -Do not install executables here in this directory (they probably belong -in @file{$(libexecdir)} or @file{$(sbindir)}). Also do not install -files that are modified in the normal course of their use (programs -whose purpose is to change the configuration of the system excluded). -Those probably belong in @file{$(localstatedir)}. - -@item sharedstatedir -The directory for installing architecture-independent data files which -the programs modify while they run. This should normally be -@file{/usr/local/com}, but write it as @file{$(prefix)/com}. -(If you are using Autoconf, write it as @samp{@@sharedstatedir@@}.) - -@item localstatedir -The directory for installing data files which the programs modify while -they run, and that pertain to one specific machine. Users should never -need to modify files in this directory to configure the package's -operation; put such configuration information in separate files that go -in @file{$(datadir)} or @file{$(sysconfdir)}. @file{$(localstatedir)} -should normally be @file{/usr/local/var}, but write it as -@file{$(prefix)/var}. -(If you are using Autoconf, write it as @samp{@@localstatedir@@}.) - -@item libdir -The directory for object files and libraries of object code. Do not -install executables here, they probably ought to go in @file{$(libexecdir)} -instead. The value of @code{libdir} should normally be -@file{/usr/local/lib}, but write it as @file{$(exec_prefix)/lib}. -(If you are using Autoconf, write it as @samp{@@libdir@@}.) - -@item infodir -The directory for installing the Info files for this package. By -default, it should be @file{/usr/local/info}, but it should be written -as @file{$(prefix)/info}. -(If you are using Autoconf, write it as @samp{@@infodir@@}.) - -@item lispdir -The directory for installing any Emacs Lisp files in this package. By -default, it should be @file{/usr/local/share/emacs/site-lisp}, but it -should be written as @file{$(prefix)/share/emacs/site-lisp}. - -If you are using Autoconf, write the default as @samp{@@lispdir@@}. -In order to make @samp{@@lispdir@@} work, you need the following lines -in your @file{configure.in} file: - -@example -lispdir='$@{datadir@}/emacs/site-lisp' -AC_SUBST(lispdir) -@end example - -@item includedir -@c rewritten to avoid overfull hbox --roland -The directory for installing header files to be included by user -programs with the C @samp{#include} preprocessor directive. This -should normally be @file{/usr/local/include}, but write it as -@file{$(prefix)/include}. -(If you are using Autoconf, write it as @samp{@@includedir@@}.) - -Most compilers other than GCC do not look for header files in directory -@file{/usr/local/include}. So installing the header files this way is -only useful with GCC. Sometimes this is not a problem because some -libraries are only really intended to work with GCC. But some libraries -are intended to work with other compilers. They should install their -header files in two places, one specified by @code{includedir} and one -specified by @code{oldincludedir}. - -@item oldincludedir -The directory for installing @samp{#include} header files for use with -compilers other than GCC. This should normally be @file{/usr/include}. -(If you are using Autoconf, you can write it as @samp{@@oldincludedir@@}.) - -The Makefile commands should check whether the value of -@code{oldincludedir} is empty. If it is, they should not try to use -it; they should cancel the second installation of the header files. - -A package should not replace an existing header in this directory unless -the header came from the same package. Thus, if your Foo package -provides a header file @file{foo.h}, then it should install the header -file in the @code{oldincludedir} directory if either (1) there is no -@file{foo.h} there or (2) the @file{foo.h} that exists came from the Foo -package. - -To tell whether @file{foo.h} came from the Foo package, put a magic -string in the file---part of a comment---and @code{grep} for that string. -@end table - -Unix-style man pages are installed in one of the following: - -@table @samp -@item mandir -The top-level directory for installing the man pages (if any) for this -package. It will normally be @file{/usr/local/man}, but you should -write it as @file{$(prefix)/man}. -(If you are using Autoconf, write it as @samp{@@mandir@@}.) - -@item man1dir -The directory for installing section 1 man pages. Write it as -@file{$(mandir)/man1}. -@item man2dir -The directory for installing section 2 man pages. Write it as -@file{$(mandir)/man2} -@item @dots{} - -@strong{Don't make the primary documentation for any GNU software be a -man page. Write a manual in Texinfo instead. Man pages are just for -the sake of people running GNU software on Unix, which is a secondary -application only.} - -@item manext -The file name extension for the installed man page. This should contain -a period followed by the appropriate digit; it should normally be @samp{.1}. - -@item man1ext -The file name extension for installed section 1 man pages. -@item man2ext -The file name extension for installed section 2 man pages. -@item @dots{} -Use these names instead of @samp{manext} if the package needs to install man -pages in more than one section of the manual. -@end table - -And finally, you should set the following variable: - -@table @samp -@item srcdir -The directory for the sources being compiled. The value of this -variable is normally inserted by the @code{configure} shell script. -(If you are using Autconf, use @samp{srcdir = @@srcdir@@}.) -@end table - -For example: - -@smallexample -@c I have changed some of the comments here slightly to fix an overfull -@c hbox, so the make manual can format correctly. --roland -# Common prefix for installation directories. -# NOTE: This directory must exist when you start the install. -prefix = /usr/local -exec_prefix = $(prefix) -# Where to put the executable for the command `gcc'. -bindir = $(exec_prefix)/bin -# Where to put the directories used by the compiler. -libexecdir = $(exec_prefix)/libexec -# Where to put the Info files. -infodir = $(prefix)/info -@end smallexample - -If your program installs a large number of files into one of the -standard user-specified directories, it might be useful to group them -into a subdirectory particular to that program. If you do this, you -should write the @code{install} rule to create these subdirectories. - -Do not expect the user to include the subdirectory name in the value of -any of the variables listed above. The idea of having a uniform set of -variable names for installation directories is to enable the user to -specify the exact same values for several different GNU packages. In -order for this to be useful, all the packages must be designed so that -they will work sensibly when the user does so. - -@node Standard Targets -@section Standard Targets for Users - -All GNU programs should have the following targets in their Makefiles: - -@table @samp -@item all -Compile the entire program. This should be the default target. This -target need not rebuild any documentation files; Info files should -normally be included in the distribution, and DVI files should be made -only when explicitly asked for. - -By default, the Make rules should compile and link with @samp{-g}, so -that executable programs have debugging symbols. Users who don't mind -being helpless can strip the executables later if they wish. - -@item install -Compile the program and copy the executables, libraries, and so on to -the file names where they should reside for actual use. If there is a -simple test to verify that a program is properly installed, this target -should run that test. - -Do not strip executables when installing them. Devil-may-care users can -use the @code{install-strip} target to do that. - -If possible, write the @code{install} target rule so that it does not -modify anything in the directory where the program was built, provided -@samp{make all} has just been done. This is convenient for building the -program under one user name and installing it under another. - -The commands should create all the directories in which files are to be -installed, if they don't already exist. This includes the directories -specified as the values of the variables @code{prefix} and -@code{exec_prefix}, as well as all subdirectories that are needed. -One way to do this is by means of an @code{installdirs} target -as described below. - -Use @samp{-} before any command for installing a man page, so that -@code{make} will ignore any errors. This is in case there are systems -that don't have the Unix man page documentation system installed. - -The way to install Info files is to copy them into @file{$(infodir)} -with @code{$(INSTALL_DATA)} (@pxref{Command Variables}), and then run -the @code{install-info} program if it is present. @code{install-info} -is a program that edits the Info @file{dir} file to add or update the -menu entry for the given Info file; it is part of the Texinfo package. -Here is a sample rule to install an Info file: - -@comment This example has been carefully formatted for the Make manual. -@comment Please do not reformat it without talking to roland@gnu.ai.mit.edu. -@smallexample -$(DESTDIR)$(infodir)/foo.info: foo.info - $(POST_INSTALL) -# There may be a newer info file in . than in srcdir. - -if test -f foo.info; then d=.; \ - else d=$(srcdir); fi; \ - $(INSTALL_DATA) $$d/foo.info $(DESTDIR)$@@; \ -# Run install-info only if it exists. -# Use `if' instead of just prepending `-' to the -# line so we notice real errors from install-info. -# We use `$(SHELL) -c' because some shells do not -# fail gracefully when there is an unknown command. - if $(SHELL) -c 'install-info --version' \ - >/dev/null 2>&1; then \ - install-info --dir-file=$(DESTDIR)$(infodir)/dir \ - $(DESTDIR)$(infodir)/foo.info; \ - else true; fi -@end smallexample - -When writing the @code{install} target, you must classify all the -commands into three categories: normal ones, @dfn{pre-installation} -commands and @dfn{post-installation} commands. @xref{Install Command -Categories}. - -@item uninstall -Delete all the installed files---the copies that the @samp{install} -target creates. - -This rule should not modify the directories where compilation is done, -only the directories where files are installed. - -The uninstallation commands are divided into three categories, just like -the installation commands. @xref{Install Command Categories}. - -@item install-strip -Like @code{install}, but strip the executable files while installing -them. In many cases, the definition of this target can be very simple: - -@smallexample -install-strip: - $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \ - install -@end smallexample - -Normally we do not recommend stripping an executable unless you are sure -the program has no bugs. However, it can be reasonable to install a -stripped executable for actual execution while saving the unstripped -executable elsewhere in case there is a bug. - -@comment The gratuitous blank line here is to make the table look better -@comment in the printed Make manual. Please leave it in. -@item clean - -Delete all files from the current directory that are normally created by -building the program. Don't delete the files that record the -configuration. Also preserve files that could be made by building, but -normally aren't because the distribution comes with them. - -Delete @file{.dvi} files here if they are not part of the distribution. - -@item distclean -Delete all files from the current directory that are created by -configuring or building the program. If you have unpacked the source -and built the program without creating any other files, @samp{make -distclean} should leave only the files that were in the distribution. - -@item mostlyclean -Like @samp{clean}, but may refrain from deleting a few files that people -normally don't want to recompile. For example, the @samp{mostlyclean} -target for GCC does not delete @file{libgcc.a}, because recompiling it -is rarely necessary and takes a lot of time. - -@item maintainer-clean -Delete almost everything from the current directory that can be -reconstructed with this Makefile. This typically includes everything -deleted by @code{distclean}, plus more: C source files produced by -Bison, tags tables, Info files, and so on. - -The reason we say ``almost everything'' is that running the command -@samp{make maintainer-clean} should not delete @file{configure} even if -@file{configure} can be remade using a rule in the Makefile. More generally, -@samp{make maintainer-clean} should not delete anything that needs to -exist in order to run @file{configure} and then begin to build the -program. This is the only exception; @code{maintainer-clean} should -delete everything else that can be rebuilt. - -The @samp{maintainer-clean} target is intended to be used by a maintainer of -the package, not by ordinary users. You may need special tools to -reconstruct some of the files that @samp{make maintainer-clean} deletes. -Since these files are normally included in the distribution, we don't -take care to make them easy to reconstruct. If you find you need to -unpack the full distribution again, don't blame us. - -To help make users aware of this, the commands for the special -@code{maintainer-clean} target should start with these two: - -@smallexample -@@echo 'This command is intended for maintainers to use; it' -@@echo 'deletes files that may need special tools to rebuild.' -@end smallexample - -@item TAGS -Update a tags table for this program. -@c ADR: how? - -@item info -Generate any Info files needed. The best way to write the rules is as -follows: - -@smallexample -info: foo.info - -foo.info: foo.texi chap1.texi chap2.texi - $(MAKEINFO) $(srcdir)/foo.texi -@end smallexample - -@noindent -You must define the variable @code{MAKEINFO} in the Makefile. It should -run the @code{makeinfo} program, which is part of the Texinfo -distribution. - -Normally a GNU distribution comes with Info files, and that means the -Info files are present in the source directory. Therefore, the Make -rule for an info file should update it in the source directory. When -users build the package, ordinarily Make will not update the Info files -because they will already be up to date. - -@item dvi -Generate DVI files for all Texinfo documentation. -For example: - -@smallexample -dvi: foo.dvi - -foo.dvi: foo.texi chap1.texi chap2.texi - $(TEXI2DVI) $(srcdir)/foo.texi -@end smallexample - -@noindent -You must define the variable @code{TEXI2DVI} in the Makefile. It should -run the program @code{texi2dvi}, which is part of the Texinfo -distribution.@footnote{@code{texi2dvi} uses @TeX{} to do the real work -of formatting. @TeX{} is not distributed with Texinfo.} Alternatively, -write just the dependencies, and allow GNU @code{make} to provide the command. - -@item dist -Create a distribution tar file for this program. The tar file should be -set up so that the file names in the tar file start with a subdirectory -name which is the name of the package it is a distribution for. This -name can include the version number. - -For example, the distribution tar file of GCC version 1.40 unpacks into -a subdirectory named @file{gcc-1.40}. - -The easiest way to do this is to create a subdirectory appropriately -named, use @code{ln} or @code{cp} to install the proper files in it, and -then @code{tar} that subdirectory. - -Compress the tar file file with @code{gzip}. For example, the actual -distribution file for GCC version 1.40 is called @file{gcc-1.40.tar.gz}. - -The @code{dist} target should explicitly depend on all non-source files -that are in the distribution, to make sure they are up to date in the -distribution. -@ifset CODESTD -@xref{Releases, , Making Releases}. -@end ifset -@ifclear CODESTD -@xref{Releases, , Making Releases, standards, GNU Coding Standards}. -@end ifclear - -@item check -Perform self-tests (if any). The user must build the program before -running the tests, but need not install the program; you should write -the self-tests so that they work when the program is built but not -installed. -@end table - -The following targets are suggested as conventional names, for programs -in which they are useful. - -@table @code -@item installcheck -Perform installation tests (if any). The user must build and install -the program before running the tests. You should not assume that -@file{$(bindir)} is in the search path. - -@item installdirs -It's useful to add a target named @samp{installdirs} to create the -directories where files are installed, and their parent directories. -There is a script called @file{mkinstalldirs} which is convenient for -this; you can find it in the Texinfo package. -@c It's in /gd/gnu/lib/mkinstalldirs. -You can use a rule like this: - -@comment This has been carefully formatted to look decent in the Make manual. -@comment Please be sure not to make it extend any further to the right.--roland -@smallexample -# Make sure all installation directories (e.g. $(bindir)) -# actually exist by making them if necessary. -installdirs: mkinstalldirs - $(srcdir)/mkinstalldirs $(bindir) $(datadir) \ - $(libdir) $(infodir) \ - $(mandir) -@end smallexample - -This rule should not modify the directories where compilation is done. -It should do nothing but create installation directories. -@end table - -@node Install Command Categories -@section Install Command Categories - -@cindex pre-installation commands -@cindex post-installation commands -When writing the @code{install} target, you must classify all the -commands into three categories: normal ones, @dfn{pre-installation} -commands and @dfn{post-installation} commands. - -Normal commands move files into their proper places, and set their -modes. They may not alter any files except the ones that come entirely -from the package they belong to. - -Pre-installation and post-installation commands may alter other files; -in particular, they can edit global configuration files or data bases. - -Pre-installation commands are typically executed before the normal -commands, and post-installation commands are typically run after the -normal commands. - -The most common use for a post-installation command is to run -@code{install-info}. This cannot be done with a normal command, since -it alters a file (the Info directory) which does not come entirely and -solely from the package being installed. It is a post-installation -command because it needs to be done after the normal command which -installs the package's Info files. - -Most programs don't need any pre-installation commands, but we have the -feature just in case it is needed. - -To classify the commands in the @code{install} rule into these three -categories, insert @dfn{category lines} among them. A category line -specifies the category for the commands that follow. - -A category line consists of a tab and a reference to a special Make -variable, plus an optional comment at the end. There are three -variables you can use, one for each category; the variable name -specifies the category. Category lines are no-ops in ordinary execution -because these three Make variables are normally undefined (and you -@emph{should not} define them in the makefile). - -Here are the three possible category lines, each with a comment that -explains what it means: - -@smallexample - $(PRE_INSTALL) # @r{Pre-install commands follow.} - $(POST_INSTALL) # @r{Post-install commands follow.} - $(NORMAL_INSTALL) # @r{Normal commands follow.} -@end smallexample - -If you don't use a category line at the beginning of the @code{install} -rule, all the commands are classified as normal until the first category -line. If you don't use any category lines, all the commands are -classified as normal. - -These are the category lines for @code{uninstall}: - -@smallexample - $(PRE_UNINSTALL) # @r{Pre-uninstall commands follow.} - $(POST_UNINSTALL) # @r{Post-uninstall commands follow.} - $(NORMAL_UNINSTALL) # @r{Normal commands follow.} -@end smallexample - -Typically, a pre-uninstall command would be used for deleting entries -from the Info directory. - -If the @code{install} or @code{uninstall} target has any dependencies -which act as subroutines of installation, then you should start -@emph{each} dependency's commands with a category line, and start the -main target's commands with a category line also. This way, you can -ensure that each command is placed in the right category regardless of -which of the dependencies actually run. - -Pre-installation and post-installation commands should not run any -programs except for these: - -@example -[ basename bash cat chgrp chmod chown cmp cp dd diff echo -egrep expand expr false fgrep find getopt grep gunzip gzip -hostname install install-info kill ldconfig ln ls md5sum -mkdir mkfifo mknod mv printenv pwd rm rmdir sed sort tee -test touch true uname xargs yes -@end example - -@cindex binary packages -The reason for distinguishing the commands in this way is for the sake -of making binary packages. Typically a binary package contains all the -executables and other files that need to be installed, and has its own -method of installing them---so it does not need to run the normal -installation commands. But installing the binary package does need to -execute the pre-installation and post-installation commands. - -Programs to build binary packages work by extracting the -pre-installation and post-installation commands. Here is one way of -extracting the pre-installation commands: - -@smallexample -make -n install -o all \ - PRE_INSTALL=pre-install \ - POST_INSTALL=post-install \ - NORMAL_INSTALL=normal-install \ - | gawk -f pre-install.awk -@end smallexample - -@noindent -where the file @file{pre-install.awk} could contain this: - -@smallexample -$0 ~ /^\t[ \t]*(normal_install|post_install)[ \t]*$/ @{on = 0@} -on @{print $0@} -$0 ~ /^\t[ \t]*pre_install[ \t]*$/ @{on = 1@} -@end smallexample - -The resulting file of pre-installation commands is executed as a shell -script as part of installing the binary package. diff --git a/contrib/binutils/etc/standards.texi b/contrib/binutils/etc/standards.texi deleted file mode 100644 index 910bf8b0479e..000000000000 --- a/contrib/binutils/etc/standards.texi +++ /dev/null @@ -1,3093 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@c %**start of header -@setfilename standards.info -@settitle GNU Coding Standards -@c This date is automagically updated when you save this file: -@set lastupdate March 13, 1998 -@c %**end of header - -@ifinfo -@format -START-INFO-DIR-ENTRY -* Standards: (standards). GNU coding standards. -END-INFO-DIR-ENTRY -@end format -@end ifinfo - -@c @setchapternewpage odd -@setchapternewpage off - -@c This is used by a cross ref in make-stds.texi -@set CODESTD 1 -@iftex -@set CHAPTER chapter -@end iftex -@ifinfo -@set CHAPTER node -@end ifinfo - -@ifinfo -GNU Coding Standards -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). -@end ignore - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Free Software Foundation. -@end ifinfo - -@titlepage -@title GNU Coding Standards -@author Richard Stallman -@author last updated @value{lastupdate} -@page - -@vskip 0pt plus 1filll -Copyright @copyright{} 1992, 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Free Software Foundation. -@end titlepage - -@ifinfo -@node Top, Preface, (dir), (dir) -@top Version - -Last updated @value{lastupdate}. -@end ifinfo - -@menu -* Preface:: About the GNU Coding Standards -* Intellectual Property:: Keeping Free Software Free -* Design Advice:: General Program Design -* Program Behavior:: Program Behavior for All Programs -* Writing C:: Making The Best Use of C -* Documentation:: Documenting Programs -* Managing Releases:: The Release Process -@end menu - -@node Preface -@chapter About the GNU Coding Standards - -The GNU Coding Standards were written by Richard Stallman and other GNU -Project volunteers. Their purpose is to make the GNU system clean, -consistent, and easy to install. This document can also be read as a -guide to writing portable, robust and reliable programs. It focuses on -programs written in C, but many of the rules and principles are useful -even if you write in another programming language. The rules often -state reasons for writing in a certain way. - -Corrections or suggestions for this document should be sent to -@email{gnu@@gnu.org}. If you make a suggestion, please include a -suggested new wording for it; our time is limited. We prefer a context -diff to the @file{standards.texi} or @file{make-stds.texi} files, but if -you don't have those files, please mail your suggestion anyway. - -This release of the GNU Coding Standards was last updated -@value{lastupdate}. - -@node Intellectual Property -@chapter Keeping Free Software Free - -This @value{CHAPTER} discusses how you can make sure that GNU software -remains unencumbered. - -@menu -* Reading Non-Free Code:: Referring to Proprietary Programs -* Contributions:: Accepting Contributions -@end menu - -@node Reading Non-Free Code -@section Referring to Proprietary Programs - -Don't in any circumstances refer to Unix source code for or during -your work on GNU! (Or to any other proprietary programs.) - -If you have a vague recollection of the internals of a Unix program, -this does not absolutely mean you can't write an imitation of it, but -do try to organize the imitation internally along different lines, -because this is likely to make the details of the Unix version -irrelevant and dissimilar to your results. - -For example, Unix utilities were generally optimized to minimize -memory use; if you go for speed instead, your program will be very -different. You could keep the entire input file in core and scan it -there instead of using stdio. Use a smarter algorithm discovered more -recently than the Unix program. Eliminate use of temporary files. Do -it in one pass instead of two (we did this in the assembler). - -Or, on the contrary, emphasize simplicity instead of speed. For some -applications, the speed of today's computers makes simpler algorithms -adequate. - -Or go for generality. For example, Unix programs often have static -tables or fixed-size strings, which make for arbitrary limits; use -dynamic allocation instead. Make sure your program handles NULs and -other funny characters in the input files. Add a programming language -for extensibility and write part of the program in that language. - -Or turn some parts of the program into independently usable libraries. -Or use a simple garbage collector instead of tracking precisely when -to free memory, or use a new GNU facility such as obstacks. - - -@node Contributions -@section Accepting Contributions - -If someone else sends you a piece of code to add to the program you are -working on, we need legal papers to use it---the same sort of legal -papers we will need to get from you. @emph{Each} significant -contributor to a program must sign some sort of legal papers in order -for us to have clear title to the program. The main author alone is not -enough. - -So, before adding in any contributions from other people, please tell -us, so we can arrange to get the papers. Then wait until we tell you -that we have received the signed papers, before you actually use the -contribution. - -This applies both before you release the program and afterward. If -you receive diffs to fix a bug, and they make significant changes, we -need legal papers for that change. - -This also applies to comments and documentation files. For copyright -law, comments and code are just text. Copyright applies to all kinds of -text, so we need legal papers for all kinds. - -You don't need papers for changes of a few lines here or there, since -they are not significant for copyright purposes. Also, you don't need -papers if all you get from the suggestion is some ideas, not actual code -which you use. For example, if you write a different solution to the -problem, you don't need to get papers. - -We know this is frustrating; it's frustrating for us as well. But if -you don't wait, you are going out on a limb---for example, what if the -contributor's employer won't sign a disclaimer? You might have to take -that code out again! - -The very worst thing is if you forget to tell us about the other -contributor. We could be very embarrassed in court some day as a -result. - -We have more detailed advice for maintainers of programs; if you have -reached the stage of actually maintaining a program for GNU (whether -released or not), please ask us for a copy. - -@node Design Advice -@chapter General Program Design - -This @value{CHAPTER} discusses some of the issues you should take into -account when designing your program. - -@menu -* Compatibility:: Compatibility with other implementations -* Using Extensions:: Using non-standard features -* ANSI C:: Using ANSI C features -* Source Language:: Using languages other than C -@end menu - -@node Compatibility -@section Compatibility with Other Implementations - -With occasional exceptions, utility programs and libraries for GNU -should be upward compatible with those in Berkeley Unix, and upward -compatible with @sc{ansi} C if @sc{ansi} C specifies their behavior, and -upward compatible with @sc{POSIX} if @sc{POSIX} specifies their -behavior. - -When these standards conflict, it is useful to offer compatibility -modes for each of them. - -@sc{ansi} C and @sc{POSIX} prohibit many kinds of extensions. Feel free -to make the extensions anyway, and include a @samp{--ansi}, -@samp{--posix}, or @samp{--compatible} option to turn them off. -However, if the extension has a significant chance of breaking any real -programs or scripts, then it is not really upward compatible. Try to -redesign its interface. - -Many GNU programs suppress extensions that conflict with POSIX if the -environment variable @code{POSIXLY_CORRECT} is defined (even if it is -defined with a null value). Please make your program recognize this -variable if appropriate. - -When a feature is used only by users (not by programs or command -files), and it is done poorly in Unix, feel free to replace it -completely with something totally different and better. (For example, -@code{vi} is replaced with Emacs.) But it is nice to offer a compatible -feature as well. (There is a free @code{vi} clone, so we offer it.) - -Additional useful features not in Berkeley Unix are welcome. - -@node Using Extensions -@section Using Non-standard Features - -Many GNU facilities that already exist support a number of convenient -extensions over the comparable Unix facilities. Whether to use these -extensions in implementing your program is a difficult question. - -On the one hand, using the extensions can make a cleaner program. -On the other hand, people will not be able to build the program -unless the other GNU tools are available. This might cause the -program to work on fewer kinds of machines. - -With some extensions, it might be easy to provide both alternatives. -For example, you can define functions with a ``keyword'' @code{INLINE} -and define that as a macro to expand into either @code{inline} or -nothing, depending on the compiler. - -In general, perhaps it is best not to use the extensions if you can -straightforwardly do without them, but to use the extensions if they -are a big improvement. - -An exception to this rule are the large, established programs (such as -Emacs) which run on a great variety of systems. Such programs would -be broken by use of GNU extensions. - -Another exception is for programs that are used as part of -compilation: anything that must be compiled with other compilers in -order to bootstrap the GNU compilation facilities. If these require -the GNU compiler, then no one can compile them without having them -installed already. That would be no good. - -@node ANSI C -@section @sc{ansi} C and pre-@sc{ansi} C - -Do not ever use the ``trigraph'' feature of @sc{ansi} C. - -@sc{ansi} C is widespread enough now that it is ok to write new programs -that use @sc{ansi} C features (and therefore will not work in -non-@sc{ansi} compilers). And if a program is already written in -@sc{ansi} C, there's no need to convert it to support non-@sc{ansi} -compilers. - -However, it is easy to support non-@sc{ansi} compilers in most programs, -so you might still consider doing so when you write a program. Instead -of writing function definitions in @sc{ansi} prototype form, - -@example -int -foo (int x, int y) -@dots{} -@end example - -@noindent -write the definition in pre-@sc{ansi} style like this, - -@example -int -foo (x, y) - int x, y; -@dots{} -@end example - -@noindent -and use a separate declaration to specify the argument prototype: - -@example -int foo (int, int); -@end example - -You need such a declaration anyway, in a header file, to get the benefit -of @sc{ansi} C prototypes in all the files where the function is called. -And once you have it, you lose nothing by writing the function -definition in the pre-@sc{ansi} style. - -If you don't know non-@sc{ansi} C, there's no need to learn it; just -write in @sc{ansi} C. - -@node Source Language -@section Using Languages Other Than C - -Using a language other than C is like using a non-standard feature: it -will cause trouble for users. Even if GCC supports the other language, -users may find it inconvenient to have to install the compiler for that -other language in order to build your program. For example, if you -write your program in C++, people will have to install the C++ compiler -in order to compile your program. Thus, it is better if you write in C. - -But there are three situations when there is no disadvantage in using -some other language: - -@itemize @bullet -@item -It is okay to use another language if your program contains an -interpreter for that language. - -For example, if your program links with GUILE, it is ok to write part of -the program in Scheme or another language supported by GUILE. - -@item -It is okay to use another language in a tool specifically intended for -use with that language. - -This is okay because the only people who want to build the tool will be -those who have installed the other language anyway. - -@item -If an application is of interest to a narrow community, then perhaps -it's not important if the application is inconvenient to install. -@end itemize - -C has one other advantage over C++ and other compiled languages: more -people know C, so more people will find it easy to read and modify the -program if it is written in C. - -@node Program Behavior -@chapter Program Behavior for All Programs - -This @value{CHAPTER} describes how to write robust software. It also -describes general standards for error messages, the command line interface, -and how libraries should behave. - -@menu -* Semantics:: Writing robust programs -* Libraries:: Library behavior -* Errors:: Formatting error messages -* User Interfaces:: Standards for command line interfaces -* Option Table:: Table of long options. -* Memory Usage:: When and how to care about memory needs -@end menu - -@node Semantics -@section Writing Robust Programs - -Avoid arbitrary limits on the length or number of @emph{any} data -structure, including file names, lines, files, and symbols, by allocating -all data structures dynamically. In most Unix utilities, ``long lines -are silently truncated''. This is not acceptable in a GNU utility. - -Utilities reading files should not drop NUL characters, or any other -nonprinting characters @emph{including those with codes above 0177}. The -only sensible exceptions would be utilities specifically intended for -interface to certain types of printers that can't handle those characters. - -Check every system call for an error return, unless you know you wish to -ignore errors. Include the system error text (from @code{perror} or -equivalent) in @emph{every} error message resulting from a failing -system call, as well as the name of the file if any and the name of the -utility. Just ``cannot open foo.c'' or ``stat failed'' is not -sufficient. - -Check every call to @code{malloc} or @code{realloc} to see if it -returned zero. Check @code{realloc} even if you are making the block -smaller; in a system that rounds block sizes to a power of 2, -@code{realloc} may get a different block if you ask for less space. - -In Unix, @code{realloc} can destroy the storage block if it returns -zero. GNU @code{realloc} does not have this bug: if it fails, the -original block is unchanged. Feel free to assume the bug is fixed. If -you wish to run your program on Unix, and wish to avoid lossage in this -case, you can use the GNU @code{malloc}. - -You must expect @code{free} to alter the contents of the block that was -freed. Anything you want to fetch from the block, you must fetch before -calling @code{free}. - -If @code{malloc} fails in a noninteractive program, make that a fatal -error. In an interactive program (one that reads commands from the -user), it is better to abort the command and return to the command -reader loop. This allows the user to kill other processes to free up -virtual memory, and then try the command again. - -Use @code{getopt_long} to decode arguments, unless the argument syntax -makes this unreasonable. - -When static storage is to be written in during program execution, use -explicit C code to initialize it. Reserve C initialized declarations -for data that will not be changed. -@c ADR: why? - -Try to avoid low-level interfaces to obscure Unix data structures (such -as file directories, utmp, or the layout of kernel memory), since these -are less likely to work compatibly. If you need to find all the files -in a directory, use @code{readdir} or some other high-level interface. -These will be supported compatibly by GNU. - -By default, the GNU system will provide the signal handling functions of -@sc{BSD} and of @sc{POSIX}. So GNU software should be written to use -these. - -In error checks that detect ``impossible'' conditions, just abort. -There is usually no point in printing any message. These checks -indicate the existence of bugs. Whoever wants to fix the bugs will have -to read the source code and run a debugger. So explain the problem with -comments in the source. The relevant data will be in variables, which -are easy to examine with the debugger, so there is no point moving them -elsewhere. - -Do not use a count of errors as the exit status for a program. -@emph{That does not work}, because exit status values are limited to 8 -bits (0 through 255). A single run of the program might have 256 -errors; if you try to return 256 as the exit status, the parent process -will see 0 as the status, and it will appear that the program succeeded. - -If you make temporary files, check the @code{TMPDIR} environment -variable; if that variable is defined, use the specified directory -instead of @file{/tmp}. - -@node Libraries -@section Library Behavior - -Try to make library functions reentrant. If they need to do dynamic -storage allocation, at least try to avoid any nonreentrancy aside from -that of @code{malloc} itself. - -Here are certain name conventions for libraries, to avoid name -conflicts. - -Choose a name prefix for the library, more than two characters long. -All external function and variable names should start with this -prefix. In addition, there should only be one of these in any given -library member. This usually means putting each one in a separate -source file. - -An exception can be made when two external symbols are always used -together, so that no reasonable program could use one without the -other; then they can both go in the same file. - -External symbols that are not documented entry points for the user -should have names beginning with @samp{_}. They should also contain -the chosen name prefix for the library, to prevent collisions with -other libraries. These can go in the same files with user entry -points if you like. - -Static functions and variables can be used as you like and need not -fit any naming convention. - -@node Errors -@section Formatting Error Messages - -Error messages from compilers should look like this: - -@example -@var{source-file-name}:@var{lineno}: @var{message} -@end example - -Error messages from other noninteractive programs should look like this: - -@example -@var{program}:@var{source-file-name}:@var{lineno}: @var{message} -@end example - -@noindent -when there is an appropriate source file, or like this: - -@example -@var{program}: @var{message} -@end example - -@noindent -when there is no relevant source file. - -In an interactive program (one that is reading commands from a -terminal), it is better not to include the program name in an error -message. The place to indicate which program is running is in the -prompt or with the screen layout. (When the same program runs with -input from a source other than a terminal, it is not interactive and -would do best to print error messages using the noninteractive style.) - -The string @var{message} should not begin with a capital letter when -it follows a program name and/or file name. Also, it should not end -with a period. - -Error messages from interactive programs, and other messages such as -usage messages, should start with a capital letter. But they should not -end with a period. - -@node User Interfaces -@section Standards for Command Line Interfaces - -Please don't make the behavior of a utility depend on the name used -to invoke it. It is useful sometimes to make a link to a utility -with a different name, and that should not change what it does. - -Instead, use a run time option or a compilation switch or both -to select among the alternate behaviors. - -Likewise, please don't make the behavior of the program depend on the -type of output device it is used with. Device independence is an -important principle of the system's design; do not compromise it -merely to save someone from typing an option now and then. - -If you think one behavior is most useful when the output is to a -terminal, and another is most useful when the output is a file or a -pipe, then it is usually best to make the default behavior the one that -is useful with output to a terminal, and have an option for the other -behavior. - -Compatibility requires certain programs to depend on the type of output -device. It would be disastrous if @code{ls} or @code{sh} did not do so -in the way all users expect. In some of these cases, we supplement the -program with a preferred alternate version that does not depend on the -output device type. For example, we provide a @code{dir} program much -like @code{ls} except that its default output format is always -multi-column format. - -It is a good idea to follow the @sc{POSIX} guidelines for the -command-line options of a program. The easiest way to do this is to use -@code{getopt} to parse them. Note that the GNU version of @code{getopt} -will normally permit options anywhere among the arguments unless the -special argument @samp{--} is used. This is not what @sc{POSIX} -specifies; it is a GNU extension. - -Please define long-named options that are equivalent to the -single-letter Unix-style options. We hope to make GNU more user -friendly this way. This is easy to do with the GNU function -@code{getopt_long}. - -One of the advantages of long-named options is that they can be -consistent from program to program. For example, users should be able -to expect the ``verbose'' option of any GNU program which has one, to be -spelled precisely @samp{--verbose}. To achieve this uniformity, look at -the table of common long-option names when you choose the option names -for your program (@pxref{Option Table}). - -It is usually a good idea for file names given as ordinary arguments to -be input files only; any output files would be specified using options -(preferably @samp{-o} or @samp{--output}). Even if you allow an output -file name as an ordinary argument for compatibility, try to provide an -option as another way to specify it. This will lead to more consistency -among GNU utilities, and fewer idiosyncracies for users to remember. - -All programs should support two standard options: @samp{--version} -and @samp{--help}. - -@table @code -@item --version -This option should direct the program to information about its name, -version, origin and legal status, all on standard output, and then exit -successfully. Other options and arguments should be ignored once this -is seen, and the program should not perform its normal function. - -The first line is meant to be easy for a program to parse; the version -number proper starts after the last space. In addition, it contains -the canonical name for this program, in this format: - -@example -GNU Emacs 19.30 -@end example - -@noindent -The program's name should be a constant string; @emph{don't} compute it -from @code{argv[0]}. The idea is to state the standard or canonical -name for the program, not its file name. There are other ways to find -out the precise file name where a command is found in @code{PATH}. - -If the program is a subsidiary part of a larger package, mention the -package name in parentheses, like this: - -@example -emacsserver (GNU Emacs) 19.30 -@end example - -@noindent -If the package has a version number which is different from this -program's version number, you can mention the package version number -just before the close-parenthesis. - -If you @strong{need} to mention the version numbers of libraries which -are distributed separately from the package which contains this program, -you can do so by printing an additional line of version info for each -library you want to mention. Use the same format for these lines as for -the first line. - -Please do not mention all of the libraries that the program uses ``just -for completeness''---that would produce a lot of unhelpful clutter. -Please mention library version numbers only if you find in practice that -they are very important to you in debugging. - -The following line, after the version number line or lines, should be a -copyright notice. If more than one copyright notice is called for, put -each on a separate line. - -Next should follow a brief statement that the program is free software, -and that users are free to copy and change it on certain conditions. If -the program is covered by the GNU GPL, say so here. Also mention that -there is no warranty, to the extent permitted by law. - -It is ok to finish the output with a list of the major authors of the -program, as a way of giving credit. - -Here's an example of output that follows these rules: - -@smallexample -GNU Emacs 19.34.5 -Copyright (C) 1996 Free Software Foundation, Inc. -GNU Emacs comes with NO WARRANTY, -to the extent permitted by law. -You may redistribute copies of GNU Emacs -under the terms of the GNU General Public License. -For more information about these matters, -see the files named COPYING. -@end smallexample - -You should adapt this to your program, of course, filling in the proper -year, copyright holder, name of program, and the references to -distribution terms, and changing the rest of the wording as necessary. - -This copyright notice only needs to mention the most recent year in -which changes were made---there's no need to list the years for previous -versions' changes. You don't have to mention the name of the program in -these notices, if that is inconvenient, since it appeared in the first -line. - -@item --help -This option should output brief documentation for how to invoke the -program, on standard output, then exit successfully. Other options and -arguments should be ignored once this is seen, and the program should -not perform its normal function. - -Near the end of the @samp{--help} option's output there should be a line -that says where to mail bug reports. It should have this format: - -@example -Report bugs to @var{mailing-address}. -@end example -@end table - -@node Option Table -@section Table of Long Options - -Here is a table of long options used by GNU programs. It is surely -incomplete, but we aim to list all the options that a new program might -want to be compatible with. If you use names not already in the table, -please send @email{gnu@@gnu.org} a list of them, with their -meanings, so we can update the table. - -@c Please leave newlines between items in this table; it's much easier -@c to update when it isn't completely squashed together and unreadable. -@c When there is more than one short option for a long option name, put -@c a semicolon between the lists of the programs that use them, not a -@c period. --friedman - -@table @samp -@item after-date -@samp{-N} in @code{tar}. - -@item all -@samp{-a} in @code{du}, @code{ls}, @code{nm}, @code{stty}, @code{uname}, -and @code{unexpand}. - -@item all-text -@samp{-a} in @code{diff}. - -@item almost-all -@samp{-A} in @code{ls}. - -@item append -@samp{-a} in @code{etags}, @code{tee}, @code{time}; -@samp{-r} in @code{tar}. - -@item archive -@samp{-a} in @code{cp}. - -@item archive-name -@samp{-n} in @code{shar}. - -@item arglength -@samp{-l} in @code{m4}. - -@item ascii -@samp{-a} in @code{diff}. - -@item assign -@samp{-v} in @code{gawk}. - -@item assume-new -@samp{-W} in Make. - -@item assume-old -@samp{-o} in Make. - -@item auto-check -@samp{-a} in @code{recode}. - -@item auto-pager -@samp{-a} in @code{wdiff}. - -@item auto-reference -@samp{-A} in @code{ptx}. - -@item avoid-wraps -@samp{-n} in @code{wdiff}. - -@item backward-search -@samp{-B} in @code{ctags}. - -@item basename -@samp{-f} in @code{shar}. - -@item batch -Used in GDB. - -@item baud -Used in GDB. - -@item before -@samp{-b} in @code{tac}. - -@item binary -@samp{-b} in @code{cpio} and @code{diff}. - -@item bits-per-code -@samp{-b} in @code{shar}. - -@item block-size -Used in @code{cpio} and @code{tar}. - -@item blocks -@samp{-b} in @code{head} and @code{tail}. - -@item break-file -@samp{-b} in @code{ptx}. - -@item brief -Used in various programs to make output shorter. - -@item bytes -@samp{-c} in @code{head}, @code{split}, and @code{tail}. - -@item c@t{++} -@samp{-C} in @code{etags}. - -@item catenate -@samp{-A} in @code{tar}. - -@item cd -Used in various programs to specify the directory to use. - -@item changes -@samp{-c} in @code{chgrp} and @code{chown}. - -@item classify -@samp{-F} in @code{ls}. - -@item colons -@samp{-c} in @code{recode}. - -@item command -@samp{-c} in @code{su}; -@samp{-x} in GDB. - -@item compare -@samp{-d} in @code{tar}. - -@item compat -Used in @code{gawk}. - -@item compress -@samp{-Z} in @code{tar} and @code{shar}. - -@item concatenate -@samp{-A} in @code{tar}. - -@item confirmation -@samp{-w} in @code{tar}. - -@item context -Used in @code{diff}. - -@item copyleft -@samp{-W copyleft} in @code{gawk}. - -@item copyright -@samp{-C} in @code{ptx}, @code{recode}, and @code{wdiff}; -@samp{-W copyright} in @code{gawk}. - -@item core -Used in GDB. - -@item count -@samp{-q} in @code{who}. - -@item count-links -@samp{-l} in @code{du}. - -@item create -Used in @code{tar} and @code{cpio}. - -@item cut-mark -@samp{-c} in @code{shar}. - -@item cxref -@samp{-x} in @code{ctags}. - -@item date -@samp{-d} in @code{touch}. - -@item debug -@samp{-d} in Make and @code{m4}; -@samp{-t} in Bison. - -@item define -@samp{-D} in @code{m4}. - -@item defines -@samp{-d} in Bison and @code{ctags}. - -@item delete -@samp{-D} in @code{tar}. - -@item dereference -@samp{-L} in @code{chgrp}, @code{chown}, @code{cpio}, @code{du}, -@code{ls}, and @code{tar}. - -@item dereference-args -@samp{-D} in @code{du}. - -@item diacritics -@samp{-d} in @code{recode}. - -@item dictionary-order -@samp{-d} in @code{look}. - -@item diff -@samp{-d} in @code{tar}. - -@item digits -@samp{-n} in @code{csplit}. - -@item directory -Specify the directory to use, in various programs. In @code{ls}, it -means to show directories themselves rather than their contents. In -@code{rm} and @code{ln}, it means to not treat links to directories -specially. - -@item discard-all -@samp{-x} in @code{strip}. - -@item discard-locals -@samp{-X} in @code{strip}. - -@item dry-run -@samp{-n} in Make. - -@item ed -@samp{-e} in @code{diff}. - -@item elide-empty-files -@samp{-z} in @code{csplit}. - -@item end-delete -@samp{-x} in @code{wdiff}. - -@item end-insert -@samp{-z} in @code{wdiff}. - -@item entire-new-file -@samp{-N} in @code{diff}. - -@item environment-overrides -@samp{-e} in Make. - -@item eof -@samp{-e} in @code{xargs}. - -@item epoch -Used in GDB. - -@item error-limit -Used in @code{makeinfo}. - -@item error-output -@samp{-o} in @code{m4}. - -@item escape -@samp{-b} in @code{ls}. - -@item exclude-from -@samp{-X} in @code{tar}. - -@item exec -Used in GDB. - -@item exit -@samp{-x} in @code{xargs}. - -@item exit-0 -@samp{-e} in @code{unshar}. - -@item expand-tabs -@samp{-t} in @code{diff}. - -@item expression -@samp{-e} in @code{sed}. - -@item extern-only -@samp{-g} in @code{nm}. - -@item extract -@samp{-i} in @code{cpio}; -@samp{-x} in @code{tar}. - -@item faces -@samp{-f} in @code{finger}. - -@item fast -@samp{-f} in @code{su}. - -@item fatal-warnings -@samp{-E} in @code{m4}. - -@item file -@samp{-f} in @code{info}, @code{gawk}, Make, @code{mt}, and @code{tar}; -@samp{-n} in @code{sed}; -@samp{-r} in @code{touch}. - -@item field-separator -@samp{-F} in @code{gawk}. - -@item file-prefix -@samp{-b} in Bison. - -@item file-type -@samp{-F} in @code{ls}. - -@item files-from -@samp{-T} in @code{tar}. - -@item fill-column -Used in @code{makeinfo}. - -@item flag-truncation -@samp{-F} in @code{ptx}. - -@item fixed-output-files -@samp{-y} in Bison. - -@item follow -@samp{-f} in @code{tail}. - -@item footnote-style -Used in @code{makeinfo}. - -@item force -@samp{-f} in @code{cp}, @code{ln}, @code{mv}, and @code{rm}. - -@item force-prefix -@samp{-F} in @code{shar}. - -@item format -Used in @code{ls}, @code{time}, and @code{ptx}. - -@item freeze-state -@samp{-F} in @code{m4}. - -@item fullname -Used in GDB. - -@item gap-size -@samp{-g} in @code{ptx}. - -@item get -@samp{-x} in @code{tar}. - -@item graphic -@samp{-i} in @code{ul}. - -@item graphics -@samp{-g} in @code{recode}. - -@item group -@samp{-g} in @code{install}. - -@item gzip -@samp{-z} in @code{tar} and @code{shar}. - -@item hashsize -@samp{-H} in @code{m4}. - -@item header -@samp{-h} in @code{objdump} and @code{recode} - -@item heading -@samp{-H} in @code{who}. - -@item help -Used to ask for brief usage information. - -@item here-delimiter -@samp{-d} in @code{shar}. - -@item hide-control-chars -@samp{-q} in @code{ls}. - -@item idle -@samp{-u} in @code{who}. - -@item ifdef -@samp{-D} in @code{diff}. - -@item ignore -@samp{-I} in @code{ls}; -@samp{-x} in @code{recode}. - -@item ignore-all-space -@samp{-w} in @code{diff}. - -@item ignore-backups -@samp{-B} in @code{ls}. - -@item ignore-blank-lines -@samp{-B} in @code{diff}. - -@item ignore-case -@samp{-f} in @code{look} and @code{ptx}; -@samp{-i} in @code{diff} and @code{wdiff}. - -@item ignore-errors -@samp{-i} in Make. - -@item ignore-file -@samp{-i} in @code{ptx}. - -@item ignore-indentation -@samp{-I} in @code{etags}. - -@item ignore-init-file -@samp{-f} in Oleo. - -@item ignore-interrupts -@samp{-i} in @code{tee}. - -@item ignore-matching-lines -@samp{-I} in @code{diff}. - -@item ignore-space-change -@samp{-b} in @code{diff}. - -@item ignore-zeros -@samp{-i} in @code{tar}. - -@item include -@samp{-i} in @code{etags}; -@samp{-I} in @code{m4}. - -@item include-dir -@samp{-I} in Make. - -@item incremental -@samp{-G} in @code{tar}. - -@item info -@samp{-i}, @samp{-l}, and @samp{-m} in Finger. - -@item initial -@samp{-i} in @code{expand}. - -@item initial-tab -@samp{-T} in @code{diff}. - -@item inode -@samp{-i} in @code{ls}. - -@item interactive -@samp{-i} in @code{cp}, @code{ln}, @code{mv}, @code{rm}; -@samp{-e} in @code{m4}; -@samp{-p} in @code{xargs}; -@samp{-w} in @code{tar}. - -@item intermix-type -@samp{-p} in @code{shar}. - -@item jobs -@samp{-j} in Make. - -@item just-print -@samp{-n} in Make. - -@item keep-going -@samp{-k} in Make. - -@item keep-files -@samp{-k} in @code{csplit}. - -@item kilobytes -@samp{-k} in @code{du} and @code{ls}. - -@item language -@samp{-l} in @code{etags}. - -@item less-mode -@samp{-l} in @code{wdiff}. - -@item level-for-gzip -@samp{-g} in @code{shar}. - -@item line-bytes -@samp{-C} in @code{split}. - -@item lines -Used in @code{split}, @code{head}, and @code{tail}. - -@item link -@samp{-l} in @code{cpio}. - -@item lint -@itemx lint-old -Used in @code{gawk}. - -@item list -@samp{-t} in @code{cpio}; -@samp{-l} in @code{recode}. - -@item list -@samp{-t} in @code{tar}. - -@item literal -@samp{-N} in @code{ls}. - -@item load-average -@samp{-l} in Make. - -@item login -Used in @code{su}. - -@item machine -No listing of which programs already use this; -someone should check to -see if any actually do, and tell @email{gnu@@gnu.org}. - -@item macro-name -@samp{-M} in @code{ptx}. - -@item mail -@samp{-m} in @code{hello} and @code{uname}. - -@item make-directories -@samp{-d} in @code{cpio}. - -@item makefile -@samp{-f} in Make. - -@item mapped -Used in GDB. - -@item max-args -@samp{-n} in @code{xargs}. - -@item max-chars -@samp{-n} in @code{xargs}. - -@item max-lines -@samp{-l} in @code{xargs}. - -@item max-load -@samp{-l} in Make. - -@item max-procs -@samp{-P} in @code{xargs}. - -@item mesg -@samp{-T} in @code{who}. - -@item message -@samp{-T} in @code{who}. - -@item minimal -@samp{-d} in @code{diff}. - -@item mixed-uuencode -@samp{-M} in @code{shar}. - -@item mode -@samp{-m} in @code{install}, @code{mkdir}, and @code{mkfifo}. - -@item modification-time -@samp{-m} in @code{tar}. - -@item multi-volume -@samp{-M} in @code{tar}. - -@item name-prefix -@samp{-a} in Bison. - -@item nesting-limit -@samp{-L} in @code{m4}. - -@item net-headers -@samp{-a} in @code{shar}. - -@item new-file -@samp{-W} in Make. - -@item no-builtin-rules -@samp{-r} in Make. - -@item no-character-count -@samp{-w} in @code{shar}. - -@item no-check-existing -@samp{-x} in @code{shar}. - -@item no-common -@samp{-3} in @code{wdiff}. - -@item no-create -@samp{-c} in @code{touch}. - -@item no-defines -@samp{-D} in @code{etags}. - -@item no-deleted -@samp{-1} in @code{wdiff}. - -@item no-dereference -@samp{-d} in @code{cp}. - -@item no-inserted -@samp{-2} in @code{wdiff}. - -@item no-keep-going -@samp{-S} in Make. - -@item no-lines -@samp{-l} in Bison. - -@item no-piping -@samp{-P} in @code{shar}. - -@item no-prof -@samp{-e} in @code{gprof}. - -@item no-regex -@samp{-R} in @code{etags}. - -@item no-sort -@samp{-p} in @code{nm}. - -@item no-split -Used in @code{makeinfo}. - -@item no-static -@samp{-a} in @code{gprof}. - -@item no-time -@samp{-E} in @code{gprof}. - -@item no-timestamp -@samp{-m} in @code{shar}. - -@item no-validate -Used in @code{makeinfo}. - -@item no-wait -Used in @code{emacsclient}. - -@item no-warn -Used in various programs to inhibit warnings. - -@item node -@samp{-n} in @code{info}. - -@item nodename -@samp{-n} in @code{uname}. - -@item nonmatching -@samp{-f} in @code{cpio}. - -@item nstuff -@samp{-n} in @code{objdump}. - -@item null -@samp{-0} in @code{xargs}. - -@item number -@samp{-n} in @code{cat}. - -@item number-nonblank -@samp{-b} in @code{cat}. - -@item numeric-sort -@samp{-n} in @code{nm}. - -@item numeric-uid-gid -@samp{-n} in @code{cpio} and @code{ls}. - -@item nx -Used in GDB. - -@item old-archive -@samp{-o} in @code{tar}. - -@item old-file -@samp{-o} in Make. - -@item one-file-system -@samp{-l} in @code{tar}, @code{cp}, and @code{du}. - -@item only-file -@samp{-o} in @code{ptx}. - -@item only-prof -@samp{-f} in @code{gprof}. - -@item only-time -@samp{-F} in @code{gprof}. - -@item output -In various programs, specify the output file name. - -@item output-prefix -@samp{-o} in @code{shar}. - -@item override -@samp{-o} in @code{rm}. - -@item overwrite -@samp{-c} in @code{unshar}. - -@item owner -@samp{-o} in @code{install}. - -@item paginate -@samp{-l} in @code{diff}. - -@item paragraph-indent -Used in @code{makeinfo}. - -@item parents -@samp{-p} in @code{mkdir} and @code{rmdir}. - -@item pass-all -@samp{-p} in @code{ul}. - -@item pass-through -@samp{-p} in @code{cpio}. - -@item port -@samp{-P} in @code{finger}. - -@item portability -@samp{-c} in @code{cpio} and @code{tar}. - -@item posix -Used in @code{gawk}. - -@item prefix-builtins -@samp{-P} in @code{m4}. - -@item prefix -@samp{-f} in @code{csplit}. - -@item preserve -Used in @code{tar} and @code{cp}. - -@item preserve-environment -@samp{-p} in @code{su}. - -@item preserve-modification-time -@samp{-m} in @code{cpio}. - -@item preserve-order -@samp{-s} in @code{tar}. - -@item preserve-permissions -@samp{-p} in @code{tar}. - -@item print -@samp{-l} in @code{diff}. - -@item print-chars -@samp{-L} in @code{cmp}. - -@item print-data-base -@samp{-p} in Make. - -@item print-directory -@samp{-w} in Make. - -@item print-file-name -@samp{-o} in @code{nm}. - -@item print-symdefs -@samp{-s} in @code{nm}. - -@item printer -@samp{-p} in @code{wdiff}. - -@item prompt -@samp{-p} in @code{ed}. - -@item query-user -@samp{-X} in @code{shar}. - -@item question -@samp{-q} in Make. - -@item quiet -Used in many programs to inhibit the usual output. @strong{Note:} every -program accepting @samp{--quiet} should accept @samp{--silent} as a -synonym. - -@item quiet-unshar -@samp{-Q} in @code{shar} - -@item quote-name -@samp{-Q} in @code{ls}. - -@item rcs -@samp{-n} in @code{diff}. - -@item re-interval -Used in @code{gawk}. - -@item read-full-blocks -@samp{-B} in @code{tar}. - -@item readnow -Used in GDB. - -@item recon -@samp{-n} in Make. - -@item record-number -@samp{-R} in @code{tar}. - -@item recursive -Used in @code{chgrp}, @code{chown}, @code{cp}, @code{ls}, @code{diff}, -and @code{rm}. - -@item reference-limit -Used in @code{makeinfo}. - -@item references -@samp{-r} in @code{ptx}. - -@item regex -@samp{-r} in @code{tac} and @code{etags}. - -@item release -@samp{-r} in @code{uname}. - -@item reload-state -@samp{-R} in @code{m4}. - -@item relocation -@samp{-r} in @code{objdump}. - -@item rename -@samp{-r} in @code{cpio}. - -@item replace -@samp{-i} in @code{xargs}. - -@item report-identical-files -@samp{-s} in @code{diff}. - -@item reset-access-time -@samp{-a} in @code{cpio}. - -@item reverse -@samp{-r} in @code{ls} and @code{nm}. - -@item reversed-ed -@samp{-f} in @code{diff}. - -@item right-side-defs -@samp{-R} in @code{ptx}. - -@item same-order -@samp{-s} in @code{tar}. - -@item same-permissions -@samp{-p} in @code{tar}. - -@item save -@samp{-g} in @code{stty}. - -@item se -Used in GDB. - -@item sentence-regexp -@samp{-S} in @code{ptx}. - -@item separate-dirs -@samp{-S} in @code{du}. - -@item separator -@samp{-s} in @code{tac}. - -@item sequence -Used by @code{recode} to chose files or pipes for sequencing passes. - -@item shell -@samp{-s} in @code{su}. - -@item show-all -@samp{-A} in @code{cat}. - -@item show-c-function -@samp{-p} in @code{diff}. - -@item show-ends -@samp{-E} in @code{cat}. - -@item show-function-line -@samp{-F} in @code{diff}. - -@item show-tabs -@samp{-T} in @code{cat}. - -@item silent -Used in many programs to inhibit the usual output. -@strong{Note:} every program accepting -@samp{--silent} should accept @samp{--quiet} as a synonym. - -@item size -@samp{-s} in @code{ls}. - -@item sort -Used in @code{ls}. - -@item source -@samp{-W source} in @code{gawk}. - -@item sparse -@samp{-S} in @code{tar}. - -@item speed-large-files -@samp{-H} in @code{diff}. - -@item split-at -@samp{-E} in @code{unshar}. - -@item split-size-limit -@samp{-L} in @code{shar}. - -@item squeeze-blank -@samp{-s} in @code{cat}. - -@item start-delete -@samp{-w} in @code{wdiff}. - -@item start-insert -@samp{-y} in @code{wdiff}. - -@item starting-file -Used in @code{tar} and @code{diff} to specify which file within -a directory to start processing with. - -@item statistics -@samp{-s} in @code{wdiff}. - -@item stdin-file-list -@samp{-S} in @code{shar}. - -@item stop -@samp{-S} in Make. - -@item strict -@samp{-s} in @code{recode}. - -@item strip -@samp{-s} in @code{install}. - -@item strip-all -@samp{-s} in @code{strip}. - -@item strip-debug -@samp{-S} in @code{strip}. - -@item submitter -@samp{-s} in @code{shar}. - -@item suffix -@samp{-S} in @code{cp}, @code{ln}, @code{mv}. - -@item suffix-format -@samp{-b} in @code{csplit}. - -@item sum -@samp{-s} in @code{gprof}. - -@item summarize -@samp{-s} in @code{du}. - -@item symbolic -@samp{-s} in @code{ln}. - -@item symbols -Used in GDB and @code{objdump}. - -@item synclines -@samp{-s} in @code{m4}. - -@item sysname -@samp{-s} in @code{uname}. - -@item tabs -@samp{-t} in @code{expand} and @code{unexpand}. - -@item tabsize -@samp{-T} in @code{ls}. - -@item terminal -@samp{-T} in @code{tput} and @code{ul}. -@samp{-t} in @code{wdiff}. - -@item text -@samp{-a} in @code{diff}. - -@item text-files -@samp{-T} in @code{shar}. - -@item time -Used in @code{ls} and @code{touch}. - -@item to-stdout -@samp{-O} in @code{tar}. - -@item total -@samp{-c} in @code{du}. - -@item touch -@samp{-t} in Make, @code{ranlib}, and @code{recode}. - -@item trace -@samp{-t} in @code{m4}. - -@item traditional -@samp{-t} in @code{hello}; -@samp{-W traditional} in @code{gawk}; -@samp{-G} in @code{ed}, @code{m4}, and @code{ptx}. - -@item tty -Used in GDB. - -@item typedefs -@samp{-t} in @code{ctags}. - -@item typedefs-and-c++ -@samp{-T} in @code{ctags}. - -@item typeset-mode -@samp{-t} in @code{ptx}. - -@item uncompress -@samp{-z} in @code{tar}. - -@item unconditional -@samp{-u} in @code{cpio}. - -@item undefine -@samp{-U} in @code{m4}. - -@item undefined-only -@samp{-u} in @code{nm}. - -@item update -@samp{-u} in @code{cp}, @code{ctags}, @code{mv}, @code{tar}. - -@item usage -Used in @code{gawk}; same as @samp{--help}. - -@item uuencode -@samp{-B} in @code{shar}. - -@item vanilla-operation -@samp{-V} in @code{shar}. - -@item verbose -Print more information about progress. Many programs support this. - -@item verify -@samp{-W} in @code{tar}. - -@item version -Print the version number. - -@item version-control -@samp{-V} in @code{cp}, @code{ln}, @code{mv}. - -@item vgrind -@samp{-v} in @code{ctags}. - -@item volume -@samp{-V} in @code{tar}. - -@item what-if -@samp{-W} in Make. - -@item whole-size-limit -@samp{-l} in @code{shar}. - -@item width -@samp{-w} in @code{ls} and @code{ptx}. - -@item word-regexp -@samp{-W} in @code{ptx}. - -@item writable -@samp{-T} in @code{who}. - -@item zeros -@samp{-z} in @code{gprof}. -@end table - -@node Memory Usage -@section Memory Usage - -If it typically uses just a few meg of memory, don't bother making any -effort to reduce memory usage. For example, if it is impractical for -other reasons to operate on files more than a few meg long, it is -reasonable to read entire input files into core to operate on them. - -However, for programs such as @code{cat} or @code{tail}, that can -usefully operate on very large files, it is important to avoid using a -technique that would artificially limit the size of files it can handle. -If a program works by lines and could be applied to arbitrary -user-supplied input files, it should keep only a line in memory, because -this is not very hard and users will want to be able to operate on input -files that are bigger than will fit in core all at once. - -If your program creates complicated data structures, just make them in -core and give a fatal error if @code{malloc} returns zero. - -@node Writing C -@chapter Making The Best Use of C - -This @value{CHAPTER} provides advice on how best to use the C language -when writing GNU software. - -@menu -* Formatting:: Formatting Your Source Code -* Comments:: Commenting Your Work -* Syntactic Conventions:: Clean Use of C Constructs -* Names:: Naming Variables and Functions -* System Portability:: Portability between different operating systems -* CPU Portability:: Supporting the range of CPU types -* System Functions:: Portability and ``standard'' library functions -* Internationalization:: Techniques for internationalization -* Mmap:: How you can safely use @code{mmap}. -@end menu - -@node Formatting -@section Formatting Your Source Code - -It is important to put the open-brace that starts the body of a C -function in column zero, and avoid putting any other open-brace or -open-parenthesis or open-bracket in column zero. Several tools look -for open-braces in column zero to find the beginnings of C functions. -These tools will not work on code not formatted that way. - -It is also important for function definitions to start the name of the -function in column zero. This helps people to search for function -definitions, and may also help certain tools recognize them. Thus, -the proper format is this: - -@example -static char * -concat (s1, s2) /* Name starts in column zero here */ - char *s1, *s2; -@{ /* Open brace in column zero here */ - @dots{} -@} -@end example - -@noindent -or, if you want to use @sc{ansi} C, format the definition like this: - -@example -static char * -concat (char *s1, char *s2) -@{ - @dots{} -@} -@end example - -In @sc{ansi} C, if the arguments don't fit nicely on one line, -split it like this: - -@example -int -lots_of_args (int an_integer, long a_long, short a_short, - double a_double, float a_float) -@dots{} -@end example - -For the body of the function, we prefer code formatted like this: - -@example -if (x < foo (y, z)) - haha = bar[4] + 5; -else - @{ - while (z) - @{ - haha += foo (z, z); - z--; - @} - return ++x + bar (); - @} -@end example - -We find it easier to read a program when it has spaces before the -open-parentheses and after the commas. Especially after the commas. - -When you split an expression into multiple lines, split it -before an operator, not after one. Here is the right way: - -@example -if (foo_this_is_long && bar > win (x, y, z) - && remaining_condition) -@end example - -Try to avoid having two operators of different precedence at the same -level of indentation. For example, don't write this: - -@example -mode = (inmode[j] == VOIDmode - || GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j]) - ? outmode[j] : inmode[j]); -@end example - -Instead, use extra parentheses so that the indentation shows the nesting: - -@example -mode = ((inmode[j] == VOIDmode - || (GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j]))) - ? outmode[j] : inmode[j]); -@end example - -Insert extra parentheses so that Emacs will indent the code properly. -For example, the following indentation looks nice if you do it by hand, -but Emacs would mess it up: - -@example -v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 - + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000; -@end example - -But adding a set of parentheses solves the problem: - -@example -v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 - + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000); -@end example - -Format do-while statements like this: - -@example -do - @{ - a = foo (a); - @} -while (a > 0); -@end example - -Please use formfeed characters (control-L) to divide the program into -pages at logical places (but not within a function). It does not matter -just how long the pages are, since they do not have to fit on a printed -page. The formfeeds should appear alone on lines by themselves. - - -@node Comments -@section Commenting Your Work - -Every program should start with a comment saying briefly what it is for. -Example: @samp{fmt - filter for simple filling of text}. - -Please write the comments in a GNU program in English, because English -is the one language that nearly all programmers in all countries can -read. If you do not write English well, please write comments in -English as well as you can, then ask other people to help rewrite them. -If you can't write comments in English, please find someone to work with -you and translate your comments into English. - -Please put a comment on each function saying what the function does, -what sorts of arguments it gets, and what the possible values of -arguments mean and are used for. It is not necessary to duplicate in -words the meaning of the C argument declarations, if a C type is being -used in its customary fashion. If there is anything nonstandard about -its use (such as an argument of type @code{char *} which is really the -address of the second character of a string, not the first), or any -possible values that would not work the way one would expect (such as, -that strings containing newlines are not guaranteed to work), be sure -to say so. - -Also explain the significance of the return value, if there is one. - -Please put two spaces after the end of a sentence in your comments, so -that the Emacs sentence commands will work. Also, please write -complete sentences and capitalize the first word. If a lower-case -identifier comes at the beginning of a sentence, don't capitalize it! -Changing the spelling makes it a different identifier. If you don't -like starting a sentence with a lower case letter, write the sentence -differently (e.g., ``The identifier lower-case is @dots{}''). - -The comment on a function is much clearer if you use the argument -names to speak about the argument values. The variable name itself -should be lower case, but write it in upper case when you are speaking -about the value rather than the variable itself. Thus, ``the inode -number NODE_NUM'' rather than ``an inode''. - -There is usually no purpose in restating the name of the function in -the comment before it, because the reader can see that for himself. -There might be an exception when the comment is so long that the function -itself would be off the bottom of the screen. - -There should be a comment on each static variable as well, like this: - -@example -/* Nonzero means truncate lines in the display; - zero means continue them. */ -int truncate_lines; -@end example - -Every @samp{#endif} should have a comment, except in the case of short -conditionals (just a few lines) that are not nested. The comment should -state the condition of the conditional that is ending, @emph{including -its sense}. @samp{#else} should have a comment describing the condition -@emph{and sense} of the code that follows. For example: - -@example -@group -#ifdef foo - @dots{} -#else /* not foo */ - @dots{} -#endif /* not foo */ -@end group -@group -#ifdef foo - @dots{} -#endif /* foo */ -@end group -@end example - -@noindent -but, by contrast, write the comments this way for a @samp{#ifndef}: - -@example -@group -#ifndef foo - @dots{} -#else /* foo */ - @dots{} -#endif /* foo */ -@end group -@group -#ifndef foo - @dots{} -#endif /* not foo */ -@end group -@end example - -@node Syntactic Conventions -@section Clean Use of C Constructs - -Please explicitly declare all arguments to functions. -Don't omit them just because they are @code{int}s. - -Declarations of external functions and functions to appear later in the -source file should all go in one place near the beginning of the file -(somewhere before the first function definition in the file), or else -should go in a header file. Don't put @code{extern} declarations inside -functions. - -It used to be common practice to use the same local variables (with -names like @code{tem}) over and over for different values within one -function. Instead of doing this, it is better declare a separate local -variable for each distinct purpose, and give it a name which is -meaningful. This not only makes programs easier to understand, it also -facilitates optimization by good compilers. You can also move the -declaration of each local variable into the smallest scope that includes -all its uses. This makes the program even cleaner. - -Don't use local variables or parameters that shadow global identifiers. - -Don't declare multiple variables in one declaration that spans lines. -Start a new declaration on each line, instead. For example, instead -of this: - -@example -@group -int foo, - bar; -@end group -@end example - -@noindent -write either this: - -@example -int foo, bar; -@end example - -@noindent -or this: - -@example -int foo; -int bar; -@end example - -@noindent -(If they are global variables, each should have a comment preceding it -anyway.) - -When you have an @code{if}-@code{else} statement nested in another -@code{if} statement, always put braces around the @code{if}-@code{else}. -Thus, never write like this: - -@example -if (foo) - if (bar) - win (); - else - lose (); -@end example - -@noindent -always like this: - -@example -if (foo) - @{ - if (bar) - win (); - else - lose (); - @} -@end example - -If you have an @code{if} statement nested inside of an @code{else} -statement, either write @code{else if} on one line, like this, - -@example -if (foo) - @dots{} -else if (bar) - @dots{} -@end example - -@noindent -with its @code{then}-part indented like the preceding @code{then}-part, -or write the nested @code{if} within braces like this: - -@example -if (foo) - @dots{} -else - @{ - if (bar) - @dots{} - @} -@end example - -Don't declare both a structure tag and variables or typedefs in the -same declaration. Instead, declare the structure tag separately -and then use it to declare the variables or typedefs. - -Try to avoid assignments inside @code{if}-conditions. For example, -don't write this: - -@example -if ((foo = (char *) malloc (sizeof *foo)) == 0) - fatal ("virtual memory exhausted"); -@end example - -@noindent -instead, write this: - -@example -foo = (char *) malloc (sizeof *foo); -if (foo == 0) - fatal ("virtual memory exhausted"); -@end example - -Don't make the program ugly to placate @code{lint}. Please don't insert any -casts to @code{void}. Zero without a cast is perfectly fine as a null -pointer constant, except when calling a varargs function. - -@node Names -@section Naming Variables and Functions - -The names of global variables and functions in a program serve as -comments of a sort. So don't choose terse names---instead, look for -names that give useful information about the meaning of the variable or -function. In a GNU program, names should be English, like other -comments. - -Local variable names can be shorter, because they are used only within -one context, where (presumably) comments explain their purpose. - -Please use underscores to separate words in a name, so that the Emacs -word commands can be useful within them. Stick to lower case; reserve -upper case for macros and @code{enum} constants, and for name-prefixes -that follow a uniform convention. - -For example, you should use names like @code{ignore_space_change_flag}; -don't use names like @code{iCantReadThis}. - -Variables that indicate whether command-line options have been -specified should be named after the meaning of the option, not after -the option-letter. A comment should state both the exact meaning of -the option and its letter. For example, - -@example -@group -/* Ignore changes in horizontal whitespace (-b). */ -int ignore_space_change_flag; -@end group -@end example - -When you want to define names with constant integer values, use -@code{enum} rather than @samp{#define}. GDB knows about enumeration -constants. - -Use file names of 14 characters or less, to avoid creating gratuitous -problems on older System V systems. You can use the program -@code{doschk} to test for this. @code{doschk} also tests for potential -name conflicts if the files were loaded onto an MS-DOS file -system---something you may or may not care about. - -@node System Portability -@section Portability between System Types - -In the Unix world, ``portability'' refers to porting to different Unix -versions. For a GNU program, this kind of portability is desirable, but -not paramount. - -The primary purpose of GNU software is to run on top of the GNU kernel, -compiled with the GNU C compiler, on various types of @sc{cpu}. The -amount and kinds of variation among GNU systems on different @sc{cpu}s -will be comparable to the variation among Linux-based GNU systems or -among BSD systems today. So the kinds of portability that are absolutely -necessary are quite limited. - -But many users do run GNU software on non-GNU Unix or Unix-like systems. -So supporting a variety of Unix-like systems is desirable, although not -paramount. - -The easiest way to achieve portability to most Unix-like systems is to -use Autoconf. It's unlikely that your program needs to know more -information about the host platform than Autoconf can provide, simply -because most of the programs that need such knowledge have already been -written. - -Avoid using the format of semi-internal data bases (e.g., directories) -when there is a higher-level alternative (@code{readdir}). - -As for systems that are not like Unix, such as MSDOS, Windows, the -Macintosh, VMS, and MVS, supporting them is usually so much work that it -is better if you don't. - -The planned GNU kernel is not finished yet, but you can tell which -facilities it will provide by looking at the GNU C Library Manual. The -GNU kernel is based on Mach, so the features of Mach will also be -available. However, if you use Mach features, you'll probably have -trouble debugging your program today. - -@node CPU Portability -@section Portability between @sc{cpu}s - -Even GNU systems will differ because of differences among @sc{cpu} -types---for example, difference in byte ordering and alignment -requirements. It is absolutely essential to handle these differences. -However, don't make any effort to cater to the possibility that an -@code{int} will be less than 32 bits. We don't support 16-bit machines -in GNU. - -Don't assume that the address of an @code{int} object is also the -address of its least-significant byte. This is false on big-endian -machines. Thus, don't make the following mistake: - -@example -int c; -@dots{} -while ((c = getchar()) != EOF) - write(file_descriptor, &c, 1); -@end example - -When calling functions, you need not worry about the difference between -pointers of various types, or between pointers and integers. On most -machines, there's no difference anyway. As for the few machines where -there is a difference, all of them support @sc{ansi} C, so you can use -prototypes (conditionalized to be active only in @sc{ansi} C) to make -the code work on those systems. - -In certain cases, it is ok to pass integer and pointer arguments -indiscriminately to the same function, and use no prototype on any -system. For example, many GNU programs have error-reporting functions -that pass their arguments along to @code{printf} and friends: - -@example -error (s, a1, a2, a3) - char *s; - int a1, a2, a3; -@{ - fprintf (stderr, "error: "); - fprintf (stderr, s, a1, a2, a3); -@} -@end example - -@noindent -In practice, this works on all machines, and it is much simpler than any -``correct'' alternative. Be sure @emph{not} to use a prototype -for such functions. - -However, avoid casting pointers to integers unless you really need to. -These assumptions really reduce portability, and in most programs they -are easy to avoid. In the cases where casting pointers to integers is -essential---such as, a Lisp interpreter which stores type information as -well as an address in one word---it is ok to do so, but you'll have to -make explicit provisions to handle different word sizes. - -@node System Functions -@section Calling System Functions - -C implementations differ substantially. @sc{ansi} C reduces but does not -eliminate the incompatibilities; meanwhile, many users wish to compile -GNU software with pre-@sc{ansi} compilers. This chapter gives -recommendations for how to use the more or less standard C library -functions to avoid unnecessary loss of portability. - -@itemize @bullet -@item -Don't use the value of @code{sprintf}. It returns the number of -characters written on some systems, but not on all systems. - -@item -@code{main} should be declared to return type @code{int}. It should -terminate either by calling @code{exit} or by returning the integer -status code; make sure it cannot ever return an undefined value. - -@item -Don't declare system functions explicitly. - -Almost any declaration for a system function is wrong on some system. -To minimize conflicts, leave it to the system header files to declare -system functions. If the headers don't declare a function, let it -remain undeclared. - -While it may seem unclean to use a function without declaring it, in -practice this works fine for most system library functions on the -systems where this really happens; thus, the disadvantage is only -theoretical. By contrast, actual declarations have frequently caused -actual conflicts. - -@item -If you must declare a system function, don't specify the argument types. -Use an old-style declaration, not an @sc{ansi} prototype. The more you -specify about the function, the more likely a conflict. - -@item -In particular, don't unconditionally declare @code{malloc} or -@code{realloc}. - -Most GNU programs use those functions just once, in functions -conventionally named @code{xmalloc} and @code{xrealloc}. These -functions call @code{malloc} and @code{realloc}, respectively, and -check the results. - -Because @code{xmalloc} and @code{xrealloc} are defined in your program, -you can declare them in other files without any risk of type conflict. - -On most systems, @code{int} is the same length as a pointer; thus, the -calls to @code{malloc} and @code{realloc} work fine. For the few -exceptional systems (mostly 64-bit machines), you can use -@strong{conditionalized} declarations of @code{malloc} and -@code{realloc}---or put these declarations in configuration files -specific to those systems. - -@item -The string functions require special treatment. Some Unix systems have -a header file @file{string.h}; others have @file{strings.h}. Neither -file name is portable. There are two things you can do: use Autoconf to -figure out which file to include, or don't include either file. - -@item -If you don't include either strings file, you can't get declarations for -the string functions from the header file in the usual way. - -That causes less of a problem than you might think. The newer @sc{ansi} -string functions should be avoided anyway because many systems still -don't support them. The string functions you can use are these: - -@example -strcpy strncpy strcat strncat -strlen strcmp strncmp -strchr strrchr -@end example - -The copy and concatenate functions work fine without a declaration as -long as you don't use their values. Using their values without a -declaration fails on systems where the width of a pointer differs from -the width of @code{int}, and perhaps in other cases. It is trivial to -avoid using their values, so do that. - -The compare functions and @code{strlen} work fine without a declaration -on most systems, possibly all the ones that GNU software runs on. -You may find it necessary to declare them @strong{conditionally} on a -few systems. - -The search functions must be declared to return @code{char *}. Luckily, -there is no variation in the data type they return. But there is -variation in their names. Some systems give these functions the names -@code{index} and @code{rindex}; other systems use the names -@code{strchr} and @code{strrchr}. Some systems support both pairs of -names, but neither pair works on all systems. - -You should pick a single pair of names and use it throughout your -program. (Nowadays, it is better to choose @code{strchr} and -@code{strrchr} for new programs, since those are the standard @sc{ansi} -names.) Declare both of those names as functions returning @code{char -*}. On systems which don't support those names, define them as macros -in terms of the other pair. For example, here is what to put at the -beginning of your file (or in a header) if you want to use the names -@code{strchr} and @code{strrchr} throughout: - -@example -#ifndef HAVE_STRCHR -#define strchr index -#endif -#ifndef HAVE_STRRCHR -#define strrchr rindex -#endif - -char *strchr (); -char *strrchr (); -@end example -@end itemize - -Here we assume that @code{HAVE_STRCHR} and @code{HAVE_STRRCHR} are -macros defined in systems where the corresponding functions exist. -One way to get them properly defined is to use Autoconf. - -@node Internationalization -@section Internationalization - -GNU has a library called GNU gettext that makes it easy to translate the -messages in a program into various languages. You should use this -library in every program. Use English for the messages as they appear -in the program, and let gettext provide the way to translate them into -other languages. - -Using GNU gettext involves putting a call to the @code{gettext} macro -around each string that might need translation---like this: - -@example -printf (gettext ("Processing file `%s'...")); -@end example - -@noindent -This permits GNU gettext to replace the string @code{"Processing file -`%s'..."} with a translated version. - -Once a program uses gettext, please make a point of writing calls to -@code{gettext} when you add new strings that call for translation. - -Using GNU gettext in a package involves specifying a @dfn{text domain -name} for the package. The text domain name is used to separate the -translations for this package from the translations for other packages. -Normally, the text domain name should be the same as the name of the -package---for example, @samp{fileutils} for the GNU file utilities. - -To enable gettext to work well, avoid writing code that makes -assumptions about the structure of words or sentences. When you want -the precise text of a sentence to vary depending on the data, use two or -more alternative string constants each containing a complete sentences, -rather than inserting conditionalized words or phrases into a single -sentence framework. - -Here is an example of what not to do: - -@example -printf ("%d file%s processed", nfiles, - nfiles != 1 ? "s" : ""); -@end example - -@noindent -The problem with that example is that it assumes that plurals are made -by adding `s'. If you apply gettext to the format string, like this, - -@example -printf (gettext ("%d file%s processed"), nfiles, - nfiles != 1 ? "s" : ""); -@end example - -@noindent -the message can use different words, but it will still be forced to use -`s' for the plural. Here is a better way: - -@example -printf ((nfiles != 1 ? "%d files processed" - : "%d file processed"), - nfiles); -@end example - -@noindent -This way, you can apply gettext to each of the two strings -independently: - -@example -printf ((nfiles != 1 ? gettext ("%d files processed") - : gettext ("%d file processed")), - nfiles); -@end example - -@noindent -This can be any method of forming the plural of the word for ``file'', and -also handles languages that require agreement in the word for -``processed''. - -A similar problem appears at the level of sentence structure with this -code: - -@example -printf ("# Implicit rule search has%s been done.\n", - f->tried_implicit ? "" : " not"); -@end example - -@noindent -Adding @code{gettext} calls to this code cannot give correct results for -all languages, because negation in some languages requires adding words -at more than one place in the sentence. By contrast, adding -@code{gettext} calls does the job straightfowardly if the code starts -out like this: - -@example -printf (f->tried_implicit - ? "# Implicit rule search has been done.\n", - : "# Implicit rule search has not been done.\n"); -@end example - -@node Mmap -@section Mmap - -Don't assume that @code{mmap} either works on all files or fails -for all files. It may work on some files and fail on others. - -The proper way to use @code{mmap} is to try it on the specific file for -which you want to use it---and if @code{mmap} doesn't work, fall back on -doing the job in another way using @code{read} and @code{write}. - -The reason this precaution is needed is that the GNU kernel (the HURD) -provides a user-extensible file system, in which there can be many -different kinds of ``ordinary files.'' Many of them support -@code{mmap}, but some do not. It is important to make programs handle -all these kinds of files. - -@node Documentation -@chapter Documenting Programs - -@menu -* GNU Manuals:: Writing proper manuals. -* Manual Structure Details:: Specific structure conventions. -* NEWS File:: NEWS files supplement manuals. -* Change Logs:: Recording Changes -* Man Pages:: Man pages are secondary. -* Reading other Manuals:: How far you can go in learning - from other manuals. -@end menu - -@node GNU Manuals -@section GNU Manuals - -The preferred way to document part of the GNU system is to write a -manual in the Texinfo formatting language. See the Texinfo manual, -either the hardcopy, or the on-line version available through -@code{info} or the Emacs Info subsystem (@kbd{C-h i}). - -Programmers often find it most natural to structure the documentation -following the structure of the implementation, which they know. But -this structure is not necessarily good for explaining how to use the -program; it may be irrelevant and confusing for a user. - -At every level, from the sentences in a paragraph to the grouping of -topics into separate manuals, the right way to structure documentation -is according to the concepts and questions that a user will have in mind -when reading it. Sometimes this structure of ideas matches the -structure of the implementation of the software being documented---but -often they are different. Often the most important part of learning to -write good documentation is learning to notice when you are structuring -the documentation like the implementation, and think about better -alternatives. - -For example, each program in the GNU system probably ought to be -documented in one manual; but this does not mean each program should -have its own manual. That would be following the structure of the -implementation, rather than the structure that helps the user -understand. - -Instead, each manual should cover a coherent @emph{topic}. For example, -instead of a manual for @code{diff} and a manual for @code{diff3}, we -have one manual for ``comparison of files'' which covers both of those -programs, as well as @code{cmp}. By documenting these programs -together, we can make the whole subject clearer. - -The manual which discusses a program should document all of the -program's command-line options and all of its commands. It should give -examples of their use. But don't organize the manual as a list of -features. Instead, organize it logically, by subtopics. Address the -questions that a user will ask when thinking about the job that the -program does. - -In general, a GNU manual should serve both as tutorial and reference. -It should be set up for convenient access to each topic through Info, -and for reading straight through (appendixes aside). A GNU manual -should give a good introduction to a beginner reading through from the -start, and should also provide all the details that hackers want. - -That is not as hard as it first sounds. Arrange each chapter as a -logical breakdown of its topic, but order the sections, and write their -text, so that reading the chapter straight through makes sense. Do -likewise when structuring the book into chapters, and when structuring a -section into paragraphs. The watchword is, @emph{at each point, address -the most fundamental and important issue raised by the preceding text.} - -If necessary, add extra chapters at the beginning of the manual which -are purely tutorial and cover the basics of the subject. These provide -the framework for a beginner to understand the rest of the manual. The -Bison manual provides a good example of how to do this. - -Don't use Unix man pages as a model for how to write GNU documentation; -most of them are terse, badly structured, and give inadequate -explanation of the underlying concepts. (There are, of course -exceptions.) Also Unix man pages use a particular format which is -different from what we use in GNU manuals. - -Please do not use the term ``pathname'' that is used in Unix -documentation; use ``file name'' (two words) instead. We use the term -``path'' only for search paths, which are lists of file names. - -Please do not use the term ``illegal'' to refer to erroneous input to a -computer program. Please use ``invalid'' for this, and reserve the term -``illegal'' for violations of law. - -@node Manual Structure Details -@section Manual Structure Details - -The title page of the manual should state the version of the programs or -packages documented in the manual. The Top node of the manual should -also contain this information. If the manual is changing more -frequently than or independent of the program, also state a version -number for the manual in both of these places. - -Each program documented in the manual should should have a node named -@samp{@var{program} Invocation} or @samp{Invoking @var{program}}. This -node (together with its subnodes, if any) should describe the program's -command line arguments and how to run it (the sort of information people -would look in a man page for). Start with an @samp{@@example} -containing a template for all the options and arguments that the program -uses. - -Alternatively, put a menu item in some menu whose item name fits one of -the above patterns. This identifies the node which that item points to -as the node for this purpose, regardless of the node's actual name. - -There will be automatic features for specifying a program name and -quickly reading just this part of its manual. - -If one manual describes several programs, it should have such a node for -each program described. - -@node NEWS File -@section The NEWS File - -In addition to its manual, the package should have a file named -@file{NEWS} which contains a list of user-visible changes worth -mentioning. In each new release, add items to the front of the file and -identify the version they pertain to. Don't discard old items; leave -them in the file after the newer items. This way, a user upgrading from -any previous version can see what is new. - -If the @file{NEWS} file gets very long, move some of the older items -into a file named @file{ONEWS} and put a note at the end referring the -user to that file. - -@node Change Logs -@section Change Logs - -Keep a change log to describe all the changes made to program source -files. The purpose of this is so that people investigating bugs in the -future will know about the changes that might have introduced the bug. -Often a new bug can be found by looking at what was recently changed. -More importantly, change logs can help you eliminate conceptual -inconsistencies between different parts of a program, by giving you a -history of how the conflicting concepts arose and who they came from. - -@menu -* Change Log Concepts:: -* Style of Change Logs:: -* Simple Changes:: -* Conditional Changes:: -@end menu - -@node Change Log Concepts -@subsection Change Log Concepts - -You can think of the change log as a conceptual ``undo list'' which -explains how earlier versions were different from the current version. -People can see the current version; they don't need the change log -to tell them what is in it. What they want from a change log is a -clear explanation of how the earlier version differed. - -The change log file is normally called @file{ChangeLog} and covers an -entire directory. Each directory can have its own change log, or a -directory can use the change log of its parent directory--it's up to -you. - -Another alternative is to record change log information with a version -control system such as RCS or CVS. This can be converted automatically -to a @file{ChangeLog} file. - -There's no need to describe the full purpose of the changes or how they -work together. If you think that a change calls for explanation, you're -probably right. Please do explain it---but please put the explanation -in comments in the code, where people will see it whenever they see the -code. For example, ``New function'' is enough for the change log when -you add a function, because there should be a comment before the -function definition to explain what it does. - -However, sometimes it is useful to write one line to describe the -overall purpose of a batch of changes. - -The easiest way to add an entry to @file{ChangeLog} is with the Emacs -command @kbd{M-x add-change-log-entry}. An entry should have an -asterisk, the name of the changed file, and then in parentheses the name -of the changed functions, variables or whatever, followed by a colon. -Then describe the changes you made to that function or variable. - -@node Style of Change Logs -@subsection Style of Change Logs - -Here are some examples of change log entries: - -@example -* register.el (insert-register): Return nil. -(jump-to-register): Likewise. - -* sort.el (sort-subr): Return nil. - -* tex-mode.el (tex-bibtex-file, tex-file, tex-region): -Restart the tex shell if process is gone or stopped. -(tex-shell-running): New function. - -* expr.c (store_one_arg): Round size up for move_block_to_reg. -(expand_call): Round up when emitting USE insns. -* stmt.c (assign_parms): Round size up for move_block_from_reg. -@end example - -It's important to name the changed function or variable in full. Don't -abbreviate function or variable names, and don't combine them. -Subsequent maintainers will often search for a function name to find all -the change log entries that pertain to it; if you abbreviate the name, -they won't find it when they search. - -For example, some people are tempted to abbreviate groups of function -names by writing @samp{* register.el (@{insert,jump-to@}-register)}; -this is not a good idea, since searching for @code{jump-to-register} or -@code{insert-register} would not find that entry. - -Separate unrelated change log entries with blank lines. When two -entries represent parts of the same change, so that they work together, -then don't put blank lines between them. Then you can omit the file -name and the asterisk when successive entries are in the same file. - -@node Simple Changes -@subsection Simple Changes - -Certain simple kinds of changes don't need much detail in the change -log. - -When you change the calling sequence of a function in a simple fashion, -and you change all the callers of the function, there is no need to make -individual entries for all the callers that you changed. Just write in -the entry for the function being called, ``All callers changed.'' - -@example -* keyboard.c (Fcommand_execute): New arg SPECIAL. -All callers changed. -@end example - -When you change just comments or doc strings, it is enough to write an -entry for the file, without mentioning the functions. Just ``Doc -fixes'' is enough for the change log. - -There's no need to make change log entries for documentation files. -This is because documentation is not susceptible to bugs that are hard -to fix. Documentation does not consist of parts that must interact in a -precisely engineered fashion. To correct an error, you need not know -the history of the erroneous passage; it is enough to compare what the -documentation says with the way the program actually works. - -@node Conditional Changes -@subsection Conditional Changes - -C programs often contain compile-time @code{#if} conditionals. Many -changes are conditional; sometimes you add a new definition which is -entirely contained in a conditional. It is very useful to indicate in -the change log the conditions for which the change applies. - -Our convention for indicating conditional changes is to use square -brackets around the name of the condition. - -Here is a simple example, describing a change which is conditional but -does not have a function or entity name associated with it: - -@example -* xterm.c [SOLARIS2]: Include string.h. -@end example - -Here is an entry describing a new definition which is entirely -conditional. This new definition for the macro @code{FRAME_WINDOW_P} is -used only when @code{HAVE_X_WINDOWS} is defined: - -@example -* frame.h [HAVE_X_WINDOWS] (FRAME_WINDOW_P): Macro defined. -@end example - -Here is an entry for a change within the function @code{init_display}, -whose definition as a whole is unconditional, but the changes themselves -are contained in a @samp{#ifdef HAVE_LIBNCURSES} conditional: - -@example -* dispnew.c (init_display) [HAVE_LIBNCURSES]: If X, call tgetent. -@end example - -Here is an entry for a change that takes affect only when -a certain macro is @emph{not} defined: - -@example -(gethostname) [!HAVE_SOCKETS]: Replace with winsock version. -@end example - -@node Man Pages -@section Man Pages - -In the GNU project, man pages are secondary. It is not necessary or -expected for every GNU program to have a man page, but some of them do. -It's your choice whether to include a man page in your program. - -When you make this decision, consider that supporting a man page -requires continual effort each time the program is changed. The time -you spend on the man page is time taken away from more useful work. - -For a simple program which changes little, updating the man page may be -a small job. Then there is little reason not to include a man page, if -you have one. - -For a large program that changes a great deal, updating a man page may -be a substantial burden. If a user offers to donate a man page, you may -find this gift costly to accept. It may be better to refuse the man -page unless the same person agrees to take full responsibility for -maintaining it---so that you can wash your hands of it entirely. If -this volunteer later ceases to do the job, then don't feel obliged to -pick it up yourself; it may be better to withdraw the man page from the -distribution until someone else agrees to update it. - -When a program changes only a little, you may feel that the -discrepancies are small enough that the man page remains useful without -updating. If so, put a prominent note near the beginning of the man -page explaining that you don't maintain it and that the Texinfo manual -is more authoritative. The note should say how to access the Texinfo -documentation. - -@node Reading other Manuals -@section Reading other Manuals - -There may be non-free books or documentation files that describe the -program you are documenting. - -It is ok to use these documents for reference, just as the author of a -new algebra textbook can read other books on algebra. A large portion -of any non-fiction book consists of facts, in this case facts about how -a certain program works, and these facts are necessarily the same for -everyone who writes about the subject. But be careful not to copy your -outline structure, wording, tables or examples from preexisting non-free -documentation. Copying from free documentation may be ok; please check -with the FSF about the individual case. - -@node Managing Releases -@chapter The Release Process - -Making a release is more than just bundling up your source files in a -tar file and putting it up for FTP. You should set up your software so -that it can be configured to run on a variety of systems. Your Makefile -should conform to the GNU standards described below, and your directory -layout should also conform to the standards discussed below. Doing so -makes it easy to include your package into the larger framework of -all GNU software. - -@menu -* Configuration:: How Configuration Should Work -* Makefile Conventions:: Makefile Conventions -* Releases:: Making Releases -@end menu - -@node Configuration -@section How Configuration Should Work - -Each GNU distribution should come with a shell script named -@code{configure}. This script is given arguments which describe the -kind of machine and system you want to compile the program for. - -The @code{configure} script must record the configuration options so -that they affect compilation. - -One way to do this is to make a link from a standard name such as -@file{config.h} to the proper configuration file for the chosen system. -If you use this technique, the distribution should @emph{not} contain a -file named @file{config.h}. This is so that people won't be able to -build the program without configuring it first. - -Another thing that @code{configure} can do is to edit the Makefile. If -you do this, the distribution should @emph{not} contain a file named -@file{Makefile}. Instead, it should include a file @file{Makefile.in} which -contains the input used for editing. Once again, this is so that people -won't be able to build the program without configuring it first. - -If @code{configure} does write the @file{Makefile}, then @file{Makefile} -should have a target named @file{Makefile} which causes @code{configure} -to be rerun, setting up the same configuration that was set up last -time. The files that @code{configure} reads should be listed as -dependencies of @file{Makefile}. - -All the files which are output from the @code{configure} script should -have comments at the beginning explaining that they were generated -automatically using @code{configure}. This is so that users won't think -of trying to edit them by hand. - -The @code{configure} script should write a file named @file{config.status} -which describes which configuration options were specified when the -program was last configured. This file should be a shell script which, -if run, will recreate the same configuration. - -The @code{configure} script should accept an option of the form -@samp{--srcdir=@var{dirname}} to specify the directory where sources are found -(if it is not the current directory). This makes it possible to build -the program in a separate directory, so that the actual source directory -is not modified. - -If the user does not specify @samp{--srcdir}, then @code{configure} should -check both @file{.} and @file{..} to see if it can find the sources. If -it finds the sources in one of these places, it should use them from -there. Otherwise, it should report that it cannot find the sources, and -should exit with nonzero status. - -Usually the easy way to support @samp{--srcdir} is by editing a -definition of @code{VPATH} into the Makefile. Some rules may need to -refer explicitly to the specified source directory. To make this -possible, @code{configure} can add to the Makefile a variable named -@code{srcdir} whose value is precisely the specified directory. - -The @code{configure} script should also take an argument which specifies the -type of system to build the program for. This argument should look like -this: - -@example -@var{cpu}-@var{company}-@var{system} -@end example - -For example, a Sun 3 might be @samp{m68k-sun-sunos4.1}. - -The @code{configure} script needs to be able to decode all plausible -alternatives for how to describe a machine. Thus, @samp{sun3-sunos4.1} -would be a valid alias. For many programs, @samp{vax-dec-ultrix} would -be an alias for @samp{vax-dec-bsd}, simply because the differences -between Ultrix and @sc{BSD} are rarely noticeable, but a few programs -might need to distinguish them. -@c Real 4.4BSD now runs on some Suns. - -There is a shell script called @file{config.sub} that you can use -as a subroutine to validate system types and canonicalize aliases. - -Other options are permitted to specify in more detail the software -or hardware present on the machine, and include or exclude optional -parts of the package: - -@table @samp -@item --enable-@var{feature}@r{[}=@var{parameter}@r{]} -Configure the package to build and install an optional user-level -facility called @var{feature}. This allows users to choose which -optional features to include. Giving an optional @var{parameter} of -@samp{no} should omit @var{feature}, if it is built by default. - -No @samp{--enable} option should @strong{ever} cause one feature to -replace another. No @samp{--enable} option should ever substitute one -useful behavior for another useful behavior. The only proper use for -@samp{--enable} is for questions of whether to build part of the program -or exclude it. - -@item --with-@var{package} -@c @r{[}=@var{parameter}@r{]} -The package @var{package} will be installed, so configure this package -to work with @var{package}. - -@c Giving an optional @var{parameter} of -@c @samp{no} should omit @var{package}, if it is used by default. - -Possible values of @var{package} include -@samp{gnu-as} (or @samp{gas}), @samp{gnu-ld}, @samp{gnu-libc}, -@samp{gdb}, -@samp{x}, -and -@samp{x-toolkit}. - -Do not use a @samp{--with} option to specify the file name to use to -find certain files. That is outside the scope of what @samp{--with} -options are for. - -@item --nfp -The target machine has no floating point processor. - -@item --gas -The target machine assembler is GAS, the GNU assembler. -This is obsolete; users should use @samp{--with-gnu-as} instead. - -@item --x -The target machine has the X Window System installed. -This is obsolete; users should use @samp{--with-x} instead. -@end table - -All @code{configure} scripts should accept all of these ``detail'' -options, whether or not they make any difference to the particular -package at hand. In particular, they should accept any option that -starts with @samp{--with-} or @samp{--enable-}. This is so users will -be able to configure an entire GNU source tree at once with a single set -of options. - -You will note that the categories @samp{--with-} and @samp{--enable-} -are narrow: they @strong{do not} provide a place for any sort of option -you might think of. That is deliberate. We want to limit the possible -configuration options in GNU software. We do not want GNU programs to -have idiosyncratic configuration options. - -Packages that perform part of the compilation process may support cross-compilation. -In such a case, the host and target machines for the program may be -different. The @code{configure} script should normally treat the -specified type of system as both the host and the target, thus producing -a program which works for the same type of machine that it runs on. - -The way to build a cross-compiler, cross-assembler, or what have you, is -to specify the option @samp{--host=@var{hosttype}} when running -@code{configure}. This specifies the host system without changing the -type of target system. The syntax for @var{hosttype} is the same as -described above. - -Bootstrapping a cross-compiler requires compiling it on a machine other -than the host it will run on. Compilation packages accept a -configuration option @samp{--build=@var{hosttype}} for specifying the -configuration on which you will compile them, in case that is different -from the host. - -Programs for which cross-operation is not meaningful need not accept the -@samp{--host} option, because configuring an entire operating system for -cross-operation is not a meaningful thing. - -Some programs have ways of configuring themselves automatically. If -your program is set up to do this, your @code{configure} script can simply -ignore most of its arguments. - -@comment The makefile standards are in a separate file that is also -@comment included by make.texinfo. Done by roland@gnu.ai.mit.edu on 1/6/93. -@comment For this document, turn chapters into sections, etc. -@lowersections -@include make-stds.texi -@raisesections - -@node Releases -@section Making Releases - -Package the distribution of @code{Foo version 69.96} up in a gzipped tar -file with the name @file{foo-69.96.tar.gz}. It should unpack into a -subdirectory named @file{foo-69.96}. - -Building and installing the program should never modify any of the files -contained in the distribution. This means that all the files that form -part of the program in any way must be classified into @dfn{source -files} and @dfn{non-source files}. Source files are written by humans -and never changed automatically; non-source files are produced from -source files by programs under the control of the Makefile. - -Naturally, all the source files must be in the distribution. It is okay -to include non-source files in the distribution, provided they are -up-to-date and machine-independent, so that building the distribution -normally will never modify them. We commonly include non-source files -produced by Bison, @code{lex}, @TeX{}, and @code{makeinfo}; this helps avoid -unnecessary dependencies between our distributions, so that users can -install whichever packages they want to install. - -Non-source files that might actually be modified by building and -installing the program should @strong{never} be included in the -distribution. So if you do distribute non-source files, always make -sure they are up to date when you make a new distribution. - -Make sure that the directory into which the distribution unpacks (as -well as any subdirectories) are all world-writable (octal mode 777). -This is so that old versions of @code{tar} which preserve the -ownership and permissions of the files from the tar archive will be -able to extract all the files even if the user is unprivileged. - -Make sure that all the files in the distribution are world-readable. - -Make sure that no file name in the distribution is more than 14 -characters long. Likewise, no file created by building the program -should have a name longer than 14 characters. The reason for this is -that some systems adhere to a foolish interpretation of the POSIX -standard, and refuse to open a longer name, rather than truncating as -they did in the past. - -Don't include any symbolic links in the distribution itself. If the tar -file contains symbolic links, then people cannot even unpack it on -systems that don't support symbolic links. Also, don't use multiple -names for one file in different directories, because certain file -systems cannot handle this and that prevents unpacking the -distribution. - -Try to make sure that all the file names will be unique on MS-DOS. A -name on MS-DOS consists of up to 8 characters, optionally followed by a -period and up to three characters. MS-DOS will truncate extra -characters both before and after the period. Thus, -@file{foobarhacker.c} and @file{foobarhacker.o} are not ambiguous; they -are truncated to @file{foobarha.c} and @file{foobarha.o}, which are -distinct. - -Include in your distribution a copy of the @file{texinfo.tex} you used -to test print any @file{*.texinfo} or @file{*.texi} files. - -Likewise, if your program uses small GNU software packages like regex, -getopt, obstack, or termcap, include them in the distribution file. -Leaving them out would make the distribution file a little smaller at -the expense of possible inconvenience to a user who doesn't know what -other files to get. - -@contents - -@bye -Local variables: -update-date-leading-regexp: "@c This date is automagically updated when you save this file:\n@set lastupdate " -update-date-trailing-regexp: "" -eval: (load "/gd/gnuorg/update-date.el") -eval: (add-hook 'write-file-hooks 'update-date) -End: diff --git a/contrib/binutils/gas/acconfig.h b/contrib/binutils/gas/acconfig.h deleted file mode 100644 index c9c60025c757..000000000000 --- a/contrib/binutils/gas/acconfig.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION - -/* Should gas use high-level BFD interfaces? */ -#undef BFD_ASSEMBLER - -/* Some assert/preprocessor combinations are incapable of handling - certain kinds of constructs in the argument of assert. For example, - quoted strings (if requoting isn't done right) or newlines. */ -#undef BROKEN_ASSERT - -/* If we aren't doing cross-assembling, some operations can be optimized, - since byte orders and value sizes don't need to be adjusted. */ -#undef CROSS_COMPILE - -/* Some gas code wants to know these parameters. */ -#undef TARGET_ALIAS -#undef TARGET_CPU -#undef TARGET_CANONICAL -#undef TARGET_OS -#undef TARGET_VENDOR - -/* Sometimes the system header files don't declare strstr. */ -#undef NEED_DECLARATION_STRSTR - -/* Sometimes the system header files don't declare malloc and realloc. */ -#undef NEED_DECLARATION_MALLOC - -/* Sometimes the system header files don't declare free. */ -#undef NEED_DECLARATION_FREE - -/* Sometimes the system header files don't declare sbrk. */ -#undef NEED_DECLARATION_SBRK - -/* Sometimes errno.h doesn't declare errno itself. */ -#undef NEED_DECLARATION_ERRNO - -#undef MANY_SEGMENTS - -/* The configure script defines this for some targets based on the - target name used. It is not always defined. */ -#undef TARGET_BYTES_BIG_ENDIAN - -/* Needed only for some configurations that can produce multiple output - formats. */ -#undef DEFAULT_EMULATION -#undef EMULATIONS -#undef USE_EMULATIONS -#undef OBJ_MAYBE_AOUT -#undef OBJ_MAYBE_BOUT -#undef OBJ_MAYBE_COFF -#undef OBJ_MAYBE_ECOFF -#undef OBJ_MAYBE_ELF -#undef OBJ_MAYBE_GENERIC -#undef OBJ_MAYBE_HP300 -#undef OBJ_MAYBE_IEEE -#undef OBJ_MAYBE_SOM -#undef OBJ_MAYBE_VMS - -/* Used for some of the COFF configurations, when the COFF code needs - to select something based on the CPU type before it knows it... */ -#undef I386COFF -#undef M68KCOFF -#undef M88KCOFF - -/* Using cgen code? */ -#undef USING_CGEN - -/* Needed only for sparc configuration. */ -#undef DEFAULT_ARCH - -/* Needed only for PowerPC Solaris. */ -#undef TARGET_SOLARIS_COMMENT - -/* Needed only for SCO 5. */ -#undef SCO_ELF diff --git a/contrib/binutils/gas/conf.in b/contrib/binutils/gas/conf.in deleted file mode 100644 index d56807cd88d5..000000000000 --- a/contrib/binutils/gas/conf.in +++ /dev/null @@ -1,127 +0,0 @@ -/* conf.in. Generated automatically from configure.in by autoheader. */ - -/* Define if using alloca.c. */ -#undef C_ALLOCA - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ -#undef CRAY_STACKSEG_END - -/* Define if you have alloca, as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ -#undef HAVE_ALLOCA_H - -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -#undef STACK_DIRECTION - -/* Should gas use high-level BFD interfaces? */ -#undef BFD_ASSEMBLER - -/* Some assert/preprocessor combinations are incapable of handling - certain kinds of constructs in the argument of assert. For example, - quoted strings (if requoting isn't done right) or newlines. */ -#undef BROKEN_ASSERT - -/* If we aren't doing cross-assembling, some operations can be optimized, - since byte orders and value sizes don't need to be adjusted. */ -#undef CROSS_COMPILE - -/* Some gas code wants to know these parameters. */ -#undef TARGET_ALIAS -#undef TARGET_CPU -#undef TARGET_CANONICAL -#undef TARGET_OS -#undef TARGET_VENDOR - -/* Sometimes the system header files don't declare strstr. */ -#undef NEED_DECLARATION_STRSTR - -/* Sometimes the system header files don't declare malloc and realloc. */ -#undef NEED_DECLARATION_MALLOC - -/* Sometimes the system header files don't declare free. */ -#undef NEED_DECLARATION_FREE - -/* Sometimes the system header files don't declare sbrk. */ -#undef NEED_DECLARATION_SBRK - -/* Sometimes errno.h doesn't declare errno itself. */ -#undef NEED_DECLARATION_ERRNO - -#undef MANY_SEGMENTS - -/* Needed only for sparc configuration. */ -#undef SPARC_V9 -#undef SPARC_ARCH64 - -/* Defined if using CGEN. */ -#undef USING_CGEN - -/* Needed only for some configurations that can produce multiple output - formats. */ -#undef DEFAULT_EMULATION -#undef EMULATIONS -#undef USE_EMULATIONS -#undef OBJ_MAYBE_AOUT -#undef OBJ_MAYBE_BOUT -#undef OBJ_MAYBE_COFF -#undef OBJ_MAYBE_ECOFF -#undef OBJ_MAYBE_ELF -#undef OBJ_MAYBE_GENERIC -#undef OBJ_MAYBE_HP300 -#undef OBJ_MAYBE_IEEE -#undef OBJ_MAYBE_SOM -#undef OBJ_MAYBE_VMS - -/* Used for some of the COFF configurations, when the COFF code needs - to select something based on the CPU type before it knows it... */ -#undef I386COFF -#undef M68KCOFF -#undef M88KCOFF - -/* Define if you have the remove function. */ -#undef HAVE_REMOVE - -/* Define if you have the sbrk function. */ -#undef HAVE_SBRK - -/* Define if you have the unlink function. */ -#undef HAVE_UNLINK - -/* Define if you have the <errno.h> header file. */ -#undef HAVE_ERRNO_H - -/* Define if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define if you have the <stdarg.h> header file. */ -#undef HAVE_STDARG_H - -/* Define if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the <varargs.h> header file. */ -#undef HAVE_VARARGS_H diff --git a/contrib/binutils/gas/config/atof-vax.c b/contrib/binutils/gas/config/atof-vax.c deleted file mode 100644 index 76ff0782868a..000000000000 --- a/contrib/binutils/gas/config/atof-vax.c +++ /dev/null @@ -1,518 +0,0 @@ -/* atof_vax.c - turn a Flonum into a VAX floating point number - Copyright (C) 1987, 1992, 93, 95, 97, 98, 1999 - Free Software Foundation, Inc. - - This file is part of GAS, the GNU Assembler. - - GAS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GAS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#include "as.h" - -static int atof_vax_sizeof PARAMS ((int)); -static int next_bits PARAMS ((int)); -static void make_invalid_floating_point_number PARAMS ((LITTLENUM_TYPE *)); -static int what_kind_of_float PARAMS ((int, int *, long *)); -static char *atof_vax PARAMS ((char *, int, LITTLENUM_TYPE *)); - -/* Precision in LittleNums. */ -#define MAX_PRECISION (8) -#define H_PRECISION (8) -#define G_PRECISION (4) -#define D_PRECISION (4) -#define F_PRECISION (2) - -/* Length in LittleNums of guard bits. */ -#define GUARD (2) - -int flonum_gen2vax PARAMS ((int format_letter, FLONUM_TYPE * f, - LITTLENUM_TYPE * words)); - -/* Number of chars in flonum type 'letter'. */ -static int -atof_vax_sizeof (letter) - int letter; -{ - int return_value; - - /* - * Permitting uppercase letters is probably a bad idea. - * Please use only lower-cased letters in case the upper-cased - * ones become unsupported! - */ - switch (letter) - { - case 'f': - case 'F': - return_value = 4; - break; - - case 'd': - case 'D': - case 'g': - case 'G': - return_value = 8; - break; - - case 'h': - case 'H': - return_value = 16; - break; - - default: - return_value = 0; - break; - } - return (return_value); -} /* atof_vax_sizeof */ - -static const long mask[] = -{ - 0x00000000, - 0x00000001, - 0x00000003, - 0x00000007, - 0x0000000f, - 0x0000001f, - 0x0000003f, - 0x0000007f, - 0x000000ff, - 0x000001ff, - 0x000003ff, - 0x000007ff, - 0x00000fff, - 0x00001fff, - 0x00003fff, - 0x00007fff, - 0x0000ffff, - 0x0001ffff, - 0x0003ffff, - 0x0007ffff, - 0x000fffff, - 0x001fffff, - 0x003fffff, - 0x007fffff, - 0x00ffffff, - 0x01ffffff, - 0x03ffffff, - 0x07ffffff, - 0x0fffffff, - 0x1fffffff, - 0x3fffffff, - 0x7fffffff, - 0xffffffff -}; - - -/* Shared between flonum_gen2vax and next_bits */ -static int bits_left_in_littlenum; -static LITTLENUM_TYPE *littlenum_pointer; -static LITTLENUM_TYPE *littlenum_end; - -static int -next_bits (number_of_bits) - int number_of_bits; -{ - int return_value; - - if (littlenum_pointer < littlenum_end) - return 0; - if (number_of_bits >= bits_left_in_littlenum) - { - return_value = mask[bits_left_in_littlenum] & *littlenum_pointer; - number_of_bits -= bits_left_in_littlenum; - return_value <<= number_of_bits; - bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS - number_of_bits; - littlenum_pointer--; - if (littlenum_pointer >= littlenum_end) - return_value |= ((*littlenum_pointer) >> (bits_left_in_littlenum)) & mask[number_of_bits]; - } - else - { - bits_left_in_littlenum -= number_of_bits; - return_value = mask[number_of_bits] & ((*littlenum_pointer) >> bits_left_in_littlenum); - } - return (return_value); -} - -static void -make_invalid_floating_point_number (words) - LITTLENUM_TYPE *words; -{ - *words = 0x8000; /* Floating Reserved Operand Code */ -} - -static int /* 0 means letter is OK. */ -what_kind_of_float (letter, precisionP, exponent_bitsP) - int letter; /* In: lowercase please. What kind of float? */ - int *precisionP; /* Number of 16-bit words in the float. */ - long *exponent_bitsP; /* Number of exponent bits. */ -{ - int retval; /* 0: OK. */ - - retval = 0; - switch (letter) - { - case 'f': - *precisionP = F_PRECISION; - *exponent_bitsP = 8; - break; - - case 'd': - *precisionP = D_PRECISION; - *exponent_bitsP = 8; - break; - - case 'g': - *precisionP = G_PRECISION; - *exponent_bitsP = 11; - break; - - case 'h': - *precisionP = H_PRECISION; - *exponent_bitsP = 15; - break; - - default: - retval = 69; - break; - } - return (retval); -} - -/***********************************************************************\ - * * - * Warning: this returns 16-bit LITTLENUMs, because that is * - * what the VAX thinks in. It is up to the caller to figure * - * out any alignment problems and to conspire for the bytes/word * - * to be emitted in the right order. Bigendians beware! * - * * - \***********************************************************************/ - -static char * /* Return pointer past text consumed. */ -atof_vax (str, what_kind, words) - char *str; /* Text to convert to binary. */ - int what_kind; /* 'd', 'f', 'g', 'h' */ - LITTLENUM_TYPE *words; /* Build the binary here. */ -{ - FLONUM_TYPE f; - LITTLENUM_TYPE bits[MAX_PRECISION + MAX_PRECISION + GUARD]; - /* Extra bits for zeroed low-order bits. */ - /* The 1st MAX_PRECISION are zeroed, */ - /* the last contain flonum bits. */ - char *return_value; - int precision; /* Number of 16-bit words in the format. */ - long exponent_bits; - - return_value = str; - f.low = bits + MAX_PRECISION; - f.high = NULL; - f.leader = NULL; - f.exponent = 0; - f.sign = '\0'; - - if (what_kind_of_float (what_kind, &precision, &exponent_bits)) - { - return_value = NULL; /* We lost. */ - make_invalid_floating_point_number (words); - } - - if (return_value) - { - memset (bits, '\0', sizeof (LITTLENUM_TYPE) * MAX_PRECISION); - - /* Use more LittleNums than seems */ - /* necessary: the highest flonum may have */ - /* 15 leading 0 bits, so could be useless. */ - f.high = f.low + precision - 1 + GUARD; - - if (atof_generic (&return_value, ".", "eE", &f)) - { - make_invalid_floating_point_number (words); - return_value = NULL; /* we lost */ - } - else - { - if (flonum_gen2vax (what_kind, &f, words)) - { - return_value = NULL; - } - } - } - return (return_value); -} /* atof_vax() */ - -/* - * In: a flonum, a vax floating point format. - * Out: a vax floating-point bit pattern. - */ - -int /* 0: OK. */ -flonum_gen2vax (format_letter, f, words) - int format_letter; /* One of 'd' 'f' 'g' 'h'. */ - FLONUM_TYPE *f; - LITTLENUM_TYPE *words; /* Deliver answer here. */ -{ - LITTLENUM_TYPE *lp; - int precision; - long exponent_bits; - int return_value; /* 0 == OK. */ - - return_value = what_kind_of_float (format_letter, &precision, &exponent_bits); - - if (return_value != 0) - { - make_invalid_floating_point_number (words); - } - else - { - if (f->low > f->leader) - { - /* 0.0e0 seen. */ - memset (words, '\0', sizeof (LITTLENUM_TYPE) * precision); - } - else - { - long exponent_1; - long exponent_2; - long exponent_3; - long exponent_4; - int exponent_skippage; - LITTLENUM_TYPE word1; - - /* JF: Deal with new Nan, +Inf and -Inf codes */ - if (f->sign != '-' && f->sign != '+') - { - make_invalid_floating_point_number (words); - return return_value; - } - /* - * All vaxen floating_point formats (so far) have: - * Bit 15 is sign bit. - * Bits 14:n are excess-whatever exponent. - * Bits n-1:0 (if any) are most significant bits of fraction. - * Bits 15:0 of the next word are the next most significant bits. - * And so on for each other word. - * - * All this to be compatible with a KF11?? (Which is still faster - * than lots of vaxen I can think of, but it also has higher - * maintenance costs ... sigh). - * - * So we need: number of bits of exponent, number of bits of - * mantissa. - */ - -#ifdef NEVER /******* This zeroing seems redundant - Dean 3may86 **********/ - /* - * No matter how few bits we got back from the atof() - * routine, add enough zero littlenums so the rest of the - * code won't run out of "significant" bits in the mantissa. - */ - { - LITTLENUM_TYPE *ltp; - for (ltp = f->leader + 1; - ltp <= f->low + precision; - ltp++) - { - *ltp = 0; - } - } -#endif - - bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS; - littlenum_pointer = f->leader; - littlenum_end = f->low; - /* Seek (and forget) 1st significant bit */ - for (exponent_skippage = 0; - !next_bits (1); - exponent_skippage++);; - - exponent_1 = f->exponent + f->leader + 1 - f->low; - /* Radix LITTLENUM_RADIX, point just higher than f->leader. */ - exponent_2 = exponent_1 * LITTLENUM_NUMBER_OF_BITS; - /* Radix 2. */ - exponent_3 = exponent_2 - exponent_skippage; - /* Forget leading zeros, forget 1st bit. */ - exponent_4 = exponent_3 + (1 << (exponent_bits - 1)); - /* Offset exponent. */ - - if (exponent_4 & ~mask[exponent_bits]) - { - /* - * Exponent overflow. Lose immediately. - */ - - make_invalid_floating_point_number (words); - - /* - * We leave return_value alone: admit we read the - * number, but return a floating exception - * because we can't encode the number. - */ - } - else - { - lp = words; - - /* Word 1. Sign, exponent and perhaps high bits. */ - /* Assume 2's complement integers. */ - word1 = (((exponent_4 & mask[exponent_bits]) << (15 - exponent_bits)) - | ((f->sign == '+') ? 0 : 0x8000) - | next_bits (15 - exponent_bits)); - *lp++ = word1; - - /* The rest of the words are just mantissa bits. */ - for (; lp < words + precision; lp++) - { - *lp = next_bits (LITTLENUM_NUMBER_OF_BITS); - } - - if (next_bits (1)) - { - /* - * Since the NEXT bit is a 1, round UP the mantissa. - * The cunning design of these hidden-1 floats permits - * us to let the mantissa overflow into the exponent, and - * it 'does the right thing'. However, we lose if the - * highest-order bit of the lowest-order word flips. - * Is that clear? - */ - - unsigned long carry; - - /* - #if (sizeof(carry)) < ((sizeof(bits[0]) * BITS_PER_CHAR) + 2) - Please allow at least 1 more bit in carry than is in a LITTLENUM. - We need that extra bit to hold a carry during a LITTLENUM carry - propagation. Another extra bit (kept 0) will assure us that we - don't get a sticky sign bit after shifting right, and that - permits us to propagate the carry without any masking of bits. - #endif - */ - for (carry = 1, lp--; - carry && (lp >= words); - lp--) - { - carry = *lp + carry; - *lp = carry; - carry >>= LITTLENUM_NUMBER_OF_BITS; - } - - if ((word1 ^ *words) & (1 << (LITTLENUM_NUMBER_OF_BITS - 1))) - { - make_invalid_floating_point_number (words); - /* - * We leave return_value alone: admit we read the - * number, but return a floating exception - * because we can't encode the number. - */ - } - } /* if (we needed to round up) */ - } /* if (exponent overflow) */ - } /* if (0.0e0) */ - } /* if (float_type was OK) */ - return (return_value); -} /* flonum_gen2vax() */ - - -/* JF this used to be in vax.c but this looks like a better place for it */ - -/* - * md_atof() - * - * In: input_line_pointer->the 1st character of a floating-point - * number. - * 1 letter denoting the type of statement that wants a - * binary floating point number returned. - * Address of where to build floating point literal. - * Assumed to be 'big enough'. - * Address of where to return size of literal (in chars). - * - * Out: Input_line_pointer->of next char after floating number. - * Error message, or 0. - * Floating point literal. - * Number of chars we used for the literal. - */ - -#define MAXIMUM_NUMBER_OF_LITTLENUMS (8) /* For .hfloats. */ - -char * -md_atof (what_statement_type, literalP, sizeP) - int what_statement_type; - char *literalP; - int *sizeP; -{ - LITTLENUM_TYPE words[MAXIMUM_NUMBER_OF_LITTLENUMS]; - register char kind_of_float; - register int number_of_chars; - register LITTLENUM_TYPE *littlenumP; - - switch (what_statement_type) - { - case 'F': /* .float */ - case 'f': /* .ffloat */ - kind_of_float = 'f'; - break; - - case 'D': /* .double */ - case 'd': /* .dfloat */ - kind_of_float = 'd'; - break; - - case 'g': /* .gfloat */ - kind_of_float = 'g'; - break; - - case 'h': /* .hfloat */ - kind_of_float = 'h'; - break; - - default: - kind_of_float = 0; - break; - }; - - if (kind_of_float) - { - register LITTLENUM_TYPE *limit; - - input_line_pointer = atof_vax (input_line_pointer, - kind_of_float, - words); - /* - * The atof_vax() builds up 16-bit numbers. - * Since the assembler may not be running on - * a little-endian machine, be very careful about - * converting words to chars. - */ - number_of_chars = atof_vax_sizeof (kind_of_float); - know (number_of_chars <= MAXIMUM_NUMBER_OF_LITTLENUMS * sizeof (LITTLENUM_TYPE)); - limit = words + (number_of_chars / sizeof (LITTLENUM_TYPE)); - for (littlenumP = words; littlenumP < limit; littlenumP++) - { - md_number_to_chars (literalP, *littlenumP, sizeof (LITTLENUM_TYPE)); - literalP += sizeof (LITTLENUM_TYPE); - }; - } - else - { - number_of_chars = 0; - }; - - *sizeP = number_of_chars; - return kind_of_float ? NULL : _("Bad call to md_atof()"); -} - -/* end of atof-vax.c */ diff --git a/contrib/binutils/gas/config/i386coff.mt b/contrib/binutils/gas/config/i386coff.mt deleted file mode 100644 index efda83365181..000000000000 --- a/contrib/binutils/gas/config/i386coff.mt +++ /dev/null @@ -1 +0,0 @@ -TDEFINES=-DI386COFF diff --git a/contrib/binutils/gas/config/sco5.mt b/contrib/binutils/gas/config/sco5.mt deleted file mode 100644 index 8879320c4e1e..000000000000 --- a/contrib/binutils/gas/config/sco5.mt +++ /dev/null @@ -1 +0,0 @@ -TDEFINES=-DSCO_ELF diff --git a/contrib/binutils/gas/config/tc-sh.c b/contrib/binutils/gas/config/tc-sh.c deleted file mode 100644 index eaa6146eea75..000000000000 --- a/contrib/binutils/gas/config/tc-sh.c +++ /dev/null @@ -1,2335 +0,0 @@ -/* tc-sh.c -- Assemble code for the Hitachi Super-H - Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation. - - This file is part of GAS, the GNU Assembler. - - GAS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GAS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* - Written By Steve Chamberlain - sac@cygnus.com - */ - -#include <stdio.h> -#include "as.h" -#include "bfd.h" -#include "subsegs.h" -#define DEFINE_TABLE -#include "opcodes/sh-opc.h" -#include <ctype.h> -const char comment_chars[] = "!"; -const char line_separator_chars[] = ";"; -const char line_comment_chars[] = "!#"; - -static void s_uses PARAMS ((int)); - -static void sh_count_relocs PARAMS ((bfd *, segT, PTR)); -static void sh_frob_section PARAMS ((bfd *, segT, PTR)); - -/* This table describes all the machine specific pseudo-ops the assembler - has to support. The fields are: - pseudo-op name without dot - function to call to execute this pseudo-op - Integer arg to pass to the function - */ - -void cons (); -void s_align_bytes (); -static void s_uacons PARAMS ((int)); - -int shl = 0; - -static void -little (ignore) - int ignore; -{ - shl = 1; - target_big_endian = 0; -} - -const pseudo_typeS md_pseudo_table[] = -{ - {"int", cons, 4}, - {"word", cons, 2}, - {"form", listing_psize, 0}, - {"little", little, 0}, - {"heading", listing_title, 0}, - {"import", s_ignore, 0}, - {"page", listing_eject, 0}, - {"program", s_ignore, 0}, - {"uses", s_uses, 0}, - {"uaword", s_uacons, 2}, - {"ualong", s_uacons, 4}, - {0, 0, 0} -}; - -/*int md_reloc_size; */ - -int sh_relax; /* set if -relax seen */ - -/* Whether -small was seen. */ - -int sh_small; - -const char EXP_CHARS[] = "eE"; - -/* Chars that mean this number is a floating point constant */ -/* As in 0f12.456 */ -/* or 0d1.2345e12 */ -const char FLT_CHARS[] = "rRsSfFdDxXpP"; - -#define C(a,b) ENCODE_RELAX(a,b) - -#define JREG 14 /* Register used as a temp when relaxing */ -#define ENCODE_RELAX(what,length) (((what) << 4) + (length)) -#define GET_WHAT(x) ((x>>4)) - -/* These are the two types of relaxable instrction */ -#define COND_JUMP 1 -#define UNCOND_JUMP 2 - -#define UNDEF_DISP 0 -#define COND8 1 -#define COND12 2 -#define COND32 3 -#define UNCOND12 1 -#define UNCOND32 2 -#define UNDEF_WORD_DISP 4 -#define END 5 - -#define UNCOND12 1 -#define UNCOND32 2 - -/* Branch displacements are from the address of the branch plus - four, thus all minimum and maximum values have 4 added to them. */ -#define COND8_F 258 -#define COND8_M -252 -#define COND8_LENGTH 2 - -/* There is one extra instruction before the branch, so we must add - two more bytes to account for it. */ -#define COND12_F 4100 -#define COND12_M -4090 -#define COND12_LENGTH 6 - -/* ??? The minimum and maximum values are wrong, but this does not matter - since this relocation type is not supported yet. */ -#define COND32_F (1<<30) -#define COND32_M -(1<<30) -#define COND32_LENGTH 14 - -#define UNCOND12_F 4098 -#define UNCOND12_M -4092 -#define UNCOND12_LENGTH 2 - -/* ??? The minimum and maximum values are wrong, but this does not matter - since this relocation type is not supported yet. */ -#define UNCOND32_F (1<<30) -#define UNCOND32_M -(1<<30) -#define UNCOND32_LENGTH 14 - -const relax_typeS md_relax_table[C (END, 0)] = { - { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, - { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, - - { 0 }, - /* C (COND_JUMP, COND8) */ - { COND8_F, COND8_M, COND8_LENGTH, C (COND_JUMP, COND12) }, - /* C (COND_JUMP, COND12) */ - { COND12_F, COND12_M, COND12_LENGTH, C (COND_JUMP, COND32), }, - /* C (COND_JUMP, COND32) */ - { COND32_F, COND32_M, COND32_LENGTH, 0, }, - { 0 }, { 0 }, { 0 }, { 0 }, - { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, - - { 0 }, - /* C (UNCOND_JUMP, UNCOND12) */ - { UNCOND12_F, UNCOND12_M, UNCOND12_LENGTH, C (UNCOND_JUMP, UNCOND32), }, - /* C (UNCOND_JUMP, UNCOND32) */ - { UNCOND32_F, UNCOND32_M, UNCOND32_LENGTH, 0, }, - { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, - { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, -}; - -static struct hash_control *opcode_hash_control; /* Opcode mnemonics */ - -/* - This function is called once, at assembler startup time. This should - set up all the tables, etc that the MD part of the assembler needs - */ - -void -md_begin () -{ - sh_opcode_info *opcode; - char *prev_name = ""; - - if (! shl) - target_big_endian = 1; - - opcode_hash_control = hash_new (); - - /* Insert unique names into hash table */ - for (opcode = sh_table; opcode->name; opcode++) - { - if (strcmp (prev_name, opcode->name)) - { - prev_name = opcode->name; - hash_insert (opcode_hash_control, opcode->name, (char *) opcode); - } - else - { - /* Make all the opcodes with the same name point to the same - string */ - opcode->name = prev_name; - } - } -} - -static int reg_m; -static int reg_n; -static int reg_b; - -static expressionS immediate; /* absolute expression */ - -typedef struct - { - sh_arg_type type; - int reg; - } - -sh_operand_info; - -/* try and parse a reg name, returns number of chars consumed */ -static int -parse_reg (src, mode, reg) - char *src; - int *mode; - int *reg; -{ - /* We use !isalnum for the next character after the register name, to - make sure that we won't accidentally recognize a symbol name such as - 'sram' as being a reference to the register 'sr'. */ - - if (src[0] == 'r') - { - if (src[1] >= '0' && src[1] <= '7' && strncmp(&src[2], "_bank", 5) == 0 - && ! isalnum (src[7])) - { - *mode = A_REG_B; - *reg = (src[1] - '0'); - return 7; - } - } - - if (src[0] == 'r') - { - if (src[1] == '1') - { - if (src[2] >= '0' && src[2] <= '5' && ! isalnum (src[3])) - { - *mode = A_REG_N; - *reg = 10 + src[2] - '0'; - return 3; - } - } - if (src[1] >= '0' && src[1] <= '9' && ! isalnum (src[2])) - { - *mode = A_REG_N; - *reg = (src[1] - '0'); - return 2; - } - } - - if (src[0] == 's' && src[1] == 's' && src[2] == 'r' && ! isalnum (src[3])) - { - *mode = A_SSR; - return 3; - } - - if (src[0] == 's' && src[1] == 'p' && src[2] == 'c' && ! isalnum (src[3])) - { - *mode = A_SPC; - return 3; - } - - if (src[0] == 's' && src[1] == 'g' && src[2] == 'r' && ! isalnum (src[3])) - { - *mode = A_SGR; - return 3; - } - - if (src[0] == 'd' && src[1] == 'b' && src[2] == 'r' && ! isalnum (src[3])) - { - *mode = A_DBR; - return 3; - } - - if (src[0] == 's' && src[1] == 'r' && ! isalnum (src[2])) - { - *mode = A_SR; - return 2; - } - - if (src[0] == 's' && src[1] == 'p' && ! isalnum (src[2])) - { - *mode = A_REG_N; - *reg = 15; - return 2; - } - - if (src[0] == 'p' && src[1] == 'r' && ! isalnum (src[2])) - { - *mode = A_PR; - return 2; - } - if (src[0] == 'p' && src[1] == 'c' && ! isalnum (src[2])) - { - *mode = A_DISP_PC; - return 2; - } - if (src[0] == 'g' && src[1] == 'b' && src[2] == 'r' && ! isalnum (src[3])) - { - *mode = A_GBR; - return 3; - } - if (src[0] == 'v' && src[1] == 'b' && src[2] == 'r' && ! isalnum (src[3])) - { - *mode = A_VBR; - return 3; - } - - if (src[0] == 'm' && src[1] == 'a' && src[2] == 'c' && ! isalnum (src[4])) - { - if (src[3] == 'l') - { - *mode = A_MACL; - return 4; - } - if (src[3] == 'h') - { - *mode = A_MACH; - return 4; - } - } - if (src[0] == 'f' && src[1] == 'r') - { - if (src[2] == '1') - { - if (src[3] >= '0' && src[3] <= '5' && ! isalnum (src[4])) - { - *mode = F_REG_N; - *reg = 10 + src[3] - '0'; - return 4; - } - } - if (src[2] >= '0' && src[2] <= '9' && ! isalnum (src[3])) - { - *mode = F_REG_N; - *reg = (src[2] - '0'); - return 3; - } - } - if (src[0] == 'd' && src[1] == 'r') - { - if (src[2] == '1') - { - if (src[3] >= '0' && src[3] <= '4' && ! ((src[3] - '0') & 1) - && ! isalnum (src[4])) - { - *mode = D_REG_N; - *reg = 10 + src[3] - '0'; - return 4; - } - } - if (src[2] >= '0' && src[2] <= '8' && ! ((src[2] - '0') & 1) - && ! isalnum (src[3])) - { - *mode = D_REG_N; - *reg = (src[2] - '0'); - return 3; - } - } - if (src[0] == 'x' && src[1] == 'd') - { - if (src[2] == '1') - { - if (src[3] >= '0' && src[3] <= '4' && ! ((src[3] - '0') & 1) - && ! isalnum (src[4])) - { - *mode = X_REG_N; - *reg = 11 + src[3] - '0'; - return 4; - } - } - if (src[2] >= '0' && src[2] <= '8' && ! ((src[2] - '0') & 1) - && ! isalnum (src[3])) - { - *mode = X_REG_N; - *reg = (src[2] - '0') + 1; - return 3; - } - } - if (src[0] == 'f' && src[1] == 'v') - { - if (src[2] == '1'&& src[3] == '2' && ! isalnum (src[4])) - { - *mode = V_REG_N; - *reg = 12; - return 4; - } - if ((src[2] == '0' || src[2] == '4' || src[2] == '8') && ! isalnum (src[3])) - { - *mode = V_REG_N; - *reg = (src[2] - '0'); - return 3; - } - } - if (src[0] == 'f' && src[1] == 'p' && src[2] == 'u' && src[3] == 'l' - && ! isalnum (src[4])) - { - *mode = FPUL_N; - return 4; - } - - if (src[0] == 'f' && src[1] == 'p' && src[2] == 's' && src[3] == 'c' - && src[4] == 'r' && ! isalnum (src[5])) - { - *mode = FPSCR_N; - return 5; - } - - if (src[0] == 'x' && src[1] == 'm' && src[2] == 't' && src[3] == 'r' - && src[4] == 'x' && ! isalnum (src[5])) - { - *mode = XMTRX_M4; - return 5; - } - - return 0; -} - -static symbolS *dot() -{ - const char *fake; - - /* JF: '.' is pseudo symbol with value of current location - in current segment. */ - fake = FAKE_LABEL_NAME; - return symbol_new (fake, - now_seg, - (valueT) frag_now_fix (), - frag_now); - -} - - -static -char * -parse_exp (s) - char *s; -{ - char *save; - char *new; - - save = input_line_pointer; - input_line_pointer = s; - expression (&immediate); - if (immediate.X_op == O_absent) - as_bad ("missing operand"); - new = input_line_pointer; - input_line_pointer = save; - return new; -} - - -/* The many forms of operand: - - Rn Register direct - @Rn Register indirect - @Rn+ Autoincrement - @-Rn Autodecrement - @(disp:4,Rn) - @(disp:8,GBR) - @(disp:8,PC) - - @(R0,Rn) - @(R0,GBR) - - disp:8 - disp:12 - #imm8 - pr, gbr, vbr, macl, mach - - */ - -static -char * -parse_at (src, op) - char *src; - sh_operand_info *op; -{ - int len; - int mode; - src++; - if (src[0] == '-') - { - /* Must be predecrement */ - src++; - - len = parse_reg (src, &mode, &(op->reg)); - if (mode != A_REG_N) - as_bad ("illegal register after @-"); - - op->type = A_DEC_N; - src += len; - } - else if (src[0] == '(') - { - /* Could be @(disp, rn), @(disp, gbr), @(disp, pc), @(r0, gbr) or - @(r0, rn) */ - src++; - len = parse_reg (src, &mode, &(op->reg)); - if (len && mode == A_REG_N) - { - src += len; - if (op->reg != 0) - { - as_bad ("must be @(r0,...)"); - } - if (src[0] == ',') - src++; - /* Now can be rn or gbr */ - len = parse_reg (src, &mode, &(op->reg)); - if (mode == A_GBR) - { - op->type = A_R0_GBR; - } - else if (mode == A_REG_N) - { - op->type = A_IND_R0_REG_N; - } - else - { - as_bad ("syntax error in @(r0,...)"); - } - } - else - { - /* Must be an @(disp,.. thing) */ - src = parse_exp (src); - if (src[0] == ',') - src++; - /* Now can be rn, gbr or pc */ - len = parse_reg (src, &mode, &op->reg); - if (len) - { - if (mode == A_REG_N) - { - op->type = A_DISP_REG_N; - } - else if (mode == A_GBR) - { - op->type = A_DISP_GBR; - } - else if (mode == A_DISP_PC) - { - /* Turn a plain @(4,pc) into @(.+4,pc) */ - if (immediate.X_op == O_constant) { - immediate.X_add_symbol = dot(); - immediate.X_op = O_symbol; - } - op->type = A_DISP_PC; - } - else - { - as_bad ("syntax error in @(disp,[Rn, gbr, pc])"); - } - } - else - { - as_bad ("syntax error in @(disp,[Rn, gbr, pc])"); - } - } - src += len; - if (src[0] != ')') - as_bad ("expecting )"); - else - src++; - } - else - { - src += parse_reg (src, &mode, &(op->reg)); - if (mode != A_REG_N) - { - as_bad ("illegal register after @"); - } - if (src[0] == '+') - { - op->type = A_INC_N; - src++; - } - else - { - op->type = A_IND_N; - } - } - return src; -} - -static void -get_operand (ptr, op) - char **ptr; - sh_operand_info *op; -{ - char *src = *ptr; - int mode = -1; - unsigned int len; - - if (src[0] == '#') - { - src++; - *ptr = parse_exp (src); - op->type = A_IMM; - return; - } - - else if (src[0] == '@') - { - *ptr = parse_at (src, op); - return; - } - len = parse_reg (src, &mode, &(op->reg)); - if (len) - { - *ptr = src + len; - op->type = mode; - return; - } - else - { - /* Not a reg, the only thing left is a displacement */ - *ptr = parse_exp (src); - op->type = A_DISP_PC; - return; - } -} - -static -char * -get_operands (info, args, operand) - sh_opcode_info *info; - char *args; - sh_operand_info *operand; - -{ - char *ptr = args; - if (info->arg[0]) - { - ptr++; - - get_operand (&ptr, operand + 0); - if (info->arg[1]) - { - if (*ptr == ',') - { - ptr++; - } - get_operand (&ptr, operand + 1); - if (info->arg[2]) - { - if (*ptr == ',') - { - ptr++; - } - get_operand (&ptr, operand + 2); - } - else - { - operand[2].type = 0; - } - } - else - { - operand[1].type = 0; - operand[2].type = 0; - } - } - else - { - operand[0].type = 0; - operand[1].type = 0; - operand[2].type = 0; - } - return ptr; -} - -/* Passed a pointer to a list of opcodes which use different - addressing modes, return the opcode which matches the opcodes - provided - */ - -static -sh_opcode_info * -get_specific (opcode, operands) - sh_opcode_info *opcode; - sh_operand_info *operands; -{ - sh_opcode_info *this_try = opcode; - char *name = opcode->name; - int n = 0; - while (opcode->name) - { - this_try = opcode++; - if (this_try->name != name) - { - /* We've looked so far down the table that we've run out of - opcodes with the same name */ - return 0; - } - /* look at both operands needed by the opcodes and provided by - the user - since an arg test will often fail on the same arg - again and again, we'll try and test the last failing arg the - first on each opcode try */ - - for (n = 0; this_try->arg[n]; n++) - { - sh_operand_info *user = operands + n; - sh_arg_type arg = this_try->arg[n]; - switch (arg) - { - case A_IMM: - case A_BDISP12: - case A_BDISP8: - case A_DISP_GBR: - case A_DISP_PC: - case A_MACH: - case A_PR: - case A_MACL: - if (user->type != arg) - goto fail; - break; - case A_R0: - /* opcode needs r0 */ - if (user->type != A_REG_N || user->reg != 0) - goto fail; - break; - case A_R0_GBR: - if (user->type != A_R0_GBR || user->reg != 0) - goto fail; - break; - case F_FR0: - if (user->type != F_REG_N || user->reg != 0) - goto fail; - break; - - case A_REG_N: - case A_INC_N: - case A_DEC_N: - case A_IND_N: - case A_IND_R0_REG_N: - case A_DISP_REG_N: - case F_REG_N: - case D_REG_N: - case X_REG_N: - case V_REG_N: - case FPUL_N: - case FPSCR_N: - /* Opcode needs rn */ - if (user->type != arg) - goto fail; - reg_n = user->reg; - break; - case FD_REG_N: - if (user->type != F_REG_N && user->type != D_REG_N) - goto fail; - reg_n = user->reg; - break; - case DX_REG_N: - if (user->type != D_REG_N && user->type != X_REG_N) - goto fail; - reg_n = user->reg; - break; - case A_GBR: - case A_SR: - case A_VBR: - case A_SSR: - case A_SPC: - case A_SGR: - case A_DBR: - if (user->type != arg) - goto fail; - break; - - case A_REG_B: - if (user->type != arg) - goto fail; - reg_b = user->reg; - break; - - case A_REG_M: - case A_INC_M: - case A_DEC_M: - case A_IND_M: - case A_IND_R0_REG_M: - case A_DISP_REG_M: - /* Opcode needs rn */ - if (user->type != arg - A_REG_M + A_REG_N) - goto fail; - reg_m = user->reg; - break; - - case F_REG_M: - case D_REG_M: - case X_REG_M: - case V_REG_M: - case FPUL_M: - case FPSCR_M: - /* Opcode needs rn */ - if (user->type != arg - F_REG_M + F_REG_N) - goto fail; - reg_m = user->reg; - break; - case DX_REG_M: - if (user->type != D_REG_N && user->type != X_REG_N) - goto fail; - reg_m = user->reg; - break; - case XMTRX_M4: - if (user->type != XMTRX_M4) - goto fail; - reg_m = 4; - break; - - default: - printf ("unhandled %d\n", arg); - goto fail; - } - } - return this_try; - fail:; - } - - return 0; -} - -int -check (operand, low, high) - expressionS *operand; - int low; - int high; -{ - if (operand->X_op != O_constant - || operand->X_add_number < low - || operand->X_add_number > high) - { - as_bad ("operand must be absolute in range %d..%d", low, high); - } - return operand->X_add_number; -} - - -static void -insert (where, how, pcrel) - char *where; - int how; - int pcrel; -{ - fix_new_exp (frag_now, - where - frag_now->fr_literal, - 2, - &immediate, - pcrel, - how); -} - -static void -build_relax (opcode) - sh_opcode_info *opcode; -{ - int high_byte = target_big_endian ? 0 : 1; - char *p; - - if (opcode->arg[0] == A_BDISP8) - { - p = frag_var (rs_machine_dependent, - md_relax_table[C (COND_JUMP, COND32)].rlx_length, - md_relax_table[C (COND_JUMP, COND8)].rlx_length, - C (COND_JUMP, 0), - immediate.X_add_symbol, - immediate.X_add_number, - 0); - p[high_byte] = (opcode->nibbles[0] << 4) | (opcode->nibbles[1]); - } - else if (opcode->arg[0] == A_BDISP12) - { - p = frag_var (rs_machine_dependent, - md_relax_table[C (UNCOND_JUMP, UNCOND32)].rlx_length, - md_relax_table[C (UNCOND_JUMP, UNCOND12)].rlx_length, - C (UNCOND_JUMP, 0), - immediate.X_add_symbol, - immediate.X_add_number, - 0); - p[high_byte] = (opcode->nibbles[0] << 4); - } - -} - -/* Now we know what sort of opcodes it is, lets build the bytes - - */ -static void -build_Mytes (opcode, operand) - sh_opcode_info *opcode; - sh_operand_info *operand; - -{ - int index; - char nbuf[4]; - char *output = frag_more (2); - int low_byte = target_big_endian ? 1 : 0; - nbuf[0] = 0; - nbuf[1] = 0; - nbuf[2] = 0; - nbuf[3] = 0; - - for (index = 0; index < 4; index++) - { - sh_nibble_type i = opcode->nibbles[index]; - if (i < 16) - { - nbuf[index] = i; - } - else - { - switch (i) - { - case REG_N: - nbuf[index] = reg_n; - break; - case REG_M: - nbuf[index] = reg_m; - break; - case REG_NM: - nbuf[index] = reg_n | (reg_m >> 2); - break; - case REG_B: - nbuf[index] = reg_b | 0x08; - break; - case DISP_4: - insert (output + low_byte, BFD_RELOC_SH_IMM4, 0); - break; - case IMM_4BY4: - insert (output + low_byte, BFD_RELOC_SH_IMM4BY4, 0); - break; - case IMM_4BY2: - insert (output + low_byte, BFD_RELOC_SH_IMM4BY2, 0); - break; - case IMM_4: - insert (output + low_byte, BFD_RELOC_SH_IMM4, 0); - break; - case IMM_8BY4: - insert (output + low_byte, BFD_RELOC_SH_IMM8BY4, 0); - break; - case IMM_8BY2: - insert (output + low_byte, BFD_RELOC_SH_IMM8BY2, 0); - break; - case IMM_8: - insert (output + low_byte, BFD_RELOC_SH_IMM8, 0); - break; - case PCRELIMM_8BY4: - insert (output, BFD_RELOC_SH_PCRELIMM8BY4, 1); - break; - case PCRELIMM_8BY2: - insert (output, BFD_RELOC_SH_PCRELIMM8BY2, 1); - break; - default: - printf ("failed for %d\n", i); - } - } - } - if (! target_big_endian) { - output[1] = (nbuf[0] << 4) | (nbuf[1]); - output[0] = (nbuf[2] << 4) | (nbuf[3]); - } - else { - output[0] = (nbuf[0] << 4) | (nbuf[1]); - output[1] = (nbuf[2] << 4) | (nbuf[3]); - } -} - -/* This is the guts of the machine-dependent assembler. STR points to a - machine dependent instruction. This function is supposed to emit - the frags/bytes it assembles to. - */ - -void -md_assemble (str) - char *str; -{ - unsigned char *op_start; - unsigned char *op_end; - sh_operand_info operand[3]; - sh_opcode_info *opcode; - char name[20]; - int nlen = 0; - /* Drop leading whitespace */ - while (*str == ' ') - str++; - - /* find the op code end */ - for (op_start = op_end = (unsigned char *) (str); - *op_end - && nlen < 20 - && !is_end_of_line[*op_end] && *op_end != ' '; - op_end++) - { - name[nlen] = op_start[nlen]; - nlen++; - } - name[nlen] = 0; - - if (nlen == 0) - { - as_bad ("can't find opcode "); - } - - opcode = (sh_opcode_info *) hash_find (opcode_hash_control, name); - - if (opcode == NULL) - { - as_bad ("unknown opcode"); - return; - } - - if (sh_relax - && ! seg_info (now_seg)->tc_segment_info_data.in_code) - { - /* Output a CODE reloc to tell the linker that the following - bytes are instructions, not data. */ - fix_new (frag_now, frag_now_fix (), 2, &abs_symbol, 0, 0, - BFD_RELOC_SH_CODE); - seg_info (now_seg)->tc_segment_info_data.in_code = 1; - } - - if (opcode->arg[0] == A_BDISP12 - || opcode->arg[0] == A_BDISP8) - { - parse_exp (op_end + 1); - build_relax (opcode); - } - else - { - if (opcode->arg[0] != A_END) - { - get_operands (opcode, op_end, operand); - } - opcode = get_specific (opcode, operand); - - if (opcode == 0) - { - /* Couldn't find an opcode which matched the operands */ - char *where = frag_more (2); - - where[0] = 0x0; - where[1] = 0x0; - as_bad ("invalid operands for opcode"); - return; - } - - build_Mytes (opcode, operand); - } - -} - -/* This routine is called each time a label definition is seen. It - emits a BFD_RELOC_SH_LABEL reloc if necessary. */ - -void -sh_frob_label () -{ - static fragS *last_label_frag; - static int last_label_offset; - - if (sh_relax - && seg_info (now_seg)->tc_segment_info_data.in_code) - { - int offset; - - offset = frag_now_fix (); - if (frag_now != last_label_frag - || offset != last_label_offset) - { - fix_new (frag_now, offset, 2, &abs_symbol, 0, 0, BFD_RELOC_SH_LABEL); - last_label_frag = frag_now; - last_label_offset = offset; - } - } -} - -/* This routine is called when the assembler is about to output some - data. It emits a BFD_RELOC_SH_DATA reloc if necessary. */ - -void -sh_flush_pending_output () -{ - if (sh_relax - && seg_info (now_seg)->tc_segment_info_data.in_code) - { - fix_new (frag_now, frag_now_fix (), 2, &abs_symbol, 0, 0, - BFD_RELOC_SH_DATA); - seg_info (now_seg)->tc_segment_info_data.in_code = 0; - } -} - -symbolS * -DEFUN (md_undefined_symbol, (name), - char *name) -{ - return 0; -} - -#ifdef OBJ_COFF - -void -DEFUN (tc_crawl_symbol_chain, (headers), - object_headers * headers) -{ - printf ("call to tc_crawl_symbol_chain \n"); -} - -void -DEFUN (tc_headers_hook, (headers), - object_headers * headers) -{ - printf ("call to tc_headers_hook \n"); -} - -#endif - -/* Various routines to kill one day */ -/* Equal to MAX_PRECISION in atof-ieee.c */ -#define MAX_LITTLENUMS 6 - -/* Turn a string in input_line_pointer into a floating point constant of type - type, and store the appropriate bytes in *litP. The number of LITTLENUMS - emitted is stored in *sizeP . An error message is returned, or NULL on OK. - */ -char * -md_atof (type, litP, sizeP) - int type; - char *litP; - int *sizeP; -{ - int prec; - LITTLENUM_TYPE words[4]; - char *t; - int i; - - switch (type) - { - case 'f': - prec = 2; - break; - - case 'd': - prec = 4; - break; - - default: - *sizeP = 0; - return "bad call to md_atof"; - } - - t = atof_ieee (input_line_pointer, type, words); - if (t) - input_line_pointer = t; - - *sizeP = prec * 2; - - if (! target_big_endian) - { - for (i = prec - 1; i >= 0; i--) - { - md_number_to_chars (litP, (valueT) words[i], 2); - litP += 2; - } - } - else - { - for (i = 0; i < prec; i++) - { - md_number_to_chars (litP, (valueT) words[i], 2); - litP += 2; - } - } - - return NULL; -} - -/* Handle the .uses pseudo-op. This pseudo-op is used just before a - call instruction. It refers to a label of the instruction which - loads the register which the call uses. We use it to generate a - special reloc for the linker. */ - -static void -s_uses (ignore) - int ignore; -{ - expressionS ex; - - if (! sh_relax) - as_warn (".uses pseudo-op seen when not relaxing"); - - expression (&ex); - - if (ex.X_op != O_symbol || ex.X_add_number != 0) - { - as_bad ("bad .uses format"); - ignore_rest_of_line (); - return; - } - - fix_new_exp (frag_now, frag_now_fix (), 2, &ex, 1, BFD_RELOC_SH_USES); - - demand_empty_rest_of_line (); -} - -CONST char *md_shortopts = ""; -struct option md_longopts[] = { - -#define OPTION_RELAX (OPTION_MD_BASE) -#define OPTION_LITTLE (OPTION_MD_BASE + 1) -#define OPTION_SMALL (OPTION_LITTLE + 1) - - {"relax", no_argument, NULL, OPTION_RELAX}, - {"little", no_argument, NULL, OPTION_LITTLE}, - {"small", no_argument, NULL, OPTION_SMALL}, - {NULL, no_argument, NULL, 0} -}; -size_t md_longopts_size = sizeof(md_longopts); - -int -md_parse_option (c, arg) - int c; - char *arg; -{ - switch (c) - { - case OPTION_RELAX: - sh_relax = 1; - break; - - case OPTION_LITTLE: - shl = 1; - target_big_endian = 0; - break; - - case OPTION_SMALL: - sh_small = 1; - break; - - default: - return 0; - } - - return 1; -} - -void -md_show_usage (stream) - FILE *stream; -{ - fprintf(stream, "\ -SH options:\n\ --little generate little endian code\n\ --relax alter jump instructions for long displacements\n\ --small align sections to 4 byte boundaries, not 16\n"); -} - -int md_short_jump_size; - -void -tc_Nout_fix_to_chars () -{ - printf ("call to tc_Nout_fix_to_chars \n"); - abort (); -} - -void -md_create_short_jump (ptr, from_Nddr, to_Nddr, frag, to_symbol) - char *ptr; - addressT from_Nddr; - addressT to_Nddr; - fragS *frag; - symbolS *to_symbol; -{ - as_fatal ("failed sanity check."); -} - -void -md_create_long_jump (ptr, from_Nddr, to_Nddr, frag, to_symbol) - char *ptr; - addressT from_Nddr, to_Nddr; - fragS *frag; - symbolS *to_symbol; -{ - as_fatal ("failed sanity check."); -} - -/* This struct is used to pass arguments to sh_count_relocs through - bfd_map_over_sections. */ - -struct sh_count_relocs -{ - /* Symbol we are looking for. */ - symbolS *sym; - /* Count of relocs found. */ - int count; -}; - -/* Count the number of fixups in a section which refer to a particular - symbol. When using BFD_ASSEMBLER, this is called via - bfd_map_over_sections. */ - -/*ARGSUSED*/ -static void -sh_count_relocs (abfd, sec, data) - bfd *abfd; - segT sec; - PTR data; -{ - struct sh_count_relocs *info = (struct sh_count_relocs *) data; - segment_info_type *seginfo; - symbolS *sym; - fixS *fix; - - seginfo = seg_info (sec); - if (seginfo == NULL) - return; - - sym = info->sym; - for (fix = seginfo->fix_root; fix != NULL; fix = fix->fx_next) - { - if (fix->fx_addsy == sym) - { - ++info->count; - fix->fx_tcbit = 1; - } - } -} - -/* Handle the count relocs for a particular section. When using - BFD_ASSEMBLER, this is called via bfd_map_over_sections. */ - -/*ARGSUSED*/ -static void -sh_frob_section (abfd, sec, ignore) - bfd *abfd; - segT sec; - PTR ignore; -{ - segment_info_type *seginfo; - fixS *fix; - - seginfo = seg_info (sec); - if (seginfo == NULL) - return; - - for (fix = seginfo->fix_root; fix != NULL; fix = fix->fx_next) - { - symbolS *sym; - bfd_vma val; - fixS *fscan; - struct sh_count_relocs info; - - if (fix->fx_r_type != BFD_RELOC_SH_USES) - continue; - - /* The BFD_RELOC_SH_USES reloc should refer to a defined local - symbol in the same section. */ - sym = fix->fx_addsy; - if (sym == NULL - || fix->fx_subsy != NULL - || fix->fx_addnumber != 0 - || S_GET_SEGMENT (sym) != sec -#if ! defined (BFD_ASSEMBLER) && defined (OBJ_COFF) - || S_GET_STORAGE_CLASS (sym) == C_EXT -#endif - || S_IS_EXTERNAL (sym)) - { - as_warn_where (fix->fx_file, fix->fx_line, - ".uses does not refer to a local symbol in the same section"); - continue; - } - - /* Look through the fixups again, this time looking for one - at the same location as sym. */ - val = S_GET_VALUE (sym); - for (fscan = seginfo->fix_root; - fscan != NULL; - fscan = fscan->fx_next) - if (val == fscan->fx_frag->fr_address + fscan->fx_where - && fscan->fx_r_type != BFD_RELOC_SH_ALIGN - && fscan->fx_r_type != BFD_RELOC_SH_CODE - && fscan->fx_r_type != BFD_RELOC_SH_DATA - && fscan->fx_r_type != BFD_RELOC_SH_LABEL) - break; - if (fscan == NULL) - { - as_warn_where (fix->fx_file, fix->fx_line, - "can't find fixup pointed to by .uses"); - continue; - } - - if (fscan->fx_tcbit) - { - /* We've already done this one. */ - continue; - } - - /* fscan should also be a fixup to a local symbol in the same - section. */ - sym = fscan->fx_addsy; - if (sym == NULL - || fscan->fx_subsy != NULL - || fscan->fx_addnumber != 0 - || S_GET_SEGMENT (sym) != sec -#if ! defined (BFD_ASSEMBLER) && defined (OBJ_COFF) - || S_GET_STORAGE_CLASS (sym) == C_EXT -#endif - || S_IS_EXTERNAL (sym)) - { - as_warn_where (fix->fx_file, fix->fx_line, - ".uses target does not refer to a local symbol in the same section"); - continue; - } - - /* Now we look through all the fixups of all the sections, - counting the number of times we find a reference to sym. */ - info.sym = sym; - info.count = 0; -#ifdef BFD_ASSEMBLER - bfd_map_over_sections (stdoutput, sh_count_relocs, (PTR) &info); -#else - { - int iscan; - - for (iscan = SEG_E0; iscan < SEG_UNKNOWN; iscan++) - sh_count_relocs ((bfd *) NULL, iscan, (PTR) &info); - } -#endif - - if (info.count < 1) - abort (); - - /* Generate a BFD_RELOC_SH_COUNT fixup at the location of sym. - We have already adjusted the value of sym to include the - fragment address, so we undo that adjustment here. */ - subseg_change (sec, 0); - fix_new (sym->sy_frag, S_GET_VALUE (sym) - sym->sy_frag->fr_address, - 4, &abs_symbol, info.count, 0, BFD_RELOC_SH_COUNT); - } -} - -/* This function is called after the symbol table has been completed, - but before the relocs or section contents have been written out. - If we have seen any .uses pseudo-ops, they point to an instruction - which loads a register with the address of a function. We look - through the fixups to find where the function address is being - loaded from. We then generate a COUNT reloc giving the number of - times that function address is referred to. The linker uses this - information when doing relaxing, to decide when it can eliminate - the stored function address entirely. */ - -void -sh_frob_file () -{ - if (! sh_relax) - return; - -#ifdef BFD_ASSEMBLER - bfd_map_over_sections (stdoutput, sh_frob_section, (PTR) NULL); -#else - { - int iseg; - - for (iseg = SEG_E0; iseg < SEG_UNKNOWN; iseg++) - sh_frob_section ((bfd *) NULL, iseg, (PTR) NULL); - } -#endif -} - -/* Called after relaxing. Set the correct sizes of the fragments, and - create relocs so that md_apply_fix will fill in the correct values. */ - -void -md_convert_frag (headers, seg, fragP) -#ifdef BFD_ASSEMBLER - bfd *headers; -#else - object_headers *headers; -#endif - segT seg; - fragS *fragP; -{ - int donerelax = 0; - - switch (fragP->fr_subtype) - { - case C (COND_JUMP, COND8): - subseg_change (seg, 0); - fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset, - 1, BFD_RELOC_SH_PCDISP8BY2); - fragP->fr_fix += 2; - fragP->fr_var = 0; - break; - - case C (UNCOND_JUMP, UNCOND12): - subseg_change (seg, 0); - fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset, - 1, BFD_RELOC_SH_PCDISP12BY2); - fragP->fr_fix += 2; - fragP->fr_var = 0; - break; - - case C (UNCOND_JUMP, UNCOND32): - case C (UNCOND_JUMP, UNDEF_WORD_DISP): - if (fragP->fr_symbol == NULL) - as_bad ("at 0x%lx, displacement overflows 12-bit field", - (unsigned long) fragP->fr_address); - else - as_bad ("at 0x%lx, displacement to %sdefined symbol %s overflows 12-bit field", - (unsigned long) fragP->fr_address, - S_IS_DEFINED (fragP->fr_symbol) ? "" : "un", - S_GET_NAME (fragP->fr_symbol)); - -#if 0 /* This code works, but generates poor code and the compiler - should never produce a sequence that requires it to be used. */ - - /* A jump wont fit in 12 bits, make code which looks like - bra foo - mov.w @(0, PC), r14 - .long disp - foo: bra @r14 - */ - int t = buffer[0] & 0x10; - - buffer[highbyte] = 0xa0; /* branch over move and disp */ - buffer[lowbyte] = 3; - buffer[highbyte+2] = 0xd0 | JREG; /* Build mov insn */ - buffer[lowbyte+2] = 0x00; - - buffer[highbyte+4] = 0; /* space for 32 bit jump disp */ - buffer[lowbyte+4] = 0; - buffer[highbyte+6] = 0; - buffer[lowbyte+6] = 0; - - buffer[highbyte+8] = 0x40 | JREG; /* Build jmp @JREG */ - buffer[lowbyte+8] = t ? 0xb : 0x2b; - - buffer[highbyte+10] = 0x20; /* build nop */ - buffer[lowbyte+10] = 0x0b; - - /* Make reloc for the long disp */ - fix_new (fragP, - fragP->fr_fix + 4, - 4, - fragP->fr_symbol, - fragP->fr_offset, - 0, - BFD_RELOC_32); - fragP->fr_fix += UNCOND32_LENGTH; - fragP->fr_var = 0; - donerelax = 1; -#endif - - break; - - case C (COND_JUMP, COND12): - /* A bcond won't fit, so turn it into a b!cond; bra disp; nop */ - { - unsigned char *buffer = - (unsigned char *) (fragP->fr_fix + fragP->fr_literal); - int highbyte = target_big_endian ? 0 : 1; - int lowbyte = target_big_endian ? 1 : 0; - - /* Toggle the true/false bit of the bcond. */ - buffer[highbyte] ^= 0x2; - - /* Build a relocation to six bytes farther on. */ - subseg_change (seg, 0); - fix_new (fragP, fragP->fr_fix, 2, -#ifdef BFD_ASSEMBLER - section_symbol (seg), -#else - seg_info (seg)->dot, -#endif - fragP->fr_address + fragP->fr_fix + 6, - 1, BFD_RELOC_SH_PCDISP8BY2); - - /* Set up a jump instruction. */ - buffer[highbyte + 2] = 0xa0; - buffer[lowbyte + 2] = 0; - fix_new (fragP, fragP->fr_fix + 2, 2, fragP->fr_symbol, - fragP->fr_offset, 1, BFD_RELOC_SH_PCDISP12BY2); - - /* Fill in a NOP instruction. */ - buffer[highbyte + 4] = 0x0; - buffer[lowbyte + 4] = 0x9; - - fragP->fr_fix += 6; - fragP->fr_var = 0; - donerelax = 1; - } - break; - - case C (COND_JUMP, COND32): - case C (COND_JUMP, UNDEF_WORD_DISP): - if (fragP->fr_symbol == NULL) - as_bad ("at 0x%lx, displacement overflows 8-bit field", - (unsigned long) fragP->fr_address); - else - as_bad ("at 0x%lx, displacement to %sdefined symbol %s overflows 8-bit field ", - (unsigned long) fragP->fr_address, - S_IS_DEFINED (fragP->fr_symbol) ? "" : "un", - S_GET_NAME (fragP->fr_symbol)); - -#if 0 /* This code works, but generates poor code, and the compiler - should never produce a sequence that requires it to be used. */ - - /* A bcond won't fit and it won't go into a 12 bit - displacement either, the code sequence looks like: - b!cond foop - mov.w @(n, PC), r14 - jmp @r14 - nop - .long where - foop: - */ - - buffer[0] ^= 0x2; /* Toggle T/F bit */ -#define JREG 14 - buffer[1] = 5; /* branch over mov, jump, nop and ptr */ - buffer[2] = 0xd0 | JREG; /* Build mov insn */ - buffer[3] = 0x2; - buffer[4] = 0x40 | JREG; /* Build jmp @JREG */ - buffer[5] = 0x0b; - buffer[6] = 0x20; /* build nop */ - buffer[7] = 0x0b; - buffer[8] = 0; /* space for 32 bit jump disp */ - buffer[9] = 0; - buffer[10] = 0; - buffer[11] = 0; - buffer[12] = 0; - buffer[13] = 0; - /* Make reloc for the long disp */ - fix_new (fragP, - fragP->fr_fix + 8, - 4, - fragP->fr_symbol, - fragP->fr_offset, - 0, - BFD_RELOC_32); - fragP->fr_fix += COND32_LENGTH; - fragP->fr_var = 0; - donerelax = 1; -#endif - - break; - - default: - abort (); - } - - if (donerelax && !sh_relax) - as_warn_where (fragP->fr_file, fragP->fr_line, - "overflow in branch to %s; converted into longer instruction sequence", - (fragP->fr_symbol != NULL - ? S_GET_NAME (fragP->fr_symbol) - : "")); -} - -valueT -DEFUN (md_section_align, (seg, size), - segT seg AND - valueT size) -{ -#ifdef BFD_ASSEMBLER -#ifdef OBJ_ELF - return size; -#else /* ! OBJ_ELF */ - return ((size + (1 << bfd_get_section_alignment (stdoutput, seg)) - 1) - & (-1 << bfd_get_section_alignment (stdoutput, seg))); -#endif /* ! OBJ_ELF */ -#else /* ! BFD_ASSEMBLER */ - return ((size + (1 << section_alignment[(int) seg]) - 1) - & (-1 << section_alignment[(int) seg])); -#endif /* ! BFD_ASSEMBLER */ -} - -/* This static variable is set by s_uacons to tell sh_cons_align that - the expession does not need to be aligned. */ - -static int sh_no_align_cons = 0; - -/* This handles the unaligned space allocation pseudo-ops, such as - .uaword. .uaword is just like .word, but the value does not need - to be aligned. */ - -static void -s_uacons (bytes) - int bytes; -{ - /* Tell sh_cons_align not to align this value. */ - sh_no_align_cons = 1; - cons (bytes); -} - -/* If a .word, et. al., pseud-op is seen, warn if the value is not - aligned correctly. Note that this can cause warnings to be issued - when assembling initialized structured which were declared with the - packed attribute. FIXME: Perhaps we should require an option to - enable this warning? */ - -void -sh_cons_align (nbytes) - int nbytes; -{ - int nalign; - char *p; - - if (sh_no_align_cons) - { - /* This is an unaligned pseudo-op. */ - sh_no_align_cons = 0; - return; - } - - nalign = 0; - while ((nbytes & 1) == 0) - { - ++nalign; - nbytes >>= 1; - } - - if (nalign == 0) - return; - - if (now_seg == absolute_section) - { - if ((abs_section_offset & ((1 << nalign) - 1)) != 0) - as_warn ("misaligned data"); - return; - } - - p = frag_var (rs_align_code, 1, 1, (relax_substateT) 0, - (symbolS *) NULL, (offsetT) nalign, (char *) NULL); - - record_alignment (now_seg, nalign); -} - -/* When relaxing, we need to output a reloc for any .align directive - that requests alignment to a four byte boundary or larger. This is - also where we check for misaligned data. */ - -void -sh_handle_align (frag) - fragS *frag; -{ - if (sh_relax - && frag->fr_type == rs_align - && frag->fr_address + frag->fr_fix > 0 - && frag->fr_offset > 1 - && now_seg != bss_section) - fix_new (frag, frag->fr_fix, 2, &abs_symbol, frag->fr_offset, 0, - BFD_RELOC_SH_ALIGN); - - if (frag->fr_type == rs_align_code - && frag->fr_next->fr_address - frag->fr_address - frag->fr_fix != 0) - as_warn_where (frag->fr_file, frag->fr_line, "misaligned data"); -} - -/* This macro decides whether a particular reloc is an entry in a - switch table. It is used when relaxing, because the linker needs - to know about all such entries so that it can adjust them if - necessary. */ - -#ifdef BFD_ASSEMBLER -#define SWITCH_TABLE_CONS(fix) (0) -#else -#define SWITCH_TABLE_CONS(fix) \ - ((fix)->fx_r_type == 0 \ - && ((fix)->fx_size == 2 \ - || (fix)->fx_size == 1 \ - || (fix)->fx_size == 4)) -#endif - -#define SWITCH_TABLE(fix) \ - ((fix)->fx_addsy != NULL \ - && (fix)->fx_subsy != NULL \ - && S_GET_SEGMENT ((fix)->fx_addsy) == text_section \ - && S_GET_SEGMENT ((fix)->fx_subsy) == text_section \ - && ((fix)->fx_r_type == BFD_RELOC_32 \ - || (fix)->fx_r_type == BFD_RELOC_16 \ - || (fix)->fx_r_type == BFD_RELOC_8 \ - || SWITCH_TABLE_CONS (fix))) - -/* See whether we need to force a relocation into the output file. - This is used to force out switch and PC relative relocations when - relaxing. */ - -int -sh_force_relocation (fix) - fixS *fix; -{ - if (! sh_relax) - return 0; - - return (fix->fx_pcrel - || SWITCH_TABLE (fix) - || fix->fx_r_type == BFD_RELOC_SH_COUNT - || fix->fx_r_type == BFD_RELOC_SH_ALIGN - || fix->fx_r_type == BFD_RELOC_SH_CODE - || fix->fx_r_type == BFD_RELOC_SH_DATA - || fix->fx_r_type == BFD_RELOC_SH_LABEL); -} - -/* Apply a fixup to the object file. */ - -#ifdef BFD_ASSEMBLER -int -md_apply_fix (fixP, valp) - fixS *fixP; - valueT *valp; -#else -void -md_apply_fix (fixP, val) - fixS *fixP; - long val; -#endif -{ - char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; - int lowbyte = target_big_endian ? 1 : 0; - int highbyte = target_big_endian ? 0 : 1; -#ifdef BFD_ASSEMBLER - long val = *valp; -#endif - long max, min; - int shift; - -#ifndef BFD_ASSEMBLER - if (fixP->fx_r_type == 0) - { - if (fixP->fx_size == 2) - fixP->fx_r_type = BFD_RELOC_16; - else if (fixP->fx_size == 4) - fixP->fx_r_type = BFD_RELOC_32; - else if (fixP->fx_size == 1) - fixP->fx_r_type = BFD_RELOC_8; - else - abort (); - } -#endif - - max = min = 0; - shift = 0; - switch (fixP->fx_r_type) - { - case BFD_RELOC_SH_IMM4: - max = 0xf; - *buf = (*buf & 0xf0) | (val & 0xf); - break; - - case BFD_RELOC_SH_IMM4BY2: - max = 0xf; - shift = 1; - *buf = (*buf & 0xf0) | ((val >> 1) & 0xf); - break; - - case BFD_RELOC_SH_IMM4BY4: - max = 0xf; - shift = 2; - *buf = (*buf & 0xf0) | ((val >> 2) & 0xf); - break; - - case BFD_RELOC_SH_IMM8BY2: - max = 0xff; - shift = 1; - *buf = val >> 1; - break; - - case BFD_RELOC_SH_IMM8BY4: - max = 0xff; - shift = 2; - *buf = val >> 2; - break; - - case BFD_RELOC_8: - case BFD_RELOC_SH_IMM8: - /* Sometimes the 8 bit value is sign extended (e.g., add) and - sometimes it is not (e.g., and). We permit any 8 bit value. - Note that adding further restrictions may invalidate - reasonable looking assembly code, such as ``and -0x1,r0''. */ - max = 0xff; - min = - 0xff; - *buf++ = val; - break; - - case BFD_RELOC_SH_PCRELIMM8BY4: - /* The lower two bits of the PC are cleared before the - displacement is added in. We can assume that the destination - is on a 4 byte bounday. If this instruction is also on a 4 - byte boundary, then we want - (target - here) / 4 - and target - here is a multiple of 4. - Otherwise, we are on a 2 byte boundary, and we want - (target - (here - 2)) / 4 - and target - here is not a multiple of 4. Computing - (target - (here - 2)) / 4 == (target - here + 2) / 4 - works for both cases, since in the first case the addition of - 2 will be removed by the division. target - here is in the - variable val. */ - val = (val + 2) / 4; - if (val & ~0xff) - as_bad_where (fixP->fx_file, fixP->fx_line, "pcrel too far"); - buf[lowbyte] = val; - break; - - case BFD_RELOC_SH_PCRELIMM8BY2: - val /= 2; - if (val & ~0xff) - as_bad_where (fixP->fx_file, fixP->fx_line, "pcrel too far"); - buf[lowbyte] = val; - break; - - case BFD_RELOC_SH_PCDISP8BY2: - val /= 2; - if (val < -0x80 || val > 0x7f) - as_bad_where (fixP->fx_file, fixP->fx_line, "pcrel too far"); - buf[lowbyte] = val; - break; - - case BFD_RELOC_SH_PCDISP12BY2: - val /= 2; - if (val < -0x800 || val >= 0x7ff) - as_bad_where (fixP->fx_file, fixP->fx_line, "pcrel too far"); - buf[lowbyte] = val & 0xff; - buf[highbyte] |= (val >> 8) & 0xf; - break; - - case BFD_RELOC_32: - if (! target_big_endian) - { - *buf++ = val >> 0; - *buf++ = val >> 8; - *buf++ = val >> 16; - *buf++ = val >> 24; - } - else - { - *buf++ = val >> 24; - *buf++ = val >> 16; - *buf++ = val >> 8; - *buf++ = val >> 0; - } - break; - - case BFD_RELOC_16: - if (! target_big_endian) - { - *buf++ = val >> 0; - *buf++ = val >> 8; - } - else - { - *buf++ = val >> 8; - *buf++ = val >> 0; - } - break; - - case BFD_RELOC_SH_USES: - /* Pass the value into sh_coff_reloc_mangle. */ - fixP->fx_addnumber = val; - break; - - case BFD_RELOC_SH_COUNT: - case BFD_RELOC_SH_ALIGN: - case BFD_RELOC_SH_CODE: - case BFD_RELOC_SH_DATA: - case BFD_RELOC_SH_LABEL: - /* Nothing to do here. */ - break; - - default: - abort (); - } - - if (shift != 0) - { - if ((val & ((1 << shift) - 1)) != 0) - as_bad_where (fixP->fx_file, fixP->fx_line, "misaligned offset"); - if (val >= 0) - val >>= shift; - else - val = ((val >> shift) - | ((long) -1 & ~ ((long) -1 >> shift))); - } - if (max != 0 && (val < min || val > max)) - as_bad_where (fixP->fx_file, fixP->fx_line, "offset out of range"); - -#ifdef BFD_ASSEMBLER - return 0; -#endif -} - -int md_long_jump_size; - -/* Called just before address relaxation. Return the length - by which a fragment must grow to reach it's destination. */ - -int -md_estimate_size_before_relax (fragP, segment_type) - register fragS *fragP; - register segT segment_type; -{ - switch (fragP->fr_subtype) - { - case C (UNCOND_JUMP, UNDEF_DISP): - /* used to be a branch to somewhere which was unknown */ - if (!fragP->fr_symbol) - { - fragP->fr_subtype = C (UNCOND_JUMP, UNCOND12); - fragP->fr_var = md_relax_table[C (UNCOND_JUMP, UNCOND12)].rlx_length; - } - else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type) - { - fragP->fr_subtype = C (UNCOND_JUMP, UNCOND12); - fragP->fr_var = md_relax_table[C (UNCOND_JUMP, UNCOND12)].rlx_length; - } - else - { - fragP->fr_subtype = C (UNCOND_JUMP, UNDEF_WORD_DISP); - fragP->fr_var = md_relax_table[C (UNCOND_JUMP, UNCOND32)].rlx_length; - return md_relax_table[C (UNCOND_JUMP, UNCOND32)].rlx_length; - } - break; - - default: - abort (); - case C (COND_JUMP, UNDEF_DISP): - /* used to be a branch to somewhere which was unknown */ - if (fragP->fr_symbol - && S_GET_SEGMENT (fragP->fr_symbol) == segment_type) - { - /* Got a symbol and it's defined in this segment, become byte - sized - maybe it will fix up */ - fragP->fr_subtype = C (COND_JUMP, COND8); - fragP->fr_var = md_relax_table[C (COND_JUMP, COND8)].rlx_length; - } - else if (fragP->fr_symbol) - { - /* Its got a segment, but its not ours, so it will always be long */ - fragP->fr_subtype = C (COND_JUMP, UNDEF_WORD_DISP); - fragP->fr_var = md_relax_table[C (COND_JUMP, COND32)].rlx_length; - return md_relax_table[C (COND_JUMP, COND32)].rlx_length; - } - else - { - /* We know the abs value */ - fragP->fr_subtype = C (COND_JUMP, COND8); - fragP->fr_var = md_relax_table[C (COND_JUMP, COND8)].rlx_length; - } - - break; - } - return fragP->fr_var; -} - -/* Put number into target byte order */ - -void -md_number_to_chars (ptr, use, nbytes) - char *ptr; - valueT use; - int nbytes; -{ - if (! target_big_endian) - number_to_chars_littleendian (ptr, use, nbytes); - else - number_to_chars_bigendian (ptr, use, nbytes); -} - -long -md_pcrel_from (fixP) - fixS *fixP; -{ - return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address + 2; -} - -#ifdef OBJ_COFF - -int -tc_coff_sizemachdep (frag) - fragS *frag; -{ - return md_relax_table[frag->fr_subtype].rlx_length; -} - -#endif /* OBJ_COFF */ - -/* When we align the .text section, insert the correct NOP pattern. */ - -int -sh_do_align (n, fill, len, max) - int n; - const char *fill; - int len; - int max; -{ - if (fill == NULL -#ifdef BFD_ASSEMBLER - && (now_seg->flags & SEC_CODE) != 0 -#else - && now_seg != data_section - && now_seg != bss_section -#endif - && n > 1) - { - static const unsigned char big_nop_pattern[] = { 0x00, 0x09 }; - static const unsigned char little_nop_pattern[] = { 0x09, 0x00 }; - - /* First align to a 2 byte boundary, in case there is an odd - .byte. */ - frag_align (1, 0, 0); - if (target_big_endian) - frag_align_pattern (n, big_nop_pattern, sizeof big_nop_pattern, max); - else - frag_align_pattern (n, little_nop_pattern, sizeof little_nop_pattern, - max); - return 1; - } - - return 0; -} - -#ifndef BFD_ASSEMBLER -#ifdef OBJ_COFF - -/* Map BFD relocs to SH COFF relocs. */ - -struct reloc_map -{ - bfd_reloc_code_real_type bfd_reloc; - int sh_reloc; -}; - -static const struct reloc_map coff_reloc_map[] = -{ - { BFD_RELOC_32, R_SH_IMM32 }, - { BFD_RELOC_16, R_SH_IMM16 }, - { BFD_RELOC_8, R_SH_IMM8 }, - { BFD_RELOC_SH_PCDISP8BY2, R_SH_PCDISP8BY2 }, - { BFD_RELOC_SH_PCDISP12BY2, R_SH_PCDISP }, - { BFD_RELOC_SH_IMM4, R_SH_IMM4 }, - { BFD_RELOC_SH_IMM4BY2, R_SH_IMM4BY2 }, - { BFD_RELOC_SH_IMM4BY4, R_SH_IMM4BY4 }, - { BFD_RELOC_SH_IMM8, R_SH_IMM8 }, - { BFD_RELOC_SH_IMM8BY2, R_SH_IMM8BY2 }, - { BFD_RELOC_SH_IMM8BY4, R_SH_IMM8BY4 }, - { BFD_RELOC_SH_PCRELIMM8BY2, R_SH_PCRELIMM8BY2 }, - { BFD_RELOC_SH_PCRELIMM8BY4, R_SH_PCRELIMM8BY4 }, - { BFD_RELOC_8_PCREL, R_SH_SWITCH8 }, - { BFD_RELOC_SH_SWITCH16, R_SH_SWITCH16 }, - { BFD_RELOC_SH_SWITCH32, R_SH_SWITCH32 }, - { BFD_RELOC_SH_USES, R_SH_USES }, - { BFD_RELOC_SH_COUNT, R_SH_COUNT }, - { BFD_RELOC_SH_ALIGN, R_SH_ALIGN }, - { BFD_RELOC_SH_CODE, R_SH_CODE }, - { BFD_RELOC_SH_DATA, R_SH_DATA }, - { BFD_RELOC_SH_LABEL, R_SH_LABEL }, - { BFD_RELOC_UNUSED, 0 } -}; - -/* Adjust a reloc for the SH. This is similar to the generic code, - but does some minor tweaking. */ - -void -sh_coff_reloc_mangle (seg, fix, intr, paddr) - segment_info_type *seg; - fixS *fix; - struct internal_reloc *intr; - unsigned int paddr; -{ - symbolS *symbol_ptr = fix->fx_addsy; - symbolS *dot; - - intr->r_vaddr = paddr + fix->fx_frag->fr_address + fix->fx_where; - - if (! SWITCH_TABLE (fix)) - { - const struct reloc_map *rm; - - for (rm = coff_reloc_map; rm->bfd_reloc != BFD_RELOC_UNUSED; rm++) - if (rm->bfd_reloc == (bfd_reloc_code_real_type) fix->fx_r_type) - break; - if (rm->bfd_reloc == BFD_RELOC_UNUSED) - as_bad_where (fix->fx_file, fix->fx_line, - "Can not represent %s relocation in this object file format", - bfd_get_reloc_code_name (fix->fx_r_type)); - intr->r_type = rm->sh_reloc; - intr->r_offset = 0; - } - else - { - know (sh_relax); - - if (fix->fx_r_type == BFD_RELOC_16) - intr->r_type = R_SH_SWITCH16; - else if (fix->fx_r_type == BFD_RELOC_8) - intr->r_type = R_SH_SWITCH8; - else if (fix->fx_r_type == BFD_RELOC_32) - intr->r_type = R_SH_SWITCH32; - else - abort (); - - /* For a switch reloc, we set r_offset to the difference between - the reloc address and the subtrahend. When the linker is - doing relaxing, it can use the determine the starting and - ending points of the switch difference expression. */ - intr->r_offset = intr->r_vaddr - S_GET_VALUE (fix->fx_subsy); - } - - /* PC relative relocs are always against the current section. */ - if (symbol_ptr == NULL) - { - switch (fix->fx_r_type) - { - case BFD_RELOC_SH_PCRELIMM8BY2: - case BFD_RELOC_SH_PCRELIMM8BY4: - case BFD_RELOC_SH_PCDISP8BY2: - case BFD_RELOC_SH_PCDISP12BY2: - case BFD_RELOC_SH_USES: - symbol_ptr = seg->dot; - break; - default: - break; - } - } - - if (fix->fx_r_type == BFD_RELOC_SH_USES) - { - /* We can't store the offset in the object file, since this - reloc does not take up any space, so we store it in r_offset. - The fx_addnumber field was set in md_apply_fix. */ - intr->r_offset = fix->fx_addnumber; - } - else if (fix->fx_r_type == BFD_RELOC_SH_COUNT) - { - /* We can't store the count in the object file, since this reloc - does not take up any space, so we store it in r_offset. The - fx_offset field was set when the fixup was created in - sh_coff_frob_file. */ - intr->r_offset = fix->fx_offset; - /* This reloc is always absolute. */ - symbol_ptr = NULL; - } - else if (fix->fx_r_type == BFD_RELOC_SH_ALIGN) - { - /* Store the alignment in the r_offset field. */ - intr->r_offset = fix->fx_offset; - /* This reloc is always absolute. */ - symbol_ptr = NULL; - } - else if (fix->fx_r_type == BFD_RELOC_SH_CODE - || fix->fx_r_type == BFD_RELOC_SH_DATA - || fix->fx_r_type == BFD_RELOC_SH_LABEL) - { - /* These relocs are always absolute. */ - symbol_ptr = NULL; - } - - /* Turn the segment of the symbol into an offset. */ - if (symbol_ptr != NULL) - { - dot = segment_info[S_GET_SEGMENT (symbol_ptr)].dot; - if (dot != NULL) - intr->r_symndx = dot->sy_number; - else - intr->r_symndx = symbol_ptr->sy_number; - } - else - intr->r_symndx = -1; -} - -#endif /* OBJ_COFF */ -#endif /* ! BFD_ASSEMBLER */ - -#ifdef BFD_ASSEMBLER - -/* Create a reloc. */ - -arelent * -tc_gen_reloc (section, fixp) - asection *section; - fixS *fixp; -{ - arelent *rel; - bfd_reloc_code_real_type r_type; - - rel = (arelent *) xmalloc (sizeof (arelent)); - rel->sym_ptr_ptr = &fixp->fx_addsy->bsym; - rel->address = fixp->fx_frag->fr_address + fixp->fx_where; - - r_type = fixp->fx_r_type; - - if (SWITCH_TABLE (fixp)) - { - rel->addend = rel->address - S_GET_VALUE (fixp->fx_subsy); - if (r_type == BFD_RELOC_16) - r_type = BFD_RELOC_SH_SWITCH16; - else if (r_type == BFD_RELOC_8) - r_type = BFD_RELOC_8_PCREL; - else if (r_type == BFD_RELOC_32) - r_type = BFD_RELOC_SH_SWITCH32; - else - abort (); - } - else if (r_type == BFD_RELOC_SH_USES) - rel->addend = fixp->fx_addnumber; - else if (r_type == BFD_RELOC_SH_COUNT) - rel->addend = fixp->fx_offset; - else if (r_type == BFD_RELOC_SH_ALIGN) - rel->addend = fixp->fx_offset; - else if (fixp->fx_pcrel) - rel->addend = fixp->fx_addnumber; - else - rel->addend = 0; - - rel->howto = bfd_reloc_type_lookup (stdoutput, r_type); - if (rel->howto == NULL) - { - as_bad_where (fixp->fx_file, fixp->fx_line, - "Cannot represent relocation type %s", - bfd_get_reloc_code_name (r_type)); - /* Set howto to a garbage value so that we can keep going. */ - rel->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_32); - assert (rel->howto != NULL); - } - - return rel; -} - -#endif /* BFD_ASSEMBLER */ diff --git a/contrib/binutils/gas/config/tc-sh.h b/contrib/binutils/gas/config/tc-sh.h deleted file mode 100644 index a18029b020d6..000000000000 --- a/contrib/binutils/gas/config/tc-sh.h +++ /dev/null @@ -1,141 +0,0 @@ -/* This file is tc-sh.h - Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. - - This file is part of GAS, the GNU Assembler. - - GAS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GAS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#define TC_SH - -#define TARGET_BYTES_BIG_ENDIAN 0 - -#define TARGET_ARCH bfd_arch_sh - -/* Whether in little endian mode. */ -extern int shl; - -/* Whether -relax was used. */ -extern int sh_relax; - -/* Whether -small was used. */ -extern int sh_small; - -/* Don't try to break words. */ -#define WORKING_DOT_WORD - -/* We require .long, et. al., to be aligned correctly. */ -#define md_cons_align(nbytes) sh_cons_align (nbytes) -extern void sh_cons_align PARAMS ((int)); - -/* When relaxing, we need to generate relocations for alignment - directives. */ -#define HANDLE_ALIGN(frag) sh_handle_align (frag) -extern void sh_handle_align PARAMS ((fragS *)); - -/* We need to force out some relocations when relaxing. */ -#define TC_FORCE_RELOCATION(fix) sh_force_relocation (fix) -extern int sh_force_relocation (); - -#define IGNORE_NONSTANDARD_ESCAPES - -#define LISTING_HEADER (shl ? "Hitachi Super-H GAS Little Endian" : "Hitachi Super-H GAS Big Endian") - -#define md_operand(x) - -extern const struct relax_type md_relax_table[]; -#define TC_GENERIC_RELAX_TABLE md_relax_table - -/* We use a special alignment function to insert the correct nop - pattern. */ -extern int sh_do_align PARAMS ((int, const char *, int, int)); -#define md_do_align(n,fill,len,max,l) if (sh_do_align (n,fill,len,max)) goto l - -/* We record, for each section, whether we have most recently output a - CODE reloc or a DATA reloc. */ -struct sh_segment_info_type -{ - int in_code : 1; -}; -#define TC_SEGMENT_INFO_TYPE struct sh_segment_info_type - -/* We call a routine to emit a reloc for a label, so that the linker - can align loads and stores without crossing a label. */ -extern void sh_frob_label PARAMS ((void)); -#define tc_frob_label(sym) sh_frob_label () - -/* We call a routine to flush pending output in order to output a DATA - reloc when required. */ -extern void sh_flush_pending_output PARAMS ((void)); -#define md_flush_pending_output() sh_flush_pending_output () - -#ifdef BFD_ASSEMBLER -#define tc_frob_file_before_adjust sh_frob_file -#else -#define tc_frob_file sh_frob_file -#endif -extern void sh_frob_file PARAMS ((void)); - -#ifdef OBJ_COFF -/* COFF specific definitions. */ - -#define DO_NOT_STRIP 0 - -/* This macro translates between an internal fix and an coff reloc type */ -#define TC_COFF_FIX2RTYPE(fix) ((fix)->fx_r_type) - -#define BFD_ARCH TARGET_ARCH - -#define COFF_MAGIC (shl ? SH_ARCH_MAGIC_LITTLE : SH_ARCH_MAGIC_BIG) - -/* We need to write out relocs which have not been completed. */ -#define TC_COUNT_RELOC(fix) ((fix)->fx_addsy != NULL) - -#define TC_RELOC_MANGLE(seg, fix, int, paddr) \ - sh_coff_reloc_mangle ((seg), (fix), (int), (paddr)) -extern void sh_coff_reloc_mangle (); - -#define tc_coff_symbol_emit_hook(a) ; /* not used */ - -#define NEED_FX_R_TYPE 1 - -#define TC_KEEP_FX_OFFSET 1 - -#define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag) -extern int tc_coff_sizemachdep PARAMS ((fragS *)); - -/* We align most sections to a 16 byte boundary. */ -#define SUB_SEGMENT_ALIGN(SEG) \ - (strncmp (obj_segment_name (SEG), ".stabstr", 8) == 0 \ - ? 0 \ - : ((strncmp (obj_segment_name (SEG), ".stab", 5) == 0 \ - || strcmp (obj_segment_name (SEG), ".ctors") == 0 \ - || strcmp (obj_segment_name (SEG), ".dtors") == 0) \ - ? 2 \ - : (sh_small ? 2 : 4))) - -#endif /* OBJ_COFF */ - -#ifdef OBJ_ELF -/* ELF specific definitions. */ - -/* Whether or not the target is big endian */ -extern int target_big_endian; - -#define TARGET_FORMAT (shl ? "elf32-shl" : "elf32-sh") - -#endif /* OBJ_ELF */ - -/* end of tc-sh.h */ diff --git a/contrib/binutils/gas/config/tc-tic30.c b/contrib/binutils/gas/config/tc-tic30.c deleted file mode 100644 index 2190a8547c62..000000000000 --- a/contrib/binutils/gas/config/tc-tic30.c +++ /dev/null @@ -1,1876 +0,0 @@ -/* tc-c30.c -- Assembly code for the Texas Instruments TMS320C30 - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. - Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) - - This file is part of GAS, the GNU Assembler. - - GAS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GAS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -/* Texas Instruments TMS320C30 machine specific gas. - Written by Steven Haworth (steve@pm.cse.rmit.edu.au). - Bugs & suggestions are completely welcome. This is free software. - Please help us make it better. */ - -#include "as.h" -#include "opcode/tic30.h" - -/* Put here all non-digit non-letter charcters that may occur in an - operand. */ -static char operand_special_chars[] = "%$-+(,)*._~/<>&^!:[@]"; -static char *ordinal_names[] = { - "first", "second", "third", "fourth", "fifth" -}; - -const int md_reloc_size = 0; - -const char comment_chars[] = ";"; -const char line_comment_chars[] = "*"; -const char line_separator_chars[] = ""; - -const char *md_shortopts = ""; -struct option md_longopts[] = { - {NULL, no_argument, NULL, 0} -}; - -size_t md_longopts_size = sizeof (md_longopts); - -/* Chars that mean this number is a floating point constant. */ -/* As in 0f12.456 */ -/* or 0d1.2345e12 */ -const char FLT_CHARS[] = "fFdDxX"; - -/* Chars that can be used to separate mant from exp in floating point - nums. */ -const char EXP_CHARS[] = "eE"; - -/* tables for lexical analysis */ -static char opcode_chars[256]; -static char register_chars[256]; -static char operand_chars[256]; -static char space_chars[256]; -static char identifier_chars[256]; -static char digit_chars[256]; - -/* lexical macros */ -#define is_opcode_char(x) (opcode_chars[(unsigned char) x]) -#define is_operand_char(x) (operand_chars[(unsigned char) x]) -#define is_register_char(x) (register_chars[(unsigned char) x]) -#define is_space_char(x) (space_chars[(unsigned char) x]) -#define is_identifier_char(x) (identifier_chars[(unsigned char) x]) -#define is_digit_char(x) (digit_chars[(unsigned char) x]) - -const pseudo_typeS md_pseudo_table[] = { - {0, 0, 0} -}; - -#undef USE_STDOUT -#define USE_STDOUT 1 - -#ifdef USE_STDARG - -#include <stdarg.h> - -int -debug (const char *string, ...) -{ - if (flag_debug) - { - va_list argptr; - char str[100]; - - va_start (argptr, string); - vsprintf (str, string, argptr); - if (str[0] == '\0') - return (0); - va_end (argptr); - fputs (str, USE_STDOUT ? stdout : stderr); - return strlen (str); - } - else - return 0; -} -#else -int -debug (string, va_alist) - const char *string; - va_dcl -{ - if (flag_debug) - { - va_list argptr; - char str[100]; - int cnt; - - va_start (argptr, string); - cnt = vsprintf (str, string, argptr); - if (str[0] == NULL) - return (0); - va_end (argptr); - fputs (str, USE_STDOUT ? stdout : stderr); - return (cnt); - } - else - return 0; -} -#endif - -/* hash table for opcode lookup */ -static struct hash_control *op_hash; -/* hash table for parallel opcode lookup */ -static struct hash_control *parop_hash; -/* hash table for register lookup */ -static struct hash_control *reg_hash; -/* hash table for indirect addressing lookup */ -static struct hash_control *ind_hash; - -void -md_begin () -{ - const char *hash_err; - debug ("In md_begin()\n"); - op_hash = hash_new (); - { - const template *current_optab = tic30_optab; - for (; current_optab < tic30_optab_end; current_optab++) - { - hash_err = hash_insert (op_hash, current_optab->name, (char *) current_optab); - if (hash_err) - as_fatal ("Internal Error: Can't Hash %s: %s", current_optab->name, hash_err); - } - } - parop_hash = hash_new (); - { - const partemplate *current_parop = tic30_paroptab; - for (; current_parop < tic30_paroptab_end; current_parop++) - { - hash_err = hash_insert (parop_hash, current_parop->name, (char *) current_parop); - if (hash_err) - as_fatal ("Internal Error: Can't Hash %s: %s", current_parop->name, hash_err); - } - } - reg_hash = hash_new (); - { - const reg *current_reg = tic30_regtab; - for (; current_reg < tic30_regtab_end; current_reg++) - { - hash_err = hash_insert (reg_hash, current_reg->name, (char *) current_reg); - if (hash_err) - as_fatal ("Internal Error: Can't Hash %s: %s", current_reg->name, hash_err); - } - } - ind_hash = hash_new (); - { - const ind_addr_type *current_ind = tic30_indaddr_tab; - for (; current_ind < tic30_indaddrtab_end; current_ind++) - { - hash_err = hash_insert (ind_hash, current_ind->syntax, (char *) current_ind); - if (hash_err) - as_fatal ("Internal Error: Can't Hash %s: %s", current_ind->syntax, hash_err); - } - } - /* fill in lexical tables: opcode_chars, operand_chars, space_chars */ - { - register int c; - register char *p; - - for (c = 0; c < 256; c++) - { - if (islower (c) || isdigit (c)) - { - opcode_chars[c] = c; - register_chars[c] = c; - } - else if (isupper (c)) - { - opcode_chars[c] = tolower (c); - register_chars[c] = opcode_chars[c]; - } - else if (c == ')' || c == '(') - { - register_chars[c] = c; - } - if (isupper (c) || islower (c) || isdigit (c)) - operand_chars[c] = c; - if (isdigit (c) || c == '-') - digit_chars[c] = c; - if (isalpha (c) || c == '_' || c == '.' || isdigit (c)) - identifier_chars[c] = c; - if (c == ' ' || c == '\t') - space_chars[c] = c; - if (c == '_') - opcode_chars[c] = c; - } - for (p = operand_special_chars; *p != '\0'; p++) - operand_chars[(unsigned char) *p] = *p; - } -} - -/* Address Mode OR values */ -#define AM_Register 0x00000000 -#define AM_Direct 0x00200000 -#define AM_Indirect 0x00400000 -#define AM_Immediate 0x00600000 -#define AM_NotReq 0xFFFFFFFF - -/* PC Relative OR values */ -#define PC_Register 0x00000000 -#define PC_Relative 0x02000000 - -typedef struct { - unsigned op_type; - struct { - int resolved; - unsigned address; - char *label; - expressionS direct_expr; - } direct; - struct { - unsigned mod; - int ARnum; - unsigned char disp; - } indirect; - struct { - unsigned opcode; - } reg; - struct { - int resolved; - int decimal_found; - float f_number; - int s_number; - unsigned int u_number; - char *label; - expressionS imm_expr; - } immediate; -} operand; - -int tic30_parallel_insn PARAMS ((char *)); -operand *tic30_operand PARAMS ((char *)); -char *tic30_find_parallel_insn PARAMS ((char *, char *)); - -template *opcode; - -struct tic30_insn { - template *tm; /* Template of current instruction */ - unsigned opcode; /* Final opcode */ - int operands; /* Number of given operands */ - /* Type of operand given in instruction */ - operand *operand_type[MAX_OPERANDS]; - unsigned addressing_mode; /* Final addressing mode of instruction */ -}; - -struct tic30_insn insn; -static int found_parallel_insn; - -void -md_assemble (line) - char *line; -{ - template *opcode; - char *current_posn; - char *token_start; - char save_char; - int count; - - debug ("In md_assemble() with argument %s\n", line); - memset (&insn, '\0', sizeof (insn)); - if (found_parallel_insn) - { - debug ("Line is second part of parallel instruction\n\n"); - found_parallel_insn = 0; - return; - } - if ((current_posn = tic30_find_parallel_insn (line, input_line_pointer + 1)) == NULL) - current_posn = line; - else - found_parallel_insn = 1; - while (is_space_char (*current_posn)) - current_posn++; - token_start = current_posn; - if (!is_opcode_char (*current_posn)) - { - as_bad ("Invalid character %s in opcode", output_invalid (*current_posn)); - return; - } - /* Check if instruction is a parallel instruction by seeing if the first - character is a q. */ - if (*token_start == 'q') - { - if (tic30_parallel_insn (token_start)) - { - if (found_parallel_insn) - free (token_start); - return; - } - } - while (is_opcode_char (*current_posn)) - current_posn++; - { /* Find instruction */ - save_char = *current_posn; - *current_posn = '\0'; - opcode = (template *) hash_find (op_hash, token_start); - if (opcode) - { - debug ("Found instruction %s\n", opcode->name); - insn.tm = opcode; - } - else - { - debug ("Didn't find insn\n"); - as_bad ("Unknown TMS320C30 instruction: %s", token_start); - return; - } - *current_posn = save_char; - } - if (*current_posn != END_OF_INSN) - { /* Find operands */ - int paren_not_balanced; - int expecting_operand = 0; - int this_operand; - do - { - /* skip optional white space before operand */ - while (!is_operand_char (*current_posn) && *current_posn != END_OF_INSN) - { - if (!is_space_char (*current_posn)) - { - as_bad ("Invalid character %s before %s operand", - output_invalid (*current_posn), - ordinal_names[insn.operands]); - return; - } - current_posn++; - } - token_start = current_posn; /* after white space */ - paren_not_balanced = 0; - while (paren_not_balanced || *current_posn != ',') - { - if (*current_posn == END_OF_INSN) - { - if (paren_not_balanced) - { - as_bad ("Unbalanced parenthesis in %s operand.", - ordinal_names[insn.operands]); - return; - } - else - break; /* we are done */ - } - else if (!is_operand_char (*current_posn) && !is_space_char (*current_posn)) - { - as_bad ("Invalid character %s in %s operand", - output_invalid (*current_posn), - ordinal_names[insn.operands]); - return; - } - if (*current_posn == '(') - ++paren_not_balanced; - if (*current_posn == ')') - --paren_not_balanced; - current_posn++; - } - if (current_posn != token_start) - { /* yes, we've read in another operand */ - this_operand = insn.operands++; - if (insn.operands > MAX_OPERANDS) - { - as_bad ("Spurious operands; (%d operands/instruction max)", - MAX_OPERANDS); - return; - } - /* now parse operand adding info to 'insn' as we go along */ - save_char = *current_posn; - *current_posn = '\0'; - insn.operand_type[this_operand] = tic30_operand (token_start); - *current_posn = save_char; - if (insn.operand_type[this_operand] == NULL) - return; - } - else - { - if (expecting_operand) - { - as_bad ("Expecting operand after ','; got nothing"); - return; - } - if (*current_posn == ',') - { - as_bad ("Expecting operand before ','; got nothing"); - return; - } - } - /* now *current_posn must be either ',' or END_OF_INSN */ - if (*current_posn == ',') - { - if (*++current_posn == END_OF_INSN) - { /* just skip it, if it's \n complain */ - as_bad ("Expecting operand after ','; got nothing"); - return; - } - expecting_operand = 1; - } - } - while (*current_posn != END_OF_INSN); /* until we get end of insn */ - } - debug ("Number of operands found: %d\n", insn.operands); - /* Check that number of operands is correct */ - if (insn.operands != insn.tm->operands) - { - int i; - int numops = insn.tm->operands; - /* If operands are not the same, then see if any of the operands are not - required. Then recheck with number of given operands. If they are still not - the same, then give an error, otherwise carry on. */ - for (i = 0; i < insn.tm->operands; i++) - if (insn.tm->operand_types[i] & NotReq) - numops--; - if (insn.operands != numops) - { - as_bad ("Incorrect number of operands given"); - return; - } - } - insn.addressing_mode = AM_NotReq; - for (count = 0; count < insn.operands; count++) - { - if (insn.operand_type[count]->op_type & insn.tm->operand_types[count]) - { - debug ("Operand %d matches\n", count + 1); - /* If instruction has two operands and has an AddressMode modifier then set - addressing mode type for instruction */ - if (insn.tm->opcode_modifier == AddressMode) - { - int addr_insn = 0; - /* Store instruction uses the second operand for the address mode. */ - if ((insn.tm->operand_types[1] & (Indirect | Direct)) == (Indirect | Direct)) - addr_insn = 1; - if (insn.operand_type[addr_insn]->op_type & (AllReg)) - insn.addressing_mode = AM_Register; - else if (insn.operand_type[addr_insn]->op_type & Direct) - insn.addressing_mode = AM_Direct; - else if (insn.operand_type[addr_insn]->op_type & Indirect) - insn.addressing_mode = AM_Indirect; - else - insn.addressing_mode = AM_Immediate; - } - } - else - { - as_bad ("The %s operand doesn't match", ordinal_names[count]); - return; - } - } - /* Now set the addressing mode for 3 operand instructions. */ - if ((insn.tm->operand_types[0] & op3T1) && (insn.tm->operand_types[1] & op3T2)) - { - /* Set the addressing mode to the values used for 2 operand instructions in the - G addressing field of the opcode. */ - char *p; - switch (insn.operand_type[0]->op_type) - { - case Rn: - case ARn: - case DPReg: - case OtherReg: - if (insn.operand_type[1]->op_type & (AllReg)) - insn.addressing_mode = AM_Register; - else if (insn.operand_type[1]->op_type & Indirect) - insn.addressing_mode = AM_Direct; - else - { - /* Shouldn't make it to this stage */ - as_bad ("Incompatible first and second operands in instruction"); - return; - } - break; - case Indirect: - if (insn.operand_type[1]->op_type & (AllReg)) - insn.addressing_mode = AM_Indirect; - else if (insn.operand_type[1]->op_type & Indirect) - insn.addressing_mode = AM_Immediate; - else - { - /* Shouldn't make it to this stage */ - as_bad ("Incompatible first and second operands in instruction"); - return; - } - break; - } - /* Now make up the opcode for the 3 operand instructions. As in parallel - instructions, there will be no unresolved values, so they can be fully formed - and added to the frag table. */ - insn.opcode = insn.tm->base_opcode; - if (insn.operand_type[0]->op_type & Indirect) - { - insn.opcode |= (insn.operand_type[0]->indirect.ARnum); - insn.opcode |= (insn.operand_type[0]->indirect.mod << 3); - } - else - insn.opcode |= (insn.operand_type[0]->reg.opcode); - if (insn.operand_type[1]->op_type & Indirect) - { - insn.opcode |= (insn.operand_type[1]->indirect.ARnum << 8); - insn.opcode |= (insn.operand_type[1]->indirect.mod << 11); - } - else - insn.opcode |= (insn.operand_type[1]->reg.opcode << 8); - if (insn.operands == 3) - insn.opcode |= (insn.operand_type[2]->reg.opcode << 16); - insn.opcode |= insn.addressing_mode; - p = frag_more (INSN_SIZE); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - } - else - { /* Not a three operand instruction */ - char *p; - int am_insn = -1; - insn.opcode = insn.tm->base_opcode; - /* Create frag for instruction - all instructions are 4 bytes long. */ - p = frag_more (INSN_SIZE); - if ((insn.operands > 0) && (insn.tm->opcode_modifier == AddressMode)) - { - insn.opcode |= insn.addressing_mode; - if (insn.addressing_mode == AM_Indirect) - { - /* Determine which operand gives the addressing mode */ - if (insn.operand_type[0]->op_type & Indirect) - am_insn = 0; - if ((insn.operands > 1) && (insn.operand_type[1]->op_type & Indirect)) - am_insn = 1; - insn.opcode |= (insn.operand_type[am_insn]->indirect.disp); - insn.opcode |= (insn.operand_type[am_insn]->indirect.ARnum << 8); - insn.opcode |= (insn.operand_type[am_insn]->indirect.mod << 11); - if (insn.operands > 1) - insn.opcode |= (insn.operand_type[!am_insn]->reg.opcode << 16); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - } - else if (insn.addressing_mode == AM_Register) - { - insn.opcode |= (insn.operand_type[0]->reg.opcode); - if (insn.operands > 1) - insn.opcode |= (insn.operand_type[1]->reg.opcode << 16); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - } - else if (insn.addressing_mode == AM_Direct) - { - if (insn.operand_type[0]->op_type & Direct) - am_insn = 0; - if ((insn.operands > 1) && (insn.operand_type[1]->op_type & Direct)) - am_insn = 1; - if (insn.operands > 1) - insn.opcode |= (insn.operand_type[!am_insn]->reg.opcode << 16); - if (insn.operand_type[am_insn]->direct.resolved == 1) - { - /* Resolved values can be placed straight into instruction word, and output */ - insn.opcode |= (insn.operand_type[am_insn]->direct.address & 0x0000FFFF); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - } - else - { /* Unresolved direct addressing mode instruction */ - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - fix_new_exp (frag_now, p + 2 - (frag_now->fr_literal), 2, &insn.operand_type[am_insn]->direct.direct_expr, 0, 0); - } - } - else if (insn.addressing_mode == AM_Immediate) - { - if (insn.operand_type[0]->immediate.resolved == 1) - { - char *keeploc; - int size; - if (insn.operands > 1) - insn.opcode |= (insn.operand_type[1]->reg.opcode << 16); - switch (insn.tm->imm_arg_type) - { - case Imm_Float: - debug ("Floating point first operand\n"); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - keeploc = input_line_pointer; - input_line_pointer = insn.operand_type[0]->immediate.label; - if (md_atof ('f', p + 2, &size) != 0) - { - as_bad ("invalid short form floating point immediate operand"); - return; - } - input_line_pointer = keeploc; - break; - case Imm_UInt: - debug ("Unsigned int first operand\n"); - if (insn.operand_type[0]->immediate.decimal_found) - as_warn ("rounding down first operand float to unsigned int"); - if (insn.operand_type[0]->immediate.u_number > 0xFFFF) - as_warn ("only lower 16-bits of first operand are used"); - insn.opcode |= (insn.operand_type[0]->immediate.u_number & 0x0000FFFFL); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - break; - case Imm_SInt: - debug ("Int first operand\n"); - if (insn.operand_type[0]->immediate.decimal_found) - as_warn ("rounding down first operand float to signed int"); - if (insn.operand_type[0]->immediate.s_number < -32768 || - insn.operand_type[0]->immediate.s_number > 32767) - { - as_bad ("first operand is too large for 16-bit signed int"); - return; - } - insn.opcode |= (insn.operand_type[0]->immediate.s_number & 0x0000FFFFL); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - break; - } - } - else - { /* Unresolved immediate label */ - if (insn.operands > 1) - insn.opcode |= (insn.operand_type[1]->reg.opcode << 16); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - fix_new_exp (frag_now, p + 2 - (frag_now->fr_literal), 2, &insn.operand_type[0]->immediate.imm_expr, 0, 0); - } - } - } - else if (insn.tm->opcode_modifier == PCRel) - { - /* Conditional Branch and Call instructions */ - if ((insn.tm->operand_types[0] & (AllReg | Disp)) == (AllReg | Disp)) - { - if (insn.operand_type[0]->op_type & (AllReg)) - { - insn.opcode |= (insn.operand_type[0]->reg.opcode); - insn.opcode |= PC_Register; - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - } - else - { - insn.opcode |= PC_Relative; - if (insn.operand_type[0]->immediate.resolved == 1) - { - insn.opcode |= (insn.operand_type[0]->immediate.s_number & 0x0000FFFF); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - } - else - { - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - fix_new_exp (frag_now, p + 2 - (frag_now->fr_literal), 2, &insn.operand_type[0]->immediate.imm_expr, 1, 0); - } - } - } - else if ((insn.tm->operand_types[0] & ARn) == ARn) - { - /* Decrement and Branch instructions */ - insn.opcode |= ((insn.operand_type[0]->reg.opcode - 0x08) << 22); - if (insn.operand_type[1]->op_type & (AllReg)) - { - insn.opcode |= (insn.operand_type[1]->reg.opcode); - insn.opcode |= PC_Register; - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - } - else if (insn.operand_type[1]->immediate.resolved == 1) - { - if (insn.operand_type[0]->immediate.decimal_found) - { - as_bad ("first operand is floating point"); - return; - } - if (insn.operand_type[0]->immediate.s_number < -32768 || - insn.operand_type[0]->immediate.s_number > 32767) - { - as_bad ("first operand is too large for 16-bit signed int"); - return; - } - insn.opcode |= (insn.operand_type[1]->immediate.s_number); - insn.opcode |= PC_Relative; - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - } - else - { - insn.opcode |= PC_Relative; - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - fix_new_exp (frag_now, p + 2 - frag_now->fr_literal, 2, &insn.operand_type[1]->immediate.imm_expr, 1, 0); - } - } - } - else if (insn.tm->operand_types[0] == IVector) - { - /* Trap instructions */ - if (insn.operand_type[0]->op_type & IVector) - insn.opcode |= (insn.operand_type[0]->immediate.u_number); - else - { /* Shouldn't get here */ - as_bad ("interrupt vector for trap instruction out of range"); - return; - } - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - } - else if (insn.tm->opcode_modifier == StackOp || insn.tm->opcode_modifier == Rotate) - { - /* Push, Pop and Rotate instructions */ - insn.opcode |= (insn.operand_type[0]->reg.opcode << 16); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - } - else if ((insn.tm->operand_types[0] & (Abs24 | Direct)) == (Abs24 | Direct)) - { - /* LDP Instruction needs to be tested for before the next section */ - if (insn.operand_type[0]->op_type & Direct) - { - if (insn.operand_type[0]->direct.resolved == 1) - { - /* Direct addressing uses lower 8 bits of direct address */ - insn.opcode |= (insn.operand_type[0]->direct.address & 0x00FF0000) >> 16; - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - } - else - { - fixS *fix; - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - fix = fix_new_exp (frag_now, p + 3 - (frag_now->fr_literal), 1, &insn.operand_type[0]->direct.direct_expr, 0, 0); - /* Ensure that the assembler doesn't complain about fitting a 24-bit - address into 8 bits. */ - fix->fx_no_overflow = 1; - } - } - else - { - if (insn.operand_type[0]->immediate.resolved == 1) - { - /* Immediate addressing uses upper 8 bits of address */ - if (insn.operand_type[0]->immediate.u_number > 0x00FFFFFF) - { - as_bad ("LDP instruction needs a 24-bit operand"); - return; - } - insn.opcode |= ((insn.operand_type[0]->immediate.u_number & 0x00FF0000) >> 16); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - } - else - { - fixS *fix; - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - fix = fix_new_exp (frag_now, p + 3 - (frag_now->fr_literal), 1, &insn.operand_type[0]->immediate.imm_expr, 0, 0); - fix->fx_no_overflow = 1; - } - } - } - else if (insn.tm->operand_types[0] & (Imm24)) - { - /* Unconditional Branch and Call instructions */ - if (insn.operand_type[0]->immediate.resolved == 1) - { - if (insn.operand_type[0]->immediate.u_number > 0x00FFFFFF) - as_warn ("first operand is too large for a 24-bit displacement"); - insn.opcode |= (insn.operand_type[0]->immediate.u_number & 0x00FFFFFF); - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - } - else - { - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - fix_new_exp (frag_now, p + 1 - (frag_now->fr_literal), 3, &insn.operand_type[0]->immediate.imm_expr, 0, 0); - } - } - else if (insn.tm->operand_types[0] & NotReq) - { - /* Check for NOP instruction without arguments. */ - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - } - else if (insn.tm->operands == 0) - { - /* Check for instructions without operands. */ - md_number_to_chars (p, (valueT) insn.opcode, INSN_SIZE); - } - } - debug ("Addressing mode: %08X\n", insn.addressing_mode); - { - int i; - for (i = 0; i < insn.operands; i++) - { - if (insn.operand_type[i]->immediate.label) - free (insn.operand_type[i]->immediate.label); - free (insn.operand_type[i]); - } - } - debug ("Final opcode: %08X\n", insn.opcode); - debug ("\n"); -} - -struct tic30_par_insn { - partemplate *tm; /* Template of current parallel instruction */ - int operands[2]; /* Number of given operands for each insn */ - /* Type of operand given in instruction */ - operand *operand_type[2][MAX_OPERANDS]; - int swap_operands; /* Whether to swap operands around. */ - unsigned p_field; /* Value of p field in multiply add/sub instructions */ - unsigned opcode; /* Final opcode */ -}; - -struct tic30_par_insn p_insn; - -int -tic30_parallel_insn (char *token) -{ - static partemplate *p_opcode; - char *current_posn = token; - char *token_start; - char save_char; - - debug ("In tic30_parallel_insn with %s\n", token); - memset (&p_insn, '\0', sizeof (p_insn)); - while (is_opcode_char (*current_posn)) - current_posn++; - { /* Find instruction */ - save_char = *current_posn; - *current_posn = '\0'; - p_opcode = (partemplate *) hash_find (parop_hash, token); - if (p_opcode) - { - debug ("Found instruction %s\n", p_opcode->name); - p_insn.tm = p_opcode; - } - else - { - char first_opcode[6] = - {0}; - char second_opcode[6] = - {0}; - int i; - int current_opcode = -1; - int char_ptr = 0; - - for (i = 0; i < strlen (token); i++) - { - char ch = *(token + i); - if (ch == '_' && current_opcode == -1) - { - current_opcode = 0; - continue; - } - if (ch == '_' && current_opcode == 0) - { - current_opcode = 1; - char_ptr = 0; - continue; - } - switch (current_opcode) - { - case 0: - first_opcode[char_ptr++] = ch; - break; - case 1: - second_opcode[char_ptr++] = ch; - break; - } - } - debug ("first_opcode = %s\n", first_opcode); - debug ("second_opcode = %s\n", second_opcode); - sprintf (token, "q_%s_%s", second_opcode, first_opcode); - p_opcode = (partemplate *) hash_find (parop_hash, token); - if (p_opcode) - { - debug ("Found instruction %s\n", p_opcode->name); - p_insn.tm = p_opcode; - p_insn.swap_operands = 1; - } - else - return 0; - } - *current_posn = save_char; - } - { /* Find operands */ - int paren_not_balanced; - int expecting_operand = 0; - int found_separator = 0; - do - { - /* skip optional white space before operand */ - while (!is_operand_char (*current_posn) && *current_posn != END_OF_INSN) - { - if (!is_space_char (*current_posn) && *current_posn != PARALLEL_SEPARATOR) - { - as_bad ("Invalid character %s before %s operand", - output_invalid (*current_posn), - ordinal_names[insn.operands]); - return 1; - } - if (*current_posn == PARALLEL_SEPARATOR) - found_separator = 1; - current_posn++; - } - token_start = current_posn; /* after white space */ - paren_not_balanced = 0; - while (paren_not_balanced || *current_posn != ',') - { - if (*current_posn == END_OF_INSN) - { - if (paren_not_balanced) - { - as_bad ("Unbalanced parenthesis in %s operand.", - ordinal_names[insn.operands]); - return 1; - } - else - break; /* we are done */ - } - else if (*current_posn == PARALLEL_SEPARATOR) - { - while (is_space_char (*(current_posn - 1))) - current_posn--; - break; - } - else if (!is_operand_char (*current_posn) && !is_space_char (*current_posn)) - { - as_bad ("Invalid character %s in %s operand", - output_invalid (*current_posn), - ordinal_names[insn.operands]); - return 1; - } - if (*current_posn == '(') - ++paren_not_balanced; - if (*current_posn == ')') - --paren_not_balanced; - current_posn++; - } - if (current_posn != token_start) - { /* yes, we've read in another operand */ - p_insn.operands[found_separator]++; - if (p_insn.operands[found_separator] > MAX_OPERANDS) - { - as_bad ("Spurious operands; (%d operands/instruction max)", - MAX_OPERANDS); - return 1; - } - /* now parse operand adding info to 'insn' as we go along */ - save_char = *current_posn; - *current_posn = '\0'; - p_insn.operand_type[found_separator][p_insn.operands[found_separator] - 1] = - tic30_operand (token_start); - *current_posn = save_char; - if (!p_insn.operand_type[found_separator][p_insn.operands[found_separator] - 1]) - return 1; - } - else - { - if (expecting_operand) - { - as_bad ("Expecting operand after ','; got nothing"); - return 1; - } - if (*current_posn == ',') - { - as_bad ("Expecting operand before ','; got nothing"); - return 1; - } - } - /* now *current_posn must be either ',' or END_OF_INSN */ - if (*current_posn == ',') - { - if (*++current_posn == END_OF_INSN) - { /* just skip it, if it's \n complain */ - as_bad ("Expecting operand after ','; got nothing"); - return 1; - } - expecting_operand = 1; - } - } - while (*current_posn != END_OF_INSN); /* until we get end of insn */ - } - if (p_insn.swap_operands) - { - int temp_num, i; - operand *temp_op; - - temp_num = p_insn.operands[0]; - p_insn.operands[0] = p_insn.operands[1]; - p_insn.operands[1] = temp_num; - for (i = 0; i < MAX_OPERANDS; i++) - { - temp_op = p_insn.operand_type[0][i]; - p_insn.operand_type[0][i] = p_insn.operand_type[1][i]; - p_insn.operand_type[1][i] = temp_op; - } - } - if (p_insn.operands[0] != p_insn.tm->operands_1) - { - as_bad ("incorrect number of operands given in the first instruction"); - return 1; - } - if (p_insn.operands[1] != p_insn.tm->operands_2) - { - as_bad ("incorrect number of operands given in the second instruction"); - return 1; - } - debug ("Number of operands in first insn: %d\n", p_insn.operands[0]); - debug ("Number of operands in second insn: %d\n", p_insn.operands[1]); - { /* Now check if operands are correct */ - int count; - int num_rn = 0; - int num_ind = 0; - for (count = 0; count < 2; count++) - { - int i; - for (i = 0; i < p_insn.operands[count]; i++) - { - if ((p_insn.operand_type[count][i]->op_type & - p_insn.tm->operand_types[count][i]) == 0) - { - as_bad ("%s instruction, operand %d doesn't match", ordinal_names[count], i + 1); - return 1; - } - /* Get number of R register and indirect reference contained within the first - two operands of each instruction. This is required for the multiply - parallel instructions which require two R registers and two indirect - references, but not in any particular place. */ - if ((p_insn.operand_type[count][i]->op_type & Rn) && i < 2) - num_rn++; - else if ((p_insn.operand_type[count][i]->op_type & Indirect) && i < 2) - num_ind++; - } - } - if ((p_insn.tm->operand_types[0][0] & (Indirect | Rn)) == (Indirect | Rn)) - { - /* Check for the multiply instructions */ - if (num_rn != 2) - { - as_bad ("incorrect format for multiply parallel instruction"); - return 1; - } - if (num_ind != 2) - { /* Shouldn't get here */ - as_bad ("incorrect format for multiply parallel instruction"); - return 1; - } - if ((p_insn.operand_type[0][2]->reg.opcode != 0x00) && - (p_insn.operand_type[0][2]->reg.opcode != 0x01)) - { - as_bad ("destination for multiply can only be R0 or R1"); - return 1; - } - if ((p_insn.operand_type[1][2]->reg.opcode != 0x02) && - (p_insn.operand_type[1][2]->reg.opcode != 0x03)) - { - as_bad ("destination for add/subtract can only be R2 or R3"); - return 1; - } - /* Now determine the P field for the instruction */ - if (p_insn.operand_type[0][0]->op_type & Indirect) - { - if (p_insn.operand_type[0][1]->op_type & Indirect) - p_insn.p_field = 0x00000000; /* Ind * Ind, Rn +/- Rn */ - else if (p_insn.operand_type[1][0]->op_type & Indirect) - p_insn.p_field = 0x01000000; /* Ind * Rn, Ind +/- Rn */ - else - p_insn.p_field = 0x03000000; /* Ind * Rn, Rn +/- Ind */ - } - else - { - if (p_insn.operand_type[0][1]->op_type & Rn) - p_insn.p_field = 0x02000000; /* Rn * Rn, Ind +/- Ind */ - else if (p_insn.operand_type[1][0]->op_type & Indirect) - { - operand *temp; - p_insn.p_field = 0x01000000; /* Rn * Ind, Ind +/- Rn */ - /* Need to swap the two multiply operands around so that everything is in - its place for the opcode makeup ie so Ind * Rn, Ind +/- Rn */ - temp = p_insn.operand_type[0][0]; - p_insn.operand_type[0][0] = p_insn.operand_type[0][1]; - p_insn.operand_type[0][1] = temp; - } - else - { - operand *temp; - p_insn.p_field = 0x03000000; /* Rn * Ind, Rn +/- Ind */ - temp = p_insn.operand_type[0][0]; - p_insn.operand_type[0][0] = p_insn.operand_type[0][1]; - p_insn.operand_type[0][1] = temp; - } - } - } - } - debug ("P field: %08X\n", p_insn.p_field); - /* Finalise opcode. This is easier for parallel instructions as they have to be - fully resolved, there are no memory addresses allowed, except through indirect - addressing, so there are no labels to resolve. */ - { - p_insn.opcode = p_insn.tm->base_opcode; - switch (p_insn.tm->oporder) - { - case OO_4op1: - p_insn.opcode |= (p_insn.operand_type[0][0]->indirect.ARnum); - p_insn.opcode |= (p_insn.operand_type[0][0]->indirect.mod << 3); - p_insn.opcode |= (p_insn.operand_type[1][1]->indirect.ARnum << 8); - p_insn.opcode |= (p_insn.operand_type[1][1]->indirect.mod << 11); - p_insn.opcode |= (p_insn.operand_type[1][0]->reg.opcode << 16); - p_insn.opcode |= (p_insn.operand_type[0][1]->reg.opcode << 22); - break; - case OO_4op2: - p_insn.opcode |= (p_insn.operand_type[0][0]->indirect.ARnum); - p_insn.opcode |= (p_insn.operand_type[0][0]->indirect.mod << 3); - p_insn.opcode |= (p_insn.operand_type[1][0]->indirect.ARnum << 8); - p_insn.opcode |= (p_insn.operand_type[1][0]->indirect.mod << 11); - p_insn.opcode |= (p_insn.operand_type[1][1]->reg.opcode << 19); - p_insn.opcode |= (p_insn.operand_type[0][1]->reg.opcode << 22); - if (p_insn.operand_type[1][1]->reg.opcode == p_insn.operand_type[0][1]->reg.opcode) - as_warn ("loading the same register in parallel operation"); - break; - case OO_4op3: - p_insn.opcode |= (p_insn.operand_type[0][1]->indirect.ARnum); - p_insn.opcode |= (p_insn.operand_type[0][1]->indirect.mod << 3); - p_insn.opcode |= (p_insn.operand_type[1][1]->indirect.ARnum << 8); - p_insn.opcode |= (p_insn.operand_type[1][1]->indirect.mod << 11); - p_insn.opcode |= (p_insn.operand_type[1][0]->reg.opcode << 16); - p_insn.opcode |= (p_insn.operand_type[0][0]->reg.opcode << 22); - break; - case OO_5op1: - p_insn.opcode |= (p_insn.operand_type[0][0]->indirect.ARnum); - p_insn.opcode |= (p_insn.operand_type[0][0]->indirect.mod << 3); - p_insn.opcode |= (p_insn.operand_type[1][1]->indirect.ARnum << 8); - p_insn.opcode |= (p_insn.operand_type[1][1]->indirect.mod << 11); - p_insn.opcode |= (p_insn.operand_type[1][0]->reg.opcode << 16); - p_insn.opcode |= (p_insn.operand_type[0][1]->reg.opcode << 19); - p_insn.opcode |= (p_insn.operand_type[0][2]->reg.opcode << 22); - break; - case OO_5op2: - p_insn.opcode |= (p_insn.operand_type[0][1]->indirect.ARnum); - p_insn.opcode |= (p_insn.operand_type[0][1]->indirect.mod << 3); - p_insn.opcode |= (p_insn.operand_type[1][1]->indirect.ARnum << 8); - p_insn.opcode |= (p_insn.operand_type[1][1]->indirect.mod << 11); - p_insn.opcode |= (p_insn.operand_type[1][0]->reg.opcode << 16); - p_insn.opcode |= (p_insn.operand_type[0][0]->reg.opcode << 19); - p_insn.opcode |= (p_insn.operand_type[0][2]->reg.opcode << 22); - break; - case OO_PField: - p_insn.opcode |= p_insn.p_field; - if (p_insn.operand_type[0][2]->reg.opcode == 0x01) - p_insn.opcode |= 0x00800000; - if (p_insn.operand_type[1][2]->reg.opcode == 0x03) - p_insn.opcode |= 0x00400000; - switch (p_insn.p_field) - { - case 0x00000000: - p_insn.opcode |= (p_insn.operand_type[0][1]->indirect.ARnum); - p_insn.opcode |= (p_insn.operand_type[0][1]->indirect.mod << 3); - p_insn.opcode |= (p_insn.operand_type[0][0]->indirect.ARnum << 8); - p_insn.opcode |= (p_insn.operand_type[0][0]->indirect.mod << 11); - p_insn.opcode |= (p_insn.operand_type[1][1]->reg.opcode << 16); - p_insn.opcode |= (p_insn.operand_type[1][0]->reg.opcode << 19); - break; - case 0x01000000: - p_insn.opcode |= (p_insn.operand_type[1][0]->indirect.ARnum); - p_insn.opcode |= (p_insn.operand_type[1][0]->indirect.mod << 3); - p_insn.opcode |= (p_insn.operand_type[0][0]->indirect.ARnum << 8); - p_insn.opcode |= (p_insn.operand_type[0][0]->indirect.mod << 11); - p_insn.opcode |= (p_insn.operand_type[1][1]->reg.opcode << 16); - p_insn.opcode |= (p_insn.operand_type[0][1]->reg.opcode << 19); - break; - case 0x02000000: - p_insn.opcode |= (p_insn.operand_type[1][1]->indirect.ARnum); - p_insn.opcode |= (p_insn.operand_type[1][1]->indirect.mod << 3); - p_insn.opcode |= (p_insn.operand_type[1][0]->indirect.ARnum << 8); - p_insn.opcode |= (p_insn.operand_type[1][0]->indirect.mod << 11); - p_insn.opcode |= (p_insn.operand_type[0][1]->reg.opcode << 16); - p_insn.opcode |= (p_insn.operand_type[0][0]->reg.opcode << 19); - break; - case 0x03000000: - p_insn.opcode |= (p_insn.operand_type[1][1]->indirect.ARnum); - p_insn.opcode |= (p_insn.operand_type[1][1]->indirect.mod << 3); - p_insn.opcode |= (p_insn.operand_type[0][0]->indirect.ARnum << 8); - p_insn.opcode |= (p_insn.operand_type[0][0]->indirect.mod << 11); - p_insn.opcode |= (p_insn.operand_type[1][0]->reg.opcode << 16); - p_insn.opcode |= (p_insn.operand_type[0][1]->reg.opcode << 19); - break; - } - break; - } - } /* Opcode is finalised at this point for all parallel instructions. */ - { /* Output opcode */ - char *p; - p = frag_more (INSN_SIZE); - md_number_to_chars (p, (valueT) p_insn.opcode, INSN_SIZE); - } - { - int i, j; - for (i = 0; i < 2; i++) - for (j = 0; j < p_insn.operands[i]; j++) - free (p_insn.operand_type[i][j]); - } - debug ("Final opcode: %08X\n", p_insn.opcode); - debug ("\n"); - return 1; -} - -operand * -tic30_operand (token) - char *token; -{ - int count; - char ind_buffer[strlen (token)]; - operand *current_op; - - debug ("In tic30_operand with %s\n", token); - current_op = (operand *) malloc (sizeof (operand)); - memset (current_op, '\0', sizeof (operand)); - if (*token == DIRECT_REFERENCE) - { - char *token_posn = token + 1; - int direct_label = 0; - debug ("Found direct reference\n"); - while (*token_posn) - { - if (!is_digit_char (*token_posn)) - direct_label = 1; - token_posn++; - } - if (direct_label) - { - char *save_input_line_pointer; - segT retval; - debug ("Direct reference is a label\n"); - current_op->direct.label = token + 1; - save_input_line_pointer = input_line_pointer; - input_line_pointer = token + 1; - debug ("Current input_line_pointer: %s\n", input_line_pointer); - retval = expression (¤t_op->direct.direct_expr); - debug ("Expression type: %d\n", current_op->direct.direct_expr.X_op); - debug ("Expression addnum: %d\n", current_op->direct.direct_expr.X_add_number); - debug ("Segment: %d\n", retval); - input_line_pointer = save_input_line_pointer; - if (current_op->direct.direct_expr.X_op == O_constant) - { - current_op->direct.address = current_op->direct.direct_expr.X_add_number; - current_op->direct.resolved = 1; - } - } - else - { - debug ("Direct reference is a number\n"); - current_op->direct.address = atoi (token + 1); - current_op->direct.resolved = 1; - } - current_op->op_type = Direct; - } - else if (*token == INDIRECT_REFERENCE) - { /* Indirect reference operand */ - int found_ar = 0; - int found_disp = 0; - int ar_number = -1; - int disp_number = 0; - int buffer_posn = 1; - ind_addr_type *ind_addr_op; - debug ("Found indirect reference\n"); - ind_buffer[0] = *token; - for (count = 1; count < strlen (token); count++) - { /* Strip operand */ - ind_buffer[buffer_posn] = tolower (*(token + count)); - if ((*(token + count - 1) == 'a' || *(token + count - 1) == 'A') && - (*(token + count) == 'r' || *(token + count) == 'R')) - { - /* AR reference is found, so get its number and remove it from the buffer - so it can pass through hash_find() */ - if (found_ar) - { - as_bad ("More than one AR register found in indirect reference"); - return NULL; - } - if (*(token + count + 1) < '0' || *(token + count + 1) > '7') - { - as_bad ("Illegal AR register in indirect reference"); - return NULL; - } - ar_number = *(token + count + 1) - '0'; - found_ar = 1; - count++; - } - if (*(token + count) == '(') - { - /* Parenthesis found, so check if a displacement value is inside. If so, get - the value and remove it from the buffer. */ - if (is_digit_char (*(token + count + 1))) - { - char disp[10]; - int disp_posn = 0; - - if (found_disp) - { - as_bad ("More than one displacement found in indirect reference"); - return NULL; - } - count++; - while (*(token + count) != ')') - { - if (!is_digit_char (*(token + count))) - { - as_bad ("Invalid displacement in indirect reference"); - return NULL; - } - disp[disp_posn++] = *(token + (count++)); - } - disp[disp_posn] = '\0'; - disp_number = atoi (disp); - count--; - found_disp = 1; - } - } - buffer_posn++; - } - ind_buffer[buffer_posn] = '\0'; - if (!found_ar) - { - as_bad ("AR register not found in indirect reference"); - return NULL; - } - ind_addr_op = (ind_addr_type *) hash_find (ind_hash, ind_buffer); - if (ind_addr_op) - { - debug ("Found indirect reference: %s\n", ind_addr_op->syntax); - if (ind_addr_op->displacement == IMPLIED_DISP) - { - found_disp = 1; - disp_number = 1; - } - else if ((ind_addr_op->displacement == DISP_REQUIRED) && !found_disp) - { - /* Maybe an implied displacement of 1 again */ - as_bad ("required displacement wasn't given in indirect reference"); - return 0; - } - } - else - { - as_bad ("illegal indirect reference"); - return NULL; - } - if (found_disp && (disp_number < 0 || disp_number > 255)) - { - as_bad ("displacement must be an unsigned 8-bit number"); - return NULL; - } - current_op->indirect.mod = ind_addr_op->modfield; - current_op->indirect.disp = disp_number; - current_op->indirect.ARnum = ar_number; - current_op->op_type = Indirect; - } - else - { - reg *regop = (reg *) hash_find (reg_hash, token); - if (regop) - { - debug ("Found register operand: %s\n", regop->name); - if (regop->regtype == REG_ARn) - current_op->op_type = ARn; - else if (regop->regtype == REG_Rn) - current_op->op_type = Rn; - else if (regop->regtype == REG_DP) - current_op->op_type = DPReg; - else - current_op->op_type = OtherReg; - current_op->reg.opcode = regop->opcode; - } - else - { - if (!is_digit_char (*token) || *(token + 1) == 'x' || strchr (token, 'h')) - { - char *save_input_line_pointer; - segT retval; - debug ("Probably a label: %s\n", token); - current_op->immediate.label = (char *) malloc (strlen (token) + 1); - strcpy (current_op->immediate.label, token); - current_op->immediate.label[strlen (token)] = '\0'; - save_input_line_pointer = input_line_pointer; - input_line_pointer = token; - debug ("Current input_line_pointer: %s\n", input_line_pointer); - retval = expression (¤t_op->immediate.imm_expr); - debug ("Expression type: %d\n", current_op->immediate.imm_expr.X_op); - debug ("Expression addnum: %d\n", current_op->immediate.imm_expr.X_add_number); - debug ("Segment: %d\n", retval); - input_line_pointer = save_input_line_pointer; - if (current_op->immediate.imm_expr.X_op == O_constant) - { - current_op->immediate.s_number = current_op->immediate.imm_expr.X_add_number; - current_op->immediate.u_number = (unsigned int) current_op->immediate.imm_expr.X_add_number; - current_op->immediate.resolved = 1; - } - } - else - { - unsigned count; - debug ("Found a number or displacement\n"); - for (count = 0; count < strlen (token); count++) - if (*(token + count) == '.') - current_op->immediate.decimal_found = 1; - current_op->immediate.label = (char *) malloc (strlen (token) + 1); - strcpy (current_op->immediate.label, token); - current_op->immediate.label[strlen (token)] = '\0'; - current_op->immediate.f_number = (float) atof (token); - current_op->immediate.s_number = (int) atoi (token); - current_op->immediate.u_number = (unsigned int) atoi (token); - current_op->immediate.resolved = 1; - } - current_op->op_type = Disp | Abs24 | Imm16 | Imm24; - if (current_op->immediate.u_number >= 0 && current_op->immediate.u_number <= 31) - current_op->op_type |= IVector; - } - } - return current_op; -} - -/* next_line points to the next line after the current instruction (current_line). - Search for the parallel bars, and if found, merge two lines into internal syntax - for a parallel instruction: - q_[INSN1]_[INSN2] [OPERANDS1] | [OPERANDS2] - By this stage, all comments are scrubbed, and only the bare lines are given. - */ - -#define NONE 0 -#define START_OPCODE 1 -#define END_OPCODE 2 -#define START_OPERANDS 3 -#define END_OPERANDS 4 - -char * -tic30_find_parallel_insn (current_line, next_line) - char *current_line; - char *next_line; -{ - int found_parallel = 0; - char first_opcode[256]; - char second_opcode[256]; - char first_operands[256]; - char second_operands[256]; - char *parallel_insn; - - debug ("In tic30_find_parallel_insn()\n"); - while (!is_end_of_line[(unsigned char) *next_line]) - { - if (*next_line == PARALLEL_SEPARATOR && *(next_line + 1) == PARALLEL_SEPARATOR) - { - found_parallel = 1; - next_line++; - break; - } - next_line++; - } - if (!found_parallel) - return NULL; - debug ("Found a parallel instruction\n"); - { - int i; - char *opcode, *operands, *line; - - for (i = 0; i < 2; i++) - { - if (i == 0) - { - opcode = &first_opcode[0]; - operands = &first_operands[0]; - line = current_line; - } - else - { - opcode = &second_opcode[0]; - operands = &second_operands[0]; - line = next_line; - } - { - int search_status = NONE; - int char_ptr = 0; - char c; - - while (!is_end_of_line[(unsigned char) (c = *line)]) - { - if (is_opcode_char (c) && search_status == NONE) - { - opcode[char_ptr++] = tolower (c); - search_status = START_OPCODE; - } - else if (is_opcode_char (c) && search_status == START_OPCODE) - { - opcode[char_ptr++] = tolower (c); - } - else if (!is_opcode_char (c) && search_status == START_OPCODE) - { - opcode[char_ptr] = '\0'; - char_ptr = 0; - search_status = END_OPCODE; - } - else if (is_operand_char (c) && search_status == START_OPERANDS) - { - operands[char_ptr++] = c; - } - if (is_operand_char (c) && search_status == END_OPCODE) - { - operands[char_ptr++] = c; - search_status = START_OPERANDS; - } - line++; - } - if (search_status != START_OPERANDS) - return NULL; - operands[char_ptr] = '\0'; - } - } - } - parallel_insn = (char *) malloc (strlen (first_opcode) + strlen (first_operands) + - strlen (second_opcode) + strlen (second_operands) + 8); - sprintf (parallel_insn, "q_%s_%s %s | %s", first_opcode, second_opcode, first_operands, second_operands); - debug ("parallel insn = %s\n", parallel_insn); - return parallel_insn; -} - -#undef NONE -#undef START_OPCODE -#undef END_OPCODE -#undef START_OPERANDS -#undef END_OPERANDS - -/* In order to get gas to ignore any | chars at the start of a line, - this function returns true if a | is found in a line. */ - -int -tic30_unrecognized_line (c) - int c; -{ - debug ("In tc_unrecognized_line\n"); - return (c == PARALLEL_SEPARATOR); -} - -int -md_estimate_size_before_relax (fragP, segment) - fragS *fragP; - segT segment; -{ - debug ("In md_estimate_size_before_relax()\n"); - return 0; -} - -void -md_convert_frag (abfd, sec, fragP) - bfd *abfd; - segT sec; - register fragS *fragP; -{ - debug ("In md_convert_frag()\n"); -} - -int -md_apply_fix (fixP, valP) - fixS *fixP; - valueT *valP; -{ - valueT value = *valP; - - debug ("In md_apply_fix() with value = %ld\n", (long) value); - debug ("Values in fixP\n"); - debug ("fx_size = %d\n", fixP->fx_size); - debug ("fx_pcrel = %d\n", fixP->fx_pcrel); - debug ("fx_where = %d\n", fixP->fx_where); - debug ("fx_offset = %d\n", (int) fixP->fx_offset); - { - char *buf = fixP->fx_frag->fr_literal + fixP->fx_where; - value /= INSN_SIZE; - if (fixP->fx_size == 1) - { /* Special fix for LDP instruction. */ - value = (value & 0x00FF0000) >> 16; - } - debug ("new value = %ld\n", (long) value); - md_number_to_chars (buf, value, fixP->fx_size); - } - return 1; -} - -int -md_parse_option (c, arg) - int c; - char *arg; -{ - int i; - - debug ("In md_parse_option()\n"); - for (i = 0; i < c; i++) - { - printf ("%c\n", arg[c]); - } - return 0; -} - -void -md_show_usage (stream) - FILE *stream; -{ - debug ("In md_show_usage()\n"); -} - -symbolS * -md_undefined_symbol (name) - char *name; -{ - debug ("In md_undefined_symbol()\n"); - return (symbolS *) 0; -} - -valueT -md_section_align (segment, size) - segT segment; - valueT size; -{ - debug ("In md_section_align() segment = %d and size = %d\n", segment, size); - size = (size + 3) / 4; - size *= 4; - debug ("New size value = %d\n", size); - return size; -} - -long -md_pcrel_from (fixP) - fixS *fixP; -{ - int offset; - - debug ("In md_pcrel_from()\n"); - debug ("fx_where = %d\n", fixP->fx_where); - debug ("fx_size = %d\n", fixP->fx_size); - /* Find the opcode that represents the current instruction in the fr_literal - storage area, and check bit 21. Bit 21 contains whether the current instruction - is a delayed one or not, and then set the offset value appropriately. */ - if (fixP->fx_frag->fr_literal[fixP->fx_where - fixP->fx_size + 1] & 0x20) - offset = 3; - else - offset = 1; - debug ("offset = %d\n", offset); - /* PC Relative instructions have a format: - displacement = Label - (PC + offset) - This function returns PC + offset where: - fx_where - fx_size = PC - INSN_SIZE * offset = offset number of instructions - */ - return fixP->fx_where - fixP->fx_size + (INSN_SIZE * offset); -} - -char * -md_atof (what_statement_type, literalP, sizeP) - int what_statement_type; - char *literalP; - int *sizeP; -{ - int prec; - char *token; - char keepval; - unsigned long value; - /* char *atof_ieee (); */ - float float_value; - debug ("In md_atof()\n"); - debug ("precision = %c\n", what_statement_type); - debug ("literal = %s\n", literalP); - debug ("line = "); - token = input_line_pointer; - while (!is_end_of_line[(unsigned char) *input_line_pointer] - && (*input_line_pointer != ',')) - { - debug ("%c", *input_line_pointer); - input_line_pointer++; - } - keepval = *input_line_pointer; - *input_line_pointer = '\0'; - debug ("\n"); - float_value = (float) atof (token); - *input_line_pointer = keepval; - debug ("float_value = %f\n", float_value); - switch (what_statement_type) - { - case 'f': - case 'F': - case 's': - case 'S': - prec = 2; - break; - - case 'd': - case 'D': - case 'r': - case 'R': - prec = 4; - break; - - default: - *sizeP = 0; - return "Bad call to MD_ATOF()"; - } - if (float_value == 0.0) - { - value = (prec == 2) ? 0x00008000L : 0x80000000L; - } - else - { - unsigned long exp, sign, mant, tmsfloat; - tmsfloat = *((long *) &float_value); - sign = tmsfloat & 0x80000000; - mant = tmsfloat & 0x007FFFFF; - exp = tmsfloat & 0x7F800000; - exp <<= 1; - if (exp == 0xFF000000) - { - if (mant == 0) - value = 0x7F7FFFFF; - else if (sign == 0) - value = 0x7F7FFFFF; - else - value = 0x7F800000; - } - else - { - exp -= 0x7F000000; - if (sign) - { - mant = mant & 0x007FFFFF; - mant = -mant; - mant = mant & 0x00FFFFFF; - if (mant == 0) - { - mant |= 0x00800000; - exp = (long) exp - 0x01000000; - } - } - tmsfloat = exp | mant; - value = tmsfloat; - } - if (prec == 2) - { - long exp, mant; - - if (tmsfloat == 0x80000000) - { - value = 0x8000; - } - else - { - value = 0; - exp = (tmsfloat & 0xFF000000); - exp >>= 24; - mant = tmsfloat & 0x007FFFFF; - if (tmsfloat & 0x00800000) - { - mant |= 0xFF000000; - mant += 0x00000800; - mant >>= 12; - mant |= 0x00000800; - mant &= 0x0FFF; - if (exp > 7) - value = 0x7800; - } - else - { - mant |= 0x00800000; - mant += 0x00000800; - exp += (mant >> 24); - mant >>= 12; - mant &= 0x07FF; - if (exp > 7) - value = 0x77FF; - } - if (exp < -8) - value = 0x8000; - if (value == 0) - { - mant = (exp << 12) | mant; - value = mant & 0xFFFF; - } - } - } - } - md_number_to_chars (literalP, value, prec); - *sizeP = prec; - return 0; -} - -void -md_number_to_chars (buf, val, n) - char *buf; - valueT val; - int n; -{ - debug ("In md_number_to_chars()\n"); - number_to_chars_bigendian (buf, val, n); - /* number_to_chars_littleendian(buf,val,n); */ -} - -#define F(SZ,PCREL) (((SZ) << 1) + (PCREL)) -#define MAP(SZ,PCREL,TYPE) case F(SZ,PCREL): code = (TYPE); break - -arelent * -tc_gen_reloc (section, fixP) - asection *section; - fixS *fixP; -{ - arelent *rel; - bfd_reloc_code_real_type code = 0; - - debug ("In tc_gen_reloc()\n"); - debug ("fixP.size = %d\n", fixP->fx_size); - debug ("fixP.pcrel = %d\n", fixP->fx_pcrel); - debug ("addsy.name = %s\n", S_GET_NAME (fixP->fx_addsy)); - switch (F (fixP->fx_size, fixP->fx_pcrel)) - { - MAP (1, 0, BFD_RELOC_TIC30_LDP); - MAP (2, 0, BFD_RELOC_16); - MAP (3, 0, BFD_RELOC_24); - MAP (2, 1, BFD_RELOC_16_PCREL); - MAP (4, 0, BFD_RELOC_32); - default: - as_bad ("Can not do %d byte %srelocation", fixP->fx_size, - fixP->fx_pcrel ? "pc-relative " : ""); - } -#undef MAP -#undef F - - rel = (arelent *) xmalloc (sizeof (arelent)); - assert (rel != 0); - rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); - *rel->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy); - rel->address = fixP->fx_frag->fr_address + fixP->fx_where; - if (fixP->fx_pcrel) - rel->addend = fixP->fx_addnumber; - else - rel->addend = 0; - rel->howto = bfd_reloc_type_lookup (stdoutput, code); - if (!rel->howto) - { - const char *name; - name = S_GET_NAME (fixP->fx_addsy); - if (name == NULL) - name = "<unknown>"; - as_fatal ("Cannot generate relocation type for symbol %s, code %s", name, bfd_get_reloc_code_name (code)); - } - return rel; -} - -void -tc_aout_pre_write_hook () -{ - debug ("In tc_aout_pre_write_hook()\n"); -} - -void -md_operand (expressionP) - expressionS *expressionP; -{ - debug ("In md_operand()\n"); -} - -char output_invalid_buf[8]; - -char * -output_invalid (c) - char c; -{ - if (isprint (c)) - sprintf (output_invalid_buf, "'%c'", c); - else - sprintf (output_invalid_buf, "(0x%x)", (unsigned) c); - return output_invalid_buf; -} diff --git a/contrib/binutils/gas/config/tc-tic30.h b/contrib/binutils/gas/config/tc-tic30.h deleted file mode 100644 index d55c8702cfe8..000000000000 --- a/contrib/binutils/gas/config/tc-tic30.h +++ /dev/null @@ -1,55 +0,0 @@ -/* tc-tic30.h -- Header file for tc-tic30.c - Copyright 1998, 2000 Free Software Foundation, Inc. - Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) - - This file is part of GAS, the GNU Assembler. - - GAS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GAS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#ifndef _TC_TIC30_H_ -#define _TC_TIC30_H_ - -#define TC_TIC30 1 - -#ifdef OBJ_AOUT -#define TARGET_FORMAT "a.out-tic30" -#endif - -#define TARGET_ARCH bfd_arch_tic30 -#define TARGET_BYTES_BIG_ENDIAN 1 - -#define WORKING_DOT_WORD - -char *output_invalid PARAMS ((int c)); - -#define END_OF_INSN '\0' -#define MAX_OPERANDS 6 -#define DIRECT_REFERENCE '@' -#define INDIRECT_REFERENCE '*' -#define PARALLEL_SEPARATOR '|' -#define INSN_SIZE 4 - -/* Define this to 1 if you want the debug output to be on stdout, - otherwise stderr will be used. If stderr is used, there will be a - better synchronisation with the as_bad outputs, but you can't - capture the output. */ -#define USE_STDOUT 0 - -#define tc_unrecognized_line tic30_unrecognized_line - -extern int tic30_unrecognized_line PARAMS ((int)); - -#endif diff --git a/contrib/binutils/gas/config/tc-v850.c b/contrib/binutils/gas/config/tc-v850.c deleted file mode 100644 index ce676cd84426..000000000000 --- a/contrib/binutils/gas/config/tc-v850.c +++ /dev/null @@ -1,2527 +0,0 @@ -/* tc-v850.c -- Assembler code for the NEC V850 - Copyright 1996, 1997, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. - - This file is part of GAS, the GNU Assembler. - - GAS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GAS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include <stdio.h> -#include <ctype.h> -#include "as.h" -#include "subsegs.h" -#include "opcode/v850.h" -#include "dwarf2dbg.h" - -#define AREA_ZDA 0 -#define AREA_SDA 1 -#define AREA_TDA 2 - -/* Sign-extend a 16-bit number. */ -#define SEXT16(x) ((((x) & 0xffff) ^ (~0x7fff)) + 0x8000) - -/* Temporarily holds the reloc in a cons expression. */ -static bfd_reloc_code_real_type hold_cons_reloc = BFD_RELOC_UNUSED; - -/* Set to TRUE if we want to be pedantic about signed overflows. */ -static boolean warn_signed_overflows = FALSE; -static boolean warn_unsigned_overflows = FALSE; - -/* Indicates the target BFD machine number. */ -static int machine = -1; - -/* Indicates the target processor(s) for the assemble. */ -static int processor_mask = -1; - -/* Structure to hold information about predefined registers. */ -struct reg_name { - const char *name; - int value; -}; - -/* Generic assembler global variables which must be defined by all - targets. */ - -/* Characters which always start a comment. */ -const char comment_chars[] = "#"; - -/* Characters which start a comment at the beginning of a line. */ -const char line_comment_chars[] = ";#"; - -/* Characters which may be used to separate multiple commands on a - single line. */ -const char line_separator_chars[] = ";"; - -/* Characters which are used to indicate an exponent in a floating - point number. */ -const char EXP_CHARS[] = "eE"; - -/* Characters which mean that a number is a floating point constant, - as in 0d1.0. */ -const char FLT_CHARS[] = "dD"; - -const relax_typeS md_relax_table[] = { - /* Conditional branches. */ - {0xff, -0x100, 2, 1}, - {0x1fffff, -0x200000, 6, 0}, - /* Unconditional branches. */ - {0xff, -0x100, 2, 3}, - {0x1fffff, -0x200000, 4, 0}, -}; - -static segT sdata_section = NULL; -static segT tdata_section = NULL; -static segT zdata_section = NULL; -static segT sbss_section = NULL; -static segT tbss_section = NULL; -static segT zbss_section = NULL; -static segT rosdata_section = NULL; -static segT rozdata_section = NULL; -static segT scommon_section = NULL; -static segT tcommon_section = NULL; -static segT zcommon_section = NULL; -static segT call_table_data_section = NULL; -static segT call_table_text_section = NULL; - -/* Fixups. */ -#define MAX_INSN_FIXUPS (5) -struct v850_fixup { - expressionS exp; - int opindex; - bfd_reloc_code_real_type reloc; -}; - -struct v850_fixup fixups[MAX_INSN_FIXUPS]; -static int fc; - -void -v850_sdata (int ignore ATTRIBUTE_UNUSED) -{ - obj_elf_section_change_hook (); - - subseg_set (sdata_section, (subsegT) get_absolute_expression ()); - - demand_empty_rest_of_line (); -} - -void -v850_tdata (int ignore ATTRIBUTE_UNUSED) -{ - obj_elf_section_change_hook (); - - subseg_set (tdata_section, (subsegT) get_absolute_expression ()); - - demand_empty_rest_of_line (); -} - -void -v850_zdata (int ignore ATTRIBUTE_UNUSED) -{ - obj_elf_section_change_hook (); - - subseg_set (zdata_section, (subsegT) get_absolute_expression ()); - - demand_empty_rest_of_line (); -} - -void -v850_sbss (int ignore ATTRIBUTE_UNUSED) -{ - obj_elf_section_change_hook (); - - subseg_set (sbss_section, (subsegT) get_absolute_expression ()); - - demand_empty_rest_of_line (); -} - -void -v850_tbss (int ignore ATTRIBUTE_UNUSED) -{ - obj_elf_section_change_hook (); - - subseg_set (tbss_section, (subsegT) get_absolute_expression ()); - - demand_empty_rest_of_line (); -} - -void -v850_zbss (int ignore ATTRIBUTE_UNUSED) -{ - obj_elf_section_change_hook (); - - subseg_set (zbss_section, (subsegT) get_absolute_expression ()); - - demand_empty_rest_of_line (); -} - -void -v850_rosdata (int ignore ATTRIBUTE_UNUSED) -{ - obj_elf_section_change_hook (); - - subseg_set (rosdata_section, (subsegT) get_absolute_expression ()); - - demand_empty_rest_of_line (); -} - -void -v850_rozdata (int ignore ATTRIBUTE_UNUSED) -{ - obj_elf_section_change_hook (); - - subseg_set (rozdata_section, (subsegT) get_absolute_expression ()); - - demand_empty_rest_of_line (); -} - -void -v850_call_table_data (int ignore ATTRIBUTE_UNUSED) -{ - obj_elf_section_change_hook (); - - subseg_set (call_table_data_section, (subsegT) get_absolute_expression ()); - - demand_empty_rest_of_line (); -} - -void -v850_call_table_text (int ignore ATTRIBUTE_UNUSED) -{ - obj_elf_section_change_hook (); - - subseg_set (call_table_text_section, (subsegT) get_absolute_expression ()); - - demand_empty_rest_of_line (); -} - -void -v850_bss (int ignore ATTRIBUTE_UNUSED) -{ - register int temp = get_absolute_expression (); - - obj_elf_section_change_hook (); - - subseg_set (bss_section, (subsegT) temp); - - demand_empty_rest_of_line (); -} - -void -v850_offset (int ignore ATTRIBUTE_UNUSED) -{ - int temp = get_absolute_expression (); - - temp -= frag_now_fix (); - - if (temp > 0) - (void) frag_more (temp); - - demand_empty_rest_of_line (); -} - -/* Copied from obj_elf_common() in gas/config/obj-elf.c. */ - -static void -v850_comm (area) - int area; -{ - char *name; - char c; - char *p; - int temp; - unsigned int size; - symbolS *symbolP; - int have_align; - - name = input_line_pointer; - c = get_symbol_end (); - - /* Just after name is now '\0'. */ - p = input_line_pointer; - *p = c; - - SKIP_WHITESPACE (); - - if (*input_line_pointer != ',') - { - as_bad (_("Expected comma after symbol-name")); - ignore_rest_of_line (); - return; - } - - /* Skip ','. */ - input_line_pointer++; - - if ((temp = get_absolute_expression ()) < 0) - { - /* xgettext:c-format */ - as_bad (_(".COMMon length (%d.) < 0! Ignored."), temp); - ignore_rest_of_line (); - return; - } - - size = temp; - *p = 0; - symbolP = symbol_find_or_make (name); - *p = c; - - if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP)) - { - as_bad (_("Ignoring attempt to re-define symbol")); - ignore_rest_of_line (); - return; - } - - if (S_GET_VALUE (symbolP) != 0) - { - if (S_GET_VALUE (symbolP) != size) - { - /* xgettext:c-format */ - as_warn (_("Length of .comm \"%s\" is already %ld. Not changed to %d."), - S_GET_NAME (symbolP), (long) S_GET_VALUE (symbolP), size); - } - } - - know (symbol_get_frag (symbolP) == &zero_address_frag); - - if (*input_line_pointer != ',') - have_align = 0; - else - { - have_align = 1; - input_line_pointer++; - SKIP_WHITESPACE (); - } - - if (! have_align || *input_line_pointer != '"') - { - if (! have_align) - temp = 0; - else - { - temp = get_absolute_expression (); - - if (temp < 0) - { - temp = 0; - as_warn (_("Common alignment negative; 0 assumed")); - } - } - - if (symbol_get_obj (symbolP)->local) - { - segT old_sec; - int old_subsec; - char *pfrag; - int align; - flagword applicable; - - old_sec = now_seg; - old_subsec = now_subseg; - - applicable = bfd_applicable_section_flags (stdoutput); - - applicable &= SEC_ALLOC; - - switch (area) - { - case AREA_SDA: - if (sbss_section == NULL) - { - sbss_section = subseg_new (".sbss", 0); - - bfd_set_section_flags (stdoutput, sbss_section, applicable); - - seg_info (sbss_section)->bss = 1; - } - break; - - case AREA_ZDA: - if (zbss_section == NULL) - { - zbss_section = subseg_new (".zbss", 0); - - bfd_set_section_flags (stdoutput, sbss_section, applicable); - - seg_info (zbss_section)->bss = 1; - } - break; - - case AREA_TDA: - if (tbss_section == NULL) - { - tbss_section = subseg_new (".tbss", 0); - - bfd_set_section_flags (stdoutput, tbss_section, applicable); - - seg_info (tbss_section)->bss = 1; - } - break; - } - - if (temp) - { - /* Convert to a power of 2 alignment. */ - for (align = 0; (temp & 1) == 0; temp >>= 1, ++align) - ; - - if (temp != 1) - { - as_bad (_("Common alignment not a power of 2")); - ignore_rest_of_line (); - return; - } - } - else - align = 0; - - switch (area) - { - case AREA_SDA: - record_alignment (sbss_section, align); - obj_elf_section_change_hook (); - subseg_set (sbss_section, 0); - break; - - case AREA_ZDA: - record_alignment (zbss_section, align); - obj_elf_section_change_hook (); - subseg_set (zbss_section, 0); - break; - - case AREA_TDA: - record_alignment (tbss_section, align); - obj_elf_section_change_hook (); - subseg_set (tbss_section, 0); - break; - - default: - abort (); - } - - if (align) - frag_align (align, 0, 0); - - switch (area) - { - case AREA_SDA: - if (S_GET_SEGMENT (symbolP) == sbss_section) - symbol_get_frag (symbolP)->fr_symbol = 0; - break; - - case AREA_ZDA: - if (S_GET_SEGMENT (symbolP) == zbss_section) - symbol_get_frag (symbolP)->fr_symbol = 0; - break; - - case AREA_TDA: - if (S_GET_SEGMENT (symbolP) == tbss_section) - symbol_get_frag (symbolP)->fr_symbol = 0; - break; - - default: - abort (); - } - - symbol_set_frag (symbolP, frag_now); - pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP, - (offsetT) size, (char *) 0); - *pfrag = 0; - S_SET_SIZE (symbolP, size); - - switch (area) - { - case AREA_SDA: - S_SET_SEGMENT (symbolP, sbss_section); - break; - - case AREA_ZDA: - S_SET_SEGMENT (symbolP, zbss_section); - break; - - case AREA_TDA: - S_SET_SEGMENT (symbolP, tbss_section); - break; - - default: - abort (); - } - - S_CLEAR_EXTERNAL (symbolP); - obj_elf_section_change_hook (); - subseg_set (old_sec, old_subsec); - } - else - { - allocate_common: - S_SET_VALUE (symbolP, (valueT) size); - S_SET_ALIGN (symbolP, temp); - S_SET_EXTERNAL (symbolP); - - switch (area) - { - case AREA_SDA: - if (scommon_section == NULL) - { - flagword applicable = - bfd_applicable_section_flags (stdoutput); - - scommon_section = subseg_new (".scommon", 0); - - bfd_set_section_flags (stdoutput, scommon_section, - (applicable - & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA - | SEC_HAS_CONTENTS)) | SEC_IS_COMMON); - } - S_SET_SEGMENT (symbolP, scommon_section); - break; - - case AREA_ZDA: - if (zcommon_section == NULL) - { - flagword applicable = - bfd_applicable_section_flags (stdoutput); - - zcommon_section = subseg_new (".zcommon", 0); - - bfd_set_section_flags (stdoutput, zcommon_section, - (applicable - & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA - | SEC_HAS_CONTENTS)) | SEC_IS_COMMON); - } - S_SET_SEGMENT (symbolP, zcommon_section); - break; - - case AREA_TDA: - if (tcommon_section == NULL) - { - flagword applicable = - bfd_applicable_section_flags (stdoutput); - - tcommon_section = subseg_new (".tcommon", 0); - - bfd_set_section_flags (stdoutput, tcommon_section, - ((applicable - & (SEC_ALLOC | SEC_LOAD - | SEC_RELOC | SEC_DATA - | SEC_HAS_CONTENTS)) - | SEC_IS_COMMON)); - } - S_SET_SEGMENT (symbolP, tcommon_section); - break; - - default: - abort (); - } - } - } - else - { - input_line_pointer++; - - /* @@ Some use the dot, some don't. Can we get some consistency?? */ - if (*input_line_pointer == '.') - input_line_pointer++; - - /* @@ Some say data, some say bss. */ - if (strncmp (input_line_pointer, "bss\"", 4) - && strncmp (input_line_pointer, "data\"", 5)) - { - while (*--input_line_pointer != '"') - ; - input_line_pointer--; - goto bad_common_segment; - } - while (*input_line_pointer++ != '"') - ; - goto allocate_common; - } - - symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT; - - demand_empty_rest_of_line (); - return; - - { - bad_common_segment: - p = input_line_pointer; - while (*p && *p != '\n') - p++; - c = *p; - *p = '\0'; - as_bad (_("bad .common segment %s"), input_line_pointer + 1); - *p = c; - input_line_pointer = p; - ignore_rest_of_line (); - return; - } -} - -void -set_machine (int number) -{ - machine = number; - bfd_set_arch_mach (stdoutput, TARGET_ARCH, machine); - - switch (machine) - { - case 0: processor_mask = PROCESSOR_V850; break; - case bfd_mach_v850e: processor_mask = PROCESSOR_V850E; break; - case bfd_mach_v850ea: processor_mask = PROCESSOR_V850EA; break; - } -} - -/* The target specific pseudo-ops which we support. */ -const pseudo_typeS md_pseudo_table[] = { - {"sdata", v850_sdata, 0}, - {"tdata", v850_tdata, 0}, - {"zdata", v850_zdata, 0}, - {"sbss", v850_sbss, 0}, - {"tbss", v850_tbss, 0}, - {"zbss", v850_zbss, 0}, - {"rosdata", v850_rosdata, 0}, - {"rozdata", v850_rozdata, 0}, - {"bss", v850_bss, 0}, - {"offset", v850_offset, 0}, - {"word", cons, 4}, - {"zcomm", v850_comm, AREA_ZDA}, - {"scomm", v850_comm, AREA_SDA}, - {"tcomm", v850_comm, AREA_TDA}, - {"v850", set_machine, 0}, - {"call_table_data", v850_call_table_data, 0}, - {"call_table_text", v850_call_table_text, 0}, - {"v850e", set_machine, bfd_mach_v850e}, - {"v850ea", set_machine, bfd_mach_v850ea}, - {"file", dwarf2_directive_file, 0}, - {"loc", dwarf2_directive_loc, 0}, - { NULL, NULL, 0} -}; - -/* Opcode hash table. */ -static struct hash_control *v850_hash; - -/* This table is sorted. Suitable for searching by a binary search. */ -static const struct reg_name pre_defined_registers[] = { - { "ep", 30 }, /* ep - element ptr */ - { "gp", 4 }, /* gp - global ptr */ - { "hp", 2 }, /* hp - handler stack ptr */ - { "lp", 31 }, /* lp - link ptr */ - { "r0", 0 }, - { "r1", 1 }, - { "r10", 10 }, - { "r11", 11 }, - { "r12", 12 }, - { "r13", 13 }, - { "r14", 14 }, - { "r15", 15 }, - { "r16", 16 }, - { "r17", 17 }, - { "r18", 18 }, - { "r19", 19 }, - { "r2", 2 }, - { "r20", 20 }, - { "r21", 21 }, - { "r22", 22 }, - { "r23", 23 }, - { "r24", 24 }, - { "r25", 25 }, - { "r26", 26 }, - { "r27", 27 }, - { "r28", 28 }, - { "r29", 29 }, - { "r3", 3 }, - { "r30", 30 }, - { "r31", 31 }, - { "r4", 4 }, - { "r5", 5 }, - { "r6", 6 }, - { "r7", 7 }, - { "r8", 8 }, - { "r9", 9 }, - { "sp", 3 }, /* sp - stack ptr */ - { "tp", 5 }, /* tp - text ptr */ - { "zero", 0 }, -}; - -#define REG_NAME_CNT \ - (sizeof (pre_defined_registers) / sizeof (struct reg_name)) - -static const struct reg_name system_registers[] = { - { "ctbp", 20 }, - { "ctpc", 16 }, - { "ctpsw", 17 }, - { "dbpc", 18 }, - { "dbpsw", 19 }, - { "ecr", 4 }, - { "eipc", 0 }, - { "eipsw", 1 }, - { "fepc", 2 }, - { "fepsw", 3 }, - { "psw", 5 }, -}; - -#define SYSREG_NAME_CNT \ - (sizeof (system_registers) / sizeof (struct reg_name)) - -static const struct reg_name system_list_registers[] = { - {"PS", 5 }, - {"SR", 0 + 1} -}; - -#define SYSREGLIST_NAME_CNT \ - (sizeof (system_list_registers) / sizeof (struct reg_name)) - -static const struct reg_name cc_names[] = { - { "c", 0x1 }, - { "e", 0x2 }, - { "ge", 0xe }, - { "gt", 0xf }, - { "h", 0xb }, - { "l", 0x1 }, - { "le", 0x7 }, - { "lt", 0x6 }, - { "n", 0x4 }, - { "nc", 0x9 }, - { "ne", 0xa }, - { "nh", 0x3 }, - { "nl", 0x9 }, - { "ns", 0xc }, - { "nv", 0x8 }, - { "nz", 0xa }, - { "p", 0xc }, - { "s", 0x4 }, - { "sa", 0xd }, - { "t", 0x5 }, - { "v", 0x0 }, - { "z", 0x2 }, -}; - -#define CC_NAME_CNT \ - (sizeof (cc_names) / sizeof (struct reg_name)) - -/* Do a binary search of the given register table to see if NAME is a - valid regiter name. Return the register number from the array on - success, or -1 on failure. */ - -static int -reg_name_search (regs, regcount, name, accept_numbers) - const struct reg_name *regs; - int regcount; - const char *name; - boolean accept_numbers; -{ - int middle, low, high; - int cmp; - symbolS *symbolP; - - /* If the register name is a symbol, then evaluate it. */ - if ((symbolP = symbol_find (name)) != NULL) - { - /* If the symbol is an alias for another name then use that. - If the symbol is an alias for a number, then return the number. */ - if (symbol_equated_p (symbolP)) - { - name - = S_GET_NAME (symbol_get_value_expression (symbolP)->X_add_symbol); - } - else if (accept_numbers) - { - int reg = S_GET_VALUE (symbolP); - - if (reg >= 0 && reg <= 31) - return reg; - } - - /* Otherwise drop through and try parsing name normally. */ - } - - low = 0; - high = regcount - 1; - - do - { - middle = (low + high) / 2; - cmp = strcasecmp (name, regs[middle].name); - if (cmp < 0) - high = middle - 1; - else if (cmp > 0) - low = middle + 1; - else - return regs[middle].value; - } - while (low <= high); - return -1; -} - -/* Summary of register_name(). - * - * in: Input_line_pointer points to 1st char of operand. - * - * out: A expressionS. - * The operand may have been a register: in this case, X_op == O_register, - * X_add_number is set to the register number, and truth is returned. - * Input_line_pointer->(next non-blank) char after operand, or is in - * its original state. */ - -static boolean -register_name (expressionP) - expressionS *expressionP; -{ - int reg_number; - char *name; - char *start; - char c; - - /* Find the spelling of the operand. */ - start = name = input_line_pointer; - - c = get_symbol_end (); - - reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, - name, FALSE); - - /* Put back the delimiting char. */ - *input_line_pointer = c; - - /* Look to see if it's in the register table. */ - if (reg_number >= 0) - { - expressionP->X_op = O_register; - expressionP->X_add_number = reg_number; - - /* Make the rest nice. */ - expressionP->X_add_symbol = NULL; - expressionP->X_op_symbol = NULL; - - return true; - } - else - { - /* Reset the line as if we had not done anything. */ - input_line_pointer = start; - - return false; - } -} - -/* Summary of system_register_name(). - * - * in: INPUT_LINE_POINTER points to 1st char of operand. - * EXPRESSIONP points to an expression structure to be filled in. - * ACCEPT_NUMBERS is true iff numerical register names may be used. - * ACCEPT_LIST_NAMES is true iff the special names PS and SR may be - * accepted. - * - * out: A expressionS structure in expressionP. - * The operand may have been a register: in this case, X_op == O_register, - * X_add_number is set to the register number, and truth is returned. - * Input_line_pointer->(next non-blank) char after operand, or is in - * its original state. */ - -static boolean -system_register_name (expressionP, accept_numbers, accept_list_names) - expressionS *expressionP; - boolean accept_numbers; - boolean accept_list_names; -{ - int reg_number; - char *name; - char *start; - char c; - - /* Find the spelling of the operand. */ - start = name = input_line_pointer; - - c = get_symbol_end (); - reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name, - accept_numbers); - - /* Put back the delimiting char. */ - *input_line_pointer = c; - - if (reg_number < 0 - && accept_numbers) - { - /* Reset input_line pointer. */ - input_line_pointer = start; - - if (isdigit (*input_line_pointer)) - { - reg_number = strtol (input_line_pointer, &input_line_pointer, 10); - - /* Make sure that the register number is allowable. */ - if (reg_number < 0 - || (reg_number > 5 && reg_number < 16) - || reg_number > 20) - { - reg_number = -1; - } - } - else if (accept_list_names) - { - c = get_symbol_end (); - reg_number = reg_name_search (system_list_registers, - SYSREGLIST_NAME_CNT, name, FALSE); - - /* Put back the delimiting char. */ - *input_line_pointer = c; - } - } - - /* Look to see if it's in the register table. */ - if (reg_number >= 0) - { - expressionP->X_op = O_register; - expressionP->X_add_number = reg_number; - - /* Make the rest nice. */ - expressionP->X_add_symbol = NULL; - expressionP->X_op_symbol = NULL; - - return true; - } - else - { - /* Reset the line as if we had not done anything. */ - input_line_pointer = start; - - return false; - } -} - -/* Summary of cc_name(). - * - * in: INPUT_LINE_POINTER points to 1st char of operand. - * - * out: A expressionS. - * The operand may have been a register: in this case, X_op == O_register, - * X_add_number is set to the register number, and truth is returned. - * Input_line_pointer->(next non-blank) char after operand, or is in - * its original state. */ - -static boolean -cc_name (expressionP) - expressionS *expressionP; -{ - int reg_number; - char *name; - char *start; - char c; - - /* Find the spelling of the operand. */ - start = name = input_line_pointer; - - c = get_symbol_end (); - reg_number = reg_name_search (cc_names, CC_NAME_CNT, name, FALSE); - - /* Put back the delimiting char. */ - *input_line_pointer = c; - - /* Look to see if it's in the register table. */ - if (reg_number >= 0) - { - expressionP->X_op = O_constant; - expressionP->X_add_number = reg_number; - - /* Make the rest nice. */ - expressionP->X_add_symbol = NULL; - expressionP->X_op_symbol = NULL; - - return true; - } - else - { - /* Reset the line as if we had not done anything. */ - input_line_pointer = start; - - return false; - } -} - -static void -skip_white_space (void) -{ - while (*input_line_pointer == ' ' - || *input_line_pointer == '\t') - ++input_line_pointer; -} - -/* Summary of parse_register_list (). - * - * in: INPUT_LINE_POINTER points to 1st char of a list of registers. - * INSN is the partially constructed instruction. - * OPERAND is the operand being inserted. - * - * out: NULL if the parse completed successfully, otherwise a - * pointer to an error message is returned. If the parse - * completes the correct bit fields in the instruction - * will be filled in. - * - * Parses register lists with the syntax: - * - * { rX } - * { rX, rY } - * { rX - rY } - * { rX - rY, rZ } - * etc - * - * and also parses constant epxressions whoes bits indicate the - * registers in the lists. The LSB in the expression refers to - * the lowest numbered permissable register in the register list, - * and so on upwards. System registers are considered to be very - * high numbers. */ - -static char * -parse_register_list (insn, operand) - unsigned long *insn; - const struct v850_operand *operand; -{ - static int type1_regs[32] = { - 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 31, 29, 28, 23, 22, 21, 20, 27, 26, 25, 24 - }; - static int type2_regs[32] = { - 19, 18, 17, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 30, 31, 29, 28, 23, 22, 21, 20, 27, 26, 25, 24 - }; - static int type3_regs[32] = { - 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 14, 15, 13, 12, 7, 6, 5, 4, 11, 10, 9, 8 - }; - int *regs; - expressionS exp; - - /* Select a register array to parse. */ - switch (operand->shift) - { - case 0xffe00001: regs = type1_regs; break; - case 0xfff8000f: regs = type2_regs; break; - case 0xfff8001f: regs = type3_regs; break; - default: - as_bad (_("unknown operand shift: %x\n"), operand->shift); - return _("internal failure in parse_register_list"); - } - - skip_white_space (); - - /* If the expression starts with a curly brace it is a register list. - Otherwise it is a constant expression, whoes bits indicate which - registers are to be included in the list. */ - - if (*input_line_pointer != '{') - { - int reg; - int i; - - expression (&exp); - - if (exp.X_op != O_constant) - return _("constant expression or register list expected"); - - if (regs == type1_regs) - { - if (exp.X_add_number & 0xFFFFF000) - return _("high bits set in register list expression"); - - for (reg = 20; reg < 32; reg++) - if (exp.X_add_number & (1 << (reg - 20))) - { - for (i = 0; i < 32; i++) - if (regs[i] == reg) - *insn |= (1 << i); - } - } - else if (regs == type2_regs) - { - if (exp.X_add_number & 0xFFFE0000) - return _("high bits set in register list expression"); - - for (reg = 1; reg < 16; reg++) - if (exp.X_add_number & (1 << (reg - 1))) - { - for (i = 0; i < 32; i++) - if (regs[i] == reg) - *insn |= (1 << i); - } - - if (exp.X_add_number & (1 << 15)) - *insn |= (1 << 3); - - if (exp.X_add_number & (1 << 16)) - *insn |= (1 << 19); - } - else /* regs == type3_regs */ - { - if (exp.X_add_number & 0xFFFE0000) - return _("high bits set in register list expression"); - - for (reg = 16; reg < 32; reg++) - if (exp.X_add_number & (1 << (reg - 16))) - { - for (i = 0; i < 32; i++) - if (regs[i] == reg) - *insn |= (1 << i); - } - - if (exp.X_add_number & (1 << 16)) - *insn |= (1 << 19); - } - - return NULL; - } - - input_line_pointer++; - - /* Parse the register list until a terminator (closing curly brace or - new-line) is found. */ - for (;;) - { - if (register_name (&exp)) - { - int i; - - /* Locate the given register in the list, and if it is there, - insert the corresponding bit into the instruction. */ - for (i = 0; i < 32; i++) - { - if (regs[i] == exp.X_add_number) - { - *insn |= (1 << i); - break; - } - } - - if (i == 32) - { - return _("illegal register included in list"); - } - } - else if (system_register_name (&exp, true, true)) - { - if (regs == type1_regs) - { - return _("system registers cannot be included in list"); - } - else if (exp.X_add_number == 5) - { - if (regs == type2_regs) - return _("PSW cannot be included in list"); - else - *insn |= 0x8; - } - else if (exp.X_add_number < 4) - *insn |= 0x80000; - else - return _("High value system registers cannot be included in list"); - } - else if (*input_line_pointer == '}') - { - input_line_pointer++; - break; - } - else if (*input_line_pointer == ',') - { - input_line_pointer++; - continue; - } - else if (*input_line_pointer == '-') - { - /* We have encountered a range of registers: rX - rY. */ - int j; - expressionS exp2; - - /* Skip the dash. */ - ++input_line_pointer; - - /* Get the second register in the range. */ - if (! register_name (&exp2)) - { - return _("second register should follow dash in register list"); - exp2.X_add_number = exp.X_add_number; - } - - /* Add the rest of the registers in the range. */ - for (j = exp.X_add_number + 1; j <= exp2.X_add_number; j++) - { - int i; - - /* Locate the given register in the list, and if it is there, - insert the corresponding bit into the instruction. */ - for (i = 0; i < 32; i++) - { - if (regs[i] == j) - { - *insn |= (1 << i); - break; - } - } - - if (i == 32) - return _("illegal register included in list"); - } - } - else - { - break; - } - - skip_white_space (); - } - - return NULL; -} - -CONST char *md_shortopts = "m:"; - -struct option md_longopts[] = { - {NULL, no_argument, NULL, 0} -}; - -size_t md_longopts_size = sizeof (md_longopts); - -void -md_show_usage (stream) - FILE *stream; -{ - fprintf (stream, _(" V850 options:\n")); - fprintf (stream, _(" -mwarn-signed-overflow Warn if signed immediate values overflow\n")); - fprintf (stream, _(" -mwarn-unsigned-overflow Warn if unsigned immediate values overflow\n")); - fprintf (stream, _(" -mv850 The code is targeted at the v850\n")); - fprintf (stream, _(" -mv850e The code is targeted at the v850e\n")); - fprintf (stream, _(" -mv850ea The code is targeted at the v850ea\n")); - fprintf (stream, _(" -mv850any The code is generic, despite any processor specific instructions\n")); -} - -int -md_parse_option (c, arg) - int c; - char *arg; -{ - if (c != 'm') - { - if (c != 'a') - /* xgettext:c-format */ - fprintf (stderr, _("unknown command line option: -%c%s\n"), c, arg); - return 0; - } - - if (strcmp (arg, "warn-signed-overflow") == 0) - { - warn_signed_overflows = TRUE; - } - else if (strcmp (arg, "warn-unsigned-overflow") == 0) - { - warn_unsigned_overflows = TRUE; - } - else if (strcmp (arg, "v850") == 0) - { - machine = 0; - processor_mask = PROCESSOR_V850; - } - else if (strcmp (arg, "v850e") == 0) - { - machine = bfd_mach_v850e; - processor_mask = PROCESSOR_V850E; - } - else if (strcmp (arg, "v850ea") == 0) - { - machine = bfd_mach_v850ea; - processor_mask = PROCESSOR_V850EA; - } - else if (strcmp (arg, "v850any") == 0) - { - /* Tell the world that this is for any v850 chip. */ - machine = 0; - - /* But support instructions for the extended versions. */ - processor_mask = PROCESSOR_V850EA; - } - else - { - /* xgettext:c-format */ - fprintf (stderr, _("unknown command line option: -%c%s\n"), c, arg); - return 0; - } - - return 1; -} - -symbolS * -md_undefined_symbol (name) - char *name ATTRIBUTE_UNUSED; -{ - return 0; -} - -char * -md_atof (type, litp, sizep) - int type; - char *litp; - int *sizep; -{ - int prec; - LITTLENUM_TYPE words[4]; - char *t; - int i; - - switch (type) - { - case 'f': - prec = 2; - break; - - case 'd': - prec = 4; - break; - - default: - *sizep = 0; - return _("bad call to md_atof"); - } - - t = atof_ieee (input_line_pointer, type, words); - if (t) - input_line_pointer = t; - - *sizep = prec * 2; - - for (i = prec - 1; i >= 0; i--) - { - md_number_to_chars (litp, (valueT) words[i], 2); - litp += 2; - } - - return NULL; -} - -/* Very gross. */ - -void -md_convert_frag (abfd, sec, fragP) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec; - fragS *fragP; -{ - subseg_change (sec, 0); - - /* In range conditional or unconditional branch. */ - if (fragP->fr_subtype == 0 || fragP->fr_subtype == 2) - { - fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, - fragP->fr_offset, 1, BFD_RELOC_UNUSED + (int)fragP->fr_opcode); - fragP->fr_fix += 2; - } - /* Out of range conditional branch. Emit a branch around a jump. */ - else if (fragP->fr_subtype == 1) - { - unsigned char *buffer = - (unsigned char *) (fragP->fr_fix + fragP->fr_literal); - - /* Reverse the condition of the first branch. */ - buffer[0] ^= 0x08; - /* Mask off all the displacement bits. */ - buffer[0] &= 0x8f; - buffer[1] &= 0x07; - /* Now set the displacement bits so that we branch - around the unconditional branch. */ - buffer[0] |= 0x30; - - /* Now create the unconditional branch + fixup to the final - target. */ - md_number_to_chars (buffer + 2, 0x00000780, 4); - fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol, - fragP->fr_offset, 1, BFD_RELOC_UNUSED + - (int) fragP->fr_opcode + 1); - fragP->fr_fix += 6; - } - /* Out of range unconditional branch. Emit a jump. */ - else if (fragP->fr_subtype == 3) - { - md_number_to_chars (fragP->fr_fix + fragP->fr_literal, 0x00000780, 4); - fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, - fragP->fr_offset, 1, BFD_RELOC_UNUSED + - (int) fragP->fr_opcode + 1); - fragP->fr_fix += 4; - } - else - abort (); -} - -valueT -md_section_align (seg, addr) - asection *seg; - valueT addr; -{ - int align = bfd_get_section_alignment (stdoutput, seg); - return ((addr + (1 << align) - 1) & (-1 << align)); -} - -void -md_begin () -{ - char *prev_name = ""; - register const struct v850_opcode *op; - flagword applicable; - - if (strncmp (TARGET_CPU, "v850ea", 6) == 0) - { - if (machine == -1) - machine = bfd_mach_v850ea; - - if (processor_mask == -1) - processor_mask = PROCESSOR_V850EA; - } - else if (strncmp (TARGET_CPU, "v850e", 5) == 0) - { - if (machine == -1) - machine = bfd_mach_v850e; - - if (processor_mask == -1) - processor_mask = PROCESSOR_V850E; - } - else if (strncmp (TARGET_CPU, "v850", 4) == 0) - { - if (machine == -1) - machine = 0; - - if (processor_mask == -1) - processor_mask = PROCESSOR_V850; - } - else - /* xgettext:c-format */ - as_bad (_("Unable to determine default target processor from string: %s"), - TARGET_CPU); - - v850_hash = hash_new (); - - /* Insert unique names into hash table. The V850 instruction set - has many identical opcode names that have different opcodes based - on the operands. This hash table then provides a quick index to - the first opcode with a particular name in the opcode table. */ - - op = v850_opcodes; - while (op->name) - { - if (strcmp (prev_name, op->name)) - { - prev_name = (char *) op->name; - hash_insert (v850_hash, op->name, (char *) op); - } - op++; - } - - bfd_set_arch_mach (stdoutput, TARGET_ARCH, machine); - - applicable = bfd_applicable_section_flags (stdoutput); - - call_table_data_section = subseg_new (".call_table_data", 0); - bfd_set_section_flags (stdoutput, call_table_data_section, - applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC - | SEC_DATA | SEC_HAS_CONTENTS)); - - call_table_text_section = subseg_new (".call_table_text", 0); - bfd_set_section_flags (stdoutput, call_table_text_section, - applicable & (SEC_ALLOC | SEC_LOAD | SEC_READONLY - | SEC_CODE)); - - /* Restore text section as the current default. */ - subseg_set (text_section, 0); -} - -static bfd_reloc_code_real_type -handle_ctoff (const struct v850_operand *operand) -{ - if (operand == NULL) - return BFD_RELOC_V850_CALLT_16_16_OFFSET; - - if (operand->bits != 6 - || operand->shift != 0) - { - as_bad (_("ctoff() relocation used on an instruction which does not support it")); - return BFD_RELOC_64; /* Used to indicate an error condition. */ - } - - return BFD_RELOC_V850_CALLT_6_7_OFFSET; -} - -static bfd_reloc_code_real_type -handle_sdaoff (const struct v850_operand *operand) -{ - if (operand == NULL) - return BFD_RELOC_V850_SDA_16_16_OFFSET; - - if (operand->bits == 15 && operand->shift == 17) - return BFD_RELOC_V850_SDA_15_16_OFFSET; - - if (operand->bits == -1) - return BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET; - - if (operand->bits != 16 - || operand->shift != 16) - { - as_bad (_("sdaoff() relocation used on an instruction which does not support it")); - return BFD_RELOC_64; /* Used to indicate an error condition. */ - } - - return BFD_RELOC_V850_SDA_16_16_OFFSET; -} - -static bfd_reloc_code_real_type -handle_zdaoff (const struct v850_operand *operand) -{ - if (operand == NULL) - return BFD_RELOC_V850_ZDA_16_16_OFFSET; - - if (operand->bits == 15 && operand->shift == 17) - return BFD_RELOC_V850_ZDA_15_16_OFFSET; - - if (operand->bits == -1) - return BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET; - - if (operand->bits != 16 - || operand->shift != 16) - { - as_bad (_("zdaoff() relocation used on an instruction which does not support it")); - /* Used to indicate an error condition. */ - return BFD_RELOC_64; - } - - return BFD_RELOC_V850_ZDA_16_16_OFFSET; -} - -static bfd_reloc_code_real_type -handle_tdaoff (const struct v850_operand *operand) -{ - if (operand == NULL) - /* Data item, not an instruction. */ - return BFD_RELOC_V850_TDA_7_7_OFFSET; - - if (operand->bits == 6 && operand->shift == 1) - /* sld.w/sst.w, operand: D8_6 */ - return BFD_RELOC_V850_TDA_6_8_OFFSET; - - if (operand->bits == 4 && operand->insert != NULL) - /* sld.hu, operand: D5-4 */ - return BFD_RELOC_V850_TDA_4_5_OFFSET; - - if (operand->bits == 4 && operand->insert == NULL) - /* sld.bu, operand: D4 */ - return BFD_RELOC_V850_TDA_4_4_OFFSET; - - if (operand->bits == 16 && operand->shift == 16) - /* set1 & chums, operands: D16 */ - return BFD_RELOC_V850_TDA_16_16_OFFSET; - - if (operand->bits != 7) - { - as_bad (_("tdaoff() relocation used on an instruction which does not support it")); - /* Used to indicate an error condition. */ - return BFD_RELOC_64; - } - - return operand->insert != NULL - ? BFD_RELOC_V850_TDA_7_8_OFFSET /* sld.h/sst.h, operand: D8_7 */ - : BFD_RELOC_V850_TDA_7_7_OFFSET; /* sld.b/sst.b, opreand: D7 */ -} - -/* Warning: The code in this function relies upon the definitions - in the v850_operands[] array (defined in opcodes/v850-opc.c) - matching the hard coded values contained herein. */ - -static bfd_reloc_code_real_type -v850_reloc_prefix (const struct v850_operand *operand) -{ - boolean paren_skipped = false; - - /* Skip leading opening parenthesis. */ - if (*input_line_pointer == '(') - { - ++input_line_pointer; - paren_skipped = true; - } - -#define CHECK_(name, reloc) \ - if (strncmp (input_line_pointer, name##"(", strlen (name) + 1) == 0) \ - { \ - input_line_pointer += strlen (name); \ - return reloc; \ - } - - CHECK_ ("hi0", BFD_RELOC_HI16 ); - CHECK_ ("hi", BFD_RELOC_HI16_S ); - CHECK_ ("lo", BFD_RELOC_LO16 ); - CHECK_ ("sdaoff", handle_sdaoff (operand)); - CHECK_ ("zdaoff", handle_zdaoff (operand)); - CHECK_ ("tdaoff", handle_tdaoff (operand)); - CHECK_ ("hilo", BFD_RELOC_32 ); - CHECK_ ("ctoff", handle_ctoff (operand) ); - - /* Restore skipped parenthesis. */ - if (paren_skipped) - --input_line_pointer; - - return BFD_RELOC_UNUSED; -} - -/* Insert an operand value into an instruction. */ - -static unsigned long -v850_insert_operand (insn, operand, val, file, line, str) - unsigned long insn; - const struct v850_operand *operand; - offsetT val; - char *file; - unsigned int line; - char *str; -{ - if (operand->insert) - { - const char *message = NULL; - - insn = operand->insert (insn, val, &message); - if (message != NULL) - { - if ((operand->flags & V850_OPERAND_SIGNED) - && ! warn_signed_overflows - && strstr (message, "out of range") != NULL) - { - /* Skip warning... */ - } - else if ((operand->flags & V850_OPERAND_SIGNED) == 0 - && ! warn_unsigned_overflows - && strstr (message, "out of range") != NULL) - { - /* Skip warning... */ - } - else if (str) - { - if (file == (char *) NULL) - as_warn ("%s: %s", str, message); - else - as_warn_where (file, line, "%s: %s", str, message); - } - else - { - if (file == (char *) NULL) - as_warn (message); - else - as_warn_where (file, line, message); - } - } - } - else - { - if (operand->bits != 32) - { - long min, max; - - if ((operand->flags & V850_OPERAND_SIGNED) != 0) - { - if (! warn_signed_overflows) - max = (1 << operand->bits) - 1; - else - max = (1 << (operand->bits - 1)) - 1; - - min = -(1 << (operand->bits - 1)); - } - else - { - max = (1 << operand->bits) - 1; - - if (! warn_unsigned_overflows) - min = -(1 << (operand->bits - 1)); - else - min = 0; - } - - if (val < (offsetT) min || val > (offsetT) max) - { - /* xgettext:c-format */ - const char *err = - _("operand out of range (%s not between %ld and %ld)"); - char buf[100]; - - /* Restore min and mix to expected values for decimal ranges. */ - if ((operand->flags & V850_OPERAND_SIGNED) - && ! warn_signed_overflows) - max = (1 << (operand->bits - 1)) - 1; - - if (! (operand->flags & V850_OPERAND_SIGNED) - && ! warn_unsigned_overflows) - min = 0; - - if (str) - { - sprintf (buf, "%s: ", str); - - sprint_value (buf + strlen (buf), val); - } - else - sprint_value (buf, val); - - if (file == (char *) NULL) - as_warn (err, buf, min, max); - else - as_warn_where (file, line, err, buf, min, max); - } - } - - insn |= (((long) val & ((1 << operand->bits) - 1)) << operand->shift); - } - - return insn; -} - -static char copy_of_instruction[128]; - -void -md_assemble (str) - char *str; -{ - char *s; - char *start_of_operands; - struct v850_opcode *opcode; - struct v850_opcode *next_opcode; - const unsigned char *opindex_ptr; - int next_opindex; - int relaxable = 0; - unsigned long insn; - unsigned long insn_size; - char *f; - int i; - int match; - boolean extra_data_after_insn = false; - unsigned extra_data_len = 0; - unsigned long extra_data = 0; - char *saved_input_line_pointer; - - strncpy (copy_of_instruction, str, sizeof (copy_of_instruction) - 1); - - /* Get the opcode. */ - for (s = str; *s != '\0' && ! isspace (*s); s++) - continue; - - if (*s != '\0') - *s++ = '\0'; - - /* Find the first opcode with the proper name. */ - opcode = (struct v850_opcode *) hash_find (v850_hash, str); - if (opcode == NULL) - { - /* xgettext:c-format */ - as_bad (_("Unrecognized opcode: `%s'"), str); - ignore_rest_of_line (); - return; - } - - str = s; - while (isspace (*str)) - ++str; - - start_of_operands = str; - - saved_input_line_pointer = input_line_pointer; - - for (;;) - { - const char *errmsg = NULL; - - match = 0; - - if ((opcode->processors & processor_mask) == 0) - { - errmsg = _("Target processor does not support this instruction."); - goto error; - } - - relaxable = 0; - fc = 0; - next_opindex = 0; - insn = opcode->opcode; - extra_data_after_insn = false; - - input_line_pointer = str = start_of_operands; - - for (opindex_ptr = opcode->operands; *opindex_ptr != 0; opindex_ptr++) - { - const struct v850_operand *operand; - char *hold; - expressionS ex; - bfd_reloc_code_real_type reloc; - - if (next_opindex == 0) - { - operand = &v850_operands[*opindex_ptr]; - } - else - { - operand = &v850_operands[next_opindex]; - next_opindex = 0; - } - - errmsg = NULL; - - while (*str == ' ' || *str == ',' || *str == '[' || *str == ']') - ++str; - - if (operand->flags & V850_OPERAND_RELAX) - relaxable = 1; - - /* Gather the operand. */ - hold = input_line_pointer; - input_line_pointer = str; - - /* lo(), hi(), hi0(), etc... */ - if ((reloc = v850_reloc_prefix (operand)) != BFD_RELOC_UNUSED) - { - /* This is a fake reloc, used to indicate an error condition. */ - if (reloc == BFD_RELOC_64) - { - match = 1; - goto error; - } - - expression (&ex); - - if (ex.X_op == O_constant) - { - switch (reloc) - { - case BFD_RELOC_V850_ZDA_16_16_OFFSET: - /* To cope with "not1 7, zdaoff(0xfffff006)[r0]" - and the like. */ - /* Fall through. */ - - case BFD_RELOC_LO16: - { - /* Truncate, then sign extend the value. */ - ex.X_add_number = SEXT16 (ex.X_add_number); - break; - } - - case BFD_RELOC_HI16: - { - /* Truncate, then sign extend the value. */ - ex.X_add_number = SEXT16 (ex.X_add_number >> 16); - break; - } - - case BFD_RELOC_HI16_S: - { - /* Truncate, then sign extend the value. */ - int temp = (ex.X_add_number >> 16) & 0xffff; - - temp += (ex.X_add_number >> 15) & 1; - - ex.X_add_number = SEXT16 (temp); - break; - } - - case BFD_RELOC_32: - if ((operand->flags & V850E_IMMEDIATE32) == 0) - { - errmsg = _("immediate operand is too large"); - goto error; - } - - extra_data_after_insn = true; - extra_data_len = 4; - extra_data = ex.X_add_number; - ex.X_add_number = 0; - break; - - default: - fprintf (stderr, "reloc: %d\n", reloc); - as_bad (_("AAARG -> unhandled constant reloc")); - break; - } - - if (fc > MAX_INSN_FIXUPS) - as_fatal (_("too many fixups")); - - fixups[fc].exp = ex; - fixups[fc].opindex = *opindex_ptr; - fixups[fc].reloc = reloc; - fc++; - } - else - { - if (reloc == BFD_RELOC_32) - { - if ((operand->flags & V850E_IMMEDIATE32) == 0) - { - errmsg = _("immediate operand is too large"); - goto error; - } - - extra_data_after_insn = true; - extra_data_len = 4; - extra_data = ex.X_add_number; - } - - if (fc > MAX_INSN_FIXUPS) - as_fatal (_("too many fixups")); - - fixups[fc].exp = ex; - fixups[fc].opindex = *opindex_ptr; - fixups[fc].reloc = reloc; - fc++; - } - } - else - { - errmsg = NULL; - - if ((operand->flags & V850_OPERAND_REG) != 0) - { - if (!register_name (&ex)) - { - errmsg = _("invalid register name"); - } - else if ((operand->flags & V850_NOT_R0) - && ex.X_add_number == 0) - { - errmsg = _("register r0 cannot be used here"); - - /* Force an error message to be generated by - skipping over any following potential matches - for this opcode. */ - opcode += 3; - } - } - else if ((operand->flags & V850_OPERAND_SRG) != 0) - { - if (!system_register_name (&ex, true, false)) - { - errmsg = _("invalid system register name"); - } - } - else if ((operand->flags & V850_OPERAND_EP) != 0) - { - char *start = input_line_pointer; - char c = get_symbol_end (); - - if (strcmp (start, "ep") != 0 && strcmp (start, "r30") != 0) - { - /* Put things back the way we found them. */ - *input_line_pointer = c; - input_line_pointer = start; - errmsg = _("expected EP register"); - goto error; - } - - *input_line_pointer = c; - str = input_line_pointer; - input_line_pointer = hold; - - while (*str == ' ' || *str == ',' - || *str == '[' || *str == ']') - ++str; - continue; - } - else if ((operand->flags & V850_OPERAND_CC) != 0) - { - if (!cc_name (&ex)) - { - errmsg = _("invalid condition code name"); - } - } - else if (operand->flags & V850E_PUSH_POP) - { - errmsg = parse_register_list (&insn, operand); - - /* The parse_register_list() function has already done - everything, so fake a dummy expression. */ - ex.X_op = O_constant; - ex.X_add_number = 0; - } - else if (operand->flags & V850E_IMMEDIATE16) - { - expression (&ex); - - if (ex.X_op != O_constant) - errmsg = _("constant expression expected"); - else if (ex.X_add_number & 0xffff0000) - { - if (ex.X_add_number & 0xffff) - errmsg = _("constant too big to fit into instruction"); - else if ((insn & 0x001fffc0) == 0x00130780) - ex.X_add_number >>= 16; - else - errmsg = _("constant too big to fit into instruction"); - } - - extra_data_after_insn = true; - extra_data_len = 2; - extra_data = ex.X_add_number; - ex.X_add_number = 0; - } - else if (operand->flags & V850E_IMMEDIATE32) - { - expression (&ex); - - if (ex.X_op != O_constant) - errmsg = _("constant expression expected"); - - extra_data_after_insn = true; - extra_data_len = 4; - extra_data = ex.X_add_number; - ex.X_add_number = 0; - } - else if (register_name (&ex) - && (operand->flags & V850_OPERAND_REG) == 0) - { - char c; - int exists = 0; - - /* It is possible that an alias has been defined that - matches a register name. For example the code may - include a ".set ZERO, 0" directive, which matches - the register name "zero". Attempt to reparse the - field as an expression, and only complain if we - cannot generate a constant. */ - - input_line_pointer = str; - - c = get_symbol_end (); - - if (symbol_find (str) != NULL) - exists = 1; - - *input_line_pointer = c; - input_line_pointer = str; - - expression (&ex); - - if (ex.X_op != O_constant) - { - /* If this register is actually occuring too early on - the parsing of the instruction, (because another - field is missing) then report this. */ - if (opindex_ptr[1] != 0 - && (v850_operands[opindex_ptr[1]].flags - & V850_OPERAND_REG)) - errmsg = _("syntax error: value is missing before the register name"); - else - errmsg = _("syntax error: register not expected"); - - /* If we created a symbol in the process of this - test then delete it now, so that it will not - be output with the real symbols... */ - if (exists == 0 - && ex.X_op == O_symbol) - symbol_remove (ex.X_add_symbol, - &symbol_rootP, &symbol_lastP); - } - } - else if (system_register_name (&ex, false, false) - && (operand->flags & V850_OPERAND_SRG) == 0) - { - errmsg = _("syntax error: system register not expected"); - } - else if (cc_name (&ex) - && (operand->flags & V850_OPERAND_CC) == 0) - { - errmsg = _("syntax error: condition code not expected"); - } - else - { - expression (&ex); - /* Special case: - If we are assembling a MOV instruction (or a CALLT.... :-) - and the immediate value does not fit into the bits - available then create a fake error so that the next MOV - instruction will be selected. This one has a 32 bit - immediate field. */ - - if (((insn & 0x07e0) == 0x0200) - && ex.X_op == O_constant - && (ex.X_add_number < (-(1 << (operand->bits - 1))) - || ex.X_add_number > ((1 << operand->bits) - 1))) - errmsg = _("immediate operand is too large"); - } - - if (errmsg) - goto error; - -#if 0 - fprintf (stderr, - " insn: %x, operand %d, op: %d, add_number: %d\n", - insn, opindex_ptr - opcode->operands, - ex.X_op, ex.X_add_number); -#endif - - switch (ex.X_op) - { - case O_illegal: - errmsg = _("illegal operand"); - goto error; - case O_absent: - errmsg = _("missing operand"); - goto error; - case O_register: - if ((operand->flags - & (V850_OPERAND_REG | V850_OPERAND_SRG)) == 0) - { - errmsg = _("invalid operand"); - goto error; - } - insn = v850_insert_operand (insn, operand, ex.X_add_number, - (char *) NULL, 0, - copy_of_instruction); - break; - - case O_constant: - insn = v850_insert_operand (insn, operand, ex.X_add_number, - (char *) NULL, 0, - copy_of_instruction); - break; - - default: - /* We need to generate a fixup for this expression. */ - if (fc >= MAX_INSN_FIXUPS) - as_fatal (_("too many fixups")); - - fixups[fc].exp = ex; - fixups[fc].opindex = *opindex_ptr; - fixups[fc].reloc = BFD_RELOC_UNUSED; - ++fc; - break; - } - } - - str = input_line_pointer; - input_line_pointer = hold; - - while (*str == ' ' || *str == ',' || *str == '[' || *str == ']' - || *str == ')') - ++str; - } - match = 1; - - error: - if (match == 0) - { - next_opcode = opcode + 1; - if (next_opcode->name != NULL - && strcmp (next_opcode->name, opcode->name) == 0) - { - opcode = next_opcode; - - /* Skip versions that are not supported by the target - processor. */ - if ((opcode->processors & processor_mask) == 0) - goto error; - - continue; - } - - as_bad ("%s: %s", copy_of_instruction, errmsg); - - if (*input_line_pointer == ']') - ++input_line_pointer; - - ignore_rest_of_line (); - input_line_pointer = saved_input_line_pointer; - return; - } - break; - } - - while (isspace (*str)) - ++str; - - if (*str != '\0') - /* xgettext:c-format */ - as_bad (_("junk at end of line: `%s'"), str); - - input_line_pointer = str; - - /* Tie dwarf2 debug info to the address at the start of the insn. - We can't do this after the insn has been output as the current - frag may have been closed off. eg. by frag_var. */ - dwarf2_emit_insn (0); - - /* Write out the instruction. */ - - if (relaxable && fc > 0) - { - insn_size = 2; - fc = 0; - - if (!strcmp (opcode->name, "br")) - { - f = frag_var (rs_machine_dependent, 4, 2, 2, - fixups[0].exp.X_add_symbol, - fixups[0].exp.X_add_number, - (char *) fixups[0].opindex); - md_number_to_chars (f, insn, insn_size); - md_number_to_chars (f + 2, 0, 2); - } - else - { - f = frag_var (rs_machine_dependent, 6, 4, 0, - fixups[0].exp.X_add_symbol, - fixups[0].exp.X_add_number, - (char *) fixups[0].opindex); - md_number_to_chars (f, insn, insn_size); - md_number_to_chars (f + 2, 0, 4); - } - } - else - { - /* Four byte insns have an opcode with the two high bits on. */ - if ((insn & 0x0600) == 0x0600) - insn_size = 4; - else - insn_size = 2; - - /* Special case: 32 bit MOV. */ - if ((insn & 0xffe0) == 0x0620) - insn_size = 2; - - f = frag_more (insn_size); - md_number_to_chars (f, insn, insn_size); - - if (extra_data_after_insn) - { - f = frag_more (extra_data_len); - md_number_to_chars (f, extra_data, extra_data_len); - - extra_data_after_insn = false; - } - } - - /* Create any fixups. At this point we do not use a - bfd_reloc_code_real_type, but instead just use the - BFD_RELOC_UNUSED plus the operand index. This lets us easily - handle fixups for any operand type, although that is admittedly - not a very exciting feature. We pick a BFD reloc type in - md_apply_fix. */ - for (i = 0; i < fc; i++) - { - const struct v850_operand *operand; - bfd_reloc_code_real_type reloc; - - operand = &v850_operands[fixups[i].opindex]; - - reloc = fixups[i].reloc; - - if (reloc != BFD_RELOC_UNUSED) - { - reloc_howto_type *reloc_howto = - bfd_reloc_type_lookup (stdoutput, reloc); - int size; - int address; - fixS *fixP; - - if (!reloc_howto) - abort (); - - size = bfd_get_reloc_size (reloc_howto); - - /* XXX This will abort on an R_V850_8 reloc - - is this reloc actually used? */ - if (size != 2 && size != 4) - abort (); - - address = (f - frag_now->fr_literal) + insn_size - size; - - if (reloc == BFD_RELOC_32) - address += 2; - - fixP = fix_new_exp (frag_now, address, size, - &fixups[i].exp, - reloc_howto->pc_relative, - reloc); - - switch (reloc) - { - case BFD_RELOC_LO16: - case BFD_RELOC_HI16: - case BFD_RELOC_HI16_S: - fixP->fx_no_overflow = 1; - break; - default: - break; - } - } - else - { - fix_new_exp (frag_now, - f - frag_now->fr_literal, 4, - & fixups[i].exp, - 1 /* FIXME: V850_OPERAND_RELATIVE ??? */, - (bfd_reloc_code_real_type) (fixups[i].opindex - + (int) BFD_RELOC_UNUSED)); - } - } - - input_line_pointer = saved_input_line_pointer; -} - -/* If while processing a fixup, a reloc really needs to be created - then it is done here. */ - -arelent * -tc_gen_reloc (seg, fixp) - asection *seg ATTRIBUTE_UNUSED; - fixS *fixp; -{ - arelent *reloc; - - reloc = (arelent *) xmalloc (sizeof (arelent)); - reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); - *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); - reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; - reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); - - if (reloc->howto == (reloc_howto_type *) NULL) - { - as_bad_where (fixp->fx_file, fixp->fx_line, - /* xgettext:c-format */ - _("reloc %d not supported by object file format"), - (int) fixp->fx_r_type); - - xfree (reloc); - - return NULL; - } - - if (fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY - || fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT) - reloc->addend = fixp->fx_offset; - else - reloc->addend = fixp->fx_addnumber; - - return reloc; -} - -/* Return current size of variable part of frag. */ - -int -md_estimate_size_before_relax (fragp, seg) - fragS *fragp; - asection *seg ATTRIBUTE_UNUSED; -{ - if (fragp->fr_subtype >= sizeof (md_relax_table) / sizeof (md_relax_table[0])) - abort (); - - return md_relax_table[fragp->fr_subtype].rlx_length; -} - -long -v850_pcrel_from_section (fixp, section) - fixS *fixp; - segT section; -{ - /* If the symbol is undefined, or in a section other than our own, - or it is weak (in which case it may well be in another section, - then let the linker figure it out. */ - if (fixp->fx_addsy != (symbolS *) NULL - && (! S_IS_DEFINED (fixp->fx_addsy) - || S_IS_WEAK (fixp->fx_addsy) - || (S_GET_SEGMENT (fixp->fx_addsy) != section))) - return 0; - - return fixp->fx_frag->fr_address + fixp->fx_where; -} - -int -md_apply_fix3 (fixp, valuep, seg) - fixS *fixp; - valueT *valuep; - segT seg ATTRIBUTE_UNUSED; -{ - valueT value; - char *where; - - if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT - || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY) - { - fixp->fx_done = 0; - return 1; - } - - if (fixp->fx_addsy == (symbolS *) NULL) - { - value = *valuep; - fixp->fx_done = 1; - } - else if (fixp->fx_pcrel) - value = *valuep; - else - { - value = fixp->fx_offset; - if (fixp->fx_subsy != (symbolS *) NULL) - { - if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section) - value -= S_GET_VALUE (fixp->fx_subsy); - else - { - /* We don't actually support subtracting a symbol. */ - as_bad_where (fixp->fx_file, fixp->fx_line, - _("expression too complex")); - } - } - } - - if ((int) fixp->fx_r_type >= (int) BFD_RELOC_UNUSED) - { - int opindex; - const struct v850_operand *operand; - unsigned long insn; - - opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED; - operand = &v850_operands[opindex]; - - /* Fetch the instruction, insert the fully resolved operand - value, and stuff the instruction back again. - - Note the instruction has been stored in little endian - format! */ - where = fixp->fx_frag->fr_literal + fixp->fx_where; - - insn = bfd_getl32 ((unsigned char *) where); - insn = v850_insert_operand (insn, operand, (offsetT) value, - fixp->fx_file, fixp->fx_line, NULL); - bfd_putl32 ((bfd_vma) insn, (unsigned char *) where); - - if (fixp->fx_done) - { - /* Nothing else to do here. */ - return 1; - } - - /* Determine a BFD reloc value based on the operand information. - We are only prepared to turn a few of the operands into relocs. */ - - if (operand->bits == 22) - fixp->fx_r_type = BFD_RELOC_V850_22_PCREL; - else if (operand->bits == 9) - fixp->fx_r_type = BFD_RELOC_V850_9_PCREL; - else - { -#if 0 - fprintf (stderr, "bits: %d, insn: %x\n", operand->bits, insn); -#endif - - as_bad_where (fixp->fx_file, fixp->fx_line, - _("unresolved expression that must be resolved")); - fixp->fx_done = 1; - return 1; - } - } - else if (fixp->fx_done) - { - /* We still have to insert the value into memory! */ - where = fixp->fx_frag->fr_literal + fixp->fx_where; - - if (fixp->fx_size == 1) - *where = value & 0xff; - else if (fixp->fx_size == 2) - bfd_putl16 (value & 0xffff, (unsigned char *) where); - else if (fixp->fx_size == 4) - bfd_putl32 (value, (unsigned char *) where); - } - - fixp->fx_addnumber = value; - return 1; -} - -/* Parse a cons expression. We have to handle hi(), lo(), etc - on the v850. */ - -void -parse_cons_expression_v850 (exp) - expressionS *exp; -{ - /* See if there's a reloc prefix like hi() we have to handle. */ - hold_cons_reloc = v850_reloc_prefix (NULL); - - /* Do normal expression parsing. */ - expression (exp); -} - -/* Create a fixup for a cons expression. If parse_cons_expression_v850 - found a reloc prefix, then we use that reloc, else we choose an - appropriate one based on the size of the expression. */ - -void -cons_fix_new_v850 (frag, where, size, exp) - fragS *frag; - int where; - int size; - expressionS *exp; -{ - if (hold_cons_reloc == BFD_RELOC_UNUSED) - { - if (size == 4) - hold_cons_reloc = BFD_RELOC_32; - if (size == 2) - hold_cons_reloc = BFD_RELOC_16; - if (size == 1) - hold_cons_reloc = BFD_RELOC_8; - } - - if (exp != NULL) - fix_new_exp (frag, where, size, exp, 0, hold_cons_reloc); - else - fix_new (frag, where, size, NULL, 0, 0, hold_cons_reloc); - - hold_cons_reloc = BFD_RELOC_UNUSED; -} - -boolean -v850_fix_adjustable (fixP) - fixS *fixP; -{ - if (fixP->fx_addsy == NULL) - return 1; - - /* Prevent all adjustments to global symbols. */ - if (S_IS_EXTERN (fixP->fx_addsy)) - return 0; - - /* Similarly for weak symbols. */ - if (S_IS_WEAK (fixP->fx_addsy)) - return 0; - - /* Don't adjust function names. */ - if (S_IS_FUNCTION (fixP->fx_addsy)) - return 0; - - /* We need the symbol name for the VTABLE entries. */ - if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT - || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY) - return 0; - - return 1; -} - -int -v850_force_relocation (fixP) - struct fix *fixP; -{ - if (fixP->fx_addsy && S_IS_WEAK (fixP->fx_addsy)) - return 1; - - if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT - || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY) - return 1; - - return 0; -} diff --git a/contrib/binutils/gas/config/tc-v850.h b/contrib/binutils/gas/config/tc-v850.h deleted file mode 100644 index 7ce049111c09..000000000000 --- a/contrib/binutils/gas/config/tc-v850.h +++ /dev/null @@ -1,93 +0,0 @@ -/* tc-v850.h -- Header file for tc-v850.c. - Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc. - - This file is part of GAS, the GNU Assembler. - - GAS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GAS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#define TC_V850 - -#include <elf/v850.h> - -#define TARGET_BYTES_BIG_ENDIAN 0 - -#ifndef BFD_ASSEMBLER - #error V850 support requires BFD_ASSEMBLER -#endif - -/* The target BFD architecture. */ -#define TARGET_ARCH bfd_arch_v850 - -/* The target BFD format. */ -#define TARGET_FORMAT "elf32-v850" - -#define MD_APPLY_FIX3 -#define md_operand(x) - -#define obj_fix_adjustable(fixP) v850_fix_adjustable(fixP) -#define TC_FORCE_RELOCATION(fixp) v850_force_relocation(fixp) - -#ifdef OBJ_ELF -/* This arranges for gas/write.c to not apply a relocation if - obj_fix_adjustable() says it is not adjustable. */ -#define TC_FIX_ADJUSTABLE(fixP) obj_fix_adjustable (fixP) -#endif - -extern int v850_force_relocation PARAMS ((struct fix *)); - -/* Permit temporary numeric labels. */ -#define LOCAL_LABELS_FB 1 - -#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */ - -/* We don't need to handle .word strangely. */ -#define WORKING_DOT_WORD - -#define md_number_to_chars number_to_chars_littleendian - -/* We need to handle lo(), hi(), etc etc in .hword, .word, etc - directives, so we have to parse "cons" expressions ourselves. */ -#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_cons_expression_v850 (EXP) -#define TC_CONS_FIX_NEW cons_fix_new_v850 -extern const struct relax_type md_relax_table[]; -#define TC_GENERIC_RELAX_TABLE md_relax_table - -/* This section must be in the small data area (pointed to by GP). */ -#define SHF_V850_GPREL 0x10000000 -/* This section must be in the tiny data area (pointed to by EP). */ -#define SHF_V850_EPREL 0x20000000 -/* This section must be in the zero data area (pointed to by R0). */ -#define SHF_V850_R0REL 0x40000000 - -#define ELF_TC_SPECIAL_SECTIONS \ - { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_GPREL }, \ - { ".rosdata", SHT_PROGBITS, SHF_ALLOC + SHF_V850_GPREL }, \ - { ".sbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_GPREL }, \ - { ".scommon", SHT_V850_SCOMMON, SHF_ALLOC + SHF_WRITE + SHF_V850_GPREL }, \ - { ".tdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_EPREL }, \ - { ".tbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_EPREL }, \ - { ".tcommon", SHT_V850_TCOMMON, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, \ - { ".zdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, \ - { ".rozdata", SHT_PROGBITS, SHF_ALLOC + SHF_V850_R0REL }, \ - { ".zbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, \ - { ".zcommon", SHT_V850_ZCOMMON, SHF_ALLOC + SHF_WRITE + SHF_V850_R0REL }, \ - { ".call_table_data", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \ - { ".call_table_text", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_EXECINSTR }, - -#define MD_PCREL_FROM_SECTION(fixP,section) v850_pcrel_from_section (fixP, section) -extern long v850_pcrel_from_section (); - -#define DWARF2_LINE_MIN_INSN_LENGTH 2 diff --git a/contrib/binutils/gas/config/tc-z8k.c b/contrib/binutils/gas/config/tc-z8k.c deleted file mode 100644 index 73666ca89ab7..000000000000 --- a/contrib/binutils/gas/config/tc-z8k.c +++ /dev/null @@ -1,1552 +0,0 @@ -/* tc-z8k.c -- Assemble code for the Zilog Z800n - Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000 - Free Software Foundation, Inc. - - This file is part of GAS, the GNU Assembler. - - GAS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GAS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -/* Written By Steve Chamberlain <sac@cygnus.com>. */ - -#define DEFINE_TABLE -#include <stdio.h> - -#include "opcodes/z8k-opc.h" - -#include "as.h" -#include "bfd.h" -#include <ctype.h> - -const char comment_chars[] = "!"; -const char line_comment_chars[] = "#"; -const char line_separator_chars[] = ";"; - -extern int machine; -extern int coff_flags; -int segmented_mode; -const int md_reloc_size; - -void cons (); - -void -s_segm () -{ - segmented_mode = 1; - machine = bfd_mach_z8001; - coff_flags = F_Z8001; -} - -void -s_unseg () -{ - segmented_mode = 0; - machine = bfd_mach_z8002; - coff_flags = F_Z8002; -} - -static void -even () -{ - frag_align (1, 0, 0); - record_alignment (now_seg, 1); -} - -void obj_coff_section (); - -int -tohex (c) - int c; -{ - if (isdigit (c)) - return c - '0'; - if (islower (c)) - return c - 'a' + 10; - return c - 'A' + 10; -} - -void -sval () -{ - SKIP_WHITESPACE (); - if (*input_line_pointer == '\'') - { - int c; - input_line_pointer++; - c = *input_line_pointer++; - while (c != '\'') - { - if (c == '%') - { - c = (tohex (input_line_pointer[0]) << 4) - | tohex (input_line_pointer[1]); - input_line_pointer += 2; - } - FRAG_APPEND_1_CHAR (c); - c = *input_line_pointer++; - } - demand_empty_rest_of_line (); - } -} - -/* This table describes all the machine specific pseudo-ops the assembler - has to support. The fields are: - pseudo-op name without dot - function to call to execute this pseudo-op - Integer arg to pass to the function - */ - -const pseudo_typeS md_pseudo_table[] = { - {"int" , cons , 2}, - {"data.b" , cons , 1}, - {"data.w" , cons , 2}, - {"data.l" , cons , 4}, - {"form" , listing_psize , 0}, - {"heading", listing_title , 0}, - {"import" , s_ignore , 0}, - {"page" , listing_eject , 0}, - {"program", s_ignore , 0}, - {"z8001" , s_segm , 0}, - {"z8002" , s_unseg , 0}, - - {"segm" , s_segm , 0}, - {"unsegm" , s_unseg , 0}, - {"unseg" , s_unseg , 0}, - {"name" , s_app_file , 0}, - {"global" , s_globl , 0}, - {"wval" , cons , 2}, - {"lval" , cons , 4}, - {"bval" , cons , 1}, - {"sval" , sval , 0}, - {"rsect" , obj_coff_section, 0}, - {"sect" , obj_coff_section, 0}, - {"block" , s_space , 0}, - {"even" , even , 0}, - {0 , 0 , 0} -}; - -const char EXP_CHARS[] = "eE"; - -/* Chars that mean this number is a floating point constant. - As in 0f12.456 - or 0d1.2345e12 */ -const char FLT_CHARS[] = "rRsSfFdDxXpP"; - -/* Opcode mnemonics. */ -static struct hash_control *opcode_hash_control; - -void -md_begin () -{ - opcode_entry_type *opcode; - char *prev_name = ""; - int idx = 0; - - opcode_hash_control = hash_new (); - - for (opcode = z8k_table; opcode->name; opcode++) - { - /* Only enter unique codes into the table. */ - if (strcmp (opcode->name, prev_name)) - { - hash_insert (opcode_hash_control, opcode->name, (char *) opcode); - idx++; - } - opcode->idx = idx; - prev_name = opcode->name; - } - - /* Default to z8002. */ - s_unseg (); - - /* Insert the pseudo ops, too. */ - for (idx = 0; md_pseudo_table[idx].poc_name; idx++) - { - opcode_entry_type *fake_opcode; - fake_opcode = (opcode_entry_type *) malloc (sizeof (opcode_entry_type)); - fake_opcode->name = md_pseudo_table[idx].poc_name; - fake_opcode->func = (void *) (md_pseudo_table + idx); - fake_opcode->opcode = 250; - hash_insert (opcode_hash_control, fake_opcode->name, fake_opcode); - } - - linkrelax = 1; -} - -struct z8k_exp { - char *e_beg; - char *e_end; - expressionS e_exp; -}; - -typedef struct z8k_op { - /* 'b','w','r','q'. */ - char regsize; - - /* 0 .. 15. */ - unsigned int reg; - - int mode; - - /* Any other register associated with the mode. */ - unsigned int x_reg; - - /* Any expression. */ - expressionS exp; -} op_type; - -static expressionS *da_operand; -static expressionS *imm_operand; - -int reg[16]; -int the_cc; -int the_ctrl; -int the_flags; -int the_interrupt; - -char * -whatreg (reg, src) - int *reg; - char *src; -{ - if (isdigit (src[1])) - { - *reg = (src[0] - '0') * 10 + src[1] - '0'; - return src + 2; - } - else - { - *reg = (src[0] - '0'); - return src + 1; - } -} - -/* Parse operands - - rh0-rh7, rl0-rl7 - r0-r15 - rr0-rr14 - rq0--rq12 - WREG r0,r1,r2,r3,r4,r5,r6,r7,fp,sp - r0l,r0h,..r7l,r7h - @WREG - @WREG+ - @-WREG - #const -*/ - -/* Try to parse a reg name. Return a pointer to the first character - in SRC after the reg name. */ - -char * -parse_reg (src, mode, reg) - char *src; - int *mode; - unsigned int *reg; -{ - char *res = 0; - char regno; - - if (src[0] == 's' && src[1] == 'p') - { - if (segmented_mode) - { - *mode = CLASS_REG_LONG; - *reg = 14; - } - else - { - *mode = CLASS_REG_WORD; - *reg = 15; - } - return src + 2; - } - if (src[0] == 'r') - { - if (src[1] == 'r') - { - *mode = CLASS_REG_LONG; - res = whatreg (reg, src + 2); - regno = *reg; - if (regno > 14) - as_warn (_("register rr%d, out of range."), regno); - } - else if (src[1] == 'h') - { - *mode = CLASS_REG_BYTE; - res = whatreg (reg, src + 2); - regno = *reg; - if (regno > 7) - as_warn (_("register rh%d, out of range."), regno); - } - else if (src[1] == 'l') - { - *mode = CLASS_REG_BYTE; - res = whatreg (reg, src + 2); - regno = *reg; - if (regno > 7) - as_warn (_("register rl%d, out of range."), regno); - *reg += 8; - } - else if (src[1] == 'q') - { - *mode = CLASS_REG_QUAD; - res = whatreg (reg, src + 2); - regno = *reg; - if (regno > 12) - as_warn (_("register rq%d, out of range."), regno); - } - else - { - *mode = CLASS_REG_WORD; - res = whatreg (reg, src + 1); - regno = *reg; - if (regno > 15) - as_warn (_("register r%d, out of range."), regno); - } - } - return res; -} - -char * -parse_exp (s, op) - char *s; - expressionS *op; -{ - char *save = input_line_pointer; - char *new; - - input_line_pointer = s; - expression (op); - if (op->X_op == O_absent) - as_bad (_("missing operand")); - new = input_line_pointer; - input_line_pointer = save; - return new; -} - -/* The many forms of operand: - - <rb> - <r> - <rr> - <rq> - @r - #exp - exp - exp(r) - r(#exp) - r(r) - */ - -static char * -checkfor (ptr, what) - char *ptr; - char what; -{ - if (*ptr == what) - ptr++; - else - as_bad (_("expected %c"), what); - - return ptr; -} - -/* Make sure the mode supplied is the size of a word. */ - -static void -regword (mode, string) - int mode; - char *string; -{ - int ok; - - ok = CLASS_REG_WORD; - if (ok != mode) - { - as_bad (_("register is wrong size for a word %s"), string); - } -} - -/* Make sure the mode supplied is the size of an address. */ - -static void -regaddr (mode, string) - int mode; - char *string; -{ - int ok; - - ok = segmented_mode ? CLASS_REG_LONG : CLASS_REG_WORD; - if (ok != mode) - { - as_bad (_("register is wrong size for address %s"), string); - } -} - -struct ctrl_names { - int value; - char *name; -}; - -struct ctrl_names ctrl_table[] = { - { 0x2, "fcw" }, - { 0x3, "refresh" }, - { 0x4, "psapseg" }, - { 0x5, "psapoff" }, - { 0x5, "psap" }, - { 0x6, "nspseg" }, - { 0x7, "nspoff" }, - { 0x7, "nsp" }, - { 0 , 0 } -}; - -static void -get_ctrl_operand (ptr, mode, dst) - char **ptr; - struct z8k_op *mode; - unsigned int dst ATTRIBUTE_UNUSED; -{ - char *src = *ptr; - int i; - - while (*src == ' ') - src++; - - mode->mode = CLASS_CTRL; - for (i = 0; ctrl_table[i].name; i++) - { - int j; - - for (j = 0; ctrl_table[i].name[j]; j++) - { - if (ctrl_table[i].name[j] != src[j]) - goto fail; - } - the_ctrl = ctrl_table[i].value; - *ptr = src + j; - return; - fail: - ; - } - the_ctrl = 0; - return; -} - -struct flag_names { - int value; - char *name; - -}; - -struct flag_names flag_table[] = { - { 0x1, "p" }, - { 0x1, "v" }, - { 0x2, "s" }, - { 0x4, "z" }, - { 0x8, "c" }, - { 0x0, "+" }, - { 0, 0 } -}; - -static void -get_flags_operand (ptr, mode, dst) - char **ptr; - struct z8k_op *mode; - unsigned int dst ATTRIBUTE_UNUSED; -{ - char *src = *ptr; - int i; - int j; - - while (*src == ' ') - src++; - - mode->mode = CLASS_FLAGS; - the_flags = 0; - for (j = 0; j <= 9; j++) - { - if (!src[j]) - goto done; - for (i = 0; flag_table[i].name; i++) - { - if (flag_table[i].name[0] == src[j]) - { - the_flags = the_flags | flag_table[i].value; - goto match; - } - } - goto done; - match: - ; - } - done: - *ptr = src + j; - return; -} - -struct interrupt_names { - int value; - char *name; - -}; - -struct interrupt_names intr_table[] = { - { 0x1, "nvi" }, - { 0x2, "vi" }, - { 0x3, "both" }, - { 0x3, "all" }, - { 0, 0 } -}; - -static void -get_interrupt_operand (ptr, mode, dst) - char **ptr; - struct z8k_op *mode; - unsigned int dst ATTRIBUTE_UNUSED; -{ - char *src = *ptr; - int i; - - while (*src == ' ') - src++; - - mode->mode = CLASS_IMM; - for (i = 0; intr_table[i].name; i++) - { - int j; - - for (j = 0; intr_table[i].name[j]; j++) - { - if (intr_table[i].name[j] != src[j]) - goto fail; - } - the_interrupt = intr_table[i].value; - *ptr = src + j; - return; - fail: - ; - } - the_interrupt = 0x0; - return; -} - -struct cc_names { - int value; - char *name; - -}; - -struct cc_names table[] = { - { 0x0, "f" }, - { 0x1, "lt" }, - { 0x2, "le" }, - { 0x3, "ule" }, - { 0x4, "ov" }, - { 0x4, "pe" }, - { 0x5, "mi" }, - { 0x6, "eq" }, - { 0x6, "z" }, - { 0x7, "c" }, - { 0x7, "ult" }, - { 0x8, "t" }, - { 0x9, "ge" }, - { 0xa, "gt" }, - { 0xb, "ugt" }, - { 0xc, "nov" }, - { 0xc, "po" }, - { 0xd, "pl" }, - { 0xe, "ne" }, - { 0xe, "nz" }, - { 0xf, "nc" }, - { 0xf, "uge" }, - { 0 , 0 } -}; - -static void -get_cc_operand (ptr, mode, dst) - char **ptr; - struct z8k_op *mode; - unsigned int dst ATTRIBUTE_UNUSED; -{ - char *src = *ptr; - int i; - - while (*src == ' ') - src++; - - mode->mode = CLASS_CC; - for (i = 0; table[i].name; i++) - { - int j; - - for (j = 0; table[i].name[j]; j++) - { - if (table[i].name[j] != src[j]) - goto fail; - } - the_cc = table[i].value; - *ptr = src + j; - return; - fail: - ; - } - the_cc = 0x8; -} - -static void -get_operand (ptr, mode, dst) - char **ptr; - struct z8k_op *mode; - unsigned int dst ATTRIBUTE_UNUSED; -{ - char *src = *ptr; - char *end; - - mode->mode = 0; - - while (*src == ' ') - src++; - if (*src == '#') - { - mode->mode = CLASS_IMM; - imm_operand = &(mode->exp); - src = parse_exp (src + 1, &(mode->exp)); - } - else if (*src == '@') - { - int d; - - mode->mode = CLASS_IR; - src = parse_reg (src + 1, &d, &mode->reg); - } - else - { - int regn; - - end = parse_reg (src, &mode->mode, ®n); - - if (end) - { - int nw, nr; - - src = end; - if (*src == '(') - { - src++; - end = parse_reg (src, &nw, &nr); - if (end) - { - /* Got Ra(Rb). */ - src = end; - - if (*src != ')') - as_bad (_("Missing ) in ra(rb)")); - else - src++; - - regaddr (mode->mode, "ra(rb) ra"); -#if 0 - regword (mode->mode, "ra(rb) rb"); -#endif - mode->mode = CLASS_BX; - mode->reg = regn; - mode->x_reg = nr; - reg[ARG_RX] = nr; - } - else - { - /* Got Ra(disp). */ - if (*src == '#') - src++; - src = parse_exp (src, &(mode->exp)); - src = checkfor (src, ')'); - mode->mode = CLASS_BA; - mode->reg = regn; - mode->x_reg = 0; - imm_operand = &(mode->exp); - } - } - else - { - mode->reg = regn; - mode->x_reg = 0; - } - } - else - { - /* No initial reg. */ - src = parse_exp (src, &(mode->exp)); - if (*src == '(') - { - src++; - end = parse_reg (src, &(mode->mode), ®n); - regword (mode->mode, "addr(Ra) ra"); - mode->mode = CLASS_X; - mode->reg = regn; - mode->x_reg = 0; - da_operand = &(mode->exp); - src = checkfor (end, ')'); - } - else - { - /* Just an address. */ - mode->mode = CLASS_DA; - mode->reg = 0; - mode->x_reg = 0; - da_operand = &(mode->exp); - } - } - } - *ptr = src; -} - -static char * -get_operands (opcode, op_end, operand) - opcode_entry_type *opcode; - char *op_end; - op_type *operand; -{ - char *ptr = op_end; - char *savptr; - - switch (opcode->noperands) - { - case 0: - operand[0].mode = 0; - operand[1].mode = 0; - break; - - case 1: - ptr++; - if (opcode->arg_info[0] == CLASS_CC) - { - get_cc_operand (&ptr, operand + 0, 0); - } - else if (opcode->arg_info[0] == CLASS_FLAGS) - { - get_flags_operand (&ptr, operand + 0, 0); - } - else if (opcode->arg_info[0] == (CLASS_IMM + (ARG_IMM2))) - { - get_interrupt_operand (&ptr, operand + 0, 0); - } - else - { - get_operand (&ptr, operand + 0, 0); - } - operand[1].mode = 0; - break; - - case 2: - ptr++; - savptr = ptr; - if (opcode->arg_info[0] == CLASS_CC) - { - get_cc_operand (&ptr, operand + 0, 0); - } - else if (opcode->arg_info[0] == CLASS_CTRL) - { - get_ctrl_operand (&ptr, operand + 0, 0); - if (the_ctrl == 0) - { - ptr = savptr; - get_operand (&ptr, operand + 0, 0); - if (ptr == 0) - return NULL; - if (*ptr == ',') - ptr++; - get_ctrl_operand (&ptr, operand + 1, 1); - return ptr; - } - } - else - { - get_operand (&ptr, operand + 0, 0); - } - if (ptr == 0) - return NULL; - if (*ptr == ',') - ptr++; - get_operand (&ptr, operand + 1, 1); - break; - - case 3: - ptr++; - get_operand (&ptr, operand + 0, 0); - if (*ptr == ',') - ptr++; - get_operand (&ptr, operand + 1, 1); - if (*ptr == ',') - ptr++; - get_operand (&ptr, operand + 2, 2); - break; - - case 4: - ptr++; - get_operand (&ptr, operand + 0, 0); - if (*ptr == ',') - ptr++; - get_operand (&ptr, operand + 1, 1); - if (*ptr == ',') - ptr++; - get_operand (&ptr, operand + 2, 2); - if (*ptr == ',') - ptr++; - get_cc_operand (&ptr, operand + 3, 3); - break; - - default: - abort (); - } - - return ptr; -} - -/* Passed a pointer to a list of opcodes which use different - addressing modes. Return the opcode which matches the opcodes - provided. */ - -static opcode_entry_type * -get_specific (opcode, operands) - opcode_entry_type *opcode; - op_type *operands; - -{ - opcode_entry_type *this_try = opcode; - int found = 0; - unsigned int noperands = opcode->noperands; - - int this_index = opcode->idx; - - while (this_index == opcode->idx && !found) - { - unsigned int i; - - this_try = opcode++; - for (i = 0; i < noperands; i++) - { - unsigned int mode = operands[i].mode; - - if ((mode & CLASS_MASK) != (this_try->arg_info[i] & CLASS_MASK)) - { - /* It could be an pc rel operand, if this is a da mode - and we like disps, then insert it. */ - - if (mode == CLASS_DA && this_try->arg_info[i] == CLASS_DISP) - { - /* This is the case. */ - operands[i].mode = CLASS_DISP; - } - else if (mode == CLASS_BA && this_try->arg_info[i]) - { - /* Can't think of a way to turn what we've been - given into something that's OK. */ - goto fail; - } - else if (this_try->arg_info[i] & CLASS_PR) - { - if (mode == CLASS_REG_LONG && segmented_mode) - { - /* OK. */ - } - else if (mode == CLASS_REG_WORD && !segmented_mode) - { - /* OK. */ - } - else - goto fail; - } - else - goto fail; - } - switch (mode & CLASS_MASK) - { - default: - break; - case CLASS_X: - case CLASS_IR: - case CLASS_BA: - case CLASS_BX: - case CLASS_DISP: - case CLASS_REG: - case CLASS_REG_WORD: - case CLASS_REG_BYTE: - case CLASS_REG_QUAD: - case CLASS_REG_LONG: - case CLASS_REGN0: - reg[this_try->arg_info[i] & ARG_MASK] = operands[i].reg; - break; - } - } - - found = 1; - fail: - ; - } - if (found) - return this_try; - else - return 0; -} - -#if 0 /* Not used. */ -static void -check_operand (operand, width, string) - struct z8k_op *operand; - unsigned int width; - char *string; -{ - if (operand->exp.X_add_symbol == 0 - && operand->exp.X_op_symbol == 0) - { - - /* No symbol involved, let's look at offset, it's dangerous if - any of the high bits are not 0 or ff's, find out by oring or - anding with the width and seeing if the answer is 0 or all - fs. */ - if ((operand->exp.X_add_number & ~width) != 0 && - (operand->exp.X_add_number | width) != (~0)) - { - as_warn (_("operand %s0x%x out of range."), - string, operand->exp.X_add_number); - } - } - -} -#endif - -static char buffer[20]; - -static void -newfix (ptr, type, operand) - int ptr; - int type; - expressionS *operand; -{ - if (operand->X_add_symbol - || operand->X_op_symbol - || operand->X_add_number) - { - fix_new_exp (frag_now, - ptr, - 1, - operand, - 0, - type); - } -} - -static char * -apply_fix (ptr, type, operand, size) - char *ptr; - int type; - expressionS *operand; - int size; -{ - int n = operand->X_add_number; - - newfix ((ptr - buffer) / 2, type, operand); - switch (size) - { - case 8: /* 8 nibbles == 32 bits. */ - *ptr++ = n >> 28; - *ptr++ = n >> 24; - *ptr++ = n >> 20; - *ptr++ = n >> 16; - case 4: /* 4 nibbles == 16 bits. */ - *ptr++ = n >> 12; - *ptr++ = n >> 8; - case 2: - *ptr++ = n >> 4; - case 1: - *ptr++ = n >> 0; - break; - } - return ptr; -} - -/* Now we know what sort of opcodes it is. Let's build the bytes. */ - -#define INSERT(x,y) *x++ = y>>24; *x++ = y>> 16; *x++=y>>8; *x++ =y; - -static void -build_bytes (this_try, operand) - opcode_entry_type *this_try; - struct z8k_op *operand ATTRIBUTE_UNUSED; -{ - char *output_ptr = buffer; - int c; - int nib; - int nibble; - unsigned int *class_ptr; - - frag_wane (frag_now); - frag_new (0); - - memset (buffer, 20, 0); - class_ptr = this_try->byte_info; - - for (nibble = 0; (c = *class_ptr++); nibble++) - { - - switch (c & CLASS_MASK) - { - default: - abort (); - - case CLASS_ADDRESS: - /* Direct address, we don't cope with the SS mode right now. */ - if (segmented_mode) - { - /* da_operand->X_add_number |= 0x80000000; -- Now set at relocation time. */ - output_ptr = apply_fix (output_ptr, R_IMM32, da_operand, 8); - } - else - { - output_ptr = apply_fix (output_ptr, R_IMM16, da_operand, 4); - } - da_operand = 0; - break; - case CLASS_DISP8: - /* pc rel 8 bit */ - output_ptr = apply_fix (output_ptr, R_JR, da_operand, 2); - da_operand = 0; - break; - - case CLASS_0DISP7: - /* pc rel 7 bit */ - *output_ptr = 0; - output_ptr = apply_fix (output_ptr, R_DISP7, da_operand, 2); - da_operand = 0; - break; - - case CLASS_1DISP7: - /* pc rel 7 bit */ - *output_ptr = 0x80; - output_ptr = apply_fix (output_ptr, R_DISP7, da_operand, 2); - output_ptr[-2] = 0x8; - da_operand = 0; - break; - - case CLASS_BIT_1OR2: - *output_ptr = c & 0xf; - if (imm_operand) - { - if (imm_operand->X_add_number == 2) - *output_ptr |= 2; - else if (imm_operand->X_add_number != 1) - as_bad (_("immediate must be 1 or 2")); - } - else - as_bad (_("immediate 1 or 2 expected")); - output_ptr++; - break; - case CLASS_CC: - *output_ptr++ = the_cc; - break; - case CLASS_0CCC: - *output_ptr++ = the_ctrl; - break; - case CLASS_1CCC: - *output_ptr++ = the_ctrl | 0x8; - break; - case CLASS_00II: - *output_ptr++ = (~the_interrupt & 0x3); - break; - case CLASS_01II: - *output_ptr++ = (~the_interrupt & 0x3) | 0x4; - break; - case CLASS_FLAGS: - *output_ptr++ = the_flags; - break; - case CLASS_BIT: - *output_ptr++ = c & 0xf; - break; - case CLASS_REGN0: - if (reg[c & 0xf] == 0) - as_bad (_("can't use R0 here")); - /* Fall through. */ - case CLASS_REG: - case CLASS_REG_BYTE: - case CLASS_REG_WORD: - case CLASS_REG_LONG: - case CLASS_REG_QUAD: - /* Insert bit mattern of right reg. */ - *output_ptr++ = reg[c & 0xf]; - break; - case CLASS_DISP: - switch (c & ARG_MASK) - { - case ARG_DISP12: - output_ptr = apply_fix (output_ptr, R_CALLR, da_operand, 4); - break; - case ARG_DISP16: - output_ptr = apply_fix (output_ptr, R_REL16, da_operand, 4); - break; - default: - output_ptr = apply_fix (output_ptr, R_IMM16, da_operand, 4); - } - da_operand = 0; - break; - - case CLASS_IMM: - { - nib = 0; - switch (c & ARG_MASK) - { - case ARG_IMM4: - output_ptr = apply_fix (output_ptr, R_IMM4L, imm_operand, 1); - break; - case ARG_IMM4M1: - imm_operand->X_add_number--; - output_ptr = apply_fix (output_ptr, R_IMM4L, imm_operand, 1); - break; - case ARG_IMMNMINUS1: - imm_operand->X_add_number--; - output_ptr = apply_fix (output_ptr, R_IMM4L, imm_operand, 1); - break; - case ARG_NIM8: - imm_operand->X_add_number = -imm_operand->X_add_number; - case ARG_IMM8: - output_ptr = apply_fix (output_ptr, R_IMM8, imm_operand, 2); - break; - case ARG_IMM16: - output_ptr = apply_fix (output_ptr, R_IMM16, imm_operand, 4); - break; - - case ARG_IMM32: - output_ptr = apply_fix (output_ptr, R_IMM32, imm_operand, 8); - break; - - default: - abort (); - } - } - } - } - - /* Copy from the nibble buffer into the frag. */ - { - int length = (output_ptr - buffer) / 2; - char *src = buffer; - char *fragp = frag_more (length); - - while (src < output_ptr) - { - *fragp = (src[0] << 4) | src[1]; - src += 2; - fragp++; - } - } -} - -/* This is the guts of the machine-dependent assembler. STR points to a - machine dependent instruction. This function is supposed to emit - the frags/bytes it assembles to. */ - -void -md_assemble (str) - char *str; -{ - char c; - char *op_start; - char *op_end; - struct z8k_op operand[3]; - opcode_entry_type *opcode; - opcode_entry_type *prev_opcode; - - /* Drop leading whitespace. */ - while (*str == ' ') - str++; - - /* Find the op code end. */ - for (op_start = op_end = str; - *op_end != 0 && *op_end != ' '; - op_end++) - ; - - if (op_end == op_start) - { - as_bad (_("can't find opcode ")); - } - c = *op_end; - - *op_end = 0; - - opcode = (opcode_entry_type *) hash_find (opcode_hash_control, op_start); - - if (opcode == NULL) - { - as_bad (_("unknown opcode")); - return; - } - - if (opcode->opcode == 250) - { - /* Was really a pseudo op. */ - - pseudo_typeS *p; - char oc; - - char *old = input_line_pointer; - *op_end = c; - - input_line_pointer = op_end; - - oc = *old; - *old = '\n'; - while (*input_line_pointer == ' ') - input_line_pointer++; - p = (pseudo_typeS *) (opcode->func); - - (p->poc_handler) (p->poc_val); - input_line_pointer = old; - *old = oc; - } - else - { - input_line_pointer = get_operands (opcode, op_end, operand); - prev_opcode = opcode; - - opcode = get_specific (opcode, operand); - - if (opcode == 0) - { - /* Couldn't find an opcode which matched the operands. */ - char *where = frag_more (2); - - where[0] = 0x0; - where[1] = 0x0; - - as_bad (_("Can't find opcode to match operands")); - return; - } - - build_bytes (opcode, operand); - } -} - -void -tc_crawl_symbol_chain (headers) - object_headers *headers ATTRIBUTE_UNUSED; -{ - printf (_("call to tc_crawl_symbol_chain \n")); -} - -symbolS * -md_undefined_symbol (name) - char *name ATTRIBUTE_UNUSED; -{ - return 0; -} - -void -tc_headers_hook (headers) - object_headers *headers ATTRIBUTE_UNUSED; -{ - printf (_("call to tc_headers_hook \n")); -} - -/* Various routines to kill one day. */ -/* Equal to MAX_PRECISION in atof-ieee.c. */ -#define MAX_LITTLENUMS 6 - -/* Turn a string in input_line_pointer into a floating point constant - of type TYPE, and store the appropriate bytes in *LITP. The number - of LITTLENUMS emitted is stored in *SIZEP. An error message is - returned, or NULL on OK. */ - -char * -md_atof (type, litP, sizeP) - char type; - char *litP; - int *sizeP; -{ - int prec; - LITTLENUM_TYPE words[MAX_LITTLENUMS]; - LITTLENUM_TYPE *wordP; - char *t; - char *atof_ieee (); - - switch (type) - { - case 'f': - case 'F': - case 's': - case 'S': - prec = 2; - break; - - case 'd': - case 'D': - case 'r': - case 'R': - prec = 4; - break; - - case 'x': - case 'X': - prec = 6; - break; - - case 'p': - case 'P': - prec = 6; - break; - - default: - *sizeP = 0; - return _("Bad call to MD_ATOF()"); - } - t = atof_ieee (input_line_pointer, type, words); - if (t) - input_line_pointer = t; - - *sizeP = prec * sizeof (LITTLENUM_TYPE); - for (wordP = words; prec--;) - { - md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE)); - litP += sizeof (LITTLENUM_TYPE); - } - return 0; -} - -CONST char *md_shortopts = "z:"; - -struct option md_longopts[] = { - {NULL, no_argument, NULL, 0} -}; - -size_t md_longopts_size = sizeof (md_longopts); - -int -md_parse_option (c, arg) - int c; - char *arg; -{ - switch (c) - { - case 'z': - if (!strcmp (arg, "8001")) - s_segm (); - else if (!strcmp (arg, "8002")) - s_unseg (); - else - { - as_bad (_("invalid architecture -z%s"), arg); - return 0; - } - break; - - default: - return 0; - } - - return 1; -} - -void -md_show_usage (stream) - FILE *stream; -{ - fprintf (stream, _("\ -Z8K options:\n\ --z8001 generate segmented code\n\ --z8002 generate unsegmented code\n")); -} - -void -tc_aout_fix_to_chars () -{ - printf (_("call to tc_aout_fix_to_chars \n")); - abort (); -} - -void -md_convert_frag (headers, seg, fragP) - object_headers *headers ATTRIBUTE_UNUSED; - segT seg ATTRIBUTE_UNUSED; - fragS *fragP ATTRIBUTE_UNUSED; -{ - printf (_("call to md_convert_frag \n")); - abort (); -} - -valueT -md_section_align (seg, size) - segT seg; - valueT size; -{ - return ((size + (1 << section_alignment[(int) seg]) - 1) - & (-1 << section_alignment[(int) seg])); - -} - -void -md_apply_fix (fixP, val) - fixS *fixP; - long val; -{ - char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; - - switch (fixP->fx_r_type) - { - case R_IMM4L: - buf[0] = (buf[0] & 0xf0) | ((buf[0] + val) & 0xf); - break; - - case R_JR: - - *buf++ = val; -#if 0 - if (val != 0) - abort (); -#endif - break; - - case R_DISP7: - - *buf++ += val; -#if 0 - if (val != 0) - abort (); -#endif - break; - - case R_IMM8: - buf[0] += val; - break; - case R_IMM16: - *buf++ = (val >> 8); - *buf++ = val; - break; - case R_IMM32: - *buf++ = (val >> 24); - *buf++ = (val >> 16); - *buf++ = (val >> 8); - *buf++ = val; - break; -#if 0 - case R_DA | R_SEG: - *buf++ = (val >> 16); - *buf++ = 0x00; - *buf++ = (val >> 8); - *buf++ = val; - break; -#endif - - case 0: - md_number_to_chars (buf, val, fixP->fx_size); - break; - - default: - abort (); - } -} - -int -md_estimate_size_before_relax (fragP, segment_type) - register fragS *fragP ATTRIBUTE_UNUSED; - register segT segment_type ATTRIBUTE_UNUSED; -{ - printf (_("call tomd_estimate_size_before_relax \n")); - abort (); -} - -/* Put number into target byte order. */ - -void -md_number_to_chars (ptr, use, nbytes) - char *ptr; - valueT use; - int nbytes; -{ - number_to_chars_bigendian (ptr, use, nbytes); -} - -long -md_pcrel_from (fixP) - fixS *fixP ATTRIBUTE_UNUSED; -{ - abort (); -} - -void -tc_coff_symbol_emit_hook (s) - symbolS *s ATTRIBUTE_UNUSED; -{ -} - -void -tc_reloc_mangle (fix_ptr, intr, base) - fixS *fix_ptr; - struct internal_reloc *intr; - bfd_vma base; - -{ - symbolS *symbol_ptr; - - if (fix_ptr->fx_addsy - && fix_ptr->fx_subsy) - { - symbolS *add = fix_ptr->fx_addsy; - symbolS *sub = fix_ptr->fx_subsy; - - if (S_GET_SEGMENT (add) != S_GET_SEGMENT (sub)) - as_bad (_("Can't subtract symbols in different sections %s %s"), - S_GET_NAME (add), S_GET_NAME (sub)); - else - { - int diff = S_GET_VALUE (add) - S_GET_VALUE (sub); - - fix_ptr->fx_addsy = 0; - fix_ptr->fx_subsy = 0; - fix_ptr->fx_offset += diff; - } - } - symbol_ptr = fix_ptr->fx_addsy; - - /* If this relocation is attached to a symbol then it's ok - to output it. */ - if (fix_ptr->fx_r_type == 0) - { - /* cons likes to create reloc32's whatever the size of the reloc. */ - switch (fix_ptr->fx_size) - { - case 2: - intr->r_type = R_IMM16; - break; - case 1: - intr->r_type = R_IMM8; - break; - case 4: - intr->r_type = R_IMM32; - break; - default: - abort (); - } - } - else - intr->r_type = fix_ptr->fx_r_type; - - intr->r_vaddr = fix_ptr->fx_frag->fr_address + fix_ptr->fx_where + base; - intr->r_offset = fix_ptr->fx_offset; - - if (symbol_ptr) - intr->r_symndx = symbol_ptr->sy_number; - else - intr->r_symndx = -1; -} diff --git a/contrib/binutils/gas/config/tc-z8k.h b/contrib/binutils/gas/config/tc-z8k.h deleted file mode 100644 index d1899e1564fd..000000000000 --- a/contrib/binutils/gas/config/tc-z8k.h +++ /dev/null @@ -1,53 +0,0 @@ -/* This file is tc-z8k.h - Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1997, 1998, - 2000 - Free Software Foundation, Inc. - - This file is part of GAS, the GNU Assembler. - - GAS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GAS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#define TC_Z8K -#define TARGET_BYTES_BIG_ENDIAN 1 - -#if ANSI_PROTOTYPES -struct internal_reloc; -#endif - -#define WORKING_DOT_WORD - -#ifndef BFD_ASSEMBLER -#define LOCAL_LABEL(x) 0 -#endif - -/* This macro translates between an internal fix and an coff reloc type */ -#define TC_COFF_FIX2RTYPE(fixP) abort (); - -#define BFD_ARCH bfd_arch_z8k -#define COFF_MAGIC 0x8000 -#define TC_COUNT_RELOC(x) (1) -#define IGNORE_NONSTANDARD_ESCAPES - -#define TC_RELOC_MANGLE(s,a,b,c) tc_reloc_mangle(a,b,c) -extern void tc_reloc_mangle - PARAMS ((struct fix *, struct internal_reloc *, bfd_vma)); - -#define DO_NOT_STRIP 0 -#define LISTING_HEADER "Zilog Z8000 GAS " -#define NEED_FX_R_TYPE 1 -#define RELOC_32 1234 - -#define md_operand(x) diff --git a/contrib/binutils/gas/config/te-multi.h b/contrib/binutils/gas/config/te-multi.h deleted file mode 100644 index b8eda4505fb7..000000000000 --- a/contrib/binutils/gas/config/te-multi.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is te-generic.h and is intended to be a template for - * target environment specific header files. - * - * It is my intent that this file will evolve into a file suitable for config, - * compile, and copying as an aid for testing and porting. xoxorich. - */ - -/* Added these, because if we don't know what we're targetting we may - need an assembler version of libgcc, and that will use local - labels. */ -#define LOCAL_LABELS_DOLLAR 1 -#define LOCAL_LABELS_FB 1 - -/* these define interfaces */ -#ifdef OBJ_HEADER -#include OBJ_HEADER -#else -#include "obj-format.h" -#endif - -/* end of te-generic.h */ diff --git a/contrib/binutils/gas/doc/c-sh.texi b/contrib/binutils/gas/doc/c-sh.texi deleted file mode 100644 index e20f55437883..000000000000 --- a/contrib/binutils/gas/doc/c-sh.texi +++ /dev/null @@ -1,272 +0,0 @@ -@c Copyright (C) 1991, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. -@c This is part of the GAS manual. -@c For copying conditions, see the file as.texinfo. -@page -@node SH-Dependent -@chapter Hitachi SH Dependent Features - -@cindex SH support -@menu -* SH Options:: Options -* SH Syntax:: Syntax -* SH Floating Point:: Floating Point -* SH Directives:: SH Machine Directives -* SH Opcodes:: Opcodes -@end menu - -@node SH Options -@section Options - -@cindex SH options (none) -@cindex options, SH (none) -@code{@value{AS}} has no additional command-line options for the Hitachi -SH family. - -@node SH Syntax -@section Syntax - -@menu -* SH-Chars:: Special Characters -* SH-Regs:: Register Names -* SH-Addressing:: Addressing Modes -@end menu - -@node SH-Chars -@subsection Special Characters - -@cindex line comment character, SH -@cindex SH line comment character -@samp{!} is the line comment character. - -@cindex line separator, SH -@cindex statement separator, SH -@cindex SH line separator -You can use @samp{;} instead of a newline to separate statements. - -@cindex symbol names, @samp{$} in -@cindex @code{$} in symbol names -Since @samp{$} has no special meaning, you may use it in symbol names. - -@node SH-Regs -@subsection Register Names - -@cindex SH registers -@cindex registers, SH -You can use the predefined symbols @samp{r0}, @samp{r1}, @samp{r2}, -@samp{r3}, @samp{r4}, @samp{r5}, @samp{r6}, @samp{r7}, @samp{r8}, -@samp{r9}, @samp{r10}, @samp{r11}, @samp{r12}, @samp{r13}, @samp{r14}, -and @samp{r15} to refer to the SH registers. - -The SH also has these control registers: - -@table @code -@item pr -procedure register (holds return address) - -@item pc -program counter - -@item mach -@itemx macl -high and low multiply accumulator registers - -@item sr -status register - -@item gbr -global base register - -@item vbr -vector base register (for interrupt vectors) -@end table - -@node SH-Addressing -@subsection Addressing Modes - -@cindex addressing modes, SH -@cindex SH addressing modes -@code{@value{AS}} understands the following addressing modes for the SH. -@code{R@var{n}} in the following refers to any of the numbered -registers, but @emph{not} the control registers. - -@table @code -@item R@var{n} -Register direct - -@item @@R@var{n} -Register indirect - -@item @@-R@var{n} -Register indirect with pre-decrement - -@item @@R@var{n}+ -Register indirect with post-increment - -@item @@(@var{disp}, R@var{n}) -Register indirect with displacement - -@item @@(R0, R@var{n}) -Register indexed - -@item @@(@var{disp}, GBR) -@code{GBR} offset - -@item @@(R0, GBR) -GBR indexed - -@item @var{addr} -@itemx @@(@var{disp}, PC) -PC relative address (for branch or for addressing memory). The -@code{@value{AS}} implementation allows you to use the simpler form -@var{addr} anywhere a PC relative address is called for; the alternate -form is supported for compatibility with other assemblers. - -@item #@var{imm} -Immediate data -@end table - -@node SH Floating Point -@section Floating Point - -@cindex floating point, SH (@sc{ieee}) -@cindex SH floating point (@sc{ieee}) -The SH family has no hardware floating point, but the @code{.float} -directive generates @sc{ieee} floating-point numbers for compatibility -with other development tools. - -@node SH Directives -@section SH Machine Directives - -@cindex SH machine directives -@cindex machine directives, SH -@cindex @code{uaword} directive, SH -@cindex @code{ualong} directive, SH - -@table @code -@item uaword -@itemx ualong -@code{@value{AS}} will issue a warning when a misaligned @code{.word} or -@code{.long} directive is used. You may use @code{.uaword} or -@code{.ualong} to indicate that the value is intentionally misaligned. -@end table - -@node SH Opcodes -@section Opcodes - -@cindex SH opcode summary -@cindex opcode summary, SH -@cindex mnemonics, SH -@cindex instruction summary, SH -For detailed information on the SH machine instruction set, see -@cite{SH-Microcomputer User's Manual} (Hitachi Micro Systems, Inc.). - -@code{@value{AS}} implements all the standard SH opcodes. No additional -pseudo-instructions are needed on this family. Note, however, that -because @code{@value{AS}} supports a simpler form of PC-relative -addressing, you may simply write (for example) - -@example -mov.l bar,r0 -@end example - -@noindent -where other assemblers might require an explicit displacement to -@code{bar} from the program counter: - -@example -mov.l @@(@var{disp}, PC) -@end example - -@ifset SMALL -@c this table, due to the multi-col faking and hardcoded order, looks silly -@c except in smallbook. See comments below "@set SMALL" near top of this file. - -Here is a summary of SH opcodes: - -@page -@smallexample -@i{Legend:} -Rn @r{a numbered register} -Rm @r{another numbered register} -#imm @r{immediate data} -disp @r{displacement} -disp8 @r{8-bit displacement} -disp12 @r{12-bit displacement} - -add #imm,Rn lds.l @@Rn+,PR -add Rm,Rn mac.w @@Rm+,@@Rn+ -addc Rm,Rn mov #imm,Rn -addv Rm,Rn mov Rm,Rn -and #imm,R0 mov.b Rm,@@(R0,Rn) -and Rm,Rn mov.b Rm,@@-Rn -and.b #imm,@@(R0,GBR) mov.b Rm,@@Rn -bf disp8 mov.b @@(disp,Rm),R0 -bra disp12 mov.b @@(disp,GBR),R0 -bsr disp12 mov.b @@(R0,Rm),Rn -bt disp8 mov.b @@Rm+,Rn -clrmac mov.b @@Rm,Rn -clrt mov.b R0,@@(disp,Rm) -cmp/eq #imm,R0 mov.b R0,@@(disp,GBR) -cmp/eq Rm,Rn mov.l Rm,@@(disp,Rn) -cmp/ge Rm,Rn mov.l Rm,@@(R0,Rn) -cmp/gt Rm,Rn mov.l Rm,@@-Rn -cmp/hi Rm,Rn mov.l Rm,@@Rn -cmp/hs Rm,Rn mov.l @@(disp,Rn),Rm -cmp/pl Rn mov.l @@(disp,GBR),R0 -cmp/pz Rn mov.l @@(disp,PC),Rn -cmp/str Rm,Rn mov.l @@(R0,Rm),Rn -div0s Rm,Rn mov.l @@Rm+,Rn -div0u mov.l @@Rm,Rn -div1 Rm,Rn mov.l R0,@@(disp,GBR) -exts.b Rm,Rn mov.w Rm,@@(R0,Rn) -exts.w Rm,Rn mov.w Rm,@@-Rn -extu.b Rm,Rn mov.w Rm,@@Rn -extu.w Rm,Rn mov.w @@(disp,Rm),R0 -jmp @@Rn mov.w @@(disp,GBR),R0 -jsr @@Rn mov.w @@(disp,PC),Rn -ldc Rn,GBR mov.w @@(R0,Rm),Rn -ldc Rn,SR mov.w @@Rm+,Rn -ldc Rn,VBR mov.w @@Rm,Rn -ldc.l @@Rn+,GBR mov.w R0,@@(disp,Rm) -ldc.l @@Rn+,SR mov.w R0,@@(disp,GBR) -ldc.l @@Rn+,VBR mova @@(disp,PC),R0 -lds Rn,MACH movt Rn -lds Rn,MACL muls Rm,Rn -lds Rn,PR mulu Rm,Rn -lds.l @@Rn+,MACH neg Rm,Rn -lds.l @@Rn+,MACL negc Rm,Rn -@page -nop stc VBR,Rn -not Rm,Rn stc.l GBR,@@-Rn -or #imm,R0 stc.l SR,@@-Rn -or Rm,Rn stc.l VBR,@@-Rn -or.b #imm,@@(R0,GBR) sts MACH,Rn -rotcl Rn sts MACL,Rn -rotcr Rn sts PR,Rn -rotl Rn sts.l MACH,@@-Rn -rotr Rn sts.l MACL,@@-Rn -rte sts.l PR,@@-Rn -rts sub Rm,Rn -sett subc Rm,Rn -shal Rn subv Rm,Rn -shar Rn swap.b Rm,Rn -shll Rn swap.w Rm,Rn -shll16 Rn tas.b @@Rn -shll2 Rn trapa #imm -shll8 Rn tst #imm,R0 -shlr Rn tst Rm,Rn -shlr16 Rn tst.b #imm,@@(R0,GBR) -shlr2 Rn xor #imm,R0 -shlr8 Rn xor Rm,Rn -sleep xor.b #imm,@@(R0,GBR) -stc GBR,Rn xtrct Rm,Rn -stc SR,Rn -@end smallexample -@end ifset - -@ifset Hitachi-all -@ifclear GENERIC -@raisesections -@end ifclear -@end ifset - diff --git a/contrib/binutils/gas/doc/c-v850.texi b/contrib/binutils/gas/doc/c-v850.texi deleted file mode 100644 index 4b36461ee52b..000000000000 --- a/contrib/binutils/gas/doc/c-v850.texi +++ /dev/null @@ -1,363 +0,0 @@ -@c Copyright 1997 Free Software Foundation, Inc. -@c This is part of the GAS manual. -@c For copying conditions, see the file as.texinfo. - -@node V850-Dependent -@chapter v850 Dependent Features - -@cindex V850 support -@menu -* V850 Options:: Options -* V850 Syntax:: Syntax -* V850 Floating Point:: Floating Point -* V850 Directives:: V850 Machine Directives -* V850 Opcodes:: Opcodes -@end menu - -@node V850 Options -@section Options -@cindex V850 options (none) -@cindex options for V850 (none) -@code{@value{AS}} supports the following additional command-line options -for the V850 processor family: - -@cindex command line options, V850 -@cindex V850 command line options -@table @code - -@cindex @code{-wsigned_overflow} command line option, V850 -@item -wsigned_overflow -Causes warnings to be produced when signed immediate values overflow the -space available for then within their opcodes. By default this option -is disabled as it is possible to receive spurious warnings due to using -exact bit patterns as immediate constants. - -@cindex @code{-wunsigned_overflow} command line option, V850 -@item -wunsigned_overflow -Causes warnings to be produced when unsigned immediate values overflow -the space available for then within their opcodes. By default this -option is disabled as it is possible to receive spurious warnings due to -using exact bit patterns as immediate constants. - -@cindex @code{-mv850} command line option, V850 -@item -mv850 -Specifies that the assembled code should be marked as being targeted at -the V850 processor. This allows the linker to detect attempts to link -such code with code assembled for other processors. - -@cindex @code{-mv850e} command line option, V850 -@item -mv850e -Specifies that the assembled code should be marked as being targeted at -the V850E processor. This allows the linker to detect attempts to link -such code with code assembled for other processors. - -@cindex @code{-mv850any} command line option, V850 -@item -mv850any -Specifies that the assembled code should be marked as being targeted at -the V850 processor but support instructions that are specific to the -extended variants of the process. This allows the production of -binaries that contain target specific code, but which are also intended -to be used in a generic fashion. For example libgcc.a contains generic -routines used by the code produced by GCC for all versions of the v850 -architecture, together with support routines only used by the V850E -architecture. - -@end table - - -@node V850 Syntax -@section Syntax -@menu -* V850-Chars:: Special Characters -* V850-Regs:: Register Names -@end menu - -@node V850-Chars -@subsection Special Characters - -@cindex line comment character, V850 -@cindex V850 line comment character -@samp{#} is the line comment character. -@node V850-Regs -@subsection Register Names - -@cindex V850 register names -@cindex register names, V850 -@code{@value{AS}} supports the following names for registers: -@table @code -@cindex @code{zero} register, V850 -@item general register 0 -r0, zero -@item general register 1 -r1 -@item general register 2 -r2, hp -@cindex @code{sp} register, V850 -@item general register 3 -r3, sp -@cindex @code{gp} register, V850 -@item general register 4 -r4, gp -@cindex @code{tp} register, V850 -@item general register 5 -r5, tp -@item general register 6 -r6 -@item general register 7 -r7 -@item general register 8 -r8 -@item general register 9 -r9 -@item general register 10 -r10 -@item general register 11 -r11 -@item general register 12 -r12 -@item general register 13 -r13 -@item general register 14 -r14 -@item general register 15 -r15 -@item general register 16 -r16 -@item general register 17 -r17 -@item general register 18 -r18 -@item general register 19 -r19 -@item general register 20 -r20 -@item general register 21 -r21 -@item general register 22 -r22 -@item general register 23 -r23 -@item general register 24 -r24 -@item general register 25 -r25 -@item general register 26 -r26 -@item general register 27 -r27 -@item general register 28 -r28 -@item general register 29 -r29 -@cindex @code{ep} register, V850 -@item general register 30 -r30, ep -@cindex @code{lp} register, V850 -@item general register 31 -r31, lp -@cindex @code{eipc} register, V850 -@item system register 0 -eipc -@cindex @code{eipsw} register, V850 -@item system register 1 -eipsw -@cindex @code{fepc} register, V850 -@item system register 2 -fepc -@cindex @code{fepsw} register, V850 -@item system register 3 -fepsw -@cindex @code{ecr} register, V850 -@item system register 4 -ecr -@cindex @code{psw} register, V850 -@item system register 5 -psw -@cindex @code{ctpc} register, V850 -@item system register 16 -ctpc -@cindex @code{ctpsw} register, V850 -@item system register 17 -ctpsw -@cindex @code{dbpc} register, V850 -@item system register 18 -dbpc -@cindex @code{dbpsw} register, V850 -@item system register 19 -dbpsw -@cindex @code{ctbp} register, V850 -@item system register 20 -ctbp -@end table - -@node V850 Floating Point -@section Floating Point - -@cindex floating point, V850 (@sc{ieee}) -@cindex V850 floating point (@sc{ieee}) -The V850 family uses @sc{ieee} floating-point numbers. - -@node V850 Directives -@section V850 Machine Directives - -@cindex machine directives, V850 -@cindex V850 machine directives -@table @code -@cindex @code{offset} directive, V850 -@item .offset @var{<expression>} -Moves the offset into the current section to the specified amount. - -@cindex @code{section} directive, V850 -@item .section "name", <type> -This is an extension to the standard .section directive. It sets the -current section to be <type> and creates an alias for this section -called "name". - -@cindex @code{.v850} directive, V850 -@item .v850 -Specifies that the assembled code should be marked as being targeted at -the V850 processor. This allows the linker to detect attempts to link -such code with code assembled for other processors. - -@cindex @code{.v850e} directive, V850 -@item .v850e -Specifies that the assembled code should be marked as being targeted at -the V850E processor. This allows the linker to detect attempts to link -such code with code assembled for other processors. - -@end table - -@node V850 Opcodes -@section Opcodes - -@cindex V850 opcodes -@cindex opcodes for V850 -@code{@value{AS}} implements all the standard V850 opcodes. - -@code{@value{AS}} also implements the following pseudo ops: - -@table @code - -@cindex @code{hi0} pseudo-op, V850 -@item hi0() -Computes the higher 16 bits of the given expression and stores it into -the immediate operand field of the given instruction. For example: - - @samp{mulhi hi0(here - there), r5, r6} - -computes the difference between the address of labels 'here' and -'there', takes the upper 16 bits of this difference, shifts it down 16 -bits and then mutliplies it by the lower 16 bits in register 5, putting -the result into register 6. - -@cindex @code{lo} pseudo-op, V850 -@item lo() -Computes the lower 16 bits of the given expression and stores it into -the immediate operand field of the given instruction. For example: - - @samp{addi lo(here - there), r5, r6} - -computes the difference between the address of labels 'here' and -'there', takes the lower 16 bits of this difference and adds it to -register 5, putting the result into register 6. - -@cindex @code{hi} pseudo-op, V850 -@item hi() -Computes the higher 16 bits of the given expression and then adds the -value of the most significant bit of the lower 16 bits of the expression -and stores the result into the immediate operand field of the given -instruction. For example the following code can be used to compute the -address of the label 'here' and store it into register 6: - - @samp{movhi hi(here), r0, r6} - @samp{movea lo(here), r6, r6} - -The reason for this special behaviour is that movea performs a sign -extention on its immediate operand. So for example if the address of -'here' was 0xFFFFFFFF then without the special behaviour of the hi() -pseudo-op the movhi instruction would put 0xFFFF0000 into r6, then the -movea instruction would takes its immediate operand, 0xFFFF, sign extend -it to 32 bits, 0xFFFFFFFF, and then add it into r6 giving 0xFFFEFFFF -which is wrong (the fifth nibble is E). With the hi() pseudo op adding -in the top bit of the lo() pseudo op, the movhi instruction actually -stores 0 into r6 (0xFFFF + 1 = 0x0000), so that the movea instruction -stores 0xFFFFFFFF into r6 - the right value. - -@cindex @code{hilo} pseudo-op, V850 -@item hilo() -Computes the 32 bit value of the given expression and stores it into -the immediate operand field of the given instruction (which must be a -mov instruction). For example: - - @samp{mov hilo(here), r6} - -computes the absolute address of label 'here' and puts the result into -register 6. - -@cindex @code{sdaoff} pseudo-op, V850 -@item sdaoff() -Computes the offset of the named variable from the start of the Small -Data Area (whoes address is held in register 4, the GP register) and -stores the result as a 16 bit signed value in the immediate operand -field of the given instruction. For example: - - @samp{ld.w sdaoff(_a_variable)[gp],r6} - -loads the contents of the location pointed to by the label '_a_variable' -into register 6, provided that the label is located somewhere within +/- -32K of the address held in the GP register. [Note the linker assumes -that the GP register contains a fixed address set to the address of the -label called '__gp'. This can either be set up automatically by the -linker, or specifically set by using the @samp{--defsym __gp=<value>} -command line option]. - -@cindex @code{tdaoff} pseudo-op, V850 -@item tdaoff() -Computes the offset of the named variable from the start of the Tiny -Data Area (whoes address is held in register 30, the EP register) and -stores the result as a 4,5, 7 or 8 bit unsigned value in the immediate -operand field of the given instruction. For example: - - @samp{sld.w tdaoff(_a_variable)[ep],r6} - -loads the contents of the location pointed to by the label '_a_variable' -into register 6, provided that the label is located somewhere within +256 -bytes of the address held in the EP register. [Note the linker assumes -that the EP register contains a fixed address set to the address of the -label called '__ep'. This can either be set up automatically by the -linker, or specifically set by using the @samp{--defsym __ep=<value>} -command line option]. - -@cindex @code{zdaoff} pseudo-op, V850 -@item zdaoff() -Computes the offset of the named variable from address 0 and stores the -result as a 16 bit signed value in the immediate operand field of the -given instruction. For example: - - @samp{movea zdaoff(_a_variable),zero,r6} - -puts the address of the label '_a_variable' into register 6, assuming -that the label is somewhere within the first 32K of memory. (Strictly -speaking it also possible to access the last 32K of memory as well, as -the offsets are signed). - -@cindex @code{ctoff} pseudo-op, V850 -@item ctoff() -Computes the offset of the named variable from the start of the Call -Table Area (whoes address is helg in system register 20, the CTBP -register) and stores the result a 6 or 16 bit unsigned value in the -immediate field of then given instruction or piece of data. For -example: - - @samp{callt ctoff(table_func1)} - -will put the call the function whoes address is held in the call table -at the location labeled 'table_func1'. - -@end table - - -For information on the V850 instruction set, see @cite{V850 -Family 32-/16-Bit single-Chip Microcontroller Architecture Manual} from NEC. -Ltd. - diff --git a/contrib/binutils/gas/doc/c-z8k.texi b/contrib/binutils/gas/doc/c-z8k.texi deleted file mode 100644 index d98adeaf04aa..000000000000 --- a/contrib/binutils/gas/doc/c-z8k.texi +++ /dev/null @@ -1,380 +0,0 @@ -@c Copyright 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. -@c This is part of the GAS manual. -@c For copying conditions, see the file as.texinfo. -@ifset GENERIC -@page -@node Z8000-Dependent -@chapter Z8000 Dependent Features -@end ifset -@ifclear GENERIC -@node Machine Dependencies -@chapter Z8000 Dependent Features -@end ifclear - -@cindex Z8000 support -The Z8000 @value{AS} supports both members of the Z8000 family: the -unsegmented Z8002, with 16 bit addresses, and the segmented Z8001 with -24 bit addresses. - -When the assembler is in unsegmented mode (specified with the -@code{unsegm} directive), an address takes up one word (16 bit) -sized register. When the assembler is in segmented mode (specified with -the @code{segm} directive), a 24-bit address takes up a long (32 bit) -register. @xref{Z8000 Directives,,Assembler Directives for the Z8000}, -for a list of other Z8000 specific assembler directives. - -@menu -* Z8000 Options:: No special command-line options for Z8000 -* Z8000 Syntax:: Assembler syntax for the Z8000 -* Z8000 Directives:: Special directives for the Z8000 -* Z8000 Opcodes:: Opcodes -@end menu - -@node Z8000 Options -@section Options - -@cindex Z8000 options -@cindex options, Z8000 -@code{@value{AS}} has no additional command-line options for the Zilog -Z8000 family. - -@node Z8000 Syntax -@section Syntax -@menu -* Z8000-Chars:: Special Characters -* Z8000-Regs:: Register Names -* Z8000-Addressing:: Addressing Modes -@end menu - -@node Z8000-Chars -@subsection Special Characters - -@cindex line comment character, Z8000 -@cindex Z8000 line comment character -@samp{!} is the line comment character. - -@cindex line separator, Z8000 -@cindex statement separator, Z8000 -@cindex Z8000 line separator -You can use @samp{;} instead of a newline to separate statements. - -@node Z8000-Regs -@subsection Register Names - -@cindex Z8000 registers -@cindex registers, Z8000 -The Z8000 has sixteen 16 bit registers, numbered 0 to 15. You can refer -to different sized groups of registers by register number, with the -prefix @samp{r} for 16 bit registers, @samp{rr} for 32 bit registers and -@samp{rq} for 64 bit registers. You can also refer to the contents of -the first eight (of the sixteen 16 bit registers) by bytes. They are -named @samp{r@var{n}h} and @samp{r@var{n}l}. - -@smallexample -@exdent @emph{byte registers} -r0l r0h r1h r1l r2h r2l r3h r3l -r4h r4l r5h r5l r6h r6l r7h r7l - -@exdent @emph{word registers} -r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 - -@exdent @emph{long word registers} -rr0 rr2 rr4 rr6 rr8 rr10 rr12 rr14 - -@exdent @emph{quad word registers} -rq0 rq4 rq8 rq12 -@end smallexample - -@node Z8000-Addressing -@subsection Addressing Modes - -@cindex addressing modes, Z8000 -@cindex Z800 addressing modes -@value{AS} understands the following addressing modes for the Z8000: - -@table @code -@item r@var{n} -Register direct - -@item @@r@var{n} -Indirect register - -@item @var{addr} -Direct: the 16 bit or 24 bit address (depending on whether the assembler -is in segmented or unsegmented mode) of the operand is in the instruction. - -@item address(r@var{n}) -Indexed: the 16 or 24 bit address is added to the 16 bit register to produce -the final address in memory of the operand. - -@item r@var{n}(#@var{imm}) -Base Address: the 16 or 24 bit register is added to the 16 bit sign -extended immediate displacement to produce the final address in memory -of the operand. - -@item r@var{n}(r@var{m}) -Base Index: the 16 or 24 bit register r@var{n} is added to the sign -extended 16 bit index register r@var{m} to produce the final address in -memory of the operand. - -@item #@var{xx} -Immediate data @var{xx}. -@end table - -@node Z8000 Directives -@section Assembler Directives for the Z8000 - -@cindex Z8000 directives -@cindex directives, Z8000 -The Z8000 port of @value{AS} includes these additional assembler directives, -for compatibility with other Z8000 assemblers. As shown, these do not -begin with @samp{.} (unlike the ordinary @value{AS} directives). - -@table @code -@kindex segm -@item segm -Generates code for the segmented Z8001. - -@kindex unsegm -@item unsegm -Generates code for the unsegmented Z8002. - -@kindex name -@item name -Synonym for @code{.file} - -@kindex global -@item global -Synonym for @code{.global} - -@kindex wval -@item wval -Synonym for @code{.word} - -@kindex lval -@item lval -Synonym for @code{.long} - -@kindex bval -@item bval -Synonym for @code{.byte} - -@kindex sval -@item sval -Assemble a string. @code{sval} expects one string literal, delimited by -single quotes. It assembles each byte of the string into consecutive -addresses. You can use the escape sequence @samp{%@var{xx}} (where -@var{xx} represents a two-digit hexadecimal number) to represent the -character whose @sc{ascii} value is @var{xx}. Use this feature to -describe single quote and other characters that may not appear in string -literals as themselves. For example, the C statement @w{@samp{char *a = -"he said \"it's 50% off\"";}} is represented in Z8000 assembly language -(shown with the assembler output in hex at the left) as - -@iftex -@begingroup -@let@nonarrowing=@comment -@end iftex -@smallexample -68652073 sval 'he said %22it%27s 50%25 off%22%00' -61696420 -22697427 -73203530 -25206F66 -662200 -@end smallexample -@iftex -@endgroup -@end iftex - -@kindex rsect -@item rsect -synonym for @code{.section} - -@kindex block -@item block -synonym for @code{.space} - -@kindex even -@item even -special case of @code{.align}; aligns output to even byte boundary. -@end table - -@node Z8000 Opcodes -@section Opcodes - -@cindex Z8000 opcode summary -@cindex opcode summary, Z8000 -@cindex mnemonics, Z8000 -@cindex instruction summary, Z8000 -For detailed information on the Z8000 machine instruction set, see -@cite{Z8000 Technical Manual}. - -@ifset SMALL -@c this table, due to the multi-col faking and hardcoded order, looks silly -@c except in smallbook. See comments below "@set SMALL" near top of this file. - -The following table summarizes the opcodes and their arguments: -@iftex -@begingroup -@let@nonarrowing=@comment -@end iftex -@smallexample - - rs @r{16 bit source register} - rd @r{16 bit destination register} - rbs @r{8 bit source register} - rbd @r{8 bit destination register} - rrs @r{32 bit source register} - rrd @r{32 bit destination register} - rqs @r{64 bit source register} - rqd @r{64 bit destination register} - addr @r{16/24 bit address} - imm @r{immediate data} - -adc rd,rs clrb addr cpsir @@rd,@@rs,rr,cc -adcb rbd,rbs clrb addr(rd) cpsirb @@rd,@@rs,rr,cc -add rd,@@rs clrb rbd dab rbd -add rd,addr com @@rd dbjnz rbd,disp7 -add rd,addr(rs) com addr dec @@rd,imm4m1 -add rd,imm16 com addr(rd) dec addr(rd),imm4m1 -add rd,rs com rd dec addr,imm4m1 -addb rbd,@@rs comb @@rd dec rd,imm4m1 -addb rbd,addr comb addr decb @@rd,imm4m1 -addb rbd,addr(rs) comb addr(rd) decb addr(rd),imm4m1 -addb rbd,imm8 comb rbd decb addr,imm4m1 -addb rbd,rbs comflg flags decb rbd,imm4m1 -addl rrd,@@rs cp @@rd,imm16 di i2 -addl rrd,addr cp addr(rd),imm16 div rrd,@@rs -addl rrd,addr(rs) cp addr,imm16 div rrd,addr -addl rrd,imm32 cp rd,@@rs div rrd,addr(rs) -addl rrd,rrs cp rd,addr div rrd,imm16 -and rd,@@rs cp rd,addr(rs) div rrd,rs -and rd,addr cp rd,imm16 divl rqd,@@rs -and rd,addr(rs) cp rd,rs divl rqd,addr -and rd,imm16 cpb @@rd,imm8 divl rqd,addr(rs) -and rd,rs cpb addr(rd),imm8 divl rqd,imm32 -andb rbd,@@rs cpb addr,imm8 divl rqd,rrs -andb rbd,addr cpb rbd,@@rs djnz rd,disp7 -andb rbd,addr(rs) cpb rbd,addr ei i2 -andb rbd,imm8 cpb rbd,addr(rs) ex rd,@@rs -andb rbd,rbs cpb rbd,imm8 ex rd,addr -bit @@rd,imm4 cpb rbd,rbs ex rd,addr(rs) -bit addr(rd),imm4 cpd rd,@@rs,rr,cc ex rd,rs -bit addr,imm4 cpdb rbd,@@rs,rr,cc exb rbd,@@rs -bit rd,imm4 cpdr rd,@@rs,rr,cc exb rbd,addr -bit rd,rs cpdrb rbd,@@rs,rr,cc exb rbd,addr(rs) -bitb @@rd,imm4 cpi rd,@@rs,rr,cc exb rbd,rbs -bitb addr(rd),imm4 cpib rbd,@@rs,rr,cc ext0e imm8 -bitb addr,imm4 cpir rd,@@rs,rr,cc ext0f imm8 -bitb rbd,imm4 cpirb rbd,@@rs,rr,cc ext8e imm8 -bitb rbd,rs cpl rrd,@@rs ext8f imm8 -bpt cpl rrd,addr exts rrd -call @@rd cpl rrd,addr(rs) extsb rd -call addr cpl rrd,imm32 extsl rqd -call addr(rd) cpl rrd,rrs halt -calr disp12 cpsd @@rd,@@rs,rr,cc in rd,@@rs -clr @@rd cpsdb @@rd,@@rs,rr,cc in rd,imm16 -clr addr cpsdr @@rd,@@rs,rr,cc inb rbd,@@rs -clr addr(rd) cpsdrb @@rd,@@rs,rr,cc inb rbd,imm16 -clr rd cpsi @@rd,@@rs,rr,cc inc @@rd,imm4m1 -clrb @@rd cpsib @@rd,@@rs,rr,cc inc addr(rd),imm4m1 -inc addr,imm4m1 ldb rbd,rs(rx) mult rrd,addr(rs) -inc rd,imm4m1 ldb rd(imm16),rbs mult rrd,imm16 -incb @@rd,imm4m1 ldb rd(rx),rbs mult rrd,rs -incb addr(rd),imm4m1 ldctl ctrl,rs multl rqd,@@rs -incb addr,imm4m1 ldctl rd,ctrl multl rqd,addr -incb rbd,imm4m1 ldd @@rs,@@rd,rr multl rqd,addr(rs) -ind @@rd,@@rs,ra lddb @@rs,@@rd,rr multl rqd,imm32 -indb @@rd,@@rs,rba lddr @@rs,@@rd,rr multl rqd,rrs -inib @@rd,@@rs,ra lddrb @@rs,@@rd,rr neg @@rd -inibr @@rd,@@rs,ra ldi @@rd,@@rs,rr neg addr -iret ldib @@rd,@@rs,rr neg addr(rd) -jp cc,@@rd ldir @@rd,@@rs,rr neg rd -jp cc,addr ldirb @@rd,@@rs,rr negb @@rd -jp cc,addr(rd) ldk rd,imm4 negb addr -jr cc,disp8 ldl @@rd,rrs negb addr(rd) -ld @@rd,imm16 ldl addr(rd),rrs negb rbd -ld @@rd,rs ldl addr,rrs nop -ld addr(rd),imm16 ldl rd(imm16),rrs or rd,@@rs -ld addr(rd),rs ldl rd(rx),rrs or rd,addr -ld addr,imm16 ldl rrd,@@rs or rd,addr(rs) -ld addr,rs ldl rrd,addr or rd,imm16 -ld rd(imm16),rs ldl rrd,addr(rs) or rd,rs -ld rd(rx),rs ldl rrd,imm32 orb rbd,@@rs -ld rd,@@rs ldl rrd,rrs orb rbd,addr -ld rd,addr ldl rrd,rs(imm16) orb rbd,addr(rs) -ld rd,addr(rs) ldl rrd,rs(rx) orb rbd,imm8 -ld rd,imm16 ldm @@rd,rs,n orb rbd,rbs -ld rd,rs ldm addr(rd),rs,n out @@rd,rs -ld rd,rs(imm16) ldm addr,rs,n out imm16,rs -ld rd,rs(rx) ldm rd,@@rs,n outb @@rd,rbs -lda rd,addr ldm rd,addr(rs),n outb imm16,rbs -lda rd,addr(rs) ldm rd,addr,n outd @@rd,@@rs,ra -lda rd,rs(imm16) ldps @@rs outdb @@rd,@@rs,rba -lda rd,rs(rx) ldps addr outib @@rd,@@rs,ra -ldar rd,disp16 ldps addr(rs) outibr @@rd,@@rs,ra -ldb @@rd,imm8 ldr disp16,rs pop @@rd,@@rs -ldb @@rd,rbs ldr rd,disp16 pop addr(rd),@@rs -ldb addr(rd),imm8 ldrb disp16,rbs pop addr,@@rs -ldb addr(rd),rbs ldrb rbd,disp16 pop rd,@@rs -ldb addr,imm8 ldrl disp16,rrs popl @@rd,@@rs -ldb addr,rbs ldrl rrd,disp16 popl addr(rd),@@rs -ldb rbd,@@rs mbit popl addr,@@rs -ldb rbd,addr mreq rd popl rrd,@@rs -ldb rbd,addr(rs) mres push @@rd,@@rs -ldb rbd,imm8 mset push @@rd,addr -ldb rbd,rbs mult rrd,@@rs push @@rd,addr(rs) -ldb rbd,rs(imm16) mult rrd,addr push @@rd,imm16 -push @@rd,rs set addr,imm4 subl rrd,imm32 -pushl @@rd,@@rs set rd,imm4 subl rrd,rrs -pushl @@rd,addr set rd,rs tcc cc,rd -pushl @@rd,addr(rs) setb @@rd,imm4 tccb cc,rbd -pushl @@rd,rrs setb addr(rd),imm4 test @@rd -res @@rd,imm4 setb addr,imm4 test addr -res addr(rd),imm4 setb rbd,imm4 test addr(rd) -res addr,imm4 setb rbd,rs test rd -res rd,imm4 setflg imm4 testb @@rd -res rd,rs sinb rbd,imm16 testb addr -resb @@rd,imm4 sinb rd,imm16 testb addr(rd) -resb addr(rd),imm4 sind @@rd,@@rs,ra testb rbd -resb addr,imm4 sindb @@rd,@@rs,rba testl @@rd -resb rbd,imm4 sinib @@rd,@@rs,ra testl addr -resb rbd,rs sinibr @@rd,@@rs,ra testl addr(rd) -resflg imm4 sla rd,imm8 testl rrd -ret cc slab rbd,imm8 trdb @@rd,@@rs,rba -rl rd,imm1or2 slal rrd,imm8 trdrb @@rd,@@rs,rba -rlb rbd,imm1or2 sll rd,imm8 trib @@rd,@@rs,rbr -rlc rd,imm1or2 sllb rbd,imm8 trirb @@rd,@@rs,rbr -rlcb rbd,imm1or2 slll rrd,imm8 trtdrb @@ra,@@rb,rbr -rldb rbb,rba sout imm16,rs trtib @@ra,@@rb,rr -rr rd,imm1or2 soutb imm16,rbs trtirb @@ra,@@rb,rbr -rrb rbd,imm1or2 soutd @@rd,@@rs,ra trtrb @@ra,@@rb,rbr -rrc rd,imm1or2 soutdb @@rd,@@rs,rba tset @@rd -rrcb rbd,imm1or2 soutib @@rd,@@rs,ra tset addr -rrdb rbb,rba soutibr @@rd,@@rs,ra tset addr(rd) -rsvd36 sra rd,imm8 tset rd -rsvd38 srab rbd,imm8 tsetb @@rd -rsvd78 sral rrd,imm8 tsetb addr -rsvd7e srl rd,imm8 tsetb addr(rd) -rsvd9d srlb rbd,imm8 tsetb rbd -rsvd9f srll rrd,imm8 xor rd,@@rs -rsvdb9 sub rd,@@rs xor rd,addr -rsvdbf sub rd,addr xor rd,addr(rs) -sbc rd,rs sub rd,addr(rs) xor rd,imm16 -sbcb rbd,rbs sub rd,imm16 xor rd,rs -sc imm8 sub rd,rs xorb rbd,@@rs -sda rd,rs subb rbd,@@rs xorb rbd,addr -sdab rbd,rs subb rbd,addr xorb rbd,addr(rs) -sdal rrd,rs subb rbd,addr(rs) xorb rbd,imm8 -sdl rd,rs subb rbd,imm8 xorb rbd,rbs -sdlb rbd,rs subb rbd,rbs xorb rbd,rbs -sdll rrd,rs subl rrd,@@rs -set @@rd,imm4 subl rrd,addr -set addr(rd),imm4 subl rrd,addr(rs) -@end smallexample -@iftex -@endgroup -@end iftex -@end ifset - diff --git a/contrib/binutils/include/aout/sun4.h b/contrib/binutils/include/aout/sun4.h deleted file mode 100644 index f42a0dd45988..000000000000 --- a/contrib/binutils/include/aout/sun4.h +++ /dev/null @@ -1,219 +0,0 @@ -/* SPARC-specific values for a.out files */ - -/* Some systems, e.g., AIX, may have defined this in header files already - included. */ -#undef TARGET_PAGE_SIZE -#define TARGET_PAGE_SIZE 0x2000 /* 8K. aka NBPG in <sys/param.h> */ -/* Note that some SPARCs have 4K pages, some 8K, some others. */ - -#define SEG_SIZE_SPARC TARGET_PAGE_SIZE -#define SEG_SIZE_SUN3 0x20000 /* Resolution of r/w protection hw */ - -#define TEXT_START_ADDR TARGET_PAGE_SIZE /* Location 0 is not accessible */ -#define N_HEADER_IN_TEXT(x) 1 - -/* Non-default definitions of the accessor macros... */ - -/* Segment size varies on Sun-3 versus Sun-4. */ - -#define N_SEGSIZE(x) (N_MACHTYPE(x) == M_SPARC? SEG_SIZE_SPARC: \ - N_MACHTYPE(x) == M_68020? SEG_SIZE_SUN3: \ - /* Guess? */ TARGET_PAGE_SIZE) - -/* Virtual Address of text segment from the a.out file. For OMAGIC, - (almost always "unlinked .o's" these days), should be zero. - Sun added a kludge so that shared libraries linked ZMAGIC get - an address of zero if a_entry (!!!) is lower than the otherwise - expected text address. These kludges have gotta go! - For linked files, should reflect reality if we know it. */ - -/* This differs from the version in aout64.h (which we override by defining - it here) only for NMAGIC (we return TEXT_START_ADDR+EXEC_BYTES_SIZE; - they return 0). */ - -#define N_TXTADDR(x) \ - (N_MAGIC(x)==OMAGIC? 0 \ - : (N_MAGIC(x) == ZMAGIC && (x).a_entry < TEXT_START_ADDR)? 0 \ - : TEXT_START_ADDR+EXEC_BYTES_SIZE) - -/* When a file is linked against a shared library on SunOS 4, the - dynamic bit in the exec header is set, and the first symbol in the - symbol table is __DYNAMIC. Its value is the address of the - following structure. */ - -struct external_sun4_dynamic -{ - /* The version number of the structure. SunOS 4.1.x creates files - with version number 3, which is what this structure is based on. - According to gdb, version 2 is similar. I believe that version 2 - used a different type of procedure linkage table, and there may - have been other differences. */ - bfd_byte ld_version[4]; - /* The virtual address of a 28 byte structure used in debugging. - The contents are filled in at run time by ld.so. */ - bfd_byte ldd[4]; - /* The virtual address of another structure with information about - how to relocate the executable at run time. */ - bfd_byte ld[4]; -}; - -/* The size of the debugging structure pointed to by the debugger - field of __DYNAMIC. */ -#define EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE (24) - -/* The structure pointed to by the linker field of __DYNAMIC. As far - as I can tell, most of the addresses in this structure are offsets - within the file, but some are actually virtual addresses. */ - -struct internal_sun4_dynamic_link -{ - /* Linked list of loaded objects. This is filled in at runtime by - ld.so and probably by dlopen. */ - unsigned long ld_loaded; - - /* The address of the list of names of shared objects which must be - included at runtime. Each entry in the list is 16 bytes: the 4 - byte address of the string naming the object (e.g., for -lc this - is "c"); 4 bytes of flags--the high bit is whether to search for - the object using the library path; the 2 byte major version - number; the 2 byte minor version number; the 4 byte address of - the next entry in the list (zero if this is the last entry). The - version numbers seem to only be non-zero when doing library - searching. */ - unsigned long ld_need; - - /* The address of the path to search for the shared objects which - must be included. This points to a string in PATH format which - is generated from the -L arguments to the linker. According to - the man page, ld.so implicitly adds ${LD_LIBRARY_PATH} to the - beginning of this string and /lib:/usr/lib:/usr/local/lib to the - end. The string is terminated by a null byte. This field is - zero if there is no additional path. */ - unsigned long ld_rules; - - /* The address of the global offset table. This appears to be a - virtual address, not a file offset. The first entry in the - global offset table seems to be the virtual address of the - sun4_dynamic structure (the same value as the __DYNAMIC symbol). - The global offset table is used for PIC code to hold the - addresses of variables. A dynamically linked file which does not - itself contain PIC code has a four byte global offset table. */ - unsigned long ld_got; - - /* The address of the procedure linkage table. This appears to be a - virtual address, not a file offset. - - On a SPARC, the table is composed of 12 byte entries, each of - which consists of three instructions. The first entry is - sethi %hi(0),%g1 - jmp %g1 - nop - These instructions are changed by ld.so into a jump directly into - ld.so itself. Each subsequent entry is - save %sp, -96, %sp - call <address of first entry in procedure linkage table> - <reloc_number | 0x01000000> - The reloc_number is the number of the reloc to use to resolve - this entry. The reloc will be a JMP_SLOT reloc against some - symbol that is not defined in this object file but should be - defined in a shared object (if it is not, ld.so will report a - runtime error and exit). The constant 0x010000000 turns the - reloc number into a sethi of %g0, which does nothing since %g0 is - hardwired to zero. - - When one of these entries is executed, it winds up calling into - ld.so. ld.so looks at the reloc number, available via the return - address, to determine which entry this is. It then looks at the - reloc and patches up the entry in the table into a sethi and jmp - to the real address followed by a nop. This means that the reloc - lookup only has to happen once, and it also means that the - relocation only needs to be done if the function is actually - called. The relocation is expensive because ld.so must look up - the symbol by name. - - The size of the procedure linkage table is given by the ld_plt_sz - field. */ - unsigned long ld_plt; - - /* The address of the relocs. These are in the same format as - ordinary relocs. Symbol index numbers refer to the symbols - pointed to by ld_stab. I think the only way to determine the - number of relocs is to assume that all the bytes from ld_rel to - ld_hash contain reloc entries. */ - unsigned long ld_rel; - - /* The address of a hash table of symbols. The hash table has - roughly the same number of entries as there are dynamic symbols; - I think the only way to get the exact size is to assume that - every byte from ld_hash to ld_stab is devoted to the hash table. - - Each entry in the hash table is eight bytes. The first four - bytes are a symbol index into the dynamic symbols. The second - four bytes are the index of the next hash table entry in the - bucket. The ld_buckets field gives the number of buckets, say B. - The first B entries in the hash table each start a bucket which - is chained through the second four bytes of each entry. A value - of zero ends the chain. - - The hash function is simply - h = 0; - while (*string != '\0') - h = (h << 1) + *string++; - h &= 0x7fffffff; - - To look up a symbol, compute the hash value of the name. Take - the modulos of hash value and the number of buckets. Start at - that entry in the hash table. See if the symbol (from the first - four bytes of the hash table entry) has the name you are looking - for. If not, use the chain field (the second four bytes of the - hash table entry) to move on to the next entry in this bucket. - If the chain field is zero you have reached the end of the - bucket, and the symbol is not in the hash table. */ - unsigned long ld_hash; - - /* The address of the symbol table. This is a list of - external_nlist structures. The string indices are relative to - the ld_symbols field. I think the only way to determine the - number of symbols is to assume that all the bytes between ld_stab - and ld_symbols are external_nlist structures. */ - unsigned long ld_stab; - - /* I don't know what this is for. It seems to always be zero. */ - unsigned long ld_stab_hash; - - /* The number of buckets in the hash table. */ - unsigned long ld_buckets; - - /* The address of the symbol string table. The first string in this - string table need not be the empty string. */ - unsigned long ld_symbols; - - /* The size in bytes of the symbol string table. */ - unsigned long ld_symb_size; - - /* The size in bytes of the text segment. */ - unsigned long ld_text; - - /* The size in bytes of the procedure linkage table. */ - unsigned long ld_plt_sz; -}; - -/* The external form of the structure. */ - -struct external_sun4_dynamic_link -{ - bfd_byte ld_loaded[4]; - bfd_byte ld_need[4]; - bfd_byte ld_rules[4]; - bfd_byte ld_got[4]; - bfd_byte ld_plt[4]; - bfd_byte ld_rel[4]; - bfd_byte ld_hash[4]; - bfd_byte ld_stab[4]; - bfd_byte ld_stab_hash[4]; - bfd_byte ld_buckets[4]; - bfd_byte ld_symbols[4]; - bfd_byte ld_symb_size[4]; - bfd_byte ld_text[4]; - bfd_byte ld_plt_sz[4]; -}; diff --git a/contrib/binutils/include/coff/rs6000.h b/contrib/binutils/include/coff/rs6000.h deleted file mode 100644 index 0def1d95d15a..000000000000 --- a/contrib/binutils/include/coff/rs6000.h +++ /dev/null @@ -1,243 +0,0 @@ -/* IBM RS/6000 "XCOFF" file definitions for BFD. - Copyright (C) 1990, 1991 Free Software Foundation, Inc. - FIXME: Can someone provide a transliteration of this name into ASCII? - Using the following chars caused a compiler warning on HIUX (so I replaced - them with octal escapes), and isn't useful without an understanding of what - character set it is. - Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM - and John Gilmore of Cygnus Support. */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - - /* IBM RS/6000 */ -#define U802WRMAGIC 0730 /* writeable text segments **chh** */ -#define U802ROMAGIC 0735 /* readonly sharable text segments */ -#define U802TOCMAGIC 0737 /* readonly text segments and TOC */ - -#define BADMAG(x) \ - ((x).f_magic != U802ROMAGIC && (x).f_magic != U802WRMAGIC && \ - (x).f_magic != U802TOCMAGIC) - -#define FILHDR struct external_filehdr -#define FILHSZ 20 - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - unsigned char magic[2]; /* type of file */ - unsigned char vstamp[2]; /* version stamp */ - unsigned char tsize[4]; /* text size in bytes, padded to FW bdry */ - unsigned char dsize[4]; /* initialized data " " */ - unsigned char bsize[4]; /* uninitialized data " " */ - unsigned char entry[4]; /* entry pt. */ - unsigned char text_start[4]; /* base of text used for this file */ - unsigned char data_start[4]; /* base of data used for this file */ - unsigned char o_toc[4]; /* address of TOC */ - unsigned char o_snentry[2]; /* section number of entry point */ - unsigned char o_sntext[2]; /* section number of .text section */ - unsigned char o_sndata[2]; /* section number of .data section */ - unsigned char o_sntoc[2]; /* section number of TOC */ - unsigned char o_snloader[2]; /* section number of .loader section */ - unsigned char o_snbss[2]; /* section number of .bss section */ - unsigned char o_algntext[2]; /* .text alignment */ - unsigned char o_algndata[2]; /* .data alignment */ - unsigned char o_modtype[2]; /* module type (??) */ - unsigned char o_cputype[2]; /* cpu type */ - unsigned char o_maxstack[4]; /* max stack size (??) */ - unsigned char o_maxdata[4]; /* max data size (??) */ - unsigned char o_resv2[12]; /* reserved */ -} -AOUTHDR; - -#define AOUTSZ 72 -#define SMALL_AOUTSZ (28) -#define AOUTHDRSZ 72 - -#define RS6K_AOUTHDR_OMAGIC 0x0107 /* old: text & data writeable */ -#define RS6K_AOUTHDR_NMAGIC 0x0108 /* new: text r/o, data r/w */ -#define RS6K_AOUTHDR_ZMAGIC 0x010B /* paged: text r/o, both page-aligned */ - - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _PAD ".pad" -#define _LOADER ".loader" - -#define SCNHDR struct external_scnhdr -#define SCNHSZ 40 - -/* XCOFF uses a special .loader section with type STYP_LOADER. */ -#define STYP_LOADER 0x1000 - -/* XCOFF uses a special .debug section with type STYP_DEBUG. */ -#define STYP_DEBUG 0x2000 - -/* XCOFF handles line number or relocation overflow by creating - another section header with STYP_OVRFLO set. */ -#define STYP_OVRFLO 0x8000 - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[2]; /* line number */ -}; - - -#define LINENO struct external_lineno -#define LINESZ 6 - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - - - -#define N_BTMASK (017) -#define N_TMASK (060) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - struct { - unsigned char x_scnlen[4]; - unsigned char x_parmhash[4]; - unsigned char x_snhash[2]; - unsigned char x_smtyp[1]; - unsigned char x_smclas[1]; - unsigned char x_stab[4]; - unsigned char x_snstab[2]; - } x_csect; - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 -#define DBXMASK 0x80 /* for dbx storage mask */ -#define SYMNAME_IN_DEBUG(symptr) ((symptr)->n_sclass & DBXMASK) - - - -/********************** RELOCATION DIRECTIVES **********************/ - - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_size[1]; - char r_type[1]; -}; - - -#define RELOC struct external_reloc -#define RELSZ 10 - -#define DEFAULT_DATA_SECTION_ALIGNMENT 4 -#define DEFAULT_BSS_SECTION_ALIGNMENT 4 -#define DEFAULT_TEXT_SECTION_ALIGNMENT 4 -/* For new sections we havn't heard of before */ -#define DEFAULT_SECTION_ALIGNMENT 4 diff --git a/contrib/binutils/include/coff/tic30.h b/contrib/binutils/include/coff/tic30.h deleted file mode 100644 index 1b5b5fdc5e20..000000000000 --- a/contrib/binutils/include/coff/tic30.h +++ /dev/null @@ -1,219 +0,0 @@ -/* coff information for Texas Instruments TMS320C3X - - Copyright 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - - -#define TIC30MAGIC 0xC000 - -#define TIC30BADMAG(x) (((x).f_magic!=TIC30MAGIC)) - -#define FILHDR struct external_filehdr -#define FILHSZ 20 - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ -} -AOUTHDR; - - -#define AOUTHDRSZ 28 -#define AOUTSZ 28 - - - - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" - - -#define SCNHDR struct external_scnhdr -#define SCNHSZ 40 - - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[4]; /* line number */ -}; - -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno)); -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_32(abfd,val, (bfd_byte *) (ext->l_lnno)); - -#define LINENO struct external_lineno -#define LINESZ 8 - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - - - -#define N_BTMASK (017) -#define N_TMASK (060) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - - -/********************** RELOCATION DIRECTIVES **********************/ - -/* The external reloc has an offset field, because some of the reloc - types on the z8k don't have room in the instruction for the entire - offset - eg with segments */ - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_offset[4]; - char r_type[2]; - char r_stuff[2]; -}; - - -#define RELOC struct external_reloc -#define RELSZ 16 - -/* TMS320C30 relocation types. */ - -#define R_TIC30_ABS16 0x100 /* 16 bit absolute. */ -#define R_TIC30_ABS24 0x101 /* 24 bit absolute. */ -#define R_TIC30_ABS32 0x102 /* 32 bit absolute. */ -#define R_TIC30_LDP 0x103 /* LDP bits 23-16 to 7-0. */ -#define R_TIC30_PC16 0x104 /* 16 bit pc relative. */ diff --git a/contrib/binutils/include/coff/z8k.h b/contrib/binutils/include/coff/z8k.h deleted file mode 100644 index 88db5c4d4261..000000000000 --- a/contrib/binutils/include/coff/z8k.h +++ /dev/null @@ -1,217 +0,0 @@ -/* coff information for Zilog Z800N - - Copyright 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/********************** FILE HEADER **********************/ - -struct external_filehdr { - char f_magic[2]; /* magic number */ - char f_nscns[2]; /* number of sections */ - char f_timdat[4]; /* time & date stamp */ - char f_symptr[4]; /* file pointer to symtab */ - char f_nsyms[4]; /* number of symtab entries */ - char f_opthdr[2]; /* sizeof(optional hdr) */ - char f_flags[2]; /* flags */ -}; - - -/* Type of cpu is stored in flags */ -#define F_Z8001 0x1000 -#define F_Z8002 0x2000 -#define F_MACHMASK 0xf000 - -#define Z8KMAGIC 0x8000 - -#define Z8KBADMAG(x) (((x).f_magic!=Z8KMAGIC)) - -#define FILHDR struct external_filehdr -#define FILHSZ 20 - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - char magic[2]; /* type of file */ - char vstamp[2]; /* version stamp */ - char tsize[4]; /* text size in bytes, padded to FW bdry*/ - char dsize[4]; /* initialized data " " */ - char bsize[4]; /* uninitialized data " " */ - char entry[4]; /* entry pt. */ - char text_start[4]; /* base of text used for this file */ - char data_start[4]; /* base of data used for this file */ -} -AOUTHDR; - - -#define AOUTHDRSZ 28 -#define AOUTSZ 28 - - - - -/********************** SECTION HEADER **********************/ - - -struct external_scnhdr { - char s_name[8]; /* section name */ - char s_paddr[4]; /* physical address, aliased s_nlib */ - char s_vaddr[4]; /* virtual address */ - char s_size[4]; /* section size */ - char s_scnptr[4]; /* file ptr to raw data for section */ - char s_relptr[4]; /* file ptr to relocation */ - char s_lnnoptr[4]; /* file ptr to line numbers */ - char s_nreloc[2]; /* number of relocation entries */ - char s_nlnno[2]; /* number of line number entries*/ - char s_flags[4]; /* flags */ -}; - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" - - -#define SCNHDR struct external_scnhdr -#define SCNHSZ 40 - - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -struct external_lineno { - union { - char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ - char l_paddr[4]; /* (physical) address of line number */ - } l_addr; - char l_lnno[4]; /* line number */ -}; - -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno)); -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_32(abfd,val, (bfd_byte *) (ext->l_lnno)); - -#define LINENO struct external_lineno -#define LINESZ 8 - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -struct external_syment -{ - union { - char e_name[E_SYMNMLEN]; - struct { - char e_zeroes[4]; - char e_offset[4]; - } e; - } e; - char e_value[4]; - char e_scnum[2]; - char e_type[2]; - char e_sclass[1]; - char e_numaux[1]; -}; - - - -#define N_BTMASK (017) -#define N_TMASK (060) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - - -union external_auxent { - struct { - char x_tagndx[4]; /* str, un, or enum tag indx */ - union { - struct { - char x_lnno[2]; /* declaration line number */ - char x_size[2]; /* str/union/array size */ - } x_lnsz; - char x_fsize[4]; /* size of function */ - } x_misc; - union { - struct { /* if ISFCN, tag, or .bb */ - char x_lnnoptr[4]; /* ptr to fcn line # */ - char x_endndx[4]; /* entry ndx past block end */ - } x_fcn; - struct { /* if ISARY, up to 4 dimen. */ - char x_dimen[E_DIMNUM][2]; - } x_ary; - } x_fcnary; - char x_tvndx[2]; /* tv index */ - } x_sym; - - union { - char x_fname[E_FILNMLEN]; - struct { - char x_zeroes[4]; - char x_offset[4]; - } x_n; - } x_file; - - struct { - char x_scnlen[4]; /* section length */ - char x_nreloc[2]; /* # relocation entries */ - char x_nlinno[2]; /* # line numbers */ - } x_scn; - - struct { - char x_tvfill[4]; /* tv fill value */ - char x_tvlen[2]; /* length of .tv */ - char x_tvran[2][2]; /* tv range */ - } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ - - -}; - -#define SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - - -/********************** RELOCATION DIRECTIVES **********************/ - -/* The external reloc has an offset field, because some of the reloc - types on the z8k don't have room in the instruction for the entire - offset - eg with segments */ - -struct external_reloc { - char r_vaddr[4]; - char r_symndx[4]; - char r_offset[4]; - char r_type[2]; - char r_stuff[2]; -}; - - -#define RELOC struct external_reloc -#define RELSZ 16 - diff --git a/contrib/binutils/include/elf/arm-oabi.h b/contrib/binutils/include/elf/arm-oabi.h deleted file mode 100644 index da5e7316eed6..000000000000 --- a/contrib/binutils/include/elf/arm-oabi.h +++ /dev/null @@ -1,88 +0,0 @@ -/* ARM ELF support for BFD. - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _ELF_ARM_H -#define _ELF_ARM_H - -#include "elf/reloc-macros.h" - -/* Processor specific flags for the ELF header e_flags field. */ -#define EF_ARM_RELEXEC 0x01 -#define EF_ARM_HASENTRY 0x02 -#define EF_INTERWORK 0x04 -#define EF_APCS_26 0x08 -#define EF_APCS_FLOAT 0x10 -#define EF_PIC 0x20 -#define EF_ALIGN8 0x40 /* 8-bit structure alignment is in use. */ -#define EF_NEW_ABI 0x80 -#define EF_OLD_ABI 0x100 - -/* Local aliases for some flags to match names used by COFF port. */ -#define F_INTERWORK EF_INTERWORK -#define F_APCS26 EF_APCS_26 -#define F_APCS_FLOAT EF_APCS_FLOAT -#define F_PIC EF_PIC - -/* Additional symbol types for Thumb. */ -#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */ -#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */ - -/* ARM-specific values for sh_flags. */ -#define SHF_ENTRYSECT 0x10000000 /* Section contains an entry point. */ -#define SHF_COMDEF 0x80000000 /* Section may be multiply defined in the input to a link step. */ - -/* ARM-specific program header flags. */ -#define PF_ARM_SB 0x10000000 /* Segment contains the location addressed by the static base. */ - -/* Relocation types. */ -START_RELOC_NUMBERS (elf_arm_reloc_type) - RELOC_NUMBER (R_ARM_NONE, 0) - RELOC_NUMBER (R_ARM_PC24, 1) - RELOC_NUMBER (R_ARM_ABS32, 2) - RELOC_NUMBER (R_ARM_REL32, 3) - RELOC_NUMBER (R_ARM_ABS8, 4) - RELOC_NUMBER (R_ARM_ABS16, 5) - RELOC_NUMBER (R_ARM_ABS12, 6) - RELOC_NUMBER (R_ARM_THM_ABS5, 7) - RELOC_NUMBER (R_ARM_THM_PC22, 8) - RELOC_NUMBER (R_ARM_SBREL32, 9) - RELOC_NUMBER (R_ARM_AMP_VCALL9, 10) - RELOC_NUMBER (R_ARM_THM_PC11, 11) /* Cygnus extension to abi: Thumb unconditional branch. */ - RELOC_NUMBER (R_ARM_THM_PC9, 12) /* Cygnus extension to abi: Thumb conditional branch. */ - RELOC_NUMBER (R_ARM_GNU_VTINHERIT, 13) - RELOC_NUMBER (R_ARM_GNU_VTENTRY, 14) - RELOC_NUMBER (R_ARM_COPY, 20) /* Copy symbol at runtime. */ - RELOC_NUMBER (R_ARM_GLOB_DAT, 21) /* Create GOT entry. */ - RELOC_NUMBER (R_ARM_JUMP_SLOT, 22) /* Create PLT entry. */ - RELOC_NUMBER (R_ARM_RELATIVE, 23) /* Adjust by program base. */ - RELOC_NUMBER (R_ARM_GOTOFF, 24) /* 32 bit offset to GOT. */ - RELOC_NUMBER (R_ARM_GOTPC, 25) /* 32 bit PC relative offset to GOT. */ - RELOC_NUMBER (R_ARM_GOT32, 26) /* 32 bit GOT entry. */ - RELOC_NUMBER (R_ARM_PLT32, 27) /* 32 bit PLT address. */ - FAKE_RELOC (FIRST_INVALID_RELOC, 28) - FAKE_RELOC (LAST_INVALID_RELOC, 249) - RELOC_NUMBER (R_ARM_RSBREL32, 250) - RELOC_NUMBER (R_ARM_THM_RPC22, 251) - RELOC_NUMBER (R_ARM_RREL32, 252) - RELOC_NUMBER (R_ARM_RABS32, 253) - RELOC_NUMBER (R_ARM_RPC24, 254) - RELOC_NUMBER (R_ARM_RBASE, 255) -END_RELOC_NUMBERS - -#endif diff --git a/contrib/binutils/include/elf/avr.h b/contrib/binutils/include/elf/avr.h deleted file mode 100644 index 59cf07347159..000000000000 --- a/contrib/binutils/include/elf/avr.h +++ /dev/null @@ -1,58 +0,0 @@ -/* AVR ELF support for BFD. - Copyright 1999, 2000 Free Software Foundation, Inc. - Contributed by Denis Chertykov <denisc@overta.ru> - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _ELF_AVR_H -#define _ELF_AVR_H - -#include "elf/reloc-macros.h" - -/* Processor specific flags for the ELF header e_flags field. */ -#define EF_AVR_MACH 0xf - -#define E_AVR_MACH_AVR1 1 -#define E_AVR_MACH_AVR2 2 -#define E_AVR_MACH_AVR3 3 -#define E_AVR_MACH_AVR4 4 -#define E_AVR_MACH_AVR5 5 - -/* Relocations. */ -START_RELOC_NUMBERS (elf_avr_reloc_type) - RELOC_NUMBER (R_AVR_NONE, 0) - RELOC_NUMBER (R_AVR_32, 1) - RELOC_NUMBER (R_AVR_7_PCREL, 2) - RELOC_NUMBER (R_AVR_13_PCREL, 3) - RELOC_NUMBER (R_AVR_16, 4) - RELOC_NUMBER (R_AVR_16_PM, 5) - RELOC_NUMBER (R_AVR_LO8_LDI, 6) - RELOC_NUMBER (R_AVR_HI8_LDI, 7) - RELOC_NUMBER (R_AVR_HH8_LDI, 8) - RELOC_NUMBER (R_AVR_LO8_LDI_NEG, 9) - RELOC_NUMBER (R_AVR_HI8_LDI_NEG, 10) - RELOC_NUMBER (R_AVR_HH8_LDI_NEG, 11) - RELOC_NUMBER (R_AVR_LO8_LDI_PM, 12) - RELOC_NUMBER (R_AVR_HI8_LDI_PM, 13) - RELOC_NUMBER (R_AVR_HH8_LDI_PM, 14) - RELOC_NUMBER (R_AVR_LO8_LDI_PM_NEG, 15) - RELOC_NUMBER (R_AVR_HI8_LDI_PM_NEG, 16) - RELOC_NUMBER (R_AVR_HH8_LDI_PM_NEG, 17) - RELOC_NUMBER (R_AVR_CALL, 18) -END_RELOC_NUMBERS (R_AVR_max) - -#endif /* _ELF_AVR_H */ diff --git a/contrib/binutils/include/elf/cris.h b/contrib/binutils/include/elf/cris.h deleted file mode 100644 index 860537534b5f..000000000000 --- a/contrib/binutils/include/elf/cris.h +++ /dev/null @@ -1,47 +0,0 @@ -/* CRIS ELF support for BFD. - Copyright 2000, 2001 Free Software Foundation, Inc. - Contributed by Axis Communications AB, Lund, Sweden. - Written by Hans-Peter Nilsson. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _ELF_CRIS_H -#define _ELF_CRIS_H - -#include "elf/reloc-macros.h" - -/* Relocations. */ -START_RELOC_NUMBERS (elf_cris_reloc_type) - RELOC_NUMBER (R_CRIS_NONE, 0) - RELOC_NUMBER (R_CRIS_8, 1) - RELOC_NUMBER (R_CRIS_16, 2) - RELOC_NUMBER (R_CRIS_32, 3) - RELOC_NUMBER (R_CRIS_8_PCREL, 4) - RELOC_NUMBER (R_CRIS_16_PCREL, 5) - RELOC_NUMBER (R_CRIS_32_PCREL, 6) - - RELOC_NUMBER (R_CRIS_GNU_VTINHERIT, 7) - RELOC_NUMBER (R_CRIS_GNU_VTENTRY, 8) - - /* No other relocs must be visible outside the assembler. */ - -END_RELOC_NUMBERS (R_CRIS_max) - -/* User symbols in this file have a leading underscore. */ -#define EF_CRIS_UNDERSCORE 0x00000001 - -#endif /* _ELF_CRIS_H */ diff --git a/contrib/binutils/include/elf/d10v.h b/contrib/binutils/include/elf/d10v.h deleted file mode 100644 index 5bc613bc3bfa..000000000000 --- a/contrib/binutils/include/elf/d10v.h +++ /dev/null @@ -1,38 +0,0 @@ -/* d10v ELF support for BFD. - Copyright 1998, 2000 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _ELF_D10V_H -#define _ELF_D10V_H - -#include "elf/reloc-macros.h" - -/* Relocation types. */ -START_RELOC_NUMBERS (elf_d10v_reloc_type) - RELOC_NUMBER (R_D10V_NONE, 0) - RELOC_NUMBER (R_D10V_10_PCREL_R, 1) - RELOC_NUMBER (R_D10V_10_PCREL_L, 2) - RELOC_NUMBER (R_D10V_16, 3) - RELOC_NUMBER (R_D10V_18, 4) - RELOC_NUMBER (R_D10V_18_PCREL, 5) - RELOC_NUMBER (R_D10V_32, 6) - RELOC_NUMBER (R_D10V_GNU_VTINHERIT, 7) - RELOC_NUMBER (R_D10V_GNU_VTENTRY, 8) -END_RELOC_NUMBERS (R_D10V_max) - -#endif diff --git a/contrib/binutils/include/elf/d30v.h b/contrib/binutils/include/elf/d30v.h deleted file mode 100644 index 5abb06a551fa..000000000000 --- a/contrib/binutils/include/elf/d30v.h +++ /dev/null @@ -1,42 +0,0 @@ -/* d30v ELF support for BFD. - Copyright 1998, 2000 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _ELF_D30V_H -#define _ELF_D30V_H - -#include "elf/reloc-macros.h" - -/* Relocations. */ -START_RELOC_NUMBERS (elf_d30v_reloc_type) - RELOC_NUMBER (R_D30V_NONE, 0) - RELOC_NUMBER (R_D30V_6, 1) - RELOC_NUMBER (R_D30V_9_PCREL, 2) - RELOC_NUMBER (R_D30V_9_PCREL_R, 3) - RELOC_NUMBER (R_D30V_15, 4) - RELOC_NUMBER (R_D30V_15_PCREL, 5) - RELOC_NUMBER (R_D30V_15_PCREL_R, 6) - RELOC_NUMBER (R_D30V_21, 7) - RELOC_NUMBER (R_D30V_21_PCREL, 8) - RELOC_NUMBER (R_D30V_21_PCREL_R, 9) - RELOC_NUMBER (R_D30V_32, 10) - RELOC_NUMBER (R_D30V_32_PCREL, 11) - RELOC_NUMBER (R_D30V_32_NORMAL, 12) -END_RELOC_NUMBERS (R_D30V_max) - -#endif diff --git a/contrib/binutils/include/elf/fr30.h b/contrib/binutils/include/elf/fr30.h deleted file mode 100644 index 12a450dffd0a..000000000000 --- a/contrib/binutils/include/elf/fr30.h +++ /dev/null @@ -1,42 +0,0 @@ -/* FR30 ELF support for BFD. - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _ELF_FR30_H -#define _ELF_FR30_H - -#include "elf/reloc-macros.h" - -/* Relocations. */ -START_RELOC_NUMBERS (elf_fr30_reloc_type) - RELOC_NUMBER (R_FR30_NONE, 0) - RELOC_NUMBER (R_FR30_8, 1) - RELOC_NUMBER (R_FR30_20, 2) - RELOC_NUMBER (R_FR30_32, 3) - RELOC_NUMBER (R_FR30_48, 4) - RELOC_NUMBER (R_FR30_6_IN_4, 5) - RELOC_NUMBER (R_FR30_8_IN_8, 6) - RELOC_NUMBER (R_FR30_9_IN_8, 7) - RELOC_NUMBER (R_FR30_10_IN_8, 8) - RELOC_NUMBER (R_FR30_9_PCREL, 9) - RELOC_NUMBER (R_FR30_12_PCREL, 10) - RELOC_NUMBER (R_FR30_GNU_VTINHERIT, 11) - RELOC_NUMBER (R_FR30_GNU_VTENTRY, 12) -END_RELOC_NUMBERS (R_FR30_max) - -#endif /* _ELF_FR30_H */ diff --git a/contrib/binutils/include/elf/hppa.h b/contrib/binutils/include/elf/hppa.h deleted file mode 100644 index 45e0b9f0f0fb..000000000000 --- a/contrib/binutils/include/elf/hppa.h +++ /dev/null @@ -1,552 +0,0 @@ -/* HPPA ELF support for BFD. - Copyright 1993, 1994, 1995, 1998, 1999, 2000 - Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file holds definitions specific to the HPPA ELF ABI. Note - that most of this is not actually implemented by BFD. */ - -#ifndef _ELF_HPPA_H -#define _ELF_HPPA_H - -/* Processor specific flags for the ELF header e_flags field. */ - -/* Trap null address dereferences. */ -#define EF_PARISC_TRAPNIL 0x00010000 - -/* .PARISC.archext section is present. */ -#define EF_PARISC_EXT 0x00020000 - -/* Program expects little-endian mode. */ -#define EF_PARISC_LSB 0x00040000 - -/* Program expects wide mode. */ -#define EF_PARISC_WIDE 0x00080000 - -/* Do not allow kernel-assisted branch prediction. */ -#define EF_PARISC_NO_KABP 0x00100000 - -/* Allow lazy swap for dynamically allocated program segments. */ -#define EF_PARISC_LAZYSWAP 0x00400000 - -/* Architecture version */ -#define EF_PARISC_ARCH 0x0000ffff - -#define EFA_PARISC_1_0 0x020b -#define EFA_PARISC_1_1 0x0210 -#define EFA_PARISC_2_0 0x0214 - -/* Special section indices. */ -/* A symbol that has been declared as a tentative definition in an ANSI C - compilation. */ -#define SHN_PARISC_ANSI_COMMON 0xff00 - -/* A symbol that has been declared as a common block using the - huge memory model. */ -#define SHN_PARISC_HUGE_COMMON 0xff01 - -/* Processor specific section types. */ - -/* Section contains product specific extension bits. */ -#define SHT_PARISC_EXT 0x70000000 - -/* Section contains unwind table entries. */ -#define SHT_PARISC_UNWIND 0x70000001 - -/* Section contains debug information for optimized code. */ -#define SHT_PARISC_DOC 0x70000002 - -/* Section contains code annotations. */ -#define SHT_PARISC_ANNOT 0x70000003 - -/* These are strictly for compatibility with the older elf32-hppa - implementation. Hopefully we can eliminate them in the future. */ -/* Optional section holding argument location/relocation info. */ -#define SHT_PARISC_SYMEXTN SHT_LOPROC+8 - -/* Option section for linker stubs. */ -#define SHT_PARISC_STUBS SHT_LOPROC+9 - -/* Processor specific section flags. */ - -/* Section contains code compiled for static branch prediction. */ -#define SHF_PARISC_SBP 0x80000000 - -/* Section should be allocated from from GP. */ -#define SHF_PARISC_HUGE 0x40000000 - -/* Section should go near GP. */ -#define SHF_PARISC_SHORT 0x20000000 - - -/* Identifies the entry point of a millicode routine. */ -#define STT_PARISC_MILLI 13 - -/* ELF/HPPA relocation types */ - -/* Note: PA-ELF is defined to use only RELA relocations. */ -#include "elf/reloc-macros.h" - -START_RELOC_NUMBERS (elf_hppa_reloc_type) -RELOC_NUMBER (R_PARISC_NONE, 0) /* No reloc */ - -/* Data / Inst. Format Relocation Expression */ - -RELOC_NUMBER (R_PARISC_DIR32, 1) -/* 32-bit word symbol + addend */ - -RELOC_NUMBER (R_PARISC_DIR21L, 2) -/* long immediate (7) LR(symbol, addend) */ - -RELOC_NUMBER (R_PARISC_DIR17R, 3) -/* branch external (19) RR(symbol, addend) */ - -RELOC_NUMBER (R_PARISC_DIR17F, 4) -/* branch external (19) symbol + addend */ - -RELOC_NUMBER (R_PARISC_DIR14R, 6) -/* load/store (1) RR(symbol, addend) */ - -RELOC_NUMBER (R_PARISC_DIR14F, 7) -/* load/store (1) symbol, addend */ - -/* PC-relative relocation types - Typically used for calls. - Note PCREL17C and PCREL17F differ only in overflow handling. - PCREL17C never reports a relocation error. - - When supporting argument relocations, function calls must be - accompanied by parameter relocation information. This information is - carried in the ten high-order bits of the addend field. The remaining - 22 bits of of the addend field are sign-extended to form the Addend. - - Note the code to build argument relocations depends on the - addend being zero. A consequence of this limitation is GAS - can not perform relocation reductions for function symbols. */ - -RELOC_NUMBER (R_PARISC_PCREL12F, 8) -/* op & branch (17) symbol - PC - 8 + addend */ - -RELOC_NUMBER (R_PARISC_PCREL32, 9) -/* 32-bit word symbol - PC - 8 + addend */ - -RELOC_NUMBER (R_PARISC_PCREL21L, 10) -/* long immediate (7) L(symbol - PC - 8 + addend) */ - -RELOC_NUMBER (R_PARISC_PCREL17R, 11) -/* branch external (19) R(symbol - PC - 8 + addend) */ - -RELOC_NUMBER (R_PARISC_PCREL17F, 12) -/* branch (20) symbol - PC - 8 + addend */ - -RELOC_NUMBER (R_PARISC_PCREL17C, 13) -/* branch (20) symbol - PC - 8 + addend */ - -RELOC_NUMBER (R_PARISC_PCREL14R, 14) -/* load/store (1) R(symbol - PC - 8 + addend) */ - -RELOC_NUMBER (R_PARISC_PCREL14F, 15) -/* load/store (1) symbol - PC - 8 + addend */ - - -/* DP-relative relocation types. */ -RELOC_NUMBER (R_PARISC_DPREL21L, 18) -/* long immediate (7) LR(symbol - GP, addend) */ - -RELOC_NUMBER (R_PARISC_DPREL14WR, 19) -/* load/store mod. comp. (2) RR(symbol - GP, addend) */ - -RELOC_NUMBER (R_PARISC_DPREL14DR, 20) -/* load/store doubleword (3) RR(symbol - GP, addend) */ - -RELOC_NUMBER (R_PARISC_DPREL14R, 22) -/* load/store (1) RR(symbol - GP, addend) */ - -RELOC_NUMBER (R_PARISC_DPREL14F, 23) -/* load/store (1) symbol - GP + addend */ - - -/* Data linkage table (DLT) relocation types - - SOM DLT_REL fixup requests are used to for static data references - from position-independent code within shared libraries. They are - similar to the GOT relocation types in some SVR4 implementations. */ - -RELOC_NUMBER (R_PARISC_DLTREL21L, 26) -/* long immediate (7) LR(symbol - GP, addend) */ - -RELOC_NUMBER (R_PARISC_DLTREL14R, 30) -/* load/store (1) RR(symbol - GP, addend) */ - -RELOC_NUMBER (R_PARISC_DLTREL14F, 31) -/* load/store (1) symbol - GP + addend */ - - -/* DLT indirect relocation types */ -RELOC_NUMBER (R_PARISC_DLTIND21L, 34) -/* long immediate (7) L(ltoff(symbol + addend)) */ - -RELOC_NUMBER (R_PARISC_DLTIND14R, 38) -/* load/store (1) R(ltoff(symbol + addend)) */ - -RELOC_NUMBER (R_PARISC_DLTIND14F, 39) -/* load/store (1) ltoff(symbol + addend) */ - - -/* Base relative relocation types. Ugh. These imply lots of state */ -RELOC_NUMBER (R_PARISC_SETBASE, 40) -/* none no reloc; base := sym */ - -RELOC_NUMBER (R_PARISC_SECREL32, 41) -/* 32-bit word symbol - SECT + addend */ - -RELOC_NUMBER (R_PARISC_BASEREL21L, 42) -/* long immediate (7) LR(symbol - base, addend) */ - -RELOC_NUMBER (R_PARISC_BASEREL17R, 43) -/* branch external (19) RR(symbol - base, addend) */ - -RELOC_NUMBER (R_PARISC_BASEREL17F, 44) -/* branch external (19) symbol - base + addend */ - -RELOC_NUMBER (R_PARISC_BASEREL14R, 46) -/* load/store (1) RR(symbol - base, addend) */ - -RELOC_NUMBER (R_PARISC_BASEREL14F, 47) -/* load/store (1) symbol - base, addend */ - - -/* Segment relative relocation types. */ -RELOC_NUMBER (R_PARISC_SEGBASE, 48) -/* none no relocation; SB := sym */ - -RELOC_NUMBER (R_PARISC_SEGREL32, 49) -/* 32-bit word symbol - SB + addend */ - - -/* Offsets from the PLT. */ -RELOC_NUMBER (R_PARISC_PLTOFF21L, 50) -/* long immediate (7) LR(pltoff(symbol), addend) */ - -RELOC_NUMBER (R_PARISC_PLTOFF14R, 54) -/* load/store (1) RR(pltoff(symbol), addend) */ - -RELOC_NUMBER (R_PARISC_PLTOFF14F, 55) -/* load/store (1) pltoff(symbol) + addend */ - - -RELOC_NUMBER (R_PARISC_LTOFF_FPTR32, 57) -/* 32-bit word ltoff(fptr(symbol+addend)) */ - -RELOC_NUMBER (R_PARISC_LTOFF_FPTR21L, 58) -/* long immediate (7) L(ltoff(fptr(symbol+addend))) */ - -RELOC_NUMBER (R_PARISC_LTOFF_FPTR14R, 62) -/* load/store (1) R(ltoff(fptr(symbol+addend))) */ - - -RELOC_NUMBER (R_PARISC_FPTR64, 64) -/* 64-bit doubleword fptr(symbol+addend) */ - - -/* Plabel relocation types. */ -RELOC_NUMBER (R_PARISC_PLABEL32, 65) -/* 32-bit word fptr(symbol) */ - -RELOC_NUMBER (R_PARISC_PLABEL21L, 66) -/* long immediate (7) L(fptr(symbol)) */ - -RELOC_NUMBER (R_PARISC_PLABEL14R, 70) -/* load/store (1) R(fptr(symbol)) */ - - -/* PCREL relocations. */ -RELOC_NUMBER (R_PARISC_PCREL64, 72) -/* 64-bit doubleword symbol - PC - 8 + addend */ - -RELOC_NUMBER (R_PARISC_PCREL22C, 73) -/* branch & link (21) symbol - PC - 8 + addend */ - -RELOC_NUMBER (R_PARISC_PCREL22F, 74) -/* branch & link (21) symbol - PC - 8 + addend */ - -RELOC_NUMBER (R_PARISC_PCREL14WR, 75) -/* load/store mod. comp. (2) R(symbol - PC - 8 + addend) */ - -RELOC_NUMBER (R_PARISC_PCREL14DR, 76) -/* load/store doubleword (3) R(symbol - PC - 8 + addend) */ - -RELOC_NUMBER (R_PARISC_PCREL16F, 77) -/* load/store (1) symbol - PC - 8 + addend */ - -RELOC_NUMBER (R_PARISC_PCREL16WF, 78) -/* load/store mod. comp. (2) symbol - PC - 8 + addend */ - -RELOC_NUMBER (R_PARISC_PCREL16DF, 79) -/* load/store doubleword (3) symbol - PC - 8 + addend */ - - -RELOC_NUMBER (R_PARISC_DIR64, 80) -/* 64-bit doubleword symbol + addend */ - -RELOC_NUMBER (R_PARISC_DIR64WR, 81) -/* 64-bit doubleword RR(symbol, addend) */ - -RELOC_NUMBER (R_PARISC_DIR64DR, 82) -/* 64-bit doubleword RR(symbol, addend) */ - -RELOC_NUMBER (R_PARISC_DIR14WR, 83) -/* load/store mod. comp. (2) RR(symbol, addend) */ - -RELOC_NUMBER (R_PARISC_DIR14DR, 84) -/* load/store doubleword (3) RR(symbol, addend) */ - -RELOC_NUMBER (R_PARISC_DIR16F, 85) -/* load/store (1) symbol + addend */ - -RELOC_NUMBER (R_PARISC_DIR16WF, 86) -/* load/store mod. comp. (2) symbol + addend */ - -RELOC_NUMBER (R_PARISC_DIR16DF, 87) -/* load/store doubleword (3) symbol + addend */ - -RELOC_NUMBER (R_PARISC_GPREL64, 88) -/* 64-bit doubleword symbol - GP + addend */ - -RELOC_NUMBER (R_PARISC_DLTREL14WR, 91) -/* load/store mod. comp. (2) RR(symbol - GP, addend) */ - -RELOC_NUMBER (R_PARISC_DLTREL14DR, 92) -/* load/store doubleword (3) RR(symbol - GP, addend) */ - -RELOC_NUMBER (R_PARISC_GPREL16F, 93) -/* load/store (1) symbol - GP + addend */ - -RELOC_NUMBER (R_PARISC_GPREL16WF, 94) -/* load/store mod. comp. (2) symbol - GP + addend */ - -RELOC_NUMBER (R_PARISC_GPREL16DF, 95) -/* load/store doubleword (3) symbol - GP + addend */ - - -RELOC_NUMBER (R_PARISC_LTOFF64, 96) -/* 64-bit doubleword ltoff(symbol + addend) */ - -RELOC_NUMBER (R_PARISC_DLTIND14WR, 99) -/* load/store mod. comp. (2) R(ltoff(symbol + addend)) */ - -RELOC_NUMBER (R_PARISC_DLTIND14DR, 100) -/* load/store doubleword (3) R(ltoff(symbol + addend)) */ - -RELOC_NUMBER (R_PARISC_LTOFF16F, 101) -/* load/store (1) ltoff(symbol + addend) */ - -RELOC_NUMBER (R_PARISC_LTOFF16WF, 102) -/* load/store mod. comp. (2) ltoff(symbol + addend) */ - -RELOC_NUMBER (R_PARISC_LTOFF16DF, 103) -/* load/store doubleword (3) ltoff(symbol + addend) */ - - -RELOC_NUMBER (R_PARISC_SECREL64, 104) -/* 64-bit doubleword symbol - SECT + addend */ - -RELOC_NUMBER (R_PARISC_BASEREL14WR, 107) -/* load/store mod. comp. (2) RR(symbol - base, addend) */ - -RELOC_NUMBER (R_PARISC_BASEREL14DR, 108) -/* load/store doubleword (3) RR(symbol - base, addend) */ - - -RELOC_NUMBER (R_PARISC_SEGREL64, 112) -/* 64-bit doubleword symbol - SB + addend */ - -RELOC_NUMBER (R_PARISC_PLTOFF14WR, 115) -/* load/store mod. comp. (2) RR(pltoff(symbol), addend) */ - -RELOC_NUMBER (R_PARISC_PLTOFF14DR, 116) -/* load/store doubleword (3) RR(pltoff(symbol), addend) */ - -RELOC_NUMBER (R_PARISC_PLTOFF16F, 117) -/* load/store (1) pltoff(symbol) + addend */ - -RELOC_NUMBER (R_PARISC_PLTOFF16WF, 118) -/* load/store mod. comp. (2) pltoff(symbol) + addend */ - -RELOC_NUMBER (R_PARISC_PLTOFF16DF, 119) -/* load/store doubleword (3) pltoff(symbol) + addend */ - - -RELOC_NUMBER (R_PARISC_LTOFF_FPTR64, 120) -/* 64-bit doubleword ltoff(fptr(symbol+addend)) */ - -RELOC_NUMBER (R_PARISC_LTOFF_FPTR14WR, 123) -/* load/store mod. comp. (2) R(ltoff(fptr(symbol+addend))) */ - -RELOC_NUMBER (R_PARISC_LTOFF_FPTR14DR, 124) -/* load/store doubleword (3) R(ltoff(fptr(symbol+addend))) */ - -RELOC_NUMBER (R_PARISC_LTOFF_FPTR16F, 125) -/* load/store (1) ltoff(fptr(symbol+addend)) */ - -RELOC_NUMBER (R_PARISC_LTOFF_FPTR16WF, 126) -/* load/store mod. comp. (2) ltoff(fptr(symbol+addend)) */ - -RELOC_NUMBER (R_PARISC_LTOFF_FPTR16DF, 127) -/* load/store doubleword (3) ltoff(fptr(symbol+addend)) */ - - -RELOC_NUMBER (R_PARISC_COPY, 128) -/* data Dynamic relocations only */ - -RELOC_NUMBER (R_PARISC_IPLT, 129) -/* plt */ - -RELOC_NUMBER (R_PARISC_EPLT, 130) -/* plt */ - - -RELOC_NUMBER (R_PARISC_TPREL32, 153) -/* 32-bit word symbol - TP + addend */ - -RELOC_NUMBER (R_PARISC_TPREL21L, 154) -/* long immediate (7) LR(symbol - TP, addend) */ - -RELOC_NUMBER (R_PARISC_TPREL14R, 158) -/* load/store (1) RR(symbol - TP, addend) */ - - -RELOC_NUMBER (R_PARISC_LTOFF_TP21L, 162) -/* long immediate (7) L(ltoff(symbol - TP + addend)) */ - -RELOC_NUMBER (R_PARISC_LTOFF_TP14R, 166) -/* load/store (1) R(ltoff(symbol - TP + addend)) */ - -RELOC_NUMBER (R_PARISC_LTOFF_TP14F, 167) -/* load/store (1) ltoff(symbol - TP + addend) */ - - -RELOC_NUMBER (R_PARISC_TPREL64, 216) -/* 64-bit word symbol - TP + addend */ - -RELOC_NUMBER (R_PARISC_TPREL14WR, 219) -/* load/store mod. comp. (2) RR(symbol - TP, addend) */ - -RELOC_NUMBER (R_PARISC_TPREL14DR, 220) -/* load/store doubleword (3) RR(symbol - TP, addend) */ - -RELOC_NUMBER (R_PARISC_TPREL16F, 221) -/* load/store (1) symbol - TP + addend */ - -RELOC_NUMBER (R_PARISC_TPREL16WF, 222) -/* load/store mod. comp. (2) symbol - TP + addend */ - -RELOC_NUMBER (R_PARISC_TPREL16DF, 223) -/* load/store doubleword (3) symbol - TP + addend */ - - -RELOC_NUMBER (R_PARISC_LTOFF_TP64, 224) -/* 64-bit doubleword ltoff(symbol - TP + addend) */ - -RELOC_NUMBER (R_PARISC_LTOFF_TP14WR, 227) -/* load/store mod. comp. (2) R(ltoff(symbol - TP + addend)) */ - -RELOC_NUMBER (R_PARISC_LTOFF_TP14DR, 228) -/* load/store doubleword (3) R(ltoff(symbol - TP + addend)) */ - -RELOC_NUMBER (R_PARISC_LTOFF_TP16F, 229) -/* load/store (1) ltoff(symbol - TP + addend) */ - -RELOC_NUMBER (R_PARISC_LTOFF_TP16WF, 230) -/* load/store mod. comp. (2) ltoff(symbol - TP + addend) */ - -RELOC_NUMBER (R_PARISC_LTOFF_TP16DF, 231) -/* load/store doubleword (3) ltoff(symbol - TP + addend) */ - -RELOC_NUMBER (R_PARISC_GNU_VTENTRY, 232) -RELOC_NUMBER (R_PARISC_GNU_VTINHERIT, 233) - -END_RELOC_NUMBERS (R_PARISC_UNIMPLEMENTED) - -#ifndef RELOC_MACROS_GEN_FUNC -typedef enum elf_hppa_reloc_type elf_hppa_reloc_type; -#endif - -#define PT_PARISC_ARCHEXT 0x70000000 -#define PT_PARISC_UNWIND 0x70000001 -#define PF_PARISC_SBP 0x08000000 -#define PF_HP_PAGE_SIZE 0x00100000 -#define PF_HP_FAR_SHARED 0x00200000 -#define PF_HP_NEAR_SHARED 0x00400000 -#define PF_HP_CODE 0x01000000 -#define PF_HP_MODIFY 0x02000000 -#define PF_HP_LAZYSWAP 0x04000000 -#define PF_HP_SBP 0x08000000 - - -/* Processor specific dynamic array tags. */ - -/* Arggh. HP's tools define these symbols based on the - old value of DT_LOOS. So we must do the same to be - compatible. */ -#define DT_HP_LOAD_MAP (OLD_DT_LOOS + 0x0) -#define DT_HP_DLD_FLAGS (OLD_DT_LOOS + 0x1) -#define DT_HP_DLD_HOOK (OLD_DT_LOOS + 0x2) -#define DT_HP_UX10_INIT (OLD_DT_LOOS + 0x3) -#define DT_HP_UX10_INITSZ (OLD_DT_LOOS + 0x4) -#define DT_HP_PREINIT (OLD_DT_LOOS + 0x5) -#define DT_HP_PREINITSZ (OLD_DT_LOOS + 0x6) -#define DT_HP_NEEDED (OLD_DT_LOOS + 0x7) -#define DT_HP_TIME_STAMP (OLD_DT_LOOS + 0x8) -#define DT_HP_CHECKSUM (OLD_DT_LOOS + 0x9) -#define DT_HP_GST_SIZE (OLD_DT_LOOS + 0xa) -#define DT_HP_GST_VERSION (OLD_DT_LOOS + 0xb) -#define DT_HP_GST_HASHVAL (OLD_DT_LOOS + 0xc) - -/* Values for DT_HP_DLD_FLAGS. */ -#define DT_HP_DEBUG_PRIVATE 0x0001 /* Map text private */ -#define DT_HP_DEBUG_CALLBACK 0x0002 /* Callback */ -#define DT_HP_DEBUG_CALLBACK_BOR 0x0004 /* BOR callback */ -#define DT_HP_NO_ENVVAR 0x0008 /* No env var */ -#define DT_HP_BIND_NOW 0x0010 /* Bind now */ -#define DT_HP_BIND_NONFATAL 0x0020 /* Bind non-fatal */ -#define DT_HP_BIND_VERBOSE 0x0040 /* Bind verbose */ -#define DT_HP_BIND_RESTRICTED 0x0080 /* Bind restricted */ -#define DT_HP_BIND_SYMBOLIC 0x0100 /* Bind symbolic */ -#define DT_HP_RPATH_FIRST 0x0200 /* RPATH first */ -#define DT_HP_BIND_DEPTH_FIRST 0x0400 /* Bind depth-first */ - -/* Program header extensions. */ -#define PT_HP_TLS (PT_LOOS + 0x0) -#define PT_HP_CORE_NONE (PT_LOOS + 0x1) -#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) -#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) -#define PT_HP_CORE_COMM (PT_LOOS + 0x4) -#define PT_HP_CORE_PROC (PT_LOOS + 0x5) -#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) -#define PT_HP_CORE_STACK (PT_LOOS + 0x7) -#define PT_HP_CORE_SHM (PT_LOOS + 0x8) -#define PT_HP_CORE_MMF (PT_LOOS + 0x9) -#define PT_HP_PARALLEL (PT_LOOS + 0x10) -#define PT_HP_FASTBIND (PT_LOOS + 0x11) - -/* Additional symbol types. */ -#define STT_HP_OPAQUE (STT_LOOS + 0x1) -#define STT_HP_STUB (STT_LOOS + 0x2) - -#endif /* _ELF_HPPA_H */ diff --git a/contrib/binutils/include/elf/i370.h b/contrib/binutils/include/elf/i370.h deleted file mode 100644 index b6f478535a5f..000000000000 --- a/contrib/binutils/include/elf/i370.h +++ /dev/null @@ -1,46 +0,0 @@ -/* i370 ELF support for BFD. - Copyright 2000 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file holds definitions specific to the i370 ELF ABI. Note - that most of this is not actually implemented by BFD. */ - -#ifndef _ELF_I370_H -#define _ELF_I370_H - -/* Processor specific section headers, sh_type field */ - -#define SHT_ORDERED SHT_HIPROC /* Link editor is to sort the \ - entries in this section \ - based on the address \ - specified in the associated \ - symbol table entry. */ - -#define EF_I370_RELOCATABLE 0x00010000 /* i370 -mrelocatable flag */ -#define EF_I370_RELOCATABLE_LIB 0x00008000 /* i370 -mrelocatable-lib flag */ -/* Processor specific section flags, sh_flags field */ - -#define SHF_EXCLUDE 0x80000000 /* Link editor is to exclude \ - this section from executable \ - and shared objects that it \ - builds when those objects \ - are not to be furhter \ - relocated. */ -#endif /* _ELF_I370_H */ - - diff --git a/contrib/binutils/include/elf/i860.h b/contrib/binutils/include/elf/i860.h deleted file mode 100644 index de34aeb01410..000000000000 --- a/contrib/binutils/include/elf/i860.h +++ /dev/null @@ -1,66 +0,0 @@ -/* i860 ELF support for BFD. - Copyright 2000 Free Software Foundation, Inc. - - Contributed by Jason Eckhardt <jle@cygnus.com>. - - This file is part of BFD, the Binary File Descriptor library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _ELF_I860_H -#define _ELF_I860_H - -/* Note: i860 ELF is defined to use only RELA relocations. */ - -#include "elf/reloc-macros.h" - -START_RELOC_NUMBERS (elf_i860_reloc_type) - RELOC_NUMBER (R_860_NONE, 0x00) /* No reloc */ - RELOC_NUMBER (R_860_32, 0x01) /* S+A */ - RELOC_NUMBER (R_860_COPY, 0x02) /* No calculation */ - RELOC_NUMBER (R_860_GLOB_DAT, 0x03) /* S, Create GOT entry */ - RELOC_NUMBER (R_860_JUMP_SLOT, 0x04) /* S+A, Create PLT entry */ - RELOC_NUMBER (R_860_RELATIVE, 0x05) /* B+A, Adj by program base */ - RELOC_NUMBER (R_860_PC26, 0x30) /* (S+A-P) >> 2 */ - RELOC_NUMBER (R_860_PLT26, 0x31) /* (L+A-P) >> 2 */ - RELOC_NUMBER (R_860_PC16, 0x32) /* (S+A-P) >> 2 */ - RELOC_NUMBER (R_860_LOW0, 0x40) /* S+A */ - RELOC_NUMBER (R_860_SPLIT0, 0x42) /* S+A */ - RELOC_NUMBER (R_860_LOW1, 0x44) /* S+A */ - RELOC_NUMBER (R_860_SPLIT1, 0x46) /* S+A */ - RELOC_NUMBER (R_860_LOW2, 0x48) /* S+A */ - RELOC_NUMBER (R_860_SPLIT2, 0x4A) /* S+A */ - RELOC_NUMBER (R_860_LOW3, 0x4C) /* S+A */ - RELOC_NUMBER (R_860_LOGOT0, 0x50) /* G */ - RELOC_NUMBER (R_860_SPGOT0, 0x52) /* G */ - RELOC_NUMBER (R_860_LOGOT1, 0x54) /* G */ - RELOC_NUMBER (R_860_SPGOT1, 0x56) /* G */ - RELOC_NUMBER (R_860_LOGOTOFF0, 0x60) /* O */ - RELOC_NUMBER (R_860_SPGOTOFF0, 0x62) /* O */ - RELOC_NUMBER (R_860_LOGOTOFF1, 0x64) /* O */ - RELOC_NUMBER (R_860_SPGOTOFF1, 0x66) /* O */ - RELOC_NUMBER (R_860_LOGOTOFF2, 0x68) /* O */ - RELOC_NUMBER (R_860_LOGOTOFF3, 0x6C) /* O */ - RELOC_NUMBER (R_860_LOPC, 0x70) /* (S+A-P) >> 2 */ - RELOC_NUMBER (R_860_HIGHADJ, 0x80) /* hiadj(S+A) */ - RELOC_NUMBER (R_860_HAGOT, 0x90) /* hiadj(G) */ - RELOC_NUMBER (R_860_HAGOTOFF, 0xA0) /* hiadj(O) */ - RELOC_NUMBER (R_860_HAPC, 0xB0) /* hiadj((S+A-P) >> 2) */ - RELOC_NUMBER (R_860_HIGH, 0xC0) /* (S+A) >> 16 */ - RELOC_NUMBER (R_860_HIGOT, 0xD0) /* G >> 16 */ - RELOC_NUMBER (R_860_HIGOTOFF, 0xE0) /* O */ -END_RELOC_NUMBERS (R_860_max) - -#endif diff --git a/contrib/binutils/include/elf/i960.h b/contrib/binutils/include/elf/i960.h deleted file mode 100644 index 253e438522d7..000000000000 --- a/contrib/binutils/include/elf/i960.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Intel 960 ELF support for BFD. - Copyright 1999, 2000 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _ELF_I960_H -#define _ELF_I960_H - -#include "elf/reloc-macros.h" - - -START_RELOC_NUMBERS (elf_i960_reloc_type) - RELOC_NUMBER (R_960_NONE, 0) - RELOC_NUMBER (R_960_12, 1) - RELOC_NUMBER (R_960_32, 2) - RELOC_NUMBER (R_960_IP24, 3) - RELOC_NUMBER (R_960_SUB, 4) - RELOC_NUMBER (R_960_OPTCALL, 5) - RELOC_NUMBER (R_960_OPTCALLX, 6) - RELOC_NUMBER (R_960_OPTCALLXA, 7) -END_RELOC_NUMBERS (R_960_max) - -#endif /* _ELF_I960_H */ diff --git a/contrib/binutils/include/elf/m32r.h b/contrib/binutils/include/elf/m32r.h deleted file mode 100644 index 2cb308d3a946..000000000000 --- a/contrib/binutils/include/elf/m32r.h +++ /dev/null @@ -1,67 +0,0 @@ -/* M32R ELF support for BFD. - Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _ELF_M32R_H -#define _ELF_M32R_H - -#include "elf/reloc-macros.h" - -/* Relocations. */ -START_RELOC_NUMBERS (elf_m32r_reloc_type) - RELOC_NUMBER (R_M32R_NONE, 0) - RELOC_NUMBER (R_M32R_16, 1) - RELOC_NUMBER (R_M32R_32, 2) - RELOC_NUMBER (R_M32R_24, 3) - RELOC_NUMBER (R_M32R_10_PCREL, 4) - RELOC_NUMBER (R_M32R_18_PCREL, 5) - RELOC_NUMBER (R_M32R_26_PCREL, 6) - RELOC_NUMBER (R_M32R_HI16_ULO, 7) - RELOC_NUMBER (R_M32R_HI16_SLO, 8) - RELOC_NUMBER (R_M32R_LO16, 9) - RELOC_NUMBER (R_M32R_SDA16, 10) - RELOC_NUMBER (R_M32R_GNU_VTINHERIT, 11) - RELOC_NUMBER (R_M32R_GNU_VTENTRY, 12) -END_RELOC_NUMBERS (R_M32R_max) - -/* Processor specific section indices. These sections do not actually - exist. Symbols with a st_shndx field corresponding to one of these - values have a special meaning. */ - -/* Small common symbol. */ -#define SHN_M32R_SCOMMON 0xff00 - -/* Processor specific section flags. */ - -/* This section contains sufficient relocs to be relaxed. - When relaxing, even relocs of branch instructions the assembler could - complete must be present because relaxing may cause the branch target to - move. */ -#define SHF_M32R_CAN_RELAX 0x10000000 - -/* Processor specific flags for the ELF header e_flags field. */ - -/* Two bit m32r architecture field. */ -#define EF_M32R_ARCH 0x30000000 - -/* m32r code. */ -#define E_M32R_ARCH 0x00000000 -/* m32rx code. */ -#define E_M32RX_ARCH 0x10000000 - -#endif diff --git a/contrib/binutils/include/elf/m68hc11.h b/contrib/binutils/include/elf/m68hc11.h deleted file mode 100644 index 0f9546d74041..000000000000 --- a/contrib/binutils/include/elf/m68hc11.h +++ /dev/null @@ -1,42 +0,0 @@ -/* m68hc11 & m68hc12 ELF support for BFD. - Copyright 1999, 2000 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _ELF_M68HC11_H -#define _ELF_M68HC11_H - -#include "elf/reloc-macros.h" - -/* Relocation types. */ -START_RELOC_NUMBERS (elf_m68hc11_reloc_type) - RELOC_NUMBER (R_M68HC11_NONE, 0) - RELOC_NUMBER (R_M68HC11_8, 1) - RELOC_NUMBER (R_M68HC11_HI8, 2) - RELOC_NUMBER (R_M68HC11_LO8, 3) - RELOC_NUMBER (R_M68HC11_PCREL_8, 4) - RELOC_NUMBER (R_M68HC11_16, 5) - RELOC_NUMBER (R_M68HC11_32, 6) - RELOC_NUMBER (R_M68HC11_3B, 7) - RELOC_NUMBER (R_M68HC11_PCREL_16, 8) - - /* These are GNU extensions to enable C++ vtable garbage collection. */ - RELOC_NUMBER (R_M68HC11_GNU_VTINHERIT, 9) - RELOC_NUMBER (R_M68HC11_GNU_VTENTRY, 10) -END_RELOC_NUMBERS (R_M68HC11_max) - -#endif diff --git a/contrib/binutils/include/elf/m68k.h b/contrib/binutils/include/elf/m68k.h deleted file mode 100644 index 03bf465e2b0c..000000000000 --- a/contrib/binutils/include/elf/m68k.h +++ /dev/null @@ -1,57 +0,0 @@ -/* MC68k ELF support for BFD. - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _ELF_M68K_H -#define _ELF_M68K_H - -#include "elf/reloc-macros.h" - -/* Relocation types. */ -START_RELOC_NUMBERS (elf_m68k_reloc_type) - RELOC_NUMBER (R_68K_NONE, 0) /* No reloc */ - RELOC_NUMBER (R_68K_32, 1) /* Direct 32 bit */ - RELOC_NUMBER (R_68K_16, 2) /* Direct 16 bit */ - RELOC_NUMBER (R_68K_8, 3) /* Direct 8 bit */ - RELOC_NUMBER (R_68K_PC32, 4) /* PC relative 32 bit */ - RELOC_NUMBER (R_68K_PC16, 5) /* PC relative 16 bit */ - RELOC_NUMBER (R_68K_PC8, 6) /* PC relative 8 bit */ - RELOC_NUMBER (R_68K_GOT32, 7) /* 32 bit PC relative GOT entry */ - RELOC_NUMBER (R_68K_GOT16, 8) /* 16 bit PC relative GOT entry */ - RELOC_NUMBER (R_68K_GOT8, 9) /* 8 bit PC relative GOT entry */ - RELOC_NUMBER (R_68K_GOT32O, 10) /* 32 bit GOT offset */ - RELOC_NUMBER (R_68K_GOT16O, 11) /* 16 bit GOT offset */ - RELOC_NUMBER (R_68K_GOT8O, 12) /* 8 bit GOT offset */ - RELOC_NUMBER (R_68K_PLT32, 13) /* 32 bit PC relative PLT address */ - RELOC_NUMBER (R_68K_PLT16, 14) /* 16 bit PC relative PLT address */ - RELOC_NUMBER (R_68K_PLT8, 15) /* 8 bit PC relative PLT address */ - RELOC_NUMBER (R_68K_PLT32O, 16) /* 32 bit PLT offset */ - RELOC_NUMBER (R_68K_PLT16O, 17) /* 16 bit PLT offset */ - RELOC_NUMBER (R_68K_PLT8O, 18) /* 8 bit PLT offset */ - RELOC_NUMBER (R_68K_COPY, 19) /* Copy symbol at runtime */ - RELOC_NUMBER (R_68K_GLOB_DAT, 20) /* Create GOT entry */ - RELOC_NUMBER (R_68K_JMP_SLOT, 21) /* Create PLT entry */ - RELOC_NUMBER (R_68K_RELATIVE, 22) /* Adjust by program base */ - /* These are GNU extensions to enable C++ vtable garbage collection. */ - RELOC_NUMBER (R_68K_GNU_VTINHERIT, 23) - RELOC_NUMBER (R_68K_GNU_VTENTRY, 24) -END_RELOC_NUMBERS (R_68K_max) - -#define EF_CPU32 0x00810000 - -#endif diff --git a/contrib/binutils/include/elf/mcore.h b/contrib/binutils/include/elf/mcore.h deleted file mode 100644 index 387a57d45177..000000000000 --- a/contrib/binutils/include/elf/mcore.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Motorola MCore support for BFD. - Copyright 1995, 1999, 2000 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file holds definitions specific to the MCore ELF ABI. */ -#ifndef _ELF_MORE_H -#define _ELF_MORE_H - -#include "elf/reloc-macros.h" - -/* Relocations. */ -START_RELOC_NUMBERS (elf_mcore_reloc_type) - RELOC_NUMBER (R_MCORE_NONE, 0) - RELOC_NUMBER (R_MCORE_ADDR32, 1) - RELOC_NUMBER (R_MCORE_PCRELIMM8BY4, 2) - RELOC_NUMBER (R_MCORE_PCRELIMM11BY2, 3) - RELOC_NUMBER (R_MCORE_PCRELIMM4BY2, 4) - RELOC_NUMBER (R_MCORE_PCREL32, 5) - RELOC_NUMBER (R_MCORE_PCRELJSR_IMM11BY2, 6) - RELOC_NUMBER (R_MCORE_GNU_VTINHERIT, 7) - RELOC_NUMBER (R_MCORE_GNU_VTENTRY, 8) - RELOC_NUMBER (R_MCORE_RELATIVE, 9) - RELOC_NUMBER (R_MCORE_COPY, 10) - RELOC_NUMBER (R_MCORE_GLOB_DAT, 11) - RELOC_NUMBER (R_MCORE_JUMP_SLOT, 12) -END_RELOC_NUMBERS (R_MCORE_max) - -/* Section Attributes. */ -#define SHF_MCORE_NOREAD 0x80000000 - -#endif /* _ELF_MCORE_H */ diff --git a/contrib/binutils/include/elf/mips.h b/contrib/binutils/include/elf/mips.h deleted file mode 100644 index 6ad8d5b96b1e..000000000000 --- a/contrib/binutils/include/elf/mips.h +++ /dev/null @@ -1,965 +0,0 @@ -/* MIPS ELF support for BFD. - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. - - By Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>, from - information in the System V Application Binary Interface, MIPS - Processor Supplement. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file holds definitions specific to the MIPS ELF ABI. Note - that most of this is not actually implemented by BFD. */ - -#ifndef _ELF_MIPS_H -#define _ELF_MIPS_H - -#include "elf/reloc-macros.h" - -/* Relocation types. */ -START_RELOC_NUMBERS (elf_mips_reloc_type) - RELOC_NUMBER (R_MIPS_NONE, 0) - RELOC_NUMBER (R_MIPS_16, 1) - RELOC_NUMBER (R_MIPS_32, 2) /* In Elf 64: alias R_MIPS_ADD */ - RELOC_NUMBER (R_MIPS_REL32, 3) /* In Elf 64: alias R_MIPS_REL */ - RELOC_NUMBER (R_MIPS_26, 4) - RELOC_NUMBER (R_MIPS_HI16, 5) - RELOC_NUMBER (R_MIPS_LO16, 6) - RELOC_NUMBER (R_MIPS_GPREL16, 7) /* In Elf 64: alias R_MIPS_GPREL */ - RELOC_NUMBER (R_MIPS_LITERAL, 8) - RELOC_NUMBER (R_MIPS_GOT16, 9) /* In Elf 64: alias R_MIPS_GOT */ - RELOC_NUMBER (R_MIPS_PC16, 10) - RELOC_NUMBER (R_MIPS_CALL16, 11) /* In Elf 64: alias R_MIPS_CALL */ - RELOC_NUMBER (R_MIPS_GPREL32, 12) - /* The remaining relocs are defined on Irix, although they are not - in the MIPS ELF ABI. */ - RELOC_NUMBER (R_MIPS_UNUSED1, 13) - RELOC_NUMBER (R_MIPS_UNUSED2, 14) - RELOC_NUMBER (R_MIPS_UNUSED3, 15) - RELOC_NUMBER (R_MIPS_SHIFT5, 16) - RELOC_NUMBER (R_MIPS_SHIFT6, 17) - RELOC_NUMBER (R_MIPS_64, 18) - RELOC_NUMBER (R_MIPS_GOT_DISP, 19) - RELOC_NUMBER (R_MIPS_GOT_PAGE, 20) - RELOC_NUMBER (R_MIPS_GOT_OFST, 21) - RELOC_NUMBER (R_MIPS_GOT_HI16, 22) - RELOC_NUMBER (R_MIPS_GOT_LO16, 23) - RELOC_NUMBER (R_MIPS_SUB, 24) - RELOC_NUMBER (R_MIPS_INSERT_A, 25) - RELOC_NUMBER (R_MIPS_INSERT_B, 26) - RELOC_NUMBER (R_MIPS_DELETE, 27) - RELOC_NUMBER (R_MIPS_HIGHER, 28) - RELOC_NUMBER (R_MIPS_HIGHEST, 29) - RELOC_NUMBER (R_MIPS_CALL_HI16, 30) - RELOC_NUMBER (R_MIPS_CALL_LO16, 31) - RELOC_NUMBER (R_MIPS_SCN_DISP, 32) - RELOC_NUMBER (R_MIPS_REL16, 33) - RELOC_NUMBER (R_MIPS_ADD_IMMEDIATE, 34) - RELOC_NUMBER (R_MIPS_PJUMP, 35) - RELOC_NUMBER (R_MIPS_RELGOT, 36) - RELOC_NUMBER (R_MIPS_JALR, 37) - RELOC_NUMBER (R_MIPS_max, 38) - /* These relocs are used for the mips16. */ - RELOC_NUMBER (R_MIPS16_26, 100) - RELOC_NUMBER (R_MIPS16_GPREL, 101) - /* These are GNU extensions to handle embedded-pic. */ - RELOC_NUMBER (R_MIPS_PC32, 248) - RELOC_NUMBER (R_MIPS_PC64, 249) - RELOC_NUMBER (R_MIPS_GNU_REL16_S2, 250) - RELOC_NUMBER (R_MIPS_GNU_REL_LO16, 251) - RELOC_NUMBER (R_MIPS_GNU_REL_HI16, 252) - /* These are GNU extensions to enable C++ vtable garbage collection. */ - RELOC_NUMBER (R_MIPS_GNU_VTINHERIT, 253) - RELOC_NUMBER (R_MIPS_GNU_VTENTRY, 254) -END_RELOC_NUMBERS (R_MIPS_maxext) - -/* Processor specific flags for the ELF header e_flags field. */ - -/* At least one .noreorder directive appears in the source. */ -#define EF_MIPS_NOREORDER 0x00000001 - -/* File contains position independent code. */ -#define EF_MIPS_PIC 0x00000002 - -/* Code in file uses the standard calling sequence for calling - position independent code. */ -#define EF_MIPS_CPIC 0x00000004 - -/* Code in file uses UCODE (obsolete) */ -#define EF_MIPS_UCODE 0x00000010 - -/* Code in file uses new ABI (-n32 on Irix 6). */ -#define EF_MIPS_ABI2 0x00000020 - -/* Process the .MIPS.options section first by ld */ -#define EF_MIPS_OPTIONS_FIRST 0x00000080 - -/* Architectural Extensions used by this file */ -#define EF_MIPS_ARCH_ASE 0x0f000000 - -/* Use MDMX multimedia extensions */ -#define EF_MIPS_ARCH_ASE_MDMX 0x08000000 - -/* Use MIPS-16 ISA extensions */ -#define EF_MIPS_ARCH_ASE_M16 0x04000000 - -/* Indicates code compiled for a 64-bit machine in 32-bit mode. - (regs are 32-bits wide.) */ -#define EF_MIPS_32BITMODE 0x00000100 - -/* Four bit MIPS architecture field. */ -#define EF_MIPS_ARCH 0xf0000000 - -/* -mips1 code. */ -#define E_MIPS_ARCH_1 0x00000000 - -/* -mips2 code. */ -#define E_MIPS_ARCH_2 0x10000000 - -/* -mips3 code. */ -#define E_MIPS_ARCH_3 0x20000000 - -/* -mips4 code. */ -#define E_MIPS_ARCH_4 0x30000000 - -/* -mips5 code. */ -#define E_MIPS_ARCH_5 0x40000000 - -/* -mips32 code. */ -#define E_MIPS_ARCH_32 0x50000000 - -/* -mips64 code. */ -#define E_MIPS_ARCH_64 0x60000000 - -/* The ABI of the file. Also see EF_MIPS_ABI2 above. */ -#define EF_MIPS_ABI 0x0000F000 - -/* The original o32 abi. */ -#define E_MIPS_ABI_O32 0x00001000 - -/* O32 extended to work on 64 bit architectures */ -#define E_MIPS_ABI_O64 0x00002000 - -/* EABI in 32 bit mode */ -#define E_MIPS_ABI_EABI32 0x00003000 - -/* EABI in 64 bit mode */ -#define E_MIPS_ABI_EABI64 0x00004000 - - -/* Machine variant if we know it. This field was invented at Cygnus, - but it is hoped that other vendors will adopt it. If some standard - is developed, this code should be changed to follow it. */ - -#define EF_MIPS_MACH 0x00FF0000 - -/* Cygnus is choosing values between 80 and 9F; - 00 - 7F should be left for a future standard; - the rest are open. */ - -#define E_MIPS_MACH_3900 0x00810000 - -#define E_MIPS_MACH_4010 0x00820000 -#define E_MIPS_MACH_4100 0x00830000 -#define E_MIPS_MACH_4650 0x00850000 -#define E_MIPS_MACH_4111 0x00880000 -#define E_MIPS_MACH_MIPS32_4K 0x00890000 -#define E_MIPS_MACH_SB1 0x008a0000 - -/* Processor specific section indices. These sections do not actually - exist. Symbols with a st_shndx field corresponding to one of these - values have a special meaning. */ - -/* Defined and allocated common symbol. Value is virtual address. If - relocated, alignment must be preserved. */ -#define SHN_MIPS_ACOMMON 0xff00 - -/* Defined and allocated text symbol. Value is virtual address. - Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables. */ -#define SHN_MIPS_TEXT 0xff01 - -/* Defined and allocated data symbol. Value is virtual address. - Occur in the dynamic symbol table of Alpha OSF/1 and Irix 5 executables. */ -#define SHN_MIPS_DATA 0xff02 - -/* Small common symbol. */ -#define SHN_MIPS_SCOMMON 0xff03 - -/* Small undefined symbol. */ -#define SHN_MIPS_SUNDEFINED 0xff04 - -/* Processor specific section types. */ - -/* Section contains the set of dynamic shared objects used when - statically linking. */ -#define SHT_MIPS_LIBLIST 0x70000000 - -/* I'm not sure what this is, but it's used on Irix 5. */ -#define SHT_MIPS_MSYM 0x70000001 - -/* Section contains list of symbols whose definitions conflict with - symbols defined in shared objects. */ -#define SHT_MIPS_CONFLICT 0x70000002 - -/* Section contains the global pointer table. */ -#define SHT_MIPS_GPTAB 0x70000003 - -/* Section contains microcode information. The exact format is - unspecified. */ -#define SHT_MIPS_UCODE 0x70000004 - -/* Section contains some sort of debugging information. The exact - format is unspecified. It's probably ECOFF symbols. */ -#define SHT_MIPS_DEBUG 0x70000005 - -/* Section contains register usage information. */ -#define SHT_MIPS_REGINFO 0x70000006 - -/* ??? */ -#define SHT_MIPS_PACKAGE 0x70000007 - -/* ??? */ -#define SHT_MIPS_PACKSYM 0x70000008 - -/* ??? */ -#define SHT_MIPS_RELD 0x70000009 - -/* Section contains interface information. */ -#define SHT_MIPS_IFACE 0x7000000b - -/* Section contains description of contents of another section. */ -#define SHT_MIPS_CONTENT 0x7000000c - -/* Section contains miscellaneous options. */ -#define SHT_MIPS_OPTIONS 0x7000000d - -/* ??? */ -#define SHT_MIPS_SHDR 0x70000010 - -/* ??? */ -#define SHT_MIPS_FDESC 0x70000011 - -/* ??? */ -#define SHT_MIPS_EXTSYM 0x70000012 - -/* ??? */ -#define SHT_MIPS_DENSE 0x70000013 - -/* ??? */ -#define SHT_MIPS_PDESC 0x70000014 - -/* ??? */ -#define SHT_MIPS_LOCSYM 0x70000015 - -/* ??? */ -#define SHT_MIPS_AUXSYM 0x70000016 - -/* ??? */ -#define SHT_MIPS_OPTSYM 0x70000017 - -/* ??? */ -#define SHT_MIPS_LOCSTR 0x70000018 - -/* ??? */ -#define SHT_MIPS_LINE 0x70000019 - -/* ??? */ -#define SHT_MIPS_RFDESC 0x7000001a - -/* Delta C++: symbol table */ -#define SHT_MIPS_DELTASYM 0x7000001b - -/* Delta C++: instance table */ -#define SHT_MIPS_DELTAINST 0x7000001c - -/* Delta C++: class table */ -#define SHT_MIPS_DELTACLASS 0x7000001d - -/* DWARF debugging section. */ -#define SHT_MIPS_DWARF 0x7000001e - -/* Delta C++: declarations */ -#define SHT_MIPS_DELTADECL 0x7000001f - -/* List of libraries the binary depends on. Includes a time stamp, version - number. */ -#define SHT_MIPS_SYMBOL_LIB 0x70000020 - -/* Events section. */ -#define SHT_MIPS_EVENTS 0x70000021 - -/* ??? */ -#define SHT_MIPS_TRANSLATE 0x70000022 - -/* Special pixie sections */ -#define SHT_MIPS_PIXIE 0x70000023 - -/* Address translation table (for debug info) */ -#define SHT_MIPS_XLATE 0x70000024 - -/* SGI internal address translation table (for debug info) */ -#define SHT_MIPS_XLATE_DEBUG 0x70000025 - -/* Intermediate code */ -#define SHT_MIPS_WHIRL 0x70000026 - -/* C++ exception handling region info */ -#define SHT_MIPS_EH_REGION 0x70000027 - -/* Obsolete address translation table (for debug info) */ -#define SHT_MIPS_XLATE_OLD 0x70000028 - -/* Runtime procedure descriptor table exception information (ucode) ??? */ -#define SHT_MIPS_PDR_EXCEPTION 0x70000029 - - -/* A section of type SHT_MIPS_LIBLIST contains an array of the - following structure. The sh_link field is the section index of the - string table. The sh_info field is the number of entries in the - section. */ -typedef struct -{ - /* String table index for name of shared object. */ - unsigned long l_name; - /* Time stamp. */ - unsigned long l_time_stamp; - /* Checksum of symbol names and common sizes. */ - unsigned long l_checksum; - /* String table index for version. */ - unsigned long l_version; - /* Flags. */ - unsigned long l_flags; -} Elf32_Lib; - -/* The external version of Elf32_Lib. */ -typedef struct -{ - unsigned char l_name[4]; - unsigned char l_time_stamp[4]; - unsigned char l_checksum[4]; - unsigned char l_version[4]; - unsigned char l_flags[4]; -} Elf32_External_Lib; - -/* The l_flags field of an Elf32_Lib structure may contain the - following flags. */ - -/* Require an exact match at runtime. */ -#define LL_EXACT_MATCH 0x00000001 - -/* Ignore version incompatibilities at runtime. */ -#define LL_IGNORE_INT_VER 0x00000002 - -/* Require matching minor version number. */ -#define LL_REQUIRE_MINOR 0x00000004 - -/* ??? */ -#define LL_EXPORTS 0x00000008 - -/* Delay loading of this library until really needed. */ -#define LL_DELAY_LOAD 0x00000010 - -/* ??? Delta C++ stuff ??? */ -#define LL_DELTA 0x00000020 - - -/* A section of type SHT_MIPS_CONFLICT is an array of indices into the - .dynsym section. Each element has the following type. */ -typedef unsigned long Elf32_Conflict; -typedef unsigned char Elf32_External_Conflict[4]; - -typedef unsigned long Elf64_Conflict; -typedef unsigned char Elf64_External_Conflict[8]; - -/* A section of type SHT_MIPS_GPTAB contains information about how - much GP space would be required for different -G arguments. This - information is only used so that the linker can provide informative - suggestions as to the best -G value to use. The sh_info field is - the index of the section for which this information applies. The - contents of the section are an array of the following union. The - first element uses the gt_header field. The remaining elements use - the gt_entry field. */ -typedef union -{ - struct - { - /* -G value actually used for this object file. */ - unsigned long gt_current_g_value; - /* Unused. */ - unsigned long gt_unused; - } gt_header; - struct - { - /* If this -G argument has been used... */ - unsigned long gt_g_value; - /* ...this many GP section bytes would be required. */ - unsigned long gt_bytes; - } gt_entry; -} Elf32_gptab; - -/* The external version of Elf32_gptab. */ - -typedef union -{ - struct - { - unsigned char gt_current_g_value[4]; - unsigned char gt_unused[4]; - } gt_header; - struct - { - unsigned char gt_g_value[4]; - unsigned char gt_bytes[4]; - } gt_entry; -} Elf32_External_gptab; - -/* A section of type SHT_MIPS_REGINFO contains the following - structure. */ -typedef struct -{ - /* Mask of general purpose registers used. */ - unsigned long ri_gprmask; - /* Mask of co-processor registers used. */ - unsigned long ri_cprmask[4]; - /* GP register value for this object file. */ - long ri_gp_value; -} Elf32_RegInfo; - -/* The external version of the Elf_RegInfo structure. */ -typedef struct -{ - unsigned char ri_gprmask[4]; - unsigned char ri_cprmask[4][4]; - unsigned char ri_gp_value[4]; -} Elf32_External_RegInfo; - -/* MIPS ELF .reginfo swapping routines. */ -extern void bfd_mips_elf32_swap_reginfo_in - PARAMS ((bfd *, const Elf32_External_RegInfo *, Elf32_RegInfo *)); -extern void bfd_mips_elf32_swap_reginfo_out - PARAMS ((bfd *, const Elf32_RegInfo *, Elf32_External_RegInfo *)); - -/* Processor specific section flags. */ - -/* This section must be in the global data area. */ -#define SHF_MIPS_GPREL 0x10000000 - -/* This section should be merged. */ -#define SHF_MIPS_MERGE 0x20000000 - -/* This section contains address data of size implied by section - element size. */ -#define SHF_MIPS_ADDR 0x40000000 - -/* This section contains string data. */ -#define SHF_MIPS_STRING 0x80000000 - -/* This section may not be stripped. */ -#define SHF_MIPS_NOSTRIP 0x08000000 - -/* This section is local to threads. */ -#define SHF_MIPS_LOCAL 0x04000000 - -/* Linker should generate implicit weak names for this section. */ -#define SHF_MIPS_NAMES 0x02000000 - -/* Section contais text/data which may be replicated in other sections. - Linker should retain only one copy. */ -#define SHF_MIPS_NODUPES 0x01000000 - -/* Processor specific program header types. */ - -/* Register usage information. Identifies one .reginfo section. */ -#define PT_MIPS_REGINFO 0x70000000 - -/* Runtime procedure table. */ -#define PT_MIPS_RTPROC 0x70000001 - -/* .MIPS.options section. */ -#define PT_MIPS_OPTIONS 0x70000002 - -/* Processor specific dynamic array tags. */ - -/* 32 bit version number for runtime linker interface. */ -#define DT_MIPS_RLD_VERSION 0x70000001 - -/* Time stamp. */ -#define DT_MIPS_TIME_STAMP 0x70000002 - -/* Checksum of external strings and common sizes. */ -#define DT_MIPS_ICHECKSUM 0x70000003 - -/* Index of version string in string table. */ -#define DT_MIPS_IVERSION 0x70000004 - -/* 32 bits of flags. */ -#define DT_MIPS_FLAGS 0x70000005 - -/* Base address of the segment. */ -#define DT_MIPS_BASE_ADDRESS 0x70000006 - -/* ??? */ -#define DT_MIPS_MSYM 0x70000007 - -/* Address of .conflict section. */ -#define DT_MIPS_CONFLICT 0x70000008 - -/* Address of .liblist section. */ -#define DT_MIPS_LIBLIST 0x70000009 - -/* Number of local global offset table entries. */ -#define DT_MIPS_LOCAL_GOTNO 0x7000000a - -/* Number of entries in the .conflict section. */ -#define DT_MIPS_CONFLICTNO 0x7000000b - -/* Number of entries in the .liblist section. */ -#define DT_MIPS_LIBLISTNO 0x70000010 - -/* Number of entries in the .dynsym section. */ -#define DT_MIPS_SYMTABNO 0x70000011 - -/* Index of first external dynamic symbol not referenced locally. */ -#define DT_MIPS_UNREFEXTNO 0x70000012 - -/* Index of first dynamic symbol in global offset table. */ -#define DT_MIPS_GOTSYM 0x70000013 - -/* Number of page table entries in global offset table. */ -#define DT_MIPS_HIPAGENO 0x70000014 - -/* Address of run time loader map, used for debugging. */ -#define DT_MIPS_RLD_MAP 0x70000016 - -/* Delta C++ class definition. */ -#define DT_MIPS_DELTA_CLASS 0x70000017 - -/* Number of entries in DT_MIPS_DELTA_CLASS. */ -#define DT_MIPS_DELTA_CLASS_NO 0x70000018 - -/* Delta C++ class instances. */ -#define DT_MIPS_DELTA_INSTANCE 0x70000019 - -/* Number of entries in DT_MIPS_DELTA_INSTANCE. */ -#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a - -/* Delta relocations. */ -#define DT_MIPS_DELTA_RELOC 0x7000001b - -/* Number of entries in DT_MIPS_DELTA_RELOC. */ -#define DT_MIPS_DELTA_RELOC_NO 0x7000001c - -/* Delta symbols that Delta relocations refer to. */ -#define DT_MIPS_DELTA_SYM 0x7000001d - -/* Number of entries in DT_MIPS_DELTA_SYM. */ -#define DT_MIPS_DELTA_SYM_NO 0x7000001e - -/* Delta symbols that hold class declarations. */ -#define DT_MIPS_DELTA_CLASSSYM 0x70000020 - -/* Number of entries in DT_MIPS_DELTA_CLASSSYM. */ -#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 - -/* Flags indicating information about C++ flavor. */ -#define DT_MIPS_CXX_FLAGS 0x70000022 - -/* Pixie information (???). */ -#define DT_MIPS_PIXIE_INIT 0x70000023 - -/* Address of .MIPS.symlib */ -#define DT_MIPS_SYMBOL_LIB 0x70000024 - -/* The GOT index of the first PTE for a segment */ -#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 - -/* The GOT index of the first PTE for a local symbol */ -#define DT_MIPS_LOCAL_GOTIDX 0x70000026 - -/* The GOT index of the first PTE for a hidden symbol */ -#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 - -/* The GOT index of the first PTE for a protected symbol */ -#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 - -/* Address of `.MIPS.options'. */ -#define DT_MIPS_OPTIONS 0x70000029 - -/* Address of `.interface'. */ -#define DT_MIPS_INTERFACE 0x7000002a - -/* ??? */ -#define DT_MIPS_DYNSTR_ALIGN 0x7000002b - -/* Size of the .interface section. */ -#define DT_MIPS_INTERFACE_SIZE 0x7000002c - -/* Size of rld_text_resolve function stored in the GOT. */ -#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d - -/* Default suffix of DSO to be added by rld on dlopen() calls. */ -#define DT_MIPS_PERF_SUFFIX 0x7000002e - -/* Size of compact relocation section (O32). */ -#define DT_MIPS_COMPACT_SIZE 0x7000002f - -/* GP value for auxiliary GOTs. */ -#define DT_MIPS_GP_VALUE 0x70000030 - -/* Address of auxiliary .dynamic. */ -#define DT_MIPS_AUX_DYNAMIC 0x70000031 - -/* Flags which may appear in a DT_MIPS_FLAGS entry. */ - -/* No flags. */ -#define RHF_NONE 0x00000000 - -/* Uses shortcut pointers. */ -#define RHF_QUICKSTART 0x00000001 - -/* Hash size is not a power of two. */ -#define RHF_NOTPOT 0x00000002 - -/* Ignore LD_LIBRARY_PATH. */ -#define RHS_NO_LIBRARY_REPLACEMENT 0x00000004 - -/* DSO address may not be relocated. */ -#define RHF_NO_MOVE 0x00000008 - -/* SGI specific features. */ -#define RHF_SGI_ONLY 0x00000010 - -/* Guarantee that .init will finish executing before any non-init - code in DSO is called. */ -#define RHF_GUARANTEE_INIT 0x00000020 - -/* Contains Delta C++ code. */ -#define RHF_DELTA_C_PLUS_PLUS 0x00000040 - -/* Guarantee that .init will start executing before any non-init - code in DSO is called. */ -#define RHF_GUARANTEE_START_INIT 0x00000080 - -/* Generated by pixie. */ -#define RHF_PIXIE 0x00000100 - -/* Delay-load DSO by default. */ -#define RHF_DEFAULT_DELAY_LOAD 0x00000200 - -/* Object may be requickstarted */ -#define RHF_REQUICKSTART 0x00000400 - -/* Object has been requickstarted */ -#define RHF_REQUICKSTARTED 0x00000800 - -/* Generated by cord. */ -#define RHF_CORD 0x00001000 - -/* Object contains no unresolved undef symbols. */ -#define RHF_NO_UNRES_UNDEF 0x00002000 - -/* Symbol table is in a safe order. */ -#define RHF_RLD_ORDER_SAFE 0x00004000 - -/* Special values for the st_other field in the symbol table. These - are used in an Irix 5 dynamic symbol table. */ - -#define STO_DEFAULT STV_DEFAULT -#define STO_INTERNAL STV_INTERNAL -#define STO_HIDDEN STV_HIDDEN -#define STO_PROTECTED STV_PROTECTED - -/* This value is used for a mips16 .text symbol. */ -#define STO_MIPS16 0xf0 - -/* The 64-bit MIPS ELF ABI uses an unusual reloc format. Each - relocation entry specifies up to three actual relocations, all at - the same address. The first relocation which required a symbol - uses the symbol in the r_sym field. The second relocation which - requires a symbol uses the symbol in the r_ssym field. If all - three relocations require a symbol, the third one uses a zero - value. */ - -/* An entry in a 64 bit SHT_REL section. */ - -typedef struct -{ - /* Address of relocation. */ - unsigned char r_offset[8]; - /* Symbol index. */ - unsigned char r_sym[4]; - /* Special symbol. */ - unsigned char r_ssym[1]; - /* Third relocation. */ - unsigned char r_type3[1]; - /* Second relocation. */ - unsigned char r_type2[1]; - /* First relocation. */ - unsigned char r_type[1]; -} Elf64_Mips_External_Rel; - -typedef struct -{ - /* Address of relocation. */ - bfd_vma r_offset; - /* Symbol index. */ - unsigned long r_sym; - /* Special symbol. */ - unsigned char r_ssym; - /* Third relocation. */ - unsigned char r_type3; - /* Second relocation. */ - unsigned char r_type2; - /* First relocation. */ - unsigned char r_type; -} Elf64_Mips_Internal_Rel; - -/* An entry in a 64 bit SHT_RELA section. */ - -typedef struct -{ - /* Address of relocation. */ - unsigned char r_offset[8]; - /* Symbol index. */ - unsigned char r_sym[4]; - /* Special symbol. */ - unsigned char r_ssym[1]; - /* Third relocation. */ - unsigned char r_type3[1]; - /* Second relocation. */ - unsigned char r_type2[1]; - /* First relocation. */ - unsigned char r_type[1]; - /* Addend. */ - unsigned char r_addend[8]; -} Elf64_Mips_External_Rela; - -typedef struct -{ - /* Address of relocation. */ - bfd_vma r_offset; - /* Symbol index. */ - unsigned long r_sym; - /* Special symbol. */ - unsigned char r_ssym; - /* Third relocation. */ - unsigned char r_type3; - /* Second relocation. */ - unsigned char r_type2; - /* First relocation. */ - unsigned char r_type; - /* Addend. */ - bfd_signed_vma r_addend; -} Elf64_Mips_Internal_Rela; - -/* MIPS ELF 64 relocation info access macros. */ -#define ELF64_MIPS_R_SSYM(i) (((i) >> 24) & 0xff) -#define ELF64_MIPS_R_TYPE3(i) (((i) >> 16) & 0xff) -#define ELF64_MIPS_R_TYPE2(i) (((i) >> 8) & 0xff) -#define ELF64_MIPS_R_TYPE(i) ((i) & 0xff) - -/* Values found in the r_ssym field of a relocation entry. */ - -/* No relocation. */ -#define RSS_UNDEF 0 - -/* Value of GP. */ -#define RSS_GP 1 - -/* Value of GP in object being relocated. */ -#define RSS_GP0 2 - -/* Address of location being relocated. */ -#define RSS_LOC 3 - -/* A SHT_MIPS_OPTIONS section contains a series of options, each of - which starts with this header. */ - -typedef struct -{ - /* Type of option. */ - unsigned char kind[1]; - /* Size of option descriptor, including header. */ - unsigned char size[1]; - /* Section index of affected section, or 0 for global option. */ - unsigned char section[2]; - /* Information specific to this kind of option. */ - unsigned char info[4]; -} Elf_External_Options; - -typedef struct -{ - /* Type of option. */ - unsigned char kind; - /* Size of option descriptor, including header. */ - unsigned char size; - /* Section index of affected section, or 0 for global option. */ - unsigned short section; - /* Information specific to this kind of option. */ - unsigned long info; -} Elf_Internal_Options; - -/* MIPS ELF option header swapping routines. */ -extern void bfd_mips_elf_swap_options_in - PARAMS ((bfd *, const Elf_External_Options *, Elf_Internal_Options *)); -extern void bfd_mips_elf_swap_options_out - PARAMS ((bfd *, const Elf_Internal_Options *, Elf_External_Options *)); - -/* Values which may appear in the kind field of an Elf_Options - structure. */ - -/* Undefined. */ -#define ODK_NULL 0 - -/* Register usage and GP value. */ -#define ODK_REGINFO 1 - -/* Exception processing information. */ -#define ODK_EXCEPTIONS 2 - -/* Section padding information. */ -#define ODK_PAD 3 - -/* Hardware workarounds performed. */ -#define ODK_HWPATCH 4 - -/* Fill value used by the linker. */ -#define ODK_FILL 5 - -/* Reserved space for desktop tools. */ -#define ODK_TAGS 6 - -/* Hardware workarounds, AND bits when merging. */ -#define ODK_HWAND 7 - -/* Hardware workarounds, OR bits when merging. */ -#define ODK_HWOR 8 - -/* GP group to use for text/data sections. */ -#define ODK_GP_GROUP 9 - -/* ID information. */ -#define ODK_IDENT 10 - -/* In the 32 bit ABI, an ODK_REGINFO option is just a Elf32_RegInfo - structure. In the 64 bit ABI, it is the following structure. The - info field of the options header is not used. */ - -typedef struct -{ - /* Mask of general purpose registers used. */ - unsigned char ri_gprmask[4]; - /* Padding. */ - unsigned char ri_pad[4]; - /* Mask of co-processor registers used. */ - unsigned char ri_cprmask[4][4]; - /* GP register value for this object file. */ - unsigned char ri_gp_value[8]; -} Elf64_External_RegInfo; - -typedef struct -{ - /* Mask of general purpose registers used. */ - unsigned long ri_gprmask; - /* Padding. */ - unsigned long ri_pad; - /* Mask of co-processor registers used. */ - unsigned long ri_cprmask[4]; - /* GP register value for this object file. */ - bfd_vma ri_gp_value; -} Elf64_Internal_RegInfo; - -typedef struct -{ - /* The hash value computed from the name of the corresponding - dynamic symbol. */ - unsigned char ms_hash_value[4]; - /* Contains both the dynamic relocation index and the symbol flags - field. The macros ELF32_MS_REL_INDEX and ELF32_MS_FLAGS are used - to access the individual values. The dynamic relocation index - identifies the first entry in the .rel.dyn section that - references the dynamic symbol corresponding to this msym entry. - If the index is 0, no dynamic relocations are associated with the - symbol. The symbol flags field is reserved for future use. */ - unsigned char ms_info[4]; -} Elf32_External_Msym; - -typedef struct -{ - /* The hash value computed from the name of the corresponding - dynamic symbol. */ - unsigned long ms_hash_value; - /* Contains both the dynamic relocation index and the symbol flags - field. The macros ELF32_MS_REL_INDEX and ELF32_MS_FLAGS are used - to access the individual values. The dynamic relocation index - identifies the first entry in the .rel.dyn section that - references the dynamic symbol corresponding to this msym entry. - If the index is 0, no dynamic relocations are associated with the - symbol. The symbol flags field is reserved for future use. */ - unsigned long ms_info; -} Elf32_Internal_Msym; - -#define ELF32_MS_REL_INDEX(i) ((i) >> 8) -#define ELF32_MS_FLAGS(i) (i) & 0xff) -#define ELF32_MS_INFO(r, f) (((r) << 8) + ((f) & 0xff)) - -/* MIPS ELF reginfo swapping routines. */ -extern void bfd_mips_elf64_swap_reginfo_in - PARAMS ((bfd *, const Elf64_External_RegInfo *, Elf64_Internal_RegInfo *)); -extern void bfd_mips_elf64_swap_reginfo_out - PARAMS ((bfd *, const Elf64_Internal_RegInfo *, Elf64_External_RegInfo *)); - -/* Masks for the info work of an ODK_EXCEPTIONS descriptor. */ -#define OEX_FPU_MIN 0x1f /* FPEs which must be enabled. */ -#define OEX_FPU_MAX 0x1f00 /* FPEs which may be enabled. */ -#define OEX_PAGE0 0x10000 /* Page zero must be mapped. */ -#define OEX_SMM 0x20000 /* Force sequential memory mode. */ -#define OEX_FPDBUG 0x40000 /* Force precise floating-point - exceptions (debug mode). */ -#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults. */ - -/* Masks of the FP exceptions for OEX_FPU_MIN and OEX_FPU_MAX. */ -#define OEX_FPU_INVAL 0x10 /* Invalid operation exception. */ -#define OEX_FPU_DIV0 0x08 /* Division by zero exception. */ -#define OEX_FPU_OFLO 0x04 /* Overflow exception. */ -#define OEX_FPU_UFLO 0x02 /* Underflow exception. */ -#define OEX_FPU_INEX 0x01 /* Inexact exception. */ - -/* Masks for the info word of an ODK_PAD descriptor. */ -#define OPAD_PREFIX 0x01 -#define OPAD_POSTFIX 0x02 -#define OPAD_SYMBOL 0x04 - -/* Masks for the info word of an ODK_HWPATCH descriptor. */ -#define OHW_R4KEOP 0x00000001 /* R4000 end-of-page patch. */ -#define OHW_R8KPFETCH 0x00000002 /* May need R8000 prefetch patch. */ -#define OHW_R5KEOP 0x00000004 /* R5000 end-of-page patch. */ -#define OHW_R5KCVTL 0x00000008 /* R5000 cvt.[ds].l bug - (clean == 1). */ -#define OHW_R10KLDL 0x00000010 /* Needs R10K misaligned - load patch. */ - -/* Masks for the info word of an ODK_IDENT/ODK_GP_GROUP descriptor. */ -#define OGP_GROUP 0x0000ffff /* GP group number. */ -#define OGP_SELF 0xffff0000 /* Self-contained GP groups. */ - -/* Masks for the info word of an ODK_HWAND/ODK_HWOR descriptor. */ -#define OHWA0_R4KEOP_CHECKED 0x00000001 -#define OHWA0_R4KEOP_CLEAN 0x00000002 - - -#endif /* _ELF_MIPS_H */ diff --git a/contrib/binutils/include/elf/mn10200.h b/contrib/binutils/include/elf/mn10200.h deleted file mode 100644 index 1dfade5ccd0d..000000000000 --- a/contrib/binutils/include/elf/mn10200.h +++ /dev/null @@ -1,39 +0,0 @@ -/* MN10200 ELF support for BFD. - Copyright 1998, 2000 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file holds definitions specific to the MN10200 ELF ABI. */ - -#ifndef _ELF_MN10200_H -#define _ELF_MN10200_H - -#include "elf/reloc-macros.h" - -/* Relocations. */ -START_RELOC_NUMBERS (elf_mn10200_reloc_type) - RELOC_NUMBER (R_MN10200_NONE, 0) - RELOC_NUMBER (R_MN10200_32, 1) - RELOC_NUMBER (R_MN10200_16, 2) - RELOC_NUMBER (R_MN10200_8, 3) - RELOC_NUMBER (R_MN10200_24, 4) - RELOC_NUMBER (R_MN10200_PCREL8, 5) - RELOC_NUMBER (R_MN10200_PCREL16, 6) - RELOC_NUMBER (R_MN10200_PCREL24, 7) -END_RELOC_NUMBERS (R_MN10200_max) - -#endif /* _ELF_MN10200_H */ diff --git a/contrib/binutils/include/elf/mn10300.h b/contrib/binutils/include/elf/mn10300.h deleted file mode 100644 index e10be900a403..000000000000 --- a/contrib/binutils/include/elf/mn10300.h +++ /dev/null @@ -1,53 +0,0 @@ -/* MN10300 ELF support for BFD. - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file holds definitions specific to the MN10300 ELF ABI. */ - -#ifndef _ELF_MN10300_H -#define _ELF_MN10300_H - -#include "elf/reloc-macros.h" - -/* Relocations. */ -START_RELOC_NUMBERS (elf_mn10300_reloc_type) - RELOC_NUMBER (R_MN10300_NONE, 0) - RELOC_NUMBER (R_MN10300_32, 1) - RELOC_NUMBER (R_MN10300_16, 2) - RELOC_NUMBER (R_MN10300_8, 3) - RELOC_NUMBER (R_MN10300_PCREL32, 4) - RELOC_NUMBER (R_MN10300_PCREL16, 5) - RELOC_NUMBER (R_MN10300_PCREL8, 6) - RELOC_NUMBER (R_MN10300_GNU_VTINHERIT, 7) - RELOC_NUMBER (R_MN10300_GNU_VTENTRY, 8) - RELOC_NUMBER (R_MN10300_24, 9) -END_RELOC_NUMBERS (R_MN10300_MAX) - -/* Machine variant if we know it. This field was invented at Cygnus, - but it is hoped that other vendors will adopt it. If some standard - is developed, this code should be changed to follow it. */ - -#define EF_MN10300_MACH 0x00FF0000 - -/* Cygnus is choosing values between 80 and 9F; - 00 - 7F should be left for a future standard; - the rest are open. */ - -#define E_MN10300_MACH_MN10300 0x00810000 -#define E_MN10300_MACH_AM33 0x00820000 -#endif /* _ELF_MN10300_H */ diff --git a/contrib/binutils/include/elf/pj.h b/contrib/binutils/include/elf/pj.h deleted file mode 100644 index 586fd3a3608c..000000000000 --- a/contrib/binutils/include/elf/pj.h +++ /dev/null @@ -1,44 +0,0 @@ -/* picoJava ELF support for BFD. - Copyright 1999, 2000 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _ELF_PJ_H -#define _ELF_PJ_H - -#include "elf/reloc-macros.h" - -/* Relocations. */ - -START_RELOC_NUMBERS (elf_pj_reloc_type) - RELOC_NUMBER (R_PJ_NONE, 0) - RELOC_NUMBER (R_PJ_DATA_DIR32, 1) - RELOC_NUMBER (R_PJ_CODE_REL32, 2) - RELOC_NUMBER (R_PJ_CODE_REL16, 3) - RELOC_NUMBER (R_PJ_CODE_DIR32, 6) - RELOC_NUMBER (R_PJ_CODE_DIR16, 7) - RELOC_NUMBER (R_PJ_CODE_LO16, 13) - RELOC_NUMBER (R_PJ_CODE_HI16, 14) - RELOC_NUMBER (R_PJ_GNU_VTINHERIT, 15) - RELOC_NUMBER (R_PJ_GNU_VTENTRY, 16) -END_RELOC_NUMBERS (R_PJ_max) - -#define EF_PICOJAVA_ARCH 0x0000000f -#define EF_PICOJAVA_NEWCALLS 0x00000010 -#define EF_PICOJAVA_GNUCALLS 0x00000020 /* The (currently) non standard GNU calling convention */ - -#endif diff --git a/contrib/binutils/include/elf/po/Make-in b/contrib/binutils/include/elf/po/Make-in deleted file mode 100644 index 0552db1feef3..000000000000 --- a/contrib/binutils/include/elf/po/Make-in +++ /dev/null @@ -1,251 +0,0 @@ -# Makefile for program source directory in GNU NLS utilities package. -# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu> -# -# This file file be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU Public License -# but which still want to provide support for the GNU gettext functionality. -# Please note that the actual code is *not* freely available. - -PACKAGE = @PACKAGE@ -VERSION = @VERSION@ - -SHELL = /bin/sh -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -datadir = $(prefix)/@DATADIRNAME@ -localedir = $(datadir)/locale -gnulocaledir = $(prefix)/share/locale -gettextsrcdir = $(prefix)/share/gettext/po -subdir = po - -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -MKINSTALLDIRS = @MKINSTALLDIRS@ - -CC = @CC@ -GENCAT = @GENCAT@ -GMSGFMT = PATH=../src:$$PATH @GMSGFMT@ -MSGFMT = @MSGFMT@ -XGETTEXT = PATH=../src:$$PATH @XGETTEXT@ -MSGMERGE = PATH=../src:$$PATH msgmerge - -DEFS = @DEFS@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ - -INCLUDES = -I.. -I$(top_srcdir)/intl - -COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) - -SOURCES = cat-id-tbl.c -POFILES = @POFILES@ -GMOFILES = @GMOFILES@ -DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \ -stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES) - -POTFILES = \ - -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -INSTOBJEXT = @INSTOBJEXT@ - -.SUFFIXES: -.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat - -.c.o: - $(COMPILE) $< - -.po.pox: - $(MAKE) $(PACKAGE).pot - $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox - -.po.mo: - $(MSGFMT) -o $@ $< - -.po.gmo: - file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ - && rm -f $$file && $(GMSGFMT) -o $$file $< - -.po.cat: - sed -f ../intl/po2msg.sed < $< > $*.msg \ - && rm -f $@ && $(GENCAT) $@ $*.msg - - -all: all-@USE_NLS@ - -all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot -all-no: - -$(srcdir)/$(PACKAGE).pot: $(POTFILES) - $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ - --add-comments --keyword=_ --keyword=N_ \ - --files-from=$(srcdir)/POTFILES.in - rm -f $(srcdir)/$(PACKAGE).pot - mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot - -$(srcdir)/cat-id-tbl.c: stamp-cat-id; @: -$(srcdir)/stamp-cat-id: $(PACKAGE).pot - rm -f cat-id-tbl.tmp - sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \ - | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp - if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \ - rm cat-id-tbl.tmp; \ - else \ - echo cat-id-tbl.c changed; \ - rm -f $(srcdir)/cat-id-tbl.c; \ - mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \ - fi - cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id - - -install: install-exec install-data -install-exec: -install-info: -install-data: install-data-@USE_NLS@ -install-data-no: all -install-data-yes: all - if test -r $(MKINSTALLDIRS); then \ - $(MKINSTALLDIRS) $(datadir); \ - else \ - $(top_srcdir)/mkinstalldirs $(datadir); \ - fi - @catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - case "$$cat" in \ - *.gmo) destdir=$(gnulocaledir);; \ - *) destdir=$(localedir);; \ - esac; \ - lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ - dir=$$destdir/$$lang/LC_MESSAGES; \ - if test -r $(MKINSTALLDIRS); then \ - $(MKINSTALLDIRS) $$dir; \ - else \ - $(top_srcdir)/mkinstalldirs $$dir; \ - fi; \ - if test -r $$cat; then \ - $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ - echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \ - else \ - $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ - echo "installing $(srcdir)/$$cat as" \ - "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \ - fi; \ - if test -r $$cat.m; then \ - $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ - echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ - else \ - if test -r $(srcdir)/$$cat.m ; then \ - $(INSTALL_DATA) $(srcdir)/$$cat.m \ - $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ - echo "installing $(srcdir)/$$cat as" \ - "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ - else \ - true; \ - fi; \ - fi; \ - done - if test "$(PACKAGE)" = "gettext"; then \ - if test -r $(MKINSTALLDIRS); then \ - $(MKINSTALLDIRS) $(gettextsrcdir); \ - else \ - $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \ - fi; \ - $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ - $(gettextsrcdir)/Makefile.in.in; \ - else \ - : ; \ - fi - -# Define this as empty until I found a useful application. -installcheck: - -uninstall: - catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ - rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ - rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ - rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ - rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ - done - rm -f $(gettextsrcdir)/po-Makefile.in.in - -check: all - -cat-id-tbl.o: ../intl/libgettext.h - -dvi info tags TAGS ID: - -mostlyclean: - rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp - rm -fr *.o - -clean: mostlyclean - -distclean: clean - rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m - -maintainer-clean: distclean - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - rm -f $(GMOFILES) - -distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) -dist distdir: update-po $(DISTFILES) - dists="$(DISTFILES)"; \ - for file in $$dists; do \ - ln $(srcdir)/$$file $(distdir) 2> /dev/null \ - || cp -p $(srcdir)/$$file $(distdir); \ - done - -update-po: Makefile - $(MAKE) $(PACKAGE).pot - PATH=`pwd`/../src:$$PATH; \ - cd $(srcdir); \ - catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ - mv $$lang.po $$lang.old.po; \ - echo "$$lang:"; \ - if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \ - rm -f $$lang.old.po; \ - else \ - echo "msgmerge for $$cat failed!"; \ - rm -f $$lang.po; \ - mv $$lang.old.po $$lang.po; \ - fi; \ - done - -POTFILES: POTFILES.in - ( if test 'x$(srcdir)' != 'x.'; then \ - posrcprefix='$(top_srcdir)/'; \ - else \ - posrcprefix="../"; \ - fi; \ - rm -f $@-t $@ \ - && (sed -e '/^#/d' -e '/^[ ]*$$/d' \ - -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ - | sed -e '$$s/\\$$//') > $@-t \ - && chmod a-w $@-t \ - && mv $@-t $@ ) - -POTFILES.in: @MAINT@ ../Makefile - cd .. && $(MAKE) po/POTFILES.in - -Makefile: Make-in ../config.status POTFILES - cd .. \ - && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \ - CONFIG_HEADERS= $(SHELL) ./config.status - -# Tell versions [3.59,3.63) of GNU make not to export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/contrib/binutils/include/elf/po/POTFILES.in b/contrib/binutils/include/elf/po/POTFILES.in deleted file mode 100644 index a3a05867fb25..000000000000 --- a/contrib/binutils/include/elf/po/POTFILES.in +++ /dev/null @@ -1,55 +0,0 @@ -addr2line.c -ar.c -arsup.c -arsup.h -bucomm.c -bucomm.h -budbg.h -coffdump.c -coffgrok.c -coffgrok.h -debug.c -debug.c -debug.h -dlltool.c -dlltool.h -dllwrap.c -dyn-string.c -dyn-string.h -filemode.c -ieee.c -ieee.c -is-ranlib.c -is-strip.c -maybe-ranlib.c -maybe-strip.c -nlmconv.c -nlmconv.h -nm.c -not-ranlib.c -not-strip.c -objcopy.c -objdump.c -prdbg.c -rdcoff.c -rdcoff.c -rddbg.c -rddbg.c -readelf.c -rename.c -resbin.c -rescoff.c -resrc.c -resres.c -size.c -srconv.c -stabs.c -stabs.c -strings.c -sysdump.c -version.c -windres.c -windres.h -winduni.c -winduni.h -wrstabs.c diff --git a/contrib/binutils/include/elf/po/binutils.pot b/contrib/binutils/include/elf/po/binutils.pot deleted file mode 100644 index ed7ba0c4282b..000000000000 --- a/contrib/binutils/include/elf/po/binutils.pot +++ /dev/null @@ -1,3756 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR Free Software Foundation, Inc. -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2000-04-05 14:09+0930\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: LANGUAGE <LL@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: ENCODING\n" - -#: addr2line.c:76 -#, c-format -msgid "" -"Usage: %s [-CfsHV] [-b bfdname] [--target=bfdname]\n" -" [-e executable] [--exe=executable] [--demangle]\n" -" [--basenames] [--functions] [addr addr ...]\n" -msgstr "" - -#: addr2line.c:83 ar.c:286 nlmconv.c:1141 nm.c:306 objcopy.c:358 objcopy.c:390 -#: objdump.c:277 readelf.c:1703 size.c:89 strings.c:512 windres.c:737 -#, c-format -msgid "Report bugs to %s\n" -msgstr "" - -#: addr2line.c:243 -#, c-format -msgid "%s: can not get addresses from archive" -msgstr "" - -#: ar.c:235 -#, c-format -msgid "no entry %s in archive\n" -msgstr "" - -#: ar.c:252 -#, c-format -msgid "" -"Usage: %s [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file " -"file...\n" -msgstr "" - -#: ar.c:255 -#, c-format -msgid " %s -M [<mri-script]\n" -msgstr "" - -#: ar.c:256 -msgid " commands:\n" -msgstr "" - -#: ar.c:257 -msgid " d - delete file(s) from the archive\n" -msgstr "" - -#: ar.c:258 -msgid " m[ab] - move file(s) in the archive\n" -msgstr "" - -#: ar.c:259 -msgid " p - print file(s) found in the archive\n" -msgstr "" - -#: ar.c:260 -msgid " q[f] - quick append file(s) to the archive\n" -msgstr "" - -#: ar.c:261 -msgid "" -" r[ab][f][u] - replace existing or insert new file(s) into the archive\n" -msgstr "" - -#: ar.c:262 -msgid " t - display contents of archive\n" -msgstr "" - -#: ar.c:263 -msgid " x[o] - extract file(s) from the archive\n" -msgstr "" - -#: ar.c:264 -msgid " command specific modifiers:\n" -msgstr "" - -#: ar.c:265 -msgid " [a] - put file(s) after [member-name]\n" -msgstr "" - -#: ar.c:266 -msgid " [b] - put file(s) before [member-name] (same as [i])\n" -msgstr "" - -#: ar.c:267 -msgid " [N] - use instance [count] of name\n" -msgstr "" - -#: ar.c:268 -msgid " [f] - truncate inserted file names\n" -msgstr "" - -#: ar.c:269 -msgid " [P] - use full path names when matching\n" -msgstr "" - -#: ar.c:270 -msgid " [o] - preserve original dates\n" -msgstr "" - -#: ar.c:271 -msgid "" -" [u] - only replace files that are newer than current archive " -"contents\n" -msgstr "" - -#: ar.c:272 -msgid " generic modifiers:\n" -msgstr "" - -#: ar.c:273 -msgid " [c] - do not warn if the library had to be created\n" -msgstr "" - -#: ar.c:274 -msgid " [s] - create an archive index (cf. ranlib)\n" -msgstr "" - -#: ar.c:275 -msgid " [S] - do not build a symbol table\n" -msgstr "" - -#: ar.c:276 -msgid " [v] - be verbose\n" -msgstr "" - -#: ar.c:277 -msgid " [V] - display the version number\n" -msgstr "" - -#: ar.c:281 -#, c-format -msgid "Usage: %s [-vV] archive\n" -msgstr "" - -#: ar.c:466 -msgid "two different operation options specified" -msgstr "" - -#: ar.c:541 -#, c-format -msgid "%s: illegal option -- %c\n" -msgstr "" - -#: ar.c:573 -msgid "no operation specified" -msgstr "" - -#: ar.c:576 -msgid "`u' is only meaningful with the `r' option." -msgstr "" - -#: ar.c:586 -msgid "`N' is only meaningful with the `x' and 'd' options." -msgstr "" - -#: ar.c:589 -msgid "Value for `N' must be positive." -msgstr "" - -#: ar.c:672 -#, c-format -msgid "%s: internal error -- this option not implemented\n" -msgstr "" - -#: ar.c:790 ar.c:841 ar.c:1283 objcopy.c:1104 -#, c-format -msgid "internal stat error on %s" -msgstr "" - -#: ar.c:810 ar.c:878 -#, c-format -msgid "%s is not a valid archive" -msgstr "" - -#: ar.c:846 -#, c-format -msgid "stat returns negative size for %s" -msgstr "" - -#: ar.c:967 -#, c-format -msgid "%s is not an archive" -msgstr "" - -#: ar.c:974 -#, c-format -msgid "%s: creating %s\n" -msgstr "" - -#: ar.c:1181 -#, c-format -msgid "No member named `%s'\n" -msgstr "" - -#: ar.c:1233 -#, c-format -msgid "%s: no entry %s in archive %s!\n" -msgstr "" - -#: ar.c:1395 -#, c-format -msgid "%s: no archive map to update" -msgstr "" - -#: arsup.c:87 -#, c-format -msgid "No entry %s in archive.\n" -msgstr "" - -#: arsup.c:119 -#, c-format -msgid "Can't open file %s\n" -msgstr "" - -#: arsup.c:167 -#, c-format -msgid "%s: Can't open output archive %s\n" -msgstr "" - -#: arsup.c:179 -#, c-format -msgid "%s: Can't open input archive %s\n" -msgstr "" - -#: arsup.c:185 -#, c-format -msgid "%s: file %s is not an archive\n" -msgstr "" - -#: arsup.c:226 -#, c-format -msgid "%s: no output archive specified yet\n" -msgstr "" - -#: arsup.c:246 arsup.c:281 arsup.c:317 arsup.c:337 arsup.c:395 -#, c-format -msgid "%s: no open output archive\n" -msgstr "" - -#: arsup.c:254 arsup.c:355 arsup.c:375 -#, c-format -msgid "%s: can't open file %s\n" -msgstr "" - -#: arsup.c:302 arsup.c:371 arsup.c:450 -#, c-format -msgid "%s: can't find module file %s\n" -msgstr "" - -#: arsup.c:402 -#, c-format -msgid "Current open archive is %s\n" -msgstr "" - -#: arsup.c:429 -#, c-format -msgid "%s: no open archive\n" -msgstr "" - -#: bucomm.c:139 -#, c-format -msgid "can't set BFD default target to `%s': %s" -msgstr "" - -#: bucomm.c:151 -#, c-format -msgid "%s: Matching formats:" -msgstr "" - -#: bucomm.c:168 -msgid "Supported targets:" -msgstr "" - -#: bucomm.c:170 -#, c-format -msgid "%s: supported targets:" -msgstr "" - -#: bucomm.c:263 -#, c-format -msgid "%s: bad number: %s" -msgstr "" - -#: coffdump.c:94 -#, c-format -msgid "#lines %d " -msgstr "" - -#: coffdump.c:456 sysdump.c:719 -#, c-format -msgid "%s: Print a human readable interpretation of a SYSROFF object file\n" -msgstr "" - -#: coffdump.c:498 srconv.c:1940 sysdump.c:755 -#, c-format -msgid "GNU %s version %s\n" -msgstr "" - -#: coffdump.c:516 srconv.c:1977 sysdump.c:775 -#, c-format -msgid "%s: no input file specified\n" -msgstr "" - -#: debug.c:653 -msgid "debug_add_to_current_namespace: no current file" -msgstr "" - -#: debug.c:736 -msgid "debug_start_source: no debug_set_filename call" -msgstr "" - -#: debug.c:795 -msgid "debug_record_function: no debug_set_filename call" -msgstr "" - -#: debug.c:851 -msgid "debug_record_parameter: no current function" -msgstr "" - -#: debug.c:885 -msgid "debug_end_function: no current function" -msgstr "" - -#: debug.c:891 -msgid "debug_end_function: some blocks were not closed" -msgstr "" - -#: debug.c:921 -msgid "debug_start_block: no current block" -msgstr "" - -#: debug.c:959 -msgid "debug_end_block: no current block" -msgstr "" - -#: debug.c:966 -msgid "debug_end_block: attempt to close top level block" -msgstr "" - -#: debug.c:992 -msgid "debug_record_line: no current unit" -msgstr "" - -#. FIXME -#: debug.c:1046 -msgid "debug_start_common_block: not implemented" -msgstr "" - -#. FIXME -#: debug.c:1058 -msgid "debug_end_common_block: not implemented" -msgstr "" - -#. FIXME. -#: debug.c:1152 -msgid "debug_record_label not implemented" -msgstr "" - -#: debug.c:1178 -msgid "debug_record_variable: no current file" -msgstr "" - -#: debug.c:1194 -msgid "debug_record_variable: no current block" -msgstr "" - -#: debug.c:1764 -msgid "debug_make_undefined_type: unsupported kind" -msgstr "" - -#: debug.c:1970 -msgid "debug_name_type: no current file" -msgstr "" - -#: debug.c:2018 -msgid "debug_tag_type: no current file" -msgstr "" - -#: debug.c:2026 -msgid "debug_tag_type: extra tag attempted" -msgstr "" - -#: debug.c:2066 -#, c-format -msgid "Warning: changing type size from %d to %d\n" -msgstr "" - -#: debug.c:2090 -msgid "debug_find_named_type: no current compilation unit" -msgstr "" - -#: debug.c:2197 -#, c-format -msgid "debug_get_real_type: circular debug information for %s\n" -msgstr "" - -#: debug.c:2662 -msgid "debug_write_type: illegal type encountered" -msgstr "" - -#: dlltool.c:770 dlltool.c:794 dlltool.c:819 -#, c-format -msgid "Internal error: Unknown machine type: %d\n" -msgstr "" - -#: dlltool.c:856 -#, c-format -msgid "Can't open def file: %s" -msgstr "" - -#: dlltool.c:861 -#, c-format -msgid "Processing def file: %s" -msgstr "" - -#: dlltool.c:865 -msgid "Processed def file" -msgstr "" - -#: dlltool.c:890 -#, c-format -msgid "Syntax error in def file %s:%d\n" -msgstr "" - -#: dlltool.c:923 -#, c-format -msgid "NAME: %s base: %x" -msgstr "" - -#: dlltool.c:926 -msgid "Can't have LIBRARY and NAME\n" -msgstr "" - -#: dlltool.c:942 -#, c-format -msgid "LIBRARY: %s base: %x" -msgstr "" - -#: dlltool.c:945 -#, c-format -msgid "%s: Can't have LIBRARY and NAME\n" -msgstr "" - -#: dlltool.c:1200 resrc.c:271 -#, c-format -msgid "wait: %s" -msgstr "" - -#: dlltool.c:1205 resrc.c:276 -#, c-format -msgid "subprocess got fatal signal %d" -msgstr "" - -#: dlltool.c:1211 -#, c-format -msgid "%s exited with status %d\n" -msgstr "" - -#: dlltool.c:1243 -#, c-format -msgid "Sucking in info from %s section in %s\n" -msgstr "" - -#: dlltool.c:1367 -#, c-format -msgid "Excluding symbol: %s\n" -msgstr "" - -#: dlltool.c:1462 dlltool.c:1473 nm.c:904 nm.c:915 objdump.c:444 objdump.c:461 -#, c-format -msgid "%s: no symbols\n" -msgstr "" - -#. FIXME: we ought to read in and block out the base relocations -#: dlltool.c:1500 -#, c-format -msgid "Done reading %s\n" -msgstr "" - -#: dlltool.c:1511 -#, c-format -msgid "Unable to open object file: %s" -msgstr "" - -#: dlltool.c:1514 -#, c-format -msgid "Scanning object file %s" -msgstr "" - -#: dlltool.c:1529 -#, c-format -msgid "Cannot produce mcore-elf dll from archive file: %s" -msgstr "" - -#: dlltool.c:1621 -msgid "Adding exports to output file" -msgstr "" - -#: dlltool.c:1666 -msgid "Added exports to output file" -msgstr "" - -#: dlltool.c:1790 -#, c-format -msgid "Generating export file: %s\n" -msgstr "" - -#: dlltool.c:1795 -#, c-format -msgid "Unable to open temporary assembler file: %s" -msgstr "" - -#: dlltool.c:1798 -#, c-format -msgid "Opened temporary file: %s" -msgstr "" - -#: dlltool.c:2012 -msgid "Generated exports file" -msgstr "" - -#: dlltool.c:2267 -#, c-format -msgid "bfd_open failed open stub file: %s" -msgstr "" - -#: dlltool.c:2270 -#, c-format -msgid "Creating stub file: %s" -msgstr "" - -#: dlltool.c:2657 -#, c-format -msgid "failed to open temporary head file: %s" -msgstr "" - -#: dlltool.c:2716 -#, c-format -msgid "failed to open temporary tail file: %s" -msgstr "" - -#: dlltool.c:2784 -#, c-format -msgid "Can't open .lib file: %s" -msgstr "" - -#: dlltool.c:2787 -#, c-format -msgid "Creating library file: %s\n" -msgstr "" - -#: dlltool.c:2846 -#, c-format -msgid "cannot delete %s: %s\n" -msgstr "" - -#: dlltool.c:2850 -msgid "Created lib file" -msgstr "" - -#: dlltool.c:2955 -#, c-format -msgid "Warning, ignoring duplicate EXPORT %s %d,%d\n" -msgstr "" - -#: dlltool.c:2961 -#, c-format -msgid "Error, duplicate EXPORT with oridinals: %s" -msgstr "" - -#: dlltool.c:3088 -msgid "Processing definitions" -msgstr "" - -#: dlltool.c:3126 -msgid "Processed definitions" -msgstr "" - -#. xgetext:c-format -#: dlltool.c:3137 -#, c-format -msgid "Usage %s <options> <object-files>\n" -msgstr "" - -#. xgetext:c-format -#: dlltool.c:3139 -#, c-format -msgid "" -" -m --machine <machine> Create as DLL for <machine>. [default: %s]\n" -msgstr "" - -#: dlltool.c:3140 -msgid "" -" possible <machine>: arm[_interwork], i386, mcore[-elf]{-le|-be}, " -"ppc, thumb\n" -msgstr "" - -#: dlltool.c:3141 -msgid " -e --output-exp <outname> Generate an export file.\n" -msgstr "" - -#: dlltool.c:3142 -msgid " -l --output-lib <outname> Generate an interface library.\n" -msgstr "" - -#: dlltool.c:3143 -msgid " -a --add-indirect Add dll indirects to export file.\n" -msgstr "" - -#: dlltool.c:3144 -msgid "" -" -D --dllname <name> Name of input dll to put into interface lib.\n" -msgstr "" - -#: dlltool.c:3145 -msgid " -d --input-def <deffile> Name of .def file to be read in.\n" -msgstr "" - -#: dlltool.c:3146 -msgid " -z --output-def <deffile> Name of .def file to be created.\n" -msgstr "" - -#: dlltool.c:3147 -msgid " --export-all-symbols Export all symbols to .def\n" -msgstr "" - -#: dlltool.c:3148 -msgid " --no-export-all-symbols Only export listed symbols\n" -msgstr "" - -#: dlltool.c:3149 -msgid " --exclude-symbols <list> Don't export <list>\n" -msgstr "" - -#: dlltool.c:3150 -msgid " --no-default-excludes Clear default exclude symbols\n" -msgstr "" - -#: dlltool.c:3151 -msgid " -b --base-file <basefile> Read linker generated base file.\n" -msgstr "" - -#: dlltool.c:3152 -msgid " -x --no-idata4 Don't generate idata$4 section.\n" -msgstr "" - -#: dlltool.c:3153 -msgid " -c --no-idata5 Don't generate idata$5 section.\n" -msgstr "" - -#: dlltool.c:3154 -msgid "" -" -U --add-underscore Add underscores to symbols in interface " -"library.\n" -msgstr "" - -#: dlltool.c:3155 -msgid " -k --kill-at Kill @<n> from exported names.\n" -msgstr "" - -#: dlltool.c:3156 -msgid " -A --add-stdcall-alias Add aliases without @<n>.\n" -msgstr "" - -#: dlltool.c:3157 -msgid " -S --as <name> Use <name> for assembler.\n" -msgstr "" - -#: dlltool.c:3158 -msgid " -f --as-flags <flags> Pass <flags> to the assembler.\n" -msgstr "" - -#: dlltool.c:3159 -msgid "" -" -C --compat-implib Create backward compatible import library.\n" -msgstr "" - -#: dlltool.c:3160 -msgid "" -" -n --no-delete Keep temp files (repeat for extra " -"preservation).\n" -msgstr "" - -#: dlltool.c:3161 -msgid " -v --verbose Be verbose.\n" -msgstr "" - -#: dlltool.c:3162 -msgid " -V --version Display the program version.\n" -msgstr "" - -#: dlltool.c:3163 -msgid " -h --help Display this information.\n" -msgstr "" - -#: dlltool.c:3165 -msgid "" -" -M --mcore-elf <outname> Process mcore-elf object files into <outname>.\n" -msgstr "" - -#: dlltool.c:3166 -msgid " -L --linker <name> Use <name> as the linker.\n" -msgstr "" - -#: dlltool.c:3167 -msgid " -F --linker-flags <flags> Pass <flags> to the linker.\n" -msgstr "" - -#: dlltool.c:3311 -#, c-format -msgid "Unable to open base-file: %s" -msgstr "" - -#: dlltool.c:3340 -#, c-format -msgid "Machine '%s' not supported" -msgstr "" - -#: dlltool.c:3443 dllwrap.c:215 -#, c-format -msgid "Tried file: %s" -msgstr "" - -#: dlltool.c:3450 dllwrap.c:222 -#, c-format -msgid "Using file: %s" -msgstr "" - -#: ieee.c:316 -msgid "unexpected end of debugging information" -msgstr "" - -#: ieee.c:411 -msgid "invalid number" -msgstr "" - -#: ieee.c:470 -msgid "invalid string length" -msgstr "" - -#: ieee.c:527 ieee.c:568 -msgid "expression stack overflow" -msgstr "" - -#: ieee.c:547 -msgid "unsupported IEEE expression operator" -msgstr "" - -#: ieee.c:562 -msgid "unknown section" -msgstr "" - -#: ieee.c:583 -msgid "expression stack underflow" -msgstr "" - -#: ieee.c:597 -msgid "expression stack mismatch" -msgstr "" - -#: ieee.c:636 -msgid "unknown builtin type" -msgstr "" - -#: ieee.c:781 -msgid "BCD float type not supported" -msgstr "" - -#: ieee.c:927 -msgid "unexpected number" -msgstr "" - -#: ieee.c:934 -msgid "unexpected record type" -msgstr "" - -#: ieee.c:967 -msgid "blocks left on stack at end" -msgstr "" - -#: ieee.c:1232 -msgid "unknown BB type" -msgstr "" - -#: ieee.c:1241 -msgid "stack overflow" -msgstr "" - -#: ieee.c:1266 -msgid "stack underflow" -msgstr "" - -#: ieee.c:1380 ieee.c:1452 ieee.c:2151 -msgid "illegal variable index" -msgstr "" - -#: ieee.c:1430 -msgid "illegal type index" -msgstr "" - -#: ieee.c:1440 ieee.c:1477 -msgid "unknown TY code" -msgstr "" - -#: ieee.c:1459 -msgid "undefined variable in TY" -msgstr "" - -#. Pascal file name. FIXME. -#: ieee.c:1870 -msgid "Pascal file name not supported" -msgstr "" - -#: ieee.c:1918 -msgid "unsupported qualifer" -msgstr "" - -#: ieee.c:2189 -msgid "undefined variable in ATN" -msgstr "" - -#: ieee.c:2232 -msgid "unknown ATN type" -msgstr "" - -#. Reserved for FORTRAN common. -#: ieee.c:2354 -msgid "unsupported ATN11" -msgstr "" - -#. We have no way to record this information. FIXME. -#: ieee.c:2381 -msgid "unsupported ATN12" -msgstr "" - -#: ieee.c:2441 -msgid "unexpected string in C++ misc" -msgstr "" - -#: ieee.c:2454 -msgid "bad misc record" -msgstr "" - -#: ieee.c:2497 -msgid "unrecognized C++ misc record" -msgstr "" - -#: ieee.c:2614 -msgid "undefined C++ object" -msgstr "" - -#: ieee.c:2648 -msgid "unrecognized C++ object spec" -msgstr "" - -#: ieee.c:2684 -msgid "unsupported C++ object type" -msgstr "" - -#: ieee.c:2694 -msgid "C++ base class not defined" -msgstr "" - -#: ieee.c:2706 ieee.c:2811 -msgid "C++ object has no fields" -msgstr "" - -#: ieee.c:2725 -msgid "C++ base class not found in container" -msgstr "" - -#: ieee.c:2832 -msgid "C++ data member not found in container" -msgstr "" - -#: ieee.c:2873 ieee.c:3023 -msgid "unknown C++ visibility" -msgstr "" - -#: ieee.c:2907 -msgid "bad C++ field bit pos or size" -msgstr "" - -#: ieee.c:2999 -msgid "bad type for C++ method function" -msgstr "" - -#: ieee.c:3009 -msgid "no type information for C++ method function" -msgstr "" - -#: ieee.c:3048 -msgid "C++ static virtual method" -msgstr "" - -#: ieee.c:3143 -msgid "unrecognized C++ object overhead spec" -msgstr "" - -#: ieee.c:3182 -msgid "undefined C++ vtable" -msgstr "" - -#: ieee.c:3253 -msgid "C++ default values not in a function" -msgstr "" - -#: ieee.c:3293 -msgid "unrecognized C++ default type" -msgstr "" - -#: ieee.c:3324 -msgid "reference parameter is not a pointer" -msgstr "" - -#: ieee.c:3409 -msgid "unrecognized C++ reference type" -msgstr "" - -#: ieee.c:3491 -msgid "C++ reference not found" -msgstr "" - -#: ieee.c:3499 -msgid "C++ reference is not pointer" -msgstr "" - -#: ieee.c:3528 ieee.c:3536 -msgid "missing required ASN" -msgstr "" - -#: ieee.c:3566 ieee.c:3574 -msgid "missing required ATN65" -msgstr "" - -#: ieee.c:3588 -msgid "bad ATN65 record" -msgstr "" - -#: ieee.c:4235 -msgid "IEEE numeric overflow: 0x" -msgstr "" - -#: ieee.c:4281 -#, c-format -msgid "IEEE string length overflow: %u\n" -msgstr "" - -#: ieee.c:5315 -#, c-format -msgid "IEEE unsupported integer type size %u\n" -msgstr "" - -#: ieee.c:5351 -#, c-format -msgid "IEEE unsupported float type size %u\n" -msgstr "" - -#: ieee.c:5387 -#, c-format -msgid "IEEE unsupported complex type size %u\n" -msgstr "" - -#: nlmconv.c:275 srconv.c:1966 -#, c-format -msgid "%s: input and output files must be different\n" -msgstr "" - -#: nlmconv.c:325 -#, c-format -msgid "%s: input file named both on command line and with INPUT\n" -msgstr "" - -#: nlmconv.c:336 -#, c-format -msgid "%s: no input file\n" -msgstr "" - -#: nlmconv.c:366 -#, c-format -msgid "%s: no name for output file\n" -msgstr "" - -#: nlmconv.c:381 -#, c-format -msgid "%s: warning:input and output formats are not compatible\n" -msgstr "" - -#: nlmconv.c:411 -msgid "make .bss section" -msgstr "" - -#: nlmconv.c:420 -msgid "make .nlmsections section" -msgstr "" - -#: nlmconv.c:422 -msgid "set .nlmsections flags" -msgstr "" - -#: nlmconv.c:450 -msgid "set .bss vma" -msgstr "" - -#: nlmconv.c:457 -msgid "set .data size" -msgstr "" - -#: nlmconv.c:638 -#, c-format -msgid "%s: warning: symbol %s imported but not in import list\n" -msgstr "" - -#: nlmconv.c:658 -msgid "set start address" -msgstr "" - -#: nlmconv.c:707 -#, c-format -msgid "%s: warning: START procedure %s not defined\n" -msgstr "" - -#: nlmconv.c:710 -#, c-format -msgid "%s: warning: EXIT procedure %s not defined\n" -msgstr "" - -#: nlmconv.c:714 -#, c-format -msgid "%s: warning: CHECK procedure %s not defined\n" -msgstr "" - -#: nlmconv.c:736 nlmconv.c:928 -msgid "custom section" -msgstr "" - -#: nlmconv.c:757 nlmconv.c:960 -msgid "help section" -msgstr "" - -#: nlmconv.c:779 nlmconv.c:979 -msgid "message section" -msgstr "" - -#: nlmconv.c:795 nlmconv.c:1012 -msgid "module section" -msgstr "" - -#: nlmconv.c:815 nlmconv.c:1029 -msgid "rpc section" -msgstr "" - -#: nlmconv.c:852 -#, c-format -msgid "%s:%s: warning: shared libraries can not have uninitialized data\n" -msgstr "" - -#: nlmconv.c:873 nlmconv.c:1049 -msgid "shared section" -msgstr "" - -#: nlmconv.c:881 -#, c-format -msgid "%s: warning: No version number given\n" -msgstr "" - -#: nlmconv.c:922 nlmconv.c:954 nlmconv.c:973 nlmconv.c:1023 nlmconv.c:1043 -#, c-format -msgid "%s:%s: read: %s\n" -msgstr "" - -#: nlmconv.c:946 -#, c-format -msgid "%s: warning: MAP and FULLMAP are not supported; try ld -M\n" -msgstr "" - -#: nlmconv.c:1121 -#, c-format -msgid "%s: Convert an object file into a NetWare Loadable Module\n" -msgstr "" - -#: nlmconv.c:1133 -#, c-format -msgid "" -"Usage: %s [-dhV] [-I bfdname] [-O bfdname] [-T header-file] [-l linker]\n" -" [--input-target=bfdname] [--output-target=bfdname]\n" -" [--header-file=file] [--linker=linker] [--debug]\n" -" [--help] [--version]\n" -" [in-file [out-file]]\n" -msgstr "" - -#: nlmconv.c:1173 -#, c-format -msgid "%s: support not compiled in for %s\n" -msgstr "" - -#: nlmconv.c:1216 -msgid "make section" -msgstr "" - -#: nlmconv.c:1230 -msgid "set section size" -msgstr "" - -#: nlmconv.c:1236 -msgid "set section alignment" -msgstr "" - -#: nlmconv.c:1240 -msgid "set section flags" -msgstr "" - -#: nlmconv.c:1251 -msgid "set .nlmsections size" -msgstr "" - -#: nlmconv.c:1339 nlmconv.c:1347 nlmconv.c:1356 nlmconv.c:1361 -msgid "set .nlmsection contents" -msgstr "" - -#: nlmconv.c:1864 -msgid "stub section sizes" -msgstr "" - -#: nlmconv.c:1913 -msgid "writing stub" -msgstr "" - -#: nlmconv.c:2003 -#, c-format -msgid "%s: unresolved PC relative reloc against %s\n" -msgstr "" - -#: nlmconv.c:2068 -#, c-format -msgid "%s: overflow when adjusting relocation against %s\n" -msgstr "" - -#: nlmconv.c:2191 -#, c-format -msgid "%s: execution of %s failed: " -msgstr "" - -#: nlmconv.c:2206 -#, c-format -msgid "%s: Execution of %s failed\n" -msgstr "" - -#: nm.c:294 -#, c-format -msgid "" -"Usage: %s [-aABCDglnopPrsuvV] [-t radix] [--radix=radix] [--target=bfdname]\n" -" [--debug-syms] [--extern-only] [--print-armap] [--print-file-name]\n" -" [--numeric-sort] [--no-sort] [--reverse-sort] [--size-sort]\n" -" [--undefined-only] [--portability] [-f {bsd,sysv,posix}]\n" -" [--format={bsd,sysv,posix}] [--demangle] [--no-demangle] [--dynamic]\n" -" [--defined-only] [--line-numbers]\n" -" [--version] [--help]\n" -" [file...]\n" -msgstr "" - -#: nm.c:339 -#, c-format -msgid "%s: %s: invalid radix\n" -msgstr "" - -#: nm.c:365 -#, c-format -msgid "%s: %s: invalid output format\n" -msgstr "" - -#: nm.c:492 -#, c-format -msgid "%s: data size %ld\n" -msgstr "" - -#: nm.c:1283 -#, c-format -msgid "" -"\n" -"\n" -"Undefined symbols from %s:\n" -"\n" -msgstr "" - -#: nm.c:1285 -#, c-format -msgid "" -"\n" -"\n" -"Symbols from %s:\n" -"\n" -msgstr "" - -#: nm.c:1286 nm.c:1340 -msgid "" -"Name Value Class Type Size Line " -"Section\n" -"\n" -msgstr "" - -#: nm.c:1337 -#, c-format -msgid "" -"\n" -"\n" -"Undefined symbols from %s[%s]:\n" -"\n" -msgstr "" - -#: nm.c:1339 -#, c-format -msgid "" -"\n" -"\n" -"Symbols from %s[%s]:\n" -"\n" -msgstr "" - -#: nm.c:1510 -msgid "" -"\n" -"Archive index:\n" -msgstr "" - -#: objcopy.c:309 -#, c-format -msgid "Usage: %s <switches> in-file [out-file]\n" -msgstr "" - -#: objcopy.c:310 objcopy.c:368 -msgid " The switches are:\n" -msgstr "" - -#: objcopy.c:311 -msgid "" -" -I --input-target <bfdname> Assume input file is in format <bfdname>\n" -" -O --output-target <bfdname> Create an output file in format " -"<bfdname>\n" -" -F --target <bfdname> Set both input and output format to " -"<bfdname>\n" -" --debugging Convert debugging information, if " -"possible\n" -" -p --preserve-dates Copy modified/access timestamps to the " -"output\n" -" -j --only-section <name> Only copy section <name> into the output\n" -" -R --remove-section <name> Remove section <name> from the output\n" -" -S --strip-all Remove all symbol and relocation " -"information\n" -" -g --strip-debug Remove all debugging symbols\n" -" --strip-unneeded Remove all symbols not needed by " -"relocations\n" -" -N --strip-symbol <name> Do not copy symbol <name>\n" -" -K --keep-symbol <name> Only copy symbol <name>\n" -" -L --localize-symbol <name> Force symbol <name> to be marked as a " -"local\n" -" -W --weaken-symbol <name> Force symbol <name> to be marked as a " -"weak\n" -" --weaken Force all global symbols to be marked as " -"weak\n" -" -x --discard-all Remove all non-global symbols\n" -" -X --discard-locals Remove any compiler-generated symbols\n" -" -i --interleave <number> Only copy one out of every <number> " -"bytes\n" -" -b --byte <num> Select byte <num> in every interleaved " -"block\n" -" --gap-fill <val> Fill gaps between sections with <val>\n" -" --pad-to <addr> Pad the last section up to address " -"<addr>\n" -" --set-start <addr> Set the start address to <addr>\n" -" {--change-start|--adjust-start} <incr>\n" -" Add <incr> to the start address\n" -" {--change-addresses|--adjust-vma} <incr>\n" -" Add <incr> to LMA, VMA and start " -"addresses\n" -" {--change-section-address|--adjust-section-vma} <name>{=|+|-}<val>\n" -" Change LMA and VMA of section <name> by " -"<val>\n" -" --change-section-lma <name>{=|+|-}<val>\n" -" Change the LMA of section <name> by " -"<val>\n" -" --change-section-vma <name>{=|+|-}<val>\n" -" Change the VMA of section <name> by " -"<val>\n" -" {--[no-]change-warnings|--[no-]adjust-warnings}\n" -" Warn if a named section does not exist\n" -" --set-section-flags <name>=<flags>\n" -" Set section <name>'s properties to " -"<flags>\n" -" --add-section <name>=<file> Add section <name> found in <file> to " -"output\n" -" --change-leading-char Force output format's leading character " -"style\n" -" --remove-leading-char Remove leading character from global " -"symbols\n" -" --redefine-sym <old>=<new> Redefine symbol name <old> to <new>\n" -" -v --verbose List all object files modified\n" -" -V --version Display this program's version number\n" -" -h --help Display this output\n" -msgstr "" - -#: objcopy.c:367 -#, c-format -msgid "Usage: %s <switches> in-file(s)\n" -msgstr "" - -#: objcopy.c:369 -msgid "" -" -I --input-target <bfdname> Assume input file is in format <bfdname>\n" -" -O --output-target <bfdname> Create an output file in format " -"<bfdname>\n" -" -F --target <bfdname> Set both input and output format to " -"<bfdname>\n" -" -p --preserve-dates Copy modified/access timestamps to the " -"output\n" -" -R --remove-section <name> Remove section <name> from the output\n" -" -s --strip-all Remove all symbol and relocation " -"information\n" -" -g -S --strip-debug Remove all debugging symbols\n" -" --strip-unneeded Remove all symbols not needed by " -"relocations\n" -" -N --strip-symbol <name> Do not copy symbol <name>\n" -" -K --keep-symbol <name> Only copy symbol <name>\n" -" -x --discard-all Remove all non-global symbols\n" -" -X --discard-locals Remove any compiler-generated symbols\n" -" -v --verbose List all object files modified\n" -" -V --version Display this program's version number\n" -" -h --help Display this output\n" -" -o <file> Place stripped output into <file>\n" -msgstr "" - -#: objcopy.c:439 -#, c-format -msgid "unrecognized section flag `%s'" -msgstr "" - -#: objcopy.c:440 -#, c-format -msgid "supported flags: %s" -msgstr "" - -#: objcopy.c:692 -#, c-format -msgid "%s: Multiple redefinition of symbol \"%s\"" -msgstr "" - -#: objcopy.c:699 -#, c-format -msgid "%s: Symbol \"%s\" is target of more than one redefinition" -msgstr "" - -#: objcopy.c:753 -#, c-format -msgid "copy from %s(%s) to %s(%s)\n" -msgstr "" - -#: objcopy.c:772 -#, c-format -msgid "Warning: Output file cannot represent architecture %s" -msgstr "" - -#: objcopy.c:799 -#, c-format -msgid "can't create section `%s': %s" -msgstr "" - -#: objcopy.c:885 -#, c-format -msgid "Can't fill gap after %s: %s" -msgstr "" - -#: objcopy.c:910 -#, c-format -msgid "Can't add padding to %s: %s" -msgstr "" - -#: objcopy.c:1048 -#, c-format -msgid "%s: error copying private BFD data: %s" -msgstr "" - -#: objcopy.c:1082 -#, c-format -msgid "cannot mkdir %s for archive copying (error: %s)" -msgstr "" - -#: objcopy.c:1351 -#, c-format -msgid "%s: section `%s': error in %s: %s" -msgstr "" - -#: objcopy.c:1625 -#, c-format -msgid "%s: can't create debugging section: %s" -msgstr "" - -#: objcopy.c:1640 -#, c-format -msgid "%s: can't set debugging section contents: %s" -msgstr "" - -#: objcopy.c:1649 -#, c-format -msgid "%s: don't know how to write debugging information for %s" -msgstr "" - -#: objcopy.c:1754 -#, c-format -msgid "%s: cannot stat: %s" -msgstr "" - -#: objcopy.c:1804 -msgid "byte number must be non-negative" -msgstr "" - -#: objcopy.c:1810 -msgid "interleave must be positive" -msgstr "" - -#: objcopy.c:1830 objcopy.c:1838 -#, c-format -msgid "%s both copied and removed" -msgstr "" - -#: objcopy.c:1907 objcopy.c:1977 objcopy.c:2078 objcopy.c:2106 -#, c-format -msgid "bad format for %s" -msgstr "" - -#: objcopy.c:1910 -#, c-format -msgid "cannot stat: %s: %s" -msgstr "" - -#: objcopy.c:1928 -#, c-format -msgid "cannot open: %s: %s" -msgstr "" - -#: objcopy.c:1932 -#, c-format -msgid "%s: fread failed" -msgstr "" - -#: objcopy.c:2046 -#, c-format -msgid "Warning: truncating gap-fill from 0x%s to 0x%x" -msgstr "" - -#: objcopy.c:2140 -msgid "byte number must be less than interleave" -msgstr "" - -#: objcopy.c:2159 -#, c-format -msgid "Cannot stat: %s: %s" -msgstr "" - -#: objcopy.c:2199 objcopy.c:2213 -#, c-format -msgid "%s %s%c0x%s never used" -msgstr "" - -#: objdump.c:229 -#, c-format -msgid "Usage: %s <switches> file(s)\n" -msgstr "" - -#: objdump.c:230 -msgid " At least one of the following switches must be given:\n" -msgstr "" - -#: objdump.c:231 -msgid "" -" -a --archive-headers Display archive header information\n" -" -f --file-headers Display the contents of the overall file header\n" -" -p --private-headers Display object format specific file header " -"contents\n" -" -h --[section-]headers Display the contents of the section headers\n" -" -x --all-headers Display the contents of all headers\n" -" -d --disassemble Display assembler contents of executable " -"sections\n" -" -D --disassemble-all Display assembler contents of all sections\n" -" -S --source Intermix source code with disassembly\n" -" -s --full-contents Display the full contents of all sections " -"requested\n" -" -g --debugging Display debug information in object file\n" -" -G --stabs Display the STABS contents of an ELF format file\n" -" -t --syms Display the contents of the symbol table(s)\n" -" -T --dynamic-syms Display the contents of the dynamic symbol table\n" -" -r --reloc Display the relocation entries in the file\n" -" -R --dynamic-reloc Display the dynamic relocation entries in the " -"file\n" -" -V --version Display this program's version number\n" -" -i --info List object formats and architectures supported\n" -" -H --help Display this information\n" -msgstr "" - -#: objdump.c:253 -msgid "" -"\n" -" The following switches are optional:\n" -msgstr "" - -#: objdump.c:254 -msgid "" -" -b --target <bfdname> Specify the target object format as " -"<bfdname>\n" -" -m --architecture <machine> Specify the target architecture as " -"<machine>\n" -" -j --section <name> Only display information for section " -"<name>\n" -" -M --disassembler-options <o> Pass text <o> on to the disassembler\n" -" -EB --endian=big Assume big endian format when " -"disassembling\n" -" -EL --endian=little Assume little endian format when " -"disassembling\n" -" --file-start-context Include context from start of file (with " -"-S)\n" -" -l --line-numbers Include line numbers and filenames in " -"output\n" -" -C --demangle Decode mangled/processed symbol names\n" -" -w --wide Format output for more than 80 columns\n" -" -z --disassemble-zeroes Do not skip blocks of zeroes when " -"disassembling\n" -" --start-address <addr> Only process data whoes address is >= " -"<addr>\n" -" --stop-address <addr> Only process data whoes address is <= " -"<addr>\n" -" --prefix-addresses Print complete address alongside " -"disassembly\n" -" --[no-]show-raw-insn Display hex alongside symbolic disassembly\n" -" --adjust-vma <offset> Add <offset> to all displayed section " -"addresses\n" -"\n" -msgstr "" - -#: objdump.c:420 -msgid "Sections:\n" -msgstr "" - -#: objdump.c:423 -msgid "Idx Name Size VMA LMA File off Algn" -msgstr "" - -#: objdump.c:425 -msgid "" -"Idx Name Size VMA LMA File off " -"Algn" -msgstr "" - -#: objdump.c:429 -msgid " Flags" -msgstr "" - -#: objdump.c:479 -#, c-format -msgid "%s: %s: not a dynamic object\n" -msgstr "" - -#: objdump.c:496 -#, c-format -msgid "%s: %s: No dynamic symbols\n" -msgstr "" - -#: objdump.c:1200 -msgid "Out of virtual memory\n" -msgstr "" - -#: objdump.c:1611 -#, c-format -msgid "%s: Can't use supplied machine %s\n" -msgstr "" - -#: objdump.c:1632 -#, c-format -msgid "%s: Can't disassemble for architecture %s\n" -msgstr "" - -#: objdump.c:1709 -#, c-format -msgid "Disassembly of section %s:\n" -msgstr "" - -#: objdump.c:1883 -#, c-format -msgid "" -"No %s section present\n" -"\n" -msgstr "" - -#: objdump.c:1890 -#, c-format -msgid "%s: %s has no %s section\n" -msgstr "" - -#: objdump.c:1904 objdump.c:1916 -#, c-format -msgid "%s: Reading %s section of %s failed: %s\n" -msgstr "" - -#: objdump.c:1959 -#, c-format -msgid "" -"Contents of %s section:\n" -"\n" -msgstr "" - -#: objdump.c:2059 -#, c-format -msgid "architecture: %s, " -msgstr "" - -#: objdump.c:2062 -#, c-format -msgid "flags 0x%08x:\n" -msgstr "" - -#: objdump.c:2075 -msgid "" -"\n" -"start address 0x" -msgstr "" - -#: objdump.c:2107 -#, c-format -msgid "" -"\n" -"%s: file format %s\n" -msgstr "" - -#: objdump.c:2150 -#, c-format -msgid "%s: printing debugging information failed\n" -msgstr "" - -#: objdump.c:2227 -#, c-format -msgid "In archive %s:\n" -msgstr "" - -#: objdump.c:2279 -#, c-format -msgid "Contents of section %s:\n" -msgstr "" - -#: objdump.c:2788 -#, c-format -msgid "BFD header file version %s\n" -msgstr "" - -#: objdump.c:2861 -#, c-format -msgid "%s: unrecognized -E option\n" -msgstr "" - -#: objdump.c:2873 -#, c-format -msgid "%s: unrecognized --endian type `%s'\n" -msgstr "" - -#: rdcoff.c:204 -#, c-format -msgid "%s: parse_coff_type: Bad type code 0x%x\n" -msgstr "" - -#: rdcoff.c:423 rdcoff.c:531 rdcoff.c:712 -#, c-format -msgid "%s: bfd_coff_get_syment failed: %s\n" -msgstr "" - -#: rdcoff.c:439 rdcoff.c:732 -#, c-format -msgid "%s: bfd_coff_get_auxent failed: %s\n" -msgstr "" - -#: rdcoff.c:798 -#, c-format -msgid "%s: %ld: .bf without preceding function\n" -msgstr "" - -#: rdcoff.c:848 -#, c-format -msgid "%s: %ld: unexpected .ef\n" -msgstr "" - -#: rddbg.c:87 -#, c-format -msgid "%s: no recognized debugging information\n" -msgstr "" - -#: rddbg.c:410 -msgid "Last stabs entries before error:\n" -msgstr "" - -#: readelf.c:303 readelf.c:329 -#, c-format -msgid "%s: Error: " -msgstr "" - -#: readelf.c:315 readelf.c:344 -#, c-format -msgid "%s: Warning: " -msgstr "" - -#: readelf.c:394 readelf.c:532 -#, c-format -msgid "Unhandled data length: %d\n" -msgstr "" - -#: readelf.c:591 -msgid "Don't know about relocations on this machine architecture\n" -msgstr "" - -#: readelf.c:631 readelf.c:660 readelf.c:692 readelf.c:720 -msgid "out of memory parsing relocs" -msgstr "" - -#: readelf.c:738 -msgid "" -" Offset Info Type Symbol's Value Symbol's Name " -"Addend\n" -msgstr "" - -#: readelf.c:741 -msgid " Offset Info Type Symbol's Value Symbol's Name\n" -msgstr "" - -#: readelf.c:885 readelf.c:887 -#, c-format -msgid "unrecognised: %-7lx" -msgstr "" - -#: readelf.c:912 -#, c-format -msgid "<string table index %3ld>" -msgstr "" - -#: readelf.c:1119 -#, c-format -msgid "Processor Specific: %lx" -msgstr "" - -#: readelf.c:1138 -#, c-format -msgid "Operating System specific: %lx" -msgstr "" - -#: readelf.c:1141 readelf.c:1506 -#, c-format -msgid "<unknown>: %lx" -msgstr "" - -#: readelf.c:1155 -msgid "NONE (None)" -msgstr "" - -#: readelf.c:1156 -msgid "REL (Relocatable file)" -msgstr "" - -#: readelf.c:1157 -msgid "EXEC (Executable file)" -msgstr "" - -#: readelf.c:1158 -msgid "DYN (Shared object file)" -msgstr "" - -#: readelf.c:1159 -msgid "CORE (Core file)" -msgstr "" - -#: readelf.c:1163 -#, c-format -msgid "Processor Specific: (%x)" -msgstr "" - -#: readelf.c:1165 -#, c-format -msgid "OS Specific: (%x)" -msgstr "" - -#: readelf.c:1167 readelf.c:1244 readelf.c:1638 -#, c-format -msgid "<unknown>: %x" -msgstr "" - -#: readelf.c:1180 -msgid "None" -msgstr "" - -#: readelf.c:1676 -msgid "Usage: readelf {options} elf-file(s)\n" -msgstr "" - -#: readelf.c:1677 -msgid " Options are:\n" -msgstr "" - -#: readelf.c:1678 -msgid " -a or --all Equivalent to: -h -l -S -s -r -d -V -A -I\n" -msgstr "" - -#: readelf.c:1679 -msgid " -h or --file-header Display the ELF file header\n" -msgstr "" - -#: readelf.c:1680 -msgid " -l or --program-headers or --segments\n" -msgstr "" - -#: readelf.c:1681 -msgid " Display the program headers\n" -msgstr "" - -#: readelf.c:1682 -msgid " -S or --section-headers or --sections\n" -msgstr "" - -#: readelf.c:1683 -msgid " Display the sections' header\n" -msgstr "" - -#: readelf.c:1684 -msgid " -e or --headers Equivalent to: -h -l -S\n" -msgstr "" - -#: readelf.c:1685 -msgid " -s or --syms or --symbols Display the symbol table\n" -msgstr "" - -#: readelf.c:1686 -msgid " -n or --notes Display the core notes (if present)\n" -msgstr "" - -#: readelf.c:1687 -msgid " -r or --relocs Display the relocations (if present)\n" -msgstr "" - -#: readelf.c:1688 -msgid " -d or --dynamic Display the dynamic segment (if present)\n" -msgstr "" - -#: readelf.c:1689 -msgid " -V or --version-info Display the version sections (if present)\n" -msgstr "" - -#: readelf.c:1690 -msgid "" -" -A or --arch-specific Display architecture specific information (if " -"any).\n" -msgstr "" - -#: readelf.c:1691 -msgid "" -" -D or --use-dynamic Use the dynamic section info when displaying " -"symbols\n" -msgstr "" - -#: readelf.c:1692 -msgid " -x <number> or --hex-dump=<number>\n" -msgstr "" - -#: readelf.c:1693 -msgid " Dump the contents of section <number>\n" -msgstr "" - -#: readelf.c:1694 -msgid " -w[liapr] or --debug-dump[=line,=info,=abbrev,=pubnames,=ranges]\n" -msgstr "" - -#: readelf.c:1695 -msgid "" -" Display the contents of DWARF2 debug sections\n" -msgstr "" - -#: readelf.c:1697 -msgid " -i <number> or --instruction-dump=<number>\n" -msgstr "" - -#: readelf.c:1698 -msgid "" -" Disassemble the contents of section <number>\n" -msgstr "" - -#: readelf.c:1700 -msgid " -I or --histogram Display histogram of bucket list lengths\n" -msgstr "" - -#: readelf.c:1701 -msgid " -v or --version Display the version number of readelf\n" -msgstr "" - -#: readelf.c:1702 -msgid " -H or --help Display this information\n" -msgstr "" - -#: readelf.c:1720 -msgid "Out of memory allocating dump request table." -msgstr "" - -#: readelf.c:1855 -#, c-format -msgid "Unrecognised debug option '%s'\n" -msgstr "" - -#: readelf.c:1880 -#, c-format -msgid "Invalid option '-%c'\n" -msgstr "" - -#: readelf.c:1893 -msgid "Nothing to do.\n" -msgstr "" - -#: readelf.c:1906 readelf.c:1923 readelf.c:3493 -msgid "none" -msgstr "" - -#: readelf.c:1907 -msgid "ELF32" -msgstr "" - -#: readelf.c:1908 -msgid "ELF64" -msgstr "" - -#: readelf.c:1910 readelf.c:1927 readelf.c:1946 -#, c-format -msgid "<unknown: %x>" -msgstr "" - -#: readelf.c:1924 -msgid "2's complement, little endian" -msgstr "" - -#: readelf.c:1925 -msgid "2's complement, big endian" -msgstr "" - -#: readelf.c:1940 -msgid "UNIX - System V" -msgstr "" - -#: readelf.c:1941 -msgid "UNIX - HP-UX" -msgstr "" - -#: readelf.c:1942 -msgid "UNIX - Linux" -msgstr "" - -#: readelf.c:1943 -msgid "Standalone App" -msgstr "" - -#: readelf.c:1944 -msgid "ARM" -msgstr "" - -#: readelf.c:1961 -msgid "Not an ELF file - it has the wrong magic bytes at the start\n" -msgstr "" - -#: readelf.c:1969 -msgid "ELF Header:\n" -msgstr "" - -#: readelf.c:1970 -msgid " Magic: " -msgstr "" - -#: readelf.c:1974 -#, c-format -msgid " Class: %s\n" -msgstr "" - -#: readelf.c:1976 -#, c-format -msgid " Data: %s\n" -msgstr "" - -#: readelf.c:1978 -#, c-format -msgid " Version: %d %s\n" -msgstr "" - -#: readelf.c:1985 -#, c-format -msgid " OS/ABI: %s\n" -msgstr "" - -#: readelf.c:1987 -#, c-format -msgid " ABI Version: %d\n" -msgstr "" - -#: readelf.c:1989 -#, c-format -msgid " Type: %s\n" -msgstr "" - -#: readelf.c:1991 -#, c-format -msgid " Machine: %s\n" -msgstr "" - -#: readelf.c:1993 -#, c-format -msgid " Version: 0x%lx\n" -msgstr "" - -#: readelf.c:1996 -msgid " Entry point address: " -msgstr "" - -#: readelf.c:1998 -msgid "" -"\n" -" Start of program headers: " -msgstr "" - -#: readelf.c:2000 -msgid "" -" (bytes into file)\n" -" Start of section headers: " -msgstr "" - -#: readelf.c:2002 -msgid " (bytes into file)\n" -msgstr "" - -#: readelf.c:2004 -#, c-format -msgid " Flags: 0x%lx%s\n" -msgstr "" - -#: readelf.c:2007 -#, c-format -msgid " Size of this header: %ld (bytes)\n" -msgstr "" - -#: readelf.c:2009 -#, c-format -msgid " Size of program headers: %ld (bytes)\n" -msgstr "" - -#: readelf.c:2011 -#, c-format -msgid " Number of program headers: %ld\n" -msgstr "" - -#: readelf.c:2013 -#, c-format -msgid " Size of section headers: %ld (bytes)\n" -msgstr "" - -#: readelf.c:2015 -#, c-format -msgid " Number of section headers: %ld\n" -msgstr "" - -#: readelf.c:2017 -#, c-format -msgid " Section header string table index: %ld\n" -msgstr "" - -#: readelf.c:2102 -msgid "" -"\n" -"There are no program headers in this file.\n" -msgstr "" - -#: readelf.c:2108 -#, c-format -msgid "" -"\n" -"Elf file type is %s\n" -msgstr "" - -#: readelf.c:2109 -msgid "Entry point " -msgstr "" - -#: readelf.c:2111 -#, c-format -msgid "" -"\n" -"There are %d program headers, starting at offset " -msgstr "" - -#: readelf.c:2122 readelf.c:2298 readelf.c:2340 readelf.c:2383 readelf.c:2424 -#: readelf.c:2932 readelf.c:2973 readelf.c:3149 readelf.c:4111 readelf.c:4125 -#: readelf.c:7023 readelf.c:7063 -msgid "Out of memory\n" -msgstr "" - -#: readelf.c:2140 -#, c-format -msgid "" -"\n" -"Program Header%s:\n" -msgstr "" - -#: readelf.c:2144 -msgid "" -" Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" -msgstr "" - -#: readelf.c:2148 -msgid " Type Offset VirtAddr PhysAddr\n" -msgstr "" - -#: readelf.c:2150 -msgid " FileSiz MemSiz Flags Align\n" -msgstr "" - -#: readelf.c:2208 -msgid "more than one dynamic segment\n" -msgstr "" - -#: readelf.c:2216 -msgid "Unable to find program interpreter name\n" -msgstr "" - -#: readelf.c:2223 -#, c-format -msgid "" -"\n" -" [Requesting program interpreter: %s]" -msgstr "" - -#: readelf.c:2241 -msgid "" -"\n" -" Section to Segment mapping:\n" -msgstr "" - -#: readelf.c:2242 -msgid " Segment Sections...\n" -msgstr "" - -#: readelf.c:2505 -msgid "" -"\n" -"There are no sections in this file.\n" -msgstr "" - -#: readelf.c:2511 -#, c-format -msgid "There are %d section headers, starting at offset 0x%lx:\n" -msgstr "" - -#: readelf.c:2551 -msgid "File contains multiple dynamic symbol tables\n" -msgstr "" - -#: readelf.c:2564 -msgid "File contains multiple dynamic string tables\n" -msgstr "" - -#: readelf.c:2591 -#, c-format -msgid "" -"\n" -"Section Header%s:\n" -msgstr "" - -#: readelf.c:2595 -msgid "" -" [Nr] Name Type Addr Off Size ES Flg Lk " -"Inf Al\n" -msgstr "" - -#: readelf.c:2598 -msgid " [Nr] Name Type Address Offset\n" -msgstr "" - -#: readelf.c:2599 -msgid " Size EntSize Flags Link Info Align\n" -msgstr "" - -#: readelf.c:2646 -msgid "" -"Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings)\n" -msgstr "" - -#: readelf.c:2647 -msgid "" -" I (info), L (link order), O (extra OS processing required)\n" -msgstr "" - -#: readelf.c:2648 -msgid " o (os specific), p (processor specific) x (unknown)\n" -msgstr "" - -#: readelf.c:2706 -#, c-format -msgid "" -"\n" -"Relocation section at offset 0x%lx contains %ld bytes:\n" -msgstr "" - -#: readelf.c:2713 -msgid "" -"\n" -"There are no dynamic relocations in this file.\n" -msgstr "" - -#: readelf.c:2741 -msgid "" -"\n" -"Relocation section " -msgstr "" - -#: readelf.c:2748 -#, c-format -msgid " at offset 0x%lx contains %lu entries:\n" -msgstr "" - -#: readelf.c:2776 -msgid "" -"\n" -"There are no relocations in this file.\n" -msgstr "" - -#: readelf.c:3026 -msgid "" -"\n" -"There is no dynamic segment in this file.\n" -msgstr "" - -#: readelf.c:3060 -msgid "Unable to seek to end of file!" -msgstr "" - -#: readelf.c:3069 -msgid "Unable to determine the number of symbols to load\n" -msgstr "" - -#: readelf.c:3099 -msgid "Unable to seek to end of file\n" -msgstr "" - -#: readelf.c:3105 -msgid "Unable to determine the length of the dynamic string table\n" -msgstr "" - -#: readelf.c:3166 -#, c-format -msgid "" -"\n" -"Dynamic segment at offset 0x%x contains %ld entries:\n" -msgstr "" - -#: readelf.c:3169 -msgid " Tag Type Name/Value\n" -msgstr "" - -#: readelf.c:3200 -msgid "Auxiliary library" -msgstr "" - -#: readelf.c:3202 -msgid "Filter library" -msgstr "" - -#: readelf.c:3218 readelf.c:3239 readelf.c:3265 -msgid "Flags:" -msgstr "" - -#: readelf.c:3220 readelf.c:3241 readelf.c:3267 -msgid " None\n" -msgstr "" - -#: readelf.c:3370 -#, c-format -msgid "Shared library: [%s]" -msgstr "" - -#: readelf.c:3373 -msgid " program interpreter" -msgstr "" - -#: readelf.c:3377 -#, c-format -msgid "Library soname: [%s]" -msgstr "" - -#: readelf.c:3381 -#, c-format -msgid "Library rpath: [%s]" -msgstr "" - -#: readelf.c:3442 -#, c-format -msgid "Not needed object: [%s]\n" -msgstr "" - -#: readelf.c:3539 -#, c-format -msgid "" -"\n" -"Version definition section '%s' contains %ld entries:\n" -msgstr "" - -#: readelf.c:3542 -msgid " Addr: 0x" -msgstr "" - -#: readelf.c:3544 readelf.c:3732 -#, c-format -msgid " Offset: %#08lx Link: %lx (%s)\n" -msgstr "" - -#: readelf.c:3574 -#, c-format -msgid " %#06x: Rev: %d Flags: %s" -msgstr "" - -#: readelf.c:3577 -#, c-format -msgid " Index: %d Cnt: %d " -msgstr "" - -#: readelf.c:3588 -#, c-format -msgid "Name: %s\n" -msgstr "" - -#: readelf.c:3590 -#, c-format -msgid "Name index: %ld\n" -msgstr "" - -#: readelf.c:3605 -#, c-format -msgid " %#06x: Parent %d: %s\n" -msgstr "" - -#: readelf.c:3608 -#, c-format -msgid " %#06x: Parent %d, name index: %ld\n" -msgstr "" - -#: readelf.c:3627 -#, c-format -msgid "" -"\n" -"Version needs section '%s' contains %ld entries:\n" -msgstr "" - -#: readelf.c:3630 -msgid " Addr: 0x" -msgstr "" - -#: readelf.c:3632 -#, c-format -msgid " Offset: %#08lx Link to section: %ld (%s)\n" -msgstr "" - -#: readelf.c:3658 -#, c-format -msgid " %#06x: Version: %d" -msgstr "" - -#: readelf.c:3661 -#, c-format -msgid " File: %s" -msgstr "" - -#: readelf.c:3663 -#, c-format -msgid " File: %lx" -msgstr "" - -#: readelf.c:3665 -#, c-format -msgid " Cnt: %d\n" -msgstr "" - -#: readelf.c:3683 -#, c-format -msgid " %#06x: Name: %s" -msgstr "" - -#: readelf.c:3686 -#, c-format -msgid " %#06x: Name index: %lx" -msgstr "" - -#: readelf.c:3689 -#, c-format -msgid " Flags: %s Version: %d\n" -msgstr "" - -#: readelf.c:3727 -#, c-format -msgid "" -"\n" -"Version symbols section '%s' contains %d entries:\n" -msgstr "" - -#: readelf.c:3730 -msgid " Addr: " -msgstr "" - -#: readelf.c:3760 -msgid " 0 (*local*) " -msgstr "" - -#: readelf.c:3764 -msgid " 1 (*global*) " -msgstr "" - -#: readelf.c:3986 -msgid "" -"\n" -"No version information found in this file.\n" -msgstr "" - -#: readelf.c:4004 readelf.c:4039 -#, c-format -msgid "<processor specific>: %d" -msgstr "" - -#: readelf.c:4006 readelf.c:4051 -#, c-format -msgid "<OS specific>: %d" -msgstr "" - -#: readelf.c:4008 readelf.c:4054 -#, c-format -msgid "<unknown>: %d" -msgstr "" - -#: readelf.c:4117 -msgid "Unable to read in dynamic data\n" -msgstr "" - -#: readelf.c:4159 -msgid "Unable to seek to start of dynamic information" -msgstr "" - -#: readelf.c:4165 -msgid "Failed to read in number of buckets\n" -msgstr "" - -#: readelf.c:4171 -msgid "Failed to read in number of chains\n" -msgstr "" - -#: readelf.c:4191 -msgid "" -"\n" -"Symbol table for image:\n" -msgstr "" - -#: readelf.c:4193 -msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" -msgstr "" - -#: readelf.c:4195 -msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" -msgstr "" - -#: readelf.c:4239 -#, c-format -msgid "" -"\n" -"Symbol table '%s' contains %lu entries:\n" -msgstr "" - -#: readelf.c:4243 -msgid " Num: Value Size Type Bind Vis Ndx Name\n" -msgstr "" - -#: readelf.c:4245 -msgid " Num: Value Size Type Bind Vis Ndx Name\n" -msgstr "" - -#: readelf.c:4354 -msgid "bad dynamic symbol" -msgstr "" - -#: readelf.c:4413 -msgid "" -"\n" -"Dynamic symbol information is not available for displaying symbols.\n" -msgstr "" - -#: readelf.c:4425 -#, c-format -msgid "" -"\n" -"Histogram for bucket list length (total of %d buckets):\n" -msgstr "" - -#: readelf.c:4427 -msgid " Length Number %% of total Coverage\n" -msgstr "" - -#: readelf.c:4432 readelf.c:4451 readelf.c:6704 readelf.c:6897 -msgid "Out of memory" -msgstr "" - -#: readelf.c:4500 -#, c-format -msgid "" -"\n" -"Dynamic info segment at offset 0x%lx contains %d entries:\n" -msgstr "" - -#: readelf.c:4503 -msgid " Num: Name BoundTo Flags\n" -msgstr "" - -#: readelf.c:4551 -#, c-format -msgid "" -"\n" -"Assembly dump of section %s\n" -msgstr "" - -#: readelf.c:4574 -#, c-format -msgid "" -"\n" -"Section '%s' has no data to dump.\n" -msgstr "" - -#: readelf.c:4579 -#, c-format -msgid "" -"\n" -"Hex dump of section '%s':\n" -msgstr "" - -#: readelf.c:4731 -msgid "badly formed extended line op encountered!" -msgstr "" - -#: readelf.c:4738 -#, c-format -msgid " Extended opcode %d: " -msgstr "" - -#: readelf.c:4743 -msgid "" -"End of Sequence\n" -"\n" -msgstr "" - -#: readelf.c:4749 -#, c-format -msgid "set Address to 0x%lx\n" -msgstr "" - -#: readelf.c:4754 -msgid " define new File Table entry\n" -msgstr "" - -#: readelf.c:4755 readelf.c:4877 -msgid " Entry\tDir\tTime\tSize\tName\n" -msgstr "" - -#: readelf.c:4757 -#, c-format -msgid " %d\t" -msgstr "" - -#: readelf.c:4760 readelf.c:4762 readelf.c:4764 readelf.c:4889 readelf.c:4891 -#: readelf.c:4893 -#, c-format -msgid "%lu\t" -msgstr "" - -#: readelf.c:4765 -#, c-format -msgid "" -"%s\n" -"\n" -msgstr "" - -#: readelf.c:4769 -#, c-format -msgid "UNKNOWN: length %d\n" -msgstr "" - -#: readelf.c:4795 -#, c-format -msgid "" -"\n" -"Dump of debug contents of section %s:\n" -"\n" -msgstr "" - -#: readelf.c:4807 -msgid "The line info appears to be corrupt - the section is too small\n" -msgstr "" - -#: readelf.c:4815 -msgid "Only DWARF version 2 line info is currently supported.\n" -msgstr "" - -#: readelf.c:4830 -#, c-format -msgid " Length: %ld\n" -msgstr "" - -#: readelf.c:4831 -#, c-format -msgid " DWARF Version: %d\n" -msgstr "" - -#: readelf.c:4832 -#, c-format -msgid " Prolgue Length: %d\n" -msgstr "" - -#: readelf.c:4833 -#, c-format -msgid " Minimum Instruction Length: %d\n" -msgstr "" - -#: readelf.c:4834 -#, c-format -msgid " Initial value of 'is_stmt': %d\n" -msgstr "" - -#: readelf.c:4835 -#, c-format -msgid " Line Base: %d\n" -msgstr "" - -#: readelf.c:4836 -#, c-format -msgid " Line Range: %d\n" -msgstr "" - -#: readelf.c:4837 -#, c-format -msgid " Opcode Base: %d\n" -msgstr "" - -#: readelf.c:4846 -msgid "" -"\n" -" Opcodes:\n" -msgstr "" - -#: readelf.c:4849 -#, c-format -msgid " Opcode %d has %d args\n" -msgstr "" - -#: readelf.c:4855 -msgid "" -"\n" -" The Directory Table is empty.\n" -msgstr "" - -#: readelf.c:4858 -msgid "" -"\n" -" The Directory Table:\n" -msgstr "" - -#: readelf.c:4862 -#, c-format -msgid " %s\n" -msgstr "" - -#: readelf.c:4873 -msgid "" -"\n" -" The File Name Table is empty.\n" -msgstr "" - -#: readelf.c:4876 -msgid "" -"\n" -" The File Name Table:\n" -msgstr "" - -#: readelf.c:4884 -#, c-format -msgid " %d\t" -msgstr "" - -#: readelf.c:4895 -#, c-format -msgid "%s\n" -msgstr "" - -#. Now display the statements. -#: readelf.c:4903 -msgid "" -"\n" -" Line Number Statements:\n" -msgstr "" - -#: readelf.c:4922 -msgid " Copy\n" -msgstr "" - -#: readelf.c:4929 -#, c-format -msgid " Advance PC by %d to %lx\n" -msgstr "" - -#: readelf.c:4937 -#, c-format -msgid " Advance Line by %d to %d\n" -msgstr "" - -#: readelf.c:4944 -#, c-format -msgid " Set File Name to entry %d in the File Name Table\n" -msgstr "" - -#: readelf.c:4952 -#, c-format -msgid " Set column to %d\n" -msgstr "" - -#: readelf.c:4959 -#, c-format -msgid " Set is_stmt to %d\n" -msgstr "" - -#: readelf.c:4964 -msgid " Set basic block\n" -msgstr "" - -#: readelf.c:4972 -#, c-format -msgid " Advance PC by constant %d to 0x%lx\n" -msgstr "" - -#: readelf.c:4980 -#, c-format -msgid " Advance PC by fixed size amount %d to 0x%lx\n" -msgstr "" - -#: readelf.c:4988 -#, c-format -msgid " Special opcode %d: advance Address by %d to 0x%lx" -msgstr "" - -#: readelf.c:4992 -#, c-format -msgid " and Line by %d to %d\n" -msgstr "" - -#: readelf.c:5015 readelf.c:5437 -#, c-format -msgid "" -"Contents of the %s section:\n" -"\n" -msgstr "" - -#: readelf.c:5034 -msgid "Only DWARF 2 pubnames are currently supported" -msgstr "" - -#: readelf.c:5038 -#, c-format -msgid " Length: %ld\n" -msgstr "" - -#: readelf.c:5040 -#, c-format -msgid " Version: %d\n" -msgstr "" - -#: readelf.c:5042 -#, c-format -msgid " Offset into .debug_info section: %ld\n" -msgstr "" - -#: readelf.c:5044 -#, c-format -msgid " Size of area in .debug_info section: %ld\n" -msgstr "" - -#: readelf.c:5047 -msgid "" -"\n" -" Offset\tName\n" -msgstr "" - -#: readelf.c:5129 -#, c-format -msgid "Unknown TAG value: %lx" -msgstr "" - -#: readelf.c:5224 -#, c-format -msgid "Unknown AT value: %lx" -msgstr "" - -#: readelf.c:5261 -#, c-format -msgid "Unknown FORM value: %lx" -msgstr "" - -#: readelf.c:5443 -msgid " Number TAG\n" -msgstr "" - -#: readelf.c:5449 -#, c-format -msgid " %ld %s [%s]\n" -msgstr "" - -#: readelf.c:5452 -msgid "has children" -msgstr "" - -#: readelf.c:5452 -msgid "no children" -msgstr "" - -#: readelf.c:5456 -#, c-format -msgid " %-18s %s\n" -msgstr "" - -#: readelf.c:5475 -#, c-format -msgid " %lu byte block: " -msgstr "" - -#: readelf.c:5939 -msgid "(User defined location op)" -msgstr "" - -#: readelf.c:5941 -msgid "(Unknown location op)" -msgstr "" - -#: readelf.c:6058 -#, c-format -msgid "Unable to handle FORM: %d" -msgstr "" - -#: readelf.c:6062 -#, c-format -msgid "Unrecognised form: %d" -msgstr "" - -#: readelf.c:6075 -msgid "(not inlined)" -msgstr "" - -#: readelf.c:6076 -msgid "(inlined)" -msgstr "" - -#: readelf.c:6077 -msgid "(declared as inline but ignored)" -msgstr "" - -#: readelf.c:6078 -msgid "(declared as inline and inlined)" -msgstr "" - -#: readelf.c:6079 -#, c-format -msgid " (Unknown inline attribute value: %lx)" -msgstr "" - -#: readelf.c:6209 readelf.c:6333 -#, c-format -msgid "" -"The section %s contains:\n" -"\n" -msgstr "" - -#: readelf.c:6231 -msgid "Only version 2 DWARF debug information is currently supported.\n" -msgstr "" - -#: readelf.c:6235 -msgid " Compilation Unit:\n" -msgstr "" - -#: readelf.c:6236 -#, c-format -msgid " Length: %ld\n" -msgstr "" - -#: readelf.c:6237 -#, c-format -msgid " Version: %d\n" -msgstr "" - -#: readelf.c:6238 -#, c-format -msgid " Abbrev Offset: %ld\n" -msgstr "" - -#: readelf.c:6239 -#, c-format -msgid " Pointer Size: %d\n" -msgstr "" - -#: readelf.c:6259 -msgid "Unable to locate .debug_abbrev section!\n" -msgstr "" - -#: readelf.c:6299 -#, c-format -msgid "Unable to locate entry %lu in the abbreviation table\n" -msgstr "" - -#: readelf.c:6304 -#, c-format -msgid " <%d><%x>: Abbrev Number: %lu (%s)\n" -msgstr "" - -#: readelf.c:6352 -#, c-format -msgid " Length: %ld\n" -msgstr "" - -#: readelf.c:6353 -#, c-format -msgid " Version: %d\n" -msgstr "" - -#: readelf.c:6354 -#, c-format -msgid " Offset into .debug_info: %lx\n" -msgstr "" - -#: readelf.c:6355 -#, c-format -msgid " Pointer Size: %d\n" -msgstr "" - -#: readelf.c:6356 -#, c-format -msgid " Segment Size: %d\n" -msgstr "" - -#: readelf.c:6358 -msgid "" -"\n" -" Address Length\n" -msgstr "" - -#: readelf.c:6399 -#, c-format -msgid "Displaying the debug contents of section %s is not yet supported.\n" -msgstr "" - -#: readelf.c:6461 -#, c-format -msgid "" -"\n" -"Section '%s' has no debugging data.\n" -msgstr "" - -#: readelf.c:6477 -#, c-format -msgid "Unrecognised debug section: %s\n" -msgstr "" - -#: readelf.c:6549 -msgid "Some sections were not dumped because they do not exist!\n" -msgstr "" - -#: readelf.c:6728 -#, c-format -msgid "" -"\n" -"Section '%s' contains %d entries:\n" -msgstr "" - -#: readelf.c:6890 -msgid "conflict list with without table" -msgstr "" - -#: readelf.c:6918 -#, c-format -msgid "" -"\n" -"Section '.conflict' contains %d entries:\n" -msgstr "" - -#: readelf.c:6919 -msgid " Num: Index Value Name" -msgstr "" - -#: readelf.c:6944 -msgid "NT_PRSTATUS (prstatus structure)" -msgstr "" - -#: readelf.c:6945 -msgid "NT_FPREGSET (floating point registers)" -msgstr "" - -#: readelf.c:6946 -msgid "NT_PRPSINFO (prpsinfo structure)" -msgstr "" - -#: readelf.c:6947 -msgid "NT_TASKSTRUCT (task structure)" -msgstr "" - -#: readelf.c:6948 -msgid "NT_PRXFPREG (user_xfpregs structure)" -msgstr "" - -#: readelf.c:6949 -msgid "NT_PSTATUS (pstatus structure)" -msgstr "" - -#: readelf.c:6950 -msgid "NT_FPREGS (floating point registers)" -msgstr "" - -#: readelf.c:6951 -msgid "NT_PSINFO (psinfo structure)" -msgstr "" - -#: readelf.c:6952 -msgid "NT_LWPSTATUS (lwpstatus_t structure)" -msgstr "" - -#: readelf.c:6953 -msgid "NT_LWPSINFO (lwpsinfo_t structure)" -msgstr "" - -#: readelf.c:6954 -msgid "NT_WIN32PSTATUS (win32_pstatus strcuture)" -msgstr "" - -#: readelf.c:6956 -#, c-format -msgid "Unknown note type: (0x%08x)" -msgstr "" - -#: readelf.c:6994 -#, c-format -msgid "" -"\n" -"Notes at offset 0x%08lx with length 0x%08lx:\n" -msgstr "" - -#: readelf.c:6997 -msgid " Owner\t\tData size\tDescription\n" -msgstr "" - -#: readelf.c:7108 -msgid "No note segments present in the core file.\n" -msgstr "" - -#: readelf.c:7186 -msgid "This instance of readelf has been built without support for a\n" -msgstr "" - -#: readelf.c:7187 -msgid "64 bit data type and so it cannot read 64 bit ELF files.\n" -msgstr "" - -#: readelf.c:7222 -#, c-format -msgid "Cannot stat input file %s.\n" -msgstr "" - -#: readelf.c:7229 -#, c-format -msgid "Input file %s not found.\n" -msgstr "" - -#: readelf.c:7235 -#, c-format -msgid "%s: Failed to read file header\n" -msgstr "" - -#: readelf.c:7249 -#, c-format -msgid "" -"\n" -"File: %s\n" -msgstr "" - -#: rename.c:131 -#, c-format -msgid "%s: cannot set time: %s" -msgstr "" - -#. We have to clean up here. -#: rename.c:170 rename.c:203 -#, c-format -msgid "%s: rename: %s" -msgstr "" - -#: rename.c:211 -#, c-format -msgid "%s: simple_copy: %s" -msgstr "" - -#: resbin.c:130 -#, c-format -msgid "%s: not enough binary data" -msgstr "" - -#: resbin.c:149 -msgid "null terminated unicode string" -msgstr "" - -#: resbin.c:179 resbin.c:185 -msgid "resource ID" -msgstr "" - -#: resbin.c:229 -msgid "cursor" -msgstr "" - -#: resbin.c:263 resbin.c:270 -msgid "menu header" -msgstr "" - -#: resbin.c:280 -msgid "menuex header" -msgstr "" - -#: resbin.c:284 -msgid "menuex offset" -msgstr "" - -#: resbin.c:291 -#, c-format -msgid "unsupported menu version %d" -msgstr "" - -#: resbin.c:319 resbin.c:334 resbin.c:400 -msgid "menuitem header" -msgstr "" - -#: resbin.c:430 -msgid "menuitem" -msgstr "" - -#: resbin.c:471 resbin.c:499 -msgid "dialog header" -msgstr "" - -#: resbin.c:489 -#, c-format -msgid "unexpected dialog signature %d" -msgstr "" - -#: resbin.c:531 -msgid "dialog font point size" -msgstr "" - -#: resbin.c:539 -msgid "dialogex font information" -msgstr "" - -#: resbin.c:564 resbin.c:582 -msgid "dialog control" -msgstr "" - -#: resbin.c:574 -msgid "dialogex control" -msgstr "" - -#: resbin.c:603 -msgid "dialog control end" -msgstr "" - -#: resbin.c:615 -msgid "dialog control data" -msgstr "" - -#: resbin.c:658 -msgid "stringtable string length" -msgstr "" - -#: resbin.c:668 -msgid "stringtable string" -msgstr "" - -#: resbin.c:701 -msgid "fontdir header" -msgstr "" - -#: resbin.c:714 -msgid "fontdir" -msgstr "" - -#: resbin.c:730 -msgid "fontdir device name" -msgstr "" - -#: resbin.c:736 -msgid "fontdir face name" -msgstr "" - -#: resbin.c:779 -msgid "accelerator" -msgstr "" - -#: resbin.c:843 -msgid "group cursor header" -msgstr "" - -#: resbin.c:847 -#, c-format -msgid "unexpected group cursor type %d" -msgstr "" - -#: resbin.c:862 -msgid "group cursor" -msgstr "" - -#: resbin.c:901 -msgid "group icon header" -msgstr "" - -#: resbin.c:905 -#, c-format -msgid "unexpected group icon type %d" -msgstr "" - -#: resbin.c:920 -msgid "group icon" -msgstr "" - -#: resbin.c:991 resbin.c:1210 -msgid "unexpected version string" -msgstr "" - -#: resbin.c:1025 -#, c-format -msgid "version length %d does not match resource length %lu" -msgstr "" - -#: resbin.c:1029 -#, c-format -msgid "unexpected version type %d" -msgstr "" - -#: resbin.c:1041 -#, c-format -msgid "unexpected fixed version information length %d" -msgstr "" - -#: resbin.c:1044 -msgid "fixed version info" -msgstr "" - -#: resbin.c:1048 -#, c-format -msgid "unexpected fixed version signature %lu" -msgstr "" - -#: resbin.c:1052 -#, c-format -msgid "unexpected fixed version info version %lu" -msgstr "" - -#: resbin.c:1081 -msgid "version var info" -msgstr "" - -#: resbin.c:1098 -#, c-format -msgid "unexpected stringfileinfo value length %d" -msgstr "" - -#: resbin.c:1108 -#, c-format -msgid "unexpected version stringtable value length %d" -msgstr "" - -#: resbin.c:1142 -#, c-format -msgid "unexpected version string length %d != %d + %d" -msgstr "" - -#: resbin.c:1153 -#, c-format -msgid "unexpected version string length %d < %d" -msgstr "" - -#: resbin.c:1170 -#, c-format -msgid "unexpected varfileinfo value length %d" -msgstr "" - -#: resbin.c:1189 -msgid "version varfileinfo" -msgstr "" - -#: resbin.c:1204 -#, c-format -msgid "unexpected version value length %d" -msgstr "" - -#: rescoff.c:128 -msgid "filename required for COFF input" -msgstr "" - -#: rescoff.c:145 -#, c-format -msgid "%s: %s: no resource section\n" -msgstr "" - -#: rescoff.c:154 -msgid "can't read resource section" -msgstr "" - -#: rescoff.c:180 -#, c-format -msgid "%s: %s: address out of bounds" -msgstr "" - -#: rescoff.c:199 -msgid "directory" -msgstr "" - -#: rescoff.c:227 -msgid "named directory entry" -msgstr "" - -#: rescoff.c:236 -msgid "directory entry name" -msgstr "" - -#: rescoff.c:256 -msgid "named subdirectory" -msgstr "" - -#: rescoff.c:264 -msgid "named resource" -msgstr "" - -#: rescoff.c:279 -msgid "ID directory entry" -msgstr "" - -#: rescoff.c:296 -msgid "ID subdirectory" -msgstr "" - -#: rescoff.c:304 -msgid "ID resource" -msgstr "" - -#: rescoff.c:330 -msgid "resource type unknown" -msgstr "" - -#: rescoff.c:333 -msgid "data entry" -msgstr "" - -#: rescoff.c:341 -msgid "resource data" -msgstr "" - -#: rescoff.c:346 -msgid "resource data size" -msgstr "" - -#: rescoff.c:441 -msgid "filename required for COFF output" -msgstr "" - -#: rescoff.c:740 -msgid "can't get BFD_RELOC_RVA relocation type" -msgstr "" - -#: resrc.c:240 resrc.c:312 -#, c-format -msgid "can't open temporary file `%s': %s" -msgstr "" - -#: resrc.c:246 -#, c-format -msgid "can't redirect stdout: `%s': %s" -msgstr "" - -#: resrc.c:262 -#, c-format -msgid "%s %s: %s" -msgstr "" - -#: resrc.c:283 -#, c-format -msgid "%s exited with status %d" -msgstr "" - -#: resrc.c:308 -#, c-format -msgid "can't execute `%s': %s" -msgstr "" - -#: resrc.c:317 -#, c-format -msgid "Using temporary file `%s' to read preprocessor output\n" -msgstr "" - -#: resrc.c:324 -#, c-format -msgid "can't popen `%s': %s" -msgstr "" - -#: resrc.c:326 -msgid "Using popen to read preprocessor output\n" -msgstr "" - -#: resrc.c:369 -#, c-format -msgid "Tried `%s'\n" -msgstr "" - -#: resrc.c:380 -#, c-format -msgid "Using `%s'\n" -msgstr "" - -#: resrc.c:544 -#, c-format -msgid "%s:%d: %s\n" -msgstr "" - -#: resrc.c:553 -#, c-format -msgid "%s: unexpected EOF" -msgstr "" - -#: resrc.c:610 -#, c-format -msgid "%s: read of %lu returned %lu" -msgstr "" - -#: resrc.c:652 resrc.c:883 resrc.c:1156 resrc.c:1310 -#, c-format -msgid "stat failed on bitmap file `%s': %s" -msgstr "" - -#: resrc.c:705 -#, c-format -msgid "cursor file `%s' does not contain cursor data" -msgstr "" - -#: resrc.c:737 resrc.c:1027 -#, c-format -msgid "%s: fseek to %lu failed: %s" -msgstr "" - -#: resrc.c:996 -#, c-format -msgid "icon file `%s' does not contain icon data" -msgstr "" - -#: resrc.c:1515 -#, c-format -msgid "can't open `%s' for output: %s" -msgstr "" - -#: size.c:79 -#, c-format -msgid "" -"Usage: %s [-ABdoxV] [--format=berkeley|sysv] [--radix=8|10|16]\n" -" [--target=bfdname] [--version] [--help] [file...]\n" -msgstr "" - -#: size.c:83 -msgid "default is --format=berkeley\n" -msgstr "" - -#: size.c:85 -msgid "default is --format=sysv\n" -msgstr "" - -#: size.c:139 -#, c-format -msgid "invalid argument to --format: %s\n" -msgstr "" - -#: size.c:166 -#, c-format -msgid "Invalid radix: %s\n" -msgstr "" - -#: srconv.c:1879 -#, c-format -msgid "Usage: %s [-dhVq] in-file [out-file]\n" -msgstr "" - -#: srconv.c:1886 -#, c-format -msgid "%s: Convert a COFF object file into a SYSROFF object file\n" -msgstr "" - -#: srconv.c:2024 -#, c-format -msgid "%s: unable to open output file %s\n" -msgstr "" - -#: stabs.c:349 stabs.c:1769 -msgid "numeric overflow" -msgstr "" - -#: stabs.c:360 -#, c-format -msgid "Bad stab: %s\n" -msgstr "" - -#: stabs.c:370 -#, c-format -msgid "Warning: %s: %s\n" -msgstr "" - -#: stabs.c:492 -msgid "N_LBRAC not within function\n" -msgstr "" - -#: stabs.c:531 -msgid "Too many N_RBRACs\n" -msgstr "" - -#: stabs.c:780 -msgid "unknown C++ encoded name" -msgstr "" - -#. Complain and keep going, so compilers can invent new -#. cross-reference types. -#: stabs.c:1306 -msgid "unrecognized cross reference type" -msgstr "" - -#. Does this actually ever happen? Is that why we are worrying -#. about dealing with it rather than just calling error_type? -#: stabs.c:1861 -msgid "missing index type" -msgstr "" - -#: stabs.c:2188 -msgid "unknown virtual character for baseclass" -msgstr "" - -#: stabs.c:2206 -msgid "unknown visibility character for baseclass" -msgstr "" - -#: stabs.c:2398 -msgid "unnamed $vb type" -msgstr "" - -#: stabs.c:2404 -msgid "unrecognized C++ abbreviation" -msgstr "" - -#: stabs.c:2484 -msgid "unknown visibility character for field" -msgstr "" - -#: stabs.c:2740 -msgid "const/volatile indicator missing" -msgstr "" - -#: stabs.c:2980 -#, c-format -msgid "No mangling for \"%s\"\n" -msgstr "" - -#: stabs.c:3293 -msgid "Undefined N_EXCL" -msgstr "" - -#: stabs.c:3381 -#, c-format -msgid "Type file number %d out of range\n" -msgstr "" - -#: stabs.c:3386 -#, c-format -msgid "Type index number %d out of range\n" -msgstr "" - -#: stabs.c:3473 -#, c-format -msgid "Unrecognized XCOFF type %d\n" -msgstr "" - -#: stabs.c:3772 -#, c-format -msgid "bad mangled name `%s'\n" -msgstr "" - -#: stabs.c:3868 -msgid "no argument types in mangled string\n" -msgstr "" - -#: strings.c:159 -#, c-format -msgid "%s: invalid number %s\n" -msgstr "" - -#: strings.c:494 -#, c-format -msgid "%s: invalid integer argument %s\n" -msgstr "" - -#: strings.c:505 -#, c-format -msgid "" -"Usage: %s [-afov] [-n min-len] [-min-len] [-t {o,x,d}] [-]\n" -" [--all] [--print-file-name] [--bytes=min-len] [--radix={o,x,d}]\n" -" [--target=bfdname] [--help] [--version] file...\n" -msgstr "" - -#: sysdump.c:712 -#, c-format -msgid "Usage: %s [-hV] in-file\n" -msgstr "" - -#: sysdump.c:783 -#, c-format -msgid "%s: cannot open input file %s\n" -msgstr "" - -#: version.c:39 -msgid "Copyright 1997, 1998, 1999 Free Software Foundation, Inc.\n" -msgstr "" - -#: version.c:40 -msgid "" -"This program is free software; you may redistribute it under the terms of\n" -"the GNU General Public License. This program has absolutely no warranty.\n" -msgstr "" - -#: windres.c:237 -#, c-format -msgid "can't open %s `%s': %s" -msgstr "" - -#: windres.c:416 -msgid ": expected to be a directory\n" -msgstr "" - -#: windres.c:428 -msgid ": expected to be a leaf\n" -msgstr "" - -#: windres.c:437 -#, c-format -msgid "%s: warning: " -msgstr "" - -#: windres.c:439 -msgid ": duplicate value\n" -msgstr "" - -#: windres.c:602 -#, c-format -msgid "%s: unknown format type `%s'\n" -msgstr "" - -#: windres.c:603 -#, c-format -msgid "%s: supported formats:" -msgstr "" - -#. Otherwise, we give up. -#: windres.c:690 -#, c-format -msgid "can not determine type of file `%s'; use the -I option" -msgstr "" - -#: windres.c:704 -#, c-format -msgid "Usage: %s [options] [input-file] [output-file]\n" -msgstr "" - -#: windres.c:706 -msgid "" -"Options:\n" -" -i FILE, --input FILE Name input file\n" -" -o FILE, --output FILE Name output file\n" -" -I FORMAT, --input-format FORMAT\n" -" Specify input format\n" -" -O FORMAT, --output-format FORMAT\n" -" Specify output format\n" -" -F TARGET, --target TARGET Specify COFF target\n" -" --preprocessor PROGRAM Program to use to preprocess rc file\n" -" --include-dir DIR Include directory when preprocessing rc file\n" -" -DSYM[=VAL], --define SYM[=VAL]\n" -" Define SYM when preprocessing rc file\n" -" -v Verbose - tells you what it's doing\n" -" --language VAL Set language when reading rc file\n" -" --use-temp-file Use a temporary file instead of popen to read\n" -" the preprocessor output\n" -" --no-use-temp-file Use popen (default)\n" -msgstr "" - -#: windres.c:725 -msgid " --yydebug Turn on parser debugging\n" -msgstr "" - -#: windres.c:728 -msgid "" -" --help Print this help message\n" -" --version Print version information\n" -msgstr "" - -#: windres.c:731 -msgid "" -"FORMAT is one of rc, res, or coff, and is deduced from the file name\n" -"extension if not specified. A single file name is an input file.\n" -"No input-file is stdin, default rc. No output-file is stdout, default rc.\n" -msgstr "" - -#: windres.c:980 -msgid "no resources" -msgstr "" - -#: wrstabs.c:366 wrstabs.c:2028 -#, c-format -msgid "string_hash_lookup failed: %s\n" -msgstr "" - -#: wrstabs.c:666 -#, c-format -msgid "stab_int_type: bad size %u\n" -msgstr "" - -#: wrstabs.c:1468 -#, c-format -msgid "%s: warning: unknown size for field `%s' in struct\n" -msgstr "" diff --git a/contrib/binutils/include/elf/v850.h b/contrib/binutils/include/elf/v850.h deleted file mode 100644 index 62b9541e8e98..000000000000 --- a/contrib/binutils/include/elf/v850.h +++ /dev/null @@ -1,107 +0,0 @@ -/* V850 ELF support for BFD. - Copyright 1997, 1998, 2000 Free Software Foundation, Inc. - Created by Michael Meissner, Cygnus Support <meissner@cygnus.com> - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file holds definitions specific to the MIPS ELF ABI. Note - that most of this is not actually implemented by BFD. */ - -#ifndef _ELF_V850_H -#define _ELF_V850_H - -/* Processor specific flags for the ELF header e_flags field. */ - -/* Four bit V850 architecture field. */ -#define EF_V850_ARCH 0xf0000000 - -/* v850 code. */ -#define E_V850_ARCH 0x00000000 - -/* v850e code. */ -#define E_V850E_ARCH 0x10000000 - -/* v850ea code. */ -#define E_V850EA_ARCH 0x20000000 - - -/* Flags for the st_other field */ -#define V850_OTHER_SDA 0x01 /* symbol had SDA relocations */ -#define V850_OTHER_ZDA 0x02 /* symbol had ZDA relocations */ -#define V850_OTHER_TDA 0x04 /* symbol had TDA relocations */ -#define V850_OTHER_TDA_BYTE 0x08 /* symbol had TDA byte relocations */ -#define V850_OTHER_ERROR 0x80 /* symbol had an error reported */ - -/* V850 relocations */ -#include "elf/reloc-macros.h" - -START_RELOC_NUMBERS (v850_reloc_type) - RELOC_NUMBER (R_V850_NONE, 0) - RELOC_NUMBER (R_V850_9_PCREL, 1) - RELOC_NUMBER (R_V850_22_PCREL, 2) - RELOC_NUMBER (R_V850_HI16_S, 3) - RELOC_NUMBER (R_V850_HI16, 4) - RELOC_NUMBER (R_V850_LO16, 5) - RELOC_NUMBER (R_V850_32, 6) - RELOC_NUMBER (R_V850_16, 7) - RELOC_NUMBER (R_V850_8, 8) - RELOC_NUMBER( R_V850_SDA_16_16_OFFSET, 9) /* For ld.b, st.b, set1, clr1, not1, tst1, movea, movhi */ - RELOC_NUMBER( R_V850_SDA_15_16_OFFSET, 10) /* For ld.w, ld.h, ld.hu, st.w, st.h */ - RELOC_NUMBER( R_V850_ZDA_16_16_OFFSET, 11) /* For ld.b, st.b, set1, clr1, not1, tst1, movea, movhi */ - RELOC_NUMBER( R_V850_ZDA_15_16_OFFSET, 12) /* For ld.w, ld.h, ld.hu, st.w, st.h */ - RELOC_NUMBER( R_V850_TDA_6_8_OFFSET, 13) /* For sst.w, sld.w */ - RELOC_NUMBER( R_V850_TDA_7_8_OFFSET, 14) /* For sst.h, sld.h */ - RELOC_NUMBER( R_V850_TDA_7_7_OFFSET, 15) /* For sst.b, sld.b */ - RELOC_NUMBER( R_V850_TDA_16_16_OFFSET, 16) /* For set1, clr1, not1, tst1, movea, movhi */ - RELOC_NUMBER( R_V850_TDA_4_5_OFFSET, 17) /* For sld.hu */ - RELOC_NUMBER( R_V850_TDA_4_4_OFFSET, 18) /* For sld.bu */ - RELOC_NUMBER( R_V850_SDA_16_16_SPLIT_OFFSET, 19) /* For ld.bu */ - RELOC_NUMBER( R_V850_ZDA_16_16_SPLIT_OFFSET, 20) /* For ld.bu */ - RELOC_NUMBER( R_V850_CALLT_6_7_OFFSET, 21) /* For callt */ - RELOC_NUMBER( R_V850_CALLT_16_16_OFFSET, 22) /* For callt */ - RELOC_NUMBER (R_V850_GNU_VTINHERIT, 23) - RELOC_NUMBER (R_V850_GNU_VTENTRY, 24) -END_RELOC_NUMBERS (R_V850_max) - - -/* Processor specific section indices. These sections do not actually - exist. Symbols with a st_shndx field corresponding to one of these - values have a special meaning. */ - -/* Small data area common symbol. */ -#define SHN_V850_SCOMMON 0xff00 - -/* Tiny data area common symbol. */ -#define SHN_V850_TCOMMON 0xff01 - -/* Zero data area common symbol. */ -#define SHN_V850_ZCOMMON 0xff02 - - -/* Processor specific section types. */ - -/* Section contains the .scommon data. */ -#define SHT_V850_SCOMMON 0x70000000 - -/* Section contains the .scommon data. */ -#define SHT_V850_TCOMMON 0x70000001 - -/* Section contains the .scommon data. */ -#define SHT_V850_ZCOMMON 0x70000002 - - -#endif /* _ELF_V850_H */ diff --git a/contrib/binutils/include/opcode/mips.h b/contrib/binutils/include/opcode/mips.h deleted file mode 100644 index 68fe57a8aae2..000000000000 --- a/contrib/binutils/include/opcode/mips.h +++ /dev/null @@ -1,749 +0,0 @@ -/* mips.h. Mips opcode list for GDB, the GNU debugger. - Copyright 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. - Contributed by Ralph Campbell and OSF - Commented and modified by Ian Lance Taylor, Cygnus Support - -This file is part of GDB, GAS, and the GNU binutils. - -GDB, GAS, and the GNU binutils are free software; you can redistribute -them and/or modify them under the terms of the GNU General Public -License as published by the Free Software Foundation; either version -1, or (at your option) any later version. - -GDB, GAS, and the GNU binutils are distributed in the hope that they -will be useful, but WITHOUT ANY WARRANTY; without even the implied -warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this file; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef _MIPS_H_ -#define _MIPS_H_ - -/* These are bit masks and shift counts to use to access the various - fields of an instruction. To retrieve the X field of an - instruction, use the expression - (i >> OP_SH_X) & OP_MASK_X - To set the same field (to j), use - i = (i &~ (OP_MASK_X << OP_SH_X)) | (j << OP_SH_X) - - Make sure you use fields that are appropriate for the instruction, - of course. - - The 'i' format uses OP, RS, RT and IMMEDIATE. - - The 'j' format uses OP and TARGET. - - The 'r' format uses OP, RS, RT, RD, SHAMT and FUNCT. - - The 'b' format uses OP, RS, RT and DELTA. - - The floating point 'i' format uses OP, RS, RT and IMMEDIATE. - - The floating point 'r' format uses OP, FMT, FT, FS, FD and FUNCT. - - A breakpoint instruction uses OP, CODE and SPEC (10 bits of the - breakpoint instruction are not defined; Kane says the breakpoint - code field in BREAK is 20 bits; yet MIPS assemblers and debuggers - only use ten bits). An optional two-operand form of break/sdbbp - allows the lower ten bits to be set too. - - The syscall instruction uses SYSCALL. - - The general coprocessor instructions use COPZ. */ - -#define OP_MASK_OP 0x3f -#define OP_SH_OP 26 -#define OP_MASK_RS 0x1f -#define OP_SH_RS 21 -#define OP_MASK_FR 0x1f -#define OP_SH_FR 21 -#define OP_MASK_FMT 0x1f -#define OP_SH_FMT 21 -#define OP_MASK_BCC 0x7 -#define OP_SH_BCC 18 -#define OP_MASK_CODE 0x3ff -#define OP_SH_CODE 16 -#define OP_MASK_CODE2 0x3ff -#define OP_SH_CODE2 6 -#define OP_MASK_RT 0x1f -#define OP_SH_RT 16 -#define OP_MASK_FT 0x1f -#define OP_SH_FT 16 -#define OP_MASK_CACHE 0x1f -#define OP_SH_CACHE 16 -#define OP_MASK_RD 0x1f -#define OP_SH_RD 11 -#define OP_MASK_FS 0x1f -#define OP_SH_FS 11 -#define OP_MASK_PREFX 0x1f -#define OP_SH_PREFX 11 -#define OP_MASK_CCC 0x7 -#define OP_SH_CCC 8 -#define OP_MASK_SYSCALL 0xfffff -#define OP_SH_SYSCALL 6 -#define OP_MASK_SHAMT 0x1f -#define OP_SH_SHAMT 6 -#define OP_MASK_FD 0x1f -#define OP_SH_FD 6 -#define OP_MASK_TARGET 0x3ffffff -#define OP_SH_TARGET 0 -#define OP_MASK_COPZ 0x1ffffff -#define OP_SH_COPZ 0 -#define OP_MASK_IMMEDIATE 0xffff -#define OP_SH_IMMEDIATE 0 -#define OP_MASK_DELTA 0xffff -#define OP_SH_DELTA 0 -#define OP_MASK_FUNCT 0x3f -#define OP_SH_FUNCT 0 -#define OP_MASK_SPEC 0x3f -#define OP_SH_SPEC 0 -#define OP_SH_LOCC 8 /* FP condition code */ -#define OP_SH_HICC 18 /* FP condition code */ -#define OP_MASK_CC 0x7 -#define OP_SH_COP1NORM 25 /* Normal COP1 encoding */ -#define OP_MASK_COP1NORM 0x1 /* a single bit */ -#define OP_SH_COP1SPEC 21 /* COP1 encodings */ -#define OP_MASK_COP1SPEC 0xf -#define OP_MASK_COP1SCLR 0x4 -#define OP_MASK_COP1CMP 0x3 -#define OP_SH_COP1CMP 4 -#define OP_SH_FORMAT 21 /* FP short format field */ -#define OP_MASK_FORMAT 0x7 -#define OP_SH_TRUE 16 -#define OP_MASK_TRUE 0x1 -#define OP_SH_GE 17 -#define OP_MASK_GE 0x01 -#define OP_SH_UNSIGNED 16 -#define OP_MASK_UNSIGNED 0x1 -#define OP_SH_HINT 16 -#define OP_MASK_HINT 0x1f -#define OP_SH_MMI 0 /* Multimedia (parallel) op */ -#define OP_MASK_MMI 0x3f -#define OP_SH_MMISUB 6 -#define OP_MASK_MMISUB 0x1f -#define OP_MASK_PERFREG 0x1f /* Performance monitoring */ -#define OP_SH_PERFREG 1 - -/* This structure holds information for a particular instruction. */ - -struct mips_opcode -{ - /* The name of the instruction. */ - const char *name; - /* A string describing the arguments for this instruction. */ - const char *args; - /* The basic opcode for the instruction. When assembling, this - opcode is modified by the arguments to produce the actual opcode - that is used. If pinfo is INSN_MACRO, then this is 0. */ - unsigned long match; - /* If pinfo is not INSN_MACRO, then this is a bit mask for the - relevant portions of the opcode when disassembling. If the - actual opcode anded with the match field equals the opcode field, - then we have found the correct instruction. If pinfo is - INSN_MACRO, then this field is the macro identifier. */ - unsigned long mask; - /* For a macro, this is INSN_MACRO. Otherwise, it is a collection - of bits describing the instruction, notably any relevant hazard - information. */ - unsigned long pinfo; - /* A collection of bits describing the instruction sets of which this - instruction or macro is a member. */ - unsigned long membership; -}; - -/* These are the characters which may appears in the args field of an - instruction. They appear in the order in which the fields appear - when the instruction is used. Commas and parentheses in the args - string are ignored when assembling, and written into the output - when disassembling. - - Each of these characters corresponds to a mask field defined above. - - "<" 5 bit shift amount (OP_*_SHAMT) - ">" shift amount between 32 and 63, stored after subtracting 32 (OP_*_SHAMT) - "a" 26 bit target address (OP_*_TARGET) - "b" 5 bit base register (OP_*_RS) - "c" 10 bit breakpoint code (OP_*_CODE) - "d" 5 bit destination register specifier (OP_*_RD) - "h" 5 bit prefx hint (OP_*_PREFX) - "i" 16 bit unsigned immediate (OP_*_IMMEDIATE) - "j" 16 bit signed immediate (OP_*_DELTA) - "k" 5 bit cache opcode in target register position (OP_*_CACHE) - "o" 16 bit signed offset (OP_*_DELTA) - "p" 16 bit PC relative branch target address (OP_*_DELTA) - "q" 10 bit extra breakpoint code (OP_*_CODE2) - "r" 5 bit same register used as both source and target (OP_*_RS) - "s" 5 bit source register specifier (OP_*_RS) - "t" 5 bit target register (OP_*_RT) - "u" 16 bit upper 16 bits of address (OP_*_IMMEDIATE) - "v" 5 bit same register used as both source and destination (OP_*_RS) - "w" 5 bit same register used as both target and destination (OP_*_RT) - "C" 25 bit coprocessor function code (OP_*_COPZ) - "B" 20 bit syscall function code (OP_*_SYSCALL) - "x" accept and ignore register name - "z" must be zero register - - Floating point instructions: - "D" 5 bit destination register (OP_*_FD) - "M" 3 bit compare condition code (OP_*_CCC) (only used for mips4 and up) - "N" 3 bit branch condition code (OP_*_BCC) (only used for mips4 and up) - "S" 5 bit fs source 1 register (OP_*_FS) - "T" 5 bit ft source 2 register (OP_*_FT) - "R" 5 bit fr source 3 register (OP_*_FR) - "V" 5 bit same register used as floating source and destination (OP_*_FS) - "W" 5 bit same register used as floating target and destination (OP_*_FT) - - Coprocessor instructions: - "E" 5 bit target register (OP_*_RT) - "G" 5 bit destination register (OP_*_RD) - "P" 5 bit performance-monitor register (OP_*_PERFREG) - - Macro instructions: - "A" General 32 bit expression - "I" 32 bit immediate - "F" 64 bit floating point constant in .rdata - "L" 64 bit floating point constant in .lit8 - "f" 32 bit floating point constant - "l" 32 bit floating point constant in .lit4 - - Other: - "()" parens surrounding optional value - "," separates operands - - Characters used so far, for quick reference when adding more: - "<>()," - "ABCDEFGILMNSTRVW" - "abcdfhijklopqrstuvwxz" -*/ - -/* These are the bits which may be set in the pinfo field of an - instructions, if it is not equal to INSN_MACRO. */ - -/* Modifies the general purpose register in OP_*_RD. */ -#define INSN_WRITE_GPR_D 0x00000001 -/* Modifies the general purpose register in OP_*_RT. */ -#define INSN_WRITE_GPR_T 0x00000002 -/* Modifies general purpose register 31. */ -#define INSN_WRITE_GPR_31 0x00000004 -/* Modifies the floating point register in OP_*_FD. */ -#define INSN_WRITE_FPR_D 0x00000008 -/* Modifies the floating point register in OP_*_FS. */ -#define INSN_WRITE_FPR_S 0x00000010 -/* Modifies the floating point register in OP_*_FT. */ -#define INSN_WRITE_FPR_T 0x00000020 -/* Reads the general purpose register in OP_*_RS. */ -#define INSN_READ_GPR_S 0x00000040 -/* Reads the general purpose register in OP_*_RT. */ -#define INSN_READ_GPR_T 0x00000080 -/* Reads the floating point register in OP_*_FS. */ -#define INSN_READ_FPR_S 0x00000100 -/* Reads the floating point register in OP_*_FT. */ -#define INSN_READ_FPR_T 0x00000200 -/* Reads the floating point register in OP_*_FR. */ -#define INSN_READ_FPR_R 0x00000400 -/* Modifies coprocessor condition code. */ -#define INSN_WRITE_COND_CODE 0x00000800 -/* Reads coprocessor condition code. */ -#define INSN_READ_COND_CODE 0x00001000 -/* TLB operation. */ -#define INSN_TLB 0x00002000 -/* Reads coprocessor register other than floating point register. */ -#define INSN_COP 0x00004000 -/* Instruction loads value from memory, requiring delay. */ -#define INSN_LOAD_MEMORY_DELAY 0x00008000 -/* Instruction loads value from coprocessor, requiring delay. */ -#define INSN_LOAD_COPROC_DELAY 0x00010000 -/* Instruction has unconditional branch delay slot. */ -#define INSN_UNCOND_BRANCH_DELAY 0x00020000 -/* Instruction has conditional branch delay slot. */ -#define INSN_COND_BRANCH_DELAY 0x00040000 -/* Conditional branch likely: if branch not taken, insn nullified. */ -#define INSN_COND_BRANCH_LIKELY 0x00080000 -/* Moves to coprocessor register, requiring delay. */ -#define INSN_COPROC_MOVE_DELAY 0x00100000 -/* Loads coprocessor register from memory, requiring delay. */ -#define INSN_COPROC_MEMORY_DELAY 0x00200000 -/* Reads the HI register. */ -#define INSN_READ_HI 0x00400000 -/* Reads the LO register. */ -#define INSN_READ_LO 0x00800000 -/* Modifies the HI register. */ -#define INSN_WRITE_HI 0x01000000 -/* Modifies the LO register. */ -#define INSN_WRITE_LO 0x02000000 -/* Takes a trap (easier to keep out of delay slot). */ -#define INSN_TRAP 0x04000000 -/* Instruction stores value into memory. */ -#define INSN_STORE_MEMORY 0x08000000 -/* Instruction uses single precision floating point. */ -#define FP_S 0x10000000 -/* Instruction uses double precision floating point. */ -#define FP_D 0x20000000 -/* Instruction is part of the tx39's integer multiply family. */ -#define INSN_MULT 0x40000000 -/* Instruction synchronize shared memory. */ -#define INSN_SYNC 0x80000000 - -/* Instruction is actually a macro. It should be ignored by the - disassembler, and requires special treatment by the assembler. */ -#define INSN_MACRO 0xffffffff - - - - - -/* MIPS ISA field--CPU level at which insn is supported. */ -#define INSN_ISA 0x0000000F -/* An instruction which is not part of any basic MIPS ISA. - (ie it is a chip specific instruction) */ -#define INSN_NO_ISA 0x00000000 -/* MIPS ISA 1 instruction. */ -#define INSN_ISA1 0x00000001 -/* MIPS ISA 2 instruction (R6000 or R4000). */ -#define INSN_ISA2 0x00000002 -/* MIPS ISA 3 instruction (R4000). */ -#define INSN_ISA3 0x00000003 -/* MIPS ISA 4 instruction (R8000). */ -#define INSN_ISA4 0x00000004 -#define INSN_ISA5 0x00000005 - -/* Chip specific instructions. These are bitmasks. */ -/* MIPS R4650 instruction. */ -#define INSN_4650 0x00000010 -/* LSI R4010 instruction. */ -#define INSN_4010 0x00000020 -/* NEC VR4100 instruction. */ -#define INSN_4100 0x00000040 -/* Toshiba R3900 instruction. */ -#define INSN_3900 0x00000080 - -/* 32-bit code running on a ISA3+ CPU. */ -#define INSN_GP32 0x00001000 - -/* Test for membership in an ISA including chip specific ISAs. - INSN is pointer to an element of the opcode table; ISA is the - specified ISA to test against; and CPU is the CPU specific ISA - to test, or zero if no CPU specific ISA test is desired. - The gp32 arg is set when you need to force 32-bit register usage on - a machine with 64-bit registers; see the documentation under -mgp32 - in the MIPS gas docs. */ - -#define OPCODE_IS_MEMBER(insn,isa,cpu,gp32) \ - ((((insn)->membership & INSN_ISA) != 0 \ - && ((insn)->membership & INSN_ISA) <= isa \ - && ((insn)->membership & INSN_GP32 ? gp32 : 1)) \ - || (cpu == 4650 \ - && ((insn)->membership & INSN_4650) != 0) \ - || (cpu == 4010 \ - && ((insn)->membership & INSN_4010) != 0) \ - || ((cpu == 4100 \ - || cpu == 4111 \ - ) \ - && ((insn)->membership & INSN_4100) != 0) \ - || (cpu == 3900 \ - && ((insn)->membership & INSN_3900) != 0)) - -/* This is a list of macro expanded instructions. - * - * _I appended means immediate - * _A appended means address - * _AB appended means address with base register - * _D appended means 64 bit floating point constant - * _S appended means 32 bit floating point constant - */ -enum { - M_ABS, - M_ADD_I, - M_ADDU_I, - M_AND_I, - M_BEQ, - M_BEQ_I, - M_BEQL_I, - M_BGE, - M_BGEL, - M_BGE_I, - M_BGEL_I, - M_BGEU, - M_BGEUL, - M_BGEU_I, - M_BGEUL_I, - M_BGT, - M_BGTL, - M_BGT_I, - M_BGTL_I, - M_BGTU, - M_BGTUL, - M_BGTU_I, - M_BGTUL_I, - M_BLE, - M_BLEL, - M_BLE_I, - M_BLEL_I, - M_BLEU, - M_BLEUL, - M_BLEU_I, - M_BLEUL_I, - M_BLT, - M_BLTL, - M_BLT_I, - M_BLTL_I, - M_BLTU, - M_BLTUL, - M_BLTU_I, - M_BLTUL_I, - M_BNE, - M_BNE_I, - M_BNEL_I, - M_DABS, - M_DADD_I, - M_DADDU_I, - M_DDIV_3, - M_DDIV_3I, - M_DDIVU_3, - M_DDIVU_3I, - M_DIV_3, - M_DIV_3I, - M_DIVU_3, - M_DIVU_3I, - M_DLA_AB, - M_DLI, - M_DMUL, - M_DMUL_I, - M_DMULO, - M_DMULO_I, - M_DMULOU, - M_DMULOU_I, - M_DREM_3, - M_DREM_3I, - M_DREMU_3, - M_DREMU_3I, - M_DSUB_I, - M_DSUBU_I, - M_DSUBU_I_2, - M_J_A, - M_JAL_1, - M_JAL_2, - M_JAL_A, - M_L_DOB, - M_L_DAB, - M_LA_AB, - M_LB_A, - M_LB_AB, - M_LBU_A, - M_LBU_AB, - M_LD_A, - M_LD_OB, - M_LD_AB, - M_LDC1_AB, - M_LDC2_AB, - M_LDC3_AB, - M_LDL_AB, - M_LDR_AB, - M_LH_A, - M_LH_AB, - M_LHU_A, - M_LHU_AB, - M_LI, - M_LI_D, - M_LI_DD, - M_LI_S, - M_LI_SS, - M_LL_AB, - M_LLD_AB, - M_LS_A, - M_LW_A, - M_LW_AB, - M_LWC0_A, - M_LWC0_AB, - M_LWC1_A, - M_LWC1_AB, - M_LWC2_A, - M_LWC2_AB, - M_LWC3_A, - M_LWC3_AB, - M_LWL_A, - M_LWL_AB, - M_LWR_A, - M_LWR_AB, - M_LWU_AB, - M_MUL, - M_MUL_I, - M_MULO, - M_MULO_I, - M_MULOU, - M_MULOU_I, - M_NOR_I, - M_OR_I, - M_REM_3, - M_REM_3I, - M_REMU_3, - M_REMU_3I, - M_ROL, - M_ROL_I, - M_ROR, - M_ROR_I, - M_S_DA, - M_S_DOB, - M_S_DAB, - M_S_S, - M_SC_AB, - M_SCD_AB, - M_SD_A, - M_SD_OB, - M_SD_AB, - M_SDC1_AB, - M_SDC2_AB, - M_SDC3_AB, - M_SDL_AB, - M_SDR_AB, - M_SEQ, - M_SEQ_I, - M_SGE, - M_SGE_I, - M_SGEU, - M_SGEU_I, - M_SGT, - M_SGT_I, - M_SGTU, - M_SGTU_I, - M_SLE, - M_SLE_I, - M_SLEU, - M_SLEU_I, - M_SLT_I, - M_SLTU_I, - M_SNE, - M_SNE_I, - M_SB_A, - M_SB_AB, - M_SH_A, - M_SH_AB, - M_SW_A, - M_SW_AB, - M_SWC0_A, - M_SWC0_AB, - M_SWC1_A, - M_SWC1_AB, - M_SWC2_A, - M_SWC2_AB, - M_SWC3_A, - M_SWC3_AB, - M_SWL_A, - M_SWL_AB, - M_SWR_A, - M_SWR_AB, - M_SUB_I, - M_SUBU_I, - M_SUBU_I_2, - M_TEQ_I, - M_TGE_I, - M_TGEU_I, - M_TLT_I, - M_TLTU_I, - M_TNE_I, - M_TRUNCWD, - M_TRUNCWS, - M_ULD, - M_ULD_A, - M_ULH, - M_ULH_A, - M_ULHU, - M_ULHU_A, - M_ULW, - M_ULW_A, - M_USH, - M_USH_A, - M_USW, - M_USW_A, - M_USD, - M_USD_A, - M_XOR_I, - M_COP0, - M_COP1, - M_COP2, - M_COP3, - M_NUM_MACROS -}; - - -/* The order of overloaded instructions matters. Label arguments and - register arguments look the same. Instructions that can have either - for arguments must apear in the correct order in this table for the - assembler to pick the right one. In other words, entries with - immediate operands must apear after the same instruction with - registers. - - Many instructions are short hand for other instructions (i.e., The - jal <register> instruction is short for jalr <register>). */ - -extern const struct mips_opcode mips_builtin_opcodes[]; -extern const int bfd_mips_num_builtin_opcodes; -extern struct mips_opcode *mips_opcodes; -extern int bfd_mips_num_opcodes; -#define NUMOPCODES bfd_mips_num_opcodes - - -/* The rest of this file adds definitions for the mips16 TinyRISC - processor. */ - -/* These are the bitmasks and shift counts used for the different - fields in the instruction formats. Other than OP, no masks are - provided for the fixed portions of an instruction, since they are - not needed. - - The I format uses IMM11. - - The RI format uses RX and IMM8. - - The RR format uses RX, and RY. - - The RRI format uses RX, RY, and IMM5. - - The RRR format uses RX, RY, and RZ. - - The RRI_A format uses RX, RY, and IMM4. - - The SHIFT format uses RX, RY, and SHAMT. - - The I8 format uses IMM8. - - The I8_MOVR32 format uses RY and REGR32. - - The IR_MOV32R format uses REG32R and MOV32Z. - - The I64 format uses IMM8. - - The RI64 format uses RY and IMM5. - */ - -#define MIPS16OP_MASK_OP 0x1f -#define MIPS16OP_SH_OP 11 -#define MIPS16OP_MASK_IMM11 0x7ff -#define MIPS16OP_SH_IMM11 0 -#define MIPS16OP_MASK_RX 0x7 -#define MIPS16OP_SH_RX 8 -#define MIPS16OP_MASK_IMM8 0xff -#define MIPS16OP_SH_IMM8 0 -#define MIPS16OP_MASK_RY 0x7 -#define MIPS16OP_SH_RY 5 -#define MIPS16OP_MASK_IMM5 0x1f -#define MIPS16OP_SH_IMM5 0 -#define MIPS16OP_MASK_RZ 0x7 -#define MIPS16OP_SH_RZ 2 -#define MIPS16OP_MASK_IMM4 0xf -#define MIPS16OP_SH_IMM4 0 -#define MIPS16OP_MASK_REGR32 0x1f -#define MIPS16OP_SH_REGR32 0 -#define MIPS16OP_MASK_REG32R 0x1f -#define MIPS16OP_SH_REG32R 3 -#define MIPS16OP_EXTRACT_REG32R(i) ((((i) >> 5) & 7) | ((i) & 0x18)) -#define MIPS16OP_MASK_MOVE32Z 0x7 -#define MIPS16OP_SH_MOVE32Z 0 -#define MIPS16OP_MASK_IMM6 0x3f -#define MIPS16OP_SH_IMM6 5 - -/* These are the characters which may appears in the args field of an - instruction. They appear in the order in which the fields appear - when the instruction is used. Commas and parentheses in the args - string are ignored when assembling, and written into the output - when disassembling. - - "y" 3 bit register (MIPS16OP_*_RY) - "x" 3 bit register (MIPS16OP_*_RX) - "z" 3 bit register (MIPS16OP_*_RZ) - "Z" 3 bit register (MIPS16OP_*_MOVE32Z) - "v" 3 bit same register as source and destination (MIPS16OP_*_RX) - "w" 3 bit same register as source and destination (MIPS16OP_*_RY) - "0" zero register ($0) - "S" stack pointer ($sp or $29) - "P" program counter - "R" return address register ($ra or $31) - "X" 5 bit MIPS register (MIPS16OP_*_REGR32) - "Y" 5 bit MIPS register (MIPS16OP_*_REG32R) - "6" 6 bit unsigned break code (MIPS16OP_*_IMM6) - "a" 26 bit jump address - "e" 11 bit extension value - "l" register list for entry instruction - "L" register list for exit instruction - - The remaining codes may be extended. Except as otherwise noted, - the full extended operand is a 16 bit signed value. - "<" 3 bit unsigned shift count * 0 (MIPS16OP_*_RZ) (full 5 bit unsigned) - ">" 3 bit unsigned shift count * 0 (MIPS16OP_*_RX) (full 5 bit unsigned) - "[" 3 bit unsigned shift count * 0 (MIPS16OP_*_RZ) (full 6 bit unsigned) - "]" 3 bit unsigned shift count * 0 (MIPS16OP_*_RX) (full 6 bit unsigned) - "4" 4 bit signed immediate * 0 (MIPS16OP_*_IMM4) (full 15 bit signed) - "5" 5 bit unsigned immediate * 0 (MIPS16OP_*_IMM5) - "H" 5 bit unsigned immediate * 2 (MIPS16OP_*_IMM5) - "W" 5 bit unsigned immediate * 4 (MIPS16OP_*_IMM5) - "D" 5 bit unsigned immediate * 8 (MIPS16OP_*_IMM5) - "j" 5 bit signed immediate * 0 (MIPS16OP_*_IMM5) - "8" 8 bit unsigned immediate * 0 (MIPS16OP_*_IMM8) - "V" 8 bit unsigned immediate * 4 (MIPS16OP_*_IMM8) - "C" 8 bit unsigned immediate * 8 (MIPS16OP_*_IMM8) - "U" 8 bit unsigned immediate * 0 (MIPS16OP_*_IMM8) (full 16 bit unsigned) - "k" 8 bit signed immediate * 0 (MIPS16OP_*_IMM8) - "K" 8 bit signed immediate * 8 (MIPS16OP_*_IMM8) - "p" 8 bit conditional branch address (MIPS16OP_*_IMM8) - "q" 11 bit branch address (MIPS16OP_*_IMM11) - "A" 8 bit PC relative address * 4 (MIPS16OP_*_IMM8) - "B" 5 bit PC relative address * 8 (MIPS16OP_*_IMM5) - "E" 5 bit PC relative address * 4 (MIPS16OP_*_IMM5) - */ - -/* For the mips16, we use the same opcode table format and a few of - the same flags. However, most of the flags are different. */ - -/* Modifies the register in MIPS16OP_*_RX. */ -#define MIPS16_INSN_WRITE_X 0x00000001 -/* Modifies the register in MIPS16OP_*_RY. */ -#define MIPS16_INSN_WRITE_Y 0x00000002 -/* Modifies the register in MIPS16OP_*_RZ. */ -#define MIPS16_INSN_WRITE_Z 0x00000004 -/* Modifies the T ($24) register. */ -#define MIPS16_INSN_WRITE_T 0x00000008 -/* Modifies the SP ($29) register. */ -#define MIPS16_INSN_WRITE_SP 0x00000010 -/* Modifies the RA ($31) register. */ -#define MIPS16_INSN_WRITE_31 0x00000020 -/* Modifies the general purpose register in MIPS16OP_*_REG32R. */ -#define MIPS16_INSN_WRITE_GPR_Y 0x00000040 -/* Reads the register in MIPS16OP_*_RX. */ -#define MIPS16_INSN_READ_X 0x00000080 -/* Reads the register in MIPS16OP_*_RY. */ -#define MIPS16_INSN_READ_Y 0x00000100 -/* Reads the register in MIPS16OP_*_MOVE32Z. */ -#define MIPS16_INSN_READ_Z 0x00000200 -/* Reads the T ($24) register. */ -#define MIPS16_INSN_READ_T 0x00000400 -/* Reads the SP ($29) register. */ -#define MIPS16_INSN_READ_SP 0x00000800 -/* Reads the RA ($31) register. */ -#define MIPS16_INSN_READ_31 0x00001000 -/* Reads the program counter. */ -#define MIPS16_INSN_READ_PC 0x00002000 -/* Reads the general purpose register in MIPS16OP_*_REGR32. */ -#define MIPS16_INSN_READ_GPR_X 0x00004000 -/* Is a branch insn. */ -#define MIPS16_INSN_BRANCH 0x00010000 - -/* The following flags have the same value for the mips16 opcode - table: - INSN_UNCOND_BRANCH_DELAY - INSN_COND_BRANCH_DELAY - INSN_COND_BRANCH_LIKELY (never used) - INSN_READ_HI - INSN_READ_LO - INSN_WRITE_HI - INSN_WRITE_LO - INSN_TRAP - INSN_ISA3 - */ - -extern const struct mips_opcode mips16_opcodes[]; -extern const int bfd_mips16_num_opcodes; - -#endif /* _MIPS_H_ */ diff --git a/contrib/binutils/include/opcode/tic30.h b/contrib/binutils/include/opcode/tic30.h deleted file mode 100644 index a70027591188..000000000000 --- a/contrib/binutils/include/opcode/tic30.h +++ /dev/null @@ -1,691 +0,0 @@ -/* tic30.h -- Header file for TI TMS320C30 opcode table - Copyright 1998 Free Software Foundation, Inc. - Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) - -This file is part of GDB, GAS, and the GNU binutils. - -GDB, GAS, and the GNU binutils are free software; you can redistribute -them and/or modify them under the terms of the GNU General Public -License as published by the Free Software Foundation; either version -1, or (at your option) any later version. - -GDB, GAS, and the GNU binutils are distributed in the hope that they -will be useful, but WITHOUT ANY WARRANTY; without even the implied -warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this file; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -/* FIXME: The opcode table should be in opcodes/tic30-opc.c, not in a - header file. */ - -#ifndef _TMS320_H_ -#define _TMS320_H_ - -struct _register -{ - char *name; - unsigned char opcode; - unsigned char regtype; -}; - -typedef struct _register reg; - -#define REG_Rn 0x01 -#define REG_ARn 0x02 -#define REG_DP 0x03 -#define REG_OTHER 0x04 - -static const reg tic30_regtab[] = { - { "r0", 0x00, REG_Rn }, - { "r1", 0x01, REG_Rn }, - { "r2", 0x02, REG_Rn }, - { "r3", 0x03, REG_Rn }, - { "r4", 0x04, REG_Rn }, - { "r5", 0x05, REG_Rn }, - { "r6", 0x06, REG_Rn }, - { "r7", 0x07, REG_Rn }, - { "ar0",0x08, REG_ARn }, - { "ar1",0x09, REG_ARn }, - { "ar2",0x0A, REG_ARn }, - { "ar3",0x0B, REG_ARn }, - { "ar4",0x0C, REG_ARn }, - { "ar5",0x0D, REG_ARn }, - { "ar6",0x0E, REG_ARn }, - { "ar7",0x0F, REG_ARn }, - { "dp", 0x10, REG_DP }, - { "ir0",0x11, REG_OTHER }, - { "ir1",0x12, REG_OTHER }, - { "bk", 0x13, REG_OTHER }, - { "sp", 0x14, REG_OTHER }, - { "st", 0x15, REG_OTHER }, - { "ie", 0x16, REG_OTHER }, - { "if", 0x17, REG_OTHER }, - { "iof",0x18, REG_OTHER }, - { "rs", 0x19, REG_OTHER }, - { "re", 0x1A, REG_OTHER }, - { "rc", 0x1B, REG_OTHER }, - { "R0", 0x00, REG_Rn }, - { "R1", 0x01, REG_Rn }, - { "R2", 0x02, REG_Rn }, - { "R3", 0x03, REG_Rn }, - { "R4", 0x04, REG_Rn }, - { "R5", 0x05, REG_Rn }, - { "R6", 0x06, REG_Rn }, - { "R7", 0x07, REG_Rn }, - { "AR0",0x08, REG_ARn }, - { "AR1",0x09, REG_ARn }, - { "AR2",0x0A, REG_ARn }, - { "AR3",0x0B, REG_ARn }, - { "AR4",0x0C, REG_ARn }, - { "AR5",0x0D, REG_ARn }, - { "AR6",0x0E, REG_ARn }, - { "AR7",0x0F, REG_ARn }, - { "DP", 0x10, REG_DP }, - { "IR0",0x11, REG_OTHER }, - { "IR1",0x12, REG_OTHER }, - { "BK", 0x13, REG_OTHER }, - { "SP", 0x14, REG_OTHER }, - { "ST", 0x15, REG_OTHER }, - { "IE", 0x16, REG_OTHER }, - { "IF", 0x17, REG_OTHER }, - { "IOF",0x18, REG_OTHER }, - { "RS", 0x19, REG_OTHER }, - { "RE", 0x1A, REG_OTHER }, - { "RC", 0x1B, REG_OTHER }, - { "", 0, 0 } -}; - -static const reg *const tic30_regtab_end - = tic30_regtab + sizeof(tic30_regtab)/sizeof(tic30_regtab[0]); - -/* Indirect Addressing Modes Modification Fields */ -/* Indirect Addressing with Displacement */ -#define PreDisp_Add 0x00 -#define PreDisp_Sub 0x01 -#define PreDisp_Add_Mod 0x02 -#define PreDisp_Sub_Mod 0x03 -#define PostDisp_Add_Mod 0x04 -#define PostDisp_Sub_Mod 0x05 -#define PostDisp_Add_Circ 0x06 -#define PostDisp_Sub_Circ 0x07 -/* Indirect Addressing with Index Register IR0 */ -#define PreIR0_Add 0x08 -#define PreIR0_Sub 0x09 -#define PreIR0_Add_Mod 0x0A -#define PreIR0_Sub_Mod 0x0B -#define PostIR0_Add_Mod 0x0C -#define PostIR0_Sub_Mod 0x0D -#define PostIR0_Add_Circ 0x0E -#define PostIR0_Sub_Circ 0x0F -/* Indirect Addressing with Index Register IR1 */ -#define PreIR1_Add 0x10 -#define PreIR1_Sub 0x11 -#define PreIR1_Add_Mod 0x12 -#define PreIR1_Sub_Mod 0x13 -#define PostIR1_Add_Mod 0x14 -#define PostIR1_Sub_Mod 0x15 -#define PostIR1_Add_Circ 0x16 -#define PostIR1_Sub_Circ 0x17 -/* Indirect Addressing (Special Cases) */ -#define IndirectOnly 0x18 -#define PostIR0_Add_BitRev 0x19 - -typedef struct { - char *syntax; - unsigned char modfield; - unsigned char displacement; -} ind_addr_type; - -#define IMPLIED_DISP 0x01 -#define DISP_REQUIRED 0x02 -#define NO_DISP 0x03 - -static const ind_addr_type tic30_indaddr_tab[] = { - { "*+ar", PreDisp_Add, IMPLIED_DISP }, - { "*-ar", PreDisp_Sub, IMPLIED_DISP }, - { "*++ar", PreDisp_Add_Mod, IMPLIED_DISP }, - { "*--ar", PreDisp_Sub_Mod, IMPLIED_DISP }, - { "*ar++", PostDisp_Add_Mod, IMPLIED_DISP }, - { "*ar--", PostDisp_Sub_Mod, IMPLIED_DISP }, - { "*ar++%", PostDisp_Add_Circ, IMPLIED_DISP }, - { "*ar--%", PostDisp_Sub_Circ, IMPLIED_DISP }, - { "*+ar()", PreDisp_Add, DISP_REQUIRED }, - { "*-ar()", PreDisp_Sub, DISP_REQUIRED }, - { "*++ar()", PreDisp_Add_Mod, DISP_REQUIRED }, - { "*--ar()", PreDisp_Sub_Mod, DISP_REQUIRED }, - { "*ar++()", PostDisp_Add_Mod, DISP_REQUIRED }, - { "*ar--()", PostDisp_Sub_Mod, DISP_REQUIRED }, - { "*ar++()%", PostDisp_Add_Circ, DISP_REQUIRED }, - { "*ar--()%", PostDisp_Sub_Circ, DISP_REQUIRED }, - { "*+ar(ir0)", PreIR0_Add, NO_DISP }, - { "*-ar(ir0)", PreIR0_Sub, NO_DISP }, - { "*++ar(ir0)", PreIR0_Add_Mod, NO_DISP }, - { "*--ar(ir0)", PreIR0_Sub_Mod, NO_DISP }, - { "*ar++(ir0)", PostIR0_Add_Mod, NO_DISP }, - { "*ar--(ir0)", PostIR0_Sub_Mod, NO_DISP }, - { "*ar++(ir0)%",PostIR0_Add_Circ, NO_DISP }, - { "*ar--(ir0)%",PostIR0_Sub_Circ, NO_DISP }, - { "*+ar(ir1)", PreIR1_Add, NO_DISP }, - { "*-ar(ir1)", PreIR1_Sub, NO_DISP }, - { "*++ar(ir1)", PreIR1_Add_Mod, NO_DISP }, - { "*--ar(ir1)", PreIR1_Sub_Mod, NO_DISP }, - { "*ar++(ir1)", PostIR1_Add_Mod, NO_DISP }, - { "*ar--(ir1)", PostIR1_Sub_Mod, NO_DISP }, - { "*ar++(ir1)%",PostIR1_Add_Circ, NO_DISP }, - { "*ar--(ir1)%",PostIR1_Sub_Circ, NO_DISP }, - { "*ar", IndirectOnly, NO_DISP }, - { "*ar++(ir0)b",PostIR0_Add_BitRev, NO_DISP }, - { "", 0,0 } -}; - -static const ind_addr_type *const tic30_indaddrtab_end - = tic30_indaddr_tab + sizeof(tic30_indaddr_tab)/sizeof(tic30_indaddr_tab[0]); - -/* Possible operand types */ -/* Register types */ -#define Rn 0x0001 -#define ARn 0x0002 -#define DPReg 0x0004 -#define OtherReg 0x0008 -/* Addressing mode types */ -#define Direct 0x0010 -#define Indirect 0x0020 -#define Imm16 0x0040 -#define Disp 0x0080 -#define Imm24 0x0100 -#define Abs24 0x0200 -/* 3 operand addressing mode types */ -#define op3T1 0x0400 -#define op3T2 0x0800 -/* Interrupt vector */ -#define IVector 0x1000 -/* Not required */ -#define NotReq 0x2000 - -#define GAddr1 Rn | Direct | Indirect | Imm16 -#define GAddr2 GAddr1 | AllReg -#define TAddr1 op3T1 | Rn | Indirect -#define TAddr2 op3T2 | Rn | Indirect -#define Reg Rn | ARn -#define AllReg Reg | DPReg | OtherReg - -typedef struct _template -{ - char *name; - unsigned int operands; /* how many operands */ - unsigned int base_opcode; /* base_opcode is the fundamental opcode byte */ - /* the bits in opcode_modifier are used to generate the final opcode from - the base_opcode. These bits also are used to detect alternate forms of - the same instruction */ - unsigned int opcode_modifier; - - /* opcode_modifier bits: */ -#define AddressMode 0x00600000 -#define PCRel 0x02000000 -#define StackOp 0x001F0000 -#define Rotate StackOp - - /* operand_types[i] describes the type of operand i. This is made - by OR'ing together all of the possible type masks. (e.g. - 'operand_types[i] = Reg|Imm' specifies that operand i can be - either a register or an immediate operand */ - unsigned int operand_types[3]; - /* This defines the number type of an immediate argument to an instruction. */ - int imm_arg_type; -#define Imm_None 0 -#define Imm_Float 1 -#define Imm_SInt 2 -#define Imm_UInt 3 -} -template; - -static const template tic30_optab[] = { - { "absf" ,2,0x00000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "absi" ,2,0x00800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "addc" ,2,0x01000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "addc3" ,3,0x20000000,AddressMode, { TAddr1|AllReg, TAddr2|AllReg, AllReg }, Imm_None }, - { "addf" ,2,0x01800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "addf3" ,3,0x20800000,AddressMode, { TAddr1, TAddr2, Rn }, Imm_None }, - { "addi" ,2,0x02000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "addi3" ,3,0x21000000,AddressMode, { TAddr1|AllReg, TAddr2|AllReg, AllReg }, Imm_None }, - { "and" ,2,0x02800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_UInt }, - { "and3" ,3,0x21800000,AddressMode, { TAddr1|AllReg, TAddr2|AllReg, AllReg }, Imm_None }, - { "andn" ,2,0x03000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_UInt }, - { "andn3" ,3,0x22000000,AddressMode, { TAddr1|AllReg, TAddr2|AllReg, AllReg }, Imm_None }, - { "ash" ,2,0x03800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ash3" ,3,0x22800000,AddressMode, { TAddr1|AllReg, TAddr2|AllReg, AllReg }, Imm_None }, - { "b" ,1,0x68000000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bu" ,1,0x68000000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "blo" ,1,0x68010000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bls" ,1,0x68020000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bhi" ,1,0x68030000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bhs" ,1,0x68040000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "beq" ,1,0x68050000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bne" ,1,0x68060000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "blt" ,1,0x68070000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "ble" ,1,0x68080000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bgt" ,1,0x68090000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bge" ,1,0x680A0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bz" ,1,0x68050000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bnz" ,1,0x68060000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bp" ,1,0x68090000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bn" ,1,0x68070000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bnn" ,1,0x680A0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bnv" ,1,0x680C0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bv" ,1,0x680D0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bnuf" ,1,0x680E0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "buf" ,1,0x680F0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bnc" ,1,0x68040000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bc" ,1,0x68010000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bnlv" ,1,0x68100000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "blv" ,1,0x68110000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bnluf" ,1,0x68120000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bluf" ,1,0x68130000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bzuf" ,1,0x68140000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bd" ,1,0x68200000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bud" ,1,0x68200000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "blod" ,1,0x68210000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "blsd" ,1,0x68220000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bhid" ,1,0x68230000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bhsd" ,1,0x68240000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "beqd" ,1,0x68250000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bned" ,1,0x68260000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bltd" ,1,0x68270000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bled" ,1,0x68280000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bgtd" ,1,0x68290000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bged" ,1,0x682A0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bzd" ,1,0x68250000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bnzd" ,1,0x68260000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bpd" ,1,0x68290000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bnd" ,1,0x68270000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bnnd" ,1,0x682A0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bnvd" ,1,0x682C0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bvd" ,1,0x682D0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bnufd" ,1,0x682E0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bufd" ,1,0x682F0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bncd" ,1,0x68240000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bcd" ,1,0x68210000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bnlvd" ,1,0x68300000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "blvd" ,1,0x68310000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bnlufd" ,1,0x68320000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "blufd" ,1,0x68330000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "bzufd" ,1,0x68340000,PCRel, { AllReg|Disp, 0, 0 }, Imm_None }, - { "br" ,1,0x60000000,0, { Imm24, 0, 0 }, Imm_UInt }, - { "brd" ,1,0x61000000,0, { Imm24, 0, 0 }, Imm_UInt }, - { "call" ,1,0x62000000,0, { Imm24, 0, 0 }, Imm_UInt }, - { "callu" ,1,0x70000000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "calllo" ,1,0x70010000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callls" ,1,0x70020000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callhi" ,1,0x70030000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callhs" ,1,0x70040000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "calleq" ,1,0x70050000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callne" ,1,0x70060000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "calllt" ,1,0x70070000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callle" ,1,0x70080000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callgt" ,1,0x70090000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callge" ,1,0x700A0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callz" ,1,0x70050000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callnz" ,1,0x70060000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callp" ,1,0x70090000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "calln" ,1,0x70070000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callnn" ,1,0x700A0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callnv" ,1,0x700C0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callv" ,1,0x700D0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callnuf",1,0x700E0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "calluf" ,1,0x700F0000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callnc" ,1,0x70040000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callc" ,1,0x70010000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callnlv",1,0x70100000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "calllv" ,1,0x70110000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callnluf",1,0x70120000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callluf",1,0x70130000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "callzuf",1,0x70140000,PCRel, { AllReg|Disp, 0, 0 }, Imm_UInt }, - { "cmpf" ,2,0x04000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "cmpf3" ,2,0x23000000,AddressMode, { TAddr1, TAddr2, 0 }, Imm_None }, - { "cmpi" ,2,0x04800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "cmpi3" ,2,0x23800000,AddressMode, { TAddr1|AllReg, TAddr2|AllReg, 0 }, Imm_None }, - { "db" ,2,0x6C000000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbu" ,2,0x6C000000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dblo" ,2,0x6C010000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbls" ,2,0x6C020000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbhi" ,2,0x6C030000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbhs" ,2,0x6C040000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbeq" ,2,0x6C050000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbne" ,2,0x6C060000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dblt" ,2,0x6C070000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dble" ,2,0x6C080000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbgt" ,2,0x6C090000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbge" ,2,0x6C0A0000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbz" ,2,0x6C050000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbnz" ,2,0x6C060000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbp" ,2,0x6C090000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbn" ,2,0x6C070000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbnn" ,2,0x6C0A0000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbnv" ,2,0x6C0C0000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbv" ,2,0x6C0D0000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbnuf" ,2,0x6C0E0000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbuf" ,2,0x6C0F0000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbnc" ,2,0x6C040000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbc" ,2,0x6C010000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbnlv" ,2,0x6C100000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dblv" ,2,0x6C110000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbnluf" ,2,0x6C120000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbluf" ,2,0x6C130000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbzuf" ,2,0x6C140000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbd" ,2,0x6C200000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbud" ,2,0x6C200000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dblod" ,2,0x6C210000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dblsd" ,2,0x6C220000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbhid" ,2,0x6C230000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbhsd" ,2,0x6C240000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbeqd" ,2,0x6C250000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbned" ,2,0x6C260000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbltd" ,2,0x6C270000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbled" ,2,0x6C280000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbgtd" ,2,0x6C290000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbged" ,2,0x6C2A0000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbzd" ,2,0x6C250000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbnzd" ,2,0x6C260000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbpd" ,2,0x6C290000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbnd" ,2,0x6C270000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbnnd" ,2,0x6C2A0000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbnvd" ,2,0x6C2C0000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbvd" ,2,0x6C2D0000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbnufd" ,2,0x6C2E0000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbufd" ,2,0x6C2F0000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbncd" ,2,0x6C240000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbcd" ,2,0x6C210000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbnlvd" ,2,0x6C300000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dblvd" ,2,0x6C310000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbnlufd",2,0x6C320000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dblufd" ,2,0x6C330000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "dbzufd" ,2,0x6C340000,PCRel, { ARn, AllReg|Disp, 0 }, Imm_None }, - { "fix" ,2,0x05000000,AddressMode, { GAddr1, AllReg, 0 }, Imm_Float }, - { "float" ,2,0x05800000,AddressMode, { GAddr2, Rn, 0 }, Imm_SInt }, - { "iack" ,1,0x1B000000,AddressMode, { Direct|Indirect, 0, 0 }, Imm_None }, - { "idle" ,0,0x06000000,0, { 0, 0, 0 }, Imm_None }, - { "idle2" ,0,0x06000001,0, { 0, 0, 0 }, Imm_None }, /* LC31 Only */ - { "lde" ,2,0x06800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldf" ,2,0x07000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfu" ,2,0x40000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldflo" ,2,0x40800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfls" ,2,0x41000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfhi" ,2,0x41800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfhs" ,2,0x42000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfeq" ,2,0x42800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfne" ,2,0x43000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldflt" ,2,0x43800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfle" ,2,0x44000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfgt" ,2,0x44800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfge" ,2,0x45000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfz" ,2,0x42800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfnz" ,2,0x43000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfp" ,2,0x44800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfn" ,2,0x43800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfnn" ,2,0x45000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfnv" ,2,0x46000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfv" ,2,0x46800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfnuf" ,2,0x47000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfuf" ,2,0x47800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfnc" ,2,0x42000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfc" ,2,0x40800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfnlv" ,2,0x48000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldflv" ,2,0x48800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfnluf",2,0x49000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfluf" ,2,0x49800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfzuf" ,2,0x4A000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldfi" ,2,0x07800000,AddressMode, { Direct|Indirect, Rn, 0 }, Imm_None }, - { "ldi" ,2,0x08000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldiu" ,2,0x50000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldilo" ,2,0x50800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldils" ,2,0x51000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldihi" ,2,0x51800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldihs" ,2,0x52000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldieq" ,2,0x52800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldine" ,2,0x53000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldilt" ,2,0x53800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldile" ,2,0x54000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldigt" ,2,0x54800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldige" ,2,0x55000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldiz" ,2,0x52800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldinz" ,2,0x53000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldip" ,2,0x54800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldin" ,2,0x53800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldinn" ,2,0x55000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldinv" ,2,0x56000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldiv" ,2,0x56800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldinuf" ,2,0x57000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldiuf" ,2,0x57800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldinc" ,2,0x52000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldic" ,2,0x50800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldinlv" ,2,0x58000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldilv" ,2,0x58800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldinluf",2,0x59000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldiluf" ,2,0x59800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldizuf" ,2,0x5A000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "ldii" ,2,0x08800000,AddressMode, { Direct|Indirect, AllReg, 0 }, Imm_None }, - { "ldm" ,2,0x09000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "ldp" ,2,0x08700000,0, { Abs24|Direct, DPReg|NotReq, 0 }, Imm_UInt }, - { "lopower",0,0x10800001,0, { 0, 0, 0 }, Imm_None }, /* LC31 Only */ - { "lsh" ,2,0x09800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_UInt }, - { "lsh3" ,3,0x24000000,AddressMode, { TAddr1|AllReg, TAddr2|AllReg, AllReg }, Imm_None }, - { "maxspeed",0,0x10800000,0, { 0, 0, 0 }, Imm_None }, /* LC31 Only */ - { "mpyf" ,2,0x0A000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "mpyf3" ,3,0x24800000,AddressMode, { TAddr1, TAddr2, Rn }, Imm_None }, - { "mpyi" ,2,0x0A800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "mpyi3" ,3,0x25000000,AddressMode, { TAddr1|AllReg, TAddr2|AllReg, AllReg }, Imm_None }, - { "negb" ,2,0x0B000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "negf" ,2,0x0B800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "negi" ,2,0x0C000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "nop" ,1,0x0C800000,AddressMode, { AllReg|Indirect|NotReq, 0, 0 }, Imm_None }, - { "norm" ,2,0x0D000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, /*Check another source*/ - { "not" ,2,0x0D800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_UInt }, - { "or" ,2,0x10000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_UInt }, - { "or3" ,3,0x25800000,AddressMode, { TAddr1|AllReg, TAddr2|AllReg, AllReg }, Imm_None }, - { "pop" ,1,0x0E200000,StackOp, { AllReg, 0, 0 }, Imm_None }, - { "popf" ,1,0x0EA00000,StackOp, { Rn, 0, 0 }, Imm_None }, - { "push" ,1,0x0F200000,StackOp, { AllReg, 0, 0 }, Imm_None }, - { "pushf" ,1,0x0FA00000,StackOp, { Rn, 0, 0 }, Imm_None }, - { "reti" ,0,0x78000000,0, { 0, 0, 0 }, Imm_None }, - { "retiu" ,0,0x78000000,0, { 0, 0, 0 }, Imm_None }, - { "retilo" ,0,0x78010000,0, { 0, 0, 0 }, Imm_None }, - { "retils" ,0,0x78020000,0, { 0, 0, 0 }, Imm_None }, - { "retihi" ,0,0x78030000,0, { 0, 0, 0 }, Imm_None }, - { "retihs" ,0,0x78040000,0, { 0, 0, 0 }, Imm_None }, - { "retieq" ,0,0x78050000,0, { 0, 0, 0 }, Imm_None }, - { "retine" ,0,0x78060000,0, { 0, 0, 0 }, Imm_None }, - { "retilt" ,0,0x78070000,0, { 0, 0, 0 }, Imm_None }, - { "retile" ,0,0x78080000,0, { 0, 0, 0 }, Imm_None }, - { "retigt" ,0,0x78090000,0, { 0, 0, 0 }, Imm_None }, - { "retige" ,0,0x780A0000,0, { 0, 0, 0 }, Imm_None }, - { "retiz" ,0,0x78050000,0, { 0, 0, 0 }, Imm_None }, - { "retinz" ,0,0x78060000,0, { 0, 0, 0 }, Imm_None }, - { "retip" ,0,0x78090000,0, { 0, 0, 0 }, Imm_None }, - { "retin" ,0,0x78070000,0, { 0, 0, 0 }, Imm_None }, - { "retinn" ,0,0x780A0000,0, { 0, 0, 0 }, Imm_None }, - { "retinv" ,0,0x780C0000,0, { 0, 0, 0 }, Imm_None }, - { "retiv" ,0,0x780D0000,0, { 0, 0, 0 }, Imm_None }, - { "retinuf",0,0x780E0000,0, { 0, 0, 0 }, Imm_None }, - { "retiuf" ,0,0x780F0000,0, { 0, 0, 0 }, Imm_None }, - { "retinc" ,0,0x78040000,0, { 0, 0, 0 }, Imm_None }, - { "retic" ,0,0x78010000,0, { 0, 0, 0 }, Imm_None }, - { "retinlv",0,0x78100000,0, { 0, 0, 0 }, Imm_None }, - { "retilv" ,0,0x78110000,0, { 0, 0, 0 }, Imm_None }, - { "retinluf",0,0x78120000,0, { 0, 0, 0 }, Imm_None }, - { "retiluf",0,0x78130000,0, { 0, 0, 0 }, Imm_None }, - { "retizuf",0,0x78140000,0, { 0, 0, 0 }, Imm_None }, - { "rets" ,0,0x78800000,0, { 0, 0, 0 }, Imm_None }, - { "retsu" ,0,0x78800000,0, { 0, 0, 0 }, Imm_None }, - { "retslo" ,0,0x78810000,0, { 0, 0, 0 }, Imm_None }, - { "retsls" ,0,0x78820000,0, { 0, 0, 0 }, Imm_None }, - { "retshi" ,0,0x78830000,0, { 0, 0, 0 }, Imm_None }, - { "retshs" ,0,0x78840000,0, { 0, 0, 0 }, Imm_None }, - { "retseq" ,0,0x78850000,0, { 0, 0, 0 }, Imm_None }, - { "retsne" ,0,0x78860000,0, { 0, 0, 0 }, Imm_None }, - { "retslt" ,0,0x78870000,0, { 0, 0, 0 }, Imm_None }, - { "retsle" ,0,0x78880000,0, { 0, 0, 0 }, Imm_None }, - { "retsgt" ,0,0x78890000,0, { 0, 0, 0 }, Imm_None }, - { "retsge" ,0,0x788A0000,0, { 0, 0, 0 }, Imm_None }, - { "retsz" ,0,0x78850000,0, { 0, 0, 0 }, Imm_None }, - { "retsnz" ,0,0x78860000,0, { 0, 0, 0 }, Imm_None }, - { "retsp" ,0,0x78890000,0, { 0, 0, 0 }, Imm_None }, - { "retsn" ,0,0x78870000,0, { 0, 0, 0 }, Imm_None }, - { "retsnn" ,0,0x788A0000,0, { 0, 0, 0 }, Imm_None }, - { "retsnv" ,0,0x788C0000,0, { 0, 0, 0 }, Imm_None }, - { "retsv" ,0,0x788D0000,0, { 0, 0, 0 }, Imm_None }, - { "retsnuf",0,0x788E0000,0, { 0, 0, 0 }, Imm_None }, - { "retsuf" ,0,0x788F0000,0, { 0, 0, 0 }, Imm_None }, - { "retsnc" ,0,0x78840000,0, { 0, 0, 0 }, Imm_None }, - { "retsc" ,0,0x78810000,0, { 0, 0, 0 }, Imm_None }, - { "retsnlv",0,0x78900000,0, { 0, 0, 0 }, Imm_None }, - { "retslv" ,0,0x78910000,0, { 0, 0, 0 }, Imm_None }, - { "retsnluf",0,0x78920000,0, { 0, 0, 0 }, Imm_None }, - { "retsluf",0,0x78930000,0, { 0, 0, 0 }, Imm_None }, - { "retszuf",0,0x78940000,0, { 0, 0, 0 }, Imm_None }, - { "rnd" ,2,0x11000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "rol" ,1,0x11E00001,Rotate, { AllReg, 0, 0 }, Imm_None }, - { "rolc" ,1,0x12600001,Rotate, { AllReg, 0, 0 }, Imm_None }, - { "ror" ,1,0x12E0FFFF,Rotate, { AllReg, 0, 0 }, Imm_None }, - { "rorc" ,1,0x1360FFFF,Rotate, { AllReg, 0, 0 }, Imm_None }, - { "rptb" ,1,0x64000000,0, { Imm24, 0, 0 }, Imm_UInt }, - { "rpts" ,1,0x139B0000,AddressMode, { GAddr2, 0, 0 }, Imm_UInt }, - { "sigi" ,0,0x16000000,0, { 0, 0, 0 }, Imm_None }, - { "stf" ,2,0x14000000,AddressMode, { Rn, Direct|Indirect, 0 }, Imm_Float }, - { "stfi" ,2,0x14800000,AddressMode, { Rn, Direct|Indirect, 0 }, Imm_Float }, - { "sti" ,2,0x15000000,AddressMode, { AllReg, Direct|Indirect, 0 }, Imm_SInt }, - { "stii" ,2,0x15800000,AddressMode, { AllReg, Direct|Indirect, 0 }, Imm_SInt }, - { "subb" ,2,0x16800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "subb3" ,3,0x26000000,AddressMode, { TAddr1|AllReg, TAddr2|AllReg, AllReg }, Imm_None }, - { "subc" ,2,0x17000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_UInt }, - { "subf" ,2,0x17800000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "subf3" ,3,0x26800000,AddressMode, { TAddr1, TAddr2, Rn }, Imm_None }, - { "subi" ,2,0x18000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "subi3" ,3,0x27000000,AddressMode, { TAddr1|AllReg, TAddr2|AllReg, AllReg }, Imm_None }, - { "subrb" ,2,0x18800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "subrf" ,2,0x19000000,AddressMode, { GAddr1, Rn, 0 }, Imm_Float }, - { "subri" ,2,0x19800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_SInt }, - { "swi" ,0,0x66000000,0, { 0, 0, 0 }, Imm_None }, - { "trap" ,1,0x74800020,0, { IVector, 0, 0 }, Imm_None }, - { "trapu" ,1,0x74800020,0, { IVector, 0, 0 }, Imm_None }, - { "traplo" ,1,0x74810020,0, { IVector, 0, 0 }, Imm_None }, - { "trapls" ,1,0x74820020,0, { IVector, 0, 0 }, Imm_None }, - { "traphi" ,1,0x74830020,0, { IVector, 0, 0 }, Imm_None }, - { "traphs" ,1,0x74840020,0, { IVector, 0, 0 }, Imm_None }, - { "trapeq" ,1,0x74850020,0, { IVector, 0, 0 }, Imm_None }, - { "trapne" ,1,0x74860020,0, { IVector, 0, 0 }, Imm_None }, - { "traplt" ,1,0x74870020,0, { IVector, 0, 0 }, Imm_None }, - { "traple" ,1,0x74880020,0, { IVector, 0, 0 }, Imm_None }, - { "trapgt" ,1,0x74890020,0, { IVector, 0, 0 }, Imm_None }, - { "trapge" ,1,0x748A0020,0, { IVector, 0, 0 }, Imm_None }, - { "trapz" ,1,0x74850020,0, { IVector, 0, 0 }, Imm_None }, - { "trapnz" ,1,0x74860020,0, { IVector, 0, 0 }, Imm_None }, - { "trapp" ,1,0x74890020,0, { IVector, 0, 0 }, Imm_None }, - { "trapn" ,1,0x74870020,0, { IVector, 0, 0 }, Imm_None }, - { "trapnn" ,1,0x748A0020,0, { IVector, 0, 0 }, Imm_None }, - { "trapnv" ,1,0x748C0020,0, { IVector, 0, 0 }, Imm_None }, - { "trapv" ,1,0x748D0020,0, { IVector, 0, 0 }, Imm_None }, - { "trapnuf",1,0x748E0020,0, { IVector, 0, 0 }, Imm_None }, - { "trapuf" ,1,0x748F0020,0, { IVector, 0, 0 }, Imm_None }, - { "trapnc" ,1,0x74840020,0, { IVector, 0, 0 }, Imm_None }, - { "trapc" ,1,0x74810020,0, { IVector, 0, 0 }, Imm_None }, - { "trapnlv",1,0x74900020,0, { IVector, 0, 0 }, Imm_None }, - { "traplv" ,1,0x74910020,0, { IVector, 0, 0 }, Imm_None }, - { "trapnluf",1,0x74920020,0, { IVector, 0, 0 }, Imm_None }, - { "trapluf",1,0x74930020,0, { IVector, 0, 0 }, Imm_None }, - { "trapzuf",1,0x74940020,0, { IVector, 0, 0 }, Imm_None }, - { "tstb" ,2,0x1A000000,AddressMode, { GAddr2, AllReg, 0 }, Imm_UInt }, - { "tstb3" ,2,0x27800000,AddressMode, { TAddr1|AllReg, TAddr2|AllReg, 0 }, Imm_None }, - { "xor" ,2,0x1A800000,AddressMode, { GAddr2, AllReg, 0 }, Imm_UInt }, - { "xor3" ,3,0x28000000,AddressMode, { TAddr1|AllReg, TAddr2|AllReg, AllReg }, Imm_None }, - { "" ,0,0x00000000,0, { 0, 0, 0 }, 0 } -}; - -static const template *const tic30_optab_end = - tic30_optab + sizeof(tic30_optab)/sizeof(tic30_optab[0]); - -typedef struct { - char *name; - unsigned int operands_1; - unsigned int operands_2; - unsigned int base_opcode; - unsigned int operand_types[2][3]; - /* Which operand fits into which part of the final opcode word. */ - int oporder; -} partemplate; - -/* oporder defines - not very descriptive. */ -#define OO_4op1 0 -#define OO_4op2 1 -#define OO_4op3 2 -#define OO_5op1 3 -#define OO_5op2 4 -#define OO_PField 5 - -static const partemplate tic30_paroptab[] = { - { "q_absf_stf", 2,2,0xC8000000, { { Indirect, Rn, 0 }, { Rn, Indirect, 0 } }, - OO_4op1 }, - { "q_absi_sti", 2,2,0xCA000000, { { Indirect, Rn, 0 }, { Rn, Indirect, 0 } }, - OO_4op1 }, - { "q_addf3_stf", 3,2,0xCC000000, { { Indirect, Rn, Rn }, { Rn, Indirect, 0 } }, - OO_5op1 }, - { "q_addi3_sti", 3,2,0xCE000000, { { Indirect, Rn, Rn }, { Rn, Indirect, 0 } }, - OO_5op1 }, - { "q_and3_sti", 3,2,0xD0000000, { { Indirect, Rn, Rn }, { Rn, Indirect, 0 } }, - OO_5op1 }, - { "q_ash3_sti", 3,2,0xD2000000, { { Rn, Indirect, Rn }, { Rn, Indirect, 0 } }, - OO_5op2 }, - { "q_fix_sti", 2,2,0xD4000000, { { Indirect, Rn, 0 }, { Rn, Indirect, 0 } }, - OO_4op1 }, - { "q_float_stf", 2,2,0xD6000000, { { Indirect, Rn, 0 }, { Rn, Indirect, 0 } }, - OO_4op1 }, - { "q_ldf_ldf", 2,2,0xC4000000, { { Indirect, Rn, 0 }, { Indirect, Rn, 0 } }, - OO_4op2 }, - { "q_ldf_stf", 2,2,0xD8000000, { { Indirect, Rn, 0 }, { Rn, Indirect, 0 } }, - OO_4op1 }, - { "q_ldi_ldi", 2,2,0xC6000000, { { Indirect, Rn, 0 }, { Indirect, Rn, 0 } }, - OO_4op2 }, - { "q_ldi_sti", 2,2,0xDA000000, { { Indirect, Rn, 0 }, { Rn, Indirect, 0 } }, - OO_4op1 }, - { "q_lsh3_sti", 3,2,0xDC000000, { { Rn, Indirect, Rn }, { Rn, Indirect, 0 } }, - OO_5op2 }, - { "q_mpyf3_addf3",3,3,0x80000000, { { Rn | Indirect, Rn | Indirect, Rn }, - { Rn | Indirect, Rn | Indirect, Rn } }, OO_PField }, - { "q_mpyf3_stf", 3,2,0xDE000000, { { Indirect, Rn, Rn }, { Rn, Indirect, 0 } }, - OO_5op1 }, - { "q_mpyf3_subf3",3,3,0x84000000, { { Rn | Indirect, Rn | Indirect, Rn }, - { Rn | Indirect, Rn | Indirect, Rn } }, OO_PField }, - { "q_mpyi3_addi3",3,3,0x88000000, { { Rn | Indirect, Rn | Indirect, Rn }, - { Rn | Indirect, Rn | Indirect, Rn } }, OO_PField }, - { "q_mpyi3_sti", 3,2,0xE0000000, { { Indirect, Rn, Rn }, { Rn, Indirect, 0 } }, - OO_5op1 }, - { "q_mpyi3_subi3",3,3,0x8C000000, { { Rn | Indirect, Rn | Indirect, Rn }, - { Rn | Indirect, Rn | Indirect, Rn } }, OO_PField }, - { "q_negf_stf", 2,2,0xE2000000, { { Indirect, Rn, 0 }, { Rn, Indirect, 0 } }, - OO_4op1 }, - { "q_negi_sti", 2,2,0xE4000000, { { Indirect, Rn, 0 }, { Rn, Indirect, 0 } }, - OO_4op1 }, - { "q_not_sti", 2,2,0xE6000000, { { Indirect, Rn, 0 }, { Rn, Indirect, 0 } }, - OO_4op1 }, - { "q_or3_sti", 3,2,0xE8000000, { { Indirect, Rn, Rn }, { Rn, Indirect, 0 } }, - OO_5op1 }, - { "q_stf_stf", 2,2,0xC0000000, { { Rn, Indirect, 0 }, { Rn, Indirect, 0 } }, - OO_4op3 }, - { "q_sti_sti", 2,2,0xC2000000, { { Rn, Indirect, 0 }, { Rn, Indirect, 0 } }, - OO_4op3 }, - { "q_subf3_stf", 3,2,0xEA000000, { { Rn, Indirect, Rn }, { Rn, Indirect, 0 } }, - OO_5op2 }, - { "q_subi3_sti", 3,2,0xEC000000, { { Rn, Indirect, Rn }, { Rn, Indirect, 0 } }, - OO_5op2 }, - { "q_xor3_sti", 3,2,0xEE000000, { { Indirect, Rn, Rn }, { Rn, Indirect, 0 } }, - OO_5op1 }, - { "", 0,0,0x00000000, { { 0, 0, 0 }, { 0, 0, 0 } }, 0 } -}; - -static const partemplate *const tic30_paroptab_end = - tic30_paroptab + sizeof(tic30_paroptab)/sizeof(tic30_paroptab[0]); - -#endif diff --git a/contrib/binutils/include/opcode/v850.h b/contrib/binutils/include/opcode/v850.h deleted file mode 100644 index 737faf88d0de..000000000000 --- a/contrib/binutils/include/opcode/v850.h +++ /dev/null @@ -1,166 +0,0 @@ -/* v850.h -- Header file for NEC V850 opcode table - Copyright 1996, 1997 Free Software Foundation, Inc. - Written by J.T. Conklin, Cygnus Support - -This file is part of GDB, GAS, and the GNU binutils. - -GDB, GAS, and the GNU binutils are free software; you can redistribute -them and/or modify them under the terms of the GNU General Public -License as published by the Free Software Foundation; either version -1, or (at your option) any later version. - -GDB, GAS, and the GNU binutils are distributed in the hope that they -will be useful, but WITHOUT ANY WARRANTY; without even the implied -warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this file; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef V850_H -#define V850_H - -/* The opcode table is an array of struct v850_opcode. */ - -struct v850_opcode -{ - /* The opcode name. */ - const char *name; - - /* The opcode itself. Those bits which will be filled in with - operands are zeroes. */ - unsigned long opcode; - - /* The opcode mask. This is used by the disassembler. This is a - mask containing ones indicating those bits which must match the - opcode field, and zeroes indicating those bits which need not - match (and are presumably filled in by operands). */ - unsigned long mask; - - /* An array of operand codes. Each code is an index into the - operand table. They appear in the order which the operands must - appear in assembly code, and are terminated by a zero. */ - unsigned char operands[8]; - - /* Which (if any) operand is a memory operand. */ - unsigned int memop; - - /* Target processor(s). A bit field of processors which support - this instruction. Note a bit field is used as some instructions - are available on multiple, different processor types, whereas - other instructions are only available on one specific type. */ - unsigned int processors; -}; - -/* Values for the processors field in the v850_opcode structure. */ -#define PROCESSOR_V850 (1 << 0) /* Just the V850. */ -#define PROCESSOR_ALL -1 /* Any processor. */ -#define PROCESSOR_V850E (1 << 1) /* Just the V850E. */ -#define PROCESSOR_NOT_V850 (~ PROCESSOR_V850) /* Any processor except the V850. */ -#define PROCESSOR_V850EA (1 << 2) /* Just the V850EA. */ - -/* The table itself is sorted by major opcode number, and is otherwise - in the order in which the disassembler should consider - instructions. */ -extern const struct v850_opcode v850_opcodes[]; -extern const int v850_num_opcodes; - - -/* The operands table is an array of struct v850_operand. */ - -struct v850_operand -{ - /* The number of bits in the operand. */ - /* If this value is -1 then the operand's bits are in a discontinous distribution in the instruction. */ - int bits; - - /* (bits >= 0): How far the operand is left shifted in the instruction. */ - /* (bits == -1): Bit mask of the bits in the operand. */ - int shift; - - /* Insertion function. This is used by the assembler. To insert an - operand value into an instruction, check this field. - - If it is NULL, execute - i |= (op & ((1 << o->bits) - 1)) << o->shift; - (i is the instruction which we are filling in, o is a pointer to - this structure, and op is the opcode value; this assumes twos - complement arithmetic). - - If this field is not NULL, then simply call it with the - instruction and the operand value. It will return the new value - of the instruction. If the ERRMSG argument is not NULL, then if - the operand value is illegal, *ERRMSG will be set to a warning - string (the operand will be inserted in any case). If the - operand value is legal, *ERRMSG will be unchanged (most operands - can accept any value). */ - unsigned long (* insert) PARAMS ((unsigned long instruction, long op, - const char ** errmsg)); - - /* Extraction function. This is used by the disassembler. To - extract this operand type from an instruction, check this field. - - If it is NULL, compute - op = o->bits == -1 ? ((i) & o->shift) : ((i) >> o->shift) & ((1 << o->bits) - 1); - if (o->flags & V850_OPERAND_SIGNED) - op = (op << (32 - o->bits)) >> (32 - o->bits); - (i is the instruction, o is a pointer to this structure, and op - is the result; this assumes twos complement arithmetic). - - If this field is not NULL, then simply call it with the - instruction value. It will return the value of the operand. If - the INVALID argument is not NULL, *INVALID will be set to - non-zero if this operand type can not actually be extracted from - this operand (i.e., the instruction does not match). If the - operand is valid, *INVALID will not be changed. */ - unsigned long (* extract) PARAMS ((unsigned long instruction, int * invalid)); - - /* One bit syntax flags. */ - int flags; -}; - -/* Elements in the table are retrieved by indexing with values from - the operands field of the v850_opcodes table. */ - -extern const struct v850_operand v850_operands[]; - -/* Values defined for the flags field of a struct v850_operand. */ - -/* This operand names a general purpose register */ -#define V850_OPERAND_REG 0x01 - -/* This operand names a system register */ -#define V850_OPERAND_SRG 0x02 - -/* This operand names a condition code used in the setf instruction */ -#define V850_OPERAND_CC 0x04 - -/* This operand takes signed values */ -#define V850_OPERAND_SIGNED 0x08 - -/* This operand is the ep register. */ -#define V850_OPERAND_EP 0x10 - -/* This operand is a PC displacement */ -#define V850_OPERAND_DISP 0x20 - -/* This is a relaxable operand. Only used for D9->D22 branch relaxing - right now. We may need others in the future (or maybe handle them like - promoted operands on the mn10300?) */ -#define V850_OPERAND_RELAX 0x40 - -/* The register specified must not be r0 */ -#define V850_NOT_R0 0x80 - -/* CYGNUS LOCAL v850e */ -/* push/pop type instruction, V850E specific. */ -#define V850E_PUSH_POP 0x100 - -/* 16 bit immediate follows instruction, V850E specific. */ -#define V850E_IMMEDIATE16 0x200 - -/* 32 bit immediate follows instruction, V850E specific. */ -#define V850E_IMMEDIATE32 0x400 - -#endif /* V850_H */ diff --git a/contrib/binutils/include/wait.h b/contrib/binutils/include/wait.h deleted file mode 100644 index fa3c9ccb1d7e..000000000000 --- a/contrib/binutils/include/wait.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Define how to access the int that the wait system call stores. - This has been compatible in all Unix systems since time immemorial, - but various well-meaning people have defined various different - words for the same old bits in the same old int (sometimes claimed - to be a struct). We just know it's an int and we use these macros - to access the bits. */ - -/* The following macros are defined equivalently to their definitions - in POSIX.1. We fail to define WNOHANG and WUNTRACED, which POSIX.1 - <sys/wait.h> defines, since our code does not use waitpid(). We - also fail to declare wait() and waitpid(). */ - -#ifndef WIFEXITED -#define WIFEXITED(w) (((w)&0377) == 0) -#endif - -#ifndef WIFSIGNALED -#define WIFSIGNALED(w) (((w)&0377) != 0177 && ((w)&~0377) == 0) -#endif - -#ifndef WIFSTOPPED -#ifdef IBM6000 - -/* Unfortunately, the above comment (about being compatible in all Unix - systems) is not quite correct for AIX, sigh. And AIX 3.2 can generate - status words like 0x57c (sigtrap received after load), and gdb would - choke on it. */ - -#define WIFSTOPPED(w) ((w)&0x40) - -#else -#define WIFSTOPPED(w) (((w)&0377) == 0177) -#endif -#endif - -#ifndef WEXITSTATUS -#define WEXITSTATUS(w) (((w) >> 8) & 0377) /* same as WRETCODE */ -#endif - -#ifndef WTERMSIG -#define WTERMSIG(w) ((w) & 0177) -#endif - -#ifndef WSTOPSIG -#define WSTOPSIG WEXITSTATUS -#endif - -/* These are not defined in POSIX, but are used by our programs. */ - -#define WAITTYPE int - -#ifndef WCOREDUMP -#define WCOREDUMP(w) (((w)&0200) != 0) -#endif - -#ifndef WSETEXIT -#define WSETEXIT(w,status) ((w) = (0 | ((status) << 8))) -#endif - -#ifndef WSETSTOP -#define WSETSTOP(w,sig) ((w) = (0177 | ((sig) << 8))) -#endif - diff --git a/contrib/binutils/install.sh b/contrib/binutils/install.sh deleted file mode 100755 index 4b883b386de2..000000000000 --- a/contrib/binutils/install.sh +++ /dev/null @@ -1,247 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/contrib/binutils/ld/acconfig.h b/contrib/binutils/ld/acconfig.h deleted file mode 100644 index c627d7faa97a..000000000000 --- a/contrib/binutils/ld/acconfig.h +++ /dev/null @@ -1,22 +0,0 @@ - -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION - -/* Whether strstr must be declared even if <string.h> is included. */ -#undef NEED_DECLARATION_STRSTR - -/* Whether free must be declared even if <stdlib.h> is included. */ -#undef NEED_DECLARATION_FREE - -/* Whether sbrk must be declared even if <unistd.h> is included. */ -#undef NEED_DECLARATION_SBRK - -/* Whether getenv must be declared even if <stdlib.h> is included. */ -#undef NEED_DECLARATION_GETENV -@TOP@ - -/* Do we need to use the b modifier when opening binary files? */ -#undef USE_BINARY_FOPEN diff --git a/contrib/binutils/ld/configdoc.texi b/contrib/binutils/ld/configdoc.texi deleted file mode 100644 index 8d1acad1ef16..000000000000 --- a/contrib/binutils/ld/configdoc.texi +++ /dev/null @@ -1,14 +0,0 @@ -@c ------------------------------ CONFIGURATION VARS: -@c 1. Inclusiveness of this manual -@set GENERIC - -@c 2. Specific target machines -@set H8300 -@set I960 -@set TICOFF - -@c 3. Properties of this configuration -@clear SingleFormat -@set UsesEnvVars -@c ------------------------------ end CONFIGURATION VARS - diff --git a/contrib/binutils/ld/emulparams/armelf_linux26.sh b/contrib/binutils/ld/emulparams/armelf_linux26.sh deleted file mode 100644 index 36d1b0ec5c7a..000000000000 --- a/contrib/binutils/ld/emulparams/armelf_linux26.sh +++ /dev/null @@ -1,20 +0,0 @@ -ARCH=arm -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlearm" -BIG_OUTPUT_FORMAT="elf32-bigarm" -LITTLE_OUTPUT_FORMAT="elf32-littlearm" -MAXPAGESIZE=0x8000 -TEMPLATE_NAME=armelf -GENERATE_SHLIB_SCRIPT=yes - -DATA_START_SYMBOLS='__data_start = . ;'; -OTHER_BSS_SYMBOLS='__bss_start__ = .;' -OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;' - -# This needs to be high enough so that we can load ld.so below it, -# yet low enough to stay away from the mmap area at 0x01100000. -# Also, it is small enough so that relocs which are pointing -# at absolute 0 will still be fixed up. -# These values give us about 0.5MB for ld.so, 16.5MB for user -# programs, and 15MB for mmap which seems a reasonable compromise. -TEXT_START_ADDR=0x00080000 diff --git a/contrib/binutils/ld/emulparams/elf32bmip.sh b/contrib/binutils/ld/emulparams/elf32bmip.sh deleted file mode 100644 index 473c41169e00..000000000000 --- a/contrib/binutils/ld/emulparams/elf32bmip.sh +++ /dev/null @@ -1,30 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-bigmips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes diff --git a/contrib/binutils/ld/emulparams/elf32bmipn32.sh b/contrib/binutils/ld/emulparams/elf32bmipn32.sh deleted file mode 100755 index 56f42a9b2964..000000000000 --- a/contrib/binutils/ld/emulparams/elf32bmipn32.sh +++ /dev/null @@ -1,75 +0,0 @@ -# This is an ELF platform. -SCRIPT_NAME=elf - -# Handle both big- and little-ended 32-bit MIPS objects. -ARCH=mips -OUTPUT_FORMAT="elf32-bigmips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" - -TEMPLATE_NAME=elf32 - -TEXT_START_ADDR=0x10000000 -MAXPAGESIZE=0x100000 -ENTRY=__start - -# GOT-related settings. -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } - .srdata : { *(.srdata) } -' - -# Magic symbols. -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -# IRIX6 defines these symbols. 0x34 is the size of the ELF header. -EXECUTABLE_SYMBOLS=" - __dso_displacement = 0; - __elf_header = ${TEXT_START_ADDR}; - __program_header_table = ${TEXT_START_ADDR} + 0x34; -" - -# There are often dynamic relocations against the .rodata section. -# Setting DT_TEXTREL in the .dynamic section does not convince the -# IRIX6 linker to permit relocations against the text segment. -# Following the IRIX linker, we simply put .rodata in the data -# segment. -WRITABLE_RODATA= - -OTHER_RELOCATING_SECTIONS=' - .MIPS.events.text : - { - *(.MIPS.events.text) - *(.MIPS.events.gnu.linkonce.t*) - } - .MIPS.content.text : - { - *(.MIPS.content.text) - *(.MIPS.content.gnu.linkonce.t*) - } - .MIPS.events.data : - { - *(.MIPS.events.data) - *(.MIPS.events.gnu.linkonce.d*) - } - .MIPS.content.data : - { - *(.MIPS.content.data) - *(.MIPS.content.gnu.linkonce.d*) - } - .MIPS.events.rodata : - { - *(.MIPS.events.rodata) - *(.MIPS.events.gnu.linkonce.r*) - } - .MIPS.content.rodata : - { - *(.MIPS.content.rodata) - *(.MIPS.content.gnu.linkonce.r*) - } -' diff --git a/contrib/binutils/ld/emulparams/elf32bsmip.sh b/contrib/binutils/ld/emulparams/elf32bsmip.sh deleted file mode 100755 index 09f130764370..000000000000 --- a/contrib/binutils/ld/emulparams/elf32bsmip.sh +++ /dev/null @@ -1,31 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-bigmips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -ENTRY=__start diff --git a/contrib/binutils/ld/emulparams/elf32ebmip.sh b/contrib/binutils/ld/emulparams/elf32ebmip.sh deleted file mode 100644 index 00ea8fd9c964..000000000000 --- a/contrib/binutils/ld/emulparams/elf32ebmip.sh +++ /dev/null @@ -1,28 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-bigmips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -EMBEDDED=yes diff --git a/contrib/binutils/ld/emulparams/elf32elmip.sh b/contrib/binutils/ld/emulparams/elf32elmip.sh deleted file mode 100644 index cf008c8f1173..000000000000 --- a/contrib/binutils/ld/emulparams/elf32elmip.sh +++ /dev/null @@ -1,28 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlemips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -EMBEDDED=yes diff --git a/contrib/binutils/ld/emulparams/elf32lmip.sh b/contrib/binutils/ld/emulparams/elf32lmip.sh deleted file mode 100644 index 23312f44acae..000000000000 --- a/contrib/binutils/ld/emulparams/elf32lmip.sh +++ /dev/null @@ -1,30 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlemips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes diff --git a/contrib/binutils/ld/emulparams/elf32lsmip.sh b/contrib/binutils/ld/emulparams/elf32lsmip.sh deleted file mode 100755 index 4bdc8a10e698..000000000000 --- a/contrib/binutils/ld/emulparams/elf32lsmip.sh +++ /dev/null @@ -1,31 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-littlemips" -BIG_OUTPUT_FORMAT="elf32-bigmips" -LITTLE_OUTPUT_FORMAT="elf32-littlemips" -TEXT_START_ADDR=0x0400000 -DATA_ADDR=0x10000000 -MAXPAGESIZE=0x40000 -NONPAGED_TEXT_START_ADDR=0x0400000 -SHLIB_TEXT_START_ADDR=0x5ffe0000 -TEXT_DYNAMIC= -INITIAL_READONLY_SECTIONS='.reginfo : { *(.reginfo) }' -OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)' -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } -' -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -OTHER_SECTIONS=' - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -' -ARCH=mips -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -ENTRY=__start diff --git a/contrib/binutils/ld/emulparams/elf64bmip.sh b/contrib/binutils/ld/emulparams/elf64bmip.sh deleted file mode 100755 index a4852d53cf42..000000000000 --- a/contrib/binutils/ld/emulparams/elf64bmip.sh +++ /dev/null @@ -1,79 +0,0 @@ -# This is an ELF platform. -SCRIPT_NAME=elf - -# Handle both big- and little-ended 32-bit MIPS objects. -ARCH=mips -OUTPUT_FORMAT="elf64-bigmips" -BIG_OUTPUT_FORMAT="elf64-bigmips" -LITTLE_OUTPUT_FORMAT="elf64-littlemips" - -# Note that the elf32 template is used for 64-bit emulations as well -# as 32-bit emulations. -ELFSIZE=64 -TEMPLATE_NAME=elf32 - -TEXT_START_ADDR=0x10000000 -MAXPAGESIZE=0x100000 -ENTRY=__start - -# GOT-related settings. -OTHER_GOT_SYMBOLS=' - _gp = ALIGN(16) + 0x7ff0; -' -OTHER_GOT_SECTIONS=' - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } - .srdata : { *(.srdata) } -' - -# Magic symbols. -TEXT_START_SYMBOLS='_ftext = . ;' -DATA_START_SYMBOLS='_fdata = . ;' -OTHER_BSS_SYMBOLS='_fbss = .;' -# IRIX6 defines these symbols. 0x40 is the size of the ELF header. -EXECUTABLE_SYMBOLS=" - __dso_displacement = 0; - __elf_header = ${TEXT_START_ADDR}; - __program_header_table = ${TEXT_START_ADDR} + 0x40; -" - -# There are often dynamic relocations against the .rodata section. -# Setting DT_TEXTREL in the .dynamic section does not convince the -# IRIX6 linker to permit relocations against the text segment. -# Following the IRIX linker, we simply put .rodata in the data -# segment. -WRITABLE_RODATA= - - -OTHER_RELOCATING_SECTIONS=' - .MIPS.events.text : - { - *(.MIPS.events.text) - *(.MIPS.events.gnu.linkonce.t*) - } - .MIPS.content.text : - { - *(.MIPS.content.text) - *(.MIPS.content.gnu.linkonce.t*) - } - .MIPS.events.data : - { - *(.MIPS.events.data) - *(.MIPS.events.gnu.linkonce.d*) - } - .MIPS.content.data : - { - *(.MIPS.content.data) - *(.MIPS.content.gnu.linkonce.d*) - } - .MIPS.events.rodata : - { - *(.MIPS.events.rodata) - *(.MIPS.events.gnu.linkonce.r*) - } - .MIPS.content.rodata : - { - *(.MIPS.content.rodata) - *(.MIPS.content.gnu.linkonce.r*) - } -' diff --git a/contrib/binutils/ld/emulparams/shelf.sh b/contrib/binutils/ld/emulparams/shelf.sh deleted file mode 100755 index 95db5877d7f5..000000000000 --- a/contrib/binutils/ld/emulparams/shelf.sh +++ /dev/null @@ -1,17 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-sh" -TEXT_START_ADDR=0x1000 -MAXPAGESIZE=128 -ARCH=sh -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -EMBEDDED=yes - -# These are for compatibility with the COFF toolchain. -ENTRY=start -CTOR_START='___ctors = .;' -CTOR_END='___ctors_end = .;' -DTOR_START='___dtors = .;' -DTOR_END='___dtors_end = .;' -OTHER_RELOCATING_SECTIONS='.stack 0x30000 : { _stack = .; *(.stack) }' diff --git a/contrib/binutils/ld/emulparams/shelf_linux.sh b/contrib/binutils/ld/emulparams/shelf_linux.sh deleted file mode 100644 index d7b7631fe634..000000000000 --- a/contrib/binutils/ld/emulparams/shelf_linux.sh +++ /dev/null @@ -1,14 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-shbig-linux" -TEXT_START_ADDR=0x400000 -MAXPAGESIZE=0x10000 -ARCH=sh -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes - -DATA_START_SYMBOLS='__data_start = . ;'; - -OTHER_READWRITE_SECTIONS=' - .note.ABI-tag : { *(.note.ABI-tag) } -' diff --git a/contrib/binutils/ld/emulparams/shl.sh b/contrib/binutils/ld/emulparams/shl.sh deleted file mode 100644 index 360aac8905c1..000000000000 --- a/contrib/binutils/ld/emulparams/shl.sh +++ /dev/null @@ -1,5 +0,0 @@ -SCRIPT_NAME=sh -OUTPUT_FORMAT="coff-shl" -TEXT_START_ADDR=0x8000 -TARGET_PAGE_SIZE=128 -ARCH=sh diff --git a/contrib/binutils/ld/emulparams/shlelf.sh b/contrib/binutils/ld/emulparams/shlelf.sh deleted file mode 100755 index bb27f86af6cc..000000000000 --- a/contrib/binutils/ld/emulparams/shlelf.sh +++ /dev/null @@ -1,17 +0,0 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-shl" -TEXT_START_ADDR=0x1000 -MAXPAGESIZE=128 -ARCH=sh -MACHINE= -TEMPLATE_NAME=elf32 -GENERATE_SHLIB_SCRIPT=yes -EMBEDDED=yes - -# These are for compatibility with the COFF toolchain. -ENTRY=start -CTOR_START='___ctors = .;' -CTOR_END='___ctors_end = .;' -DTOR_START='___dtors = .;' -DTOR_END='___dtors_end = .;' -OTHER_RELOCATING_SECTIONS='.stack 0x30000 : { _stack = .; *(.stack) }' diff --git a/contrib/binutils/ld/emulparams/tic30aout.sh b/contrib/binutils/ld/emulparams/tic30aout.sh deleted file mode 100755 index 2a4c13f598f7..000000000000 --- a/contrib/binutils/ld/emulparams/tic30aout.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=tic30aout -OUTPUT_FORMAT="a.out-tic30" -OUTPUT_ARCH="tms320c30" -TEXT_START_ADDR=0x0 -TARGET_PAGE_SIZE=128 -ARCH=tms320c30 -BIG=1 diff --git a/contrib/binutils/ld/emulparams/tic30coff.sh b/contrib/binutils/ld/emulparams/tic30coff.sh deleted file mode 100755 index df7794373373..000000000000 --- a/contrib/binutils/ld/emulparams/tic30coff.sh +++ /dev/null @@ -1,7 +0,0 @@ -SCRIPT_NAME=tic30coff -OUTPUT_FORMAT="coff-tic30" -OUTPUT_ARCH="tms320c30" -TEXT_START_ADDR=0x0 -TARGET_PAGE_SIZE=128 -ARCH=tms320c30 -BIG=1 diff --git a/contrib/binutils/ld/emulparams/v850.sh b/contrib/binutils/ld/emulparams/v850.sh deleted file mode 100644 index 78bfbd3882df..000000000000 --- a/contrib/binutils/ld/emulparams/v850.sh +++ /dev/null @@ -1,14 +0,0 @@ -MACHINE= -SCRIPT_NAME=v850 -OUTPUT_FORMAT="elf32-v850" -TEXT_START_ADDR=0x100000 -ZDATA_START_ADDR=0x160 -ROZDATA_START_ADDR="ALIGN (4)" -SDATA_START_ADDR="ALIGN (4)" -ROSDATA_START_ADDR="ALIGN (4)" -TDATA_START_ADDR="ALIGN (4)" -CALL_TABLE_START_ADDR="ALIGN (4)" -ARCH=v850 -MAXPAGESIZE=256 -ENTRY=_start -EMBEDDED=yes diff --git a/contrib/binutils/ld/emultempl/stringify.sed b/contrib/binutils/ld/emultempl/stringify.sed deleted file mode 100644 index a526d3ffc4c5..000000000000 --- a/contrib/binutils/ld/emultempl/stringify.sed +++ /dev/null @@ -1,4 +0,0 @@ -s/["\\]/\\&/g -s/$/\\n\\/ -1 s/^/"/ -$ s/$/n"/ diff --git a/contrib/binutils/ld/scripttempl/elfppc.sc b/contrib/binutils/ld/scripttempl/elfppc.sc deleted file mode 100644 index ddab8f80f814..000000000000 --- a/contrib/binutils/ld/scripttempl/elfppc.sc +++ /dev/null @@ -1,288 +0,0 @@ -# -# Unusual variables checked by this code: -# NOP - two byte opcode for no-op (defaults to 0) -# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start -# OTHER_READONLY_SECTIONS - other than .text .init .rodata ... -# (e.g., .PARISC.milli) -# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ... -# (e.g., .PARISC.global) -# OTHER_SECTIONS - at the end -# EXECUTABLE_SYMBOLS - symbols that must be defined for an -# executable (e.g., _DYNAMIC_LINK) -# TEXT_START_SYMBOLS - symbols that appear at the start of the -# .text section. -# DATA_START_SYMBOLS - symbols that appear at the start of the -# .data section. -# OTHER_BSS_SYMBOLS - symbols that appear at the start of the -# .bss section besides __bss_start. -# -# When adding sections, do note that the names of some sections are used -# when specifying the start address of the next. -# -test -z "$ENTRY" && ENTRY=_start -test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} -test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} -test "$LD_FLAG" = "N" && DATA_ADDR=. -SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2) }" -SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2) }" -INTERP=".interp ${RELOCATING-0} : { *(.interp) }" -PLT=".plt ${RELOCATING-0} : { *(.plt) }" -CTOR=".ctors ${CONSTRUCTING-0} : - { - ${CONSTRUCTING+${CTOR_START}} - /* gcc uses crtbegin.o to find the start of - the constructors, so we make sure it is - first. Because this is a wildcard, it - doesn't matter if the user does not - actually link against crtbegin.o; the - linker won't look for a file to match a - wildcard. The wildcard also means that it - doesn't matter which directory crtbegin.o - is in. */ - - KEEP (*crtbegin.o(.ctors)) - - /* We don't want to include the .ctor section from - from the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - - KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - ${CONSTRUCTING+${CTOR_END}} - }" - -DTOR=" .dtors ${CONSTRUCTING-0} : - { - ${CONSTRUCTING+${DTOR_START}} - KEEP (*crtbegin.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - ${CONSTRUCTING+${DTOR_END}} - }" - -cat <<EOF -OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", - "${LITTLE_OUTPUT_FORMAT}") -OUTPUT_ARCH(${ARCH}) -ENTRY(${ENTRY}) - -${RELOCATING+${LIB_SEARCH_DIRS}} -${RELOCATING+/* Do we need any of these for elf? - __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} -${RELOCATING+${EXECUTABLE_SYMBOLS}} -${RELOCATING- /* For some reason, the Solaris linker makes bad executables - if gld -r is used and the intermediate file has sections starting - at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld - bug. But for now assigning the zero vmas works. */} - -${RELOCATING+PROVIDE (__stack = 0);} -${RELOCATING+PROVIDE (___stack = 0);} -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}} - ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}} - ${CREATE_SHLIB-${INTERP}} - .hash ${RELOCATING-0} : { *(.hash) } - .dynsym ${RELOCATING-0} : { *(.dynsym) } - .dynstr ${RELOCATING-0} : { *(.dynstr) } - .gnu.version ${RELOCATING-0} : { *(.gnu.version) } - .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) } - .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) } - .rela.text ${RELOCATING-0} : - { - *(.rela.text) - ${RELOCATING+*(.rela.text.*)} - ${RELOCATING+*(.rela.gnu.linkonce.t*)} - } - .rela.data ${RELOCATING-0} : - { - *(.rela.data) - ${RELOCATING+*(.rela.data.*)} - ${RELOCATING+*(.rela.gnu.linkonce.d*)} - } - .rela.rodata ${RELOCATING-0} : - { - *(.rela.rodata) - ${RELOCATING+*(.rela.rodata.*)} - ${RELOCATING+*(.rela.gnu.linkonce.r*)} - } - .rela.got ${RELOCATING-0} : { *(.rela.got) } - .rela.got1 ${RELOCATING-0} : { *(.rela.got1) } - .rela.got2 ${RELOCATING-0} : { *(.rela.got2) } - .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } - .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } - .rela.init ${RELOCATING-0} : { *(.rela.init) } - .rela.fini ${RELOCATING-0} : { *(.rela.fini) } - .rela.bss ${RELOCATING-0} : { *(.rela.bss) } - .rela.plt ${RELOCATING-0} : { *(.rela.plt) } - .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) } - .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) } - .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2) } - .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2) } - .text ${RELOCATING-0} : - { - ${RELOCATING+${TEXT_START_SYMBOLS}} - *(.text) - ${RELOCATING+*(.text.*)} - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - ${RELOCATING+*(.gnu.linkonce.t*)} - } =${NOP-0} - .init ${RELOCATING-0} : { KEEP (*(.init)) } =${NOP-0} - .fini ${RELOCATING-0} : { KEEP (*(.fini)) } =${NOP-0} - .rodata ${RELOCATING-0} : - { - *(.rodata) - ${RELOCATING+*(.rodata.*)} - ${RELOCATING+*(.gnu.linkonce.r*)} - } - .rodata1 ${RELOCATING-0} : { *(.rodata1) } - ${RELOCATING+_etext = .;} - ${RELOCATING+PROVIDE (etext = .);} - ${RELOCATING+PROVIDE (__etext = .);} - ${CREATE_SHLIB-${SDATA2}} - ${CREATE_SHLIB-${SBSS2}} - ${RELOCATING+${OTHER_READONLY_SECTIONS}} - - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. It would - be more correct to do this: - ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (ALIGN(8) & (${MAXPAGESIZE} - 1))};} - The current expression does not correctly handle the case of a - text segment ending precisely at the end of a page; it causes the - data segment to skip a page. The above expression does not have - this problem, but it will currently (2/95) cause BFD to allocate - a single segment, combining both text and data, for this case. - This will prevent the text segment from being shared among - multiple executions of the program; I think that is more - important than losing a page of the virtual address space (note - that no actual memory is lost; the page which is skipped can not - be referenced). */ - ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};} - - .data ${RELOCATING-0} : - { - ${RELOCATING+${DATA_START_SYMBOLS}} - *(.data) - ${RELOCATING+*(.data.*)} - ${RELOCATING+*(.gnu.linkonce.d*)} - ${CONSTRUCTING+CONSTRUCTORS} - } - .data1 ${RELOCATING-0} : { *(.data1) } - ${RELOCATING+${OTHER_READWRITE_SECTIONS}} - - .got1 ${RELOCATING-0} : { *(.got1) } - .dynamic ${RELOCATING-0} : { *(.dynamic) } - - /* Put .ctors and .dtors next to the .got2 section, so that the pointers - get relocated with -mrelocatable. Also put in the .fixup pointers. - The current compiler no longer needs this, but keep it around for 2.7.2 */ - - ${RELOCATING+PROVIDE (_GOT2_START_ = .);} - ${RELOCATING+PROVIDE (__GOT2_START_ = .);} - .got2 ${RELOCATING-0} : { *(.got2) } - - ${RELOCATING+PROVIDE (__CTOR_LIST__ = .);} - ${RELOCATING+PROVIDE (___CTOR_LIST__ = .);} - ${RELOCATING+${CTOR}} - ${RELOCATING+PROVIDE (__CTOR_END__ = .);} - ${RELOCATING+PROVIDE (___CTOR_END__ = .);} - - ${RELOCATING+PROVIDE (__DTOR_LIST__ = .);} - ${RELOCATING+PROVIDE (___DTOR_LIST__ = .);} - ${RELOCATING+${DTOR}} - ${RELOCATING+PROVIDE (__DTOR_END__ = .);} - ${RELOCATING+PROVIDE (___DTOR_END__ = .);} - - ${RELOCATING+PROVIDE (_FIXUP_START_ = .);} - ${RELOCATING+PROVIDE (__FIXUP_START_ = .);} - .fixup ${RELOCATING-0} : { *(.fixup) } - ${RELOCATING+PROVIDE (_FIXUP_END_ = .);} - ${RELOCATING+PROVIDE (__FIXUP_END_ = .);} - ${RELOCATING+PROVIDE (_GOT2_END_ = .);} - ${RELOCATING+PROVIDE (__GOT2_END_ = .);} - - ${RELOCATING+PROVIDE (_GOT_START_ = .);} - ${RELOCATING+PROVIDE (__GOT_START_ = .);} - .got ${RELOCATING-0} : { *(.got) } - .got.plt ${RELOCATING-0} : { *(.got.plt) } - ${CREATE_SHLIB+${SDATA2}} - ${CREATE_SHLIB+${SBSS2}} - ${RELOCATING+PROVIDE (_GOT_END_ = .);} - ${RELOCATING+PROVIDE (__GOT_END_ = .);} - - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata ${RELOCATING-0} : { *(.sdata) } - ${RELOCATING+_edata = .;} - ${RELOCATING+PROVIDE (edata = .);} - ${RELOCATING+PROVIDE (__edata = .);} - .sbss ${RELOCATING-0} : - { - ${RELOCATING+PROVIDE (__sbss_start = .);} - ${RELOCATING+PROVIDE (___sbss_start = .);} - *(.sbss) - *(.scommon) - *(.dynsbss) - ${RELOCATING+PROVIDE (__sbss_end = .);} - ${RELOCATING+PROVIDE (___sbss_end = .);} - } - ${PLT} - .bss ${RELOCATING-0} : - { - ${RELOCATING+${OTHER_BSS_SYMBOLS}} - ${RELOCATING+PROVIDE (__bss_start = .);} - ${RELOCATING+PROVIDE (___bss_start = .);} - *(.dynbss) - *(.bss) - *(COMMON) - } - ${RELOCATING+_end = . ;} - ${RELOCATING+PROVIDE (end = .);} - ${RELOCATING+PROVIDE (__end = .);} - - /* These are needed for ELF backends which have not yet been - converted to the new style linker. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - - /* These must appear regardless of ${RELOCATING}. */ - ${OTHER_SECTIONS} -} -EOF diff --git a/contrib/binutils/ld/scripttempl/tic30aout.sc b/contrib/binutils/ld/scripttempl/tic30aout.sc deleted file mode 100644 index 28baed37e614..000000000000 --- a/contrib/binutils/ld/scripttempl/tic30aout.sc +++ /dev/null @@ -1,34 +0,0 @@ -cat <<EOF -OUTPUT_FORMAT("${OUTPUT_FORMAT}") -OUTPUT_ARCH(${ARCH}) - -${STACKZERO+${RELOCATING+${STACKZERO}}} -${RELOCATING+PROVIDE (__stack = 0);} -SECTIONS -{ - ${RELOCATING+. = ${TEXT_START_ADDR};} - .text : - { - CREATE_OBJECT_SYMBOLS - *(.text) - ${RELOCATING+_etext = .;} - ${RELOCATING+__etext = .;} - ${PAD_TEXT+${RELOCATING+. = ${DATA_ALIGNMENT};}} - } - ${RELOCATING+. = ${DATA_ALIGNMENT};} - .data : - { - *(.data) - ${RELOCATING+_edata = .;} - ${RELOCATING+__edata = .;} - } - .bss : - { - ${RELOCATING+ __bss_start = .}; - *(.bss) - *(COMMON) - ${RELOCATING+_end = ALIGN(4) }; - ${RELOCATING+__end = ALIGN(4) }; - } -} -EOF diff --git a/contrib/binutils/ld/scripttempl/tic30coff.sc b/contrib/binutils/ld/scripttempl/tic30coff.sc deleted file mode 100644 index df2d4f737cd3..000000000000 --- a/contrib/binutils/ld/scripttempl/tic30coff.sc +++ /dev/null @@ -1,58 +0,0 @@ -cat <<EOF -OUTPUT_FORMAT("${OUTPUT_FORMAT}") -OUTPUT_ARCH("${OUTPUT_ARCH}") - -MEMORY -{ - rom : ORIGIN = 0x00000300, LENGTH = 16k - ram : ORIGIN = 0x00000300 + 16k, LENGTH = 16k - ramblk0 : ORIGIN = 0x02026000, LENGTH = 0x1000 - ramblk1 : ORIGIN = 0x02027000, LENGTH = 0x1000 -} - -SECTIONS -{ -.vectors 0x00000000 : -{ - *(vectors) -} - -.text : -{ - *(.text) -} > rom - -.const : -{ - *(.const) - __etext = . ; -} > rom - -.mdata : AT( ADDR(.const) + SIZEOF(.const) ) -{ - __data = . ; - *(.data); - __edata = . ; -} > ram - -.bss : -{ - __bss = . ; - *(.bss); - *(COMMON); - __ebss = . ; -} > ram - -.ram0 : -{ - *(ram0) -} > ramblk0 - -.ram1 : -{ - *(ram1) -} > ramblk1 - -} - -EOF diff --git a/contrib/binutils/ld/scripttempl/v850.sc b/contrib/binutils/ld/scripttempl/v850.sc deleted file mode 100644 index 90731de87494..000000000000 --- a/contrib/binutils/ld/scripttempl/v850.sc +++ /dev/null @@ -1,222 +0,0 @@ -cat << EOF -OUTPUT_FORMAT("elf32-v850", "elf32-v850", - "elf32-v850") -OUTPUT_ARCH(v850) -ENTRY(_start) -SEARCH_DIR(.); -SECTIONS -{ - /* This saves a little space in the ELF file, since the zda starts - at a higher location that the ELF headers take up. */ - - .zdata ${ZDATA_START_ADDR} : - { - *(.zdata) - *(.zbss) - *(reszdata) - *(.zcommon) - } - - /* This is the read only part of the zero data area. - Having it as a seperate section prevents its - attributes from being inherited by the zdata - section. Specifically it prevents the zdata - section from being marked READONLY. */ - - .rozdata ${ROZDATA_START_ADDR} : - { - *(.rozdata) - *(romzdata) - *(romzbss) - } - - /* Read-only sections, merged into text segment. */ - . = ${TEXT_START_ADDR}; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.init : { *(.rel.init) } - .rela.init : { *(.rela.init) } - .rel.fini : { *(.rel.fini) } - .rela.fini : { *(.rela.fini) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { KEEP (*(.init)) } =0 - .plt : { *(.plt) } - - .text : - { - *(.text) - ${RELOCATING+*(.text.*)} - - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.gnu.linkonce.t*) - } =0 - - ${RELOCATING+_etext = .;} - ${RELOCATING+PROVIDE (etext = .);} - - /* This is special code area at the end of the normal text section. - It contains a small lookup table at the start followed by the - code pointed to by entries in the lookup table. */ - - .call_table_data ${CALL_TABLE_START_ADDR} : - { - ${RELOCATING+PROVIDE(__ctbp = .);} - *(.call_table_data) - } = 0xff /* Fill gaps with 0xff. */ - - .call_table_text : - { - *(.call_table_text) - } - - .fini : { KEEP (*(.fini)) } =0 - .rodata : { *(.rodata) ${RELOCATING+*(.rodata.*)} *(.gnu.linkonce.r*) } - .rodata1 : { *(.rodata1) } - - .data : - { - *(.data) - ${RELOCATING+*(.data.*)} - *(.gnu.linkonce.d*) - CONSTRUCTORS - } - .data1 : { *(.data1) } - .ctors : - { - ${CONSTRUCTING+___ctors = .;} - KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*crtend(.ctors)) - ${CONSTRUCTING+___ctors_end = .;} - } - .dtors : - { - ${CONSTRUCTING+___dtors = .;} - KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*crtend.o(.dtors)) - ${CONSTRUCTING+___dtors_end = .;} - } - - .got : { *(.got.plt) *(.got) } - .dynamic : { *(.dynamic) } - - .tdata ${TDATA_START_ADDR} : - { - ${RELOCATING+PROVIDE (__ep = .);} - *(.tbyte) - *(.tcommon_byte) - *(.tdata) - *(.tbss) - *(.tcommon) - } - - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - - .sdata ${SDATA_START_ADDR} : - { - ${RELOCATING+PROVIDE (__gp = . + 0x8000);} - *(.sdata) - } - - /* See comment about .rozdata. */ - .rosdata ${ROSDATA_START_ADDR} : - { - *(.rosdata) - } - - /* We place the .sbss data section AFTER the .rosdata section, so that - it can directly preceed the .bss section. This allows runtime startup - code to initialise all the zero-data sections by simply taking the - value of '_edata' and zeroing until it reaches '_end'. */ - - .sbss : - { - ${RELOCATING+__sbss_start = .;} - *(.sbss) - *(.scommon) - } - - ${RELOCATING+_edata = DEFINED (__sbss_start) ? __sbss_start : . ;} - ${RELOCATING+PROVIDE (edata = _edata);} - - .bss : - { - ${RELOCATING+__bss_start = DEFINED (__sbss_start) ? __sbss_start : . ;} - ${RELOCATING+__real_bss_start = . ;} - *(.dynbss) - *(.bss) - *(COMMON) - } - - ${RELOCATING+_end = . ;} - ${RELOCATING+PROVIDE (end = .);} - - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - - /* SGI/MIPS DWARF 2 extensions. */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - - /* User stack. */ - .stack 0x200000 : - { - ${RELOCATING+__stack = .;} - *(.stack) - } -} -EOF diff --git a/contrib/binutils/libiberty/acconfig.h b/contrib/binutils/libiberty/acconfig.h deleted file mode 100644 index f7c599df7ac6..000000000000 --- a/contrib/binutils/libiberty/acconfig.h +++ /dev/null @@ -1,11 +0,0 @@ -/* Define if you have the sys_errlist variable. */ -#undef HAVE_SYS_ERRLIST - -/* Define if you have the sys_nerr variable. */ -#undef HAVE_SYS_NERR - -/* Define if you have the sys_siglist variable. */ -#undef HAVE_SYS_SIGLIST - -/* Define if you have the strerror function. */ -#undef HAVE_STRERROR diff --git a/contrib/binutils/libiberty/alloca-botch.h b/contrib/binutils/libiberty/alloca-botch.h deleted file mode 100644 index c909573f58c6..000000000000 --- a/contrib/binutils/libiberty/alloca-botch.h +++ /dev/null @@ -1,5 +0,0 @@ -/* RS/6000 AIX botched alloca and requires a pragma, which ordinary compilers - throw up about, so we have to put it in a specially-configured file. - Like this one. */ - -#pragma alloca diff --git a/contrib/binutils/libiberty/alloca-norm.h b/contrib/binutils/libiberty/alloca-norm.h deleted file mode 100644 index bda4fc049adf..000000000000 --- a/contrib/binutils/libiberty/alloca-norm.h +++ /dev/null @@ -1,25 +0,0 @@ -/* "Normal" configuration for alloca. */ - -#ifdef __GNUC__ -#ifndef alloca -#define alloca __builtin_alloca -#endif -#else /* ! defined (__GNUC__) */ -#if defined (sparc) && defined (sun) -#include <alloca.h> -#ifdef __STDC__ -extern void *__builtin_alloca(); -#else /* ! defined (__STDC__) */ -extern char *__builtin_alloca(); /* Stupid include file doesn't declare it */ -#endif /* ! defined (__STDC__) */ -#else /* ! defined (sparc) || ! defined (sun) */ -#ifdef __STDC__ -PTR alloca (size_t); -#else /* ! defined (__STDC__) */ -PTR alloca (); /* must agree with functions.def */ -#endif /* ! defined (__STDC__) */ -#endif /* ! defined (sparc) || ! defined (sun) */ -#ifdef _WIN32 -#include <malloc.h> -#endif -#endif /* ! defined (__GNUC__) */ diff --git a/contrib/binutils/libiberty/config/mh-sysv b/contrib/binutils/libiberty/config/mh-sysv deleted file mode 100644 index eb102d550108..000000000000 --- a/contrib/binutils/libiberty/config/mh-sysv +++ /dev/null @@ -1 +0,0 @@ -RANLIB=true diff --git a/contrib/binutils/libiberty/config/mh-sysv4 b/contrib/binutils/libiberty/config/mh-sysv4 deleted file mode 100644 index 4d1aa3cd61d5..000000000000 --- a/contrib/binutils/libiberty/config/mh-sysv4 +++ /dev/null @@ -1,3 +0,0 @@ -HDEFINES = -DHAVE_SYSCONF -RANLIB=true -INSTALL = cp diff --git a/contrib/binutils/libiberty/config/mt-mingw32 b/contrib/binutils/libiberty/config/mt-mingw32 deleted file mode 100644 index 2fb17d783d03..000000000000 --- a/contrib/binutils/libiberty/config/mt-mingw32 +++ /dev/null @@ -1,27 +0,0 @@ -# Mingw32 target Makefile fragment. -# The autoconfiguration fails for a Mingw32 target, because of an -# incompatible definition of sys_errlist, which is imported from a DLL. -# Therefore, we compute the dependencies by hand. - -HDEFINES = -DNO_SYS_PARAM_H -DNO_SYS_FILE_H -CONFIG_H = mgconfig.h -NEEDED_LIST = mgneeded-list - -mgconfig.h: Makefile - if [ -f ../newlib/Makefile ]; then \ - $(MAKE) $(FLAGS_TO_PASS) xconfig.h; \ - cp xconfig.h mgconfig.h; \ - else \ - echo "#define NEED_sys_siglist 1" >>mgconfig.h; \ - echo "#define NEED_strsignal 1" >>mgconfig.h; \ - echo "#define NEED_psignal 1" >>mgconfig.h; \ - echo "#define NEED_basename 1" >>mgconfig.h; \ - fi - -mgneeded-list: Makefile - if [ -f ../newlib/Makefile ]; then \ - $(MAKE) $(FLAGS_TO_PASS) xneeded-list; \ - cp xneeded-list mgneeded-list; \ - else \ - echo getopt.o vasprintf.o >mgneeded-list; \ - fi diff --git a/contrib/binutils/libiberty/dummy.c b/contrib/binutils/libiberty/dummy.c deleted file mode 100644 index 08da647e30eb..000000000000 --- a/contrib/binutils/libiberty/dummy.c +++ /dev/null @@ -1,49 +0,0 @@ -#include <ansidecl.h> - -#ifdef __STDC__ -#include <stddef.h> -#define clock_t unsigned long -#define DEF(NAME, RETURN_TYPE, ARGLIST, ARGS) extern RETURN_TYPE NAME (ARGS); -#define DEFFUNC(NAME, RETURN_TYPE, ARGLIST, ARGS) extern RETURN_TYPE NAME (ARGS); -#else -#define void int -#define size_t unsigned long -#define clock_t unsigned long -#define DEF(NAME, RETURN_TYPE, ARGLIST, ARGS) extern RETURN_TYPE NAME (); -#define DEFFUNC(NAME, RETURN_TYPE, ARGLIST, ARGS) extern RETURN_TYPE NAME (); -#endif - -#define DEFVAR(NAME,DECL,USE) extern DECL; - -#define NOTHING /*nothing*/ - -#include "alloca-conf.h" -#include "functions.def" - -/* Always use our: getopt.o getopt1.o obstack.o spaces.o */ - -int -main (argc, argv) - int argc; char **argv; -{ - -/* Create a dummy function call for each DEF-defined function. */ - -#undef DEF -#undef DEFVAR -#undef DEFFUNC -#undef AND -#define AND = 0; -/* ARGS expands into a set of declaration. NAME ARG_LIST expands - info a function call that uses those variables as actual parameters. - If the function has been DEF'ed correctly, we can pass the right - number and types of parameters, which is nice. (E.g. gcc may - otherwise complain about the wrong number of parameters to certain - builtins.) */ -#define DEF(NAME, RETURN_TYPE, ARG_LIST, ARGS) { ARGS; NAME ARG_LIST; } -#define DEFVAR(NAME, DECL, USE) { USE; } -#define DEFFUNC(NAME, RETURN_TYPE, ARG_LIST, ARGS) { ARGS; NAME ARG_LIST; } -#include "functions.def" - - return (0); -} diff --git a/contrib/binutils/libiberty/functions.def b/contrib/binutils/libiberty/functions.def deleted file mode 100644 index 0f13f107868e..000000000000 --- a/contrib/binutils/libiberty/functions.def +++ /dev/null @@ -1,70 +0,0 @@ -/* - * List of function definitions that may *optionally* be included - * in libiberty.a. The function names must match the filenames, - * e.g. bzero() is defined in bzero.c. (While each file can contain - * extra functions, do not list them.) - * - * In the default libiberty configuration, these object files - * (e.g bzero.o) are included if and only if cc fails to find - * the corresponding function in libc. - */ - -DEF(asprintf, int, (), NOTHING) -DEF(atexit, int, (f), void (*f)()) -DEF(bcmp, int, (s1, s2, length), char *s1 AND char *s2 AND int length ) -DEF(bcopy, void, (s1, s2, length), char *s1 AND char *s2 AND int length ) -DEF(bzero, void, (s, length), char *s AND int length) -DEF(clock, clock_t, (), NOTHING) -DEF(getopt, int, (argc, argv, optstring), - int argc AND char **argv AND CONST char *optstring) -DEF(getpagesize, int , (), NOTHING) -DEF(getcwd, char*, (buf, len), char *buf AND int len) -DEF(index, char*, (s, c), char *s AND int c) -DEF(insque, void, (), NOTHING) -DEF(memchr, PTR, (s, c, length), CONST PTR s AND int c AND size_t length) -DEF(memcmp, int, (s1, s2, length), - CONST PTR s1 AND CONST PTR s2 AND size_t length) -DEF(memcpy, PTR, (s1, s2, length), PTR s1 AND CONST PTR s2 AND size_t length) -DEF(memmove, PTR, (s1, s2, length), PTR s1 AND CONST PTR s2 AND size_t length) -DEF(memset, PTR, (s, val, length), PTR s AND int val AND size_t length ) -DEF(random, long int, (), NOTHING) -DEF(rename, int, (f, t), char *f AND char *t) -DEF(rindex, char*, (s, c), char *s AND int c) -DEF(strcasecmp, int, (s1, s2), char *s1 AND char *s2) -DEF(strncasecmp, int, (s1, s2, n), char *s1 AND char *s2 AND int n) -DEF(strchr, char*, (s, c), CONST char *s AND int c) -DEF(strdup, char*, (s1), char * s1) -DEF(strrchr, char*, (s, c), CONST char *s AND int c) -DEF(strstr, char*, (), NOTHING) -DEF(strtod, double, (), NOTHING) -DEF(strtol, long, (), NOTHING) -DEF(strtoul, unsigned long, (), NOTHING) -DEF(tmpnam, char *, (s), char * s) -DEF(vfork, int, (), NOTHING) -DEF(vfprintf, int, (), NOTHING) -DEF(vprintf, int, (), NOTHING) -DEF(vsprintf, int, (), NOTHING) -DEF(sigsetmask, int, (), NOTHING) -DEF(alloca, PTR, (size), size_t size) -DEF(waitpid, int, (pid, statp, opts), int pid AND int* statp AND int opts ) -DEF(vasprintf, int, (), NOTHING) - -/* List of global variables that we want to look for in the host - environment, and to generate an entry NEED_<variable> in config.h - if they are not found. The first arg is the variable name, the - second arg is how to declare the variable, and the third is how to - use it. */ - -DEFVAR(sys_nerr, int sys_nerr, sys_nerr = 0) -DEFVAR(sys_errlist, char *sys_errlist[], sys_errlist[0] = 0) -DEFVAR(sys_siglist, char *sys_siglist[], sys_siglist[0] = 0) - -/* List of global functions that we want to look for in the host - environment, and to generate an entry NEED_<funcname> in config.h - if they are not found. */ - -DEFFUNC(strerror, char*, (errnoval), int errnoval) -DEFFUNC(psignal, void, (signo, message), unsigned signo AND char *message) -DEFFUNC(basename, char *, (name), CONST char *name) -DEFFUNC(on_exit, void, (f, arg), void (*f)() AND char *arg) -DEFFUNC(strsignal, const char *, (signo), int signo) diff --git a/contrib/binutils/md5.sum b/contrib/binutils/md5.sum deleted file mode 100644 index c62704f18f90..000000000000 --- a/contrib/binutils/md5.sum +++ /dev/null @@ -1,3022 +0,0 @@ -0636e73ff0215e8d672dc4c32c317bb3 COPYING -f30a9716ef3762e3467a2f62bf790f0a COPYING.LIB -9cdb15c1e49c0070192d6d1c7a195e7e Makefile.in -07c33a285703b40cd6f93a478e97e03b README -22383b04c0616f41ee4ba51baca24655 bfd/ChangeLog -ceab81aa1f02825092808fdafba0239d bfd/COPYING -5a266b5dba92eea6d99752a62548bb2d bfd/doc/ChangeLog -1e5a6fbefd1aaed4433ace8afce78961 bfd/doc/Makefile.am -a464bee4132fb2fa44c4d2e46b58a754 bfd/doc/Makefile.in -0fbe144d8d1782e0379db812371c6a57 bfd/doc/aoutx.texi -6f34186ad28a5b230efc088a709560de bfd/doc/archive.texi -f98e3a1458953a5a6fae44a5c5f75e30 bfd/doc/archures.texi -84be077fe0d16ded1d48b6bd4602f737 bfd/doc/bfd.info -a31bdf4569c4f1cd2745113b3083aa30 bfd/doc/bfd.info-1 -6911c8229b2daa3efa2ce01bd699c793 bfd/doc/bfd.info-2 -efa0b7d03876abc3e57a529aa5b43048 bfd/doc/bfd.info-3 -39bdefc46b786b1663d0b84f64fcf04f bfd/doc/bfd.info-4 -b2c4637dbb3c0690b75e900477fa1224 bfd/doc/bfd.info-5 -33ed65a4ba35b35445e5684b8454a0b9 bfd/doc/bfd.info-6 -ba54c1f2d34777c4624608c8cd032ade bfd/doc/bfd.info-7 -0b6e6b0217a3682a89b784120d6c6912 bfd/doc/bfd.texinfo -bf1f24c962732c18cedacc546e577d38 bfd/doc/bfdint.texi -8b6ecc6029ed69110c2fd06605bbb028 bfd/doc/bfdsumm.texi -aeb854f56071a92ed682ea3a47ef412e bfd/doc/bfdt.texi -a08da988e834eaa44ce036daed384f3f bfd/doc/cache.texi -4e6650cba5f9d8f2bc248e7edfe2b166 bfd/doc/chew.c -9b20193a1b085b49ad22e22a94d7eade bfd/doc/coffcode.texi -99105e514872b3e0f5eadbc9844efeed bfd/doc/core.texi -e67d8b07516154c4ddbee2e3bab3d75e bfd/doc/doc.str -c60b298f07f5a175f2325d48bd009bdb bfd/doc/elf.texi -d41d8cd98f00b204e9800998ecf8427e bfd/doc/elfcode.texi -4e84142a7f35ea897af65f69d33fbae5 bfd/doc/format.texi -1d846f321c1f04f609386d3c31201c93 bfd/doc/hash.texi -7ac9a36b8a72594048188cd4ee5012dc bfd/doc/init.texi -e17fcdf3ea8e298f1327ed8c4649a156 bfd/doc/libbfd.texi -6f212b00766abadea5b686c91c024f16 bfd/doc/linker.texi -5fa24958e8a60b2f879af658e615ccc0 bfd/doc/makefile.vms -75adee5262cfe18e955d31dcec3d9a54 bfd/doc/opncls.texi -5bf597a23995b21bfaefa45638e33df3 bfd/doc/proto.str -6f8560b2e86ac189a40bce16c927dcdb bfd/doc/reloc.texi -81e47720738cbb4c3361b092baf90841 bfd/doc/section.texi -fd78f14948d36f7fae45d29db7b0d521 bfd/doc/syms.texi -d193493718f22e2de122b05b741f660b bfd/doc/targets.texi -f7f4648407c03c8d7ecdac1e9b3c267a bfd/po/Make-in -445a1c3ee4b5467304d3568fc54a9530 bfd/po/bfd.pot -6aaeff367ac449364787e94b6db53183 bfd/ChangeLog-9193 -78e72a396e9d529dc2f9e3f6c0eb7efb bfd/ChangeLog-9495 -45851bb85b21afd2c2247c5bd531eda0 bfd/ChangeLog-9697 -3a8b2876879b53a8f247a03416527a48 bfd/ChangeLog-9899 -d618facc3e8ce8bf3d02ba452e1be6ab bfd/MAINTAINERS -cac2c8b510bd39ae04fe5bfce40a197e bfd/Makefile.am -d99c8cebc58f57cc7982b4755bfcb6c5 bfd/Makefile.in -6455e3c85b31e588ecb75f7d3c945c8d bfd/PORTING -11627ef87a2a20a3326b87602d051620 bfd/README -cd26654c6eb30680694867e434e40044 bfd/TODO -fa9dc5a90d06b56e4fc7388caa0936f2 bfd/acinclude.m4 -3d436bc3696617e5f5539e46fbb81763 bfd/aclocal.m4 -783909cb3ba12056ddfd113362c66b8f bfd/aix386-core.c -15d641f38a61d43e9540e89296e67321 bfd/aout-adobe.c -d56d591b9a3938cd12de14ca63863c47 bfd/aout-arm.c -e00ccede7e9e61f87ad5d8b67810817b bfd/aout-cris.c -d80798e7e80396610c9817724df3d0fc bfd/aout-encap.c -0bb2732a15a0255366389fa13f5034b8 bfd/aout-ns32k.c -d4ee6f5c992ea87510be7b202fc06dfb bfd/aout-sparcle.c -2f8b4091d064635ae41681ee597078d0 bfd/aout-target.h -3e051d26fb5cbdd0c8530d67a5a829ad bfd/aout-tic30.c -c2fa21aea08313dffcc9b4a2a3e9ca5b bfd/aout0.c -710ff75a0a234773691c069654dd8ba6 bfd/aout32.c -cae169ce11deb6f450104c569c23c853 bfd/aout64.c -4a67efea73c2bf40983f1570607e10de bfd/aoutf1.h -2e0b7e96647fd0d8a75c730fc92bd7ea bfd/aoutx.h -e9c89491cabfaf3db12368e423003172 bfd/archive.c -ed85bcca32de659b4ac834648c69e47a bfd/archures.c -43473bfc2577fc75e330907ad43b810d bfd/armnetbsd.c -68fc30620cce0b416e21fc8bf9ffb66d bfd/bfd-in.h -d101e9977294c79488c7038e11bb8872 bfd/bfd-in2.h -1ec8f01cd36a0410d6a358c13450d32c bfd/bfd.c -43ab9de01b31034b63b1e34e58e171bf bfd/binary.c -5b0964ce2bef841eca1cc28ac170b340 bfd/bout.c -794d989c69536eac1b969452a240c617 bfd/cache.c -6d3c1b378bc7ed685664fe6eca297523 bfd/cf-i386lynx.c -545c111611d3dddaae8c666293aac89b bfd/cf-m68klynx.c -09a8617f3c790897c5ac230aa7c9e683 bfd/cf-sparclynx.c -ecf07e87f41eacfbb3f69e959b67986f bfd/cisco-core.c -06ecc8e343ca4331ab10c8f00a9df323 bfd/coff-a29k.c -2af31e3d92988fb31c0970a686aa7960 bfd/coff-alpha.c -be66609cf0885355395701084da2a073 bfd/coff-apollo.c -25815e411716c71b2e39e46996716db5 bfd/coff-arm.c -04d8d5fe37fd8bdbf2c70031ff92db80 bfd/coff-aux.c -57df3015110d34f4a343941c45f60577 bfd/coff-go32.c -3546fff401b9a26bcd4121820ea52797 bfd/coff-h8300.c -6e844c7259f2b47eeb578984f8b06b7a bfd/coff-h8500.c -edc1a2a2a4106ddbe929545af6898e31 bfd/coff-i386.c -eedf5424ec64783efbb545eb930fbd8e bfd/coff-i860.c -f03155ea586d01ced8c85c43ec93dc9f bfd/coff-i960.c -eae36e1c87fce17a42f52b56f71d1841 bfd/coff-ia64.c -80ff3a9c87e1335f5fcd991a398c159f bfd/coff-m68k.c -646163dbbe28724f933cc5dff8d6b522 bfd/coff-m88k.c -9fd04d7b0c69cd43a51a42e4cac313e3 bfd/coff-mcore.c -85217ef58e511dbf42d4b007f8f8e624 bfd/coff-mips.c -0fe98f356a19d05611fa133c217e77e5 bfd/coff-pmac.c -b31637614abfd34b5e72ad0f76f6418c bfd/coff-ppc.c -92197be7dfa58b4f3c079ea0e91c165b bfd/coff-rs6000.c -14096c1501e38762f71ecc48819cc389 bfd/coff-sh.c -56dadcdfef723b9fd53ecc9a501f616f bfd/coff-sparc.c -ff09554abd281030f46ccc417c403aa9 bfd/coff-stgo32.c -0a6bcb90289a5f62cb39fb0ec0858560 bfd/coff-svm68k.c -eddc8ea37292e1e57f26435d884e432b bfd/coff-tic30.c -e6300d33022fe5164ebb75d09c20fabb bfd/coff-tic54x.c -015b6a9faba6e0ee871d1c3e751c4261 bfd/coff-tic80.c -f8c6308a039c92faded1d165112668a2 bfd/coff-u68k.c -59a6770435f62b0214de775a03bf4e9c bfd/coff-w65.c -d958f107aae4a2592d9bbc57e2fc50c5 bfd/coff-we32k.c -81a2479479af147514f6cbe7ca941e07 bfd/coff-z8k.c -b599fc0cbd45a2d9cb95845f9802ba28 bfd/coff64-rs6000.c -d4e3ce939d94c50f67c16ba80bbd809f bfd/coffcode.h -3029424ada4af130ef96b8e1d7a99a53 bfd/coffgen.c -94a1415b45d3f1ca4c1cbd2cb591f62d bfd/cofflink.c -c81791ff3f60009e8d28464b6c53c396 bfd/coffswap.h -1d6832ab0a312bf399ac892d9666ef25 bfd/config.bfd -2ebfc42d5d2a4668d364f1b54968b4bc bfd/config.in -d1292a46d15e8d2b2b9c0fc4f837e375 bfd/configure -a8485b69f68d81f4ef2f29b51bb36d85 bfd/configure.com -da932a956ba7ad830b729bafd4af4644 bfd/configure.host -12427c9975895d3dfc3cfa7724e630bc bfd/configure.in -13256bb517cdf3f1b4b04eaabc8a4490 bfd/corefile.c -6bc9b90664a2ebdf2b85f19dce0b7f11 bfd/cpu-a29k.c -f93b02f976ea91934c4118be4ed019d4 bfd/cpu-alpha.c -ebc8e4333cf21216de587d22524c9f57 bfd/cpu-arc.c -2ac57d0ff930768b2fa927123e660ec9 bfd/cpu-arm.c -9b9349ab23aa88786581dc0734f31316 bfd/cpu-avr.c -89de8746c4102f5b0b89ff0b19314d7b bfd/cpu-cris.c -6c476a3781d45cdca390650b9273d3ed bfd/cpu-d10v.c -7a7d89b109710f951f825992832fb422 bfd/cpu-d30v.c -fe25690c8c53442b507f5247c9635748 bfd/cpu-fr30.c -567c27d0eb1ca67f1767099379a5957f bfd/cpu-h8300.c -2b2928d3eba5ec4e99916940f24319b5 bfd/cpu-h8500.c -5e942a325f1b1a2e50767f070ce3895c bfd/cpu-hppa.c -5020c76b76859038dd5a92a46647a667 bfd/cpu-i370.c -03868248f282503ee1ddc86c81d77804 bfd/cpu-i386.c -b6d0fbb65c82465573f28353a930b3b6 bfd/cpu-i860.c -42d1e5cfdae1ac51322e21ac410d7bc9 bfd/cpu-i960.c -b7bffd30c0e7b6134a923b1be64ece2e bfd/cpu-ia64-opc.c -2e48697f67575deb45fb727619267da3 bfd/cpu-ia64.c -cdbfa4a9703bf5bfca24f4b7d6bc49a7 bfd/cpu-m10200.c -3dcc6de8db1ffd6408ad3f3dd080b0d3 bfd/cpu-m10300.c -4b5332540a2a4d907dd2d0d6552b4f2f bfd/cpu-m32r.c -0ff542774da1203f6f6496971e8f33b8 bfd/cpu-m68hc11.c -5f6585a0783899916bc3bd9ce42c0624 bfd/cpu-m68hc12.c -431570536021941e2fb8658707a8deba bfd/cpu-m68k.c -480b3bebf9d0b948bc3d51c23fbd511f bfd/cpu-m88k.c -ecc303dc3afabbc076d866c4b1d40191 bfd/cpu-mcore.c -84aedb91a48659311061f3779e1cc5b2 bfd/cpu-mips.c -a0985008fc628157c9b27afceb9fa5fb bfd/cpu-ns32k.c -57fd58bea31545e419d39485059294a4 bfd/cpu-pj.c -21b3055e3b8cca8b2fa65ea72c010fbf bfd/cpu-powerpc.c -2634d322a7c1b737c5ba95d727e70d5c bfd/cpu-rs6000.c -76591b09ebf820167a73bee3d4f8b608 bfd/cpu-sh.c -6c1f0f9816581e6654cfb4476ec51386 bfd/cpu-sparc.c -4a7876d7cfd8a37c9e37f95d0968e7b4 bfd/cpu-tic30.c -b43f6e6ead72cff7ff28c87cec93a33a bfd/cpu-tic54x.c -424e7a355ca4b115f657609a91ade54e bfd/cpu-tic80.c -6d0acf764ac828e6db63a074a54b80ba bfd/cpu-v850.c -722f3f2dceee71c5eae9ab6d9a12e4a2 bfd/cpu-vax.c -42b04e46e5c22d8231df9062c48f9cf8 bfd/cpu-w65.c -3d3a88c1679b541231b65d10b197595c bfd/cpu-we32k.c -17738f4235390683e20471a7a52ff886 bfd/cpu-z8k.c -bf7c79bca2a5503d8e5a08eb2093e354 bfd/demo64.c -325284c2aa7c21d58bf3592f16147525 bfd/dep-in.sed -66ddc5e71a123f88fae4b649913a3625 bfd/dwarf1.c -8e226ff61ec8397b649fcea23d18c5e6 bfd/dwarf2.c -2bd82ca961cf8804c71a8a0f9418612d bfd/ecoff.c -bb90a452e36b92549e623ae4b11b71b3 bfd/ecofflink.c -338f536d95996bf70af288e87e2661bf bfd/ecoffswap.h -35a5d5aa67cdcb354a57872bd6abf5ab bfd/efi-app-ia32.c -e11d2ca6f1bb770ed54aa40386f69b6b bfd/efi-app-ia64.c -069cfcb9e552adb039a5e7f8f54bf045 bfd/elf-bfd.h -a45567b7ed9963c8917942cfb177f137 bfd/elf-hppa.h -dea405a2cadc109a396e598e426782e3 bfd/elf-m10200.c -b0bf972d5ef56f0c349e552cf6225116 bfd/elf-m10300.c -7557a9d743f544179e1914eafb71ba2e bfd/elf.c -c612153791413796ae7b0afe055e345d bfd/elf32-arc.c -8107b55913a0bf1fe46d8ceed7ae71bf bfd/elf32-arm.h -0ff7faa86372c71faaba9df3828878cc bfd/elf32-avr.c -36378f4202010b3f3b89fd679a49320e bfd/elf32-cris.c -c885ba8e2901116ce03d2b3dccac4e89 bfd/elf32-d10v.c -0235362bfd052c523c133bf570acbd53 bfd/elf32-d30v.c -49faab1462b330c4c49dbe7c9d180eaf bfd/elf32-fr30.c -e8040020c66e66a42fd98d2bc855e805 bfd/elf32-gen.c -3ee4163b4b9d0c3b7a164627c08771c8 bfd/elf32-hppa.c -b7922397f8a9f48d5a4fc64833db13f9 bfd/elf32-hppa.h -f23b710d855b7173334c6718bf6cd688 bfd/elf32-i370.c -90cf2ef15a659400e8feb6645a367f6a bfd/elf32-i386.c -d644f126ec840265005aeb71f67906e7 bfd/elf32-i860.c -95d5d92e7306b53ea5ab95c62e2b5ea1 bfd/elf32-i960.c -bef5efb28c6db1170c54e9fd3497aeee bfd/elf32-m32r.c -3ac813e93933b49eb51dc510faff890b bfd/elf32-m68hc11.c -ebbf73fbb693283520892daf4eaed2de bfd/elf32-m68hc12.c -84b69778a652d2cfc29bcbf5d82d33af bfd/elf32-m68k.c -6d08a2b4a53db400e322f8f712aa9498 bfd/elf32-m88k.c -1f60d815efdef6aeaa046f8b354f53e4 bfd/elf32-mcore.c -4fbbadc82c574345b50e8ce7a7c46cbc bfd/elf32-mips.c -b3684e979f1de64ee10aa23e5685c5c2 bfd/elf32-pj.c -17c6ae4e2299f25c786a18af88639931 bfd/elf32-ppc.c -18f44608c596c17f9b986a18a3c9fa1e bfd/elf32-sh-lin.c -177d3fec0eaa269a02d1d00174ffd176 bfd/elf32-sh.c -b4b4859eb5d5c1c85481a34897fc1cda bfd/elf32-sparc.c -f73cf274c056492df2771950064a22a9 bfd/elf32-v850.c -ed57bd460ee2d4a61a5c445f280f295c bfd/elf32.c -ab7d515fdfd6173798101dd1247c38e4 bfd/elf64-alpha.c -7d66675b4fb106331426ca0775a0dd71 bfd/elf64-gen.c -dfe015d5db4e49f664194f73f3bd3aa6 bfd/elf64-hppa.c -8d4af471848e82a40a426088ad312988 bfd/elf64-hppa.h -fdeb99876d995a5113705d365c39882f bfd/elf64-mips.c -805e4b8c3b808a837780d88677b2b8d8 bfd/elf64-sparc.c -51948652723cb7cbdc5bf48f68972960 bfd/elf64-x86-64.c -0df4bff9f99908d451625f14be3dc667 bfd/elf64.c -04c179c481f73ef38f4fde45099ea774 bfd/elfarm-nabi.c -7a2f68e293672a469707ee7247ca431f bfd/elfarm-oabi.c -1c857bcc6db894788e6d9612d9190fcd bfd/elfcode.h -a179dd23bcf17071bcd156e30739e502 bfd/elfcore.h -4665db235c5fc322fe645ec556a02351 bfd/elflink.c -eec699dcafd99021dcd6ca470b97bfcb bfd/elflink.h -ee628b92cd241097a81fd761ecfe709f bfd/elfxx-ia64.c -0067bc443dde2afdfdcfa15fb2107267 bfd/elfxx-target.h -5f9b71e52009091cb901280cbe42283c bfd/epoc-pe-arm.c -c9f006f05a9b9f4d6be5fa84dcad8b6a bfd/epoc-pei-arm.c -00882a27abee3c09285429e99d2872ee bfd/format.c -4498092435cf035affd5b3f0d859f7f1 bfd/freebsd.h -c16189d94fa43e845e6b066e6bd29401 bfd/gen-aout.c -ee6fc742a96faf09cbe76a5b8933d3c4 bfd/genlink.h -663a6979bd331c91d1385445edeca7b0 bfd/go32stub.h -6e40031d51114640cfeba4f70e8fce2d bfd/hash.c -d231e6f23f8ca89aa2914992a30a7439 bfd/host-aout.c -4967093aecdbcaebab4be47ad87369f0 bfd/hp300bsd.c -23f63c6bf8c8a673de96d7400861f16b bfd/hp300hpux.c -5cfacfdd3fde9b8c36cbec0486280982 bfd/hppabsd-core.c -035696490716fd55aa20a97a0137f622 bfd/hpux-core.c -42b78f2024c6114d60dce39873229d91 bfd/i386aout.c -f9e0718ca8ae927a262a15b909ca38ad bfd/i386bsd.c -ab28a73ed28b2cb083c882f194d8e590 bfd/i386dynix.c -78373f6cb8c37a9bca0681d2a20af1fb bfd/i386freebsd.c -735a4d6ae9285e257a8cdd64b0ead47a bfd/i386linux.c -4209c991c4f25fb8eb32a8f2437f8292 bfd/i386lynx.c -b90ee8151f8b7c972b6dd46d6beede62 bfd/i386mach3.c -0ce260445c167060070abf30a9e53c70 bfd/i386msdos.c -cb70bc2c9f165797e7bdd0999f3abe31 bfd/i386netbsd.c -ab3df517926791ecae7ca2156c959cb3 bfd/i386os9k.c -bcbeff36cc77a574f222cabed9cf99fd bfd/ieee.c -38785bca5642dd3180e2fad821cedd64 bfd/ihex.c -35b7f1acea0a7c53f6785b40d6970b93 bfd/init.c -dbacd89b0524dc23409add426b7472c8 bfd/irix-core.c -00338a689deaa57875ec90cc111c41f0 bfd/libaout.h -d168900c72cfeaf166dafd27860da0c2 bfd/libbfd-in.h -54fd88f9cf5efec9f04566762600d19a bfd/libbfd.c -426446ce4e817753d7424ef4a42e0ea2 bfd/libbfd.h -670240432b1392be37be4e295d43b03b bfd/libcoff-in.h -c00c38f574930e065d00ee76b5b4b6a8 bfd/libcoff.h -dec4128d1fedb44090e144ceff634fd9 bfd/libecoff.h -714e36507b340c549ba044a151edbdb8 bfd/libhppa.h -809c3ca7fcfbcb52a7e89dbb7d3e3201 bfd/libieee.h -71aaf625a223bf8edb9cb1426fa0e575 bfd/libnlm.h -85a8008401af9b2ba92de57c32eee942 bfd/liboasys.h -1ee2ef5ed0cc707ef280e29d5e7d3c3b bfd/libpei.h -c71ee68d6a6055f1b6775ff042e4c300 bfd/linker.c -17e42ae480674d8ab750a635c250225e bfd/lynx-core.c -837d4132caf5e4cb009d65b614bf5ddc bfd/m68k4knetbsd.c -ef9f1794858f2a82cf432f809297307b bfd/m68klinux.c -c7a2b0353c8a2b2796a66ce71991d2e7 bfd/m68klynx.c -c6fc3e1de6dc74acd4945b2190587398 bfd/m68knetbsd.c -32f14321dcbc5b8eda9a2510e3d906af bfd/m88kmach3.c -5de4da6a9169effb512e6ba4d014d420 bfd/makefile.vms -4755d408c8274e1ecccf6218928dcf14 bfd/mipsbsd.c -5971cd61d7c10702978519aa5ed41474 bfd/mpw-config.in -85bd791a2ac9c9d7c2bea1932665d568 bfd/mpw-make.sed -ffdf9f0b0e709d01320c67cbf89eb61a bfd/netbsd-core.c -08197a4e2682c16a478d1d40d26c3ce7 bfd/netbsd.h -7bea89213da645698442c08f787b5ef1 bfd/newsos3.c -5b5a6b2076f5d451f84fbc5e5593df79 bfd/nlm-target.h -3fe07db0117ce532feafa057cd418c00 bfd/nlm.c -6e68f62fb373e47b3b0483f78f68a61d bfd/nlm32-alpha.c -3cc80747d16f524a1fab743e6f4607cd bfd/nlm32-i386.c -67161ce31c23459c26291b06c5571132 bfd/nlm32-ppc.c -62934679d489e139b65d6474d4b85e12 bfd/nlm32-sparc.c -ad09e68167b48df24f238e874a31a152 bfd/nlm32.c -7d6920efa240ddfe625a9d076cd6510e bfd/nlm64.c -a37d20d7c5f95eac0ba8e72ddd34157c bfd/nlmcode.h -651e70e9dc3e8ab81ac750d642be169f bfd/nlmswap.h -8e9c830cacb3843634b4438619c73365 bfd/ns32k.h -9d9d06b881cde8a6f76df36b0478fd03 bfd/ns32knetbsd.c -603c5e4485d4073f712bde82f05c3ab1 bfd/oasys.c -d19472d4764ea44d34f0aa1ae28f8ea1 bfd/opncls.c -286a3a9d629da6889f1bd0222f046dd2 bfd/osf-core.c -359181d31e0067bb155f3130f09014b6 bfd/pc532-mach.c -28eb753042c518eb7613dc0c07a9d712 bfd/pe-arm.c -46dc4c0e41d9ac58d901ba24bf87ec58 bfd/pe-i386.c -eac157e8749a4d566f023fc73ad2701b bfd/pe-mcore.c -10af86983af7f89f498269be562242dc bfd/pe-mips.c -2408372ef3e1635e1f21849c2df91516 bfd/pe-ppc.c -8a9f5341f8b811ff4c9fefafa89a6f58 bfd/pe-sh.c -b1211436c28e181afcc8ff2ecf88cdef bfd/peXXigen.c -9631d64e8b1f1f63001359dd94506a91 bfd/pei-arm.c -351655074548989187fe875754b59a71 bfd/pei-i386.c -dbd6eb2c16f6c94bb0d3af6970467b5c bfd/pei-mcore.c -ea8a74b5980841010a185ebd539e874f bfd/pei-mips.c -f15a63befa27efcdbcd3711ecddd89a2 bfd/pei-ppc.c -46016926e380a707142c8078f62dfb64 bfd/pei-sh.c -c6ba7bb0aee2254c824408f4ebb1bafe bfd/peicode.h -135fcf4f350b6df18bc13667f0877ddd bfd/ppcboot.c -2646e6098d56703b47e5dd24f142f9f9 bfd/ptrace-core.c -bc3a5994f67ded8dd965a8159c3e04f5 bfd/reloc.c -1429ff69337a27fc5e5947c011bacf7a bfd/reloc16.c -d05920c33c8e35c43e6b22ff14b165e3 bfd/riscix.c -0d2c4a7c00dc63b2739abc22c82cfdf1 bfd/rs6000-core.c -98fb2a13f09a7833c9a8cb6d998d55b9 bfd/sco5-core.c -a80fa7325ce9c43ab3c9df9eb86a4e53 bfd/section.c -946a61fb3971a2703997a3e24da9efaf bfd/som.c -f4cab5ccf3d2f6c08f1a0665bd9a9a3a bfd/som.h -bf0c4c812e4319f9fc2891c1ddd22524 bfd/sparclinux.c -795fae048517419029a27b49302244ed bfd/sparclynx.c -ea009eea5d4bd499cfcc6ec25ff8d083 bfd/sparcnetbsd.c -9c5d025db2c856faa1cde13845fe0d6b bfd/srec.c -891289f18ef687556cab8f090331e3fe bfd/stab-syms.c -05ff64098a17cc71f4e623323c2262d3 bfd/stabs.c -1ded054093de910d9786c62bc4fe8cc6 bfd/stamp-h.in -5003da336bebe34495f3eb23f11e8530 bfd/sunos.c -ca78ceb2375111f455986ce25f607e87 bfd/syms.c -bcc86dba28f942df39328408dde24d01 bfd/sysdep.h -d143a64c16594367d7b4034951a1d553 bfd/targets.c -26dac42ee68d1de97152743dd098bd83 bfd/targmatch.sed -7c96f19a6c01b1b4704c8f7915c46a19 bfd/tekhex.c -6aeb10d91a1614ef27dfed54c94ecba8 bfd/trad-core.c -56c006a80866e026335d4db420be7516 bfd/vaxnetbsd.c -70319dc6d45749efd52f9d1393f1688c bfd/versados.c -62552477c5cfcc583cbfdf6da1be2cc6 bfd/vms-gsd.c -03148dc2fdb5f8b2fa0378995908c3ec bfd/vms-hdr.c -9e245904fabf6630c8137c37a2908027 bfd/vms-misc.c -cfe21991d8cccc770d34b0dfefa351fe bfd/vms-tir.c -a953dee93ee3269e5a0d2f0eddc8517a bfd/vms.c -ee46c5eaac647cd1d1685c506202d18e bfd/vms.h -4772c3a29f7fcc7d9c10f1e42fa14cf5 bfd/xcoff-target.h -71e5116d9e043a87784b978c63b82b2d bfd/xcofflink.c -74b9e8377ce5ef7f2ad8914ad5e1dd41 bfd/hosts/alphalinux.h -6626deeac79edaa6eef30082a4fd9dd4 bfd/hosts/alphavms.h -70e1a59995604c3b804469fa27b92d94 bfd/hosts/decstation.h -7f90b6f7c21bcc67525386bdb9399540 bfd/hosts/delta68.h -5a75f0a8518cdf994c6837632317650a bfd/hosts/dpx2.h -6d9ebd0f91f9085690638821e2ce67e0 bfd/hosts/hp300bsd.h -50735617194ee653f1cf99af40a7dbc9 bfd/hosts/i386bsd.h -c3d90b1a06731c814d89371f91583bb9 bfd/hosts/i386linux.h -90fa9751fedd9623f399b8bcd6a646b3 bfd/hosts/i386mach3.h -09a90ebd4e56bce95e72a93c6274997e bfd/hosts/i386sco.h -1d13cbc7201d1b35dfd2353027122d33 bfd/hosts/i860mach3.h -779197139aaf874e61ef9339cdf7df30 bfd/hosts/m68kaux.h -c40f7966cbdb0fac0b4366c9c61eac06 bfd/hosts/m68klinux.h -2563c4d1fef8234619b1c2007dfdaf90 bfd/hosts/m88kmach3.h -8fbd4bfd38ea85aeedac03e1962242dc bfd/hosts/mipsbsd.h -f61dc4a9a9a665ab9fba6861214bdea3 bfd/hosts/mipsmach3.h -d4e865701ae3a5149a05ff92b2542e94 bfd/hosts/news-mips.h -2a46cd81291f56275932a241e022f567 bfd/hosts/news.h -21af1454d516fbfd996f6d6bc3b8db9b bfd/hosts/pc532mach.h -2440e7cdd4e85ead6516650e1329bd0f bfd/hosts/riscos.h -31fe7c1b8aaaf0174c5fe2ef83298ca9 bfd/hosts/symmetry.h -627775bbea4f1d59b97edfa80e81a259 bfd/hosts/tahoe.h -1214020ec5befbef1dda50900deb4740 bfd/hosts/vaxbsd.h -9b476271b3bc5815a37f6b887c092090 bfd/hosts/vaxult.h -9b476271b3bc5815a37f6b887c092090 bfd/hosts/vaxult2.h -9fd8ff8120f96817fe7b034b4ed9b4f5 binutils/po/POTFILES.in -bfb5c178c2404196ab54d7532a61e3d4 binutils/po/Make-in -0c3e2088c29f5140c34d4c1a4cf50efb binutils/po/binutils.pot -327a79cbc083ebf99b8c70353167405b binutils/ChangeLog -2472bb0eaaa74c1313fa692818c05de1 binutils/ChangeLog-9197 -14304b5ca4a2273914dfcad6be18564e binutils/ChangeLog-9899 -13eece6d011b883aa4547d6456769697 binutils/MAINTAINERS -f4074cf64ffef103687013a2e96d6fd0 binutils/Makefile.am -0ceae7f8e4364ac489da69717c9bfea0 binutils/Makefile.in -abacc206a632053405f9da3d19f357c0 binutils/NEWS -d3c110ce10986acf5652bcede3ba5d15 binutils/README -949ae831863e3d2d546a13e90598af7d binutils/acinclude.m4 -c76743519e57c546f30f57013f446bec binutils/aclocal.m4 -c1436a898294a0066903a5104d59658e binutils/addr2line.1 -c1296f6a626273f10323beba4c496201 binutils/addr2line.c -98881d2c88484e6af6d780a96771be58 binutils/ar.1 -a04cdb2cef55746e411d28760663335c binutils/ar.c -ffbb491f2776bf07259287e518ab943e binutils/arlex.c -65306c2e52d8644d8b373eaa39b24062 binutils/arlex.l -ca083bf7f778d5c3abb4dcf85f7fb069 binutils/arparse.c -9f796192da100ab75cc8e8986cf5ec9f binutils/arparse.h -5e234398e134240a685477dd35dfa867 binutils/arparse.y -42e0a4af5d75962dbed3ab8c34b5c3f3 binutils/arsup.c -0bf4eb9b7b9f8964c5d0aea4f501ea70 binutils/arsup.h -f443d4e0d5c81d99f3ca85c213929794 binutils/binutils.info -3d7f73b3f96ca7ba3a1ffb206393592e binutils/binutils.info-1 -519fe824e3b2fbcba9e27c543f16cafb binutils/binutils.info-2 -df7e54f71f2886c89077e97cd576f7ac binutils/binutils.info-3 -4e2cca724195b6b7503bfd507420da3b binutils/binutils.texi -84e127713d45f096f8b6a23cf646e73f binutils/bucomm.c -fb0535da62e6833d2db9abfc40161404 binutils/bucomm.h -6e32645619af004d54c2b09867e2bed8 binutils/budbg.h -0b097861a14f344d75659c82a0329699 binutils/coffdump.c -712cbcb633b810aeca514045f7a091cb binutils/coffgrok.c -727709ba9f525b95a78b7aa3453baffa binutils/coffgrok.h -4e92063f698d7013de0286ef44322816 binutils/config.in -4359fdef33618e0323337df0588c5cc3 binutils/config.texi -ef0db6edcbe0610762e2414a9cfbc8a4 binutils/configure -0df24a539b5dcfb1c9b147d28b80e05d binutils/configure.com -b3a87f9e52b1cc40780b932ba7ea9909 binutils/configure.in -150a0434297702b55b12a72ee3836b4e binutils/cxxfilt.man -bd5c323adf047cfa77d61ab3a1d30948 binutils/debug.c -d067535d0ee0e2dfef7c101ae9ed5afd binutils/debug.h -52960f8f6f672312531d1cdcb4bde2cf binutils/deflex.c -f3bc4c49528dbeb97029c901b2a1cfeb binutils/deflex.l -a5799c90522edb7749356475e2b3c076 binutils/defparse.c -01fa40dc7e4ed75477d60fe6853be93e binutils/defparse.h -4f39891c79936bdfb4f03bb4b5cd1f39 binutils/defparse.y -fb7920a70d8eba8b94fd446da371604e binutils/dep-in.sed -826fb11427b3c2ce4aa0d35d57ebfcdf binutils/dlltool.c -fcd4c7531e0ae0b27cc707d49df82bda binutils/dlltool.h -2d6e186f8e50d1cfd2dbb2c6d77aa25a binutils/dllwrap.c -d7bd6f5d07c781caf5cd1a0b20633900 binutils/filemode.c -321ff0d85aa4e062bb891eba8f971734 binutils/ieee.c -4d04341c680f1136f390abd07d49caef binutils/is-ranlib.c -920b2431a9bafbda1144b22258327b10 binutils/is-strip.c -39ac662d88dea0e279c66fee67cac871 binutils/mac-binutils.r -fb2055ce0e0f73de2e8df95cc40641d9 binutils/makefile.vms-in -f82d9835fa96d421d65a5ea7f5cb5299 binutils/maybe-ranlib.c -aa064dac8c2147d98b05609a47b80ddd binutils/maybe-strip.c -1d9d64c1d1409968c8f722c009b71b32 binutils/mpw-config.in -2ccc0b509ed732287996815f4ec3bb81 binutils/mpw-make.sed -3f9006583fe2a2baee6469944a4d6c06 binutils/nlmconv.1 -d13531ce33278c0b9469db895bb1d7e8 binutils/nlmconv.c -cf949369d105afd57bab40a2101f089b binutils/nlmconv.h -43f2bf49637f73763c155357169d3d6e binutils/nlmheader.c -3426060b7fba0ed0184a410e33bf7fd3 binutils/nlmheader.h -5fd07036b1458259b61aba4be0b68831 binutils/nlmheader.y -216a9371bddca8d4638e129ad21a4337 binutils/nm.1 -59f887c696b56a5fd7c47faa4e031d81 binutils/nm.c -b3c63de023675571764212902c24ee77 binutils/not-ranlib.c -7b521296e81503ee1a37cc77039dc203 binutils/not-strip.c -30b1bb7f3abcfa73a3c6b4b059329712 binutils/objcopy.1 -fb8a2b8519754c33584893536f1c9600 binutils/objcopy.c -542a5564ba0a8082d59cdcdc8151c665 binutils/objdump.1 -8c9fef7b45cd7432093fbf89466a225f binutils/objdump.c -f9e36e9e0cd55ab620e09fdebeca42cb binutils/prdbg.c -020c2cec49a443a1b1865f95077e044e binutils/ranlib.1 -bec38036243f76c13fa87b092c0292e4 binutils/ranlib.sh -352580333a5a5446ee5846eda6ed72e7 binutils/rclex.c -d482dbfc392432a79f29b921679073c2 binutils/rclex.l -218b925653d29f7fa28c0f4a4a7f7423 binutils/rcparse.c -0bb76c3e578d61500674d6fafb307be3 binutils/rcparse.h -df9b51d3071dfd3be7e34e765bbad589 binutils/rcparse.y -ddd9b9d17599b40e8eb39c954503ee6b binutils/rdcoff.c -c13b08d97206def27a7f8612f0b73e89 binutils/rddbg.c -32295c33f18819cfe0d40d7f75213dc2 binutils/readelf.c -301dda393ce6198dab5c0fd289e3d333 binutils/rename.c -d128d999bb8a16ffc6c6a8d10eb05a41 binutils/resbin.c -616cbfbe6d9e4a292c807f7fd9b8f993 binutils/rescoff.c -2560f6c6d92efe9cac783ad2ac24e13a binutils/resrc.c -e266faaa14043a879715b85dbf53d48a binutils/resres.c -b62e62e9c7d29e37c5968c1a005f3eae binutils/sanity.sh -e0d20337f2d99c6f1546cc14750c2af7 binutils/size.1 -c74508b4e2d421b3e011e4334742205c binutils/size.c -f56f7d79f8b8754d1270ad6c8e2215ea binutils/srconv.c -7bdd8bcf3f73100f2ba7a7455c04ee39 binutils/stabs.c -1ded054093de910d9786c62bc4fe8cc6 binutils/stamp-h.in -0548ad6ecd51c170effca26be02c225b binutils/strings.1 -b9c4d10fa3fc66eaf6fb3a525957d563 binutils/strings.c -d2c537d036457e8b2a8ec56ea0a37a60 binutils/strip.1 -35812e6671c0dacf4b209aedd62cb242 binutils/sysdump.c -e5df2443c5572a565ab25e875341c257 binutils/sysinfo.c -c872c0449117476453fa1156a4ddd4fe binutils/sysinfo.h -b5558d092a056006f557bde14786e7f3 binutils/sysinfo.y -360e007536fd5fc8211a294bbaa1a8be binutils/syslex.c -58ee0c7157e6cd1f73af7ae76033054b binutils/syslex.l -2a0d9dfb5514c6c076eae77e837c9418 binutils/sysroff.info -bc126ab62a0177393350b365f3a5e40e binutils/unwind-ia64.c -836ad638b88e86bdb20e53e885f778a2 binutils/unwind-ia64.h -ccedd336cd29294e43a17ba0d6e23c52 binutils/version.c -195751181452e4a1a8f04ec25db22e71 binutils/windres.c -6b39b8d57876e2116d6cc9a25d095196 binutils/windres.h -d5e5a7f1ce5f0bfdac6677f94363937b binutils/winduni.c -656d6daadd2719e5d0c7fe398114e95a binutils/winduni.h -33a17a3bd3de007bd19f721d6499f665 binutils/wrstabs.c -34d0ab842ffa4318e8cbe2bba4c565dd binutils/testsuite/binutils-all/bintest.s -769e0d6ed347b047fb2540949475d543 binutils/testsuite/binutils-all/ar.exp -a1f33ff9c6d058fa281146d85da8a7ad binutils/testsuite/binutils-all/objcopy.exp -d58edef3a25f7729b8fa76f61a2c9648 binutils/testsuite/binutils-all/nm.exp -8e5c9079f46f332db8bbe679b64c878b binutils/testsuite/binutils-all/hppa/addendbug.s -d91ecc8b2ba6965842cf206d8144c3e1 binutils/testsuite/binutils-all/hppa/freg.s -4412faac86e3f31dd926f7cca1b34fda binutils/testsuite/binutils-all/hppa/objdump.exp -8c020e9f1b3dd06718965e6a68bee100 binutils/testsuite/binutils-all/objdump.exp -c6a30881e7a8df05c3769f70c797d338 binutils/testsuite/binutils-all/readelf.exp -fd5d39184621cf8c2e7ff6b2404d299d binutils/testsuite/binutils-all/readelf.h -25d9186ef9252a2db8ef03ad11337e1e binutils/testsuite/binutils-all/readelf.r -93a710740488294f2458be7b750ccadb binutils/testsuite/binutils-all/readelf.s -e597a5420641d9d64c21fee25118b7cc binutils/testsuite/binutils-all/readelf.s-64 -b1d2f987e8bc3b99c2f25d3b1ad0ba7d binutils/testsuite/binutils-all/readelf.ss -22c83167f1761586e80d622551da44d3 binutils/testsuite/binutils-all/readelf.ss-64 -04ab5a3452defc08311819709f841b07 binutils/testsuite/binutils-all/readelf.ss-mips -99e8a65be94223ecc838421b47b19c49 binutils/testsuite/binutils-all/readelf.ss-tmips -ea24bec237106a0e7811279341c8ad4c binutils/testsuite/binutils-all/readelf.wi -472ee848e6a70cc6a512a388ca695d58 binutils/testsuite/binutils-all/size.exp -96869108191b6a2bfb097357132aee71 binutils/testsuite/binutils-all/testprog.c -3be37588c17084be375a802b4d40388e binutils/testsuite/ChangeLog -9fdd25912eef439ee83ad374bfc5a271 binutils/testsuite/config/default.exp -332890f8e08b7aa8c60bb35f6065c211 binutils/testsuite/config/hppa.sed -6c8f3fff368112453697522201a340ce binutils/testsuite/lib/utils-lib.exp -bf1e177862ddef9aa6970474ca011825 config/mpw/ChangeLog -43d2a9ca5ff1a5f5acd3390b7b082830 config/mpw/MoveIfChange -d9387d651ddbc91875c97259d0fc35af config/mpw/README -a31a49fd4c06ba2b08ff299cc2cfac0d config/mpw/forward-include -a9ee17c3900e8edf08a3cf209a87cf2d config/mpw/g-mpw-make.sed -df7cf8189011eae6ec32c27a268ebc06 config/mpw/mpw-touch -082758f13e230f38a846e9017ee6025d config/mpw/mpw-true -39980e1a3d29624ec94a6df2dfb8dcd2 config/mpw/null-command -71b670c5a9868b2833972721f73578e0 config/mpw/open-brace -7588b51a118ab73de5d6a3ba0fc1e47f config/mpw/tr-7to8-src -082758f13e230f38a846e9017ee6025d config/mpw/true -02a96b04d8fd1586bfca132bac4e1a4e config/ChangeLog -70c03dac891f6bc7d806b9427b31bc86 config/acinclude.m4 -141167afa246fce5e59bb9e55cfb2fc8 config/mh-a68bsd -2b5476085f7589e173bd81316a7549c2 config/mh-aix386 -57925a69ccb24ae7ca7cf949a07d26d3 config/mh-apollo68 -9b65dc7f50a7134932aa278ac0378703 config/mh-armpic -8d82479feea57715325ee949952ae5e5 config/mh-cxux -ddde55c2eac58773f99aabb2f011e206 config/mh-cygwin -251cf9b667a963075140fcfa616f06da config/mh-decstation -a3dc79b2e3494813c3a0b352d2185c17 config/mh-delta88 -ab6f38194c18de21e5ac0761d0d6352d config/mh-dgux -615158832b3fca3cea2f51053e67590e config/mh-dgux386 -2738c9de2581bc9c2d21f48950b18bec config/mh-djgpp -9b65dc7f50a7134932aa278ac0378703 config/mh-elfalphapic -153649fe7fb621b814baad06a2bf299f config/mh-hp300 -3330f1730b6b4bb70b09ffe2415c74be config/mh-hpux -3330f1730b6b4bb70b09ffe2415c74be config/mh-hpux8 -9b65dc7f50a7134932aa278ac0378703 config/mh-i370pic -740855ebe34cb2d01fba1f1bcb4264cf config/mh-ia64pic -7add3042f79e57cdcb52abf304c26a70 config/mh-interix -25c3bd9e7778c2c5d799fb6f1615be3f config/mh-irix4 -ffaaae454726b7ec67de856093365ec1 config/mh-irix5 -bc99b6de866022c39cde3cc7eda83fe3 config/mh-irix6 -1acb83eaa6a78c587598bd7efc2025d9 config/mh-lynxos -6bace932d30f092a27fba43e01226c04 config/mh-lynxrs6k -740855ebe34cb2d01fba1f1bcb4264cf config/mh-m68kpic -7bb6a9aa44a68e1e71f76cf8b8c2d135 config/mh-mingw32 -44882b0820862d0e134a8e4e5537afce config/mh-ncr3000 -42f074ecc1191e9ebda8e447c4f46713 config/mh-ncrsvr43 -90b19906d7ba40a6e4b83efb959809c7 config/mh-necv4 -21c5c77600fd6fb58f378ef2acf0190c config/mh-openedition -9b65dc7f50a7134932aa278ac0378703 config/mh-papic -9b65dc7f50a7134932aa278ac0378703 config/mh-ppcpic -e263a8fdee36cbc610757f2317da3991 config/mh-riscos -ac3fc3e8d21f9f9fe83c4cbde3890387 config/mh-sco -c502a579b42cb78af2154966343f491f config/mh-solaris -fa84a282ce7cd6876d1eac368a31a368 config/mh-sparcpic -2e3ce1267c492dd862c48b59eab932ac config/mh-sun3 -278ff58db0fc6c75e1cd39ca2ad1acfe config/mh-sysv -a0992273a62d3448fe6ea65a74250899 config/mh-sysv4 -08516ddc97d1ada83d4bd631bd1964be config/mh-sysv5 -e75a559cf75354c524229f480b5f6e7a config/mh-vaxult2 -740855ebe34cb2d01fba1f1bcb4264cf config/mh-x86pic -f80e59daab2815b9faf70f2fe2f0ec2c config/mpw-mh-mpw -f60c118789c383f2548e2f8969513865 config/mt-aix43 -6eee2b9b80994128082ebcfb8285239d config/mt-armpic -96289d06809692c31d71e69c4bedb6d7 config/mt-d30v -6eee2b9b80994128082ebcfb8285239d config/mt-elfalphapic -6eee2b9b80994128082ebcfb8285239d config/mt-i370pic -4d21c96a048f825b25f5ecb7259866ef config/mt-ia64pic -9c9256a473bc2e1204e258e48246cabf config/mt-linux -4d21c96a048f825b25f5ecb7259866ef config/mt-m68kpic -2067ce86494ccb89791fe169eee8c198 config/mt-netware -5aa8f75c6588d513ce199e2e44c206e2 config/mt-ospace -6eee2b9b80994128082ebcfb8285239d config/mt-papic -6eee2b9b80994128082ebcfb8285239d config/mt-ppcpic -05fc6527f7fe0692e7bd51c24868c2a3 config/mt-sparcpic -4c029f499ccf3ba2561603b2a113178e config/mt-v810 -12b3030d3d59526c374c15af4f5944dd config/mt-wince -4d21c96a048f825b25f5ecb7259866ef config/mt-x86pic -8f1f7dafc590b26d22f3e597284f25b9 config-ml.in -e0d75b8ca062b8ec4eebf664aab1644a config.guess -306d551fd358a6363d2446486f1b8821 config.if -3a43bdabca8b9eca92530bb3ea2eeb24 config.sub -2523c7ca068da11d38e06af6347abce9 configure -0473df9cb9367e9c8a77c289a6f5f764 configure.in -e28364a0df955105a7f6898cc8ca366e etc/Makefile.in -213e80930c0be010bb250612af54775f etc/configure -e9b828169fe54bf6414ec1f4376af077 etc/configure.in -27fb25be358ff0eec0a44ac86f3872ee etc/standards.texi -fc8ef2abb184ab45779484c10d4d8d8f etc/make-stds.texi -a76594be1e11898d26d9bdf1f54af07b etc/standards.info -5ee7bcaad637e7010a2581db7927a16a etc/configure.texi -193f671ff984e81653741fa7c212a232 etc/configure.info -1a911cd9b8902678f64b5e33d457a8bd etc/configure.info-1 -ca127e48a13744e2fff22df3b893264e etc/configure.info-2 -1686cccb56366de0a01e848bfbfd9f22 etc/configure.info-3 -a20b40a0a5d3282f6a97c627be1e38c6 etc/configbuild.ein -570746cd93c4dae506cf2a6153a2a1b3 etc/configbuild.fig -f97ac2d5e05edeb335b73f8b6beef581 etc/configbuild.jin -b2851bb6d77822adc89ffc6d323b5fea etc/configbuild.tin -e67b330b1ad623f1bd3850483cd4666f etc/configdev.ein -c1f7c41d3e596256ab5f5f933a66293f etc/configdev.fig -8e14386548b8da4c5072aa2abea55886 etc/configdev.jin -32fc10cbdbf679bd0ffc8857cf069b43 etc/configdev.tin -e75bd9994061d19f9670d08acbd01eb1 gas/config/aout_gnu.h -a802dbfeda3550bfd22804228399f0c2 gas/config/atof-ieee.c -4027fb83cf42e6199aea0cb2526a06fc gas/config/atof-tahoe.c -14a0f251c1273cce5c62b3a5edfc3dab gas/config/atof-vax.c -09c324e401be218c9f9b18833e2bfd9b gas/config/e-crisaout.c -88c6165199c1aae7bd9c2733ad9a1847 gas/config/e-criself.c -8915ab931627c03103b8ff52bd2060eb gas/config/e-i386aout.c -4592324396b51379efcdefa7b75a17da gas/config/e-i386coff.c -90f70110e875b74bf055abc7f609c4be gas/config/e-i386elf.c -a153ff4dc91266991257426d1a9d7309 gas/config/e-mipsecoff.c -be51facd59d0de4cc60d8b0a64360795 gas/config/e-mipself.c -4f384db2ef30841ca0502269a3e8f438 gas/config/itbl-mips.h -5abd9bcd8f0e5ce25309035cbf3bc0fe gas/config/m68k-parse.h -869147d7bca490ff7f20fbe121715a99 gas/config/m68k-parse.y -0517b56ef366ac53f4921e66d1a85b2b gas/config/m88k-opcode.h -8d517bccecde0b721a58b01a14731bb6 gas/config/obj-aout.c -06b407be57cbacc7ba05787f8072be7d gas/config/obj-aout.h -84532c4badb5b5a414ea7366c240b1f7 gas/config/obj-bout.c -fdc8729ecc7985ac4dc9531bf8ef8e77 gas/config/obj-bout.h -a15d8ba751d3b7dbfb8b378a57fc7fb3 gas/config/obj-coff.c -c8c39016cef6730efd244c450075c988 gas/config/obj-coff.h -6e39bf9284bfa403132fbc486c0058b5 gas/config/obj-ecoff.c -39d1ce7b5d484ca95d660c2a1e4eebd0 gas/config/obj-ecoff.h -5ad09dc220a6763becd6e5916e939354 gas/config/obj-elf.c -34d18bd7dc155d66c4196ab7d06f7240 gas/config/obj-elf.h -fc5244809078292ed69543b590057d60 gas/config/obj-evax.c -409f2700494fb5da88cd17bd13787e30 gas/config/obj-evax.h -1a5fb62914ddd24d361b7b129a038361 gas/config/obj-generic.c -5697e716124f3115e85dea04de9597fc gas/config/obj-generic.h -9e0918da00ab277c95f9a2b9e4f5f29d gas/config/obj-hp300.c -7b4f9af8c88a8fddf18a0b0a2d81b0db gas/config/obj-hp300.h -6bee9b63dc974cdcfd38fc323627c123 gas/config/obj-ieee.c -c3c18ef4a1af26d29718ad6ce33cb4dd gas/config/obj-ieee.h -32d6ee58a1474027c5403a0fae7a9ba4 gas/config/obj-multi.c -9f5bf398a837e7a19947e088a9443b9f gas/config/obj-multi.h -16a236759175a5714c77962a358d3c5c gas/config/obj-som.c -80b8ff6d8f8c6f69b33d1a0275753fe1 gas/config/obj-som.h -8ea02b18794c00460bc81a2b8119739a gas/config/obj-vms.c -92be5fb47ee648292dfb0bc7ff27326b gas/config/obj-vms.h -c1894be92519dd48b0314109f1881012 gas/config/tc-a29k.c -c5139d88aed8bf2b090309497013dd6f gas/config/tc-a29k.h -211e99ec1bb1759368747760c893df82 gas/config/tc-alpha.c -33d0731b8586c060675186d139597c41 gas/config/tc-alpha.h -a8fc2b9440f26a722f34715f08991ba7 gas/config/tc-arc.c -081e35843ad7dcfeb68b50aedcab491e gas/config/tc-arc.h -e15ea2817e89bc3ad3355c2c7207cd87 gas/config/tc-arm.c -c920e78d25bbdd5900958e04709fd4b8 gas/config/tc-arm.h -463b2242e8e491564d5e0e1506bb06de gas/config/tc-avr.c -37d6caa633b2f7901f443b5307e8a905 gas/config/tc-avr.h -00c243430f9f2f60ab15245d6bd15e7e gas/config/tc-cris.c -c201f4750843a1fd322b38f8ed4e6bda gas/config/tc-cris.h -2f9c666879c01e30c44aaf445b1033b5 gas/config/tc-d10v.c -8faf078fa60927d88ed23dbd23ef1a38 gas/config/tc-d10v.h -c08f0392e2dbbddc8f04f0779343f336 gas/config/tc-d30v.c -8b7945ccc65e5da78d3a9fe09c2308e6 gas/config/tc-d30v.h -0ed0301072d2438031d4e222b3d06d57 gas/config/tc-fr30.c -ee4d3a84b465216e750f06b0fcdba621 gas/config/tc-fr30.h -d41d8cd98f00b204e9800998ecf8427e gas/config/tc-generic.c -eec169238b80630136c19235264cb04f gas/config/tc-generic.h -ad92b1751356945284c3450fe0ed00c4 gas/config/tc-h8300.c -801eb9030ae51576454343bceed3f8a4 gas/config/tc-h8300.h -312f280c2f4d500378edd99087c7ff98 gas/config/tc-h8500.c -664c496490b0f88854b345cb940eca9d gas/config/tc-h8500.h -f763378e31a8c10cbb8437e2513b53b5 gas/config/tc-hppa.c -4393890693232f88d07a9e1d76544d0e gas/config/tc-hppa.h -73d71eb5625c8cab823b05718dad8379 gas/config/tc-i370.c -50392712885658244102256d4333dbbb gas/config/tc-i370.h -1287427633324e0b6ef2563288452b55 gas/config/tc-i386.c -0d8b9453c5c2b85fbf52d5d18075bd5e gas/config/tc-i386.h -f8adb51ebafdb40f294def677366a81f gas/config/tc-i860.c -0b60639885f14b9d4262b1b5695e4ddf gas/config/tc-i860.h -cc609a2100c2e89d7c34c9e3a40cc3c1 gas/config/tc-i960.c -f46200f85ff3c2db7a0a88c7834014ce gas/config/tc-i960.h -1ef7e0b07d22b5947cce3237e4c99ead gas/config/tc-ia64.c -55a5ee0b822753196340782ebdb63fb7 gas/config/tc-ia64.h -2c414ce59771fab4925ecdf8d8c0fe68 gas/config/tc-m32r.c -1b6e3bee9d679bdad05dd205bee78995 gas/config/tc-m32r.h -a12bd005331953eec47146cd4b2fcbb3 gas/config/tc-m68851.h -eb109194d0009839d36ba51165ed6082 gas/config/tc-m68hc11.c -a298ed6402724d90e5b8edee560a6a7e gas/config/tc-m68hc11.h -023972affb12beccb32294a9a1908d65 gas/config/tc-m68k.c -20302dc874a9489ce7bb7a38876de1b3 gas/config/tc-m68k.h -6d621a3e526cc0a6d2b657dea4a2305d gas/config/tc-m88k.c -107c3b50693b48561ea3e1f21427f814 gas/config/tc-m88k.h -ef5e629ce116e621dcfdc2f24c9f2511 gas/config/tc-mcore.c -79faecc51abb67e48eac14101fa5f41b gas/config/tc-mcore.h -720b0edaa61cef121c857642cf070877 gas/config/tc-mips.c -f1f594c95b827a8e431f1a7fad5fdca5 gas/config/tc-mips.h -851173367f8b9e7ba049651482357a34 gas/config/tc-mn10200.c -a1d9a4975a26d18367a870bcfd757ad0 gas/config/tc-mn10200.h -15ecdb549363635ad76b2c3a86e700de gas/config/tc-mn10300.c -7f67c8f56a13301960fd818cbbfabcc4 gas/config/tc-mn10300.h -b00eae3c8b6829291b629c31015075e2 gas/config/tc-ns32k.c -2de740c8af5873b4d86571cb87a4278f gas/config/tc-ns32k.h -47f42d9d2b0868e4b8f317101b0c1684 gas/config/tc-pj.c -8dc88fa36c8ae8d4d6dc0dd424b15154 gas/config/tc-pj.h -e53e90d9045ed48820f1b5b07c98bea2 gas/config/tc-ppc.c -801e811b0a3d378913351cdb8556d0c6 gas/config/tc-ppc.h -b9bde6879b21d1fc21732d1c17b243ea gas/config/tc-sh.c -23301ea5ae6486c30131563f56983c4e gas/config/tc-sh.h -2f6a18c71d581798af6ef0148f863c4d gas/config/tc-sparc.c -845af70a42df937b9ebf4c1d19002d75 gas/config/tc-sparc.h -745fe32b81053e3b80ecb325654425ab gas/config/tc-tahoe.c -ffcd4331c7d6d28e97466a66f3620f2b gas/config/tc-tahoe.h -bc08cecd35802bed257d11dc5ee3aa02 gas/config/tc-tic30.c -172636d7d3732eb57c67ead9709d4d96 gas/config/tc-tic30.h -9d9818beb4f8c04429d8442d1624be53 gas/config/tc-tic54x.c -8797523948d01e18fdd637d6dbe36d4d gas/config/tc-tic54x.h -82c9a73a973825d66c344d6e271f4174 gas/config/tc-tic80.c -a8de106e568896428baa8b248f1f7d8f gas/config/tc-tic80.h -dd5e427d8cac9e551d263fddc7144024 gas/config/tc-v850.c -5ce308c35dd719428af4510cb7adde41 gas/config/tc-v850.h -f9107adcd738a440490415bd12bd5db8 gas/config/tc-vax.c -a782b0af9745557989f35bb76a300bc8 gas/config/tc-vax.h -6db1110e7f9a9f839c5bd245aa8b3b34 gas/config/tc-w65.c -7ce6ac4d03348c1102b1d6e4308bf1e2 gas/config/tc-w65.h -3e5bb9333fd37bcbbfc45d3b918e79de gas/config/tc-z8k.c -b985cc503b319a201bc0ddf5a2e9cb23 gas/config/tc-z8k.h -40b4f0d89e0f7a47828f7e6b2eb98cf8 gas/config/te-386bsd.h -0d6f3b4695c8a69980eef0635a4b376b gas/config/te-aux.h -904c7780c93025e1c16bd7facc5eb6d5 gas/config/te-delt88.h -c30935955b6e3e593aec0c121bf741fb gas/config/te-delta.h -47cd21925072d94dd095186c5202b92d gas/config/te-dpx2.h -fbce03dceb71bf68d8c872bbb69b35aa gas/config/te-dynix.h -7e2acd95eb4766b4530cd90d5da12e11 gas/config/te-epoc-pe.h -4215a65e5e9aaf52a39c0277cec05a06 gas/config/te-freebsd.h -9677889ebc4d2d31b7cf1d99bf884883 gas/config/te-generic.h -9c4b72d5db2a3b58fe216e98e5d1604e gas/config/te-go32.h -fdfff2ba26de59e5e34124666bbe255a gas/config/te-hp300.h -e2bdcb851ea04db026cbd75585ce50c7 gas/config/te-hppa.h -ffe54b5f97c4c93a036fcb434b0e2ce3 gas/config/te-hppa64.h -8a89d0db3087edfef6adb3d11e461332 gas/config/te-hppalinux64.h -37ed6767b7669c59a6f01cf229bb2763 gas/config/te-hpux.h -c5c5a24aae2ba252078a1e9aba6f29dc gas/config/te-i386aix.h -48983355f44a1998351bc155fe48f093 gas/config/te-ic960.h -19b403b208d810d952e172e14e5ccc4d gas/config/te-interix.h -4cfb2f20ec1301d37e9ff374e46317ce gas/config/te-linux.h -0525817b2f140459473072028c30da2b gas/config/te-lnews.h -2d77aec1c4985fc5f3a8eee88e95dec7 gas/config/te-lynx.h -36d49af0e764532aaae5a64d2c046790 gas/config/te-mach.h -9f70e9ab23ffcbdddf605e1f7b9479c4 gas/config/te-macos.h -7adae751b97b48a10ca1f8483e539d6b gas/config/te-nbsd.h -42e509551b9c1e76f3a8f4621d2eee03 gas/config/te-nbsd532.h -c34e9c2b58482673113e11fd998598c1 gas/config/te-pc532mach.h -158cb175a491e482d6e0d3412b0bb216 gas/config/te-pe.h -a9cbae48ef62e7a20c33d8a94c576b4b gas/config/te-ppcnw.h -a8a052866cd9c40ef31c0f4eaf7d653f gas/config/te-psos.h -0ff6629cbf363fc1b3d16c4ee4877f1c gas/config/te-riscix.h -4e442b2838e599466e9cc0fa346021fc gas/config/te-sparcaout.h -68cff7532af5d9dc4f8678dbd215506f gas/config/te-sun3.h -589c88a6aa89ffe655b1f8924e13bbd6 gas/config/te-svr4.h -667553559949ecb7bc468a6fda1003f4 gas/config/te-sysv32.h -5e785cb6f9a16599434f78b525b2a943 gas/config/te-tmips.h -5dc896f3c45078f34974fe05fb94ee3e gas/config/te-wince-pe.h -6599faa23572d356256aa616b013c64d gas/config/vax-inst.h -fd1ee35049f9bb5ca0b5b40b8109e49f gas/config/vms-a-conf.h -ed8248ba3c34b041f1d8942b285d6196 gas/config/vms-conf.h -cf987871e5d5e86f6aa12afbc89fc785 gas/CONTRIBUTORS -ceab81aa1f02825092808fdafba0239d gas/COPYING -49b0c513e9e8f5c5f2d0f7a71435c914 gas/ChangeLog -416a26a1162590c860fb1fefffc54cca gas/ChangeLog-9295 -6d8b241f06f94a04f180294552ee41a2 gas/ChangeLog-9697 -f577af562fb6cac4e22d6b5ae67235ac gas/ChangeLog-9899 -d618facc3e8ce8bf3d02ba452e1be6ab gas/MAINTAINERS -c7d8894c1b4cae0cb9632c80b08092d7 gas/Makefile.am -4f2f7020e0b422aca1cc93158938388e gas/Makefile.in -d9a8e0c26cac87a5c4618803fe69ecde gas/NEWS -0ed4366c2ef5bde49890368940dc9fa3 gas/README -e8b1e941cbf0b441da52f38fd2ea9725 gas/README-vms -c66ab308e6d86fac0000d1a9322838b1 gas/acinclude.m4 -43e54453976ff55cd63629d58e04fc0e gas/aclocal.m4 -0713cc4c7ba088fb707c5ccf5420b551 gas/app.c -44c182a81fe50344e603258add9cc6f4 gas/as.c -ce2e7980d3ce0ebb9027297f3059e8b2 gas/as.h -70eee11ef3b99a2aef25cc4e5355cf38 gas/asintl.h -a13029645c6a330d47f64661c7d7e472 gas/atof-generic.c -75bf496ec970dc9712e80b4a5a4af824 gas/bignum-copy.c -c096b326d8cba2abd6ece3ebb29df4c1 gas/bignum.h -00240c3f69e4d6cafdf8b729e6e84d6d gas/bit_fix.h -8fa009ac31ba211585c4f4ad3f80bed7 gas/cgen.c -f2b1a3d53180488da57702ce8d6257d4 gas/cgen.h -65dd281f88f92212b81bb354359b3336 gas/cond.c -e46511c2ddcf00256c007081122f6678 gas/config-gas.com -039f9a3e0b0fa261d5b5c272be4422de gas/config.in -d9692a1b832b0d71391ac34ad78b1b49 gas/configure -aae9c95aaea1df86eb2621b27ed3a99a gas/configure.in -454732b991bc3adfbaed197eb7e87709 gas/debug.c -402433baaaa08f73e6ec935228d2e751 gas/dep-in.sed -e3fd8ef3d3d26dcd037e9bc72b5f1c91 gas/depend.c -4b78ba859f531df84c9d04ba0eadc95f gas/dwarf2dbg.c -191371b169a1a50bf4cfb6e95875f083 gas/dwarf2dbg.h -05e52c03f16bce065122a178cb04f2bf gas/ecoff.c -2ade498ef51a01b944ba9620a2f803f3 gas/ecoff.h -2c00a55daccea8fa31dd514eb9ae7b95 gas/ehopt.c -57b3fe37aafdffc79479ab3da84f901e gas/emul-target.h -305fc57eaa656bac0b150bcc1ca2538d gas/emul.h -c08f06fdeb6fc93631a01d7b53dd846f gas/expr.c -03b127e2410c495a62d3f43bc0351b5c gas/expr.h -35c5208ec46fa524456e2a41c18c67d8 gas/flonum-copy.c -88bdca4528df9b542227513c3617a0b2 gas/flonum-konst.c -2aaf2ac6e8260efb36ebf67b54ac6a78 gas/flonum-mult.c -9b9175f8704d4952a56acef82dd58f85 gas/flonum.h -6727bca8a71f454d76057aaad0b98707 gas/frags.c -8584b7ba7291c886b9db82ad72401cf1 gas/frags.h -49fc4a865d0a8dd8d46951b592d50ebe gas/gasp.c -f728bf7e9df39918cf8c7467d5fa7478 gas/gdbinit.in -00715f54f0585d4c32ab362142dac7a3 gas/hash.c -ef6eb8d70fe48af05178e9af3ed9448b gas/hash.h -e94dab0cc4b68a0ef5ce9dfdfcb09984 gas/input-file.c -0df025a05b963cc8d9a890a686c92334 gas/input-file.h -acbcd05187266da779112cd208f312f8 gas/input-scrub.c -af2dde296a48962feabc18ea603b9480 gas/itbl-lex.c -637856676a2c5e17d45ca48ee4d1edfa gas/itbl-lex.l -fbc898da80a636f469f7765a1c6d50d6 gas/itbl-ops.c -5ae99999af9ac5c1850c36b5f4921be9 gas/itbl-ops.h -8568d6f215619a4ce44c36e32a3e65ff gas/itbl-parse.c -04faf433a35cef1d6b5e9f445aaf6acc gas/itbl-parse.h -b2285f69b5092425e6fa8b4195130f66 gas/itbl-parse.y -c7fe4764b8aa7ac76eeed0a1de98a8d9 gas/link.cmd -687e8b5eb64646e802334fd785512a73 gas/listing.c -fb844327efbb1aeae5f388f656026f39 gas/listing.h -adc284330e8a889f23d9153dc9eba7ad gas/literal.c -962769307588bcf7e9b053afaf508395 gas/m68k-parse.c -afe7080b22bc9b5e058f473469ced030 gas/mac-as.r -b4edaba52caffcedfa007bea5a46ef73 gas/macro.c -9f90a230cb447aa332f3dbf23af429da gas/macro.h -b905aee5c2a099f7d2579459121c7e2b gas/make-gas.com -c3cd93b34bceee0379472974735c6f6b gas/makefile.vms -5ab92a359045f71aec9afc090f1e9ec8 gas/messages.c -829e2d776ea96775c8298d5efddc22e7 gas/mpw-config.in -3c7892f4cb73a22801aa4656e36bb469 gas/mpw-make.sed -d5ef56b704245ff8f113091d867f6c6f gas/obj.h -e09da02faa41e17d061587cf2e6df050 gas/output-file.c -afffb943b1ad26344f206ee6bc357279 gas/output-file.h -486dad21992ef1bbad46ca481351cfdb gas/read.c -aea4edd3f3a9223bdd7b719e6aa46390 gas/read.h -e7258e74de805cdf31e919271531c1b7 gas/sb.c -cff195f2e145a3038579a1501e9fdbf5 gas/sb.h -5364361aa996d6ecf5f78a55b3110b8b gas/stabs.c -1ded054093de910d9786c62bc4fe8cc6 gas/stamp-h.in -dd55eb01ef944ba463cb2ce5f34a7647 gas/struc-symbol.h -f0b4d340f2ea14f0b248792e6c103174 gas/subsegs.c -260af34792338267f3927dc44a3a8197 gas/subsegs.h -752685a6111312f1187d42e7aa0b930b gas/symbols.c -e78b627a67a43e407e6cc9d3966e6474 gas/symbols.h -1da751d730b752f86eca5aaa24c563b2 gas/tc.h -df57d3e0b2752e5caab5294b3acee98c gas/vmsconf.sh -88a4db7edc70e897c4a8923cbf78bf68 gas/write.c -78b058a7d893939c2ab422c2e85789d2 gas/write.h -bb547fe62002b67ae96d3c52f72f9de2 gas/doc/Makefile.am -2423cc0876c2510df60a5275b0bdd5b0 gas/doc/Makefile.in -be60028bc97199721b146eb35125cc2d gas/doc/all.texi -41db9086dadd0f035d15cb3d92bd1203 gas/doc/as.1 -362e4e8e3c9ac37b1cc1148df43222f4 gas/doc/as.info -85161d87cc0e0d4297787c63456db47f gas/doc/as.info-1 -b81884593f4f05d264946d7a4891701e gas/doc/as.info-2 -b2d9e66a77e2e2986070575c066816c5 gas/doc/as.info-3 -26ae00e2c16b261a3a90dcb8cc4d4da7 gas/doc/as.info-4 -a696a5ced8c5d881f5ea63097dfc0597 gas/doc/as.info-5 -e09cf158c7e7cb65bdee3eebcff58ff9 gas/doc/as.info-6 -41fe1393b25845f0a16585f076c52f3c gas/doc/as.info-7 -94705e2e9f12c6ec33493e5dc00d4343 gas/doc/as.info-8 -94123531607079712cdc98925b407eb0 gas/doc/as.info-9 -2fbd5270dcebd346a0991e021a6f8915 gas/doc/as.texinfo -a59215bdf94de57a0285409852af014d gas/doc/c-a29k.texi -e01a5d41dd1d11b839b779cf991abe7b gas/doc/c-arc.texi -6c7a0c6eb13ad819b865fdca9b883da8 gas/doc/c-arm.texi -5dfb627124dfb35ac44d11fdd435d36c gas/doc/c-d10v.texi -670a3dc2d7f147e973d1540d3e02059e gas/doc/c-d30v.texi -6e93279725365b5846b332617955f22b gas/doc/c-h8300.texi -1e370e38bad3cf84368e988413793571 gas/doc/c-h8500.texi -4dc0aab471ec88e9f732b465812e10ab gas/doc/c-hppa.texi -517ef856eea39abb37275974217b7297 gas/doc/c-i370.texi -5e674e1c182709037cb3536a60efb929 gas/doc/c-i386.texi -e8d13a43c909238a5916ce17e31d3ea5 gas/doc/c-i860.texi -42b8ac98b598dd6f2ece88fabb284af0 gas/doc/c-i960.texi -147c08afa3ccc82a2d9485e5f1a59317 gas/doc/c-m32r.texi -fb7536ff2e6681fa34501b7c320df664 gas/doc/c-m68hc11.texi -e0de947758a2e436eb5d00cb411666b7 gas/doc/c-m68k.texi -5be2114dfab16f3522fc347cd44da217 gas/doc/c-mips.texi -677a7e5662a701c8a5f9d82943f36257 gas/doc/c-ns32k.texi -b12cf56f6b45fa508ec963382efcc726 gas/doc/c-pj.texi -a3350f042ea6b18add50514707eb5d13 gas/doc/c-sh.texi -c87b3dff39869ac245c49a82edafb776 gas/doc/c-sparc.texi -29f6dccc43df1302dedd26fca1c362b1 gas/doc/c-tic54x.texi -f5679aeb7a13f072790a4cd15c511019 gas/doc/c-v850.texi -6d7f87c13f69ca2595e95c9eab762d92 gas/doc/c-vax.texi -5810de21486a935844319423d7a6e9cf gas/doc/c-z8k.texi -79b45497aca1b0c05295f8f2faee4b6f gas/doc/gasp.info -8ba1c8507b412944e6c7bdc67da6d964 gas/doc/gasp.texi -4359fdef33618e0323337df0588c5cc3 gas/doc/gasver.texi -73b674cd9bd9d15802cc28334b6a25e1 gas/doc/h8.texi -cf12d9be0d41e433cda51d024905eb5c gas/doc/internals.texi -25c9af2d17e31c41a405f4da0a58984e gas/po/POTFILES.in -bfb5c178c2404196ab54d7532a61e3d4 gas/po/Make-in -8d085be47b4986e1d1f7b90d59722bb2 gas/po/gas.pot -189b37e66fa0d5345240ac619d9c94c3 gas/testsuite/config/default.exp -febbd8dc88b45e9686846ca773346af2 gas/testsuite/ChangeLog -6fdc3af8b63d5c8dd0a98137215d3753 gas/testsuite/gas/all/cofftag.d -acc0977114e4b9e65b9d2aa95c35ff8f gas/testsuite/gas/all/align.d -a60277af402def6d8b222eb7aa29fd72 gas/testsuite/gas/all/align.s -a43c5656afe02c36a6e1ef61a6027724 gas/testsuite/gas/all/cofftag.s -7642a824a63aa87c0f0c07ebab2ea9ba gas/testsuite/gas/all/comment.s -b693149b9cb9c53162d7d2eddc0ee4e8 gas/testsuite/gas/all/cond.d -a0744db73ab7d631e72a1107ffb1c1d8 gas/testsuite/gas/all/cond.s -7ec8ad8becdaf04c09bde661a8ae427e gas/testsuite/gas/all/diff1.s -a3ed4c57221d0e6ae68721825604f04d gas/testsuite/gas/all/float.s -d5cade1146f240feeeb31fa7cee691f3 gas/testsuite/gas/all/gas.exp -ff0067e6fc03e40d69f6d4a3df69c315 gas/testsuite/gas/all/itbl -ae3b5706bcb2b5451fa0da52c419c576 gas/testsuite/gas/all/itbl-test.c -0a1bc24fd58a8e10476fda0bd5b649ed gas/testsuite/gas/all/itbl.s -b61a6aca515ae31b7be7abda0a152bbc gas/testsuite/gas/all/p1480.s -c9637636fc150630e2d44c82892f2551 gas/testsuite/gas/all/p2425.s -856ac38b9fe37e63d8173f9299961115 gas/testsuite/gas/all/struct.d -0b2dc0f909d4928a8de943eade54a345 gas/testsuite/gas/all/struct.s -8ba076a868d6d446a4ab1462add54fd3 gas/testsuite/gas/all/x930509.s -1a8de6cbd6b3c02a2a483c8cd6ce42a7 gas/testsuite/gas/arc/branch.d -19197f29a6d87e3e78495e7a47ebf496 gas/testsuite/gas/arc/adc.d -1b06ceb2288c093be970d894568fa5da gas/testsuite/gas/arc/adc.s -65084e57125295318062997e920c19af gas/testsuite/gas/arc/add.d -75e6baa15e0d53599edfd7ec770375b6 gas/testsuite/gas/arc/add.s -4927747f607ee7be7bf50e7fd6ef02ee gas/testsuite/gas/arc/alias.d -54f01e033f0d248759b8fc6fb71a06db gas/testsuite/gas/arc/alias.s -b8a7885db402fc70652f0410a5820d50 gas/testsuite/gas/arc/and.d -b8fce093a488f7b1c2e6418f7c31c9e3 gas/testsuite/gas/arc/and.s -4bafbcb8f67131a387ad56e5b1bcfac1 gas/testsuite/gas/arc/arc.exp -aa32ccad03a6d294726c0e58e6d2250a gas/testsuite/gas/arc/asl.d -af955c8cf38c553fa4221383c64b6b13 gas/testsuite/gas/arc/asl.s -56384c65539866b6e7fc0a0a05eabce8 gas/testsuite/gas/arc/asr.d -9887c6e68d8176e71d75b9d91604e914 gas/testsuite/gas/arc/asr.s -5288b51666fdc9bb0c65a07671c3c9fd gas/testsuite/gas/arc/b.d -78b81ebb3355a47d5c478e1e56444ffb gas/testsuite/gas/arc/b.s -402522bfb20c4387e1faba27224186ac gas/testsuite/gas/arc/bic.d -ab22388e1552b8926d7b8960f9a6fe20 gas/testsuite/gas/arc/bic.s -ec7abac24fa3c402b31f624a3ff9de77 gas/testsuite/gas/arc/bl.d -e2c237cc25d1cfc82c9285818858e329 gas/testsuite/gas/arc/bl.s -8432db29eb95c38348bb4216a28f43a4 gas/testsuite/gas/arc/branch.s -1165c7d246f9e1a548af4c5b7f4e5f60 gas/testsuite/gas/arc/brk.d -872c85cca67988958ef95591b4fecb7d gas/testsuite/gas/arc/brk.s -acf1eca3b061941ff367bba7654f8a2e gas/testsuite/gas/arc/extb.d -0ab2d9abcadcf93d9b6dd8eb0962d7ab gas/testsuite/gas/arc/extb.s -cb8963efc4b0412d0cf5f6d2d4412d14 gas/testsuite/gas/arc/extw.d -e66a84df62389472e90d215276e87384 gas/testsuite/gas/arc/extw.s -53684f8cb4cc475d5632ffa22555b6c5 gas/testsuite/gas/arc/flag.d -2b6e2dd0335ebc45bb694de8cc2f4c6b gas/testsuite/gas/arc/flag.s -dd35c9020fa1c43318beec05e9d63dd6 gas/testsuite/gas/arc/insn3.d -c9f07db5b59a1a725b1cb520c7dfffe2 gas/testsuite/gas/arc/insn3.s -6623a00a22962dfb1afcb24a2f8920bb gas/testsuite/gas/arc/j.d -7ee6358f55317d08d08f864238c78515 gas/testsuite/gas/arc/j.s -431696fbe85080394483a455208af19c gas/testsuite/gas/arc/jl.d -4a56cf56903f8e4c25dd7865dd1a92df gas/testsuite/gas/arc/jl.s -59910ad05ca1dd842920f3ca9f4b491d gas/testsuite/gas/arc/ld.d -d5a8532516e863d33880e4a649f8ebc9 gas/testsuite/gas/arc/ld.s -4d7ba9b754c7afdba41dfec82239bc30 gas/testsuite/gas/arc/ld2.d -28379656fb4f5c37963ed6991c582ed6 gas/testsuite/gas/arc/ld2.s -af5c07a06b5ab10049b70efc03fe4310 gas/testsuite/gas/arc/lp.d -657d876ad61daec2d6de3a4269bfeaf3 gas/testsuite/gas/arc/lp.s -0b801348feff41c1625f9c681af122c5 gas/testsuite/gas/arc/lsr.d -a9c2ebcafcfc68a8bb7014172813ee2c gas/testsuite/gas/arc/lsr.s -ae005c091f26b4ceac5b19e8c13d8835 gas/testsuite/gas/arc/math.d -c632e7e9e19d65e75557a5e42d513905 gas/testsuite/gas/arc/math.s -42cc6922491da263d6ab87fca2593794 gas/testsuite/gas/arc/mov.d -5bbe3186d21f23263b4a3743cfb1c0e5 gas/testsuite/gas/arc/mov.s -ff9e23ba171eb9fab4ae4bf71ca1964f gas/testsuite/gas/arc/nop.d -4b5a9a087212c040ef94e7cfc7c64113 gas/testsuite/gas/arc/nop.s -c596ab98be90e4fcdb2e92e35e3ca66f gas/testsuite/gas/arc/or.d -a9984178263c3d2fdc55aa82c0850038 gas/testsuite/gas/arc/or.s -152d55e75d6f7079d969d4582e98e32c gas/testsuite/gas/arc/rlc.d -7186c231f11739791f407f6ad9bfdfcd gas/testsuite/gas/arc/rlc.s -f67f42d8077195a9ed9da2cd3ff93889 gas/testsuite/gas/arc/ror.d -0f4fa90aec1e6518392567bb89d7420f gas/testsuite/gas/arc/ror.s -cce2b1054c09a0d526bc548ea162dc6c gas/testsuite/gas/arc/rrc.d -2a33859e8d1450a314390aee1eed985c gas/testsuite/gas/arc/rrc.s -7d0b42fa66729b4df6f26c5daa47c6ee gas/testsuite/gas/arc/sbc.d -6d4e549168ccb7340e4c87d6c3ca9f06 gas/testsuite/gas/arc/sbc.s -b0ae0aa5baea6246ee417710ad641653 gas/testsuite/gas/arc/sexb.d -e3e0516272a27d4fdde6e78fcfc0beae gas/testsuite/gas/arc/sexb.s -753f0757cceff8d9fba7da206607b32c gas/testsuite/gas/arc/sexw.d -505c87905fe1b3b19909f4ff658880e8 gas/testsuite/gas/arc/sexw.s -04e291c6c4227ad3ea068b33bcca2bee gas/testsuite/gas/arc/sleep.d -4b2c68f86079ddc3738d423a7d9286ec gas/testsuite/gas/arc/sleep.s -dd35c9020fa1c43318beec05e9d63dd6 gas/testsuite/gas/arc/sshift.d -285d03daf381a393d3099a8ff7ad1b92 gas/testsuite/gas/arc/sshift.s -15bcea7e5243fe6d08107039eff96e76 gas/testsuite/gas/arc/st.d -0416aa9321cbdc9a725bc459453431cc gas/testsuite/gas/arc/st.s -e913933835012629d5199008027146f4 gas/testsuite/gas/arc/sub.d -beca3fc3b72a58cc4eadd2369592d87f gas/testsuite/gas/arc/sub.s -f2c956a2c8d124cf6924a93a3b18641d gas/testsuite/gas/arc/swi.d -458a27c1ed4ecb3d834bc928af3a1969 gas/testsuite/gas/arc/swi.s -ca575363e502545e2e5d2a6ab64c6af8 gas/testsuite/gas/arc/warn.exp -8bdd04be09313ff33dba220b78d26d8c gas/testsuite/gas/arc/warn.s -9020b43e63291859faac20e7065787d9 gas/testsuite/gas/arc/xor.d -c1a790a7f1cc4e88b2235b226fae54b2 gas/testsuite/gas/arc/xor.s -218ceddbec7e4efdd63a6186a62fded9 gas/testsuite/gas/template -abe5158404494a7b0e74db43f784559a gas/testsuite/gas/alpha/fp.d -eb3ec5f424ad44c0e52fe488caa1402e gas/testsuite/gas/alpha/fp.exp -820ca91b26e95c2ba803e8b9a0ebe76e gas/testsuite/gas/alpha/fp.s -a1361a5b37b54c593cbef99cd85f28a9 gas/testsuite/gas/arm/arch4t.s -e805204a7256772ed77713643ce06a08 gas/testsuite/gas/arm/adrl.d -fea3d814c57f0d641ed3e2b30e3fe9da gas/testsuite/gas/arm/adrl.s -035a15045a9f50492d980d3fac9ef34a gas/testsuite/gas/arm/arm7dm.s -84352b71a635ec348f8370891582ca03 gas/testsuite/gas/arm/arm.exp -217d22388024d3ceb3c80613491f9d13 gas/testsuite/gas/arm/arm3.s -1eb3fbffc325dda43f0f98e8237840f7 gas/testsuite/gas/arm/arm6.s -3b3aa7939f5a6f1b53dc96025bbcfdd4 gas/testsuite/gas/arm/el_segundo.d -b5f8101bcc3f3cc7e46c4e89b30a29f7 gas/testsuite/gas/arm/arm7t.d -acdb01f03b31a3f8cae20ac99db63be5 gas/testsuite/gas/arm/arm7t.s -d594c5bb1795675960702c68c17df8aa gas/testsuite/gas/arm/copro.s -9b3a93b21d21ee58a49c1d0039a555de gas/testsuite/gas/arm/el_segundo.s -6f3f35f3d1f4b051fddba9412542e087 gas/testsuite/gas/arm/float.s -2134e910175749a301307015d968cbb1 gas/testsuite/gas/arm/immed.s -796fb4584e45dbc501f5e85b09182a2d gas/testsuite/gas/arm/inst.d -d451b7fb925e026001176d59277d67c5 gas/testsuite/gas/arm/inst.s -b2fd7458f8e0d2cf15a9249f9fedac4d gas/testsuite/gas/arm/le-fpconst.d -01ece05c7a31cb680e04d26a1f7dc281 gas/testsuite/gas/arm/le-fpconst.s -3613c7ccdfda8492ba8127d99020ff2b gas/testsuite/gas/arm/pic.d -528c3bb56cc6ae2b19157b75203221c6 gas/testsuite/gas/arm/pic.s -55a46d871a3fe4417039c85265d830a1 gas/testsuite/gas/arm/thumb.s -f91305f065fc92ec4cfd34af31197ff7 gas/testsuite/gas/arm/xscale.d -814449ccde23eaac315e913ef381756a gas/testsuite/gas/arm/xscale.s -109b1e2f911068bd6a3280a90061ea8b gas/testsuite/gas/cris/binop-extx.d -eed41e12ba1edecaaa2d3c3789332377 gas/testsuite/gas/cris/addi.d -04449730390af545ba20b42dccd5fe09 gas/testsuite/gas/cris/addi.s -29cdb8544456ec0d40f1b406db48473a gas/testsuite/gas/cris/binop-cmpmove.d -d2a858f83be22b61d2299cc2e5e10a0b gas/testsuite/gas/cris/binop-cmpmovx.d -e31ad643fe65589cbbdb034e1e5f197f gas/testsuite/gas/cris/binop-segref.s -7f94279e488ea079e8a1568dbeb09974 gas/testsuite/gas/cris/binop.d -0128aaa3d875adaf235960d488417afc gas/testsuite/gas/cris/binop.s -a3e707e09eac0416e1d96af6bc910dd0 gas/testsuite/gas/cris/bork.d -67a42ca84f31bc333b785695009221fa gas/testsuite/gas/cris/bork.s -d77f50b1d3d668af993e9fb633b9f401 gas/testsuite/gas/cris/branch-warn-1.s -eb037cb8821e59f91c4e4b787f56cd78 gas/testsuite/gas/cris/branch-warn-2.s -6cf3f5c1d500bd9b0a1de2c3416dffe0 gas/testsuite/gas/cris/branch-warn-3.s -6475601840a6f889ee9eccdc91023bf9 gas/testsuite/gas/cris/branch.d -caff7842b5ef92ca805daf6782c1e414 gas/testsuite/gas/cris/branch.s -4e520a3efff1f37f0de6df15c0a34c10 gas/testsuite/gas/cris/break.d -700be97c0689c4196f0da1842abcc231 gas/testsuite/gas/cris/break.s -2aaf552ea3b069446af5a6a18ad2c7e0 gas/testsuite/gas/cris/brokw-1.d -82d4b8908cfe41325173b31ad92d03fc gas/testsuite/gas/cris/brokw-1.s -a13ae25cf3ec8d458caa16dc63c2b828 gas/testsuite/gas/cris/brokw-2.d -99acc6281a586d428c2e81f5a3e76020 gas/testsuite/gas/cris/brokw-2.s -9fb7e1ca811a353db12fab28f6d7a630 gas/testsuite/gas/cris/brokw-3.d -b5ea3631270db99bda62649c3d96f03d gas/testsuite/gas/cris/brokw-3.s -c4d5e7abbcaf212d987111b7c1e2040e gas/testsuite/gas/cris/bwtest-err-1.s -d80841d50a9461e6e7533c43e44dd4d1 gas/testsuite/gas/cris/ccr.d -fb52bd22addaa45d2f47fc8fc5bcc63f gas/testsuite/gas/cris/ccr.s -0d39e0e05353afc3532e275b909fdbeb gas/testsuite/gas/cris/clear.d -0c2ea11d1047cf554432ca3d4e9d03cc gas/testsuite/gas/cris/continue.d -c87164ab4042aef14e7b7bed37d62d46 gas/testsuite/gas/cris/continue.s -944c9803d087eee985d9f792da7c29be gas/testsuite/gas/cris/cris.exp -ab7c0afd8d2cd448c3b0576af049256b gas/testsuite/gas/cris/diffexp-ovwr.d -a5073cd621e46c9b6b371425b3a8059a gas/testsuite/gas/cris/diffexp-ovwr.s -ee8c39803ebc83959f29ae641da137a0 gas/testsuite/gas/cris/fragtest.d -8de93219134f7b607edec27266d57c27 gas/testsuite/gas/cris/fragtest.s -37ac7adec86ed5a8fd0ef39db9a607f4 gas/testsuite/gas/cris/jump-type.d -1763110b16f52ce71e7111a466e55493 gas/testsuite/gas/cris/labfloat.d -2788020656f9952ba2200bfe6ed8b5f6 gas/testsuite/gas/cris/labfloat.s -63b363c29b7f111d3522135b27a5baac gas/testsuite/gas/cris/macroat.d -f2ac553ad97357a22204205c1c2c64d5 gas/testsuite/gas/cris/macroat.s -7972fbd01b55832d66e9afe5b21a44d9 gas/testsuite/gas/cris/movem-to-reg.d -06f511d9c5dfbbd6ec70e6b5fd954735 gas/testsuite/gas/cris/nosep.d -fc504e0b22b646ea6326e679962d2062 gas/testsuite/gas/cris/nosep.s -e87fda2ed120152aed5ef5927f48514d gas/testsuite/gas/cris/oneop-type.d -2cdc382a264a948b2290859f9b0722f2 gas/testsuite/gas/cris/operand-err-1.s -a9f5ed5476ee8f09aeb8676f6751b01f gas/testsuite/gas/cris/prefix.d -ce78d7541cba3153c036b973d48c2233 gas/testsuite/gas/cris/prefix.s -cef8a89ceeecbfe4d7566ccbfdd4a357 gas/testsuite/gas/cris/pushpop-byte-sreg.d -1e8ffe5e395258d271453a7d182b125e gas/testsuite/gas/cris/pushpop-dcr1-sreg.d -d97ab94343d60cc33c71b43c1fb5cabd gas/testsuite/gas/cris/pushpop-dword-sreg.d -b27c33ec812e847a147601591093ccf0 gas/testsuite/gas/cris/pushpop-word-sreg.d -38ca765cb65923ca112c69a5b347c04e gas/testsuite/gas/cris/pushpop.d -5f57132a6921dd590b853ab871c16039 gas/testsuite/gas/cris/pushpop.s -e4c7c0f31b9839d5536151310f544ee3 gas/testsuite/gas/cris/quick-s6.d -7fa1053d2735accfe207c6bd9dc2c699 gas/testsuite/gas/cris/quick-u5.d -0c9904527686c1ab40e8b41ebd824baf gas/testsuite/gas/cris/quick-u6.d -078d655cbc167283db8ba953c3148a1b gas/testsuite/gas/cris/quick.s -b76b6dbc2e3d8675977eba8b2c80fdeb gas/testsuite/gas/cris/range-err-1.s -fb6ff1ccf6bc8984d311335bb1c65de2 gas/testsuite/gas/cris/range-err-2.s -1aa963985a948084e7f57bc64ae394dc gas/testsuite/gas/cris/rd-regprefix-1.d -483b2b941bdac034989505d636c292bb gas/testsuite/gas/cris/rd-regprefix-1.s -ec4ae60abafccecdf76cfa6db8973836 gas/testsuite/gas/cris/rd-regprefix-1b.d -ba3a8b1d41f12777d99bb3b0f0242e4a gas/testsuite/gas/cris/reg-to-mem.d -c36b1354d494fa3d14e0f53cbdad14d1 gas/testsuite/gas/cris/regprefix-err-1.s -daf514b146b6d788c0d44a44c78fb084 gas/testsuite/gas/cris/regreg.d -57d564c932d2ec3a002e095c03b43755 gas/testsuite/gas/cris/regreg.s -9b3f927669d4ef8900289aa5ec407517 gas/testsuite/gas/cris/return.d -618b1c16f597a8c927d63668befe360c gas/testsuite/gas/cris/return.s -e0ccfd23d8757d8497bf9428ced9a2be gas/testsuite/gas/cris/scc.d -dfef1f180533d93400114eb0106e4047 gas/testsuite/gas/cris/scc.s -a4016c7d0fb8462d531bedf3d29db82a gas/testsuite/gas/cris/sep-err-1.s -0d8192d5d6fc2d3cf97a212a82d0ce7e gas/testsuite/gas/cris/sep-err-2.s -faaccaed133c943daeb19f14b890ac70 gas/testsuite/gas/cris/sep-err-3.s -62e83deae56f617278b9cc972afe4da2 gas/testsuite/gas/cris/separator.d -e929807163f06ba801c4d3d98eef047a gas/testsuite/gas/cris/separator.s -7dd5458e20d0ecb5c21cff9fa0a9f46a gas/testsuite/gas/cris/shexpr-1.d -f6aed27cb988eadba85e4dacfcef485e gas/testsuite/gas/cris/shexpr-1.s -47b5ed349286a89189e5915c07a7d945 gas/testsuite/gas/cris/sreg-to-x.d -36ee6b68e98b7cbd9ffd498673bb83a8 gas/testsuite/gas/cris/string-1.d -ba96569c4c3a69683f9eda2f2e804ac9 gas/testsuite/gas/cris/string-1.s -5649d5e6ddaf6789f15e1b8cb1979b1c gas/testsuite/gas/cris/string-2.d -6ddd84549c2ae105a7ffc9e339d1e37e gas/testsuite/gas/cris/string-2.s -80c15d753b5f84e6b2dc8834e2f8906e gas/testsuite/gas/cris/test.d -b7120a4705aa9a380d545c5a796c3159 gas/testsuite/gas/cris/unimplemented.d -962270c17acff6001a62ba57047c826a gas/testsuite/gas/cris/unimplemented.s -ddd6a1784dc2c7a34042c0a5fb3c1800 gas/testsuite/gas/cris/unop-mem.d -ec2af75e8927ac1b38d610129de5962b gas/testsuite/gas/cris/unop.s -75063b64ce4c7ce0ccb58e946587b1fb gas/testsuite/gas/cris/us-err-1.s -57983a53289a7da6c1ed399d7fe0a3e9 gas/testsuite/gas/cris/us-err-2.s -89b77f3261be6a0b6f7c2117ec573b35 gas/testsuite/gas/cris/us-err-3.s -a325d1070d73f0a40781fd4c0feb8055 gas/testsuite/gas/cris/x-to-byte-sreg.d -5f4256191fa514d404b9b31f0b48d973 gas/testsuite/gas/cris/x-to-dcr1-sreg.d -183314b6dae188dbb4ed4b3dfbfbd02a gas/testsuite/gas/cris/x-to-dword-sreg.d -be4438db4d0c5d5a732331453a4f54b3 gas/testsuite/gas/cris/x-to-word-sreg.d -c1a784e8e7fc1cb601b7c63df2e1320f gas/testsuite/gas/d10v/d10.exp -0004da131d3e5488db3b4b89bd259250 gas/testsuite/gas/d10v/inst.d -bbe173f89d3ad611d31b7cf43d88291c gas/testsuite/gas/d10v/inst.s -d7768075c27bdbdff4a1347c6b1746d0 gas/testsuite/gas/d30v/bittest.d -a15d68d40c502f8fb891fb71e6a331b4 gas/testsuite/gas/d30v/align.d -8ab5843e51782cc8150825c0aed13da9 gas/testsuite/gas/d30v/align.s -8a9471a2ce14a0c94c7af09fd8cf6f7c gas/testsuite/gas/d30v/array.d -afb9ee8fc39b6c6a3b5a607f0958dd2b gas/testsuite/gas/d30v/array.s -36ccce5414200c372215e06d70d6aad0 gas/testsuite/gas/d30v/bittest.l -4b9689db23a80dfeeb4e6217aaf0a8ad gas/testsuite/gas/d30v/bittest.s -df0c590e221f5dd7900a1c128978ecea gas/testsuite/gas/d30v/d30.exp -5c2ba5b08a8d87ddfc1a70cf2d7c90aa gas/testsuite/gas/d30v/guard-debug.d -739c4467a3344e1787f7b4bdbf919705 gas/testsuite/gas/d30v/guard-debug.s -24a691232054571885f6c30112e51658 gas/testsuite/gas/d30v/guard.d -59254ab788d218d38c2c0d6e71251e76 gas/testsuite/gas/d30v/guard.s -748040da85ada059191e19f00e2488f6 gas/testsuite/gas/d30v/inst.d -39cdbdd6bd65bb5930b303daa6d76dcd gas/testsuite/gas/d30v/inst.s -02e401be332104808af7c8300005fe7d gas/testsuite/gas/d30v/label-debug.d -7f982990c748276d508b09332cdae4f6 gas/testsuite/gas/d30v/label-debug.s -c483a48ce51ab77c8dee11cfab64b50a gas/testsuite/gas/d30v/label.d -7f982990c748276d508b09332cdae4f6 gas/testsuite/gas/d30v/label.s -26406f9a3cbcac3df375ce96f2bf6d60 gas/testsuite/gas/d30v/mul.d -d16bd2d8de2333b4d7ee533c7fbdb1c4 gas/testsuite/gas/d30v/mul.s -3f5d45bfe5794cd78197dab5eba2c4e6 gas/testsuite/gas/d30v/opt.d -cd67e61c7ea236940d9b65c880a564b4 gas/testsuite/gas/d30v/opt.s -7ede5044d404df6c8e7e4397218784b3 gas/testsuite/gas/d30v/reloc.d -2ed511260d2382d512257ccd75e39887 gas/testsuite/gas/d30v/reloc.s -d06a422e5cd491385a39700e8488ebe2 gas/testsuite/gas/d30v/serial.l -26005134b177b676ea077b771aa246cc gas/testsuite/gas/d30v/serial.s -ecab3756772637d3e43ed51d3afe89dd gas/testsuite/gas/d30v/serial2.l -4c96fc10e8ae0de631d7681473ac66eb gas/testsuite/gas/d30v/serial2.s -fbd1fa6f75f8a3d34dd0eb6b9bcfecf2 gas/testsuite/gas/d30v/serial2O.l -4c96fc10e8ae0de631d7681473ac66eb gas/testsuite/gas/d30v/serial2O.s -7fc2a4f0d0ed0a1e698ef2e351bacd11 gas/testsuite/gas/d30v/warn_oddreg.l -04cb44d9a5a4e2791243c475947c1dfa gas/testsuite/gas/d30v/warn_oddreg.s -3aa51e33fc3c4fb00d9f02ab8b6c1412 gas/testsuite/gas/elf/ehopt0.d -6d8da292baf24ce6878336c3bed5a1db gas/testsuite/gas/elf/ehopt0.s -7ddf696baeb3e5954c1d5755625f4f5c gas/testsuite/gas/elf/elf.exp -2e585cb42734f16db2d5af3c7e3b8ae0 gas/testsuite/gas/elf/section0.d -94799bbca15898e61e62e52d81f0bcca gas/testsuite/gas/elf/section0.s -045c78bad26109f03785866dccb0aef6 gas/testsuite/gas/elf/section1.d -b892afd90c0c8f8d9b5486dcd484d815 gas/testsuite/gas/elf/section1.s -5c0da9476fde1f1fb1257eb5a7c1864b gas/testsuite/gas/elf/section2.e -365f7f4f8f6fa73bf0c738244defbb98 gas/testsuite/gas/elf/section2.e-mips -10cd1b592475b4aa51fad4414503db94 gas/testsuite/gas/elf/section2.l -5a42c78c814dadc7e4a11cba2a795f97 gas/testsuite/gas/elf/section2.s -8f760ce7cf5b0bcea1fd0c123134bc4b gas/testsuite/gas/fr30/allinsn.d -f43f517834a1bcead42dab25e75f41d0 gas/testsuite/gas/fr30/allinsn.exp -fdf34a19cb21c9273e472a9bb4c9e97f gas/testsuite/gas/fr30/allinsn.s -4a1055775cc266d1a0458ce050e653d3 gas/testsuite/gas/fr30/fr30.exp -2924c535df55b6a32889011860a29689 gas/testsuite/gas/h8300/addsub.s -8b119bf28b7ba30807a8850b9edf96d3 gas/testsuite/gas/h8300/addsubh.s -5b8c73d8de33afa02ff707f67065a1ef gas/testsuite/gas/h8300/addsubs.s -d86b31775e7398f8bc4d446d9d0a017b gas/testsuite/gas/h8300/bitops1.s -15fd0f35907c986489fa36bddebbb526 gas/testsuite/gas/h8300/bitops1h.s -584a7cd8ad886afe1f0d2f9b5d817467 gas/testsuite/gas/h8300/bitops1s.s -30ff0841f2e26ebb8e15aa636a64e4a5 gas/testsuite/gas/h8300/bitops2.s -a741bf520d8175248d8c363dd660cad9 gas/testsuite/gas/h8300/bitops2h.s -2e137c2f7cf12903edc7dd00bfe6d409 gas/testsuite/gas/h8300/bitops2s.s -3d15e82abb0f85bdfacdbb653e083999 gas/testsuite/gas/h8300/bitops3.s -82edeaa989ae932805db0608f8cc235a gas/testsuite/gas/h8300/bitops3h.s -f5395cd9806896db584e3fbbdb548389 gas/testsuite/gas/h8300/bitops3s.s -6249a5e4419949642c98aaa14f3d8b10 gas/testsuite/gas/h8300/bitops4.s -5a394a0dbef8a7f14e4294b4dcfed8a5 gas/testsuite/gas/h8300/bitops4h.s -791083648e92754b6c62f3201681ece1 gas/testsuite/gas/h8300/bitops4s.s -23aecc0c8af29a4bf18f97a9607677d5 gas/testsuite/gas/h8300/branch.s -1f02561f75f4c45679ba42b0492cc58a gas/testsuite/gas/h8300/branchh.s -e251ed292c39572dbd1364f73d5fd32e gas/testsuite/gas/h8300/branchs.s -f0e5262ac4229fe320614df5a40f35e9 gas/testsuite/gas/h8300/cbranch.s -30d75e5d8c2ef426fe42a377456bda0b gas/testsuite/gas/h8300/cbranchh.s -5fdbcffb87056d813eafd925d9c763f0 gas/testsuite/gas/h8300/cbranchs.s -80cc8a6d96ee17417ea03077199ad4d7 gas/testsuite/gas/h8300/cmpsi2.s -3be6267a929c5b26e8f4d69491d0877a gas/testsuite/gas/h8300/compare.s -b2030d679f34f4563b5a00cbe2c1d072 gas/testsuite/gas/h8300/compareh.s -94eec517c2a5cefb40f7bcc8a338a83a gas/testsuite/gas/h8300/compares.s -437e6b6cef5f904dd70a700cd486f7ea gas/testsuite/gas/h8300/decimal.s -9b32251ca7b543949470558b507ca6b3 gas/testsuite/gas/h8300/decimalh.s -56fe63d196d46b2f8dc1c4bfca0c351d gas/testsuite/gas/h8300/decimals.s -0c35be5ae497429ff49aa3076805fda3 gas/testsuite/gas/h8300/divmul.s -d37984dfb136ed1c465a17ac6ff8cbb4 gas/testsuite/gas/h8300/divmulh.s -d37984dfb136ed1c465a17ac6ff8cbb4 gas/testsuite/gas/h8300/divmuls.s -f813008dac0b658d469085e795844664 gas/testsuite/gas/h8300/extendh.s -4d7497fb959f22fd9f7b666d4c61eee6 gas/testsuite/gas/h8300/extends.s -75a67be04365505ad29c72fef5a9ffe9 gas/testsuite/gas/h8300/ffxx1.d -fac5432bff2a42ebe3ace2a5431b0028 gas/testsuite/gas/h8300/ffxx1.s -67fb823dadfe9cc61cc4c40717871318 gas/testsuite/gas/h8300/h8300.exp -d068dc8b49ea5e3a2841052399d04411 gas/testsuite/gas/h8300/incdec.s -57ef072e39a9e088908da70b650fe6b7 gas/testsuite/gas/h8300/incdech.s -68127cbf4156b232462ded46fb1eeb96 gas/testsuite/gas/h8300/incdecs.s -ad670f4be1807bfa3361ea5dfdc0658d gas/testsuite/gas/h8300/logical.s -4baf511d4fbb91925e6de834c9b49ea5 gas/testsuite/gas/h8300/logicalh.s -c4d9cba61beedae407c0c1260e6e1d5d gas/testsuite/gas/h8300/logicals.s -3c56ddac8216a69a609103570d7b3e49 gas/testsuite/gas/h8300/macs.s -fb0d77314633b62d40a4a054311960e8 gas/testsuite/gas/h8300/misc.s -0474a81ccc5b5408fc54aa171faafb52 gas/testsuite/gas/h8300/misch.s -11bb474016acda38cc0db95df94487a3 gas/testsuite/gas/h8300/miscs.s -9193c97fad2ede164c0c90d605b70f46 gas/testsuite/gas/h8300/mov32bug.s -1883f564d24d685c8dc63486f070f4a6 gas/testsuite/gas/h8300/movb.s -fcd326aa9537340e99b1100508c3aa5b gas/testsuite/gas/h8300/movbh.s -7145f97672f9645e3de195a7fdf55a1b gas/testsuite/gas/h8300/movbs.s -d8c9bc7371b9b1d46a2eefb32d90d58d gas/testsuite/gas/h8300/movlh.s -0e5f5a058fd24a750a53bfa817b326a5 gas/testsuite/gas/h8300/movls.s -3674b05426b7d9c23e487af7bb8465e2 gas/testsuite/gas/h8300/movw.s -75e9728e4f42fb7fbedbba7ed96b11db gas/testsuite/gas/h8300/movwh.s -b0068c567a3f9efc6b3b31cf95a5a318 gas/testsuite/gas/h8300/movws.s -911d1f05cbac2099a9f3d2c76df2d656 gas/testsuite/gas/h8300/multiples.s -4393180d58ab1ed9d690f02ff183b6f6 gas/testsuite/gas/h8300/pushpop.s -4d82e273acc364dfaddc59b3a13ee22e gas/testsuite/gas/h8300/pushpoph.s -8ff1c8b35100699d39d44f67e19a5176 gas/testsuite/gas/h8300/pushpops.s -6cc6731a0e070e666e164d9163629113 gas/testsuite/gas/h8300/rotsh.s -7bc113956c8ca4ddcd42503e4bd530e3 gas/testsuite/gas/h8300/rotshh.s -811af24ecd9436d020bfaf84413f5847 gas/testsuite/gas/h8300/rotshs.s -3f42a581ab454d64c32db9aee33ef424 gas/testsuite/gas/hppa/basic/basic.exp -f0fc0667db6fc80b90e168e77d21a710 gas/testsuite/gas/hppa/basic/add.s -98ee4fb8ed790b202a1c065b7e0b997b gas/testsuite/gas/hppa/basic/add2.s -57ad58f96f1a781f50c99315319025b2 gas/testsuite/gas/hppa/basic/addi.s -d9c4ae7672d35624f16301c6c3d2d6e3 gas/testsuite/gas/hppa/basic/branch.s -018bafaddc464bf5344056a4a6ba62aa gas/testsuite/gas/hppa/basic/branch2.s -2744044afb6af0ffe892e71482c7e83b gas/testsuite/gas/hppa/basic/comclr.s -30e98c333c6c3c41f4230609d617d4bd gas/testsuite/gas/hppa/basic/copr.s -18c064b287abc57be5f66793ce0a4ed8 gas/testsuite/gas/hppa/basic/coprmem.s -593e94c43830b50ccf4ccf7aefdabc9a gas/testsuite/gas/hppa/basic/dcor.s -54b1bb4ce869350a6860eea7ef011576 gas/testsuite/gas/hppa/basic/dcor2.s -7f9d07824ecdd65dce64fdbb8ab88668 gas/testsuite/gas/hppa/basic/deposit.s -9e7936d6dca987e90acb029a0794e50c gas/testsuite/gas/hppa/basic/deposit2.s -4179bc45da0c3f5c674c51bce4f3ef42 gas/testsuite/gas/hppa/basic/deposit3.s -5532f754b3ee74d823c916f73352f531 gas/testsuite/gas/hppa/basic/ds.s -ebef581b3abd2e0a860dc45c474dcc77 gas/testsuite/gas/hppa/basic/extract.s -f0c6b56da1f75e189baf27d8c1f535fe gas/testsuite/gas/hppa/basic/extract2.s -51d8fb411be8712bd0c7ce811ad6dc38 gas/testsuite/gas/hppa/basic/extract3.s -a982fc398cedf2e44201d59012ee7066 gas/testsuite/gas/hppa/basic/fmem.s -a0babc25ea6d4372cb5eccc0ae3f4825 gas/testsuite/gas/hppa/basic/fmemLRbug.s -91548514b195f47807497ea510c61712 gas/testsuite/gas/hppa/basic/fp_comp.s -9847e0fce8c6da72b7f980b441367739 gas/testsuite/gas/hppa/basic/fp_comp2.s -698e8f34a3b345696ad42ea0fe3a42dc gas/testsuite/gas/hppa/basic/fp_conv.s -50c67d6e1a3d6914794a948be62b14f6 gas/testsuite/gas/hppa/basic/fp_fcmp.s -67b6a72f5e598098f02c322b08238380 gas/testsuite/gas/hppa/basic/fp_misc.s -bf748287a3393071018df9ef711ff79e gas/testsuite/gas/hppa/basic/imem.s -382400fc1867cc374e7a9a97620ba203 gas/testsuite/gas/hppa/basic/immed.s -3dcb29aed920c5fca9f33ae76fa7bf5e gas/testsuite/gas/hppa/basic/logical.s -40808c7e14c9dd94905f168f5bd28a9d gas/testsuite/gas/hppa/basic/media.s -3f9890f5f05691d773c5252cca7c3bdb gas/testsuite/gas/hppa/basic/perf.s -5cc775342d33290ccc79a2c3392ba59c gas/testsuite/gas/hppa/basic/purge.s -585389c4c1113b467f309f8b53564ddf gas/testsuite/gas/hppa/basic/purge2.s -bc0a3320065bbb6f8c7226807fa35e7d gas/testsuite/gas/hppa/basic/sh1add.s -7682c249ad6ac5dce5a7a0d5c70b9759 gas/testsuite/gas/hppa/basic/sh2add.s -3976fa98bed24429b469cc702b660e93 gas/testsuite/gas/hppa/basic/sh3add.s -69cfdc26fc07d25504dfb30978448340 gas/testsuite/gas/hppa/basic/shift.s -f588468f60d1393a578d3147a655f303 gas/testsuite/gas/hppa/basic/shift2.s -d35888a201d29276d5f468576ce69678 gas/testsuite/gas/hppa/basic/shift3.s -b3128437c366866da97f401491e4854c gas/testsuite/gas/hppa/basic/shladd.s -8ed6a738a1fd2383dbe99d68c8cf59e4 gas/testsuite/gas/hppa/basic/shladd2.s -66715cf6565b3eabaabafd99e8b2dab6 gas/testsuite/gas/hppa/basic/special.s -1af275b55a5680b0a941bfdf1e5496e9 gas/testsuite/gas/hppa/basic/spop.s -cbe82b7200c01fac6ef8ad8c4c90e4a0 gas/testsuite/gas/hppa/basic/sub.s -7f6527cc71e690f05a0d73c733c1b14b gas/testsuite/gas/hppa/basic/sub2.s -c2fd7d2c7fc3f77c944b5af56ebbcb7d gas/testsuite/gas/hppa/basic/subi.s -857c66689b29c2902448ccfc8b55d78a gas/testsuite/gas/hppa/basic/system.s -9dec6c8e5b94b75cb0e0fb27c16ce4ee gas/testsuite/gas/hppa/basic/system2.s -05e8ccf6f72f4a0efbdf0f852a206023 gas/testsuite/gas/hppa/basic/unit.s -1ed85cf259a78d3d86ea435e74dfcbe6 gas/testsuite/gas/hppa/basic/unit2.s -03008cde62428d4ff2464bef8cb8bcd2 gas/testsuite/gas/hppa/basic/weird.s -73cbb56b2c330327d9c06ea89af0cd91 gas/testsuite/gas/hppa/README -d93edd3b974fa05de350f6104c63af74 gas/testsuite/gas/hppa/parse/align1.s -6a7df2ab8d1491f8f64f60fb0a359558 gas/testsuite/gas/hppa/parse/align2.s -85d6e969f063c0bee9565d096c43657e gas/testsuite/gas/hppa/parse/appbug.s -72ae2fe9c7ff74b0267402ab93c59282 gas/testsuite/gas/hppa/parse/badfmpyadd.s -b0dd08d05ad154fa1797fbb7b65f1b3a gas/testsuite/gas/hppa/parse/block1.s -44d0164ab1f3f2f8201ca4cac02f0a91 gas/testsuite/gas/hppa/parse/block2.s -7012f9c767f18688e051c168e218464b gas/testsuite/gas/hppa/parse/calldatabug.s -d26fcb5186e8ffda4892557ecf9d836a gas/testsuite/gas/hppa/parse/callinfobug.s -36132d401bbf31234a71915b94762a26 gas/testsuite/gas/hppa/parse/defbug.s -8355f3baa7c8bf6dfdde12165f166988 gas/testsuite/gas/hppa/parse/entrybug.s -a8c2940c51c368a14265009963ce4a7d gas/testsuite/gas/hppa/parse/exportbug.s -0aa9ab25448da72ed059168f45ee4e11 gas/testsuite/gas/hppa/parse/exprbug.s -464c7378f55821348860da76fd77ed2e gas/testsuite/gas/hppa/parse/fixup7bug.s -69d79811f23cb30bd2c536063a29c137 gas/testsuite/gas/hppa/parse/global.s -eae1949a6363097a7e2ef5bd260b9aa7 gas/testsuite/gas/hppa/parse/labelbug.s -a7ec38bf59489eb49f4bd3ce752f7cb4 gas/testsuite/gas/hppa/parse/linesepbug.s -adf3dd32e97d184fa3a923e977ac0f20 gas/testsuite/gas/hppa/parse/lselbug.s -e09d99b9bb0cc52546de922bf02a3a13 gas/testsuite/gas/hppa/parse/nosubspace.s -8161b5f30367ba86f14e168e2fbf025a gas/testsuite/gas/hppa/parse/parse.exp -030b7a7332dca245ae8a65a00ab8e169 gas/testsuite/gas/hppa/parse/procbug.s -ba4a443e4362a957c9eda52f33e9ed56 gas/testsuite/gas/hppa/parse/regpopbug.s -b19738063af645b6f2231ee644131542 gas/testsuite/gas/hppa/parse/spacebug.s -16d00a249972a7d82fd5b443a6c006ea gas/testsuite/gas/hppa/parse/ssbug.s -6e77c97c02695c15f9f54b9b531a5e2b gas/testsuite/gas/hppa/parse/stdreg.s -e4c3228c9e3a74eb9b2170caafd9cf4c gas/testsuite/gas/hppa/parse/stringer.s -b91fabc2587cd34b7543fe16032d9c3e gas/testsuite/gas/hppa/parse/undefbug.s -ad0e0513effd832ce4787671ac4c5eac gas/testsuite/gas/hppa/parse/versionbug.s -7f9b2353d22448012a9435f7b80ccf1a gas/testsuite/gas/hppa/parse/xmpyubug.s -629e685800d946a73fba78f4f9e2a342 gas/testsuite/gas/hppa/reloc/applybug.s -e7eccf3a36e653b9312fc78bb40a5022 gas/testsuite/gas/hppa/reloc/blebug.s -9c8150c0635455986ba2e99432e230ad gas/testsuite/gas/hppa/reloc/blebug2.s -cfe88051f0bd644932bc22814216e804 gas/testsuite/gas/hppa/reloc/blebug3.s -2e83d05979fd4ec0c399182ad7513423 gas/testsuite/gas/hppa/reloc/exitbug.s -a7ab875345b2ba9a0c1e6aee0c0b23cb gas/testsuite/gas/hppa/reloc/fixupbug.s -84f724d5d6335f9367de5e493847499c gas/testsuite/gas/hppa/reloc/funcrelocbug.s -8fd8e8d6557a090221c4b9382f712183 gas/testsuite/gas/hppa/reloc/labelopbug.s -79c490df3cf5ac395769cfd1378b598b gas/testsuite/gas/hppa/reloc/longcall.s -6fedcfa10d24c76dde19990cbdb53c1a gas/testsuite/gas/hppa/reloc/picreloc.s -a30d0372d62d0a448e374ed80897e3bf gas/testsuite/gas/hppa/reloc/plabelbug.s -f2f905140c0955e2a88e451fad681f42 gas/testsuite/gas/hppa/reloc/r_no_reloc.s -5042b71ae3f83b270fa17a2b7f27fc92 gas/testsuite/gas/hppa/reloc/reduce.s -bc728b6253b6c770472ed22f5def04e0 gas/testsuite/gas/hppa/reloc/reduce2.s -45668f4718492900a833f2d3ebe47e57 gas/testsuite/gas/hppa/reloc/reduce3.s -5fce2ee045a8f221d7d4a0470786d00b gas/testsuite/gas/hppa/reloc/reloc.exp -2813e26c00aa991fb8cc3f67b56ae4f6 gas/testsuite/gas/hppa/reloc/roundmode.s -c690211a1ccb9ebe1cda17e17b5d1cf4 gas/testsuite/gas/hppa/reloc/selectorbug.s -c0e4f0dd244fb83332f776ca09756e5b gas/testsuite/gas/hppa/unsorted/align3.s -a7b6914341e97c943a5b931b5ff724a1 gas/testsuite/gas/hppa/unsorted/align4.s -d5ecda3dffcd60591d33b1718f89d02c gas/testsuite/gas/hppa/unsorted/brlenbug.s -0854f5ede3fb810256df5394b5d17a6f gas/testsuite/gas/hppa/unsorted/common.s -563abc929a52d7539bb83a990fbfcb65 gas/testsuite/gas/hppa/unsorted/fragbug.s -3c295194b6d3754be9b7b7da67fddcb4 gas/testsuite/gas/hppa/unsorted/globalbug.s -af9e915b6ea1a8a691914d94bb230546 gas/testsuite/gas/hppa/unsorted/importbug.s -741867661d59451b7d71d392fc0d7206 gas/testsuite/gas/hppa/unsorted/labeldiffs.s -0aa46fc17784b72b21d387564dddde36 gas/testsuite/gas/hppa/unsorted/locallabel.s -f8705df6b564ae8bc51ff8255048afd1 gas/testsuite/gas/hppa/unsorted/ss_align.s -da24d502a74952b6c5895ffc62d541d1 gas/testsuite/gas/hppa/unsorted/unsorted.exp -dabaf1f82986e409d20127484c8388e3 gas/testsuite/gas/i386/general.l -4f13cd819c9c8bdc0e25c3e1ea7e0be1 gas/testsuite/gas/i386/amd.d -c89704ccdc6abd42145480c444772394 gas/testsuite/gas/i386/amd.s -481a82666e24dd35712ddbe1953070fc gas/testsuite/gas/i386/float.l -0df7ab956e3209428d665890983ef957 gas/testsuite/gas/i386/float.s -c6f32143c1a338a7e3c688cadb2a27b3 gas/testsuite/gas/i386/general.s -f55987a25b2d327d6cce6d34c2f1f3e4 gas/testsuite/gas/i386/i386.exp -54bf1dea9d3fa662fd489d8ba6123a50 gas/testsuite/gas/i386/intel.d -19173fe8ed78eaf92af5f4e7219aed51 gas/testsuite/gas/i386/intel.s -734d748810614b19b03ac10dfde2b1f4 gas/testsuite/gas/i386/intelpic.d -10af8323b3fdfb2580629d4bbb96414f gas/testsuite/gas/i386/intelpic.s -92c2460d4bc6a3d856918e182ca720b3 gas/testsuite/gas/i386/inval.l -ebaaadf5e7218736c6523e8c024e4a63 gas/testsuite/gas/i386/inval.s -e6d4cc21cd6fd3850a2527bd9a0602df gas/testsuite/gas/i386/jump.d -a5ac8a9636b7ab8c6a732203d0914133 gas/testsuite/gas/i386/jump.s -73d7f5fe54695a0d1baff6361ee951af gas/testsuite/gas/i386/jump16.d -72fb343c916713f2da32dd3ebcb13cd7 gas/testsuite/gas/i386/jump16.s -c4bd4a9c5d709255664ff19de89fe4ce gas/testsuite/gas/i386/katmai.d -3e427af40c4ab651d69de595d3f996f7 gas/testsuite/gas/i386/katmai.s -d566afc7ce85d649e11306e09c745945 gas/testsuite/gas/i386/modrm.l -1d1696a1b6db5c16aa2463cdd8b6a045 gas/testsuite/gas/i386/modrm.s -a9f88835bfba484b001209393305e9ab gas/testsuite/gas/i386/naked.d -b4fe60a42e7f416e8bcfc4c911652c79 gas/testsuite/gas/i386/naked.s -91f562b065b071024b4ad049253cc00b gas/testsuite/gas/i386/opcode.d -7c8d765ebc016ae5b7ce8941230d47ba gas/testsuite/gas/i386/opcode.s -d1ab72522efa161dc5bb0d5d34c6cbe3 gas/testsuite/gas/i386/prefix.d -18eb6094372a8ea6dcedecc52d4bbafb gas/testsuite/gas/i386/prefix.s -6d542d1a416f943f08f7081f0ea15d6e gas/testsuite/gas/i386/relax.d -1b8a63c63fa1cb4fd0069ad74110d3a8 gas/testsuite/gas/i386/relax.s -73bd114ee58f8613e40dcc68dc44ecab gas/testsuite/gas/i386/reloc.d -785e2743dba0137e0235c3a40f7ed72b gas/testsuite/gas/i386/reloc.s -2d08693d201a298eb883722a268fb281 gas/testsuite/gas/i386/sse2.d -266867e323b3248cd8cdad201276821d gas/testsuite/gas/i386/sse2.s -108a9548a770fe8d5f7e2f92c9418545 gas/testsuite/gas/i386/ssemmx2.d -e73e0f652b697100e02db9b419b06cd0 gas/testsuite/gas/i386/ssemmx2.s -04f524b94eb61aaf58b37c180ab1e373 gas/testsuite/gas/i386/white.l -305b7d730a90ea5ac8fb330a3bf13fec gas/testsuite/gas/i386/white.s -62171adf925034f2497f65c4381bda77 gas/testsuite/gas/i386/x86_64.d -167651a8472e8240a82c364ac9738761 gas/testsuite/gas/i386/x86_64.s -dbbf38f460db18779a5e3b6d064eb499 gas/testsuite/gas/ia64/dv-branch.d -ec058dd65d1af91fe84f41b725857462 gas/testsuite/gas/ia64/dv-branch.s -956561267da937b1be0fada7c6ea25c7 gas/testsuite/gas/ia64/dv-entry-err.l -e635d21d0f94975c7df306096506d41b gas/testsuite/gas/ia64/dv-entry-err.s -d2c80d56ca498f06aaed101e323f583f gas/testsuite/gas/ia64/dv-imply.d -a4c835f4336ab0d7bea5c1251fe02f94 gas/testsuite/gas/ia64/dv-imply.s -091538d6530e8a161937745d99426d7a gas/testsuite/gas/ia64/dv-mutex-err.l -91d93a728f474aa95c998e07a884224c gas/testsuite/gas/ia64/dv-mutex-err.s -8126eb7a7fcdd728745e456cb576a1e3 gas/testsuite/gas/ia64/dv-mutex.d -91cb93a568ee81bf4a049bfcad3be8f4 gas/testsuite/gas/ia64/dv-mutex.s -faad91ad280ed985504df18b5df67462 gas/testsuite/gas/ia64/dv-raw-err.l -47f0ecc4a6d44c41bceba1bf96951931 gas/testsuite/gas/ia64/dv-raw-err.s -042d6a6ba6e6fab95e540ea3f117cadd gas/testsuite/gas/ia64/dv-safe.d -c06a2d45e380eacc79be2946865839ea gas/testsuite/gas/ia64/dv-safe.s -b08507477c737fd99ecbcdaf985f7864 gas/testsuite/gas/ia64/dv-srlz.d -fcb5ba635bb6c1bf11217572aed8c194 gas/testsuite/gas/ia64/dv-srlz.s -47a1c9e8c8d646cb1276022156938aef gas/testsuite/gas/ia64/dv-war-err.l -96d62a881175a15f9d0eb1464592de82 gas/testsuite/gas/ia64/dv-war-err.s -c29583516e19e2b432fc8be35ccfd38c gas/testsuite/gas/ia64/dv-waw-err.l -5120b50924c7c72ed617ecf58bb839c4 gas/testsuite/gas/ia64/dv-waw-err.s -4702e0589d4ecfea81d623654726c865 gas/testsuite/gas/ia64/fixup-dump.pl -3340310e879de7f94d7008a34cd902e3 gas/testsuite/gas/ia64/ia64.exp -e6ff55117be31d2e2338afa8ba6743e1 gas/testsuite/gas/ia64/opc-a-err.l -c10f248c93a66cf00810e181bcf47859 gas/testsuite/gas/ia64/opc-a-err.s -d01bcbbb33e4aaddf588cf96bb2818c3 gas/testsuite/gas/ia64/opc-a.d -7a4b4b8b83d010b15200291b7428d900 gas/testsuite/gas/ia64/opc-a.pl -25a4e13b65c5c563854c68b27850ec27 gas/testsuite/gas/ia64/opc-a.s -6f669176b63ccb7041cff7a0c43bdd2a gas/testsuite/gas/ia64/opc-b.d -a6e1c6d4094099abc90c4eddf392cf90 gas/testsuite/gas/ia64/opc-b.pl -0a0dcd4d0f92863aacd3374f10cf89d4 gas/testsuite/gas/ia64/opc-b.s -87d4c9bce119a46f50cd7873ecdbb579 gas/testsuite/gas/ia64/opc-f.d -e44f587f12c4e939d44570b92b5ca82b gas/testsuite/gas/ia64/opc-f.pl -7de8eef520f311b774af7bdea416eee9 gas/testsuite/gas/ia64/opc-f.s -08b1ba95e8fd11a0f7f8c1f3705e0be2 gas/testsuite/gas/ia64/opc-i.d -6df89ea375d396efe8cd150381479c12 gas/testsuite/gas/ia64/opc-i.pl -2574b1a2f2579fa030a50947773fa6c0 gas/testsuite/gas/ia64/opc-i.s -95ae13460bb1d9601c083697cac119e9 gas/testsuite/gas/ia64/opc-m.d -85878e0564576b3b7bafb3eb82660f7d gas/testsuite/gas/ia64/opc-m.pl -df0663aeae5336e53e1d06b3e39f6bb2 gas/testsuite/gas/ia64/opc-m.s -42205102976e466e5bbffcdd4d3cfcb7 gas/testsuite/gas/ia64/opc-x.d -da315d802d151e76d7d335473c729f38 gas/testsuite/gas/ia64/opc-x.s -cd152fa44d0a9ca4200fbec848788915 gas/testsuite/gas/ia64/regs.d -e6ce0da8b25a4cd6c5b44068eb4278cd gas/testsuite/gas/ia64/regs.pl -b6c72b3bbf42fd15250f957014a139c9 gas/testsuite/gas/ia64/regs.s -c8161d7293bcc7692937ee4d5b16fc60 gas/testsuite/gas/ieee-fp/x930509a.exp -b0509b0492fd2fc8448b011ae03a41b8 gas/testsuite/gas/ieee-fp/x930509a.s -649f145a8122db7f91f18b85740849a5 gas/testsuite/gas/m32r/allinsn.d -239bb6ea0e35bbe2e8a5939edab2a2cb gas/testsuite/gas/m32r/allinsn.exp -5f9b6e2b9934e8a02576ba496d16ab72 gas/testsuite/gas/m32r/allinsn.s -74ef82c499b9dbc10b25373e6823c276 gas/testsuite/gas/m32r/error.exp -d71cb8f6eee3bbdd0ccecaaca513831a gas/testsuite/gas/m32r/fslot.d -da6bcd9a061b6fdd7a4ee5b2aec6811a gas/testsuite/gas/m32r/fslot.s -da48ccf2513f4723fced3d98ee902eee gas/testsuite/gas/m32r/fslotx.d -c81e23eb3020f45236c4ef7e98a14008 gas/testsuite/gas/m32r/fslotx.s -13b1a745fafe89b83fc828fa73bc0ea5 gas/testsuite/gas/m32r/high-1.d -0c257c8a3667fa667e99bb3cb9aff5a7 gas/testsuite/gas/m32r/high-1.s -873accfff909b6aac6b9a2e8cf961856 gas/testsuite/gas/m32r/interfere.s -d8115906f69c19b93a1fa6deba5b2d70 gas/testsuite/gas/m32r/m32r.exp -6b48ad39eeb0006e1fc1c9010cfbc21d gas/testsuite/gas/m32r/m32rx.d -778e305ed7747652af13150f315591a9 gas/testsuite/gas/m32r/m32rx.exp -3e3e8b05f1651dbc0692a8a20fc804ba gas/testsuite/gas/m32r/m32rx.s -c0b5f95ee4eec971ea74dc81435baec8 gas/testsuite/gas/m32r/outofrange.s -32f8410f7bdb6db49efc7016f230360f gas/testsuite/gas/m32r/relax-1.d -ee56272ade0ca1ed891d0bcdc81d1173 gas/testsuite/gas/m32r/relax-1.s -ffadebffc2057e150da0f56aa0f6d511 gas/testsuite/gas/m32r/relax-2.d -dfd4ad2ea1d8b29e222e48a671c648e1 gas/testsuite/gas/m32r/relax-2.s -debc3c1322cf7602d46e1657a4249b10 gas/testsuite/gas/m32r/uppercase.d -3ad7dc32e323605aaf71cc84e39717df gas/testsuite/gas/m32r/uppercase.s -d21d472754ca0f699e8faf8c95175ec1 gas/testsuite/gas/m32r/wrongsize.s -9187362c4020cfb7b9df8782637bb65d gas/testsuite/gas/m68hc11/all_insns.d -f17b7c3ca3c536ffa8e6df6dc2f439f1 gas/testsuite/gas/m68hc11/all.exp -57022ccbd6cef54a3a8ece7847d6569f gas/testsuite/gas/m68hc11/all_insns.s -7bd42f694ffddccc2e193372d35e2541 gas/testsuite/gas/m68hc11/insns-dwarf2.d -afeb3f5fe5cf302f22c11a8a73c76fe6 gas/testsuite/gas/m68hc11/insns.d -b40598fa9d279a12c73b904dc7f640cd gas/testsuite/gas/m68hc11/insns.s -d77d9f6b2a194247a6d436103c2aa5a6 gas/testsuite/gas/m68hc11/lbranch-dwarf2.d -2ce8f16d1b2813d639637246318a2fa5 gas/testsuite/gas/m68hc11/lbranch.d -270514d96ae94f63ea38a4eb9fccd095 gas/testsuite/gas/m68hc11/lbranch.s -7e3463ce5e0c47ca8bdaaf6f3d443f8d gas/testsuite/gas/m68hc11/malis-include.s -41ba77d190f160fb60f0392b97e0d453 gas/testsuite/gas/m68hc11/malis.d -a469d5986f2366e13cba507b0314fdfd gas/testsuite/gas/m68hc11/malis.s -89d1a83096ae0248028459092e1518ca gas/testsuite/gas/m68hc11/opers12-dwarf2.d -9931e7658c6388e1ad91fb3bb0f38a38 gas/testsuite/gas/m68hc11/opers12.d -bfd8edd9e0edf8fb9cd5ea3ebf070461 gas/testsuite/gas/m68hc11/opers12.s -d36654135443b0740d6b2c78b03ad44b gas/testsuite/gas/m68k/bitfield.d -2a34f43b42955f46a42618a50182de68 gas/testsuite/gas/m68k/all.exp -fa19c98907bd173f6de4c396ef9acd45 gas/testsuite/gas/m68k/bitfield.s -1c229d52fdc1160c9dd9f74b19c1ec69 gas/testsuite/gas/m68k/cas.d -20e0445e36d8d9f35c6022fa7118a3da gas/testsuite/gas/m68k/cas.s -96de03f7fc5967e5d267ae957ac508cf gas/testsuite/gas/m68k/disperr.s -26dfd242ac765008271e85e25d9d8446 gas/testsuite/gas/m68k/fmoveml.d -205a85d6482891f58292e065222b78fa gas/testsuite/gas/m68k/fmoveml.s -b14e11a2793fb32f7d471e31e4ecf7b9 gas/testsuite/gas/m68k/link.d -ea9ee18230b981ada48e2b69bb566220 gas/testsuite/gas/m68k/link.s -85e6de04e2d6138d3b0e1e3e932fc884 gas/testsuite/gas/m68k/op68000.d -d72997199e7c0cfb9dae24c9bc0347fd gas/testsuite/gas/m68k/operands.d -d5012d936b1b45db947e4a29a883fc9d gas/testsuite/gas/m68k/operands.s -b334f15354ebeffb3acba502cc1dae67 gas/testsuite/gas/m68k/p2410.s -ce5152b0da290f444d58c6ef03d48e02 gas/testsuite/gas/m68k/p2663.s -9f97c8240a44cb8d55e355b3577f7a7d gas/testsuite/gas/m68k/pcrel.d -3bc8cba59ef27f67c6c6e2a67717db04 gas/testsuite/gas/m68k/pcrel.s -c1fce4f35335083fbf7d4538c5a7230f gas/testsuite/gas/m68k/pic1.s -6ebe1f8291de253ee6ce0e469b3e03aa gas/testsuite/gas/m68k/t2.d -ba9a3e851cb31d41e5a33c44dc3ebd13 gas/testsuite/gas/m68k/t2.s -3a162ab2de5525fc4745144a511922c9 gas/testsuite/gas/m68k-coff/p2389a.s -4117edd076cf599f92777cbfea5d59ba gas/testsuite/gas/m68k-coff/gas.exp -45f1ecda71b05960409560f553228a2d gas/testsuite/gas/m68k-coff/p2389.s -29f7789ff1bca9100fda6a1276c73f70 gas/testsuite/gas/m68k-coff/p2430a.s -2c65e9837c0fa5884e6d7aa8ab7f5b27 gas/testsuite/gas/m68k-coff/p2430.s -9ae5a3f91535cb9ce86b48698e6096b1 gas/testsuite/gas/m68k-coff/t1.s -abc6ff7e3825198ada07ac55f4f3ab7e gas/testsuite/gas/m88k/m88k.exp -dccbd7ad6ededd07df99af498231642d gas/testsuite/gas/m88k/init.d -ebcd9dfb18999e4f42a3c3d5a53fcb81 gas/testsuite/gas/m88k/init.s -ef6c6bcefee3f0df10bbe2455661acc7 gas/testsuite/gas/macros/macros.exp -06148aa2e0046074be6e05308a79b642 gas/testsuite/gas/macros/err.s -f64593bf9530d575f681a8566ef216c3 gas/testsuite/gas/macros/irp.d -e284db7fba30dba3218492a95521d6b1 gas/testsuite/gas/macros/irp.s -369273a5f986fd76ff12a8c638e722a0 gas/testsuite/gas/macros/strings.d -b320acc9c113dd9d1967db7ee0857e8a gas/testsuite/gas/macros/rept.d -f5abc6437f073dff4af533a36ea9d280 gas/testsuite/gas/macros/rept.s -efbeac5d9e630c2251fa42fd98bdfd47 gas/testsuite/gas/macros/semi.d -e772243ae7fe04097bba952a6d9173bd gas/testsuite/gas/macros/semi.s -8990b11a483140af060adb1ff48c4cc5 gas/testsuite/gas/macros/strings.s -df6bcb5dd71cf55583464fc270bc52a1 gas/testsuite/gas/macros/test1.d -74a3db320fafd23b64c4ab6f48a17246 gas/testsuite/gas/macros/test1.s -ac43f2633f23586812df9e1a40627d82 gas/testsuite/gas/macros/test2.d -0fd6102941c5acb1bb8e85a697a2ff23 gas/testsuite/gas/macros/test2.s -7e8aafe277f842553e1bf935c32fa0e8 gas/testsuite/gas/macros/test3.d -1dbcc25102396060274f0b3d1268f47c gas/testsuite/gas/macros/test3.s -0544bcf7466e18eabd7d715e3059b24f gas/testsuite/gas/mcore/allinsn.d -3f84389ae5d2fa1891f6db5a66746c47 gas/testsuite/gas/mcore/allinsn.exp -0ee353f47d16db7430f79032977dc1af gas/testsuite/gas/mcore/allinsn.s -537103a0821acc23c643173a5b44062a gas/testsuite/gas/mips/break20.d -9c3689024c183a4b37014fce89d4c0eb gas/testsuite/gas/mips/abs.d -93b8bd81a813fed709cc6b5639d4552a gas/testsuite/gas/mips/abs.s -74518b2a94faa95c13c4d18516e73a48 gas/testsuite/gas/mips/add.d -3aee944bf3dc58dded8dd88c0ef7e205 gas/testsuite/gas/mips/add.s -0cecb6450a4984efe4d9dc93d53bb71d gas/testsuite/gas/mips/and.d -31c4e7dfe6203941f0a009c79fe9aedb gas/testsuite/gas/mips/and.s -be2f88510c23cf738e68b90ba8ed4984 gas/testsuite/gas/mips/beq.d -0c68387d4560df31811cf1a8acbc2958 gas/testsuite/gas/mips/beq.s -44bb49c8b2818b785c9ad7d0dec45df4 gas/testsuite/gas/mips/bge.d -eca0c74d018c0e56f81d49381b5f9a6c gas/testsuite/gas/mips/bge.s -c4faa565be53610538b153932918c3c0 gas/testsuite/gas/mips/bgeu.d -5a9a9ba8716b251c9b6aea9a9ddfed78 gas/testsuite/gas/mips/bgeu.s -588722af7a657b70b24f95c275fb2939 gas/testsuite/gas/mips/blt.d -e28cc53eef33d048effa03ff1d696991 gas/testsuite/gas/mips/blt.s -c7725bfac64a9dd54047de1f24f4106d gas/testsuite/gas/mips/bltu.d -08821d562fd1d36b49bb73ec19a1b818 gas/testsuite/gas/mips/bltu.s -01e30fca71ae643c6acb0e4c3d579f1c gas/testsuite/gas/mips/break20.s -dd381a80a3175c0433c2778e559e66f7 gas/testsuite/gas/mips/delay.d -f8386c3523ad68825b3b91215e3ce856 gas/testsuite/gas/mips/delay.s -6ce614bbef53b14bfaae9d392f25d8e4 gas/testsuite/gas/mips/div-ilocks.d -e18c56b9627325cb9dfc2fb280a822a1 gas/testsuite/gas/mips/div.d -6da8cc8418138e9b9ee39ac970e437da gas/testsuite/gas/mips/div.s -e86f1ff9069e89abc5f1398f3c2537ba gas/testsuite/gas/mips/dli.d -89a3d7e768db094a0b11ede7bfca879d gas/testsuite/gas/mips/dli.s -e66f7bf10e7ba1ebcee5676a941b05f8 gas/testsuite/gas/mips/e32-rel2.d -f578f2ded6569ab283de19d512a81cdb gas/testsuite/gas/mips/e32el-rel2.d -ed701440c13f9150f1e0048ee440e710 gas/testsuite/gas/mips/elf-rel.d -eb8cd56831349b3482483c425b481301 gas/testsuite/gas/mips/elf-rel.s -d2a5c89ee0e80dc9e0bc21bb0e30c063 gas/testsuite/gas/mips/elf-rel2.d -f7a0c6062a5a8fe838e93a14441b72bc gas/testsuite/gas/mips/elf-rel2.s -a43901f3dcf1dd5a64c0fd2c23f20f7c gas/testsuite/gas/mips/elf-rel3.d -bed8097caa447a2852d225642aed4711 gas/testsuite/gas/mips/elf-rel3.s -6531d00a109f1e0829eda1178a1b886a gas/testsuite/gas/mips/elf_e_flags.c -6bbeff5a2159c064f18894cc7bd9b7ef gas/testsuite/gas/mips/elf_e_flags.s -4da3a439698c64eaff4bd734ce0c63c4 gas/testsuite/gas/mips/elf_e_flags1.d -f5171663be58260ab0f111c9a75b4bca gas/testsuite/gas/mips/elf_e_flags2.d -9aa4cb59fdd9f8957c758e5bbc51b7d4 gas/testsuite/gas/mips/elf_e_flags3.d -bd5416cb0030cdc4871db84d061ff5c6 gas/testsuite/gas/mips/elf_e_flags4.d -50e4a37ba95ae53c1e082de05669c17a gas/testsuite/gas/mips/elfel-rel.d -4a0d4da918ec2b87774c61b0ac676833 gas/testsuite/gas/mips/elfel-rel2.d -162ad232f56d6e4900c815de5cdaf845 gas/testsuite/gas/mips/elfel-rel3.d -2fd3b92c729abb0ea1523ccf238b5025 gas/testsuite/gas/mips/elfel-rel3.s -b1d5e0f6b6bf2a8981fc5cf052b4a312 gas/testsuite/gas/mips/empic.d -749cf53f3155f1f122aa79bf71ccacbc gas/testsuite/gas/mips/empic.s -b47234477b017d8640d0a583d17b44cb gas/testsuite/gas/mips/itbl -3be9cfa967f82e0b4325b152baf0f23a gas/testsuite/gas/mips/itbl.s -f749ed9a6daa0dcdfd342b2a75b42e76 gas/testsuite/gas/mips/jal-empic.d -21fcb5fb003bdd5da6023ae14ddf8136 gas/testsuite/gas/mips/jal-svr4pic.d -644da8eaec6c846730e2b965a6fb0e39 gas/testsuite/gas/mips/jal-svr4pic.s -fc6fd411b87de4fe1e4103bdfda61933 gas/testsuite/gas/mips/jal-xgot.d -027b54f716266d307c80de2320fcf930 gas/testsuite/gas/mips/jal.d -2a9d8534b670ee90e9212ab2a706cf87 gas/testsuite/gas/mips/jal.s -5ae53c3943254fdd8222308abb126d38 gas/testsuite/gas/mips/la-empic.d -e9c696756945df68acdf916951943741 gas/testsuite/gas/mips/la-empic.s -cbdace2f18d6d189af31230093ca5e3c gas/testsuite/gas/mips/la-svr4pic.d -68a536a51395e0081f92221ec4cb61e8 gas/testsuite/gas/mips/la-xgot.d -6705c5e988e1c2a99690af6dda603789 gas/testsuite/gas/mips/la.d -f479612dc60112156a66a5292a60b205 gas/testsuite/gas/mips/la.s -0417463ce8f1bbac44b82e9a09f58321 gas/testsuite/gas/mips/lb-empic.d -b941d24b4746291a2fe361540766913b gas/testsuite/gas/mips/lb-pic.s -1f66be9b27c8016b848e92a9acd96d5d gas/testsuite/gas/mips/lb-svr4pic.d -2f5e8e5ef8600d736cb629afe7485528 gas/testsuite/gas/mips/lb-xgot-ilocks.d -d9289421eb691d41e325b6dd6a18c1ae gas/testsuite/gas/mips/lb-xgot.d -b9b03ce62abe797e2aef0c820265c772 gas/testsuite/gas/mips/lb.d -e9d35a3d0cdd51294a858378d467574d gas/testsuite/gas/mips/lb.s -5120a014142934b9ec8957e5744a3260 gas/testsuite/gas/mips/ld-empic.d -767e91de3b9f92ce2a668642a2ea2fbe gas/testsuite/gas/mips/ld-ilocks-addr32.d -7cec7e938337dca05a5f45ca501cae66 gas/testsuite/gas/mips/ld-ilocks.d -3e1c4e9e2e45a90c704db383f9551b8a gas/testsuite/gas/mips/ld-pic.s -bdb41be78c421144777ffd68ce9cc12a gas/testsuite/gas/mips/ld-svr4pic.d -30530f8ed4203f0e6335f1f4af66c0ed gas/testsuite/gas/mips/ld-xgot.d -49b44c3c7b60070dfbdd9c8b2f3954ea gas/testsuite/gas/mips/ld.d -8b08d1b9548f0a0ece2cede37c07ec87 gas/testsuite/gas/mips/ld.s -1969dda2d40fff88c811833cd9ae5f51 gas/testsuite/gas/mips/li.d -b5df74ea9e934e9bf65cd0bba8eac411 gas/testsuite/gas/mips/li.s -9dbe0e03a5386d5721ff8fc5391dab33 gas/testsuite/gas/mips/lif-empic.d -3f909a73d3a8fcdb607e4cc27437766a gas/testsuite/gas/mips/lif-svr4pic.d -7005137e25034def6329f2f60e0996fd gas/testsuite/gas/mips/lif-xgot.d -24416fc0940341f36bc025aefc05c604 gas/testsuite/gas/mips/lifloat.d -a0a03d60c7fdb7e812a9f97325945910 gas/testsuite/gas/mips/lifloat.s -642de403c1e77713b324b2a165adf6f8 gas/testsuite/gas/mips/lineno.d -c2034fba9031ad7f3bc0a1128ae6198f gas/testsuite/gas/mips/lineno.s -b9be97c1aa73ebe314f85ce9890aa75e gas/testsuite/gas/mips/mips.exp -a9a10694a9e4101fc40f1b5fa6d8d999 gas/testsuite/gas/mips/mips16-e.d -4785c49a602347865df48551df7121fc gas/testsuite/gas/mips/mips16-e.s -0d9982c499e97a5f2a40d9b592586193 gas/testsuite/gas/mips/mips16-f.d -7146e7075936aa4a1434864cf7bf6d4e gas/testsuite/gas/mips/mips16-f.s -97b3d39a4f90d82f4d405ac12f4d5e72 gas/testsuite/gas/mips/mips16.d -a686ad0a2da9fe043d717c57b4580d0b gas/testsuite/gas/mips/mips16.s -15f633e687d2e28e792496ad3cb4dc4c gas/testsuite/gas/mips/mips32.d -9f4640a5a47e4b1a26a968bc837de82a gas/testsuite/gas/mips/mips32.s -282d43dd59cb14d4ee715f2131946725 gas/testsuite/gas/mips/mips4.d -1d91653bf695ab6b54caf527440eb0b2 gas/testsuite/gas/mips/mips4.s -f35695633c08bea813f1c5da947c770c gas/testsuite/gas/mips/mips4010.d -cd49d59fb8e9057e6313f5ff630015b9 gas/testsuite/gas/mips/mips4010.s -3fadda766878ce990b5372bc2d1096d5 gas/testsuite/gas/mips/mips4100.d -957bb8b99fce311beffd2fe9f3a0eddc gas/testsuite/gas/mips/mips4100.s -1e6151ac3b3ac15d2556fd22174e2a29 gas/testsuite/gas/mips/mips4650.d -5c10900661e0928e9a340c3c925418b1 gas/testsuite/gas/mips/mips4650.s -0b85782f82b845c698359f73731196c5 gas/testsuite/gas/mips/mips64.d -4929310e699e0e1ac8bc28e44030ebff gas/testsuite/gas/mips/mips64.s -d54d4a935c5a458282d8b82f7a890831 gas/testsuite/gas/mips/mipsel16-f.d -56c7733ca5f7e921738b527a5f447964 gas/testsuite/gas/mips/mul-ilocks.d -0b2e9dc8e1a3454098fd8fb66651fc5a gas/testsuite/gas/mips/mul.d -03190409f6e3f76c2b66c8ab590d10bf gas/testsuite/gas/mips/mul.s -24250759fab3a88ba80dc09edff83f78 gas/testsuite/gas/mips/nodelay.d -c46536d17d5ebad3eee458a52073330b gas/testsuite/gas/mips/rol.d -5f8fefb5bda995779109a3d959bc071f gas/testsuite/gas/mips/rol.s -d4c27ce7dd87092e695e4df919a7ef61 gas/testsuite/gas/mips/sb.d -15410af41b16b3678e11c8c7d4d6d7a7 gas/testsuite/gas/mips/sb.s -5d3f8be0295dfe3afa394af2d492190b gas/testsuite/gas/mips/sync.d -ffcef95bbefaf3a59e62285fe39bda76 gas/testsuite/gas/mips/sync.s -bb8eff4fb1f49d667833720ec1ed1a45 gas/testsuite/gas/mips/telempic.d -d7d31ccd74befcdad7317366421d5329 gas/testsuite/gas/mips/tempic.d -7ac6d404e2e9d57ca4cd51e929b836fe gas/testsuite/gas/mips/tmips16-e.d -f02641e647b4b68646fe54322af84d5f gas/testsuite/gas/mips/tmipsel16-e.d -a9f05cfa4f3975b1ec93ee3cc56561ec gas/testsuite/gas/mips/trap20.d -f7d1e998d2057f17dfa22040879794f5 gas/testsuite/gas/mips/trap20.s -0b9071247431c2b789835f4dc4ec45ec gas/testsuite/gas/mips/trunc.d -6206de0006f0d3b3552c2c4de6d4d40c gas/testsuite/gas/mips/trunc.s -e5f5b974d0da7c046bb033afcf60fc48 gas/testsuite/gas/mips/uld.d -4dfc3d5c85518711401b4a15122c6cea gas/testsuite/gas/mips/uld.s -ea3815f56ffded46b428ff097414aa19 gas/testsuite/gas/mips/ulh-empic.d -42668d2b953e17216dad9ff5b51a11b8 gas/testsuite/gas/mips/ulh-pic.s -5158cd2e3607a2a5db193c8407f2b383 gas/testsuite/gas/mips/ulh-svr4pic.d -ed27ca0c51a00192b6d32d81a354aa2a gas/testsuite/gas/mips/ulh-xgot.d -4c374b4e6113d1add0a7b267949a1bf0 gas/testsuite/gas/mips/ulh.d -d4c1e8e91b66176d0dd73baa903929d9 gas/testsuite/gas/mips/ulh.s -8a640531f9842fac05e6a906e0cd4e33 gas/testsuite/gas/mips/ulw.d -ed019962f9d9264d80ac0a3ec29faaf3 gas/testsuite/gas/mips/ulw.s -ab4867894e361a5bd27a784519eabced gas/testsuite/gas/mips/usd.d -c4f723634a0f69013515468922c55a04 gas/testsuite/gas/mips/usd.s -f0fac62ab8f363574dc13b6b5b43ec5d gas/testsuite/gas/mips/ush.d -fa20601e0c404bd38a90edf5f43077bb gas/testsuite/gas/mips/ush.s -3c18be69c1508086bc845c86099ddab6 gas/testsuite/gas/mips/usw.d -59b429c3b2d1ea0daf2377204cbdfdca gas/testsuite/gas/mips/usw.s -b00b8e50d58ac967e8e84c9dc8df9075 gas/testsuite/gas/mn10200/basic.exp -c58581edb3ac95b306f040bbc2c16678 gas/testsuite/gas/mn10200/add.s -b117e36f812c2eb416156d441f26185e gas/testsuite/gas/mn10200/logical.s -9411b8190fac3aad748696ea30bba5b0 gas/testsuite/gas/mn10200/bcc.s -efa2232339233fab01e2fe7ca6c2f3cf gas/testsuite/gas/mn10200/bccx.s -aabf4d8010190b4ebadb4d4dce938282 gas/testsuite/gas/mn10200/bit.s -3f51363ea969316f726dc5529904888e gas/testsuite/gas/mn10200/cmp.s -874b6bc0f155eecbaffecb93a5642416 gas/testsuite/gas/mn10200/ext.s -1ff17a9ade34cc243a67f4e5afb1873e gas/testsuite/gas/mn10200/muldiv.s -ea8599975d89b01f9aaba3b664947565 gas/testsuite/gas/mn10200/mov1.s -3386b14210f3cd873dde20c6166162c6 gas/testsuite/gas/mn10200/mov2.s -a0b70b1cc9ec5e2783428dcc483ee86d gas/testsuite/gas/mn10200/mov3.s -6e62837e492b9688e29de9625549b402 gas/testsuite/gas/mn10200/mov4.s -e37e1b13a06659d005a650675dcf3935 gas/testsuite/gas/mn10200/movb.s -f6ce44141165b449c3cb51ebe486e98e gas/testsuite/gas/mn10200/movbu.s -32dfde7ae5c5361c03c746481b7aee8d gas/testsuite/gas/mn10200/movx.s -723c642cba806a6ce6dda8c3881ef233 gas/testsuite/gas/mn10200/other.s -21b9f1644f5a62fdc603b218708648f3 gas/testsuite/gas/mn10200/shift.s -7ac2864fac53b6b778c4aba3efb1a2e1 gas/testsuite/gas/mn10200/sub.s -3c5d635c4e529ba743b2062006ab8a00 gas/testsuite/gas/mn10300/am33_2.s -02ba050389aba06e510285db97af882b gas/testsuite/gas/mn10300/add.s -3bb44c38f4fbab75c570123d255c57f8 gas/testsuite/gas/mn10300/am33.s -dfe221c89fe65738a2360f231c2b6794 gas/testsuite/gas/mn10300/am33_3.s -593bbef9992d2f23b91f4ea176b28957 gas/testsuite/gas/mn10300/am33_4.s -62ae8325beee2a8180a39e125355ba2b gas/testsuite/gas/mn10300/am33_5.s -90dcb58c5eb364963271d465adac73ef gas/testsuite/gas/mn10300/am33_6.s -ae77079066eabaa0cc3b0db53f95500b gas/testsuite/gas/mn10300/am33_7.s -631a649907d27d317cee70928c6c27fc gas/testsuite/gas/mn10300/am33_8.s -04890830259a2f960fa1ef6f2d344ee8 gas/testsuite/gas/mn10300/basic.exp -9411b8190fac3aad748696ea30bba5b0 gas/testsuite/gas/mn10300/bcc.s -b15e3790182c7ba25b21a4185f2a55e6 gas/testsuite/gas/mn10300/bit.s -647a9c89d56b470cb3fef7839a32834d gas/testsuite/gas/mn10300/cmp.s -3828018d3809076328223d9d3c1e48c5 gas/testsuite/gas/mn10300/ext.s -f6db4622ff4a88bc9ebf44aec56bc245 gas/testsuite/gas/mn10300/extend.s -f2b5260884e40bc35f8694403da505f8 gas/testsuite/gas/mn10300/logical.s -d3d15560536638ff0e38a1cd6bea678a gas/testsuite/gas/mn10300/loop.s -e554261a6559698fe2722b841dd1b5e3 gas/testsuite/gas/mn10300/mov1.s -1453d74ea0d60c24e054f9443aa26fe4 gas/testsuite/gas/mn10300/mov2.s -8d091f8bc50686881c4104f6dc9b6ab7 gas/testsuite/gas/mn10300/mov3.s -e5df57ebcca23c27b6c2399780e9a146 gas/testsuite/gas/mn10300/mov4.s -384122880cfa3e6fa4a8b08c350c62a8 gas/testsuite/gas/mn10300/movbu.s -075a3ba2756f3cf09ac1926492ccf614 gas/testsuite/gas/mn10300/movhu.s -155d5bd225998f0bf8a65d543230adc5 gas/testsuite/gas/mn10300/movm.s -aa222b2f903cde208e2be8c3972e3c8a gas/testsuite/gas/mn10300/muldiv.s -9cbe29313848966be970cdecdc09e7b2 gas/testsuite/gas/mn10300/other.s -293fa500fcb2e85940176a545801b046 gas/testsuite/gas/mn10300/shift.s -ed9edfd6a0eea176f6974376bd321b10 gas/testsuite/gas/mn10300/sub.s -961a51d51720b650cb383a6aa510d4d9 gas/testsuite/gas/mn10300/udf.s -4b259d611c94c789b73572d5b0863a5b gas/testsuite/gas/mri/comment.d -5ffc5b9af8cd82e8ff721a39d583a9cb gas/testsuite/gas/mri/char.d -016f8a629209b7d7313c4a4e3c37c909 gas/testsuite/gas/mri/char.s -84c565776c727a1f5986b5d8d39ba13e gas/testsuite/gas/mri/comment.s -aca62962ea755bbc1aaeb56b32c53974 gas/testsuite/gas/mri/common.d -7b6bfc157de809b518bb8820f293f78c gas/testsuite/gas/mri/common.s -c3db4a831aaf5f148abfde517fff14f2 gas/testsuite/gas/mri/constants.d -df9ad2212b59618793c7080d043c14e4 gas/testsuite/gas/mri/constants.s -2258c0445fb6b2005828c77b96c0520a gas/testsuite/gas/mri/empty.s -78ea402a49a07c1a325a03a28be37678 gas/testsuite/gas/mri/equ.d -83843a1d515852848a6fc1054a984792 gas/testsuite/gas/mri/equ.s -ceec8399c07b39bee0a4ea07eece6d2f gas/testsuite/gas/mri/expr.d -21255a47a57f7e00246072b10af9b641 gas/testsuite/gas/mri/expr.s -bc4dc43acfdddf49f994908c7e26abe6 gas/testsuite/gas/mri/float.d -4f7756364607bd924587f3689b8b16b7 gas/testsuite/gas/mri/float.s -2e7a0a8ee1508d01e6532c6c6c7b11b1 gas/testsuite/gas/mri/for.d -70d33f74b91d862f9f9b6c4dd173ce58 gas/testsuite/gas/mri/for.s -75333d0367e1162e0f31471a7731fbf5 gas/testsuite/gas/mri/if.d -ba2ce35b0663f91570cc0725695f2f0f gas/testsuite/gas/mri/if.s -4b03ed946465a72d469e2aeff2ddd6f5 gas/testsuite/gas/mri/immconst.d -f1f5c0c93c39409b9a82cf956d42e39e gas/testsuite/gas/mri/label.d -ed17ca77ec65b8492a436ad06a222487 gas/testsuite/gas/mri/label.s -31e12f9de66d36f631e1883a3f763077 gas/testsuite/gas/mri/moveml.d -4e57586c117d02856b0a1e2fe1e199cb gas/testsuite/gas/mri/moveml.s -6f90672446c28d52cef0a7a5ce335254 gas/testsuite/gas/mri/mri.exp -4f6263a77a91affd2a0cd34b177000bd gas/testsuite/gas/mri/repeat.d -1684df3330c24639ae41d526858b2a80 gas/testsuite/gas/mri/repeat.s -67ebccbf76d5002534361af491abfddf gas/testsuite/gas/mri/semi.d -da1cdabe1af1adb9735d5d609dccca32 gas/testsuite/gas/mri/semi.s -bf93368342190b86a250e95b9de09d8a gas/testsuite/gas/mri/while.d -cdd1ad74d4bb0147f32931b83c7383be gas/testsuite/gas/mri/while.s -f3a7124485548781ba12a81c18199e29 gas/testsuite/gas/pj/ops.d -308d2177ed3b3b087d977e46c924fc0c gas/testsuite/gas/pj/ops.s -a6667ed6fc7b116477f95ef897bc5444 gas/testsuite/gas/pj/pj.exp -96a9890816c6c3314d3862d35fe59f3f gas/testsuite/gas/ppc/astest.d -5254d1fc440f434a46e97eb96b2735c1 gas/testsuite/gas/ppc/astest.s -b9b4926634e4c4e6e812b47b38a2f84b gas/testsuite/gas/ppc/astest2.d -9ae09fa391c3aa343824a7745551b28e gas/testsuite/gas/ppc/astest2.s -318ca470fd4b138732e4907c229b9bf6 gas/testsuite/gas/ppc/ppc.exp -d2e3625ca66a7c30b9270f806c67c877 gas/testsuite/gas/ppc/simpshft.d -0fc9ce29053c855d0a3abe241d93c961 gas/testsuite/gas/ppc/simpshft.s -f32ff8e646f5d0e0fbc6ecb76c4682e5 gas/testsuite/gas/sh/basic.exp -83d353a7646413b74d2087aa22fae13b gas/testsuite/gas/sh/err-1.s -495cac29a4993f28c4782ef285228c38 gas/testsuite/gas/sh/err.exp -70b8c1e3f6395cf992292993dcbdf601 gas/testsuite/gas/sh/fp.s -4b815d3da1c2d2bceeb98994c659c492 gas/testsuite/gas/sparc/membar.d -392efaa6637a8734d3ab35e579615a53 gas/testsuite/gas/sparc/asi.d -8f35c68aef641d7cc35698d67a32557e gas/testsuite/gas/sparc/asi.s -521b5671f3aa6bae70f78b5f3d37de1a gas/testsuite/gas/sparc/membar.s -12b5e618325d4a4bc80cb8766bbfc064 gas/testsuite/gas/sparc/mism-1.s -706c79f848f389921b20f0f64dde1ecd gas/testsuite/gas/sparc/mismatch.exp -d85c226fa388a66bd2689ba3efedf5e4 gas/testsuite/gas/sparc/prefetch.d -0b615422f6c8ad3fe5c42f2a8c7af1e4 gas/testsuite/gas/sparc/prefetch.s -9c7bc5ce86d96a964c5c7f02d43db0da gas/testsuite/gas/sparc/rdpr.d -09f5e33dbd927c548c928b9db9f14fe0 gas/testsuite/gas/sparc/rdpr.s -78517d2fce6c7707fd2f09689ebc3d72 gas/testsuite/gas/sparc/reloc64.d -7d56aec0e050e09c004a33abd25a9293 gas/testsuite/gas/sparc/reloc64.s -08afa18cf165a3043a6b92153526c876 gas/testsuite/gas/sparc/set64.d -1facb5655fe83c44ac900776c563e717 gas/testsuite/gas/sparc/set64.s -59861c3ea98eff8780189bc79824a7b4 gas/testsuite/gas/sparc/sparc.exp -3564e46bcf53613a512e32f2633c3d05 gas/testsuite/gas/sparc/splet-2.d -69817b445f39a0e3cf591de872fa74e5 gas/testsuite/gas/sparc/splet-2.s -5fa3fb7a059f3fd315df0af21e0c9619 gas/testsuite/gas/sparc/splet.d -6236b0423a317e0a2340bdb317c54d1e gas/testsuite/gas/sparc/splet.s -a6b1a41bb26dc70e130bc42ef7133cc7 gas/testsuite/gas/sparc/synth.d -0e0dead95b89c31c1ed49b21c430bc1a gas/testsuite/gas/sparc/synth.s -b041cafa83c1f1f131ca949780217e54 gas/testsuite/gas/sparc/synth64.d -0303005116e0116e28f1dd473ca39f28 gas/testsuite/gas/sparc/synth64.s -8f196520d2f35fd1890df94723f6aec3 gas/testsuite/gas/sparc/unalign.d -1eeb1d4db023af72c50e896a4bb90638 gas/testsuite/gas/sparc/unalign.s -10dd2c15d6932af5f1203d03fbc6dae6 gas/testsuite/gas/sparc/wrpr.d -d44c4548a463c3e491d6fdaaa0f20177 gas/testsuite/gas/sparc/wrpr.s -f65f40edb42735b8af3a4baaacd662f5 gas/testsuite/gas/sparc-solaris/addend.exp -7dd4467acc1dda3c1753ebcbfeeead33 gas/testsuite/gas/sparc-solaris/addend.s -dd2ab79e6bd90288569274206313966b gas/testsuite/gas/sparc-solaris/gas.exp -b2d813e248b8ec085ca8d551271274bf gas/testsuite/gas/sparc-solaris/sol-cc.s -2e927e8072e145441bb882a01e3ac8cd gas/testsuite/gas/sparc-solaris/sol-gcc.s -54a6b727f437bf7989e266329d0dd875 gas/testsuite/gas/sun4/addend.d -b648f70387617b14507805caeea0b6d6 gas/testsuite/gas/sun4/addend.exp -7dd4467acc1dda3c1753ebcbfeeead33 gas/testsuite/gas/sun4/addend.s -8d19328fb89c3001a897cbf2f4f3b92d gas/testsuite/gas/symver/symver.exp -f942ca1487fba1e0fa62d14b0f2cca1d gas/testsuite/gas/symver/symver0.d -7f2d42503901978e4eb5bab37fd01df2 gas/testsuite/gas/symver/symver0.s -711847708837ed39c80fa62ab704b649 gas/testsuite/gas/symver/symver1.d -1d6eb4d5a6cbf6ac541ca7d4c561b74f gas/testsuite/gas/symver/symver1.s -b44c04d7f2b689d60bccae544b854f95 gas/testsuite/gas/symver/symver2.l -7214f11688ed0284f53c3c060fa973bf gas/testsuite/gas/symver/symver2.s -d37568e052e76a50c9d4775eede01585 gas/testsuite/gas/symver/symver3.l -7f58a39bd0e6eda06fa15260adaa1044 gas/testsuite/gas/symver/symver3.s -aaf2746f913c7c81f487786bd9b99543 gas/testsuite/gas/symver/symver4.l -ff40f84c77b398ca408422048eb1684e gas/testsuite/gas/symver/symver4.s -c2401f7310b24ae252e1905a90fbb133 gas/testsuite/gas/symver/symver5.l -ed56c563fc819e4c50c4160a17f8abae gas/testsuite/gas/symver/symver5.s -a3a92a55022c0edb85d34af1d1739ee8 gas/testsuite/gas/symver/symver6.l -73c983230d1435795774501e7247e78c gas/testsuite/gas/symver/symver6.s -06219e9948de26c5c3c06e783256d8e5 gas/testsuite/gas/tic54x/address.d -78c05303f9f0cbc1a4610cafd8684961 gas/testsuite/gas/tic54x/address.s -fb347ccf07d51593edd432f687aa5376 gas/testsuite/gas/tic54x/addrfar.d -25c170a2e98a7b134c9d90c32965c1b3 gas/testsuite/gas/tic54x/align.d -59a3b1b5bc5d51e4f20df8ea41128d88 gas/testsuite/gas/tic54x/align.s -6b7b3e8e956870e9d7ce471e2a1b6ebf gas/testsuite/gas/tic54x/all-opcodes.d -16b138265d758ee38dbf89a41696f4b4 gas/testsuite/gas/tic54x/all-opcodes.s -6ed8469e573b882990ad930cd270b1b1 gas/testsuite/gas/tic54x/asg.d -64c9ec95e386f8e5d0040c26fee7321c gas/testsuite/gas/tic54x/asg.s -fcd7df0d00621d5b547d92bd23c4ca62 gas/testsuite/gas/tic54x/cons.d -671f83be79acf4e42032f33d828864ac gas/testsuite/gas/tic54x/cons.s -2f04f28d19f65600c0958cf168558a6d gas/testsuite/gas/tic54x/consfar.d -f29bcaee02fc92a68ccfdd32f6999527 gas/testsuite/gas/tic54x/extaddr.d -7eae8033cffbecce992afdaa9c339ff6 gas/testsuite/gas/tic54x/extaddr.s -953d25fcac101a1860be2b36bb61ec50 gas/testsuite/gas/tic54x/field.d -534ff025c4a332a0b3a4811c889d9637 gas/testsuite/gas/tic54x/field.s -e8334221e9d81711a8120983fc654f4b gas/testsuite/gas/tic54x/in_mlib.asm -6b81ff294df52cc2ee0cde1d128f3253 gas/testsuite/gas/tic54x/labels.d -aae9f04acb5f59969bf1f0465d7c78bd gas/testsuite/gas/tic54x/labels.inc -b745801cf3d0eb59ca1b1a583e26a0b1 gas/testsuite/gas/tic54x/labels.s -28e2dc705290da3c4d7010494599f100 gas/testsuite/gas/tic54x/loop.d -4a609e1f44de00f164f48203d5df870b gas/testsuite/gas/tic54x/loop.s -eb2b6fc38f9bd4793dd7020a05122e3b gas/testsuite/gas/tic54x/lp.d -2c650e0c313376b80d7a6950039ff3b4 gas/testsuite/gas/tic54x/lp.s -c8161a6bcb529ab6c94cfa3a3521e429 gas/testsuite/gas/tic54x/macro.d -d76d2e7a0d946a16279b4eeafcfa0cc7 gas/testsuite/gas/tic54x/macro.s -09c277ba1f7d69551c473cd20cbb14bd gas/testsuite/gas/tic54x/macro1.s -ddbfc019917d779c19002992f3929367 gas/testsuite/gas/tic54x/macros.lib -7ad5a03901cc52759b77b30e51f34875 gas/testsuite/gas/tic54x/math.d -1ff7d6cd1fb20b8cde42e82ea5e38dfa gas/testsuite/gas/tic54x/math.s -aa3b0bac4ffdf82c7a4b6121ec3fc560 gas/testsuite/gas/tic54x/opcodes.d -03c7d9751c849b0f4a04ce24d181e494 gas/testsuite/gas/tic54x/opcodes.s -d1f6def2d5b9c1a697baaa24128bc192 gas/testsuite/gas/tic54x/sections.d -4c9b7302923b60d63cd64bee9dd621d5 gas/testsuite/gas/tic54x/sections.s -41deec8226f138d357d5a06609ff7c1b gas/testsuite/gas/tic54x/set.d -cdf1f13fafc4d4abd831567cdda40eff gas/testsuite/gas/tic54x/set.s -cdf7f966b14c2ae2815b55e4b6eaa023 gas/testsuite/gas/tic54x/struct.d -28bcc7e09d20e59e1ccb70e318f45324 gas/testsuite/gas/tic54x/struct.s -3a49bc7e30027613e26e13d25b7f5dbd gas/testsuite/gas/tic54x/subsym.d -a6d4e40952285da31a31a7146766dc04 gas/testsuite/gas/tic54x/subsym.s -a3547e6b13dd61f04ad639ae18c38bb3 gas/testsuite/gas/tic54x/subsym1.s -b2df4dd8056e7236407bbc4c60b27b02 gas/testsuite/gas/tic54x/tic54x.exp -f3ab69523e22267482a9bb7a4ca35543 gas/testsuite/gas/tic80/align.lst -bed809ed517aeb7c1246209c7f5b0ede gas/testsuite/gas/tic80/add.d -98eb432f2b3667f4172bc7bf8279fae8 gas/testsuite/gas/tic80/add.lst -126505861238887b38542c2c007b4f44 gas/testsuite/gas/tic80/add.s -26a1a236ac7ccef8f9d5ae9f771a1e15 gas/testsuite/gas/tic80/align.d -e184de59b384a0b61f611f43fd0481db gas/testsuite/gas/tic80/bitnum.d -0bd85a81ad6b84115fb27616eec5abd5 gas/testsuite/gas/tic80/align.s -4e8424d297ee11749b57a2dec2bfd7be gas/testsuite/gas/tic80/bitnum.lst -8670ee2178617d2fab1746489ec22609 gas/testsuite/gas/tic80/bitnum.s -4d4729704be4f2a668a5b8f589fc6922 gas/testsuite/gas/tic80/ccode.d -ee5b688ae7df591cadc29f06f26845a0 gas/testsuite/gas/tic80/ccode.lst -2b9858d4ebadb84b9197d33ccc1422e1 gas/testsuite/gas/tic80/ccode.s -7a715f4871362014afea0032c8ab1bde gas/testsuite/gas/tic80/cregops.d -74aaf84be9651b7d468afe9d57016a6d gas/testsuite/gas/tic80/cregops.lst -ef4ba470d30ac045a040677b704ffc66 gas/testsuite/gas/tic80/cregops.s -626d4a37405c1c8ebc93a7be21c2a9b0 gas/testsuite/gas/tic80/endmask.d -46833c7025b93bab36f855a40a5be3ce gas/testsuite/gas/tic80/endmask.lst -00643dd65f546646666046d4e2cfdef5 gas/testsuite/gas/tic80/endmask.s -6fa3699cda567401f6236547132b0d20 gas/testsuite/gas/tic80/float.d -f97907246c6a0d4370a3b08b1f7d6829 gas/testsuite/gas/tic80/float.lst -e9392428f1929a6f12c8d0c5bfc7d95c gas/testsuite/gas/tic80/float.s -924d1ef98e49d0d881d7936c76795f26 gas/testsuite/gas/tic80/regops.d -68f717e98126f6612a5fa278576ffcb1 gas/testsuite/gas/tic80/regops.lst -16bbb022a6816956f454d4f141d87b8f gas/testsuite/gas/tic80/regops.s -ff82220cf29c5cd876cb0ba8a495695a gas/testsuite/gas/tic80/regops2.d -207cc576c6c79969fe4510ae1c0fb1e0 gas/testsuite/gas/tic80/regops2.lst -0e21bec7cf7231f015d0890f3c60c750 gas/testsuite/gas/tic80/regops2.s -cab98129d538fef49483e468bea9cab7 gas/testsuite/gas/tic80/regops3.d -fb72f4fadb5605b36c53f5c798139907 gas/testsuite/gas/tic80/regops3.lst -dca27d2d5b2888ad207b35cbb5a5c1bf gas/testsuite/gas/tic80/regops3.s -4a437df1abe33ea3d6b4a744dd1b3c71 gas/testsuite/gas/tic80/regops4.d -d127941ee0d43b5f508f2e40744df9fc gas/testsuite/gas/tic80/regops4.lst -610f8fb61cc924958615f15cbd3fb591 gas/testsuite/gas/tic80/regops4.s -987bf57eb106e1f96eef6b5a8add52c1 gas/testsuite/gas/tic80/relocs1.c -96d6b8f21498eb373bcd7cf1c0438c0c gas/testsuite/gas/tic80/relocs1.d -1932c15229e0d07381c8f8cea548fd75 gas/testsuite/gas/tic80/relocs1.lst -db5aaea7f4cbc104391f2a92ac06f28f gas/testsuite/gas/tic80/relocs1.s -22e1b37d7fdb2c192a1203a5e71a7fad gas/testsuite/gas/tic80/relocs1b.d -e53f695a65c5ec81a507b69f66537d65 gas/testsuite/gas/tic80/relocs2.c -420fdeac1619d019ca440ea87663d870 gas/testsuite/gas/tic80/relocs2.d -04fecb799cbd9447e058e8d53ed75ff4 gas/testsuite/gas/tic80/relocs2.lst -5c763a74cae5be60ace2421226e27631 gas/testsuite/gas/tic80/relocs2.s -2c1dc022a0f215dae6dea890f28798d8 gas/testsuite/gas/tic80/relocs2b.d -d7d5f18226711cd03767a8e2538cdbef gas/testsuite/gas/tic80/tic80.exp -ce0fc256b576a00b3292ad52441d079c gas/testsuite/gas/v850/basic.exp -b3daff1073feeab915c5d25268ab1d71 gas/testsuite/gas/v850/arith.s -d33db5351243bff28f76ada8284737dc gas/testsuite/gas/v850/branch.s -fd5263cb3409650f6bb2e9b610eab2d9 gas/testsuite/gas/v850/bit.s -e3d311e55349338e4876c3711ed91c46 gas/testsuite/gas/v850/compare.s -986292c2ba21464166aa337ab580a139 gas/testsuite/gas/v850/fepsw.s -5f8e79e5bec30791f19218a7ad23040d gas/testsuite/gas/v850/hilo.s -f7d87df456dee97f2d28be5a29afde0a gas/testsuite/gas/v850/hilo2.s -36254aabdcf9005f2dd8e7fba47de388 gas/testsuite/gas/v850/jumps.s -ee5a6da54e89a759bccef5da2ce4747e gas/testsuite/gas/v850/logical.s -79263247214c7d46c383e26aafc74d31 gas/testsuite/gas/v850/mem.s -2db16d6b7c2aa2cc17e621ac1da852eb gas/testsuite/gas/v850/misc.s -8c5fd0446e831223f93adebecec8a2b2 gas/testsuite/gas/v850/move.s -90c3465d11f275837ad5b9cac2dd51c4 gas/testsuite/gas/v850/range.s -10e8b025bce8af1b59c395fc5799236c gas/testsuite/gas/v850/reloc.s -9dab247181eb9a6ca08677f2b567cec0 gas/testsuite/gas/vax/quad.exp -c36a2f8942f73fe7a5550ba90d2ecfd7 gas/testsuite/gas/vax/quad.s -1e191c0d4f723e71c2f4f44b14cfa942 gas/testsuite/gas/vtable/entry0.d -bb679f23724eed5be0d4524e7f14005c gas/testsuite/gas/vtable/entry0.s -0b1998d125aec2d1e508c646ac5da657 gas/testsuite/gas/vtable/entry1.d -bb679f23724eed5be0d4524e7f14005c gas/testsuite/gas/vtable/entry1.s -64f7daf21aa03263ec1f75c8b4ebbebe gas/testsuite/gas/vtable/inherit0.d -a37bd60d99eb2ada7ec2360039dc1b4a gas/testsuite/gas/vtable/inherit0.s -a90dff346874aeab5a7833b62a12e5db gas/testsuite/gas/vtable/inherit1.l -fcc7f1b5a640e5714a1bcd9d50df7979 gas/testsuite/gas/vtable/inherit1.s -1b1f9e422b1d90576fac2ffee6256a9f gas/testsuite/gas/vtable/vtable.exp -5c08b2b199bcea246a03344173d3f96b gas/testsuite/gasp/assign.asm -99deacf6e3a96c8e21a453709af6ca01 gas/testsuite/gasp/INC1.H -a926c95abb0d81a9a764bed20ca06f0c gas/testsuite/gasp/INC2.H -269356bda8c304ef47bacd331b4fc968 gas/testsuite/gasp/mri/embed.asm -fd5ca6b2f3c6e59aa7040e532f28600e gas/testsuite/gasp/mri/embed.out -6b8744910f78aef4b165e287973af04f gas/testsuite/gasp/mri/exists.asm -ac5385c093c3023ebc8370ef66cf3b41 gas/testsuite/gasp/mri/exists.out -ceadf5cddc8000502be2f2fbc24cabec gas/testsuite/gasp/mri/irp.asm -c41e38e1116c0009a93516f09e86f839 gas/testsuite/gasp/mri/irp.out -728e6db3e88d2ddb22e424fc2e404dae gas/testsuite/gasp/mri/irpc.asm -c4d925d7fdc60ddafa773c5b7830cf2e gas/testsuite/gasp/mri/irpc.out -bc9ea91fe33eea9993f7dd5b737cb880 gas/testsuite/gasp/mri/macro.asm -8bf5e77911c284a34bfdf9c3f34d9e49 gas/testsuite/gasp/mri/macro.out -7a68842c90401e4b34071449715e0f0e gas/testsuite/gasp/mri/narg.asm -87693669559588c329af7213cd9c487a gas/testsuite/gasp/mri/narg.out -d0af25ef7f1c265d961ee9e088cf8276 gas/testsuite/gasp/mri/rept.asm -e2065f7a89c27a29049327cf8e31b18e gas/testsuite/gasp/mri/rept.out -563a4800e8b40729415090306bce6554 gas/testsuite/gasp/assign.err -42447b48e38c0caa7934fe72d48f1724 gas/testsuite/gasp/assign.out -7e11017965ff9319ca614e437e3b269a gas/testsuite/gasp/condass.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/condass.err -e7bf1012067a2a9008084234aea5c23c gas/testsuite/gasp/condass.out -03ec63f9050b6d77982db47bd7216cda gas/testsuite/gasp/crash.asm -f92c854daee87f8949312ec1faf02864 gas/testsuite/gasp/crash.err -9f1a1ec87f3fcc35cf3ab8f943ee0f04 gas/testsuite/gasp/crash.out -70aced41deb34edfe61b2888a0f2d2b4 gas/testsuite/gasp/crash1.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/crash1.err -a23d7921aa2ba917503b2994e53ddf1a gas/testsuite/gasp/crash1.out -0a6ae29a56ebe74b4f93dc149949dbe5 gas/testsuite/gasp/crash2.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/crash2.err -d18e176c99fab5d444ef8ef98ef476c1 gas/testsuite/gasp/crash2.out -e8e046b711151d3439e06411493b6b67 gas/testsuite/gasp/data.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/data.err -dd5d6726c6d3ab3b244367d15e5a33a5 gas/testsuite/gasp/data.out -d3a831ce902a2c7a641807d41bf060b3 gas/testsuite/gasp/exp.asm -635e19beab5dc8dbda0faae105390da5 gas/testsuite/gasp/exp.err -3cfa517a87ee6808108dd82d821a9142 gas/testsuite/gasp/exp.out -d9840554d6f6404180190fb46ecfa609 gas/testsuite/gasp/gasp.exp -6952d6e84b8eff6f8ad3735049384d9b gas/testsuite/gasp/include.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/include.err -38f5ce2c3d1abd4c85cbae3381a35d00 gas/testsuite/gasp/include.out -b336cf59f3381637b0bbc85903836f49 gas/testsuite/gasp/listing.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/listing.err -d64ca2c01c09d852ee97d0b9e283f427 gas/testsuite/gasp/listing.out -2cbe9e11582b63f485413fb0c8d4882a gas/testsuite/gasp/macro.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/macro.err -3aeb89bd83e0cf8b84c7281b5191ba07 gas/testsuite/gasp/macro.out -8111773c73a99298c21c45704eb6fa11 gas/testsuite/gasp/mdouble.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/mdouble.err -fbfd85681f676ecec67e21d8aa571bf6 gas/testsuite/gasp/mdouble.out -a7284cd713fd12560f811939fc784860 gas/testsuite/gasp/pl1.asm -76cefca44793036ef20556314fdafadd gas/testsuite/gasp/pl1.err -266d215f1b5b7d6743c3bb75be698654 gas/testsuite/gasp/pl1.out -b67a3bb2f6c1256c5252c8f3b6e76bfd gas/testsuite/gasp/pl2.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/pl2.err -21bd454e41c190fc028359db94f60626 gas/testsuite/gasp/pl2.out -80cb3c666405f7145b2a385fc6e4dfbd gas/testsuite/gasp/pl3.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/pl3.err -089301edb4b459a59d61ffcfe7d709dc gas/testsuite/gasp/pl3.out -b8410781da6854955ede10668b40acb0 gas/testsuite/gasp/pl4.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/pl4.err -4344b2df49ee03937e0e6757e9546441 gas/testsuite/gasp/pl4.out -f0836880911e25120d0e919a3e3c9a6e gas/testsuite/gasp/pl5.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/pl5.err -531bce879bdb6df7858a251b2489548c gas/testsuite/gasp/pl5.out -214848f5a01f2721b749c0d6d179fc7a gas/testsuite/gasp/pl6.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/pl6.err -6c5154a2e0886aa2ed34040e9fe697c4 gas/testsuite/gasp/pl6.out -ed7dc7cdd7cba3f7d2bfd972654e741b gas/testsuite/gasp/pl7.asm -76cefca44793036ef20556314fdafadd gas/testsuite/gasp/pl7.err -2b0bfdec74d0f2d405f6dcaf11e9cb9d gas/testsuite/gasp/pl7.out -c2ec7a594dd444a867ccb269a255c592 gas/testsuite/gasp/pl8.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/pl8.err -a01ab58299b4bbda08c5a55e3152301d gas/testsuite/gasp/pl8.out -1b8fdb309983468765a0f26231b7db2a gas/testsuite/gasp/pr7583.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/pr7583.err -a29f353fa5f949d2eb12b499baf3bd0c gas/testsuite/gasp/pr7583.out -f94a30de39715bba6e11b2720e2a7a24 gas/testsuite/gasp/reg.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/reg.err -129ad1aea55cbd6afe5b5e44c433ee57 gas/testsuite/gasp/reg.out -6287f41f28e5d0a372bcec00489a1fcc gas/testsuite/gasp/rep.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/rep.err -0d497169dff397f2e446fe23b5ee981f gas/testsuite/gasp/rep.out -a91feea67b9afd9c2d123299e917cdb2 gas/testsuite/gasp/repeat.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/repeat.err -7fe9d715fbf1f3e90c282b69c8a388af gas/testsuite/gasp/repeat.out -a0420f1482401d14d10ef4d4c8da644f gas/testsuite/gasp/reperr.asm -76cefca44793036ef20556314fdafadd gas/testsuite/gasp/reperr.err -f4c30bc7915f5d47168f3b47094c1449 gas/testsuite/gasp/reperr.out -e042647132f714b19a98c4ab535fcf69 gas/testsuite/gasp/reperr1.asm -527eea9a7e1feaa36aee5f84c4691465 gas/testsuite/gasp/reperr1.err -5bde34ef89fa801ac3eaf1c59f7d4763 gas/testsuite/gasp/reperr1.out -b4b91fe28ecaa31df9618a2a4a9e2a76 gas/testsuite/gasp/reperr2.asm -443731a66bbfcc1831647071a681f5b1 gas/testsuite/gasp/reperr2.err -a9f1da65b7f9da6492a84ce6296970fa gas/testsuite/gasp/reperr2.out -f85e0a8deb6e54c906e2750b42d7cfd2 gas/testsuite/gasp/reperr3.asm -4eeca830592748b13cde26461bac739b gas/testsuite/gasp/reperr3.err -2f151098b19ade3dad0cbef222e86a5d gas/testsuite/gasp/reperr3.out -1b326c95c48895d14dba16c01e763bb0 gas/testsuite/gasp/sdata.asm -0c62f96d2af905dfa64eb1427a600c11 gas/testsuite/gasp/sdata.err -657f7bdf02673edba4a055158e9cb587 gas/testsuite/gasp/sdata.out -6b52ad9f5150dfabecadf59651b01012 gas/testsuite/gasp/sfunc.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/sfunc.err -3f5c6078bb1164493fd7d975fa78134c gas/testsuite/gasp/sfunc.out -c928b32a65029c49d6add1539b555a17 gas/testsuite/gasp/t1.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/t1.err -37921430797b568a3ac395ffdcd1030c gas/testsuite/gasp/t1.out -94f4985650874fa3f2223be2ca97a494 gas/testsuite/gasp/t2.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/t2.err -e63f0cf737dcecca010288e940156820 gas/testsuite/gasp/t2.out -0aa649aaacfcdbf138acd6302e51444b gas/testsuite/gasp/t3.asm -76cefca44793036ef20556314fdafadd gas/testsuite/gasp/t3.err -cb8d602227b2b4e0ee0cbc24905b1c92 gas/testsuite/gasp/t3.out -65f971bbfd23b3e6f4f256550fa6c999 gas/testsuite/gasp/while.asm -d41d8cd98f00b204e9800998ecf8427e gas/testsuite/gasp/while.err -a68b47ff34892c8fa97aaf9cc09bc975 gas/testsuite/gasp/while.out -133e9f8bb4d12ac7e498f0ac5d0246c0 gas/testsuite/lib/doobjcmp -5725f8e58e03bd6026f3e2721e1db22e gas/testsuite/lib/doboth -aad4965bf0067bf9fb71acc19f7877d4 gas/testsuite/lib/dostriptest -bdf5e4dee40167a92f0a45965b0375b7 gas/testsuite/lib/dotest -af650aab07403b5a05623713b613856f gas/testsuite/lib/dounsreloc -30764ced5c424e3c2c384059cbe2a227 gas/testsuite/lib/dounssym -5cbf6643d54a0c593fffc5eb026afd65 gas/testsuite/lib/gas-defs.exp -d78aaf1191d033531d00fa9888214ee0 gas/testsuite/lib/gas-dg.exp -499042a4448e4b2d3bd2b2a1b0b5d859 gas/testsuite/lib/run -c25a2b439faecdbc5a8cd011fb753f1f gettext.m4 -f830d343ce09eb11786979f2ce0bf68d gprof/po/POTFILES.in -bfb5c178c2404196ab54d7532a61e3d4 gprof/po/Make-in -ba1bcadd6275dd4ce7f7663645c967ac gprof/po/gprof.pot -b167dc5dcf583c07feecea0f8003e647 gprof/.gdbinit -8b210aedaec55d2d7d197fc9fd49e2de gprof/ChangeLog -d618facc3e8ce8bf3d02ba452e1be6ab gprof/MAINTAINERS -deef5e76f10703bf9ad39c89e1900111 gprof/Makefile.am -eb9abc12601593ac6521d4786a708b77 gprof/Makefile.in -55be9544e8fe419300921fa44a0aa692 gprof/NOTES -84c06350a03466660f0f691ed1220657 gprof/TEST -62728c5b834e3893e5414a8bae9a99d8 gprof/TODO -b33dab2d2e4ea1694e3d63ff4715142b gprof/acconfig.h -2e77183c94ff25e517327793c2db2e55 gprof/acinclude.m4 -245c5c6842c9a94a0e48a3d8deeebe75 gprof/aclocal.m4 -e778a923257c810d68dec13fd488eb17 gprof/alpha.c -56d1218121151f1e7557f69ea5241ea0 gprof/basic_blocks.c -ca39735906fdd30d5e4123366e064b55 gprof/basic_blocks.h -fb26efc191946b1c391604afbadfe436 gprof/bb_exit_func.c -67083749ab9eb7b9869f600e24046960 gprof/bbconv.pl -25e7c14a812ac2befca1efaba7326de3 gprof/bsd_callg_bl.c -cadeef23b67be4bb67efb8d51c426a84 gprof/bsd_callg_bl.m -c2d75700c52ecc745ba87093070c2415 gprof/call_graph.c -aaf334303399885b664cb82016829e9a gprof/call_graph.h -d2d5dc44d4751291a986e067fc8487ed gprof/cg_arcs.c -f4b4564ff4855580d031efb91d6b96c8 gprof/cg_arcs.h -d698389b5fb62def7dca627e691f69f2 gprof/cg_dfn.c -9763120b90a70649f8da911568b308fc gprof/cg_dfn.h -f38dbd64edd9486f1caf893b22dc17b9 gprof/cg_print.c -0982459c755ac5d97b53a306ec100aba gprof/cg_print.h -b8cefe113dfdf660fcf039d46fec1d84 gprof/configure -55653a53a4dc8a073937819596bacfeb gprof/configure.in -6124e24af0d750f7ad26144e2e549e25 gprof/corefile.c -69ca0d5792b82ef544c23d1ad975c43e gprof/corefile.h -fb7920a70d8eba8b94fd446da371604e gprof/dep-in.sed -b25cb6184818f6bb4dea4962b70ea3bb gprof/flat_bl.c -d6498bb2d3ec24087785cd109c215067 gprof/flat_bl.m -8929b59fb940ea7c3d784d48d652200d gprof/fsf_callg_bl.c -609bbce6f5cedf6b0c8d25c3061b582a gprof/fsf_callg_bl.m -82f03d11db14e68944e0afe9b989de7d gprof/gconfig.in -95f54ce5c8c2dab23e194640fcd4e7cb gprof/gen-c-prog.awk -9478de676b8aef7172f520c48c6e7b6c gprof/gmon.h -c9a6058973dc17f9603ec7302347c6db gprof/gmon_io.c -16cff2f007a3be70b454770aaa01e8e5 gprof/gmon_io.h -2911752bcbb7d22a193dcc22d3c8abed gprof/gmon_out.h -24d890c7d2b01bf70a015038155504a2 gprof/gprof.1 -180ebbeb622b3f0a7e6f2373b0f9c5f0 gprof/gprof.c -1f49635b9990b75a4f482f23f80639df gprof/gprof.h -fd4e33072a67b1aed065e8a56a681c01 gprof/gprof.info -7a0a344dee265ffc777fed1dac3f40fd gprof/gprof.info-1 -e0558f0ebe0660c2f99b60e45aa3b86e gprof/gprof.info-2 -4f5a8f8d3c765480e3926b416714bb8b gprof/gprof.info-3 -cd3f0020f31b79a9b3c26e7066d24550 gprof/gprof.texi -774dcfa219e6de263957873db9bb656a gprof/hertz.c -02cf975780e3e9ea8f94840e5e907513 gprof/hertz.h -3e1ff6771e7e61c5838928f2c549d985 gprof/hist.c -6926b0108166d8ad8581e568f9c82b3d gprof/hist.h -de5f7a6bc76456fcde059a4c496dcbef gprof/i386.c -a41c773603a5e194a6a96222a73da05d gprof/search_list.c -a0c5df87181a20319a478d8f4c6aad8c gprof/search_list.h -b4d532476731b57e44ba662fc0cded13 gprof/source.c -9a6fbf36a7ef053211da8d84411a00c4 gprof/source.h -fb1a645046a0682ea7c81a99c9d58504 gprof/sparc.c -1ded054093de910d9786c62bc4fe8cc6 gprof/stamp-h.in -0317be88177207a78e64a3ca49783604 gprof/sym_ids.c -c5d1c00631c1434a38b4d75c37996a36 gprof/sym_ids.h -abcb4dccea34be3939eb77be053c32d1 gprof/symtab.c -7bc5ed3a10d3698b36cccd7ab92ee679 gprof/symtab.h -c53db119688d6704d758ca2c264eadfa gprof/tahoe.c -33ade2a875836fa6fe418757473dbe3e gprof/utils.c -9174a73ed79e0d552e57d09390065985 gprof/utils.h -80e67bdaa5940b70f9dd3aa7d3e7c1d1 gprof/vax.c -056e5ad4bbaad338a99f25d1c82a6b54 include/ChangeLog -94d55d512a9ba36caa9b7df079bae19f include/COPYING -6514be18199969dce1c96374a8d2f48f include/aout/ChangeLog -cc18d2a17ec338312f00622e1fa4692e include/aout/adobe.h -a7ad447d7a0696596a330bbe0e1bf620 include/aout/aout64.h -c6b08000298f64bb35885212da785e44 include/aout/ar.h -0b3a71cdc523174aee63e9db7b093187 include/aout/dynix3.h -64818c4cc3aab586e47bc9daa57ed4e2 include/aout/encap.h -d56e5b7b7841033c99960c96365579c4 include/aout/host.h -5d9fed058c072b61553cf62174a8e37e include/aout/hp.h -3b82142ce45a3be868eb0eda0a107c47 include/aout/hp300hpux.h -d82993bf02befd5682dcd44b076ad991 include/aout/hppa.h -e91c2c24d9be7b5cbfa6047d799cb850 include/aout/ranlib.h -d06f0176a5098d444f22d53fabc7c2e8 include/aout/reloc.h -7ab3b77967f4eb33111904b27f0796a2 include/aout/stab.def -4fc8401a176b5d472bc2a60e1a0917ab include/aout/stab_gnu.h -f76759c6246b1e8376e84e0c1d8ef6bc include/aout/sun4.h -e8f3b123eb50e26e1d38ca5af44d9ba1 include/coff/ChangeLog -19860cc610e4a705a4706e96d21c3b83 include/coff/a29k.h -552fa1e45d76f2c7892c12472a3ac391 include/coff/alpha.h -3b46257336484efd619c1d349f26758f include/coff/apollo.h -24e7f4f443444e67f0cf849662f36f90 include/coff/arm.h -7b2f28b2e4bf9e88bb4a23a3e96e99f6 include/coff/aux-coff.h -c6d820306c035dd8dd33743a04701097 include/coff/ecoff.h -5ef1801dfbf3fd9d07b95d8e5a075438 include/coff/go32exe.h -aa8789afe1c0c03506bfe72b6d03e557 include/coff/h8300.h -71e1ab83c4f3edad768f13096af183df include/coff/h8500.h -9f42dbf0d95444bb422133f705ae5b50 include/coff/i386.h -c4f8a3ba91f77c4dafc810968584c027 include/coff/i860.h -10948521baf96106b8b1a493b76e6428 include/coff/i960.h -37b14ce150fc5efb823f8a24bf036917 include/coff/ia64.h -4b9d948ced9fa1991bc044284eda23a2 include/coff/internal.h -f2d5296a6f39f7cb8b11123dc2e9446a include/coff/m68k.h -2ec742a1917661fce2c9a968c67742cd include/coff/m88k.h -ad94876330906bc5cd98ce46ecb3147c include/coff/mcore.h -d78f43558e5749316731ff8da7afbee2 include/coff/mips.h -e592618085487f0bc467ae02d7ebdf27 include/coff/mipspe.h -bbe77385f8f20e3871cd2a3310348376 include/coff/pe.h -c0a52b2daa52523bc0c4a5958af2a055 include/coff/powerpc.h -ca7551ab79d241ffbb45086318f24ec5 include/coff/rs6000.h -58270182d29df55e7ebac9935b7ce813 include/coff/rs6k64.h -6863d4494aaa304631d878c6c0d32bae include/coff/sh.h -d93e26806dd11c6c492db5f4cfc50dbc include/coff/sparc.h -49952fda1e759e5aa659f8f78d7e0ba0 include/coff/sym.h -ac2f6431d01bacf541ecc3e5e8dc5499 include/coff/symconst.h -d404152f19d5fd917f5c213cab9dfe55 include/coff/ti.h -a943e5f95323f5c3a0d0cc76899b3157 include/coff/tic30.h -00a943a23f99cb26ae4ef0f1cd874052 include/coff/tic54x.h -2bea3280a510b0e60456554172c30f7d include/coff/tic80.h -8243e196db4d55775bea63595f65cdc3 include/coff/w65.h -f65be1056446cc9f95448245334c9346 include/coff/we32k.h -5b68b9272205b8a20a37a7244f936e54 include/coff/z8k.h -d618facc3e8ce8bf3d02ba452e1be6ab include/MAINTAINERS -de46742edca3a9276eefa5ae8fdee5eb include/alloca-conf.h -15001c35bd6d66101a28ff4d4f48c6b9 include/ansidecl.h -2aa37081b825fc7f9371fb2f2bb14477 include/bfdlink.h -e4247635fdf4b4f00f70e8d0fb756cf7 include/bin-bugs.h -0134165067ac86d517e032aa5a861e4c include/bout.h -c4f59b0838482455edea3d3ec13bfe62 include/callback.h -96b8f1978567a85a54e7985a848d1bed include/demangle.h -68e677849a73047588da295c7b37165e include/dis-asm.h -bdf2bd343ec6e5fb41e946812accd405 include/dyn-string.h -df592480ae2f45f93360b1f1270756ab include/filenames.h -8a01536b114929e73727fdd96b0f39b0 include/floatformat.h -d54eb7868908574db9965575a16c1819 include/fnmatch.h -b2cd17a9267bc2e92df461d3170cb15c include/fopen-bin.h -87444b5c85b3c2bc734f8b86157b15db include/fopen-same.h -2f3ef0265ac665d61a8721a78c47a79f include/fopen-vms.h -7b08d623511997558fcc99b0df47efc5 include/gdbm.h -3a8f21303285c19af2ff8a2d88c9599d include/getopt.h -0a7705129476cbc81cb4a95a69b5177a include/hashtab.h -09291cabd10c827ec23605fd27575d8b include/hp-symtab.h -4140d269a4d719013db3beba8f684572 include/ieee.h -39f09bdf2a300b24072642a1bb540149 include/libiberty.h -e1b9929975775d9831fb9d726e48230e include/md5.h -07de9606e88a074c745d5bbcd835c1e2 include/oasys.h -88d315194393cec8fa190539965d5113 include/objalloc.h -63b71216672f5453f509d6111030e0ef include/obstack.h -82709f401badc29ca812065155ff60b9 include/os9k.h -a9720ee19979bb321c07fabfa9c50bea include/partition.h -d011632065e457c8589b28d0c53e5b04 include/progress.h -8a280b18f0cabe5ebf764a3030dd481a include/remote-sim.h -12f13d7f77320135261fd50e0abd94ba include/safe-ctype.h -c8670b4767badb71a4da8a851b014eee include/sim-d10v.h -866d60698fbecc154ad3cf29e029ebc6 include/sort.h -d8d1601c2d1ee96513826d0cba20ba1b include/splay-tree.h -4ebaa58a8bcb2ad62a520447123446ed include/symcat.h -dbea2ed322e7ea959fc2a2c3949d01ef include/elf/ChangeLog -f42fa13c6c33a69368f7ba26963fe866 include/elf/alpha.h -3bf4ae3474c9c4b8310da4a84aec1dca include/elf/arc.h -2fe80e192d9659bea7b0bdaa31aa149e include/elf/arm.h -58a80a77bf1669d85ca0d6095e6e85b4 include/elf/avr.h -2cfc0b1bf4c1d7d5bc9fdfe215f72619 include/elf/common.h -81b2f401fb8c6bff37f28f811a70210b include/elf/cris.h -f65a19cb8f5a2d53a4c0f71c90bef0e7 include/elf/d10v.h -e1bbf4eba14b2efe2dd202e9a7038bd1 include/elf/d30v.h -d350084ff96d123c4ee539745ed1ef2c include/elf/dwarf.h -744b35dfe0baf98be9bc289bd0f00448 include/elf/dwarf2.h -bd2e0d99c91c060a6afd29a774572ae9 include/elf/external.h -2adb44173bb9ba06c13aef464c4701a3 include/elf/fr30.h -0899399867f5ede8459434cb58862e61 include/elf/hppa.h -3244632ab2a049af0ebcef9b16c9f0b5 include/elf/i370.h -91ea37d0949ed5198393c4e36cac949b include/elf/i386.h -6e10443e0f1746964a6cc3fa883215b5 include/elf/i860.h -4f6c7e8248b9ec284b181a55ff15a17a include/elf/i960.h -2e5a2836ae170cd5df905e1badfb6c6f include/elf/ia64.h -57a2acfa4c0f4764f1f181b0deee1741 include/elf/internal.h -f2816b5aaef73516d44b235aa098e22a include/elf/m32r.h -d289b5c4850dd5c1979d66a9568ad9db include/elf/m68hc11.h -c8eda6e35260f4d7f9897ad95a2248c5 include/elf/m68k.h -97ed3477e1b76ff78e6ae3c361506869 include/elf/mcore.h -d2fdeb878c7b8c208630b9a9a2ff5e84 include/elf/mips.h -9090a0078b91916eb138a6e96ba1ffab include/elf/mn10200.h -238dcb5869243682d1de4b464c288fbc include/elf/mn10300.h -f9cffe9859496c157656bbd3a7b7459f include/elf/pj.h -9d168cba90f8b5bd18e49bd33876f3c5 include/elf/ppc.h -883bdfc4fbbbd6a89013a5522ce509f9 include/elf/reloc-macros.h -5f9856492ae08f28a4a37826e7398365 include/elf/sh.h -36bd8460c99395fd2c73b66e5882380e include/elf/sparc.h -3aa9b74a41a552e5cff4d62cdb2017db include/elf/v850.h -a02d6617c483d114704d8b89e7af3e0c include/elf/x86-64.h -5dbb507e309b9fe20c45d16972bfb936 include/mpw/sys/resource.h -6bc56500657f8c3b71b20af4c69e967f include/mpw/sys/file.h -6bc56500657f8c3b71b20af4c69e967f include/mpw/sys/param.h -745d20e08d92b71d289da383e8a47168 include/mpw/sys/stat.h -99098422e0de596f6a2e552220346da7 include/mpw/sys/time.h -009a0ee881c63ae879dd80dde06daca5 include/mpw/sys/types.h -34d253468a44fc96db48e38814a2e4ce include/mpw/ChangeLog -ac05e56eb8acd390d0fa557abc21380d include/mpw/README -d1c1f4e66376b9ef2e8d4c79446503ba include/mpw/dir.h -c293cf9a745465e2371edda6e3f700d5 include/mpw/dirent.h -fd0c0ec6483a6ac794cfe370f323c8e7 include/mpw/fcntl.h -211595cb825444acd3656a8172a3261c include/mpw/grp.h -7a2ba7b6e2b168f335e8d53b1003ab24 include/mpw/mpw.h -32f1e7dc45c3a15418ec5e0998f1f8f3 include/mpw/pwd.h -55d48ac5e6e6ef01dcad00aeb8b33831 include/mpw/spin.h -043c8982bc0ff4fd987727abd7341aa9 include/mpw/stat.h -94cd8a35a9f625ee6a4d19ef2a481042 include/mpw/utime.h -30ab289a4d9376ba8ec961019e3c291c include/mpw/varargs.h -17e1d26830cfdfcfd3f10ac77b0fbca8 include/nlm/ChangeLog -ee9fe4c84a50cb6d303eb3848fbd6eba include/nlm/alpha-ext.h -cd1bbe2052d94d6d0ba5892f15b1d48a include/nlm/common.h -3c99c8ba8f85e2cb10829f35e3223113 include/nlm/external.h -119b651e264af67466b26517fa1ab516 include/nlm/i386-ext.h -83eee47917743f8eadb3cab94449dbee include/nlm/internal.h -5446642ff3b9fee027d46b00a0cd9383 include/nlm/ppc-ext.h -12311cd52e4c3cbb45b2f8eb775cc8c4 include/nlm/sparc32-ext.h -de353dec3d3156369ebeda0962c5b39e include/opcode/ChangeLog -462ffbe74d2be5d6f8607b4f072e53f5 include/opcode/a29k.h -0c6d0efab2da874133036face81c3666 include/opcode/alpha.h -0281afdeeedaeafda7a17fd25a67ec00 include/opcode/arc.h -f51724681cb616b8ddaa4ed0aacb67fb include/opcode/arm.h -98fab9ee305c764c0d98bdaa52ddb874 include/opcode/avr.h -32ab4453846d992862d569d9873ba281 include/opcode/cgen.h -b68941a9545d607ec5245a96ccd399c9 include/opcode/convex.h -58d48256e88159d47d7911df439e43f3 include/opcode/cris.h -ac443bb309a4a778383af46b6f101901 include/opcode/d10v.h -61819e55d807e7953d1864c88ba74c1c include/opcode/d30v.h -38c8a41b5a691d7f48cfa40495e0c5a2 include/opcode/h8300.h -b74df8d0c0456132c090adf9b7173a65 include/opcode/hppa.h -7e3c952acc4568fdd1d873147e3c0d2d include/opcode/i370.h -ba1c64016e7e1949f14a81b15651e106 include/opcode/i386.h -b2d9c35e0647c729335b50866309ed9b include/opcode/i860.h -10654d7ed7402428c40546e33e5f147c include/opcode/i960.h -05bf164aa56c4c5ab3dcb35d8785aac1 include/opcode/ia64.h -7628171c45c02183c4c952b6760ebcdd include/opcode/m68hc11.h -ba270bed72f4cbb17d70d9964a2779c7 include/opcode/m68k.h -fad6ef73bfcbcf77fb6ff04c05d2b215 include/opcode/m88k.h -5a1abd8839180eaa24ffd1dff62739f9 include/opcode/mips.h -43e315bf6f41c74ceeb8422191c76ffb include/opcode/mn10200.h -ad7ece4aed093a098c3ea27047837dad include/opcode/mn10300.h -f08f60834808b211b5ea9531e53bfd49 include/opcode/np1.h -8201356f4327535622d9aaefab8f7e42 include/opcode/ns32k.h -2686b284377642c3a6afb790785808f4 include/opcode/pj.h -10a57ede0f7fe1825b0412223edf5852 include/opcode/pn.h -56e3e2af3e522292571f6a8b18255f99 include/opcode/ppc.h -57b6865994b962b82214d3e543408f2a include/opcode/pyr.h -67834671955468c7dcaf51979772ef9c include/opcode/sparc.h -c69e19287023c929ac20ee5311acfadc include/opcode/tahoe.h -2b0f365ad336acad633a116537cfd018 include/opcode/tic30.h -f6d161f577d67533b30aa8fa85ca3c33 include/opcode/tic54x.h -d2c9644c874999bbb1f275ebf8adea86 include/opcode/tic80.h -f02fe800bd8571f3e2677aa2c3a06c90 include/opcode/v850.h -e78acf38376a53ce9ac029cdd1c4d560 include/opcode/vax.h -d41d8cd98f00b204e9800998ecf8427e include/regs/ChangeLog -5afe8eb5573965dfb58378e4e46f3813 install-sh -c3f98161a09663d4152a318793fde272 intl/ChangeLog -e824af0ffcae539e52cac31fa3faf1d5 intl/Makefile.in -ee2ff1244c36ed348643bd1a51001f4f intl/acconfig.h -6e16646448de7fab92862eefbdcca179 intl/aclocal.m4 -da7585912c32cc902a40682c188c9c76 intl/bindtextdom.c -caa3581b00edb0a7d3811a24a3e46c5c intl/cat-compat.c -da5e55ccdeae42d336d8f9225cebfd75 intl/config.h -bd51dd1c7684c9f15ee4532bfd7bf12f intl/config.in -05c6a93ed8c2801c09dfe15e6cd47452 intl/config.status -2f9be0885ee6447a29fd0550b52c40aa intl/configure -eb4685d54a1e3da00cab275a5c3fa6c4 intl/configure.in -b542cbb1c1c4a9dfac867172246e0a20 intl/dcgettext.c -63df19e31e5f6a6df817da915b44ed3d intl/dgettext.c -4db7c1b94ee4cda24bc74474f3a59a3e intl/explodename.c -4b12bb77b2d9d268b8ec6ee39d12c4a8 intl/finddomain.c -a3f9f228e0044a48c00cf5970b8be258 intl/gettext.c -2ba9a94b32d0c8056e617e85ad7a994a intl/gettext.h -5f9d7d7a72a3e8e42034c55b5c7f83eb intl/gettextP.h -5fca7fa018536a827790bf56e384cb5d intl/hash-string.h -93e4ab4b2eba5d2b8a36e1b2380190c5 intl/intl-compat.c -f00903218b78761c55cd76aea43e0cad intl/intlh.inst.in -3ee800e1115b811c49bd4f0b8a6a65aa intl/l10nflist.c -792fd16022a69b1321042701c46218d0 intl/libgettext.h -07e60d7ada1d5cf14da1c4c2823feaf0 intl/libintl.glibc -88c9303406b57aeed1f313b827c28e3a intl/linux-msg.sed -bc7989f895f4e4e38d43419dc0f4777b intl/loadinfo.h -441f20d1c11229acbe9eb350b162548a intl/loadmsgcat.c -122fc9bc010467ff915e57aa7114a780 intl/localealias.c -606344532ffc07b36812c0d04acb1f38 intl/po2tbl.sed.in -1ded054093de910d9786c62bc4fe8cc6 intl/stamp-h -6283160be713ad0dc1102617ada6fa54 intl/textdomain.c -0be261721efcbc3f04680d99e149f18a intl/xopen-msg.sed -c289dc63e731d4a1da809249e0922832 ld/emulparams/aixppc.sh -2e897117043ad88f2c7bcf35a606d76b ld/emulparams/README -4f6b4154113438f7481f4661d09daabe ld/emulparams/a29k.sh -b313a6fa271657abd14511455050cdb2 ld/emulparams/aixrs6.sh -29fda341c48f8b90fbf258b6d475867e ld/emulparams/alpha.sh -91e308e524924e29bc43412f89a2fead ld/emulparams/arcelf.sh -2e08024e0d4b3c527d426e134d4af1ef ld/emulparams/arm_epoc_pe.sh -a061559a038d4e5b1efe929656c6eabd ld/emulparams/armaoutb.sh -a419e5e9b54e9511306099d0f8ddf0a5 ld/emulparams/armaoutl.sh -d7a431dc9e8878378179623ccf9bfb47 ld/emulparams/armcoff.sh -b89887d1de91912a100a09e766faafeb ld/emulparams/armelf.sh -27ee98332d14972c9906e52f38dbc915 ld/emulparams/armelf_linux.sh -4e88bc5535572c27ad8e22ea4f245202 ld/emulparams/armelf_oabi.sh -0f7bcbd8a14e3f6392834cf18fde47fb ld/emulparams/armnbsd.sh -f8974ac24d96f452ff36b40a6203383d ld/emulparams/armpe.sh -d054a3453b323338552bb636ebb8e116 ld/emulparams/avr1200.sh -35959d43d0a857cea44143e597becec1 ld/emulparams/avr23xx.sh -6bce86ca67f3e0d62294eb9bd2635402 ld/emulparams/avr4433.sh -3c8c6bed009efce2bf0242ef1d003245 ld/emulparams/avr44x4.sh -b79ca66a017af6b2cc9612337262291c ld/emulparams/avr85xx.sh -d612b547d13f97624ad3cabe1406a152 ld/emulparams/avrmega103.sh -b9db3ff305090194178987e80d8ed449 ld/emulparams/avrmega161.sh -fe83397f7a2e0de4d02d04b61f229a25 ld/emulparams/avrmega603.sh -d47b82239f4ac8c14355a94378cf39b7 ld/emulparams/coff_sparc.sh -2106e6a6c645d248df9265a8408980c2 ld/emulparams/crisaout.sh -ce0b745d5a04bfd7bb575b1c7180641e ld/emulparams/criself.sh -57b93a092a4cac65e988765446eb13da ld/emulparams/crislinux.sh -4e68ea19373cca478057e6a64814e143 ld/emulparams/d10velf.sh -17e84454d13546953021ef10207da62f ld/emulparams/d30v_e.sh -094a88671f30762402b9e5c78e4e3e9e ld/emulparams/d30v_o.sh -b904add983e2aa12033b4c8812a73cb4 ld/emulparams/d30velf.sh -162d7cba8938432d260e1e9321bf43ce ld/emulparams/delta68.sh -e8fa19901f4c10300649e6c2d30be9f8 ld/emulparams/ebmon29k.sh -b30522a3c37bc370dfe45f546cca3127 ld/emulparams/elf32_i860.sh -3d9de5e9ff61c57dfe7cae3508863c7f ld/emulparams/elf32_i960.sh -5521057ee51d04b9c5be955ad01fa01d ld/emulparams/elf32_sparc.sh -1dd17564c9aff8b6c2e40e7a9f571b7a ld/emulparams/elf32b4300.sh -f64269d5383ab08f0c9e5b79c788caf0 ld/emulparams/elf32bmip.sh -989be87f670515d0a102da2ee6102e7c ld/emulparams/elf32bmipn32.sh -52f1a6b5e20bd996dc715168c8700d56 ld/emulparams/elf32bsmip.sh -09ad12c799e0de160ea05b5e2c67977d ld/emulparams/elf32btsmip.sh -41c14a8d73070481da1f2559785322b0 ld/emulparams/elf32ebmip.sh -6f124bd5baf085b40380db07a4ba7c2e ld/emulparams/elf32elmip.sh -ed5f10fa7edc2674622078dbfd378434 ld/emulparams/elf32fr30.sh -8c345571cb4a1d16f3335639204f1b3b ld/emulparams/elf32i370.sh -e6c4955bf2db80c6964e66af709f05cb ld/emulparams/elf32l4300.sh -0fc4b854a11f17219053f735f3f6cec2 ld/emulparams/elf32lmip.sh -1e20413e271fd05e253b187172ba8137 ld/emulparams/elf32lppc.sh -92f6cc4fe8ca41fb6e6d15cd4f72838f ld/emulparams/elf32lppcsim.sh -1143fb3d9743c026ec587df088bd31f8 ld/emulparams/elf32lsmip.sh -f3acecc64f5801ead7fcc37b95faa23f ld/emulparams/elf32ltsmip.sh -b0bd40fd4790073da2ca8a139dd5abbb ld/emulparams/elf32mcore.sh -5e3d03a5417dbd051c0f465b832d15d4 ld/emulparams/elf32ppc.sh -2d539f783dfb7d0fe71e2554f4b14841 ld/emulparams/elf32ppclinux.sh -7790d9c91fc199cc51434abe289bf438 ld/emulparams/elf32ppcsim.sh -792c26246fde59e0f132bb33c4039b48 ld/emulparams/elf64_ia64.sh -7448f80602579636b9e1898cd5a37228 ld/emulparams/elf64_sparc.sh -ed729adb5c8420afe7245240e95db0f1 ld/emulparams/elf64alpha.sh -769fdd8cbe0bf5e72ca8dca7d78d3259 ld/emulparams/elf64bmip.sh -8135eedeb358358243d545461b0090dd ld/emulparams/elf64btsmip.sh -ff249db25e56dc6b03a8b61eb8a89070 ld/emulparams/elf64hppa.sh -e3f95201ea2635af31251e96b95d75c6 ld/emulparams/elf64ltsmip.sh -7ebad7c632abef6e016c94541d4ad30b ld/emulparams/elf_i386.sh -e853a2e087ac512a0cfa5ffc4baa6474 ld/emulparams/elf_i386_be.sh -05e655e5b9bba0d20b4020d660720f56 ld/emulparams/elf_i386_chaos.sh -b48b2c27f9bc85ff6c979aafcdf82bf3 ld/emulparams/elf_x86_64.sh -a12d58b36cd6e31986d7515c77fec3af ld/emulparams/gld960.sh -16e204dd1b3a385eb2dcf14ccddaa50a ld/emulparams/gld960coff.sh -3a7b9aaf11eae3f3cbd21b6220434ad0 ld/emulparams/h8300.sh -38e60b173489d53692974c5b6a04cfb9 ld/emulparams/h8300h.sh -f9d708a8c553ed19183a1f638fe633b4 ld/emulparams/h8300s.sh -b3b0d0be943fd5517fbc171778f63de0 ld/emulparams/h8500.sh -6dabd6ffde56b2445c38969243d3575e ld/emulparams/h8500b.sh -6d71814235108ce0faa35813c1959495 ld/emulparams/h8500c.sh -e8b9174ddad38feceda59af2dbec0d09 ld/emulparams/h8500m.sh -f0a112f331b4c6bfbfbb1895cdd63eff ld/emulparams/h8500s.sh -54b7e862187330b80b6314b2c1c1b05e ld/emulparams/hp300bsd.sh -4bbb1b67f14d1e124683aecbd19e69cf ld/emulparams/hp3hpux.sh -7af6e1ad74bc71f864b9c04412f1bebc ld/emulparams/hppaelf.sh -dbcd064517314bc119e4b54ae7847284 ld/emulparams/hppalinux.sh -0537af9ab3953ed67d099959cd4e181c ld/emulparams/i386aout.sh -5ed1f528a6752f2ed12d48977cc43da1 ld/emulparams/i386beos.sh -ca54144cdb2703b51ceb13bc03e36c83 ld/emulparams/i386bsd.sh -d05a50688386622b8ad4e4c1f2286662 ld/emulparams/i386coff.sh -8d213758c362dee91c9aca3fe2521321 ld/emulparams/i386go32.sh -da7411bcf5fc48e4739d94a108c64f56 ld/emulparams/i386linux.sh -7d2e038dbd7439a23c353688c7ff6087 ld/emulparams/i386lynx.sh -fdc6893b38868d4006e1d62edc5a09bd ld/emulparams/i386mach.sh -63dc5bed51de89c74fdfb27b20c5dcc9 ld/emulparams/i386moss.sh -95e2973323b32d1896c6e19758582b09 ld/emulparams/i386msdos.sh -fd44b883579ad95580bf3cae88bd91b4 ld/emulparams/i386nbsd.sh -5714ea774490dece5da92c0fc5c72d77 ld/emulparams/i386nw.sh -189c01efee7710b9d1b107f60db173a9 ld/emulparams/i386pe.sh -168c0e6c22de9f60b4cfd893a1e0a4f0 ld/emulparams/i386pe_posix.sh -50cd18f6ac43ffed547adab63eaf7fd0 ld/emulparams/lnk960.sh -02117bc90d8d122568f4695bb15d61b7 ld/emulparams/m32relf.sh -17f327870e9d5f2b67bb6767084eae64 ld/emulparams/m68hc11elf.sh -f11b453814e07dfe2f126c575f25db31 ld/emulparams/m68hc11elfb.sh -30b81dcf1f3db68cdb1e15bce5b41d78 ld/emulparams/m68hc12elf.sh -7d1044ca8b044c1a519d8db2db658577 ld/emulparams/m68hc12elfb.sh -2c03157a829a79d93b2ca4b5005f032a ld/emulparams/m68k4knbsd.sh -173818cf70910edb066aa57cbad66829 ld/emulparams/m68kaout.sh -00b17c39c4dcf1058751dc07f30dbea3 ld/emulparams/m68kaux.sh -f0580d8a518bcc77032874c9cb72809d ld/emulparams/m68kcoff.sh -d82fefa828fc4538f17bb3f788352154 ld/emulparams/m68kelf.sh -7d5b500c05a8f5cd0eccbbc81dc99139 ld/emulparams/m68klinux.sh -89788f2245a4c41e33afab79e70e6bb7 ld/emulparams/m68klynx.sh -37404d78456eeb52a674a4dcbbb9bb36 ld/emulparams/m68knbsd.sh -13f758bfc68e72e4e1df1cc8e8b01407 ld/emulparams/m68kpsos.sh -71a6bb6cc26e527411df45774831e1fc ld/emulparams/m88kbcs.sh -f1fa919d1c7900c6c69ad1137c008524 ld/emulparams/mcorepe.sh -6c5efc2d80801d3ab24a03f11d108e39 ld/emulparams/mipsbig.sh -8589776726fb0a88568b9dbda5660c35 ld/emulparams/mipsbsd.sh -9b4dac4f3c4dcd64fa56cef06eff44fa ld/emulparams/mipsidt.sh -a9f7e459186328fe620a7923de39340c ld/emulparams/mipsidtl.sh -60661603c73c5ec9883d1f65e561e2d6 ld/emulparams/mipslit.sh -8cb42fe6977ca6c642cb7b96a9b0fda0 ld/emulparams/mipslnews.sh -1e83e0caf4fa27128375fc0ee5b0d362 ld/emulparams/mipspe.sh -cb9ddc7149bdc45e4894ad3c5f7043dc ld/emulparams/mn10200.sh -16199cff84a98df6ed43d1032f86d4ac ld/emulparams/mn10300.sh -49337298ecef7c4e2569237b614c9675 ld/emulparams/news.sh -a712bce9b19b7554abdf8de63140c88e ld/emulparams/ns32knbsd.sh -a9ad37848e6c339a4fe81f322c3f3390 ld/emulparams/pc532macha.sh -332eddb90f3e1d4a5a320243735ebf5c ld/emulparams/pjelf.sh -8e2b9fce572d19af6ce84e6efbb74add ld/emulparams/pjlelf.sh -cbcbc06cb401fb2074140cb8b535d4e8 ld/emulparams/ppcmacos.sh -f71b3cd563ff272019f928ca9cbd0eba ld/emulparams/ppcnw.sh -762b6a9cb39066b56d9cee03286dcf82 ld/emulparams/ppcpe.sh -ff7570d6bf2e39ba10e74a394052028b ld/emulparams/riscix.sh -e1c80afa234bc21751979b515fb688e2 ld/emulparams/sa29200.sh -f363ccd6fc740ceec31fa8001cf2e9a0 ld/emulparams/sh.sh -131aec9365eaee35bf7d15d9e28dec96 ld/emulparams/shelf.sh -8b4b3eed32de796acbcf4a2b11a83e3b ld/emulparams/shelf_linux.sh -0806db54e70993cecdd7023f339e4d39 ld/emulparams/shl.sh -70d54bfad0f08afc691f19192fb244f8 ld/emulparams/shlelf.sh -d1cb0ddcc185836f97a39dd37a0f49cb ld/emulparams/shlelf_linux.sh -a316da8cf4e620c00377e161b3a15fa0 ld/emulparams/shpe.sh -6062ec8406144fbbe4ad32e193a7ac04 ld/emulparams/sparcaout.sh -16bbfb9268886d428a81d42f007c5f20 ld/emulparams/sparclinux.sh -d004a32b2e6edcc69d900c2207bcbbbb ld/emulparams/sparclynx.sh -957bd3e925d255ac965dde1aa7303f40 ld/emulparams/sparcnbsd.sh -8f86834d923d64e45861594e4dc8c457 ld/emulparams/st2000.sh -f8ff78cfcc19d1d4389a84330615a363 ld/emulparams/sun3.sh -04380fc27e6223ffc89d2b43f9421434 ld/emulparams/sun4.sh -5d10f221cc393b1ae1719132de13f3da ld/emulparams/tic30aout.sh -4fc903e37671053625509f7486c63816 ld/emulparams/tic30coff.sh -aead097a3385a27cba7210470e150a10 ld/emulparams/tic54xcoff.sh -786ca05591eada9f7fbf7d5804dc0b81 ld/emulparams/tic80coff.sh -31a5bc747cdaf134204652bf78e61771 ld/emulparams/v850.sh -060bf2672cf53a505f23d413017e0be4 ld/emulparams/vanilla.sh -1689044462ea8c0a614ff1b3a91a0192 ld/emulparams/vax.sh -1e240622a795d134bad0e8a60460b9ae ld/emulparams/vsta.sh -7efc4f8c9d1eca2e14084bcd65535b9a ld/emulparams/w65.sh -cd93ec9e7e74cadfaf8044cca1581111 ld/emulparams/z8001.sh -8890ef4fad0e25044c8d3200a9e77ee7 ld/emulparams/z8002.sh -2a5cb94cef3195c5006cbcccd4ea6a78 ld/ChangeLog -1ae0cd65c8a7fb4e347f5a8584cafd1a ld/ChangeLog-9197 -2e154e4e100af48493f6fa789d4517ae ld/ChangeLog-9899 -d618facc3e8ce8bf3d02ba452e1be6ab ld/MAINTAINERS -52fe75d2d3eacdf3865e9968e646030f ld/Makefile.am -4be7a6136d60892a1971cbfbbdd19a6e ld/Makefile.in -8adc4dd7a7707cade1f72f88c49b818a ld/NEWS -d3f15e73b68c6d694e6eddcdc11f1f04 ld/README -01627b664c7e61ab5dc202bb72913e0a ld/TODO -b802b0cc52e6c72a326c11a64c8155a0 ld/acinclude.m4 -f1734965ff3907806ff585fdbcda515d ld/aclocal.m4 -bcd1abcd9f55cd39380e86555cd04488 ld/config.in -bdcfe9939e2b527a2c7ac3a4cbd09f6b ld/configure -59c74394349437e37d4c7e5284aecb50 ld/configure.host -a6a60d7fb5c82dde521faa647f2b2f49 ld/configure.in -d4092cb236ed20c3872e350b7e3863a4 ld/configure.tgt -d3d9eb4581bec474a3cf465160b1371e ld/deffile.h -37e7fb1b97db43bb03690e4e7468f8ee ld/deffilep.y -93fbfa053ffcf82c36613c2e7ca30eda ld/dep-in.sed -e2677a696ed870d444e53cf69e8a69f6 ld/gen-doc.texi -5a7a6887613081ade332f14f1262f907 ld/genscripts.sh -d3d6fc53e5f8d5e5f962266911f0441b ld/h8-doc.texi -a9ea9d042e8f202d1ae318bb4dcdeda6 ld/ld.1 -dc12c63e536bb4d30122799fcfcd61b2 ld/ld.h -9af8fa62657be80f73f1c25215971bcb ld/ld.info -8f0d53a6eedd7210635c279880569300 ld/ld.info-1 -b9e92eaf7909800eb27222331671da4f ld/ld.info-2 -d514b36ea675f9b1770d33101fe77c92 ld/ld.info-3 -84441dd528c1fc2bf3e446b0a20a240b ld/ld.info-4 -07f47d1279b089736e2bfa62102b1ad0 ld/ld.info-5 -c35193580f679ead6fe0137ced6ada69 ld/ld.info-6 -34c8d5659cc0bc70a2448f8e260d73ea ld/ld.texinfo -42041e4e16e2fe5e78b67fbead7a431b ld/ldcref.c -bdd86d7671d31e05370e5c4dd6563c27 ld/ldctor.c -5feb38f9fdfff03477a2e903ab3b0a9a ld/ldctor.h -eb13c3d4870762f25fcd6620cb14e53c ld/ldemul.c -e922c33a61aab25af6710d9809c4f4c0 ld/ldemul.h -a4bd1472be8a8e931a82825b319da567 ld/ldexp.c -ceebb9e2a2f925e2dd6bd5eefdf13166 ld/ldexp.h -367eab4d73a8b2eba9e1f317dcb3b7e9 ld/ldfile.c -16f4a7510b084d57d6bdaf97da6193f8 ld/ldfile.h -9b2dada8716782c20350d43caa2f21b7 ld/ldgram.c -469602bdd786d950e9759b5c1c607058 ld/ldgram.h -615e9abfaa087941ac1a665b03f6c9d5 ld/ldgram.y -991cdf89843c7a85c80939a69f7744e5 ld/ldint.texinfo -8ca47fabed6fbbcd7a76307cd0392d00 ld/ldlang.c -573b0985ee45448098b2ecfd7ef68754 ld/ldlang.h -e3589edbe9619a856c94a9e1472af695 ld/ldlex.c -695387a63964774ce8bad66fa3cbc3ac ld/ldlex.h -ab34ade19af66bcf41fd1cdf8316fbce ld/ldlex.l -0456d4b5849cae5e7b5602e180c81fb1 ld/ldmain.c -9bf1eb955e180d436f5179fba53a1582 ld/ldmain.h -eaf5e555807b6f79e3df15fd87d501ab ld/ldmisc.c -ade62229096754b98373b9ae23d91b70 ld/ldmisc.h -3a602698f02818af629d09f4bd3f7fee ld/ldver.c -672e26e69ab6b241da6d7e5e4775f943 ld/ldver.h -4359fdef33618e0323337df0588c5cc3 ld/ldver.texi -79e7b100959436e9e1e63d4dca95b6ed ld/ldwrite.c -2b0d7a0f98da7f507f182b4dd2f9b616 ld/ldwrite.h -72c0de82995b3f382dd79e9b8aee3744 ld/lexsup.c -d2c2ef9b2c8b24061720ae93db1c4908 ld/mac-ld.r -26d2c38dee9ec69444252636bb0f6cc9 ld/mpw-config.in -75da5b27b1aed0cd7e35b59d9816e8ba ld/mpw-elfmips.c -1aa6339246f903df40d56a6e1741125a ld/mpw-eppcmac.c -d59f31235ae0e62676d70df668146a3a ld/mpw-esh.c -b20a61570cea5126bbe2247bbf21b3c6 ld/mpw-idtmips.c -01eb948a7c267f614ce2d08c8270170f ld/mpw-make.sed -d42ccc86b79c8964f38a1411f8b7c5c3 ld/mri.c -2ad4dc287abf549ea050d6ff283d603c ld/mri.h -98560f9c1fc2227cc7c788586914cc15 ld/pe-dll.c -da3989e60b39997de519cdbb5e6ea757 ld/pe-dll.h -1ded054093de910d9786c62bc4fe8cc6 ld/stamp-h.in -3f6f936b110ea5a5399a1446a3193c62 ld/sysdep.h -33d53fcbafe88b22932a3319277862ea ld/emultempl/armcoff.em -b812a798c37d8d5f5901f1821a8a648a ld/emultempl/README -9b159b0dcd1b4592439409005af127bf ld/emultempl/aix.em -12544d37e7ba4af1aa940499b149eb02 ld/emultempl/armelf.em -9f11acc5b293ac007ef4f30069a0148c ld/emultempl/armelf_oabi.em -995bbfc228460e4eef6eef52a09384a9 ld/emultempl/astring.sed -da24b8a824c3f326149884affe72b954 ld/emultempl/beos.em -d2fc27e169746e4690b9255988f3f959 ld/emultempl/elf32.em -410858b431ec254ac37f760c1ea87f1a ld/emultempl/generic.em -0a9fdf535a7a19ab8b1bad9713888740 ld/emultempl/gld960.em -76c0c089a4a55b0c9621b49d38908e67 ld/emultempl/gld960c.em -6b0ca1358cf1f8c0066f2e5301f46d56 ld/emultempl/hppaelf.em -6f50e5470dba075e580db09276f7d3db ld/emultempl/linux.em -9ee4fb106dcb3642b3c10ffd1e55457a ld/emultempl/lnk960.em -e959cab000712c2d7827b28020188272 ld/emultempl/m68kcoff.em -b995be733fe9aaafa45af874c12102a6 ld/emultempl/m68kelf.em -448e845763e60a5c713e3b2fc9863cf3 ld/emultempl/mipsecoff.em -a8190e4a0b5cca5b8677d8bb2d39940f ld/emultempl/ostring.sed -e14202a045cb3c41ebfe042228e3252d ld/emultempl/pe.em -8be5c13555bd37d1c70bbb1006b583da ld/emultempl/sunos.em -e21fa8d986017ca6352be94fdff217bd ld/emultempl/ticoff.em -1fc5ca4c2d336b91b473c13b241bf2b9 ld/emultempl/vanilla.em -63397aaa2c2074aa7be7ffe57b2e6c69 ld/po/POTFILES.in -ea2baddf1654fa8df40eb033d33b6068 ld/po/Make-in -c8e20dea09bd30058704c752a202c8b9 ld/po/ld.pot -d471f7a5a3dc4deffa1a8f2039a38504 ld/scripttempl/alpha.sc -01c6e3598e372d510730e381dd25c2cd ld/scripttempl/README -fdcbfdd0b93aa6b73e1b73127b28bdae ld/scripttempl/a29k.sc -ebac9206176b1d49526ea9edbc71867a ld/scripttempl/aix.sc -8e2be304cab1b30f2770ca3dd188f47f ld/scripttempl/armaout.sc -11e720b2d4fbd6b8ad9ce26f980acd6a ld/scripttempl/aout.sc -f40cc9e187c16d5d4170456ccb17d03a ld/scripttempl/armcoff.sc -119e975ce8b1005742840a9152c03a99 ld/scripttempl/crisaout.sc -3fb69113f5952434021a5fc481d5b417 ld/scripttempl/delta68.sc -a4e630a7a2094f2b44f19e41069e4433 ld/scripttempl/ebmon29k.sc -2f6206dfef231404aa0babbf12d2b69c ld/scripttempl/elf.sc -c7f5cfe3ed0b5773a9d2107c7fe08475 ld/scripttempl/elf32avr.sc -744fd7db42c234328f24006210a9f7a9 ld/scripttempl/elfd10v.sc -557b6406e74fc2c9cefe6233f95fe5a8 ld/scripttempl/elfd30v.sc -6ad7e39a3e5729ad923402573fd2351f ld/scripttempl/elfi370.sc -e96aae5650c97ddede3769205d9256f6 ld/scripttempl/elfm68hc11.sc -b435ff7b33225c47a2c42481b66fd5b6 ld/scripttempl/elfm68hc12.sc -5393b9689fa4a05d916c9ebbb54f015f ld/scripttempl/epocpe.sc -bb39f599d5755db06b3516d0471fe7f0 ld/scripttempl/h8300.sc -03a31f296b07be57364e68342f141a75 ld/scripttempl/h8300h.sc -b3675a21a2701e05a7895b6a28108d25 ld/scripttempl/h8300s.sc -6c57b9f11a6f50c46ecce9df62061dbf ld/scripttempl/h8500.sc -39da8240aa7f5aca7b23d93bcf243bb8 ld/scripttempl/h8500b.sc -a1235b4e692307533adc69d75c98da06 ld/scripttempl/h8500c.sc -45c5f295e421e663e1843207ae13951a ld/scripttempl/h8500m.sc -b6ce335a288c23cf897c944a84aafe3b ld/scripttempl/h8500s.sc -786aba3e828af6519ac1cb21ca5ebd9e ld/scripttempl/hppaelf.sc -973ec6d5280fe67f4694d07f03b6991e ld/scripttempl/i386beos.sc -89f55fbb09da1e8728f74f0dfda3192d ld/scripttempl/i386coff.sc -606d3f3a80d30603f3bbaf5c75ca3bee ld/scripttempl/i386go32.sc -debc01664da1e6913ca6ee1d350c7c9f ld/scripttempl/i386lynx.sc -dd4667c5e75a68e5bcc4b0769830974b ld/scripttempl/i386msdos.sc -f14aed79776fb856704487766477ef6b ld/scripttempl/i960.sc -ac993ea32406502f14b7089c4239296f ld/scripttempl/m68kaux.sc -0acb5ea28c8feeee6aae68de5fb62a67 ld/scripttempl/m68kcoff.sc -5ac24db89fd94088b97b9b2a9b5c6ea2 ld/scripttempl/m68klynx.sc -66790e6da2a36230461c111c12e5a6fc ld/scripttempl/m88kbcs.sc -d942ea1043bca95ad16a43702655862c ld/scripttempl/mcorepe.sc -13a45868ad3e92575be92f1558d1c9b7 ld/scripttempl/mips.sc -756f010bc1fcebe9cb08b1c8afa66389 ld/scripttempl/mipsbsd.sc -3219d28558d7ee8ceac00771c0f41aad ld/scripttempl/nw.sc -305f38a09603aa92f10e6d0b4cfc7680 ld/scripttempl/pe.sc -47e02e8254495a858dbef6c19c1ac173 ld/scripttempl/pj.sc -219f146ba7cb4c7346c9abd2a6c78798 ld/scripttempl/ppcpe.sc -ab0f8d8220dc084233dee358c5e57433 ld/scripttempl/psos.sc -1ca280b61dcc707ecc1128cfa80b8243 ld/scripttempl/riscix.sc -cd076d3e4b10af9d6eec06ff494e1c6e ld/scripttempl/sa29200.sc -e9bf54b19fd6c440995f4bf7a7a34d64 ld/scripttempl/sh.sc -1231890eaa6427329f4e49ef29a3b632 ld/scripttempl/sparccoff.sc -a56557b365a2fc1cf4070c7c5663b79c ld/scripttempl/sparclynx.sc -6277ea502afc8c184eeccce4362d538b ld/scripttempl/st2000.sc -f9f56c0b4c0548aadba5f30ee7f105fe ld/scripttempl/tic30aout.sc -581d4b5a31b2f67b8274aa96b201af92 ld/scripttempl/tic30coff.sc -d66c340121962b6706c37311253b0ea8 ld/scripttempl/tic54xcoff.sc -b6d1e44df8ff2382dcc53bf1816a4177 ld/scripttempl/tic80coff.sc -9767716444e270cbeda9727d75e12b39 ld/scripttempl/v850.sc -922fccd6995f0a119365fd7ceb7b25ce ld/scripttempl/vanilla.sc -9ef634e16ac4537117ea157867e85207 ld/scripttempl/w65.sc -474b1c82cd04327e7433dd108c93e239 ld/scripttempl/z8000.sc -4c78bc0be539fce5e7b7d076f918b568 ld/testsuite/config/default.exp -3205f2e22c9761eb0c10696266fdaf4d ld/testsuite/ChangeLog -b9b40d74b338fd9bf9a0999931d1b6e8 ld/testsuite/ld-bootstrap/bootstrap.exp -4b9f7ea09166acbf0b5d72c88c5b3956 ld/testsuite/ld-cdtest/cdtest-bar.cc -7d245ef3c98762296b516547243311d0 ld/testsuite/ld-cdtest/cdtest-foo.cc -6db246fa73606a55b99fd68fc8b67e5d ld/testsuite/ld-cdtest/cdtest-foo.h -42bc325afd7f1f937f20faa53c9f1490 ld/testsuite/ld-cdtest/cdtest-main.cc -cfb423f4424fe65c2fe45d99c49ff558 ld/testsuite/ld-cdtest/cdtest.dat -f0953d15141cfb527557cdf3e2491e89 ld/testsuite/ld-cdtest/cdtest.exp -d989349ade37c6c902c049861488e70b ld/testsuite/ld-checks/checks.exp -328c5cac80b76bd422b0b77d5517d175 ld/testsuite/ld-checks/asm.s -536a4d2e63692344109849b984f9da06 ld/testsuite/ld-checks/script -8e56f3234a0494775108d96aa30d18da ld/testsuite/ld-elfvers/vers.exp -5f2c2be170fc2ea8b5f4b1d7e8d72165 ld/testsuite/ld-elfvers/vers1.c -580fae4dde72b7ecb4ddf9a2fb369b72 ld/testsuite/ld-elfvers/vers1.dsym -0f0d48d66a7468bb1ea8f0f907f65f74 ld/testsuite/ld-elfvers/vers1.map -e70fa3cc72507e3c454eeaff68f8c28f ld/testsuite/ld-elfvers/vers1.sym -d739eb560d4a0f23ab4cf60df5378602 ld/testsuite/ld-elfvers/vers1.ver -ca85484e74a669868fc7e52fe11d7fb4 ld/testsuite/ld-elfvers/vers13.asym -e8cdfeee2880948d113226cb5004d92c ld/testsuite/ld-elfvers/vers15.c -63a46548615c9f270349f427719d1b10 ld/testsuite/ld-elfvers/vers15.dsym -46f1035151fe2009e5de509d8f7ebaf2 ld/testsuite/ld-elfvers/vers15.sym -63f2b3b06a796f7a49a90902fbadd4ad ld/testsuite/ld-elfvers/vers15.ver -d71d95fe36a6bc2f88c952ac37cb990a ld/testsuite/ld-elfvers/vers16.c -ff7574e34a600f7ae616a4384f98ad0f ld/testsuite/ld-elfvers/vers16.dsym -d057681641b9fc14e87f35c677b6243d ld/testsuite/ld-elfvers/vers16.map -92e6d0ae0c0aef2c17de9ef04d6bf7f2 ld/testsuite/ld-elfvers/vers16a.c -4d81c8fe8c0b5ea33ef6c4001cfee806 ld/testsuite/ld-elfvers/vers16a.dsym -fb67971a2dd673bf9ae0506459f0bf2d ld/testsuite/ld-elfvers/vers16a.ver -a2e06e03cf5f45c27839f309a5388b81 ld/testsuite/ld-elfvers/vers17.c -35a714a53e208be7dd7f246285c4dd30 ld/testsuite/ld-elfvers/vers17.dsym -db62e32b4b422023390633f11005c406 ld/testsuite/ld-elfvers/vers17.map -bf382203a5c52664aa6e7728abbbd31a ld/testsuite/ld-elfvers/vers17.ver -64ce133534d131385b4d10606c423b81 ld/testsuite/ld-elfvers/vers18.c -3a85e7068b4a30ec5e7585a14b19ce69 ld/testsuite/ld-elfvers/vers18.dsym -31b6949806df3bd1f959a957bed07ff6 ld/testsuite/ld-elfvers/vers18.map -99fdeff24e389af67f2125724e3c0c2b ld/testsuite/ld-elfvers/vers18.sym -3727b5769ad6291477eb3ffaa67eb9d2 ld/testsuite/ld-elfvers/vers18.ver -039a925919afb81dc1ee342704f38935 ld/testsuite/ld-elfvers/vers19.c -c1b9e106ce57e5a1d19a19e5ad108ea6 ld/testsuite/ld-elfvers/vers19.dsym -56042a92306b44d3b68444cb64f9c768 ld/testsuite/ld-elfvers/vers19.ver -0a2838d86e28cda599478f48e5b5bdfd ld/testsuite/ld-elfvers/vers2.c -6c04dd6b5a1f83b8ad01dc66e0cef2c9 ld/testsuite/ld-elfvers/vers2.dsym -0f243904b21ec2e5cda0083a35f9708e ld/testsuite/ld-elfvers/vers2.map -a597d603357c6c6537d1ee1e806a56d6 ld/testsuite/ld-elfvers/vers2.ver -2198856c8569cc7494ffe89650a9e63b ld/testsuite/ld-elfvers/vers3.c -c1b9e106ce57e5a1d19a19e5ad108ea6 ld/testsuite/ld-elfvers/vers3.dsym -d02949a2cd805d83970ffc3229895e01 ld/testsuite/ld-elfvers/vers3.ver -eaeb7b786e1af44d384e8c84dc7a2dc4 ld/testsuite/ld-elfvers/vers4.c -41acbfbc82b54219566366b069b2ce34 ld/testsuite/ld-elfvers/vers4.sym -e878b24651400ca1fb1bdc0c16a22848 ld/testsuite/ld-elfvers/vers4a.dsym -41acbfbc82b54219566366b069b2ce34 ld/testsuite/ld-elfvers/vers4a.sym -e15e85042ec35363e4bc97c35187187a ld/testsuite/ld-elfvers/vers4a.ver -940d06960890b0eb73114f452b44604a ld/testsuite/ld-elfvers/vers5.c -3874cf48820bc48dd48d1ee16551af06 ld/testsuite/ld-elfvers/vers6.c -440222caab8e6f857b77c1ba50d81e84 ld/testsuite/ld-elfvers/vers6.dsym -b355de4ba2834305bca9bf3b7cc91e70 ld/testsuite/ld-elfvers/vers6.sym -c6dda7839f06ae8858d0d413c6b436dc ld/testsuite/ld-elfvers/vers6.ver -8c6338ab91836afb2918ef463e5e899a ld/testsuite/ld-elfvers/vers7.c -9a7ae246a7154e67158fc0cdcda850d8 ld/testsuite/ld-elfvers/vers7.map -8d7f1e06f9194fa66402e5efff269754 ld/testsuite/ld-elfvers/vers7a.c -b3fdb5ca0a4cf57530bf9d838fe825da ld/testsuite/ld-elfvers/vers7a.dsym -d466ec8b7fcadee36db85cac92c1601a ld/testsuite/ld-elfvers/vers7a.sym -3cbade7d1c3f4ac6ccbc83cebf13d3f7 ld/testsuite/ld-elfvers/vers7a.ver -258f61144bcd39b444b75dba182129e6 ld/testsuite/ld-elfvers/vers8.c -3a208e171858590f5717735bf85432b6 ld/testsuite/ld-elfvers/vers8.map -36514fcaa2e950e55d5930aa97782ea2 ld/testsuite/ld-elfvers/vers8.ver -2866447458043d608659fc1fe92f617a ld/testsuite/ld-elfvers/vers9.c -21dcd2120edc32b5e36974abdc6e1f3e ld/testsuite/ld-elfvers/vers9.dsym -0d2f6f5317e5732e649745046ab2ab9a ld/testsuite/ld-elfvers/vers9.sym -ba97850c4c77d6ae99535f328268af22 ld/testsuite/ld-elfvers/vers9.ver -a1502268321d4816ffa1d1bb1cf335e1 ld/testsuite/ld-elfvsb/elf-offset.ld -26f7423a78988457f44e1879ec1ec1b1 ld/testsuite/ld-elfvsb/elfvsb.dat -c7e4e3bb61152914b24ca9d48c7414e8 ld/testsuite/ld-elfvsb/elfvsb.exp -996a5cc52bf7b1f6356ea1e77aaca26e ld/testsuite/ld-elfvsb/main.c -a5d04655b47574a63e0d034c2b15ecf8 ld/testsuite/ld-elfvsb/sh1.c -2a301406fc0d5ccedb5fe48db23d0838 ld/testsuite/ld-elfvsb/sh2.c -b77b2046bde3f0f47b7ed8412f4e095f ld/testsuite/ld-empic/empic.exp -e7337619d5f156145600727d89a92cad ld/testsuite/ld-empic/relax.t -9890e4435b569df5957bf349ae070544 ld/testsuite/ld-empic/relax1.c -06661c7d74d2309ff2e35b10146bd41e ld/testsuite/ld-empic/relax2.c -9bb9724eff6590e585dd1969fac15dff ld/testsuite/ld-empic/relax3.c -c192f60f33fc224b5c2c16766d07994d ld/testsuite/ld-empic/relax4.c -a8b21f91a17c7ecd1f8ca5b7f00e075b ld/testsuite/ld-empic/run.c -37bc1d770c9e77e637c46e1ae7992247 ld/testsuite/ld-empic/runtest1.c -a27a7a90ff46445fa4334638ec71ce3d ld/testsuite/ld-empic/runtest2.c -75a0208d669a12ec40c6c09cda96a4b4 ld/testsuite/ld-empic/runtesti.s -e882253a7b0f660986d5794a36239b1b ld/testsuite/ld-scripts/cross1.c -dacdbdd934565fa39a43a2a2372dfe7f ld/testsuite/ld-scripts/cross1.t -2bad1250e1d3998f3c2d678b1b90d275 ld/testsuite/ld-scripts/cross2.c -f4850b548feaf5705683c9096cad261d ld/testsuite/ld-scripts/cross2.t -6cda0a6cae6d6fe585c175aa49c2578e ld/testsuite/ld-scripts/cross3.c -8e5623c6b47db95f8e2be269f12dd48f ld/testsuite/ld-scripts/crossref.exp -3987c7a541be314eb899fb320d1236aa ld/testsuite/ld-scripts/defined.exp -89dc613e3ce213bd756b77d022667dac ld/testsuite/ld-scripts/defined.s -d3b1800f46a71805045a3a5732fd42bc ld/testsuite/ld-scripts/defined.t -5dc9106fd27359a7db37212f56b0c101 ld/testsuite/ld-scripts/phdrs.exp -9af38df1b2580b0ee309b0acfb185537 ld/testsuite/ld-scripts/phdrs.s -56a4859269de48bfbf859d4d0a327e9f ld/testsuite/ld-scripts/phdrs.t -b4fdfa8cd5673593833160a46be7b211 ld/testsuite/ld-scripts/script.exp -8ef222fed2cbd6222ef9c4bfb5caceb3 ld/testsuite/ld-scripts/script.s -b9bc56b095f61ceef7cb9a948be41609 ld/testsuite/ld-scripts/script.t -a673788e6a586931f65fee9d8964d0b8 ld/testsuite/ld-scripts/scriptm.t -b17503e5b20c63c8c98c18694e77f1c9 ld/testsuite/ld-scripts/sizeof.exp -de2cf65f9506880e63f0fdd46bb23c12 ld/testsuite/ld-scripts/sizeof.s -feffaafc250ae18dfdd493f8a6c4f2c6 ld/testsuite/ld-scripts/sizeof.t -c135cc5906cdf4cfe49d4c51df63c515 ld/testsuite/ld-scripts/weak.exp -3591b42540bac07bfbb66f7f0ce59d88 ld/testsuite/ld-scripts/weak.t -8df46a87530dbe689785bcc1c1a75da7 ld/testsuite/ld-scripts/weak1.s -b3bb044bcdc10e3eccef47d0c2c2429e ld/testsuite/ld-scripts/weak2.s -0490e9a40c7efa469100cf3f29ea8143 ld/testsuite/ld-selective/3.cc -3f6043e6b6bd49e760b9e753b6aaf9ac ld/testsuite/ld-selective/1.c -237d849095a360c8cad108dd7c84812b ld/testsuite/ld-selective/2.c -dcfb7a28e3bdf5d5453248236fbd60bc ld/testsuite/ld-selective/4.cc -a2c9c1152a0133516e4640ed96422473 ld/testsuite/ld-selective/5.cc -c5363d796238787cdb2c6ae148b90831 ld/testsuite/ld-selective/selective.exp -fe57a8477f445b968630a746d538da92 ld/testsuite/ld-sh/sh.exp -1480d5643c4a3a7456700440e9f108dc ld/testsuite/ld-sh/sh1.s -4a6b928d31480c42bc368db1a2d729b3 ld/testsuite/ld-sh/sh2.c -486895674299bb2c523133e56a567c1f ld/testsuite/ld-sh/start.s -a1502268321d4816ffa1d1bb1cf335e1 ld/testsuite/ld-shared/elf-offset.ld -662fbaf1e1bfcf9e0f69ece262c1fbc9 ld/testsuite/ld-shared/main.c -1ac7636415298be4ec10d57894d7bd92 ld/testsuite/ld-shared/sh1.c -dda81aa1c99d9fd983ae39378b5b69fd ld/testsuite/ld-shared/sh2.c -7ac9ed1cf3e4b23bd77743315f0560d5 ld/testsuite/ld-shared/shared.dat -8309ff0409c524b5958d7ffb2295f541 ld/testsuite/ld-shared/shared.exp -8b38128b19d7be0a9f143a3fae14669f ld/testsuite/ld-shared/sun4.dat -e8d8c5ef094b26b46377375f8ef076c3 ld/testsuite/ld-shared/symbolic.dat -bf16787cbff593c9377800bda68bc12b ld/testsuite/ld-shared/xcoff.dat -8541a6beb8232366c133e9097a10c8d2 ld/testsuite/ld-srec/srec.exp -ff2b78b0df3a6bc56644e35ec4f068bd ld/testsuite/ld-srec/sr1.c -6524623299b50b9299f4b3fca543b0fa ld/testsuite/ld-srec/sr2.c -16d9ac8f3038072368a8550eb60b5d26 ld/testsuite/ld-srec/sr3.cc -b619c6e42cb950ef08a2be4baed7e558 ld/testsuite/ld-undefined/undefined.c -80908f8a2cc2983b2e57ab40e0505045 ld/testsuite/ld-undefined/undefined.exp -68086317a3885311286459eb9083c71c ld/testsuite/ld-undefined/weak-undef.exp -d46f02756d74cac491eccd91c9497ca3 ld/testsuite/ld-undefined/weak-undef.s -ff2b7f892a6ef004c2076f2bab575ec0 ld/testsuite/ld-undefined/weak-undef.t -29efa44de09187dfbd1badee054c2ffd ld/testsuite/ld-versados/versados.exp -a3dd5e83356444e20dfff2b6986f9701 ld/testsuite/ld-versados/t1-1.ro -20fa39afdcf19846ef54b8c8a63c09fa ld/testsuite/ld-versados/t1-2.ro -750043b1377753643d66f2ea010d1d64 ld/testsuite/ld-versados/t1.ld -1ea1a397873490e5a225282b08911b79 ld/testsuite/ld-versados/t1.ook -b73a148ff92b3b9f50118dedddc8e9aa ld/testsuite/ld-versados/t2-1.ro -6521d61c4bf4f500cb868ded9a47044e ld/testsuite/ld-versados/t2-2.ro -ed2b6b448335acf507dc34b5a01710d8 ld/testsuite/ld-versados/t2-3.ro -7020c6c2928c89ca798f517226862f1c ld/testsuite/ld-versados/t2.ld -fb1e9ddf26ad5af0d34950d762f68ed9 ld/testsuite/ld-versados/t2.ook -d8417145277c2f71b3d7c058472f3577 ld/testsuite/lib/ld-lib.exp -e2677a696ed870d444e53cf69e8a69f6 ld/configdoc.texi -7b65854f594c84e80295173de277b3dc libiberty/config/mh-cxux7 -4004fdcde347fda58406b4b84a995c66 libiberty/config/mh-aix -b2eafdc4d4e0928a5d0e89d5f6fe116c libiberty/config/mh-beos -044204f5b4bcac5eae2face0602129ae libiberty/config/mh-fbsd21 -904bdcd9daf97fa55a9ca8901ffe7435 libiberty/config/mh-openedition -38e76da568ab25260754fdb9d5080513 libiberty/config/mh-windows -f30a9716ef3762e3467a2f62bf790f0a libiberty/COPYING.LIB -536f1ea00e95287882c108f51be00df5 libiberty/ChangeLog -d43770145fb3c3433ac33986770a7b36 libiberty/Makefile.in -08cc0e5f8cd2cc6bc1e4114011be131b libiberty/README -5ca0eba5b33e5f6952114bfe84c167b9 libiberty/aclocal.m4 -de46742edca3a9276eefa5ae8fdee5eb libiberty/alloca-conf.h -18b3e90c1496f1db337b93a2c3bda513 libiberty/alloca.c -d54574b77c40ff38a37139b4df4918c8 libiberty/argv.c -d837d38495c38d45d1c8bd94eda40b39 libiberty/asprintf.c -d89da155295f797db9f987220ef9af4f libiberty/atexit.c -0ec74e2bf6de5ac2ee096696b3f7dfb5 libiberty/basename.c -8536a9fe63d5270026766fb6a833c0e3 libiberty/bcmp.c -37f840db36868cae15135e9beb9d9c5b libiberty/bcopy.c -c5855ab06709314b196b5ceb7a7cb5dc libiberty/bsearch.c -3e539dda7281866347213ed444830f9b libiberty/bzero.c -fd01fef67ce311c2462b1957ff06282e libiberty/calloc.c -815fb49e28a8980f8b838aaecaefa891 libiberty/choose-temp.c -4c081fe106364d829d16c720e3a99ad0 libiberty/clock.c -6abc10aedbbd94274f97174a9ec454dd libiberty/concat.c -fdaf5fdc2a84ff34103604588aea1a3b libiberty/config.h-vms -bb2688eeee0799b47128613436b5731f libiberty/config.in -6ba918af7eec27cd147903518d519d46 libiberty/config.table -fde4aae2aac71c6837d5db1db1f4b880 libiberty/configure -9cc359fd1437d6afd69b5169104ddffd libiberty/configure.in -8493d27a97881009393ceec1aa431f0e libiberty/copysign.c -4427c696ecc360a813ecf063589f84a3 libiberty/cp-demangle.c -9463d7142e481f2a98e594901ca5a9f6 libiberty/cplus-dem.c -231d3202aadb19e1d3209fa0797b4ec4 libiberty/dyn-string.c -62121149a1d62bef125c75380131b180 libiberty/fdmatch.c -85de4ab7bf13ff400ecbd15001f91950 libiberty/floatformat.c -5a0e7522053fc29b178bcd5ee644aaee libiberty/fnmatch.c -3508056d5c091a4a066ef6895b66a63c libiberty/getcwd.c -2deefd98fad4fd25e2ed0facd2e5518f libiberty/getopt.c -5fd11388f488b53ec69eeb3e71161636 libiberty/getopt1.c -f4ed35bf0db2796c07db055f638abec8 libiberty/getpagesize.c -9fc32d36b7617e6393b8d8aa4dc8a5e0 libiberty/getpwd.c -b9bdf217753be4c1315c3a9689983290 libiberty/getruntime.c -e05e129c9bbfca9c792724adff237e85 libiberty/hashtab.c -d707920a44f45525dc4c6e310926a210 libiberty/hex.c -004477cba1e0a85a2d443bee4a0af269 libiberty/index.c -4c4b7edb35b7ffbbba5e7e2ec399d559 libiberty/insque.c -e331b31ce1cbf27a44f2fbeb54fa7b17 libiberty/makefile.vms -d985e08160b8aec6f4ba23175400181c libiberty/md5.c -cdca3f90987260a7a860aee136ca740a libiberty/memchr.c -2439abd355027df270d48733215f891a libiberty/memcmp.c -f59c3c95c9ab8b66dfccaa3d7ba1f878 libiberty/memcpy.c -8dda7ebe5e2c3c6c28aa53e06b283fcb libiberty/memmove.c -57043300d663328adbb1b40c2cd7793e libiberty/memset.c -bd2a139d55d7bbaeee671b50a45992fa libiberty/mkstemps.c -969668698375a7ecf08bc086b9613a31 libiberty/mpw-config.in -54c65d1bafd7d8d29b9d29761d977020 libiberty/mpw-make.sed -9de6f56befd6350286f5a42836a8433a libiberty/mpw.c -7897e43bedd2def4beb6eb73003efa68 libiberty/msdos.c -9fbb504341d8982f9439a168b9ef825e libiberty/objalloc.c -41b517bd87e0312eb4f1c72f641c2008 libiberty/obstack.c -34f70650591a3e50bf80a47259b21063 libiberty/partition.c -170b24f0daa4451a1a0c61badc6a2592 libiberty/pexecute.c -1c26add2214f8d43e42a3ef76e0a2c4e libiberty/putenv.c -892047691cd75e110b6c995047656068 libiberty/random.c -9afa19a52697f0d83a8f94c8f55b0140 libiberty/rename.c -b751b6a5c19944eded4cfcba1fd527df libiberty/rindex.c -438e62574b58fc80136eb9b43aa4d6b7 libiberty/safe-ctype.c -fb5ea509ef834b0fae40b4de9e121a4e libiberty/setenv.c -1f3c59265795bbeeaa0682e30ec008fa libiberty/sigsetmask.c -bcd38bbff8e80df6e908d7ee57d7b681 libiberty/sort.c -4a3173c26ad8cb30302e1425135647f8 libiberty/spaces.c -ea6978858b89cbdbf2bb796522e38603 libiberty/splay-tree.c -406f9df3aca1c9cb104e35d93aa5f19a libiberty/strcasecmp.c -25493d01cf01dddc7326eb6bb39b59d7 libiberty/strchr.c -352f6f1cb2e6025866d406ede3a475c0 libiberty/strdup.c -db0fc51193ca195a3f588e5184e1987a libiberty/strerror.c -00040f08f420f8336e67840133efdd87 libiberty/strncasecmp.c -2e333001f8ef8e01ae2f153e51b59ce4 libiberty/strncmp.c -19847187ca2ed7b38342718371b57a89 libiberty/strrchr.c -022d5e8aa132e524de1a9e087867161e libiberty/strsignal.c -58984b80dbe4d3364feda5c675b3e23c libiberty/strstr.c -0cd5eef7fa7708a43350f98eacf8776a libiberty/strtod.c -a0e7c73c62ba8a24e1590c27e34c59d3 libiberty/strtol.c -e06d6526f14dcd0834827520331fef16 libiberty/strtoul.c -d0b4c29a87478edc4c2c69c3e9d2be0a libiberty/tmpnam.c -8824ff84682ec60eca212b518429db18 libiberty/vasprintf.c -1e46cffdcdf7e68d72a8f24c71c04d08 libiberty/vfork.c -280fb05a979214b0876be4c9dc7d4061 libiberty/vfprintf.c -9a46f8a6bd6b911849f209d09e94b66f libiberty/vmsbuild.com -893d859616bab673df0504cb02a7feec libiberty/vprintf.c -d187e50a7a7817fcbf2bbd6595093756 libiberty/vsprintf.c -52860722750d8633eb78d1dbe6db4f5b libiberty/waitpid.c -5caf61856a76a6eb1cb52bb1c86501c5 libiberty/xatexit.c -357b147749e719e3c69315ac83c6a4bf libiberty/xexit.c -e404c730a2531595d5fea1c5da957e98 libiberty/xmalloc.c -b0feb91e581c43d5ae41b0576e877ab3 libiberty/xmemdup.c -6ec02ce9b4802dd6939200d4d2faba6a libiberty/xstrdup.c -e70805298181e0f55a52a64b17d72904 libiberty/xstrerror.c -f209fdb2c52db4462c254e6b8d89f2ee libiberty/testsuite/Makefile.in -6319e17edb27c399c30f1596c2ce41b5 libiberty/testsuite/demangle-expected -5cd31fc5e2e642e2de1c3d6a0792b431 libiberty/testsuite/regress-demangle -cc28484945e89f4d469672c4b1beaabe libtool.m4 -30c8f1fcca77253cf9e9657caac44c12 ltcf-c.sh -3a3fcd8d6f8accd80d1d41301045b2d8 ltcf-cxx.sh -1bf2c254103b812c60e6c8e8b90e4c83 ltcf-gcj.sh -9dedd8a70b17964941f1446787f61c2d ltconfig -906ef7ec1319467f83cfc91083949b01 ltmain.sh -734690a438420e8479e15d8ee6971792 makefile.vms -393d298125f8e03c13364afe447b308d missing -fbe2467afef81c41c166173adeb0ee20 mkdep -bc994884d395541d40c4192919a89a21 mkinstalldirs -c71ddf72c059891ca0bd1727f5aa0de1 move-if-change -a8fe1ab072e42efff2a0ec883d91130b mpw-README -af52692753387da2241fc4bc6ccec120 mpw-build.in -5479cbb3e13987fe2170b7a403b82e8f mpw-config.in -d186332a893eacec29defecdc3524ecf mpw-configure -96312bdd41def6a5946784d468dc29d3 mpw-install -7476f5d64c6678694b06bc7aba53fb97 opcodes/po/POTFILES.in -bfb5c178c2404196ab54d7532a61e3d4 opcodes/po/Make-in -87185f7dbaa4e4671dd4d64d491ed41e opcodes/po/opcodes.pot -5d10e6815b371dfeb9c53be2e06fc199 opcodes/ChangeLog -47912714837729ee35d5261ffff2941c opcodes/ChangeLog-9297 -2b70061d7488180442b52de1c9a9e819 opcodes/ChangeLog-9899 -d618facc3e8ce8bf3d02ba452e1be6ab opcodes/MAINTAINERS -253bd0a237fe51f196cde6b19edb1d19 opcodes/Makefile.am -2008005afc9d925a582285b3debb7968 opcodes/Makefile.in -84f5802b0b8a97be111d90fbe1eb5bc1 opcodes/a29k-dis.c -901749e9292ba1f5f109f5cc195bfe8b opcodes/acinclude.m4 -1738493e94ddf315a5f49742feabafdd opcodes/aclocal.m4 -edc549a6c86437daebd9ca4d85dac4d1 opcodes/alpha-dis.c -d57fd8d45f9ef301948abe020b8ea6ed opcodes/alpha-opc.c -407f2ac5f227ea3ab0fdbc29a2c157b8 opcodes/arc-dis.c -b35daf399df5036ff496742fbc5e08ec opcodes/arc-dis.h -8b5ec96c147acb9028e535b3ad80525b opcodes/arc-ext.c -2c085be449e338c2bda530572029c8c9 opcodes/arc-ext.h -6406fb8a25796d8042fcfbea50575876 opcodes/arc-opc.c -9e2b20ce7eeb3a319398ce3eb1d478f7 opcodes/arm-dis.c -011a87a896e0f67c2954e823b7ae037f opcodes/arm-opc.h -598016dc5a3065f79d352c18f24761cb opcodes/avr-dis.c -e9c941efc984cb22a689256e26e43e14 opcodes/cgen-asm.c -84c6a72bc58e3efe77abaa65e9190f86 opcodes/cgen-asm.in -d6cf591b1c7d4d3dbe9306ae800c132f opcodes/cgen-dis.c -7d118a2ff1141006931f55bffcd8e2ea opcodes/cgen-dis.in -b75826a34eee8fb6a90848adcc4377f0 opcodes/cgen-ibld.in -0086c001b35c9036a2d8cacae262aff4 opcodes/cgen-opc.c -95f1a3447a2b756b0f3a2b1cbdb98a16 opcodes/cgen.sh -0063bd27512e913f600d7732d1f6b455 opcodes/config.in -64774095a357e0c5dc0968329dff579c opcodes/configure -bcf375e26bbff52dc5d8df5f33a648d4 opcodes/configure.in -a2f28fa183e6adf5e888277d00a09ec0 opcodes/cris-dis.c -f9210ed755224660483db100711cd468 opcodes/cris-opc.c -3ff7eece27f0263ad962483020d1596d opcodes/d10v-dis.c -0557da1786712b947f0f29cd6141d7e1 opcodes/d10v-opc.c -b8ff24c42fbc4e3520c40784e6d870d6 opcodes/d30v-dis.c -0eebf1cce2cfd05039625773a97b8d40 opcodes/d30v-opc.c -003af092c5d632b4f4d90904faecd02e opcodes/dep-in.sed -21a789d7e4f7c00d4658aa7894ebb5f2 opcodes/dis-buf.c -2900c6f1a9f22b5291942c8ab5a1cc38 opcodes/disassemble.c -8575543eddea6b4909ecdd4aa7f96382 opcodes/fr30-asm.c -91642ad67bfffb844412fe3fc162732b opcodes/fr30-desc.c -44cf09ad36fa37532727361c3d655469 opcodes/fr30-desc.h -621fc334dc302583ba0d3936c47d73f1 opcodes/fr30-dis.c -7e3a44e24211aa6f1791a28192093777 opcodes/fr30-ibld.c -75fd4b7a627f6abf22338ce0f2b5744b opcodes/fr30-opc.c -751349749f75da04fc8ca9f007346f03 opcodes/fr30-opc.h -734b36ee7995c1e6bc93a338b9d66af2 opcodes/h8300-dis.c -dd0cbe2eae0c7d890d713979641e0836 opcodes/h8500-dis.c -be7eeeaaf1ac843e1b1b862a2abbaeab opcodes/h8500-opc.h -9e4136c02128d5cffedc2b42b26e13f8 opcodes/hppa-dis.c -8baa539d215e542bf822c36afd58d1d3 opcodes/i370-dis.c -f2ffaf6eaf3da84601fa3e11c75cb3b6 opcodes/i370-opc.c -5e6140717c388d0ba1193e3b12da9284 opcodes/i386-dis.c -325271abed39e7901f8e311329b7cd40 opcodes/i860-dis.c -e09d15cb2de4a4b71fc524e5dca3ea33 opcodes/i960-dis.c -f0469cd9c1a3c87e3bfd3a24c910f4c6 opcodes/ia64-asmtab.c -4c555d2fbf3bb0d7002a8108f7e28656 opcodes/ia64-asmtab.h -8384cb8430b26dfecca57f6cd6828fcd opcodes/ia64-dis.c -a9d29c4a2268f28092c985c7ad75a13d opcodes/ia64-gen.c -c36c8bd413a36bdbb0769eb453f96233 opcodes/ia64-ic.tbl -0d52960c8b9c111364271ff7c52049b6 opcodes/ia64-opc-a.c -8bc6bf983afd8d19ecbfd3956b3af1c2 opcodes/ia64-opc-b.c -8c9afa7e15881357af5fe46b1f5d80a4 opcodes/ia64-opc-d.c -c617e97d72c9f654b0305faf8b4ae10c opcodes/ia64-opc-f.c -c7e9b3273a3c819c81ad3807e3f86d43 opcodes/ia64-opc-i.c -489e185e02196bd26948258825b9d5ce opcodes/ia64-opc-m.c -5ade2d80b63adb27604e529c84ec0bf1 opcodes/ia64-opc-x.c -729f8bb05396f283169ef6d5cb5c62d1 opcodes/ia64-opc.c -354757cd4b638d7e50f0b34fd6e2c87a opcodes/ia64-opc.h -be62c652f94c6c4e4c7339a42025c43a opcodes/ia64-raw.tbl -b3d7452b4310332b7974b34b09f65a6d opcodes/ia64-war.tbl -a4eed6589f8feed99206080f7362eb7a opcodes/ia64-waw.tbl -a9d541dd9eccd3a1ea0415880b9521a7 opcodes/m10200-dis.c -cdf93ebf301a6f4b4072b2dfe4b56083 opcodes/m10200-opc.c -e999a55493e5bb73dccd2c2f49245bcf opcodes/m10300-dis.c -95476f50fb47e0c8423e8cdba158b341 opcodes/m10300-opc.c -c3c8430e52ed581bb9703f342223cfc1 opcodes/m32r-asm.c -c4ee7ef5b002da4ace8feed1be237d02 opcodes/m32r-desc.c -4842ca40e0cc8f7213279fd51fbb360c opcodes/m32r-desc.h -4d8e90904be8aecf6edf3f9e4affb910 opcodes/m32r-dis.c -452bd9f0a50294c59e6d9ded993b8934 opcodes/m32r-ibld.c -519f99255995a52ea031a68947874d03 opcodes/m32r-opc.c -065e44be10d96ee13c9d99fbd652cb4b opcodes/m32r-opc.h -b04da92be306da6813f23b988280eac7 opcodes/m32r-opinst.c -750ee68160890cb6bb8dc85f42f8fab7 opcodes/m68hc11-dis.c -534406cb1900704eb5bd5a8ab7c15362 opcodes/m68hc11-opc.c -b6d13f9c4898cd69610db32745c555a0 opcodes/m68k-dis.c -f95df4c61edcb7a72e97c651be941245 opcodes/m68k-opc.c -ac754e1e474d8bbd929f0a2f76026917 opcodes/m88k-dis.c -d129eed92c6947db4372b285656ef9a1 opcodes/makefile.vms -deddfa1e5bfc0d1cd272bb335c44f6ed opcodes/mcore-dis.c -5d1d73c7fcd371c3a4bb39d4a8e5cb44 opcodes/mcore-opc.h -378f487e8bd120f93fc5c8df05f10435 opcodes/mips-dis.c -3637f95bf25a1298bdebbbcc1ef8b2be opcodes/mips-opc.c -c5f2a79141b09a53e3430582f3559b7b opcodes/mips16-opc.c -5de239a139c71421a7cce634f8deca83 opcodes/mpw-config.in -031902d455df71012bd4603e5d616ca6 opcodes/mpw-make.sed -8720ca17359e24396f182810719f226a opcodes/ns32k-dis.c -81a682289129e3eefb7cfd6ce9d10d92 opcodes/opintl.h -5fd78854f081acef734b6313c9db3ed8 opcodes/pj-dis.c -7d29ed3a2cb830feadb1382aa3895b6f opcodes/pj-opc.c -ebd0146069b8dc7f178514f29b861060 opcodes/ppc-dis.c -1959550f862696159952f6d1cd19a589 opcodes/ppc-opc.c -81aca074f5c2f015f2607f33e4e2766f opcodes/sh-dis.c -7a4b5aac9ceabeaed3863691a70e6ab6 opcodes/sh-opc.h -ff77e2ad868c4cb2a913a04bbda42594 opcodes/sparc-dis.c -c35af9a7f84cf1a894d7595d914bba1d opcodes/sparc-opc.c -1ded054093de910d9786c62bc4fe8cc6 opcodes/stamp-h.in -8e4842844d864baf1d2056cf0651c2df opcodes/sysdep.h -5909eef2aabc61a8d5e9a71c9734defe opcodes/tic30-dis.c -368332708cdfe65a7195a852455d2e52 opcodes/tic54x-dis.c -971f75d91d6ba40f2040d21eb6f80b1f opcodes/tic54x-opc.c -0bbe03c2f65c1128fd6a0b0916315af3 opcodes/tic80-dis.c -2225052326dd29b94a99ca86fb0086d8 opcodes/tic80-opc.c -b0eefa85cb7a554ecd2056548d6d1b28 opcodes/v850-dis.c -5e2518c50d12ebda6e1fc9dd836c3602 opcodes/v850-opc.c -9f55832c633c46d55657de6006a6a1f0 opcodes/vax-dis.c -3cda2aff2cc4a955064f8a3f58a1887f opcodes/w65-dis.c -988ea26bcea3fd0093c354df06c24c1a opcodes/w65-opc.h -390692c1210bfd6864093e5dda087337 opcodes/z8k-dis.c -2bab6fea415ef1dbac1f958c912bc0d2 opcodes/z8k-opc.h -98b13794afa1b64b2c38411a2c72d404 opcodes/z8kgen.c -0b03c02d551d6f9d9db0c64ddde56500 setup.com -7d7855ad10def38a17850f5b17d3a9dd symlink-tree -0a8fa11d23b640dd1b15a36f8a7f0d3f texinfo/texinfo.tex -7588c5103af27cc93537977f059f52dc ylwrap diff --git a/contrib/binutils/opcodes/acconfig.h b/contrib/binutils/opcodes/acconfig.h deleted file mode 100644 index ef2f4966c1bd..000000000000 --- a/contrib/binutils/opcodes/acconfig.h +++ /dev/null @@ -1,6 +0,0 @@ - -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION diff --git a/contrib/binutils/opcodes/tic30-dis.c b/contrib/binutils/opcodes/tic30-dis.c deleted file mode 100644 index 67956f7a380a..000000000000 --- a/contrib/binutils/opcodes/tic30-dis.c +++ /dev/null @@ -1,710 +0,0 @@ -/* Disassembly routines for TMS320C30 architecture - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. - Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#include <errno.h> -#include <math.h> -#include "sysdep.h" -#include "dis-asm.h" -#include "opcode/tic30.h" - -#define NORMAL_INSN 1 -#define PARALLEL_INSN 2 - -/* Gets the type of instruction based on the top 2 or 3 bits of the - instruction word. */ -#define GET_TYPE(insn) (insn & 0x80000000 ? insn & 0xC0000000 : insn & 0xE0000000) - -/* Instruction types. */ -#define TWO_OPERAND_1 0x00000000 -#define TWO_OPERAND_2 0x40000000 -#define THREE_OPERAND 0x20000000 -#define PAR_STORE 0xC0000000 -#define MUL_ADDS 0x80000000 -#define BRANCHES 0x60000000 - -/* Specific instruction id bits. */ -#define NORMAL_IDEN 0x1F800000 -#define PAR_STORE_IDEN 0x3E000000 -#define MUL_ADD_IDEN 0x2C000000 -#define BR_IMM_IDEN 0x1F000000 -#define BR_COND_IDEN 0x1C3F0000 - -/* Addressing modes. */ -#define AM_REGISTER 0x00000000 -#define AM_DIRECT 0x00200000 -#define AM_INDIRECT 0x00400000 -#define AM_IMM 0x00600000 - -#define P_FIELD 0x03000000 - -#define REG_AR0 0x08 -#define LDP_INSN 0x08700000 - -/* TMS320C30 program counter for current instruction. */ -static unsigned int _pc; - -struct instruction -{ - int type; - template *tm; - partemplate *ptm; -}; - -int get_tic30_instruction PARAMS ((unsigned long, struct instruction *)); -int print_two_operand - PARAMS ((disassemble_info *, unsigned long, struct instruction *)); -int print_three_operand - PARAMS ((disassemble_info *, unsigned long, struct instruction *)); -int print_par_insn - PARAMS ((disassemble_info *, unsigned long, struct instruction *)); -int print_branch - PARAMS ((disassemble_info *, unsigned long, struct instruction *)); -int get_indirect_operand PARAMS ((unsigned short, int, char *)); -int get_register_operand PARAMS ((unsigned char, char *)); -int cnvt_tmsfloat_ieee PARAMS ((unsigned long, int, float *)); - -int -print_insn_tic30 (pc, info) - bfd_vma pc; - disassemble_info *info; -{ - unsigned long insn_word; - struct instruction insn = { 0, NULL, NULL }; - bfd_vma bufaddr = pc - info->buffer_vma; - /* Obtain the current instruction word from the buffer. */ - insn_word = (*(info->buffer + bufaddr) << 24) | (*(info->buffer + bufaddr + 1) << 16) | - (*(info->buffer + bufaddr + 2) << 8) | *(info->buffer + bufaddr + 3); - _pc = pc / 4; - /* Get the instruction refered to by the current instruction word - and print it out based on its type. */ - if (!get_tic30_instruction (insn_word, &insn)) - return -1; - switch (GET_TYPE (insn_word)) - { - case TWO_OPERAND_1: - case TWO_OPERAND_2: - if (!print_two_operand (info, insn_word, &insn)) - return -1; - break; - case THREE_OPERAND: - if (!print_three_operand (info, insn_word, &insn)) - return -1; - break; - case PAR_STORE: - case MUL_ADDS: - if (!print_par_insn (info, insn_word, &insn)) - return -1; - break; - case BRANCHES: - if (!print_branch (info, insn_word, &insn)) - return -1; - break; - } - return 4; -} - -int -get_tic30_instruction (insn_word, insn) - unsigned long insn_word; - struct instruction *insn; -{ - switch (GET_TYPE (insn_word)) - { - case TWO_OPERAND_1: - case TWO_OPERAND_2: - case THREE_OPERAND: - insn->type = NORMAL_INSN; - { - template *current_optab = (template *) tic30_optab; - for (; current_optab < tic30_optab_end; current_optab++) - { - if (GET_TYPE (current_optab->base_opcode) == GET_TYPE (insn_word)) - { - if (current_optab->operands == 0) - { - if (current_optab->base_opcode == insn_word) - { - insn->tm = current_optab; - break; - } - } - else if ((current_optab->base_opcode & NORMAL_IDEN) == (insn_word & NORMAL_IDEN)) - { - insn->tm = current_optab; - break; - } - } - } - } - break; - case PAR_STORE: - insn->type = PARALLEL_INSN; - { - partemplate *current_optab = (partemplate *) tic30_paroptab; - for (; current_optab < tic30_paroptab_end; current_optab++) - { - if (GET_TYPE (current_optab->base_opcode) == GET_TYPE (insn_word)) - { - if ((current_optab->base_opcode & PAR_STORE_IDEN) == (insn_word & PAR_STORE_IDEN)) - { - insn->ptm = current_optab; - break; - } - } - } - } - break; - case MUL_ADDS: - insn->type = PARALLEL_INSN; - { - partemplate *current_optab = (partemplate *) tic30_paroptab; - for (; current_optab < tic30_paroptab_end; current_optab++) - { - if (GET_TYPE (current_optab->base_opcode) == GET_TYPE (insn_word)) - { - if ((current_optab->base_opcode & MUL_ADD_IDEN) == (insn_word & MUL_ADD_IDEN)) - { - insn->ptm = current_optab; - break; - } - } - } - } - break; - case BRANCHES: - insn->type = NORMAL_INSN; - { - template *current_optab = (template *) tic30_optab; - for (; current_optab < tic30_optab_end; current_optab++) - { - if (GET_TYPE (current_optab->base_opcode) == GET_TYPE (insn_word)) - { - if (current_optab->operand_types[0] & Imm24) - { - if ((current_optab->base_opcode & BR_IMM_IDEN) == (insn_word & BR_IMM_IDEN)) - { - insn->tm = current_optab; - break; - } - } - else if (current_optab->operands > 0) - { - if ((current_optab->base_opcode & BR_COND_IDEN) == (insn_word & BR_COND_IDEN)) - { - insn->tm = current_optab; - break; - } - } - else - { - if ((current_optab->base_opcode & (BR_COND_IDEN | 0x00800000)) == (insn_word & (BR_COND_IDEN | 0x00800000))) - { - insn->tm = current_optab; - break; - } - } - } - } - } - break; - default: - return 0; - } - return 1; -} - -int -print_two_operand (info, insn_word, insn) - disassemble_info *info; - unsigned long insn_word; - struct instruction *insn; -{ - char name[12]; - char operand[2][13] = - { - {0}, - {0}}; - float f_number; - - if (insn->tm == NULL) - return 0; - strcpy (name, insn->tm->name); - if (insn->tm->opcode_modifier == AddressMode) - { - int src_op, dest_op; - /* Determine whether instruction is a store or a normal instruction. */ - if ((insn->tm->operand_types[1] & (Direct | Indirect)) == (Direct | Indirect)) - { - src_op = 1; - dest_op = 0; - } - else - { - src_op = 0; - dest_op = 1; - } - /* Get the destination register. */ - if (insn->tm->operands == 2) - get_register_operand ((insn_word & 0x001F0000) >> 16, operand[dest_op]); - /* Get the source operand based on addressing mode. */ - switch (insn_word & AddressMode) - { - case AM_REGISTER: - /* Check for the NOP instruction before getting the operand. */ - if ((insn->tm->operand_types[0] & NotReq) == 0) - get_register_operand ((insn_word & 0x0000001F), operand[src_op]); - break; - case AM_DIRECT: - sprintf (operand[src_op], "@0x%lX", (insn_word & 0x0000FFFF)); - break; - case AM_INDIRECT: - get_indirect_operand ((insn_word & 0x0000FFFF), 2, operand[src_op]); - break; - case AM_IMM: - /* Get the value of the immediate operand based on variable type. */ - switch (insn->tm->imm_arg_type) - { - case Imm_Float: - cnvt_tmsfloat_ieee ((insn_word & 0x0000FFFF), 2, &f_number); - sprintf (operand[src_op], "%2.2f", f_number); - break; - case Imm_SInt: - sprintf (operand[src_op], "%d", (short) (insn_word & 0x0000FFFF)); - break; - case Imm_UInt: - sprintf (operand[src_op], "%lu", (insn_word & 0x0000FFFF)); - break; - default: - return 0; - } - /* Handle special case for LDP instruction. */ - if ((insn_word & 0xFFFFFF00) == LDP_INSN) - { - strcpy (name, "ldp"); - sprintf (operand[0], "0x%06lX", (insn_word & 0x000000FF) << 16); - operand[1][0] = '\0'; - } - } - } - /* Handle case for stack and rotate instructions. */ - else if (insn->tm->operands == 1) - { - if (insn->tm->opcode_modifier == StackOp) - { - get_register_operand ((insn_word & 0x001F0000) >> 16, operand[0]); - } - } - /* Output instruction to stream. */ - info->fprintf_func (info->stream, " %s %s%c%s", name, - operand[0][0] ? operand[0] : "", - operand[1][0] ? ',' : ' ', - operand[1][0] ? operand[1] : ""); - return 1; -} - -int -print_three_operand (info, insn_word, insn) - disassemble_info *info; - unsigned long insn_word; - struct instruction *insn; -{ - char operand[3][13] = - { - {0}, - {0}, - {0}}; - - if (insn->tm == NULL) - return 0; - switch (insn_word & AddressMode) - { - case AM_REGISTER: - get_register_operand ((insn_word & 0x000000FF), operand[0]); - get_register_operand ((insn_word & 0x0000FF00) >> 8, operand[1]); - break; - case AM_DIRECT: - get_register_operand ((insn_word & 0x000000FF), operand[0]); - get_indirect_operand ((insn_word & 0x0000FF00) >> 8, 1, operand[1]); - break; - case AM_INDIRECT: - get_indirect_operand ((insn_word & 0x000000FF), 1, operand[0]); - get_register_operand ((insn_word & 0x0000FF00) >> 8, operand[1]); - break; - case AM_IMM: - get_indirect_operand ((insn_word & 0x000000FF), 1, operand[0]); - get_indirect_operand ((insn_word & 0x0000FF00) >> 8, 1, operand[1]); - break; - default: - return 0; - } - if (insn->tm->operands == 3) - get_register_operand ((insn_word & 0x001F0000) >> 16, operand[2]); - info->fprintf_func (info->stream, " %s %s,%s%c%s", insn->tm->name, - operand[0], operand[1], - operand[2][0] ? ',' : ' ', - operand[2][0] ? operand[2] : ""); - return 1; -} - -int -print_par_insn (info, insn_word, insn) - disassemble_info *info; - unsigned long insn_word; - struct instruction *insn; -{ - size_t i, len; - char *name1, *name2; - char operand[2][3][13] = - { - { - {0}, - {0}, - {0}}, - { - {0}, - {0}, - {0}}}; - - if (insn->ptm == NULL) - return 0; - /* Parse out the names of each of the parallel instructions from the - q_insn1_insn2 format. */ - name1 = (char *) strdup (insn->ptm->name + 2); - name2 = ""; - len = strlen (name1); - for (i = 0; i < len; i++) - { - if (name1[i] == '_') - { - name2 = &name1[i + 1]; - name1[i] = '\0'; - break; - } - } - /* Get the operands of the instruction based on the operand order. */ - switch (insn->ptm->oporder) - { - case OO_4op1: - get_indirect_operand ((insn_word & 0x000000FF), 1, operand[0][0]); - get_indirect_operand ((insn_word & 0x0000FF00) >> 8, 1, operand[1][1]); - get_register_operand ((insn_word >> 16) & 0x07, operand[1][0]); - get_register_operand ((insn_word >> 22) & 0x07, operand[0][1]); - break; - case OO_4op2: - get_indirect_operand ((insn_word & 0x000000FF), 1, operand[0][0]); - get_indirect_operand ((insn_word & 0x0000FF00) >> 8, 1, operand[1][0]); - get_register_operand ((insn_word >> 19) & 0x07, operand[1][1]); - get_register_operand ((insn_word >> 22) & 0x07, operand[0][1]); - break; - case OO_4op3: - get_indirect_operand ((insn_word & 0x000000FF), 1, operand[0][1]); - get_indirect_operand ((insn_word & 0x0000FF00) >> 8, 1, operand[1][1]); - get_register_operand ((insn_word >> 16) & 0x07, operand[1][0]); - get_register_operand ((insn_word >> 22) & 0x07, operand[0][0]); - break; - case OO_5op1: - get_indirect_operand ((insn_word & 0x000000FF), 1, operand[0][0]); - get_indirect_operand ((insn_word & 0x0000FF00) >> 8, 1, operand[1][1]); - get_register_operand ((insn_word >> 16) & 0x07, operand[1][0]); - get_register_operand ((insn_word >> 19) & 0x07, operand[0][1]); - get_register_operand ((insn_word >> 22) & 0x07, operand[0][2]); - break; - case OO_5op2: - get_indirect_operand ((insn_word & 0x000000FF), 1, operand[0][1]); - get_indirect_operand ((insn_word & 0x0000FF00) >> 8, 1, operand[1][1]); - get_register_operand ((insn_word >> 16) & 0x07, operand[1][0]); - get_register_operand ((insn_word >> 19) & 0x07, operand[0][0]); - get_register_operand ((insn_word >> 22) & 0x07, operand[0][2]); - break; - case OO_PField: - if (insn_word & 0x00800000) - get_register_operand (0x01, operand[0][2]); - else - get_register_operand (0x00, operand[0][2]); - if (insn_word & 0x00400000) - get_register_operand (0x03, operand[1][2]); - else - get_register_operand (0x02, operand[1][2]); - switch (insn_word & P_FIELD) - { - case 0x00000000: - get_indirect_operand ((insn_word & 0x000000FF), 1, operand[0][1]); - get_indirect_operand ((insn_word & 0x0000FF00) >> 8, 1, operand[0][0]); - get_register_operand ((insn_word >> 16) & 0x07, operand[1][1]); - get_register_operand ((insn_word >> 19) & 0x07, operand[1][0]); - break; - case 0x01000000: - get_indirect_operand ((insn_word & 0x000000FF), 1, operand[1][0]); - get_indirect_operand ((insn_word & 0x0000FF00) >> 8, 1, operand[0][0]); - get_register_operand ((insn_word >> 16) & 0x07, operand[1][1]); - get_register_operand ((insn_word >> 19) & 0x07, operand[0][1]); - break; - case 0x02000000: - get_indirect_operand ((insn_word & 0x000000FF), 1, operand[1][1]); - get_indirect_operand ((insn_word & 0x0000FF00) >> 8, 1, operand[1][0]); - get_register_operand ((insn_word >> 16) & 0x07, operand[0][1]); - get_register_operand ((insn_word >> 19) & 0x07, operand[0][0]); - break; - case 0x03000000: - get_indirect_operand ((insn_word & 0x000000FF), 1, operand[1][1]); - get_indirect_operand ((insn_word & 0x0000FF00) >> 8, 1, operand[0][0]); - get_register_operand ((insn_word >> 16) & 0x07, operand[1][0]); - get_register_operand ((insn_word >> 19) & 0x07, operand[0][1]); - break; - } - break; - default: - return 0; - } - info->fprintf_func (info->stream, " %s %s,%s%c%s", name1, - operand[0][0], operand[0][1], - operand[0][2][0] ? ',' : ' ', - operand[0][2][0] ? operand[0][2] : ""); - info->fprintf_func (info->stream, "\n\t\t\t|| %s %s,%s%c%s", name2, - operand[1][0], operand[1][1], - operand[1][2][0] ? ',' : ' ', - operand[1][2][0] ? operand[1][2] : ""); - free (name1); - return 1; -} - -int -print_branch (info, insn_word, insn) - disassemble_info *info; - unsigned long insn_word; - struct instruction *insn; -{ - char operand[2][13] = - { - {0}, - {0}}; - unsigned long address; - int print_label = 0; - - if (insn->tm == NULL) - return 0; - /* Get the operands for 24-bit immediate jumps. */ - if (insn->tm->operand_types[0] & Imm24) - { - address = insn_word & 0x00FFFFFF; - sprintf (operand[0], "0x%lX", address); - print_label = 1; - } - /* Get the operand for the trap instruction. */ - else if (insn->tm->operand_types[0] & IVector) - { - address = insn_word & 0x0000001F; - sprintf (operand[0], "0x%lX", address); - } - else - { - address = insn_word & 0x0000FFFF; - /* Get the operands for the DB instructions. */ - if (insn->tm->operands == 2) - { - get_register_operand (((insn_word & 0x01C00000) >> 22) + REG_AR0, operand[0]); - if (insn_word & PCRel) - { - sprintf (operand[1], "%d", (short) address); - print_label = 1; - } - else - get_register_operand (insn_word & 0x0000001F, operand[1]); - } - /* Get the operands for the standard branches. */ - else if (insn->tm->operands == 1) - { - if (insn_word & PCRel) - { - address = (short) address; - sprintf (operand[0], "%ld", address); - print_label = 1; - } - else - get_register_operand (insn_word & 0x0000001F, operand[0]); - } - } - info->fprintf_func (info->stream, " %s %s%c%s", insn->tm->name, - operand[0][0] ? operand[0] : "", - operand[1][0] ? ',' : ' ', - operand[1][0] ? operand[1] : ""); - /* Print destination of branch in relation to current symbol. */ - if (print_label && info->symbols) - { - asymbol *sym = *info->symbols; - - if ((insn->tm->opcode_modifier == PCRel) && (insn_word & PCRel)) - { - address = (_pc + 1 + (short) address) - ((sym->section->vma + sym->value) / 4); - /* Check for delayed instruction, if so adjust destination. */ - if (insn_word & 0x00200000) - address += 2; - } - else - { - address -= ((sym->section->vma + sym->value) / 4); - } - if (address == 0) - info->fprintf_func (info->stream, " <%s>", sym->name); - else - info->fprintf_func (info->stream, " <%s %c %d>", sym->name, - ((short) address < 0) ? '-' : '+', - abs (address)); - } - return 1; -} - -int -get_indirect_operand (fragment, size, buffer) - unsigned short fragment; - int size; - char *buffer; -{ - unsigned char mod; - unsigned arnum; - unsigned char disp; - - if (buffer == NULL) - return 0; - /* Determine which bits identify the sections of the indirect - operand based on the size in bytes. */ - switch (size) - { - case 1: - mod = (fragment & 0x00F8) >> 3; - arnum = (fragment & 0x0007); - disp = 0; - break; - case 2: - mod = (fragment & 0xF800) >> 11; - arnum = (fragment & 0x0700) >> 8; - disp = (fragment & 0x00FF); - break; - default: - return 0; - } - { - const ind_addr_type *current_ind = tic30_indaddr_tab; - for (; current_ind < tic30_indaddrtab_end; current_ind++) - { - if (current_ind->modfield == mod) - { - if (current_ind->displacement == IMPLIED_DISP && size == 2) - { - continue; - } - else - { - size_t i, len; - int bufcnt; - - len = strlen (current_ind->syntax); - for (i = 0, bufcnt = 0; i < len; i++, bufcnt++) - { - buffer[bufcnt] = current_ind->syntax[i]; - if (buffer[bufcnt - 1] == 'a' && buffer[bufcnt] == 'r') - buffer[++bufcnt] = arnum + '0'; - if (buffer[bufcnt] == '(' - && current_ind->displacement == DISP_REQUIRED) - { - sprintf (&buffer[bufcnt + 1], "%u", disp); - bufcnt += strlen (&buffer[bufcnt + 1]); - } - } - buffer[bufcnt + 1] = '\0'; - break; - } - } - } - } - return 1; -} - -int -get_register_operand (fragment, buffer) - unsigned char fragment; - char *buffer; -{ - const reg *current_reg = tic30_regtab; - - if (buffer == NULL) - return 0; - for (; current_reg < tic30_regtab_end; current_reg++) - { - if ((fragment & 0x1F) == current_reg->opcode) - { - strcpy (buffer, current_reg->name); - return 1; - } - } - return 0; -} - -int -cnvt_tmsfloat_ieee (tmsfloat, size, ieeefloat) - unsigned long tmsfloat; - int size; - float *ieeefloat; -{ - unsigned long exp, sign, mant; - - if (size == 2) - { - if ((tmsfloat & 0x0000F000) == 0x00008000) - tmsfloat = 0x80000000; - else - { - tmsfloat <<= 16; - tmsfloat = (long) tmsfloat >> 4; - } - } - exp = tmsfloat & 0xFF000000; - if (exp == 0x80000000) - { - *ieeefloat = 0.0; - return 1; - } - exp += 0x7F000000; - sign = (tmsfloat & 0x00800000) << 8; - mant = tmsfloat & 0x007FFFFF; - if (exp == 0xFF000000) - { - if (mant == 0) - *ieeefloat = ERANGE; - if (sign == 0) - *ieeefloat = 1.0 / 0.0; - else - *ieeefloat = -1.0 / 0.0; - return 1; - } - exp >>= 1; - if (sign) - { - mant = (~mant) & 0x007FFFFF; - mant += 1; - exp += mant & 0x00800000; - exp &= 0x7F800000; - mant &= 0x007FFFFF; - } - if (tmsfloat == 0x80000000) - sign = mant = exp = 0; - tmsfloat = sign | exp | mant; - *ieeefloat = *((float *) &tmsfloat); - return 1; -} diff --git a/contrib/binutils/opcodes/v850-dis.c b/contrib/binutils/opcodes/v850-dis.c deleted file mode 100644 index 0f688678a8a9..000000000000 --- a/contrib/binutils/opcodes/v850-dis.c +++ /dev/null @@ -1,381 +0,0 @@ -/* Disassemble V850 instructions. - Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - - -#include <stdio.h> - -#include "sysdep.h" -#include "opcode/v850.h" -#include "dis-asm.h" -#include "opintl.h" - -static const char *const v850_reg_names[] = -{ "r0", "r1", "r2", "sp", "gp", "r5", "r6", "r7", - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", - "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", - "r24", "r25", "r26", "r27", "r28", "r29", "ep", "lp" }; - -static const char *const v850_sreg_names[] = -{ "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "sr6", "sr7", - "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15", - "ctpc", "ctpsw", "dbpc", "dbpsw", "ctbp", "sr21", "sr22", "sr23", - "sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31", - "sr16", "sr17", "sr18", "sr19", "sr20", "sr21", "sr22", "sr23", - "sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31" }; - -static const char *const v850_cc_names[] = -{ "v", "c/l", "z", "nh", "s/n", "t", "lt", "le", - "nv", "nc/nl", "nz", "h", "ns/p", "sa", "ge", "gt" }; - -static int -disassemble (memaddr, info, insn) - bfd_vma memaddr; - struct disassemble_info *info; - unsigned long insn; -{ - struct v850_opcode * op = (struct v850_opcode *)v850_opcodes; - const struct v850_operand * operand; - int match = 0; - int short_op = ((insn & 0x0600) != 0x0600); - int bytes_read; - int target_processor; - - /* Special case: 32 bit MOV */ - if ((insn & 0xffe0) == 0x0620) - short_op = true; - - bytes_read = short_op ? 2 : 4; - - /* If this is a two byte insn, then mask off the high bits. */ - if (short_op) - insn &= 0xffff; - - switch (info->mach) - { - case 0: - default: - target_processor = PROCESSOR_V850; - break; - - case bfd_mach_v850e: - target_processor = PROCESSOR_V850E; - break; - - case bfd_mach_v850ea: - target_processor = PROCESSOR_V850EA; - break; - } - - /* Find the opcode. */ - while (op->name) - { - if ((op->mask & insn) == op->opcode - && (op->processors & target_processor)) - { - const unsigned char * opindex_ptr; - unsigned int opnum; - unsigned int memop; - - match = 1; - (*info->fprintf_func) (info->stream, "%s\t", op->name); -/*fprintf (stderr, "match: mask: %x insn: %x, opcode: %x, name: %s\n", op->mask, insn, op->opcode, op->name );*/ - - memop = op->memop; - /* Now print the operands. - - MEMOP is the operand number at which a memory - address specification starts, or zero if this - instruction has no memory addresses. - - A memory address is always two arguments. - - This information allows us to determine when to - insert commas into the output stream as well as - when to insert disp[reg] expressions onto the - output stream. */ - - for (opindex_ptr = op->operands, opnum = 1; - *opindex_ptr != 0; - opindex_ptr++, opnum++) - { - long value; - int flag; - int status; - bfd_byte buffer[ 4 ]; - - operand = &v850_operands[*opindex_ptr]; - - if (operand->extract) - value = (operand->extract) (insn, 0); - else - { - if (operand->bits == -1) - value = (insn & operand->shift); - else - value = (insn >> operand->shift) & ((1 << operand->bits) - 1); - - if (operand->flags & V850_OPERAND_SIGNED) - value = ((long)(value << (32 - operand->bits)) - >> (32 - operand->bits)); - } - - /* The first operand is always output without any - special handling. - - For the following arguments: - - If memop && opnum == memop + 1, then we need '[' since - we're about to output the register used in a memory - reference. - - If memop && opnum == memop + 2, then we need ']' since - we just finished the register in a memory reference. We - also need a ',' before this operand. - - Else we just need a comma. - - We may need to output a trailing ']' if the last operand - in an instruction is the register for a memory address. - - The exception (and there's always an exception) is the - "jmp" insn which needs square brackets around it's only - register argument. */ - - if (memop && opnum == memop + 1) info->fprintf_func (info->stream, "["); - else if (memop && opnum == memop + 2) info->fprintf_func (info->stream, "],"); - else if (memop == 1 && opnum == 1 - && (operand->flags & V850_OPERAND_REG)) - info->fprintf_func (info->stream, "["); - else if (opnum > 1) info->fprintf_func (info->stream, ", "); - - /* extract the flags, ignorng ones which do not effect disassembly output. */ - flag = operand->flags; - flag &= ~ V850_OPERAND_SIGNED; - flag &= ~ V850_OPERAND_RELAX; - flag &= - flag; - - switch (flag) - { - case V850_OPERAND_REG: info->fprintf_func (info->stream, "%s", v850_reg_names[value]); break; - case V850_OPERAND_SRG: info->fprintf_func (info->stream, "%s", v850_sreg_names[value]); break; - case V850_OPERAND_CC: info->fprintf_func (info->stream, "%s", v850_cc_names[value]); break; - case V850_OPERAND_EP: info->fprintf_func (info->stream, "ep"); break; - default: info->fprintf_func (info->stream, "%d", value); break; - case V850_OPERAND_DISP: - { - bfd_vma addr = value + memaddr; - - /* On the v850 the top 8 bits of an address are used by an overlay manager. - Thus it may happen that when we are looking for a symbol to match - against an address with some of its top bits set, the search fails to - turn up an exact match. In this case we try to find an exact match - against a symbol in the lower address space, and if we find one, we - use that address. We only do this for JARL instructions however, as - we do not want to misinterpret branch instructions. */ - if (operand->bits == 22) - { - if ( ! info->symbol_at_address_func (addr, info) - && ((addr & 0xFF000000) != 0) - && info->symbol_at_address_func (addr & 0x00FFFFFF, info)) - { - addr &= 0x00FFFFFF; - } - } - info->print_address_func (addr, info); - break; - } - - case V850E_PUSH_POP: - { - static int list12_regs[32] = { 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 29, 28, 23, 22, 21, 20, 27, 26, 25, 24 }; - static int list18_h_regs[32] = { 19, 18, 17, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 30, 31, 29, 28, 23, 22, 21, 20, 27, 26, 25, 24 }; - static int list18_l_regs[32] = { 3, 2, 1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 14, 15, 13, 12, 7, 6, 5, 4, 11, 10, 9, 8 }; - int * regs; - int i; - unsigned long int mask = 0; - int pc = false; - int sr = false; - - - switch (operand->shift) - { - case 0xffe00001: regs = list12_regs; break; - case 0xfff8000f: regs = list18_h_regs; break; - case 0xfff8001f: regs = list18_l_regs; value &= ~0x10; break; /* Do not include magic bit */ - default: - /* xgettext:c-format */ - fprintf (stderr, _("unknown operand shift: %x\n"), operand->shift ); - abort(); - } - - for (i = 0; i < 32; i++) - { - if (value & (1 << i)) - { - switch (regs[ i ]) - { - default: mask |= (1 << regs[ i ]); break; - /* xgettext:c-format */ - case 0: fprintf (stderr, _("unknown pop reg: %d\n"), i ); abort(); - case -1: pc = true; break; - case -2: sr = true; break; - } - } - } - - info->fprintf_func (info->stream, "{"); - - if (mask || pc || sr) - { - if (mask) - { - unsigned int bit; - int shown_one = false; - - for (bit = 0; bit < 32; bit++) - if (mask & (1 << bit)) - { - unsigned long int first = bit; - unsigned long int last; - - if (shown_one) - info->fprintf_func (info->stream, ", "); - else - shown_one = true; - - info->fprintf_func (info->stream, v850_reg_names[first]); - - for (bit++; bit < 32; bit++) - if ((mask & (1 << bit)) == 0) - break; - - last = bit; - - if (last > first + 1) - { - info->fprintf_func (info->stream, " - %s", v850_reg_names[ last - 1 ]); - } - } - } - - if (pc) - info->fprintf_func (info->stream, "%sPC", mask ? ", " : ""); - if (sr) - info->fprintf_func (info->stream, "%sSR", (mask || pc) ? ", " : ""); - } - - info->fprintf_func (info->stream, "}"); - } - break; - - case V850E_IMMEDIATE16: - status = info->read_memory_func (memaddr + bytes_read, buffer, 2, info); - if (status == 0) - { - bytes_read += 2; - value = bfd_getl16 (buffer); - - /* If this is a DISPOSE instruction with ff set to 0x10, then shift value up by 16. */ - if ((insn & 0x001fffc0) == 0x00130780) - value <<= 16; - - info->fprintf_func (info->stream, "0x%x", value); - } - else - { - info->memory_error_func (status, memaddr + bytes_read, info); - } - break; - - case V850E_IMMEDIATE32: - status = info->read_memory_func (memaddr + bytes_read, buffer, 4, info); - if (status == 0) - { - bytes_read += 4; - value = bfd_getl32 (buffer); - info->fprintf_func (info->stream, "0x%lx", value); - } - else - { - info->memory_error_func (status, memaddr + bytes_read, info); - } - break; - } - - /* Handle jmp correctly. */ - if (memop == 1 && opnum == 1 - && ((operand->flags & V850_OPERAND_REG) != 0)) - (*info->fprintf_func) (info->stream, "]"); - } - - /* Close any square bracket we left open. */ - if (memop && opnum == memop + 2) - (*info->fprintf_func) (info->stream, "]"); - - /* All done. */ - break; - } - op++; - } - - if (!match) - { - if (short_op) - info->fprintf_func (info->stream, ".short\t0x%04x", insn); - else - info->fprintf_func (info->stream, ".long\t0x%08x", insn); - } - - return bytes_read; -} - -int -print_insn_v850 (memaddr, info) - bfd_vma memaddr; - struct disassemble_info * info; -{ - int status; - bfd_byte buffer[ 4 ]; - unsigned long insn = 0; - - /* First figure out how big the opcode is. */ - - status = info->read_memory_func (memaddr, buffer, 2, info); - if (status == 0) - { - insn = bfd_getl16 (buffer); - - if ( (insn & 0x0600) == 0x0600 - && (insn & 0xffe0) != 0x0620) - { - /* If this is a 4 byte insn, read 4 bytes of stuff. */ - status = info->read_memory_func (memaddr, buffer, 4, info); - - if (status == 0) - insn = bfd_getl32 (buffer); - } - } - - if (status != 0) - { - info->memory_error_func (status, memaddr, info); - return -1; - } - - /* Make sure we tell our caller how many bytes we consumed. */ - return disassemble (memaddr, info, insn); -} diff --git a/contrib/binutils/opcodes/v850-opc.c b/contrib/binutils/opcodes/v850-opc.c deleted file mode 100644 index 20a4d6d64644..000000000000 --- a/contrib/binutils/opcodes/v850-opc.c +++ /dev/null @@ -1,786 +0,0 @@ -/* Assemble V850 instructions. - Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "sysdep.h" -#include "opcode/v850.h" -#include <stdio.h> -#include "opintl.h" - -/* regular opcode */ -#define OP(x) ((x & 0x3f) << 5) -#define OP_MASK OP (0x3f) - -/* conditional branch opcode */ -#define BOP(x) ((0x0b << 7) | (x & 0x0f)) -#define BOP_MASK ((0x0f << 7) | 0x0f) - -/* one-word opcodes */ -#define one(x) ((unsigned int) (x)) - -/* two-word opcodes */ -#define two(x,y) ((unsigned int) (x) | ((unsigned int) (y) << 16)) - - - -/* The functions used to insert and extract complicated operands. */ - -/* Note: There is a conspiracy between these functions and - v850_insert_operand() in gas/config/tc-v850.c. Error messages - containing the string 'out of range' will be ignored unless a - specific command line option is given to GAS. */ - -static const char * not_valid = N_ ("displacement value is not in range and is not aligned"); -static const char * out_of_range = N_ ("displacement value is out of range"); -static const char * not_aligned = N_ ("displacement value is not aligned"); - -static const char * immediate_out_of_range = N_ ("immediate value is out of range"); - -static unsigned long -insert_d9 (insn, value, errmsg) - unsigned long insn; - long value; - const char ** errmsg; -{ - if (value > 0xff || value < -0x100) - { - if ((value % 2) != 0) - * errmsg = _("branch value not in range and to odd offset"); - else - * errmsg = _("branch value out of range"); - } - else if ((value % 2) != 0) - * errmsg = _("branch to odd offset"); - - return (insn | ((value & 0x1f0) << 7) | ((value & 0x0e) << 3)); -} - -static unsigned long -extract_d9 (insn, invalid) - unsigned long insn; - int * invalid; -{ - unsigned long ret = ((insn & 0xf800) >> 7) | ((insn & 0x0070) >> 3); - - if ((insn & 0x8000) != 0) - ret -= 0x0200; - - return ret; -} - -static unsigned long -insert_d22 (insn, value, errmsg) - unsigned long insn; - long value; - const char ** errmsg; -{ - if (value > 0x1fffff || value < -0x200000) - { - if ((value % 2) != 0) - * errmsg = _("branch value not in range and to an odd offset"); - else - * errmsg = _("branch value out of range"); - } - else if ((value % 2) != 0) - * errmsg = _("branch to odd offset"); - - return (insn | ((value & 0xfffe) << 16) | ((value & 0x3f0000) >> 16)); -} - -static unsigned long -extract_d22 (insn, invalid) - unsigned long insn; - int * invalid; -{ - signed long ret = ((insn & 0xfffe0000) >> 16) | ((insn & 0x3f) << 16); - - return (unsigned long) ((ret << 10) >> 10); -} - -static unsigned long -insert_d16_15 (insn, value, errmsg) - unsigned long insn; - long value; - const char ** errmsg; -{ - if (value > 0x7fff || value < -0x8000) - { - if ((value % 2) != 0) - * errmsg = _(not_valid); - else - * errmsg = _(out_of_range); - } - else if ((value % 2) != 0) - * errmsg = _(not_aligned); - - return insn | ((value & 0xfffe) << 16); -} - -static unsigned long -extract_d16_15 (insn, invalid) - unsigned long insn; - int * invalid; -{ - signed long ret = (insn & 0xfffe0000); - - return ret >> 16; -} - -static unsigned long -insert_d8_7 (insn, value, errmsg) - unsigned long insn; - long value; - const char ** errmsg; -{ - if (value > 0xff || value < 0) - { - if ((value % 2) != 0) - * errmsg = _(not_valid); - else - * errmsg = _(out_of_range); - } - else if ((value % 2) != 0) - * errmsg = _(not_aligned); - - value >>= 1; - - return (insn | (value & 0x7f)); -} - -static unsigned long -extract_d8_7 (insn, invalid) - unsigned long insn; - int * invalid; -{ - unsigned long ret = (insn & 0x7f); - - return ret << 1; -} - -static unsigned long -insert_d8_6 (insn, value, errmsg) - unsigned long insn; - long value; - const char ** errmsg; -{ - if (value > 0xff || value < 0) - { - if ((value % 4) != 0) - *errmsg = _(not_valid); - else - * errmsg = _(out_of_range); - } - else if ((value % 4) != 0) - * errmsg = _(not_aligned); - - value >>= 1; - - return (insn | (value & 0x7e)); -} - -static unsigned long -extract_d8_6 (insn, invalid) - unsigned long insn; - int * invalid; -{ - unsigned long ret = (insn & 0x7e); - - return ret << 1; -} - -static unsigned long -insert_d5_4 (insn, value, errmsg) - unsigned long insn; - long value; - const char ** errmsg; -{ - if (value > 0x1f || value < 0) - { - if (value & 1) - * errmsg = _(not_valid); - else - *errmsg = _(out_of_range); - } - else if (value & 1) - * errmsg = _(not_aligned); - - value >>= 1; - - return (insn | (value & 0x0f)); -} - -static unsigned long -extract_d5_4 (insn, invalid) - unsigned long insn; - int * invalid; -{ - unsigned long ret = (insn & 0x0f); - - return ret << 1; -} - -static unsigned long -insert_d16_16 (insn, value, errmsg) - unsigned long insn; - signed long value; - const char ** errmsg; -{ - if (value > 0x7fff || value < -0x8000) - * errmsg = _(out_of_range); - - return (insn | ((value & 0xfffe) << 16) | ((value & 1) << 5)); -} - -static unsigned long -extract_d16_16 (insn, invalid) - unsigned long insn; - int * invalid; -{ - signed long ret = insn & 0xfffe0000; - - ret >>= 16; - - ret |= ((insn & 0x20) >> 5); - - return ret; -} - -static unsigned long -insert_i9 (insn, value, errmsg) - unsigned long insn; - signed long value; - const char ** errmsg; -{ - if (value > 0xff || value < -0x100) - * errmsg = _(immediate_out_of_range); - - return insn | ((value & 0x1e0) << 13) | (value & 0x1f); -} - -static unsigned long -extract_i9 (insn, invalid) - unsigned long insn; - int * invalid; -{ - signed long ret = insn & 0x003c0000; - - ret <<= 10; - ret >>= 23; - - ret |= (insn & 0x1f); - - return ret; -} - -static unsigned long -insert_u9 (insn, value, errmsg) - unsigned long insn; - unsigned long value; - const char ** errmsg; -{ - if (value > 0x1ff) - * errmsg = _(immediate_out_of_range); - - return insn | ((value & 0x1e0) << 13) | (value & 0x1f); -} - -static unsigned long -extract_u9 (insn, invalid) - unsigned long insn; - int * invalid; -{ - unsigned long ret = insn & 0x003c0000; - - ret >>= 13; - - ret |= (insn & 0x1f); - - return ret; -} - -static unsigned long -insert_spe (insn, value, errmsg) - unsigned long insn; - unsigned long value; - const char ** errmsg; -{ - if (value != 3) - * errmsg = _("invalid register for stack adjustment"); - - return insn & (~ 0x180000); -} - -static unsigned long -extract_spe (insn, invalid) - unsigned long insn; - int * invalid; -{ - return 3; -} - -static unsigned long -insert_i5div (insn, value, errmsg) - unsigned long insn; - unsigned long value; - const char ** errmsg; -{ - if (value > 0x1ff) - { - if (value & 1) - * errmsg = _("immediate value not in range and not even"); - else - * errmsg = _(immediate_out_of_range); - } - else if (value & 1) - * errmsg = _("immediate value must be even"); - - value = 32 - value; - - return insn | ((value & 0x1e) << 17); -} - -static unsigned long -extract_i5div (insn, invalid) - unsigned long insn; - int * invalid; -{ - unsigned long ret = insn & 0x3c0000; - - ret >>= 17; - - ret = 32 - ret; - - return ret; -} - - -/* Warning: code in gas/config/tc-v850.c examines the contents of this array. - If you change any of the values here, be sure to look for side effects in - that code. */ -const struct v850_operand v850_operands[] = -{ -#define UNUSED 0 - { 0, 0, NULL, NULL, 0 }, - -/* The R1 field in a format 1, 6, 7, or 9 insn. */ -#define R1 (UNUSED + 1) - { 5, 0, NULL, NULL, V850_OPERAND_REG }, - -/* As above, but register 0 is not allowed. */ -#define R1_NOTR0 (R1 + 1) - { 5, 0, NULL, NULL, V850_OPERAND_REG | V850_NOT_R0 }, - -/* The R2 field in a format 1, 2, 4, 5, 6, 7, 9 insn. */ -#define R2 (R1_NOTR0 + 1) - { 5, 11, NULL, NULL, V850_OPERAND_REG }, - -/* As above, but register 0 is not allowed. */ -#define R2_NOTR0 (R2 + 1) - { 5, 11, NULL, NULL, V850_OPERAND_REG | V850_NOT_R0 }, - -/* The imm5 field in a format 2 insn. */ -#define I5 (R2_NOTR0 + 1) - { 5, 0, NULL, NULL, V850_OPERAND_SIGNED }, - -/* The unsigned imm5 field in a format 2 insn. */ -#define I5U (I5 + 1) - { 5, 0, NULL, NULL, 0 }, - -/* The imm16 field in a format 6 insn. */ -#define I16 (I5U + 1) - { 16, 16, NULL, NULL, V850_OPERAND_SIGNED }, - -/* The signed disp7 field in a format 4 insn. */ -#define D7 (I16 + 1) - { 7, 0, NULL, NULL, 0}, - -/* The disp16 field in a format 6 insn. */ -#define D16_15 (D7 + 1) - { 15, 17, insert_d16_15, extract_d16_15, V850_OPERAND_SIGNED }, - -/* The 3 bit immediate field in format 8 insn. */ -#define B3 (D16_15 + 1) - { 3, 11, NULL, NULL, 0 }, - -/* The 4 bit condition code in a setf instruction */ -#define CCCC (B3 + 1) - { 4, 0, NULL, NULL, V850_OPERAND_CC }, - -/* The unsigned DISP8 field in a format 4 insn. */ -#define D8_7 (CCCC + 1) - { 7, 0, insert_d8_7, extract_d8_7, 0 }, - -/* The unsigned DISP8 field in a format 4 insn. */ -#define D8_6 (D8_7 + 1) - { 6, 1, insert_d8_6, extract_d8_6, 0 }, - -/* System register operands. */ -#define SR1 (D8_6 + 1) - { 5, 0, NULL, NULL, V850_OPERAND_SRG }, - -/* EP Register. */ -#define EP (SR1 + 1) - { 0, 0, NULL, NULL, V850_OPERAND_EP }, - -/* The imm16 field (unsigned) in a format 6 insn. */ -#define I16U (EP + 1) - { 16, 16, NULL, NULL, 0}, - -/* The R2 field as a system register. */ -#define SR2 (I16U + 1) - { 5, 11, NULL, NULL, V850_OPERAND_SRG }, - -/* The disp16 field in a format 8 insn. */ -#define D16 (SR2 + 1) - { 16, 16, NULL, NULL, V850_OPERAND_SIGNED }, - -/* The DISP9 field in a format 3 insn, relaxable. */ -#define D9_RELAX (D16 + 1) - { 9, 0, insert_d9, extract_d9, V850_OPERAND_RELAX | V850_OPERAND_SIGNED | V850_OPERAND_DISP }, - -/* The DISP22 field in a format 4 insn, relaxable. - This _must_ follow D9_RELAX; the assembler assumes that the longer - version immediately follows the shorter version for relaxing. */ -#define D22 (D9_RELAX + 1) - { 22, 0, insert_d22, extract_d22, V850_OPERAND_SIGNED | V850_OPERAND_DISP }, - -/* The signed disp4 field in a format 4 insn. */ -#define D4 (D22 + 1) - { 4, 0, NULL, NULL, 0}, - -/* The unsigned disp5 field in a format 4 insn. */ -#define D5_4 (D4 + 1) - { 4, 0, insert_d5_4, extract_d5_4, 0 }, - -/* The disp16 field in an format 7 unsigned byte load insn. */ -#define D16_16 (D5_4 + 1) - { -1, 0xfffe0020, insert_d16_16, extract_d16_16, 0 }, - -/* Third register in conditional moves. */ -#define R3 (D16_16 + 1) - { 5, 27, NULL, NULL, V850_OPERAND_REG }, - -/* Condition code in conditional moves. */ -#define MOVCC (R3 + 1) - { 4, 17, NULL, NULL, V850_OPERAND_CC }, - -/* The imm9 field in a multiply word. */ -#define I9 (MOVCC + 1) - { 9, 0, insert_i9, extract_i9, V850_OPERAND_SIGNED }, - -/* The unsigned imm9 field in a multiply word. */ -#define U9 (I9 + 1) - { 9, 0, insert_u9, extract_u9, 0 }, - -/* A list of registers in a prepare/dispose instruction. */ -#define LIST12 (U9 + 1) - { -1, 0xffe00001, NULL, NULL, V850E_PUSH_POP }, - -/* The IMM6 field in a call instruction. */ -#define I6 (LIST12 + 1) - { 6, 0, NULL, NULL, 0 }, - -/* The 16 bit immediate following a 32 bit instruction. */ -#define IMM16 (I6 + 1) - { 16, 16, NULL, NULL, V850_OPERAND_SIGNED | V850E_IMMEDIATE16 }, - -/* The 32 bit immediate following a 32 bit instruction. */ -#define IMM32 (IMM16 + 1) - { 0, 0, NULL, NULL, V850E_IMMEDIATE32 }, - -/* The imm5 field in a push/pop instruction. */ -#define IMM5 (IMM32 + 1) - { 5, 1, NULL, NULL, 0 }, - -/* Reg2 in dispose instruction. */ -#define R2DISPOSE (IMM5 + 1) - { 5, 16, NULL, NULL, V850_OPERAND_REG | V850_NOT_R0 }, - -/* Stack pointer in prepare instruction. */ -#define SP (R2DISPOSE + 1) - { 2, 19, insert_spe, extract_spe, V850_OPERAND_REG }, - -/* The IMM5 field in a divide N step instruction. */ -#define I5DIV (SP + 1) - { 9, 0, insert_i5div, extract_i5div, V850_OPERAND_SIGNED }, - - /* The list of registers in a PUSHMH/POPMH instruction. */ -#define LIST18_H (I5DIV + 1) - { -1, 0xfff8000f, NULL, NULL, V850E_PUSH_POP }, - - /* The list of registers in a PUSHML/POPML instruction. */ -#define LIST18_L (LIST18_H + 1) - { -1, 0xfff8001f, NULL, NULL, V850E_PUSH_POP }, /* The setting of the 4th bit is a flag to disassmble() in v850-dis.c */ -} ; - - -/* reg-reg instruction format (Format I) */ -#define IF1 {R1, R2} - -/* imm-reg instruction format (Format II) */ -#define IF2 {I5, R2} - -/* conditional branch instruction format (Format III) */ -#define IF3 {D9_RELAX} - -/* 3 operand instruction (Format VI) */ -#define IF6 {I16, R1, R2} - -/* 3 operand instruction (Format VI) */ -#define IF6U {I16U, R1, R2} - - - -/* The opcode table. - - The format of the opcode table is: - - NAME OPCODE MASK { OPERANDS } MEMOP PROCESSOR - - NAME is the name of the instruction. - OPCODE is the instruction opcode. - MASK is the opcode mask; this is used to tell the disassembler - which bits in the actual opcode must match OPCODE. - OPERANDS is the list of operands. - MEMOP specifies which operand (if any) is a memory operand. - PROCESSORS specifies which CPU(s) support the opcode. - - The disassembler reads the table in order and prints the first - instruction which matches, so this table is sorted to put more - specific instructions before more general instructions. It is also - sorted by major opcode. - - The table is also sorted by name. This is used by the assembler. - When parsing an instruction the assembler finds the first occurance - of the name of the instruciton in this table and then attempts to - match the instruction's arguments with description of the operands - associated with the entry it has just found in this table. If the - match fails the assembler looks at the next entry in this table. - If that entry has the same name as the previous entry, then it - tries to match the instruction against that entry and so on. This - is how the assembler copes with multiple, different formats of the - same instruction. */ - -const struct v850_opcode v850_opcodes[] = -{ -{ "breakpoint", 0xffff, 0xffff, {UNUSED}, 0, PROCESSOR_ALL }, - -{ "jmp", one (0x0060), one (0xffe0), {R1}, 1, PROCESSOR_ALL }, - -/* load/store instructions */ -{ "sld.bu", one (0x0300), one (0x0780), {D7, EP, R2_NOTR0}, 1, PROCESSOR_V850EA }, -{ "sld.bu", one (0x0060), one (0x07f0), {D4, EP, R2_NOTR0}, 1, PROCESSOR_V850E }, - -{ "sld.hu", one (0x0400), one (0x0780), {D8_7, EP, R2_NOTR0}, 1, PROCESSOR_V850EA }, -{ "sld.hu", one (0x0070), one (0x07f0), {D5_4, EP, R2_NOTR0}, 1, PROCESSOR_V850E }, - -{ "sld.b", one (0x0060), one (0x07f0), {D4, EP, R2}, 1, PROCESSOR_V850EA }, -{ "sld.b", one (0x0300), one (0x0780), {D7, EP, R2}, 1, PROCESSOR_V850E }, -{ "sld.b", one (0x0300), one (0x0780), {D7, EP, R2}, 1, PROCESSOR_V850 }, - -{ "sld.h", one (0x0070), one (0x07f0), {D5_4, EP, R2}, 1, PROCESSOR_V850EA }, -{ "sld.h", one (0x0400), one (0x0780), {D8_7, EP, R2}, 1, PROCESSOR_V850E }, -{ "sld.h", one (0x0400), one (0x0780), {D8_7, EP, R2}, 1, PROCESSOR_V850 }, -{ "sld.w", one (0x0500), one (0x0781), {D8_6, EP, R2}, 1, PROCESSOR_ALL }, -{ "sst.b", one (0x0380), one (0x0780), {R2, D7, EP}, 2, PROCESSOR_ALL }, -{ "sst.h", one (0x0480), one (0x0780), {R2, D8_7, EP}, 2, PROCESSOR_ALL }, -{ "sst.w", one (0x0501), one (0x0781), {R2, D8_6, EP}, 2, PROCESSOR_ALL }, - -{ "pushml", two (0x07e0, 0x0001), two (0xfff0, 0x0007), {LIST18_L}, 0, PROCESSOR_V850EA }, -{ "pushmh", two (0x07e0, 0x0003), two (0xfff0, 0x0007), {LIST18_H}, 0, PROCESSOR_V850EA }, -{ "popml", two (0x07f0, 0x0001), two (0xfff0, 0x0007), {LIST18_L}, 0, PROCESSOR_V850EA }, -{ "popmh", two (0x07f0, 0x0003), two (0xfff0, 0x0007), {LIST18_H}, 0, PROCESSOR_V850EA }, -{ "prepare", two (0x0780, 0x0003), two (0xffc0, 0x001f), {LIST12, IMM5, SP}, 0, PROCESSOR_NOT_V850 }, -{ "prepare", two (0x0780, 0x000b), two (0xffc0, 0x001f), {LIST12, IMM5, IMM16}, 0, PROCESSOR_NOT_V850 }, -{ "prepare", two (0x0780, 0x0013), two (0xffc0, 0x001f), {LIST12, IMM5, IMM16}, 0, PROCESSOR_NOT_V850 }, -{ "prepare", two (0x0780, 0x001b), two (0xffc0, 0x001f), {LIST12, IMM5, IMM32}, 0, PROCESSOR_NOT_V850 }, -{ "prepare", two (0x0780, 0x0001), two (0xffc0, 0x001f), {LIST12, IMM5}, 0, PROCESSOR_NOT_V850 }, -{ "dispose", one (0x0640), one (0xffc0), {IMM5, LIST12, R2DISPOSE},0, PROCESSOR_NOT_V850 }, -{ "dispose", two (0x0640, 0x0000), two (0xffc0, 0x001f), {IMM5, LIST12}, 0, PROCESSOR_NOT_V850 }, - -{ "ld.b", two (0x0700, 0x0000), two (0x07e0, 0x0000), {D16, R1, R2}, 1, PROCESSOR_ALL }, -{ "ld.h", two (0x0720, 0x0000), two (0x07e0, 0x0001), {D16_15, R1, R2}, 1, PROCESSOR_ALL }, -{ "ld.w", two (0x0720, 0x0001), two (0x07e0, 0x0001), {D16_15, R1, R2}, 1, PROCESSOR_ALL }, -{ "ld.bu", two (0x0780, 0x0001), two (0x07c0, 0x0001), {D16_16, R1, R2_NOTR0}, 1, PROCESSOR_NOT_V850 }, -{ "ld.hu", two (0x07e0, 0x0001), two (0x07e0, 0x0001), {D16_15, R1, R2_NOTR0}, 1, PROCESSOR_NOT_V850 }, -{ "st.b", two (0x0740, 0x0000), two (0x07e0, 0x0000), {R2, D16, R1}, 2, PROCESSOR_ALL }, -{ "st.h", two (0x0760, 0x0000), two (0x07e0, 0x0001), {R2, D16_15, R1}, 2, PROCESSOR_ALL }, -{ "st.w", two (0x0760, 0x0001), two (0x07e0, 0x0001), {R2, D16_15, R1}, 2, PROCESSOR_ALL }, - -/* byte swap/extend instructions */ -{ "zxb", one (0x0080), one (0xffe0), {R1_NOTR0}, 0, PROCESSOR_NOT_V850 }, -{ "zxh", one (0x00c0), one (0xffe0), {R1_NOTR0}, 0, PROCESSOR_NOT_V850 }, -{ "sxb", one (0x00a0), one (0xffe0), {R1_NOTR0}, 0, PROCESSOR_NOT_V850 }, -{ "sxh", one (0x00e0), one (0xffe0), {R1_NOTR0}, 0, PROCESSOR_NOT_V850 }, -{ "bsh", two (0x07e0, 0x0342), two (0x07ff, 0x07ff), {R2, R3}, 0, PROCESSOR_NOT_V850 }, -{ "bsw", two (0x07e0, 0x0340), two (0x07ff, 0x07ff), {R2, R3}, 0, PROCESSOR_NOT_V850 }, -{ "hsw", two (0x07e0, 0x0344), two (0x07ff, 0x07ff), {R2, R3}, 0, PROCESSOR_NOT_V850 }, - -/* jump table instructions */ -{ "switch", one (0x0040), one (0xffe0), {R1}, 1, PROCESSOR_NOT_V850 }, -{ "callt", one (0x0200), one (0xffc0), {I6}, 0, PROCESSOR_NOT_V850 }, -{ "ctret", two (0x07e0, 0x0144), two (0xffff, 0xffff), {0}, 0, PROCESSOR_NOT_V850 }, - -/* arithmetic operation instructions */ -{ "setf", two (0x07e0, 0x0000), two (0x07f0, 0xffff), {CCCC, R2}, 0, PROCESSOR_ALL }, -{ "cmov", two (0x07e0, 0x0320), two (0x07e0, 0x07e1), {MOVCC, R1, R2, R3}, 0, PROCESSOR_NOT_V850 }, -{ "cmov", two (0x07e0, 0x0300), two (0x07e0, 0x07e1), {MOVCC, I5, R2, R3}, 0, PROCESSOR_NOT_V850 }, - -{ "mul", two (0x07e0, 0x0220), two (0x07e0, 0x07ff), {R1, R2, R3}, 0, PROCESSOR_NOT_V850 }, -{ "mul", two (0x07e0, 0x0240), two (0x07e0, 0x07c3), {I9, R2, R3}, 0, PROCESSOR_NOT_V850 }, -{ "mulu", two (0x07e0, 0x0222), two (0x07e0, 0x07ff), {R1, R2, R3}, 0, PROCESSOR_NOT_V850 }, -{ "mulu", two (0x07e0, 0x0242), two (0x07e0, 0x07c3), {U9, R2, R3}, 0, PROCESSOR_NOT_V850 }, - -{ "div", two (0x07e0, 0x02c0), two (0x07e0, 0x07ff), {R1, R2, R3}, 0, PROCESSOR_NOT_V850 }, -{ "divu", two (0x07e0, 0x02c2), two (0x07e0, 0x07ff), {R1, R2, R3}, 0, PROCESSOR_NOT_V850 }, -{ "divhu", two (0x07e0, 0x0282), two (0x07e0, 0x07ff), {R1, R2, R3}, 0, PROCESSOR_NOT_V850 }, -{ "divh", two (0x07e0, 0x0280), two (0x07e0, 0x07ff), {R1, R2, R3}, 0, PROCESSOR_NOT_V850 }, -{ "divh", OP (0x02), OP_MASK, {R1, R2_NOTR0}, 0, PROCESSOR_ALL }, - -{ "divhn", two (0x07e0, 0x0280), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, -{ "divhun", two (0x07e0, 0x0282), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, -{ "divn", two (0x07e0, 0x02c0), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, -{ "divun", two (0x07e0, 0x02c2), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, -{ "sdivhn", two (0x07e0, 0x0180), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, -{ "sdivhun", two (0x07e0, 0x0182), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, -{ "sdivn", two (0x07e0, 0x01c0), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, -{ "sdivun", two (0x07e0, 0x01c2), two (0x07e0, 0x07c3), {I5DIV, R1, R2, R3}, 0, PROCESSOR_V850EA }, - -{ "nop", one (0x00), one (0xffff), {0}, 0, PROCESSOR_ALL }, -{ "mov", OP (0x10), OP_MASK, {I5, R2_NOTR0}, 0, PROCESSOR_ALL }, -{ "mov", one (0x0620), one (0xffe0), {IMM32, R1_NOTR0}, 0, PROCESSOR_NOT_V850 }, -{ "mov", OP (0x00), OP_MASK, {R1, R2_NOTR0}, 0, PROCESSOR_ALL }, -{ "movea", OP (0x31), OP_MASK, {I16, R1, R2_NOTR0}, 0, PROCESSOR_ALL }, -{ "movhi", OP (0x32), OP_MASK, {I16U, R1, R2_NOTR0}, 0, PROCESSOR_ALL }, -{ "add", OP (0x0e), OP_MASK, IF1, 0, PROCESSOR_ALL }, -{ "add", OP (0x12), OP_MASK, IF2, 0, PROCESSOR_ALL }, -{ "addi", OP (0x30), OP_MASK, IF6, 0, PROCESSOR_ALL }, -{ "sub", OP (0x0d), OP_MASK, IF1, 0, PROCESSOR_ALL }, -{ "subr", OP (0x0c), OP_MASK, IF1, 0, PROCESSOR_ALL }, -{ "mulh", OP (0x17), OP_MASK, {I5, R2_NOTR0}, 0, PROCESSOR_ALL }, -{ "mulh", OP (0x07), OP_MASK, {R1, R2_NOTR0}, 0, PROCESSOR_ALL }, -{ "mulhi", OP (0x37), OP_MASK, {I16, R1, R2_NOTR0}, 0, PROCESSOR_ALL }, -{ "cmp", OP (0x0f), OP_MASK, IF1, 0, PROCESSOR_ALL }, -{ "cmp", OP (0x13), OP_MASK, IF2, 0, PROCESSOR_ALL }, - -/* saturated operation instructions */ -{ "satadd", OP (0x11), OP_MASK, {I5, R2_NOTR0}, 0, PROCESSOR_ALL }, -{ "satadd", OP (0x06), OP_MASK, {R1, R2_NOTR0}, 0, PROCESSOR_ALL }, -{ "satsub", OP (0x05), OP_MASK, {R1, R2_NOTR0}, 0, PROCESSOR_ALL }, -{ "satsubi", OP (0x33), OP_MASK, {I16, R1, R2_NOTR0}, 0, PROCESSOR_ALL }, -{ "satsubr", OP (0x04), OP_MASK, {R1, R2_NOTR0}, 0, PROCESSOR_ALL }, - -/* logical operation instructions */ -{ "tst", OP (0x0b), OP_MASK, IF1, 0, PROCESSOR_ALL }, -{ "or", OP (0x08), OP_MASK, IF1, 0, PROCESSOR_ALL }, -{ "ori", OP (0x34), OP_MASK, IF6U, 0, PROCESSOR_ALL }, -{ "and", OP (0x0a), OP_MASK, IF1, 0, PROCESSOR_ALL }, -{ "andi", OP (0x36), OP_MASK, IF6U, 0, PROCESSOR_ALL }, -{ "xor", OP (0x09), OP_MASK, IF1, 0, PROCESSOR_ALL }, -{ "xori", OP (0x35), OP_MASK, IF6U, 0, PROCESSOR_ALL }, -{ "not", OP (0x01), OP_MASK, IF1, 0, PROCESSOR_ALL }, -{ "sar", OP (0x15), OP_MASK, {I5U, R2}, 0, PROCESSOR_ALL }, -{ "sar", two (0x07e0, 0x00a0), two (0x07e0, 0xffff), {R1, R2}, 0, PROCESSOR_ALL }, -{ "shl", OP (0x16), OP_MASK, {I5U, R2}, 0, PROCESSOR_ALL }, -{ "shl", two (0x07e0, 0x00c0), two (0x07e0, 0xffff), {R1, R2}, 0, PROCESSOR_ALL }, -{ "shr", OP (0x14), OP_MASK, {I5U, R2}, 0, PROCESSOR_ALL }, -{ "shr", two (0x07e0, 0x0080), two (0x07e0, 0xffff), {R1, R2}, 0, PROCESSOR_ALL }, -{ "sasf", two (0x07e0, 0x0200), two (0x07f0, 0xffff), {CCCC, R2}, 0, PROCESSOR_NOT_V850 }, - -/* branch instructions */ - /* signed integer */ -{ "bgt", BOP (0xf), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "bge", BOP (0xe), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "blt", BOP (0x6), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "ble", BOP (0x7), BOP_MASK, IF3, 0, PROCESSOR_ALL }, - /* unsigned integer */ -{ "bh", BOP (0xb), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "bnh", BOP (0x3), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "bl", BOP (0x1), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "bnl", BOP (0x9), BOP_MASK, IF3, 0, PROCESSOR_ALL }, - /* common */ -{ "be", BOP (0x2), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "bne", BOP (0xa), BOP_MASK, IF3, 0, PROCESSOR_ALL }, - /* others */ -{ "bv", BOP (0x0), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "bnv", BOP (0x8), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "bn", BOP (0x4), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "bp", BOP (0xc), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "bc", BOP (0x1), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "bnc", BOP (0x9), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "bz", BOP (0x2), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "bnz", BOP (0xa), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "br", BOP (0x5), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "bsa", BOP (0xd), BOP_MASK, IF3, 0, PROCESSOR_ALL }, - -/* Branch macros. - - We use the short form in the opcode/mask fields. The assembler - will twiddle bits as necessary if the long form is needed. */ - - /* signed integer */ -{ "jgt", BOP (0xf), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jge", BOP (0xe), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jlt", BOP (0x6), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jle", BOP (0x7), BOP_MASK, IF3, 0, PROCESSOR_ALL }, - /* unsigned integer */ -{ "jh", BOP (0xb), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jnh", BOP (0x3), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jl", BOP (0x1), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jnl", BOP (0x9), BOP_MASK, IF3, 0, PROCESSOR_ALL }, - /* common */ -{ "je", BOP (0x2), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jne", BOP (0xa), BOP_MASK, IF3, 0, PROCESSOR_ALL }, - /* others */ -{ "jv", BOP (0x0), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jnv", BOP (0x8), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jn", BOP (0x4), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jp", BOP (0xc), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jc", BOP (0x1), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jnc", BOP (0x9), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jz", BOP (0x2), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jnz", BOP (0xa), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jsa", BOP (0xd), BOP_MASK, IF3, 0, PROCESSOR_ALL }, -{ "jbr", BOP (0x5), BOP_MASK, IF3, 0, PROCESSOR_ALL }, - -{ "jr", one (0x0780), two (0xffc0, 0x0001), {D22}, 0, PROCESSOR_ALL }, -{ "jarl", one (0x0780), two (0x07c0, 0x0001), {D22, R2}, 0, PROCESSOR_ALL}, - -/* bit manipulation instructions */ -{ "set1", two (0x07c0, 0x0000), two (0xc7e0, 0x0000), {B3, D16, R1}, 2, PROCESSOR_ALL }, -{ "set1", two (0x07e0, 0x00e0), two (0x07e0, 0xffff), {R2, R1}, 2, PROCESSOR_NOT_V850 }, -{ "not1", two (0x47c0, 0x0000), two (0xc7e0, 0x0000), {B3, D16, R1}, 2, PROCESSOR_ALL }, -{ "not1", two (0x07e0, 0x00e2), two (0x07e0, 0xffff), {R2, R1}, 2, PROCESSOR_NOT_V850 }, -{ "clr1", two (0x87c0, 0x0000), two (0xc7e0, 0x0000), {B3, D16, R1}, 2, PROCESSOR_ALL }, -{ "clr1", two (0x07e0, 0x00e4), two (0x07e0, 0xffff), {R2, R1}, 2, PROCESSOR_NOT_V850 }, -{ "tst1", two (0xc7c0, 0x0000), two (0xc7e0, 0x0000), {B3, D16, R1}, 2, PROCESSOR_ALL }, -{ "tst1", two (0x07e0, 0x00e6), two (0x07e0, 0xffff), {R2, R1}, 2, PROCESSOR_NOT_V850 }, - -/* special instructions */ -{ "di", two (0x07e0, 0x0160), two (0xffff, 0xffff), {0}, 0, PROCESSOR_ALL }, -{ "ei", two (0x87e0, 0x0160), two (0xffff, 0xffff), {0}, 0, PROCESSOR_ALL }, -{ "halt", two (0x07e0, 0x0120), two (0xffff, 0xffff), {0}, 0, PROCESSOR_ALL }, -{ "reti", two (0x07e0, 0x0140), two (0xffff, 0xffff), {0}, 0, PROCESSOR_ALL }, -{ "trap", two (0x07e0, 0x0100), two (0xffe0, 0xffff), {I5U}, 0, PROCESSOR_ALL }, -{ "ldsr", two (0x07e0, 0x0020), two (0x07e0, 0xffff), {R1, SR2}, 0, PROCESSOR_ALL }, -{ "stsr", two (0x07e0, 0x0040), two (0x07e0, 0xffff), {SR1, R2}, 0, PROCESSOR_ALL }, -{ 0, 0, 0, {0}, 0, 0 }, - -} ; - -const int v850_num_opcodes = - sizeof (v850_opcodes) / sizeof (v850_opcodes[0]); - diff --git a/contrib/binutils/opcodes/z8k-dis.c b/contrib/binutils/opcodes/z8k-dis.c deleted file mode 100644 index 825950059da1..000000000000 --- a/contrib/binutils/opcodes/z8k-dis.c +++ /dev/null @@ -1,574 +0,0 @@ -/* Disassemble z8000 code. - Copyright 1992, 1993, 1998, 2000 - Free Software Foundation, Inc. - -This file is part of GNU Binutils. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "sysdep.h" -#include "dis-asm.h" - -#define DEFINE_TABLE -#include "z8k-opc.h" - -#include <setjmp.h> - -typedef struct -{ - /* These are all indexed by nibble number (i.e only every other entry - of bytes is used, and every 4th entry of words). */ - unsigned char nibbles[24]; - unsigned char bytes[24]; - unsigned short words[24]; - - /* Nibble number of first word not yet fetched. */ - int max_fetched; - bfd_vma insn_start; - jmp_buf bailout; - - long tabl_index; - char instr_asmsrc[80]; - unsigned long arg_reg[0x0f]; - unsigned long immediate; - unsigned long displacement; - unsigned long address; - unsigned long cond_code; - unsigned long ctrl_code; - unsigned long flags; - unsigned long interrupts; -} -instr_data_s; - -/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive) - to ADDR (exclusive) are valid. Returns 1 for success, longjmps - on error. */ -#define FETCH_DATA(info, nibble) \ - ((nibble) < ((instr_data_s *)(info->private_data))->max_fetched \ - ? 1 : fetch_data ((info), (nibble))) - -static int -fetch_data (info, nibble) - struct disassemble_info *info; - int nibble; -{ - unsigned char mybuf[20]; - int status; - instr_data_s *priv = (instr_data_s *) info->private_data; - - if ((nibble % 4) != 0) - abort (); - - status = (*info->read_memory_func) (priv->insn_start, - (bfd_byte *) mybuf, - nibble / 2, - info); - if (status != 0) - { - (*info->memory_error_func) (status, priv->insn_start, info); - longjmp (priv->bailout, 1); - } - - { - int i; - unsigned char *p = mybuf; - - for (i = 0; i < nibble;) - { - priv->words[i] = (p[0] << 8) | p[1]; - - priv->bytes[i] = *p; - priv->nibbles[i++] = *p >> 4; - priv->nibbles[i++] = *p & 0xf; - - ++p; - priv->bytes[i] = *p; - priv->nibbles[i++] = *p >> 4; - priv->nibbles[i++] = *p & 0xf; - - ++p; - } - } - priv->max_fetched = nibble; - return 1; -} - -static char *codes[16] = -{ - "f", - "lt", - "le", - "ule", - "ov/pe", - "mi", - "eq", - "c/ult", - "t", - "ge", - "gt", - "ugt", - "nov/po", - "pl", - "ne", - "nc/uge" -}; - -int z8k_lookup_instr PARAMS ((unsigned char *, disassemble_info *)); -static void output_instr - PARAMS ((instr_data_s *, unsigned long, disassemble_info *)); -static void unpack_instr PARAMS ((instr_data_s *, int, disassemble_info *)); -static void unparse_instr PARAMS ((instr_data_s *)); - -static int -print_insn_z8k (addr, info, is_segmented) - bfd_vma addr; - disassemble_info *info; - int is_segmented; -{ - instr_data_s instr_data; - - info->private_data = (PTR) &instr_data; - instr_data.max_fetched = 0; - instr_data.insn_start = addr; - if (setjmp (instr_data.bailout) != 0) - /* Error return. */ - return -1; - - instr_data.tabl_index = z8k_lookup_instr (instr_data.nibbles, info); - if (instr_data.tabl_index > 0) - { - unpack_instr (&instr_data, is_segmented, info); - unparse_instr (&instr_data); - output_instr (&instr_data, addr, info); - return z8k_table[instr_data.tabl_index].length; - } - else - { - FETCH_DATA (info, 4); - (*info->fprintf_func) (info->stream, ".word %02x%02x", - instr_data.bytes[0], instr_data.bytes[2]); - return 2; - } -} - -int -print_insn_z8001 (addr, info) - bfd_vma addr; - disassemble_info *info; -{ - return print_insn_z8k (addr, info, 1); -} - -int -print_insn_z8002 (addr, info) - bfd_vma addr; - disassemble_info *info; -{ - return print_insn_z8k (addr, info, 0); -} - -int -z8k_lookup_instr (nibbles, info) - unsigned char *nibbles; - disassemble_info *info; -{ - - int nibl_index, tabl_index; - int nibl_matched; - unsigned short instr_nibl; - unsigned short tabl_datum, datum_class, datum_value; - - nibl_matched = 0; - tabl_index = 0; - while (!nibl_matched && z8k_table[tabl_index].name) - { - nibl_matched = 1; - for (nibl_index = 0; - nibl_index < z8k_table[tabl_index].length * 2 && nibl_matched; - nibl_index++) - { - if ((nibl_index % 4) == 0) - /* Fetch one word at a time. */ - FETCH_DATA (info, nibl_index + 4); - instr_nibl = nibbles[nibl_index]; - - tabl_datum = z8k_table[tabl_index].byte_info[nibl_index]; - datum_class = tabl_datum & CLASS_MASK; - datum_value = ~CLASS_MASK & tabl_datum; - - switch (datum_class) - { - case CLASS_BIT: - if (datum_value != instr_nibl) - nibl_matched = 0; - break; - case CLASS_00II: - if (!((~instr_nibl) & 0x4)) - nibl_matched = 0; - break; - case CLASS_01II: - if (!(instr_nibl & 0x4)) - nibl_matched = 0; - break; - case CLASS_0CCC: - if (!((~instr_nibl) & 0x8)) - nibl_matched = 0; - break; - case CLASS_1CCC: - if (!(instr_nibl & 0x8)) - nibl_matched = 0; - break; - case CLASS_0DISP7: - if (!((~instr_nibl) & 0x8)) - nibl_matched = 0; - nibl_index += 1; - break; - case CLASS_1DISP7: - if (!(instr_nibl & 0x8)) - nibl_matched = 0; - nibl_index += 1; - break; - case CLASS_REGN0: - if (instr_nibl == 0) - nibl_matched = 0; - break; - case CLASS_BIT_1OR2: - if ((instr_nibl | 0x2) != (datum_value | 0x2)) - nibl_matched = 0; - break; - default: - break; - } - } - if (nibl_matched) - { - return tabl_index; - } - - tabl_index++; - } - return -1; - -} - -static void -output_instr (instr_data, addr, info) - instr_data_s *instr_data; - unsigned long addr; - disassemble_info *info; -{ - int loop, loop_limit; - char tmp_str[20]; - char out_str[100]; - - strcpy (out_str, "\t"); - - loop_limit = z8k_table[instr_data->tabl_index].length * 2; - FETCH_DATA (info, loop_limit); - for (loop = 0; loop < loop_limit; loop++) - { - sprintf (tmp_str, "%x", instr_data->nibbles[loop]); - strcat (out_str, tmp_str); - } - - while (loop++ < 8) - { - strcat (out_str, " "); - } - - strcat (out_str, instr_data->instr_asmsrc); - - (*info->fprintf_func) (info->stream, "%s", out_str); -} - -static void -unpack_instr (instr_data, is_segmented, info) - instr_data_s *instr_data; - int is_segmented; - disassemble_info *info; -{ - int nibl_count, loop; - unsigned short instr_nibl, instr_byte, instr_word; - long instr_long; - unsigned short tabl_datum, datum_class, datum_value; - - nibl_count = 0; - loop = 0; - while (z8k_table[instr_data->tabl_index].byte_info[loop] != 0) - { - FETCH_DATA (info, nibl_count + 4 - (nibl_count % 4)); - instr_nibl = instr_data->nibbles[nibl_count]; - instr_byte = instr_data->bytes[nibl_count]; - instr_word = instr_data->words[nibl_count]; - - tabl_datum = z8k_table[instr_data->tabl_index].byte_info[loop]; - datum_class = tabl_datum & CLASS_MASK; - datum_value = tabl_datum & ~CLASS_MASK; - - switch (datum_class) - { - case CLASS_X: - instr_data->address = instr_nibl; - break; - case CLASS_BA: - instr_data->displacement = instr_nibl; - break; - case CLASS_BX: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - case CLASS_DISP: - switch (datum_value) - { - case ARG_DISP16: - instr_data->displacement = instr_word; - nibl_count += 3; - break; - case ARG_DISP12: - instr_data->displacement = instr_word & 0x0fff; - nibl_count += 2; - break; - default: - break; - } - break; - case CLASS_IMM: - switch (datum_value) - { - case ARG_IMM4: - instr_data->immediate = instr_nibl; - break; - case ARG_NIM8: - instr_data->immediate = (-instr_byte); - nibl_count += 1; - break; - case ARG_IMM8: - instr_data->immediate = instr_byte; - nibl_count += 1; - break; - case ARG_IMM16: - instr_data->immediate = instr_word; - nibl_count += 3; - break; - case ARG_IMM32: - FETCH_DATA (info, nibl_count + 8); - instr_long = (instr_data->words[nibl_count] << 16) - | (instr_data->words[nibl_count + 4]); - instr_data->immediate = instr_long; - nibl_count += 7; - break; - case ARG_IMMN: - instr_data->immediate = instr_nibl - 1; - break; - case ARG_IMM4M1: - instr_data->immediate = instr_nibl + 1; - break; - case ARG_IMM_1: - instr_data->immediate = 1; - break; - case ARG_IMM_2: - instr_data->immediate = 2; - break; - case ARG_IMM2: - instr_data->immediate = instr_nibl & 0x3; - break; - default: - break; - } - break; - case CLASS_CC: - instr_data->cond_code = instr_nibl; - break; - case CLASS_CTRL: - instr_data->ctrl_code = instr_nibl; - break; - case CLASS_DA: - case CLASS_ADDRESS: - if (is_segmented) - { - if (instr_nibl & 0x8) - { - FETCH_DATA (info, nibl_count + 8); - instr_long = (instr_data->words[nibl_count] << 16) - | (instr_data->words[nibl_count + 4]); - instr_data->address = ((instr_word & 0x7f00) << 8) + - (instr_long & 0xffff); - nibl_count += 7; - } - else - { - instr_data->address = ((instr_word & 0x7f00) << 8) + - (instr_word & 0x00ff); - nibl_count += 3; - } - } - else - { - instr_data->address = instr_word; - nibl_count += 3; - } - break; - case CLASS_0CCC: - instr_data->cond_code = instr_nibl & 0x7; - break; - case CLASS_1CCC: - instr_data->cond_code = instr_nibl & 0x7; - break; - case CLASS_0DISP7: - instr_data->displacement = instr_byte & 0x7f; - nibl_count += 1; - break; - case CLASS_1DISP7: - instr_data->displacement = instr_byte & 0x7f; - nibl_count += 1; - break; - case CLASS_01II: - instr_data->interrupts = instr_nibl & 0x3; - break; - case CLASS_00II: - instr_data->interrupts = instr_nibl & 0x3; - break; - case CLASS_BIT: - /* Do nothing. */ - break; - case CLASS_IR: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - case CLASS_FLAGS: - instr_data->flags = instr_nibl; - break; - case CLASS_REG: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - case CLASS_REG_BYTE: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - case CLASS_REG_WORD: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - case CLASS_REG_QUAD: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - case CLASS_REG_LONG: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - case CLASS_REGN0: - instr_data->arg_reg[datum_value] = instr_nibl; - break; - default: - break; - } - - loop += 1; - nibl_count += 1; - } -} - -static void -unparse_instr (instr_data) - instr_data_s *instr_data; -{ - unsigned short tabl_datum, datum_class, datum_value; - int loop, loop_limit; - char out_str[80], tmp_str[25]; - - sprintf (out_str, "\t%s\t", z8k_table[instr_data->tabl_index].name); - - loop_limit = z8k_table[instr_data->tabl_index].noperands; - for (loop = 0; loop < loop_limit; loop++) - { - if (loop) - strcat (out_str, ","); - - tabl_datum = z8k_table[instr_data->tabl_index].arg_info[loop]; - datum_class = tabl_datum & CLASS_MASK; - datum_value = tabl_datum & ~CLASS_MASK; - - switch (datum_class) - { - case CLASS_X: - sprintf (tmp_str, "0x%0lx(R%ld)", instr_data->address, - instr_data->arg_reg[datum_value]); - strcat (out_str, tmp_str); - break; - case CLASS_BA: - sprintf (tmp_str, "r%ld(#%lx)", instr_data->arg_reg[datum_value], - instr_data->immediate); - strcat (out_str, tmp_str); - break; - case CLASS_BX: - sprintf (tmp_str, "r%ld(R%ld)", instr_data->arg_reg[datum_value], - instr_data->arg_reg[ARG_RX]); - strcat (out_str, tmp_str); - break; - case CLASS_DISP: - sprintf (tmp_str, "#0x%0lx", instr_data->displacement); - strcat (out_str, tmp_str); - break; - case CLASS_IMM: - sprintf (tmp_str, "#0x%0lx", instr_data->immediate); - strcat (out_str, tmp_str); - break; - case CLASS_CC: - sprintf (tmp_str, "%s", codes[instr_data->cond_code]); - strcat (out_str, tmp_str); - break; - case CLASS_CTRL: - sprintf (tmp_str, "0x%0lx", instr_data->ctrl_code); - strcat (out_str, tmp_str); - break; - case CLASS_DA: - case CLASS_ADDRESS: - sprintf (tmp_str, "#0x%0lx", instr_data->address); - strcat (out_str, tmp_str); - break; - case CLASS_IR: - sprintf (tmp_str, "@R%ld", instr_data->arg_reg[datum_value]); - strcat (out_str, tmp_str); - break; - case CLASS_FLAGS: - sprintf (tmp_str, "0x%0lx", instr_data->flags); - strcat (out_str, tmp_str); - break; - case CLASS_REG_BYTE: - if (instr_data->arg_reg[datum_value] >= 0x8) - { - sprintf (tmp_str, "rl%ld", - instr_data->arg_reg[datum_value] - 0x8); - } - else - { - sprintf (tmp_str, "rh%ld", instr_data->arg_reg[datum_value]); - } - strcat (out_str, tmp_str); - break; - case CLASS_REG_WORD: - sprintf (tmp_str, "r%ld", instr_data->arg_reg[datum_value]); - strcat (out_str, tmp_str); - break; - case CLASS_REG_QUAD: - sprintf (tmp_str, "rq%ld", instr_data->arg_reg[datum_value]); - strcat (out_str, tmp_str); - break; - case CLASS_REG_LONG: - sprintf (tmp_str, "rr%ld", instr_data->arg_reg[datum_value]); - strcat (out_str, tmp_str); - break; - default: - break; - } - } - - strcpy (instr_data->instr_asmsrc, out_str); -} diff --git a/contrib/binutils/opcodes/z8k-opc.h b/contrib/binutils/opcodes/z8k-opc.h deleted file mode 100644 index 379a3a3c6477..000000000000 --- a/contrib/binutils/opcodes/z8k-opc.h +++ /dev/null @@ -1,4438 +0,0 @@ - /* THIS FILE IS AUTOMAGICALLY GENERATED, DON'T EDIT IT */ -#define ARG_MASK 0x0f -#define ARG_SRC 0x01 -#define ARG_DST 0x02 -#define ARG_RS 0x01 -#define ARG_RD 0x02 -#define ARG_RA 0x03 -#define ARG_RB 0x04 -#define ARG_RR 0x05 -#define ARG_RX 0x06 -#define ARG_IMM4 0x01 -#define ARG_IMM8 0x02 -#define ARG_IMM16 0x03 -#define ARG_IMM32 0x04 -#define ARG_IMMN 0x05 -#define ARG_IMMNMINUS1 0x05 -#define ARG_IMM_1 0x06 -#define ARG_IMM_2 0x07 -#define ARG_DISP16 0x08 -#define ARG_NIM8 0x09 -#define ARG_IMM2 0x0a -#define ARG_IMM1OR2 0x0b -#define ARG_DISP12 0x0b -#define ARG_DISP8 0x0c -#define ARG_IMM4M1 0x0d -#define CLASS_MASK 0x1fff0 -#define CLASS_X 0x10 -#define CLASS_BA 0x20 -#define CLASS_DA 0x30 -#define CLASS_BX 0x40 -#define CLASS_DISP 0x50 -#define CLASS_IMM 0x60 -#define CLASS_CC 0x70 -#define CLASS_CTRL 0x80 -#define CLASS_ADDRESS 0xd0 -#define CLASS_0CCC 0xe0 -#define CLASS_1CCC 0xf0 -#define CLASS_0DISP7 0x100 -#define CLASS_1DISP7 0x200 -#define CLASS_01II 0x300 -#define CLASS_00II 0x400 -#define CLASS_BIT 0x500 -#define CLASS_FLAGS 0x600 -#define CLASS_IR 0x700 -#define CLASS_DISP8 0x800 -#define CLASS_BIT_1OR2 0x900 -#define CLASS_REG 0x7000 -#define CLASS_REG_BYTE 0x2000 -#define CLASS_REG_WORD 0x3000 -#define CLASS_REG_QUAD 0x4000 -#define CLASS_REG_LONG 0x5000 -#define CLASS_REGN0 0x8000 -#define CLASS_PR 0x10000 -#define OPC_adc 0 -#define OPC_adcb 1 -#define OPC_add 2 -#define OPC_addb 3 -#define OPC_addl 4 -#define OPC_and 5 -#define OPC_andb 6 -#define OPC_bit 7 -#define OPC_bitb 8 -#define OPC_call 9 -#define OPC_calr 10 -#define OPC_clr 11 -#define OPC_clrb 12 -#define OPC_com 13 -#define OPC_comb 14 -#define OPC_comflg 15 -#define OPC_cp 16 -#define OPC_cpb 17 -#define OPC_cpd 18 -#define OPC_cpdb 19 -#define OPC_cpdr 20 -#define OPC_cpdrb 21 -#define OPC_cpi 22 -#define OPC_cpib 23 -#define OPC_cpir 24 -#define OPC_cpirb 25 -#define OPC_cpl 26 -#define OPC_cpsd 27 -#define OPC_cpsdb 28 -#define OPC_cpsdr 29 -#define OPC_cpsdrb 30 -#define OPC_cpsi 31 -#define OPC_cpsib 32 -#define OPC_cpsir 33 -#define OPC_cpsirb 34 -#define OPC_dab 35 -#define OPC_dbjnz 36 -#define OPC_dec 37 -#define OPC_decb 38 -#define OPC_di 39 -#define OPC_div 40 -#define OPC_divl 41 -#define OPC_djnz 42 -#define OPC_ei 43 -#define OPC_ex 44 -#define OPC_exb 45 -#define OPC_exts 46 -#define OPC_extsb 47 -#define OPC_extsl 48 -#define OPC_halt 49 -#define OPC_in 50 -#define OPC_inb 51 -#define OPC_inc 52 -#define OPC_incb 53 -#define OPC_ind 54 -#define OPC_indb 55 -#define OPC_inib 56 -#define OPC_inibr 57 -#define OPC_iret 58 -#define OPC_jp 59 -#define OPC_jr 60 -#define OPC_ld 61 -#define OPC_lda 62 -#define OPC_ldar 63 -#define OPC_ldb 64 -#define OPC_ldctl 65 -#define OPC_ldir 66 -#define OPC_ldirb 67 -#define OPC_ldk 68 -#define OPC_ldl 69 -#define OPC_ldm 70 -#define OPC_ldps 71 -#define OPC_ldr 72 -#define OPC_ldrb 73 -#define OPC_ldrl 74 -#define OPC_mbit 75 -#define OPC_mreq 76 -#define OPC_mres 77 -#define OPC_mset 78 -#define OPC_mult 79 -#define OPC_multl 80 -#define OPC_neg 81 -#define OPC_negb 82 -#define OPC_nop 83 -#define OPC_or 84 -#define OPC_orb 85 -#define OPC_out 86 -#define OPC_outb 87 -#define OPC_outd 88 -#define OPC_outdb 89 -#define OPC_outib 90 -#define OPC_outibr 91 -#define OPC_pop 92 -#define OPC_popl 93 -#define OPC_push 94 -#define OPC_pushl 95 -#define OPC_res 96 -#define OPC_resb 97 -#define OPC_resflg 98 -#define OPC_ret 99 -#define OPC_rl 100 -#define OPC_rlb 101 -#define OPC_rlc 102 -#define OPC_rlcb 103 -#define OPC_rldb 104 -#define OPC_rr 105 -#define OPC_rrb 106 -#define OPC_rrc 107 -#define OPC_rrcb 108 -#define OPC_rrdb 109 -#define OPC_sbc 110 -#define OPC_sbcb 111 -#define OPC_sda 112 -#define OPC_sdab 113 -#define OPC_sdal 114 -#define OPC_sdl 115 -#define OPC_sdlb 116 -#define OPC_sdll 117 -#define OPC_set 118 -#define OPC_setb 119 -#define OPC_setflg 120 -#define OPC_sinb 121 -#define OPC_sind 122 -#define OPC_sindb 123 -#define OPC_sinib 124 -#define OPC_sinibr 125 -#define OPC_sla 126 -#define OPC_slab 127 -#define OPC_slal 128 -#define OPC_sll 129 -#define OPC_sllb 130 -#define OPC_slll 131 -#define OPC_sout 132 -#define OPC_soutb 133 -#define OPC_soutd 134 -#define OPC_soutdb 135 -#define OPC_soutib 136 -#define OPC_soutibr 137 -#define OPC_sra 138 -#define OPC_srab 139 -#define OPC_sral 140 -#define OPC_srl 141 -#define OPC_srlb 142 -#define OPC_srll 143 -#define OPC_sub 144 -#define OPC_subb 145 -#define OPC_subl 146 -#define OPC_tcc 147 -#define OPC_tccb 148 -#define OPC_test 149 -#define OPC_testb 150 -#define OPC_testl 151 -#define OPC_trdb 152 -#define OPC_trdrb 153 -#define OPC_trib 154 -#define OPC_trirb 155 -#define OPC_trtdrb 156 -#define OPC_trtib 157 -#define OPC_trtirb 158 -#define OPC_trtdb 159 -#define OPC_tset 160 -#define OPC_tsetb 161 -#define OPC_xor 162 -#define OPC_xorb 163 -#define OPC_ldd 164 -#define OPC_lddb 165 -#define OPC_lddr 166 -#define OPC_lddrb 167 -#define OPC_ldi 168 -#define OPC_ldib 169 -#define OPC_sc 170 -#define OPC_bpt 171 -#define OPC_ext0e 172 -#define OPC_ext0f 172 -#define OPC_ext8e 172 -#define OPC_ext8f 172 -#define OPC_rsvd36 172 -#define OPC_rsvd38 172 -#define OPC_rsvd78 172 -#define OPC_rsvd7e 172 -#define OPC_rsvd9d 172 -#define OPC_rsvd9f 172 -#define OPC_rsvdb9 172 -#define OPC_rsvdbf 172 -#define OPC_outi 173 -typedef struct { -#ifdef NICENAMES -char *nicename; -int type; -int cycles; -int flags; -#endif -char *name; -unsigned char opcode; -void (*func)(); -unsigned int arg_info[4]; -unsigned int byte_info[10]; -int noperands; -int length; -int idx; -} opcode_entry_type; -#ifdef DEFINE_TABLE -opcode_entry_type z8k_table[] = { - - -/* 1011 0101 ssss dddd *** adc rd,rs */ -{ -#ifdef NICENAMES -"adc rd,rs",16,5, -0x3c, -#endif -"adc",OPC_adc,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+0xb,CLASS_BIT+5,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,0}, - - -/* 1011 0100 ssss dddd *** adcb rbd,rbs */ -{ -#ifdef NICENAMES -"adcb rbd,rbs",8,5, -0x3f, -#endif -"adcb",OPC_adcb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+0xb,CLASS_BIT+4,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,1}, - - -/* 0000 0001 ssN0 dddd *** add rd,@rs */ -{ -#ifdef NICENAMES -"add rd,@rs",16,7, -0x3c, -#endif -"add",OPC_add,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+0,CLASS_BIT+1,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,2}, - - -/* 0100 0001 0000 dddd address_src *** add rd,address_src */ -{ -#ifdef NICENAMES -"add rd,address_src",16,9, -0x3c, -#endif -"add",OPC_add,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+4,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,3}, - - -/* 0100 0001 ssN0 dddd address_src *** add rd,address_src(rs) */ -{ -#ifdef NICENAMES -"add rd,address_src(rs)",16,10, -0x3c, -#endif -"add",OPC_add,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+4,CLASS_BIT+1,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,4}, - - -/* 0000 0001 0000 dddd imm16 *** add rd,imm16 */ -{ -#ifdef NICENAMES -"add rd,imm16",16,7, -0x3c, -#endif -"add",OPC_add,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+0,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,5}, - - -/* 1000 0001 ssss dddd *** add rd,rs */ -{ -#ifdef NICENAMES -"add rd,rs",16,4, -0x3c, -#endif -"add",OPC_add,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+8,CLASS_BIT+1,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,6}, - - -/* 0000 0000 ssN0 dddd *** addb rbd,@rs */ -{ -#ifdef NICENAMES -"addb rbd,@rs",8,7, -0x3f, -#endif -"addb",OPC_addb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+0,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,7}, - - -/* 0100 0000 0000 dddd address_src *** addb rbd,address_src */ -{ -#ifdef NICENAMES -"addb rbd,address_src",8,9, -0x3f, -#endif -"addb",OPC_addb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+4,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,8}, - - -/* 0100 0000 ssN0 dddd address_src *** addb rbd,address_src(rs) */ -{ -#ifdef NICENAMES -"addb rbd,address_src(rs)",8,10, -0x3f, -#endif -"addb",OPC_addb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+4,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,9}, - - -/* 0000 0000 0000 dddd imm8 imm8 *** addb rbd,imm8 */ -{ -#ifdef NICENAMES -"addb rbd,imm8",8,7, -0x3f, -#endif -"addb",OPC_addb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,10}, - - -/* 1000 0000 ssss dddd *** addb rbd,rbs */ -{ -#ifdef NICENAMES -"addb rbd,rbs",8,4, -0x3f, -#endif -"addb",OPC_addb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,11}, - - -/* 0001 0110 ssN0 dddd *** addl rrd,@rs */ -{ -#ifdef NICENAMES -"addl rrd,@rs",32,14, -0x3c, -#endif -"addl",OPC_addl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+1,CLASS_BIT+6,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,12}, - - -/* 0101 0110 0000 dddd address_src *** addl rrd,address_src */ -{ -#ifdef NICENAMES -"addl rrd,address_src",32,15, -0x3c, -#endif -"addl",OPC_addl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+5,CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,13}, - - -/* 0101 0110 ssN0 dddd address_src *** addl rrd,address_src(rs) */ -{ -#ifdef NICENAMES -"addl rrd,address_src(rs)",32,16, -0x3c, -#endif -"addl",OPC_addl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+6,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,14}, - - -/* 0001 0110 0000 dddd imm32 *** addl rrd,imm32 */ -{ -#ifdef NICENAMES -"addl rrd,imm32",32,14, -0x3c, -#endif -"addl",OPC_addl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM32),}, - {CLASS_BIT+1,CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,15}, - - -/* 1001 0110 ssss dddd *** addl rrd,rrs */ -{ -#ifdef NICENAMES -"addl rrd,rrs",32,8, -0x3c, -#endif -"addl",OPC_addl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_LONG+(ARG_RS),}, - {CLASS_BIT+9,CLASS_BIT+6,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,16}, - - -/* 0000 0111 ssN0 dddd *** and rd,@rs */ -{ -#ifdef NICENAMES -"and rd,@rs",16,7, -0x18, -#endif -"and",OPC_and,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+0,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,17}, - - -/* 0100 0111 0000 dddd address_src *** and rd,address_src */ -{ -#ifdef NICENAMES -"and rd,address_src",16,9, -0x18, -#endif -"and",OPC_and,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+4,CLASS_BIT+7,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,18}, - - -/* 0100 0111 ssN0 dddd address_src *** and rd,address_src(rs) */ -{ -#ifdef NICENAMES -"and rd,address_src(rs)",16,10, -0x18, -#endif -"and",OPC_and,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+4,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,19}, - - -/* 0000 0111 0000 dddd imm16 *** and rd,imm16 */ -{ -#ifdef NICENAMES -"and rd,imm16",16,7, -0x18, -#endif -"and",OPC_and,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+0,CLASS_BIT+7,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,20}, - - -/* 1000 0111 ssss dddd *** and rd,rs */ -{ -#ifdef NICENAMES -"and rd,rs",16,4, -0x18, -#endif -"and",OPC_and,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+8,CLASS_BIT+7,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,21}, - - -/* 0000 0110 ssN0 dddd *** andb rbd,@rs */ -{ -#ifdef NICENAMES -"andb rbd,@rs",8,7, -0x1c, -#endif -"andb",OPC_andb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+0,CLASS_BIT+6,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,22}, - - -/* 0100 0110 0000 dddd address_src *** andb rbd,address_src */ -{ -#ifdef NICENAMES -"andb rbd,address_src",8,9, -0x1c, -#endif -"andb",OPC_andb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+4,CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,23}, - - -/* 0100 0110 ssN0 dddd address_src *** andb rbd,address_src(rs) */ -{ -#ifdef NICENAMES -"andb rbd,address_src(rs)",8,10, -0x1c, -#endif -"andb",OPC_andb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+4,CLASS_BIT+6,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,24}, - - -/* 0000 0110 0000 dddd imm8 imm8 *** andb rbd,imm8 */ -{ -#ifdef NICENAMES -"andb rbd,imm8",8,7, -0x1c, -#endif -"andb",OPC_andb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0,CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,25}, - - -/* 1000 0110 ssss dddd *** andb rbd,rbs */ -{ -#ifdef NICENAMES -"andb rbd,rbs",8,4, -0x1c, -#endif -"andb",OPC_andb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+8,CLASS_BIT+6,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,26}, - - -/* 0010 0111 ddN0 imm4 *** bit @rd,imm4 */ -{ -#ifdef NICENAMES -"bit @rd,imm4",16,8, -0x10, -#endif -"bit",OPC_bit,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+2,CLASS_BIT+7,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,27}, - - -/* 0110 0111 ddN0 imm4 address_dst *** bit address_dst(rd),imm4 */ -{ -#ifdef NICENAMES -"bit address_dst(rd),imm4",16,11, -0x10, -#endif -"bit",OPC_bit,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+6,CLASS_BIT+7,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,28}, - - -/* 0110 0111 0000 imm4 address_dst *** bit address_dst,imm4 */ -{ -#ifdef NICENAMES -"bit address_dst,imm4",16,10, -0x10, -#endif -"bit",OPC_bit,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+6,CLASS_BIT+7,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,29}, - - -/* 1010 0111 dddd imm4 *** bit rd,imm4 */ -{ -#ifdef NICENAMES -"bit rd,imm4",16,4, -0x10, -#endif -"bit",OPC_bit,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+0xa,CLASS_BIT+7,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,30}, - - -/* 0010 0111 0000 ssss 0000 dddd 0000 0000 *** bit rd,rs */ -{ -#ifdef NICENAMES -"bit rd,rs",16,10, -0x10, -#endif -"bit",OPC_bit,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+2,CLASS_BIT+7,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,31}, - - -/* 0010 0110 ddN0 imm4 *** bitb @rd,imm4 */ -{ -#ifdef NICENAMES -"bitb @rd,imm4",8,8, -0x10, -#endif -"bitb",OPC_bitb,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+2,CLASS_BIT+6,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,32}, - - -/* 0110 0110 ddN0 imm4 address_dst *** bitb address_dst(rd),imm4 */ -{ -#ifdef NICENAMES -"bitb address_dst(rd),imm4",8,11, -0x10, -#endif -"bitb",OPC_bitb,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+6,CLASS_BIT+6,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,33}, - - -/* 0110 0110 0000 imm4 address_dst *** bitb address_dst,imm4 */ -{ -#ifdef NICENAMES -"bitb address_dst,imm4",8,10, -0x10, -#endif -"bitb",OPC_bitb,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+6,CLASS_BIT+6,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,34}, - - -/* 1010 0110 dddd imm4 *** bitb rbd,imm4 */ -{ -#ifdef NICENAMES -"bitb rbd,imm4",8,4, -0x10, -#endif -"bitb",OPC_bitb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+0xa,CLASS_BIT+6,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,35}, - - -/* 0010 0110 0000 ssss 0000 dddd 0000 0000 *** bitb rbd,rs */ -{ -#ifdef NICENAMES -"bitb rbd,rs",8,10, -0x10, -#endif -"bitb",OPC_bitb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+2,CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,36}, - - -/* 0011 0110 0000 0000 *** bpt */ -{ -#ifdef NICENAMES -"bpt",8,2, -0x00, -#endif -"bpt",OPC_bpt,0,{0}, - {CLASS_BIT+3,CLASS_BIT+6,CLASS_BIT+0,CLASS_BIT+0,0,0,0,0,0,},0,2,37}, - - -/* 0001 1111 ddN0 0000 *** call @rd */ -{ -#ifdef NICENAMES -"call @rd",32,10, -0x00, -#endif -"call",OPC_call,0,{CLASS_IR+(ARG_RD),}, - {CLASS_BIT+1,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,38}, - - -/* 0101 1111 0000 0000 address_dst *** call address_dst */ -{ -#ifdef NICENAMES -"call address_dst",32,12, -0x00, -#endif -"call",OPC_call,0,{CLASS_DA+(ARG_DST),}, - {CLASS_BIT+5,CLASS_BIT+0xf,CLASS_BIT+0,CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,39}, - - -/* 0101 1111 ddN0 0000 address_dst *** call address_dst(rd) */ -{ -#ifdef NICENAMES -"call address_dst(rd)",32,13, -0x00, -#endif -"call",OPC_call,0,{CLASS_X+(ARG_RD),}, - {CLASS_BIT+5,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,40}, - - -/* 1101 disp12 *** calr disp12 */ -{ -#ifdef NICENAMES -"calr disp12",16,10, -0x00, -#endif -"calr",OPC_calr,0,{CLASS_DISP,}, - {CLASS_BIT+0xd,CLASS_DISP+(ARG_DISP12),0,0,0,0,0,0,0,},1,2,41}, - - -/* 0000 1101 ddN0 1000 *** clr @rd */ -{ -#ifdef NICENAMES -"clr @rd",16,8, -0x00, -#endif -"clr",OPC_clr,0,{CLASS_IR+(ARG_RD),}, - {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,42}, - - -/* 0100 1101 0000 1000 address_dst *** clr address_dst */ -{ -#ifdef NICENAMES -"clr address_dst",16,11, -0x00, -#endif -"clr",OPC_clr,0,{CLASS_DA+(ARG_DST),}, - {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,43}, - - -/* 0100 1101 ddN0 1000 address_dst *** clr address_dst(rd) */ -{ -#ifdef NICENAMES -"clr address_dst(rd)",16,12, -0x00, -#endif -"clr",OPC_clr,0,{CLASS_X+(ARG_RD),}, - {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,44}, - - -/* 1000 1101 dddd 1000 *** clr rd */ -{ -#ifdef NICENAMES -"clr rd",16,7, -0x00, -#endif -"clr",OPC_clr,0,{CLASS_REG_WORD+(ARG_RD),}, - {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,45}, - - -/* 0000 1100 ddN0 1000 *** clrb @rd */ -{ -#ifdef NICENAMES -"clrb @rd",8,8, -0x00, -#endif -"clrb",OPC_clrb,0,{CLASS_IR+(ARG_RD),}, - {CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,46}, - - -/* 0100 1100 0000 1000 address_dst *** clrb address_dst */ -{ -#ifdef NICENAMES -"clrb address_dst",8,11, -0x00, -#endif -"clrb",OPC_clrb,0,{CLASS_DA+(ARG_DST),}, - {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,47}, - - -/* 0100 1100 ddN0 1000 address_dst *** clrb address_dst(rd) */ -{ -#ifdef NICENAMES -"clrb address_dst(rd)",8,12, -0x00, -#endif -"clrb",OPC_clrb,0,{CLASS_X+(ARG_RD),}, - {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,48}, - - -/* 1000 1100 dddd 1000 *** clrb rbd */ -{ -#ifdef NICENAMES -"clrb rbd",8,7, -0x00, -#endif -"clrb",OPC_clrb,0,{CLASS_REG_BYTE+(ARG_RD),}, - {CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,49}, - - -/* 0000 1101 ddN0 0000 *** com @rd */ -{ -#ifdef NICENAMES -"com @rd",16,12, -0x18, -#endif -"com",OPC_com,0,{CLASS_IR+(ARG_RD),}, - {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,50}, - - -/* 0100 1101 0000 0000 address_dst *** com address_dst */ -{ -#ifdef NICENAMES -"com address_dst",16,15, -0x18, -#endif -"com",OPC_com,0,{CLASS_DA+(ARG_DST),}, - {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,51}, - - -/* 0100 1101 ddN0 0000 address_dst *** com address_dst(rd) */ -{ -#ifdef NICENAMES -"com address_dst(rd)",16,16, -0x18, -#endif -"com",OPC_com,0,{CLASS_X+(ARG_RD),}, - {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,52}, - - -/* 1000 1101 dddd 0000 *** com rd */ -{ -#ifdef NICENAMES -"com rd",16,7, -0x18, -#endif -"com",OPC_com,0,{CLASS_REG_WORD+(ARG_RD),}, - {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,53}, - - -/* 0000 1100 ddN0 0000 *** comb @rd */ -{ -#ifdef NICENAMES -"comb @rd",8,12, -0x1c, -#endif -"comb",OPC_comb,0,{CLASS_IR+(ARG_RD),}, - {CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,54}, - - -/* 0100 1100 0000 0000 address_dst *** comb address_dst */ -{ -#ifdef NICENAMES -"comb address_dst",8,15, -0x1c, -#endif -"comb",OPC_comb,0,{CLASS_DA+(ARG_DST),}, - {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,55}, - - -/* 0100 1100 ddN0 0000 address_dst *** comb address_dst(rd) */ -{ -#ifdef NICENAMES -"comb address_dst(rd)",8,16, -0x1c, -#endif -"comb",OPC_comb,0,{CLASS_X+(ARG_RD),}, - {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,56}, - - -/* 1000 1100 dddd 0000 *** comb rbd */ -{ -#ifdef NICENAMES -"comb rbd",8,7, -0x1c, -#endif -"comb",OPC_comb,0,{CLASS_REG_BYTE+(ARG_RD),}, - {CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,57}, - - -/* 1000 1101 flags 0101 *** comflg flags */ -{ -#ifdef NICENAMES -"comflg flags",16,7, -0x3c, -#endif -"comflg",OPC_comflg,0,{CLASS_FLAGS,}, - {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_FLAGS,CLASS_BIT+5,0,0,0,0,0,},1,2,58}, - - -/* 0000 1101 ddN0 0001 imm16 *** cp @rd,imm16 */ -{ -#ifdef NICENAMES -"cp @rd,imm16",16,11, -0x3c, -#endif -"cp",OPC_cp,0,{CLASS_IR+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+1,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,59}, - - -/* 0100 1101 ddN0 0001 address_dst imm16 *** cp address_dst(rd),imm16 */ -{ -#ifdef NICENAMES -"cp address_dst(rd),imm16",16,15, -0x3c, -#endif -"cp",OPC_cp,0,{CLASS_X+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+1,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM16),0,0,0,},2,6,60}, - - -/* 0100 1101 0000 0001 address_dst imm16 *** cp address_dst,imm16 */ -{ -#ifdef NICENAMES -"cp address_dst,imm16",16,14, -0x3c, -#endif -"cp",OPC_cp,0,{CLASS_DA+(ARG_DST),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+1,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM16),0,0,0,},2,6,61}, - - -/* 0000 1011 ssN0 dddd *** cp rd,@rs */ -{ -#ifdef NICENAMES -"cp rd,@rs",16,7, -0x3c, -#endif -"cp",OPC_cp,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+0,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,62}, - - -/* 0100 1011 0000 dddd address_src *** cp rd,address_src */ -{ -#ifdef NICENAMES -"cp rd,address_src",16,9, -0x3c, -#endif -"cp",OPC_cp,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+4,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,63}, - - -/* 0100 1011 ssN0 dddd address_src *** cp rd,address_src(rs) */ -{ -#ifdef NICENAMES -"cp rd,address_src(rs)",16,10, -0x3c, -#endif -"cp",OPC_cp,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+4,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,64}, - - -/* 0000 1011 0000 dddd imm16 *** cp rd,imm16 */ -{ -#ifdef NICENAMES -"cp rd,imm16",16,7, -0x3c, -#endif -"cp",OPC_cp,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+0,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,65}, - - -/* 1000 1011 ssss dddd *** cp rd,rs */ -{ -#ifdef NICENAMES -"cp rd,rs",16,4, -0x3c, -#endif -"cp",OPC_cp,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+8,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,66}, - - -/* 0000 1100 ddN0 0001 imm8 imm8 *** cpb @rd,imm8 */ -{ -#ifdef NICENAMES -"cpb @rd,imm8",8,11, -0x3c, -#endif -"cpb",OPC_cpb,0,{CLASS_IR+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+1,CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,67}, - - -/* 0100 1100 ddN0 0001 address_dst imm8 imm8 *** cpb address_dst(rd),imm8 */ -{ -#ifdef NICENAMES -"cpb address_dst(rd),imm8",8,15, -0x3c, -#endif -"cpb",OPC_cpb,0,{CLASS_X+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+1,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,},2,6,68}, - - -/* 0100 1100 0000 0001 address_dst imm8 imm8 *** cpb address_dst,imm8 */ -{ -#ifdef NICENAMES -"cpb address_dst,imm8",8,14, -0x3c, -#endif -"cpb",OPC_cpb,0,{CLASS_DA+(ARG_DST),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+1,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,},2,6,69}, - - -/* 0000 1010 ssN0 dddd *** cpb rbd,@rs */ -{ -#ifdef NICENAMES -"cpb rbd,@rs",8,7, -0x3c, -#endif -"cpb",OPC_cpb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+0,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,70}, - - -/* 0100 1010 0000 dddd address_src *** cpb rbd,address_src */ -{ -#ifdef NICENAMES -"cpb rbd,address_src",8,9, -0x3c, -#endif -"cpb",OPC_cpb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+4,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,71}, - - -/* 0100 1010 ssN0 dddd address_src *** cpb rbd,address_src(rs) */ -{ -#ifdef NICENAMES -"cpb rbd,address_src(rs)",8,10, -0x3c, -#endif -"cpb",OPC_cpb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+4,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,72}, - - -/* 0000 1010 0000 dddd imm8 imm8 *** cpb rbd,imm8 */ -{ -#ifdef NICENAMES -"cpb rbd,imm8",8,7, -0x3c, -#endif -"cpb",OPC_cpb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,73}, - - -/* 1000 1010 ssss dddd *** cpb rbd,rbs */ -{ -#ifdef NICENAMES -"cpb rbd,rbs",8,4, -0x3c, -#endif -"cpb",OPC_cpb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+8,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,74}, - - -/* 1011 1011 ssN0 1000 0000 rrrr dddd cccc *** cpd rd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpd rd,@rs,rr,cc",16,11, -0x3c, -#endif -"cpd",OPC_cpd,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,75}, - - -/* 1011 1010 ssN0 1000 0000 rrrr dddd cccc *** cpdb rbd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpdb rbd,@rs,rr,cc",8,11, -0x3c, -#endif -"cpdb",OPC_cpdb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,76}, - - -/* 1011 1011 ssN0 1100 0000 rrrr dddd cccc *** cpdr rd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpdr rd,@rs,rr,cc",16,11, -0x3c, -#endif -"cpdr",OPC_cpdr,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xc,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,77}, - - -/* 1011 1010 ssN0 1100 0000 rrrr dddd cccc *** cpdrb rbd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpdrb rbd,@rs,rr,cc",8,11, -0x3c, -#endif -"cpdrb",OPC_cpdrb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xc,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,78}, - - -/* 1011 1011 ssN0 0000 0000 rrrr dddd cccc *** cpi rd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpi rd,@rs,rr,cc",16,11, -0x3c, -#endif -"cpi",OPC_cpi,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,79}, - - -/* 1011 1010 ssN0 0000 0000 rrrr dddd cccc *** cpib rbd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpib rbd,@rs,rr,cc",8,11, -0x3c, -#endif -"cpib",OPC_cpib,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,80}, - - -/* 1011 1011 ssN0 0100 0000 rrrr dddd cccc *** cpir rd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpir rd,@rs,rr,cc",16,11, -0x3c, -#endif -"cpir",OPC_cpir,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,81}, - - -/* 1011 1010 ssN0 0100 0000 rrrr dddd cccc *** cpirb rbd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpirb rbd,@rs,rr,cc",8,11, -0x3c, -#endif -"cpirb",OPC_cpirb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REG+(ARG_RD),CLASS_CC,0,},4,4,82}, - - -/* 0001 0000 ssN0 dddd *** cpl rrd,@rs */ -{ -#ifdef NICENAMES -"cpl rrd,@rs",32,14, -0x3c, -#endif -"cpl",OPC_cpl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+1,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,83}, - - -/* 0101 0000 0000 dddd address_src *** cpl rrd,address_src */ -{ -#ifdef NICENAMES -"cpl rrd,address_src",32,15, -0x3c, -#endif -"cpl",OPC_cpl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+5,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,84}, - - -/* 0101 0000 ssN0 dddd address_src *** cpl rrd,address_src(rs) */ -{ -#ifdef NICENAMES -"cpl rrd,address_src(rs)",32,16, -0x3c, -#endif -"cpl",OPC_cpl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,85}, - - -/* 0001 0000 0000 dddd imm32 *** cpl rrd,imm32 */ -{ -#ifdef NICENAMES -"cpl rrd,imm32",32,14, -0x3c, -#endif -"cpl",OPC_cpl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM32),}, - {CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,86}, - - -/* 1001 0000 ssss dddd *** cpl rrd,rrs */ -{ -#ifdef NICENAMES -"cpl rrd,rrs",32,8, -0x3c, -#endif -"cpl",OPC_cpl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_LONG+(ARG_RS),}, - {CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,87}, - - -/* 1011 1011 ssN0 1010 0000 rrrr ddN0 cccc *** cpsd @rd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpsd @rd,@rs,rr,cc",16,11, -0x3c, -#endif -"cpsd",OPC_cpsd,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,88}, - - -/* 1011 1010 ssN0 1010 0000 rrrr ddN0 cccc *** cpsdb @rd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpsdb @rd,@rs,rr,cc",8,11, -0x3c, -#endif -"cpsdb",OPC_cpsdb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,89}, - - -/* 1011 1011 ssN0 1110 0000 rrrr ddN0 cccc *** cpsdr @rd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpsdr @rd,@rs,rr,cc",16,11, -0x3c, -#endif -"cpsdr",OPC_cpsdr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xe,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,90}, - - -/* 1011 1010 ssN0 1110 0000 rrrr ddN0 cccc *** cpsdrb @rd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpsdrb @rd,@rs,rr,cc",8,11, -0x3c, -#endif -"cpsdrb",OPC_cpsdrb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xe,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,91}, - - -/* 1011 1011 ssN0 0010 0000 rrrr ddN0 cccc *** cpsi @rd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpsi @rd,@rs,rr,cc",16,11, -0x3c, -#endif -"cpsi",OPC_cpsi,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,92}, - - -/* 1011 1010 ssN0 0010 0000 rrrr ddN0 cccc *** cpsib @rd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpsib @rd,@rs,rr,cc",8,11, -0x3c, -#endif -"cpsib",OPC_cpsib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,93}, - - -/* 1011 1011 ssN0 0110 0000 rrrr ddN0 cccc *** cpsir @rd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpsir @rd,@rs,rr,cc",16,11, -0x3c, -#endif -"cpsir",OPC_cpsir,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,94}, - - -/* 1011 1010 ssN0 0110 0000 rrrr ddN0 cccc *** cpsirb @rd,@rs,rr,cc */ -{ -#ifdef NICENAMES -"cpsirb @rd,@rs,rr,cc",8,11, -0x3c, -#endif -"cpsirb",OPC_cpsirb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),CLASS_CC,}, - {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_CC,0,},4,4,95}, - - -/* 1011 0000 dddd 0000 *** dab rbd */ -{ -#ifdef NICENAMES -"dab rbd",8,5, -0x38, -#endif -"dab",OPC_dab,0,{CLASS_REG_BYTE+(ARG_RD),}, - {CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,96}, - - -/* 1111 dddd 0disp7 *** dbjnz rbd,disp7 */ -{ -#ifdef NICENAMES -"dbjnz rbd,disp7",16,11, -0x00, -#endif -"dbjnz",OPC_dbjnz,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DISP,}, - {CLASS_BIT+0xf,CLASS_REG+(ARG_RD),CLASS_0DISP7,0,0,0,0,0,0,},2,2,97}, - - -/* 0010 1011 ddN0 imm4m1 *** dec @rd,imm4m1 */ -{ -#ifdef NICENAMES -"dec @rd,imm4m1",16,11, -0x1c, -#endif -"dec",OPC_dec,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+2,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,98}, - - -/* 0110 1011 ddN0 imm4m1 address_dst *** dec address_dst(rd),imm4m1 */ -{ -#ifdef NICENAMES -"dec address_dst(rd),imm4m1",16,14, -0x1c, -#endif -"dec",OPC_dec,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+6,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,99}, - - -/* 0110 1011 0000 imm4m1 address_dst *** dec address_dst,imm4m1 */ -{ -#ifdef NICENAMES -"dec address_dst,imm4m1",16,13, -0x1c, -#endif -"dec",OPC_dec,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+6,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,100}, - - -/* 1010 1011 dddd imm4m1 *** dec rd,imm4m1 */ -{ -#ifdef NICENAMES -"dec rd,imm4m1",16,4, -0x1c, -#endif -"dec",OPC_dec,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+0xa,CLASS_BIT+0xb,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,101}, - - -/* 0010 1010 ddN0 imm4m1 *** decb @rd,imm4m1 */ -{ -#ifdef NICENAMES -"decb @rd,imm4m1",8,11, -0x1c, -#endif -"decb",OPC_decb,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+2,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,102}, - - -/* 0110 1010 ddN0 imm4m1 address_dst *** decb address_dst(rd),imm4m1 */ -{ -#ifdef NICENAMES -"decb address_dst(rd),imm4m1",8,14, -0x1c, -#endif -"decb",OPC_decb,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+6,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,103}, - - -/* 0110 1010 0000 imm4m1 address_dst *** decb address_dst,imm4m1 */ -{ -#ifdef NICENAMES -"decb address_dst,imm4m1",8,13, -0x1c, -#endif -"decb",OPC_decb,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+6,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,104}, - - -/* 1010 1010 dddd imm4m1 *** decb rbd,imm4m1 */ -{ -#ifdef NICENAMES -"decb rbd,imm4m1",8,4, -0x1c, -#endif -"decb",OPC_decb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+0xa,CLASS_BIT+0xa,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,105}, - - -/* 0111 1100 0000 00ii *** di i2 */ -{ -#ifdef NICENAMES -"di i2",16,7, -0x00, -#endif -"di",OPC_di,0,{CLASS_IMM+(ARG_IMM2),}, - {CLASS_BIT+7,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_00II,0,0,0,0,0,},1,2,106}, - - -/* 0001 1011 ssN0 dddd *** div rrd,@rs */ -{ -#ifdef NICENAMES -"div rrd,@rs",16,107, -0x3c, -#endif -"div",OPC_div,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+1,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,107}, - - -/* 0101 1011 0000 dddd address_src *** div rrd,address_src */ -{ -#ifdef NICENAMES -"div rrd,address_src",16,107, -0x3c, -#endif -"div",OPC_div,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+5,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,108}, - - -/* 0101 1011 ssN0 dddd address_src *** div rrd,address_src(rs) */ -{ -#ifdef NICENAMES -"div rrd,address_src(rs)",16,107, -0x3c, -#endif -"div",OPC_div,0,{CLASS_REG_LONG+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,109}, - - -/* 0001 1011 0000 dddd imm16 *** div rrd,imm16 */ -{ -#ifdef NICENAMES -"div rrd,imm16",16,107, -0x3c, -#endif -"div",OPC_div,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+1,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,110}, - - -/* 1001 1011 ssss dddd *** div rrd,rs */ -{ -#ifdef NICENAMES -"div rrd,rs",16,107, -0x3c, -#endif -"div",OPC_div,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+9,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,111}, - - -/* 0001 1010 ssN0 dddd *** divl rqd,@rs */ -{ -#ifdef NICENAMES -"divl rqd,@rs",32,744, -0x3c, -#endif -"divl",OPC_divl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+1,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,112}, - - -/* 0101 1010 0000 dddd address_src *** divl rqd,address_src */ -{ -#ifdef NICENAMES -"divl rqd,address_src",32,745, -0x3c, -#endif -"divl",OPC_divl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+5,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,113}, - - -/* 0101 1010 ssN0 dddd address_src *** divl rqd,address_src(rs) */ -{ -#ifdef NICENAMES -"divl rqd,address_src(rs)",32,746, -0x3c, -#endif -"divl",OPC_divl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,114}, - - -/* 0001 1010 0000 dddd imm32 *** divl rqd,imm32 */ -{ -#ifdef NICENAMES -"divl rqd,imm32",32,744, -0x3c, -#endif -"divl",OPC_divl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_IMM+(ARG_IMM32),}, - {CLASS_BIT+1,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,115}, - - -/* 1001 1010 ssss dddd *** divl rqd,rrs */ -{ -#ifdef NICENAMES -"divl rqd,rrs",32,744, -0x3c, -#endif -"divl",OPC_divl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_REG_LONG+(ARG_RS),}, - {CLASS_BIT+9,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,116}, - - -/* 1111 dddd 1disp7 *** djnz rd,disp7 */ -{ -#ifdef NICENAMES -"djnz rd,disp7",16,11, -0x00, -#endif -"djnz",OPC_djnz,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DISP,}, - {CLASS_BIT+0xf,CLASS_REG+(ARG_RD),CLASS_1DISP7,0,0,0,0,0,0,},2,2,117}, - - -/* 0111 1100 0000 01ii *** ei i2 */ -{ -#ifdef NICENAMES -"ei i2",16,7, -0x00, -#endif -"ei",OPC_ei,0,{CLASS_IMM+(ARG_IMM2),}, - {CLASS_BIT+7,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_01II,0,0,0,0,0,},1,2,118}, - - -/* 0010 1101 ssN0 dddd *** ex rd,@rs */ -{ -#ifdef NICENAMES -"ex rd,@rs",16,12, -0x00, -#endif -"ex",OPC_ex,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+2,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,119}, - - -/* 0110 1101 0000 dddd address_src *** ex rd,address_src */ -{ -#ifdef NICENAMES -"ex rd,address_src",16,15, -0x00, -#endif -"ex",OPC_ex,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+6,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,120}, - - -/* 0110 1101 ssN0 dddd address_src *** ex rd,address_src(rs) */ -{ -#ifdef NICENAMES -"ex rd,address_src(rs)",16,16, -0x00, -#endif -"ex",OPC_ex,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+6,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,121}, - - -/* 1010 1101 ssss dddd *** ex rd,rs */ -{ -#ifdef NICENAMES -"ex rd,rs",16,6, -0x00, -#endif -"ex",OPC_ex,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+0xa,CLASS_BIT+0xd,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,122}, - - -/* 0010 1100 ssN0 dddd *** exb rbd,@rs */ -{ -#ifdef NICENAMES -"exb rbd,@rs",8,12, -0x00, -#endif -"exb",OPC_exb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+2,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,123}, - - -/* 0110 1100 0000 dddd address_src *** exb rbd,address_src */ -{ -#ifdef NICENAMES -"exb rbd,address_src",8,15, -0x00, -#endif -"exb",OPC_exb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+6,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,124}, - - -/* 0110 1100 ssN0 dddd address_src *** exb rbd,address_src(rs) */ -{ -#ifdef NICENAMES -"exb rbd,address_src(rs)",8,16, -0x00, -#endif -"exb",OPC_exb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+6,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,125}, - - -/* 1010 1100 ssss dddd *** exb rbd,rbs */ -{ -#ifdef NICENAMES -"exb rbd,rbs",8,6, -0x00, -#endif -"exb",OPC_exb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+0xa,CLASS_BIT+0xc,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,126}, - - -/* 0000 1110 imm8 *** ext0e imm8 */ -{ -#ifdef NICENAMES -"ext0e imm8",8,10, -0x00, -#endif -"ext0e",OPC_ext0e,0,{CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0,CLASS_BIT+0xe,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,127}, - - -/* 0000 1111 imm8 *** ext0f imm8 */ -{ -#ifdef NICENAMES -"ext0f imm8",8,10, -0x00, -#endif -"ext0f",OPC_ext0f,0,{CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,128}, - - -/* 1000 1110 imm8 *** ext8e imm8 */ -{ -#ifdef NICENAMES -"ext8e imm8",8,10, -0x00, -#endif -"ext8e",OPC_ext8e,0,{CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+8,CLASS_BIT+0xe,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,129}, - - -/* 1000 1111 imm8 *** ext8f imm8 */ -{ -#ifdef NICENAMES -"ext8f imm8",8,10, -0x00, -#endif -"ext8f",OPC_ext8f,0,{CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+8,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,130}, - - -/* 1011 0001 dddd 1010 *** exts rrd */ -{ -#ifdef NICENAMES -"exts rrd",16,11, -0x00, -#endif -"exts",OPC_exts,0,{CLASS_REG_LONG+(ARG_RD),}, - {CLASS_BIT+0xb,CLASS_BIT+1,CLASS_REG+(ARG_RD),CLASS_BIT+0xa,0,0,0,0,0,},1,2,131}, - - -/* 1011 0001 dddd 0000 *** extsb rd */ -{ -#ifdef NICENAMES -"extsb rd",8,11, -0x00, -#endif -"extsb",OPC_extsb,0,{CLASS_REG_WORD+(ARG_RD),}, - {CLASS_BIT+0xb,CLASS_BIT+1,CLASS_REG+(ARG_RD),CLASS_BIT+0,0,0,0,0,0,},1,2,132}, - - -/* 1011 0001 dddd 0111 *** extsl rqd */ -{ -#ifdef NICENAMES -"extsl rqd",32,11, -0x00, -#endif -"extsl",OPC_extsl,0,{CLASS_REG_QUAD+(ARG_RD),}, - {CLASS_BIT+0xb,CLASS_BIT+1,CLASS_REG+(ARG_RD),CLASS_BIT+7,0,0,0,0,0,},1,2,133}, - - -/* 0111 1010 0000 0000 *** halt */ -{ -#ifdef NICENAMES -"halt",16,8, -0x00, -#endif -"halt",OPC_halt,0,{0}, - {CLASS_BIT+7,CLASS_BIT+0xa,CLASS_BIT+0,CLASS_BIT+0,0,0,0,0,0,},0,2,134}, - - -/* 0011 1101 ssN0 dddd *** in rd,@rs */ -{ -#ifdef NICENAMES -"in rd,@rs",16,10, -0x00, -#endif -"in",OPC_in,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,135}, - - -/* 0011 1101 dddd 0100 imm16 *** in rd,imm16 */ -{ -#ifdef NICENAMES -"in rd,imm16",16,12, -0x00, -#endif -"in",OPC_in,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+3,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+4,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,136}, - - -/* 0011 1100 ssN0 dddd *** inb rbd,@rs */ -{ -#ifdef NICENAMES -"inb rbd,@rs",8,12, -0x00, -#endif -"inb",OPC_inb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,137}, - - -/* 0011 1010 dddd 0100 imm16 *** inb rbd,imm16 */ -{ -#ifdef NICENAMES -"inb rbd,imm16",8,10, -0x00, -#endif -"inb",OPC_inb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RD),CLASS_BIT+4,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,138}, - - -/* 0010 1001 ddN0 imm4m1 *** inc @rd,imm4m1 */ -{ -#ifdef NICENAMES -"inc @rd,imm4m1",16,11, -0x1c, -#endif -"inc",OPC_inc,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+2,CLASS_BIT+9,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,139}, - - -/* 0110 1001 ddN0 imm4m1 address_dst *** inc address_dst(rd),imm4m1 */ -{ -#ifdef NICENAMES -"inc address_dst(rd),imm4m1",16,14, -0x1c, -#endif -"inc",OPC_inc,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+6,CLASS_BIT+9,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,140}, - - -/* 0110 1001 0000 imm4m1 address_dst *** inc address_dst,imm4m1 */ -{ -#ifdef NICENAMES -"inc address_dst,imm4m1",16,13, -0x1c, -#endif -"inc",OPC_inc,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+6,CLASS_BIT+9,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,141}, - - -/* 1010 1001 dddd imm4m1 *** inc rd,imm4m1 */ -{ -#ifdef NICENAMES -"inc rd,imm4m1",16,4, -0x1c, -#endif -"inc",OPC_inc,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+0xa,CLASS_BIT+9,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,142}, - - -/* 0010 1000 ddN0 imm4m1 *** incb @rd,imm4m1 */ -{ -#ifdef NICENAMES -"incb @rd,imm4m1",8,11, -0x1c, -#endif -"incb",OPC_incb,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+2,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,143}, - - -/* 0110 1000 ddN0 imm4m1 address_dst *** incb address_dst(rd),imm4m1 */ -{ -#ifdef NICENAMES -"incb address_dst(rd),imm4m1",8,14, -0x1c, -#endif -"incb",OPC_incb,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+6,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,144}, - - -/* 0110 1000 0000 imm4m1 address_dst *** incb address_dst,imm4m1 */ -{ -#ifdef NICENAMES -"incb address_dst,imm4m1",8,13, -0x1c, -#endif -"incb",OPC_incb,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+6,CLASS_BIT+8,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,145}, - - -/* 1010 1000 dddd imm4m1 *** incb rbd,imm4m1 */ -{ -#ifdef NICENAMES -"incb rbd,imm4m1",8,4, -0x1c, -#endif -"incb",OPC_incb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4M1),}, - {CLASS_BIT+0xa,CLASS_BIT+8,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4M1),0,0,0,0,0,},2,2,146}, - - -/* 0011 1011 ssN0 1000 0000 aaaa ddN0 1000 *** ind @rd,@rs,ra */ -{ -#ifdef NICENAMES -"ind @rd,@rs,ra",16,21, -0x04, -#endif -"ind",OPC_ind,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,147}, - - -/* 0011 1010 ssN0 1000 0000 aaaa ddN0 1000 *** indb @rd,@rs,rba */ -{ -#ifdef NICENAMES -"indb @rd,@rs,rba",8,21, -0x04, -#endif -"indb",OPC_indb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,148}, - - -/* 0011 1010 ssN0 0000 0000 aaaa ddN0 1000 *** inib @rd,@rs,ra */ -{ -#ifdef NICENAMES -"inib @rd,@rs,ra",8,21, -0x04, -#endif -"inib",OPC_inib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,149}, - - -/* 0011 1010 ssN0 0000 0000 aaaa ddN0 0000 *** inibr @rd,@rs,ra */ -{ -#ifdef NICENAMES -"inibr @rd,@rs,ra",16,21, -0x04, -#endif -"inibr",OPC_inibr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,150}, - - -/* 0111 1011 0000 0000 *** iret */ -{ -#ifdef NICENAMES -"iret",16,13, -0x3f, -#endif -"iret",OPC_iret,0,{0}, - {CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+0,0,0,0,0,0,},0,2,151}, - - -/* 0001 1110 ddN0 cccc *** jp cc,@rd */ -{ -#ifdef NICENAMES -"jp cc,@rd",16,10, -0x00, -#endif -"jp",OPC_jp,0,{CLASS_CC,CLASS_IR+(ARG_RD),}, - {CLASS_BIT+1,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_CC,0,0,0,0,0,},2,2,152}, - - -/* 0101 1110 0000 cccc address_dst *** jp cc,address_dst */ -{ -#ifdef NICENAMES -"jp cc,address_dst",16,7, -0x00, -#endif -"jp",OPC_jp,0,{CLASS_CC,CLASS_DA+(ARG_DST),}, - {CLASS_BIT+5,CLASS_BIT+0xe,CLASS_BIT+0,CLASS_CC,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,153}, - - -/* 0101 1110 ddN0 cccc address_dst *** jp cc,address_dst(rd) */ -{ -#ifdef NICENAMES -"jp cc,address_dst(rd)",16,8, -0x00, -#endif -"jp",OPC_jp,0,{CLASS_CC,CLASS_X+(ARG_RD),}, - {CLASS_BIT+5,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_CC,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,154}, - - -/* 1110 cccc disp8 *** jr cc,disp8 */ -{ -#ifdef NICENAMES -"jr cc,disp8",16,6, -0x00, -#endif -"jr",OPC_jr,0,{CLASS_CC,CLASS_DISP,}, - {CLASS_BIT+0xe,CLASS_CC,CLASS_DISP8,0,0,0,0,0,0,},2,2,155}, - - -/* 0000 1101 ddN0 0101 imm16 *** ld @rd,imm16 */ -{ -#ifdef NICENAMES -"ld @rd,imm16",16,7, -0x00, -#endif -"ld",OPC_ld,0,{CLASS_IR+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,156}, - - -/* 0010 1111 ddN0 ssss *** ld @rd,rs */ -{ -#ifdef NICENAMES -"ld @rd,rs",16,8, -0x00, -#endif -"ld",OPC_ld,0,{CLASS_IR+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+2,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,157}, - - -/* 0100 1101 ddN0 0101 address_dst imm16 *** ld address_dst(rd),imm16 */ -{ -#ifdef NICENAMES -"ld address_dst(rd),imm16",16,15, -0x00, -#endif -"ld",OPC_ld,0,{CLASS_X+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+5,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM16),0,0,0,},2,6,158}, - - -/* 0110 1111 ddN0 ssss address_dst *** ld address_dst(rd),rs */ -{ -#ifdef NICENAMES -"ld address_dst(rd),rs",16,12, -0x00, -#endif -"ld",OPC_ld,0,{CLASS_X+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+6,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,159}, - - -/* 0100 1101 0000 0101 address_dst imm16 *** ld address_dst,imm16 */ -{ -#ifdef NICENAMES -"ld address_dst,imm16",16,14, -0x00, -#endif -"ld",OPC_ld,0,{CLASS_DA+(ARG_DST),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+5,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM16),0,0,0,},2,6,160}, - - -/* 0110 1111 0000 ssss address_dst *** ld address_dst,rs */ -{ -#ifdef NICENAMES -"ld address_dst,rs",16,11, -0x00, -#endif -"ld",OPC_ld,0,{CLASS_DA+(ARG_DST),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+6,CLASS_BIT+0xf,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,161}, - - -/* 0011 0011 ddN0 ssss imm16 *** ld rd(imm16),rs */ -{ -#ifdef NICENAMES -"ld rd(imm16),rs",16,14, -0x00, -#endif -"ld",OPC_ld,0,{CLASS_BA+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,162}, - - -/* 0111 0011 ddN0 ssss 0000 xxxx 0000 0000 *** ld rd(rx),rs */ -{ -#ifdef NICENAMES -"ld rd(rx),rs",16,14, -0x00, -#endif -"ld",OPC_ld,0,{CLASS_BX+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+7,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,163}, - - -/* 0010 0001 ssN0 dddd *** ld rd,@rs */ -{ -#ifdef NICENAMES -"ld rd,@rs",16,7, -0x00, -#endif -"ld",OPC_ld,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+2,CLASS_BIT+1,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,164}, - - -/* 0110 0001 0000 dddd address_src *** ld rd,address_src */ -{ -#ifdef NICENAMES -"ld rd,address_src",16,9, -0x00, -#endif -"ld",OPC_ld,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+6,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,165}, - - -/* 0110 0001 ssN0 dddd address_src *** ld rd,address_src(rs) */ -{ -#ifdef NICENAMES -"ld rd,address_src(rs)",16,10, -0x00, -#endif -"ld",OPC_ld,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+6,CLASS_BIT+1,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,166}, - - -/* 0010 0001 0000 dddd imm16 *** ld rd,imm16 */ -{ -#ifdef NICENAMES -"ld rd,imm16",16,7, -0x00, -#endif -"ld",OPC_ld,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+2,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,167}, - - -/* 1010 0001 ssss dddd *** ld rd,rs */ -{ -#ifdef NICENAMES -"ld rd,rs",16,3, -0x00, -#endif -"ld",OPC_ld,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+0xa,CLASS_BIT+1,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,168}, - - -/* 0011 0001 ssN0 dddd imm16 *** ld rd,rs(imm16) */ -{ -#ifdef NICENAMES -"ld rd,rs(imm16)",16,14, -0x00, -#endif -"ld",OPC_ld,0,{CLASS_REG_WORD+(ARG_RD),CLASS_BA+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+1,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,169}, - - -/* 0111 0001 ssN0 dddd 0000 xxxx 0000 0000 *** ld rd,rs(rx) */ -{ -#ifdef NICENAMES -"ld rd,rs(rx)",16,14, -0x00, -#endif -"ld",OPC_ld,0,{CLASS_REG_WORD+(ARG_RD),CLASS_BX+(ARG_RS),}, - {CLASS_BIT+7,CLASS_BIT+1,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,170}, - - -/* 0111 0110 0000 dddd address_src *** lda prd,address_src */ -{ -#ifdef NICENAMES -"lda prd,address_src",16,12, -0x00, -#endif -"lda",OPC_lda,0,{CLASS_PR+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+7,CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,171}, - - -/* 0111 0110 ssN0 dddd address_src *** lda prd,address_src(rs) */ -{ -#ifdef NICENAMES -"lda prd,address_src(rs)",16,13, -0x00, -#endif -"lda",OPC_lda,0,{CLASS_PR+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+7,CLASS_BIT+6,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,172}, - - -/* 0011 0100 ssN0 dddd imm16 *** lda prd,rs(imm16) */ -{ -#ifdef NICENAMES -"lda prd,rs(imm16)",16,15, -0x00, -#endif -"lda",OPC_lda,0,{CLASS_PR+(ARG_RD),CLASS_BA+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,173}, - - -/* 0111 0100 ssN0 dddd 0000 xxxx 0000 0000 *** lda prd,rs(rx) */ -{ -#ifdef NICENAMES -"lda prd,rs(rx)",16,15, -0x00, -#endif -"lda",OPC_lda,0,{CLASS_PR+(ARG_RD),CLASS_BX+(ARG_RS),}, - {CLASS_BIT+7,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,174}, - - -/* 0011 0100 0000 dddd disp16 *** ldar prd,disp16 */ -{ -#ifdef NICENAMES -"ldar prd,disp16",16,15, -0x00, -#endif -"ldar",OPC_ldar,0,{CLASS_PR+(ARG_RD),CLASS_DISP,}, - {CLASS_BIT+3,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,175}, - - -/* 0000 1100 ddN0 0101 imm8 imm8 *** ldb @rd,imm8 */ -{ -#ifdef NICENAMES -"ldb @rd,imm8",8,7, -0x00, -#endif -"ldb",OPC_ldb,0,{CLASS_IR+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,176}, - - -/* 0010 1110 ddN0 ssss *** ldb @rd,rbs */ -{ -#ifdef NICENAMES -"ldb @rd,rbs",8,8, -0x00, -#endif -"ldb",OPC_ldb,0,{CLASS_IR+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+2,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,177}, - - -/* 0100 1100 ddN0 0101 address_dst imm8 imm8 *** ldb address_dst(rd),imm8 */ -{ -#ifdef NICENAMES -"ldb address_dst(rd),imm8",8,15, -0x00, -#endif -"ldb",OPC_ldb,0,{CLASS_X+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+5,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,},2,6,178}, - - -/* 0110 1110 ddN0 ssss address_dst *** ldb address_dst(rd),rbs */ -{ -#ifdef NICENAMES -"ldb address_dst(rd),rbs",8,12, -0x00, -#endif -"ldb",OPC_ldb,0,{CLASS_X+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+6,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,179}, - - -/* 0100 1100 0000 0101 address_dst imm8 imm8 *** ldb address_dst,imm8 */ -{ -#ifdef NICENAMES -"ldb address_dst,imm8",8,14, -0x00, -#endif -"ldb",OPC_ldb,0,{CLASS_DA+(ARG_DST),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+5,CLASS_ADDRESS+(ARG_DST),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,},2,6,180}, - - -/* 0110 1110 0000 ssss address_dst *** ldb address_dst,rbs */ -{ -#ifdef NICENAMES -"ldb address_dst,rbs",8,11, -0x00, -#endif -"ldb",OPC_ldb,0,{CLASS_DA+(ARG_DST),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+6,CLASS_BIT+0xe,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,181}, - - -/* 0010 0000 ssN0 dddd *** ldb rbd,@rs */ -{ -#ifdef NICENAMES -"ldb rbd,@rs",8,7, -0x00, -#endif -"ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+2,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,182}, - - -/* 0110 0000 0000 dddd address_src *** ldb rbd,address_src */ -{ -#ifdef NICENAMES -"ldb rbd,address_src",8,9, -0x00, -#endif -"ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+6,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,183}, - - -/* 0110 0000 ssN0 dddd address_src *** ldb rbd,address_src(rs) */ -{ -#ifdef NICENAMES -"ldb rbd,address_src(rs)",8,10, -0x00, -#endif -"ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+6,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,184}, - - -/* 1100 dddd imm8 *** ldb rbd,imm8 */ -{ -#ifdef NICENAMES -"ldb rbd,imm8",8,5, -0x00, -#endif -"ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},2,2,185}, - - -/* 1010 0000 ssss dddd *** ldb rbd,rbs */ -{ -#ifdef NICENAMES -"ldb rbd,rbs",8,3, -0x00, -#endif -"ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,186}, - - -/* 0011 0000 ssN0 dddd imm16 *** ldb rbd,rs(imm16) */ -{ -#ifdef NICENAMES -"ldb rbd,rs(imm16)",8,14, -0x00, -#endif -"ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_BA+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,187}, - - -/* 0111 0000 ssN0 dddd 0000 xxxx 0000 0000 *** ldb rbd,rs(rx) */ -{ -#ifdef NICENAMES -"ldb rbd,rs(rx)",8,14, -0x00, -#endif -"ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_BX+(ARG_RS),}, - {CLASS_BIT+7,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,188}, - - -/* 0011 0010 ddN0 ssss imm16 *** ldb rd(imm16),rbs */ -{ -#ifdef NICENAMES -"ldb rd(imm16),rbs",8,14, -0x00, -#endif -"ldb",OPC_ldb,0,{CLASS_BA+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,189}, - - -/* 0111 0010 ddN0 ssss 0000 xxxx 0000 0000 *** ldb rd(rx),rbs */ -{ -#ifdef NICENAMES -"ldb rd(rx),rbs",8,14, -0x00, -#endif -"ldb",OPC_ldb,0,{CLASS_BX+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+7,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,190}, - - -/* 0111 1101 ssss 1ccc *** ldctl ctrl,rs */ -{ -#ifdef NICENAMES -"ldctl ctrl,rs",32,7, -0x00, -#endif -"ldctl",OPC_ldctl,0,{CLASS_CTRL,CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+7,CLASS_BIT+0xd,CLASS_REG+(ARG_RS),CLASS_1CCC,0,0,0,0,0,},2,2,191}, - - -/* 0111 1101 dddd 0ccc *** ldctl rd,ctrl */ -{ -#ifdef NICENAMES -"ldctl rd,ctrl",32,7, -0x00, -#endif -"ldctl",OPC_ldctl,0,{CLASS_REG_WORD+(ARG_RD),CLASS_CTRL,}, - {CLASS_BIT+7,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_0CCC,0,0,0,0,0,},2,2,192}, - - -/* 1011 1011 ssN0 1001 0000 rrrr ddN0 1000 *** ldd @rd,@rs,rr */ -{ -#ifdef NICENAMES -"ldd @rd,@rs,rr",16,11, -0x04, -#endif -"ldd",OPC_ldd,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),}, - {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,193}, - - -/* 1011 1010 ssN0 1001 0000 rrrr ddN0 1000 *** lddb @rd,@rs,rr */ -{ -#ifdef NICENAMES -"lddb @rd,@rs,rr",8,11, -0x04, -#endif -"lddb",OPC_lddb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),}, - {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,194}, - - -/* 1011 1011 ssN0 1001 0000 rrrr ddN0 0000 *** lddr @rd,@rs,rr */ -{ -#ifdef NICENAMES -"lddr @rd,@rs,rr",16,11, -0x04, -#endif -"lddr",OPC_lddr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),}, - {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,195}, - - -/* 1011 1010 ssN0 1001 0000 rrrr ddN0 0000 *** lddrb @rd,@rs,rr */ -{ -#ifdef NICENAMES -"lddrb @rd,@rs,rr",8,11, -0x04, -#endif -"lddrb",OPC_lddrb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),}, - {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,196}, - - -/* 1011 1011 ssN0 0001 0000 rrrr ddN0 1000 *** ldi @rd,@rs,rr */ -{ -#ifdef NICENAMES -"ldi @rd,@rs,rr",16,11, -0x04, -#endif -"ldi",OPC_ldi,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),}, - {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,197}, - - -/* 1011 1010 ssN0 0001 0000 rrrr ddN0 1000 *** ldib @rd,@rs,rr */ -{ -#ifdef NICENAMES -"ldib @rd,@rs,rr",8,11, -0x04, -#endif -"ldib",OPC_ldib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),}, - {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,198}, - - -/* 1011 1011 ssN0 0001 0000 rrrr ddN0 0000 *** ldir @rd,@rs,rr */ -{ -#ifdef NICENAMES -"ldir @rd,@rs,rr",16,11, -0x04, -#endif -"ldir",OPC_ldir,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),}, - {CLASS_BIT+0xb,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,199}, - - -/* 1011 1010 ssN0 0001 0000 rrrr ddN0 0000 *** ldirb @rd,@rs,rr */ -{ -#ifdef NICENAMES -"ldirb @rd,@rs,rr",8,11, -0x04, -#endif -"ldirb",OPC_ldirb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RR),}, - {CLASS_BIT+0xb,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,200}, - - -/* 1011 1101 dddd imm4 *** ldk rd,imm4 */ -{ -#ifdef NICENAMES -"ldk rd,imm4",16,5, -0x00, -#endif -"ldk",OPC_ldk,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+0xb,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,201}, - - -/* 0001 1101 ddN0 ssss *** ldl @rd,rrs */ -{ -#ifdef NICENAMES -"ldl @rd,rrs",32,11, -0x00, -#endif -"ldl",OPC_ldl,0,{CLASS_IR+(ARG_RD),CLASS_REG_LONG+(ARG_RS),}, - {CLASS_BIT+1,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,202}, - - -/* 0101 1101 ddN0 ssss address_dst *** ldl address_dst(rd),rrs */ -{ -#ifdef NICENAMES -"ldl address_dst(rd),rrs",32,14, -0x00, -#endif -"ldl",OPC_ldl,0,{CLASS_X+(ARG_RD),CLASS_REG_LONG+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,203}, - - -/* 0101 1101 0000 ssss address_dst *** ldl address_dst,rrs */ -{ -#ifdef NICENAMES -"ldl address_dst,rrs",32,15, -0x00, -#endif -"ldl",OPC_ldl,0,{CLASS_DA+(ARG_DST),CLASS_REG_LONG+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,204}, - - -/* 0011 0111 ddN0 ssss imm16 *** ldl rd(imm16),rrs */ -{ -#ifdef NICENAMES -"ldl rd(imm16),rrs",32,17, -0x00, -#endif -"ldl",OPC_ldl,0,{CLASS_BA+(ARG_RD),CLASS_REG_LONG+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+7,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,205}, - - -/* 0111 0111 ddN0 ssss 0000 xxxx 0000 0000 *** ldl rd(rx),rrs */ -{ -#ifdef NICENAMES -"ldl rd(rx),rrs",32,17, -0x00, -#endif -"ldl",OPC_ldl,0,{CLASS_BX+(ARG_RD),CLASS_REG_LONG+(ARG_RS),}, - {CLASS_BIT+7,CLASS_BIT+7,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,206}, - - -/* 0001 0100 ssN0 dddd *** ldl rrd,@rs */ -{ -#ifdef NICENAMES -"ldl rrd,@rs",32,11, -0x00, -#endif -"ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+1,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,207}, - - -/* 0101 0100 0000 dddd address_src *** ldl rrd,address_src */ -{ -#ifdef NICENAMES -"ldl rrd,address_src",32,12, -0x00, -#endif -"ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+5,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,208}, - - -/* 0101 0100 ssN0 dddd address_src *** ldl rrd,address_src(rs) */ -{ -#ifdef NICENAMES -"ldl rrd,address_src(rs)",32,13, -0x00, -#endif -"ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,209}, - - -/* 0001 0100 0000 dddd imm32 *** ldl rrd,imm32 */ -{ -#ifdef NICENAMES -"ldl rrd,imm32",32,11, -0x00, -#endif -"ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM32),}, - {CLASS_BIT+1,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,210}, - - -/* 1001 0100 ssss dddd *** ldl rrd,rrs */ -{ -#ifdef NICENAMES -"ldl rrd,rrs",32,5, -0x00, -#endif -"ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_LONG+(ARG_RS),}, - {CLASS_BIT+9,CLASS_BIT+4,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,211}, - - -/* 0011 0101 ssN0 dddd imm16 *** ldl rrd,rs(imm16) */ -{ -#ifdef NICENAMES -"ldl rrd,rs(imm16)",32,17, -0x00, -#endif -"ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_BA+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,212}, - - -/* 0111 0101 ssN0 dddd 0000 xxxx 0000 0000 *** ldl rrd,rs(rx) */ -{ -#ifdef NICENAMES -"ldl rrd,rs(rx)",32,17, -0x00, -#endif -"ldl",OPC_ldl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_BX+(ARG_RS),}, - {CLASS_BIT+7,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,213}, - - -/* 0001 1100 ddN0 1001 0000 ssss 0000 nminus1 *** ldm @rd,rs,n */ -{ -#ifdef NICENAMES -"ldm @rd,rs,n",16,11, -0x00, -#endif -"ldm",OPC_ldm,0,{CLASS_IR+(ARG_RD),CLASS_REG_WORD+(ARG_RS),CLASS_IMM + (ARG_IMMN),}, - {CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),0,},3,4,214}, - - -/* 0101 1100 ddN0 1001 0000 ssss 0000 nminus1 address_dst *** ldm address_dst(rd),rs,n */ -{ -#ifdef NICENAMES -"ldm address_dst(rd),rs,n",16,15, -0x00, -#endif -"ldm",OPC_ldm,0,{CLASS_X+(ARG_RD),CLASS_REG_WORD+(ARG_RS),CLASS_IMM + (ARG_IMMN),}, - {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_DST),},3,6,215}, - - -/* 0101 1100 0000 1001 0000 ssss 0000 nminus1 address_dst *** ldm address_dst,rs,n */ -{ -#ifdef NICENAMES -"ldm address_dst,rs,n",16,14, -0x00, -#endif -"ldm",OPC_ldm,0,{CLASS_DA+(ARG_DST),CLASS_REG_WORD+(ARG_RS),CLASS_IMM + (ARG_IMMN),}, - {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_DST),},3,6,216}, - - -/* 0001 1100 ssN0 0001 0000 dddd 0000 nminus1 *** ldm rd,@rs,n */ -{ -#ifdef NICENAMES -"ldm rd,@rs,n",16,11, -0x00, -#endif -"ldm",OPC_ldm,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_IMM + (ARG_IMMN),}, - {CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),0,},3,4,217}, - - -/* 0101 1100 ssN0 0001 0000 dddd 0000 nminus1 address_src *** ldm rd,address_src(rs),n */ -{ -#ifdef NICENAMES -"ldm rd,address_src(rs),n",16,15, -0x00, -#endif -"ldm",OPC_ldm,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),CLASS_IMM + (ARG_IMMN),}, - {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_SRC),},3,6,218}, - - -/* 0101 1100 0000 0001 0000 dddd 0000 nminus1 address_src *** ldm rd,address_src,n */ -{ -#ifdef NICENAMES -"ldm rd,address_src,n",16,14, -0x00, -#endif -"ldm",OPC_ldm,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),CLASS_IMM + (ARG_IMMN),}, - {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_SRC),},3,6,219}, - - -/* 0011 1001 ssN0 0000 *** ldps @rs */ -{ -#ifdef NICENAMES -"ldps @rs",16,12, -0x3f, -#endif -"ldps",OPC_ldps,0,{CLASS_IR+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,0,0,0,0,},1,2,220}, - - -/* 0111 1001 0000 0000 address_src *** ldps address_src */ -{ -#ifdef NICENAMES -"ldps address_src",16,16, -0x3f, -#endif -"ldps",OPC_ldps,0,{CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+7,CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},1,4,221}, - - -/* 0111 1001 ssN0 0000 address_src *** ldps address_src(rs) */ -{ -#ifdef NICENAMES -"ldps address_src(rs)",16,17, -0x3f, -#endif -"ldps",OPC_ldps,0,{CLASS_X+(ARG_RS),}, - {CLASS_BIT+7,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},1,4,222}, - - -/* 0011 0011 0000 ssss disp16 *** ldr disp16,rs */ -{ -#ifdef NICENAMES -"ldr disp16,rs",16,14, -0x00, -#endif -"ldr",OPC_ldr,0,{CLASS_DISP,CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,223}, - - -/* 0011 0001 0000 dddd disp16 *** ldr rd,disp16 */ -{ -#ifdef NICENAMES -"ldr rd,disp16",16,14, -0x00, -#endif -"ldr",OPC_ldr,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DISP,}, - {CLASS_BIT+3,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,224}, - - -/* 0011 0010 0000 ssss disp16 *** ldrb disp16,rbs */ -{ -#ifdef NICENAMES -"ldrb disp16,rbs",8,14, -0x00, -#endif -"ldrb",OPC_ldrb,0,{CLASS_DISP,CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,225}, - - -/* 0011 0000 0000 dddd disp16 *** ldrb rbd,disp16 */ -{ -#ifdef NICENAMES -"ldrb rbd,disp16",8,14, -0x00, -#endif -"ldrb",OPC_ldrb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DISP,}, - {CLASS_BIT+3,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,226}, - - -/* 0011 0111 0000 ssss disp16 *** ldrl disp16,rrs */ -{ -#ifdef NICENAMES -"ldrl disp16,rrs",32,17, -0x00, -#endif -"ldrl",OPC_ldrl,0,{CLASS_DISP,CLASS_REG_LONG+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+7,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,227}, - - -/* 0011 0101 0000 dddd disp16 *** ldrl rrd,disp16 */ -{ -#ifdef NICENAMES -"ldrl rrd,disp16",32,17, -0x00, -#endif -"ldrl",OPC_ldrl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DISP,}, - {CLASS_BIT+3,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_DISP+(ARG_DISP16),0,0,0,0,},2,4,228}, - - -/* 0111 1011 0000 1010 *** mbit */ -{ -#ifdef NICENAMES -"mbit",16,7, -0x38, -#endif -"mbit",OPC_mbit,0,{0}, - {CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+0xa,0,0,0,0,0,},0,2,229}, - - -/* 0111 1011 dddd 1101 *** mreq rd */ -{ -#ifdef NICENAMES -"mreq rd",16,12, -0x18, -#endif -"mreq",OPC_mreq,0,{CLASS_REG_WORD+(ARG_RD),}, - {CLASS_BIT+7,CLASS_BIT+0xb,CLASS_REG+(ARG_RD),CLASS_BIT+0xd,0,0,0,0,0,},1,2,230}, - - -/* 0111 1011 0000 1001 *** mres */ -{ -#ifdef NICENAMES -"mres",16,5, -0x00, -#endif -"mres",OPC_mres,0,{0}, - {CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+9,0,0,0,0,0,},0,2,231}, - - -/* 0111 1011 0000 1000 *** mset */ -{ -#ifdef NICENAMES -"mset",16,5, -0x00, -#endif -"mset",OPC_mset,0,{0}, - {CLASS_BIT+7,CLASS_BIT+0xb,CLASS_BIT+0,CLASS_BIT+8,0,0,0,0,0,},0,2,232}, - - -/* 0001 1001 ssN0 dddd *** mult rrd,@rs */ -{ -#ifdef NICENAMES -"mult rrd,@rs",16,70, -0x3c, -#endif -"mult",OPC_mult,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+1,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,233}, - - -/* 0101 1001 0000 dddd address_src *** mult rrd,address_src */ -{ -#ifdef NICENAMES -"mult rrd,address_src",16,70, -0x3c, -#endif -"mult",OPC_mult,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+5,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,234}, - - -/* 0101 1001 ssN0 dddd address_src *** mult rrd,address_src(rs) */ -{ -#ifdef NICENAMES -"mult rrd,address_src(rs)",16,70, -0x3c, -#endif -"mult",OPC_mult,0,{CLASS_REG_LONG+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,235}, - - -/* 0001 1001 0000 dddd imm16 *** mult rrd,imm16 */ -{ -#ifdef NICENAMES -"mult rrd,imm16",16,70, -0x3c, -#endif -"mult",OPC_mult,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+1,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,236}, - - -/* 1001 1001 ssss dddd *** mult rrd,rs */ -{ -#ifdef NICENAMES -"mult rrd,rs",16,70, -0x3c, -#endif -"mult",OPC_mult,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+9,CLASS_BIT+9,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,237}, - - -/* 0001 1000 ssN0 dddd *** multl rqd,@rs */ -{ -#ifdef NICENAMES -"multl rqd,@rs",32,282, -0x3c, -#endif -"multl",OPC_multl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+1,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,238}, - - -/* 0101 1000 0000 dddd address_src *** multl rqd,address_src */ -{ -#ifdef NICENAMES -"multl rqd,address_src",32,282, -0x3c, -#endif -"multl",OPC_multl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+5,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,239}, - - -/* 0101 1000 ssN0 dddd address_src *** multl rqd,address_src(rs) */ -{ -#ifdef NICENAMES -"multl rqd,address_src(rs)",32,282, -0x3c, -#endif -"multl",OPC_multl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,240}, - - -/* 0001 1000 0000 dddd imm32 *** multl rqd,imm32 */ -{ -#ifdef NICENAMES -"multl rqd,imm32",32,282, -0x3c, -#endif -"multl",OPC_multl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_IMM+(ARG_IMM32),}, - {CLASS_BIT+1,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,241}, - - -/* 1001 1000 ssss dddd *** multl rqd,rrs */ -{ -#ifdef NICENAMES -"multl rqd,rrs",32,282, -0x3c, -#endif -"multl",OPC_multl,0,{CLASS_REG_QUAD+(ARG_RD),CLASS_REG_LONG+(ARG_RS),}, - {CLASS_BIT+9,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,242}, - - -/* 0000 1101 ddN0 0010 *** neg @rd */ -{ -#ifdef NICENAMES -"neg @rd",16,12, -0x3c, -#endif -"neg",OPC_neg,0,{CLASS_IR+(ARG_RD),}, - {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,243}, - - -/* 0100 1101 0000 0010 address_dst *** neg address_dst */ -{ -#ifdef NICENAMES -"neg address_dst",16,15, -0x3c, -#endif -"neg",OPC_neg,0,{CLASS_DA+(ARG_DST),}, - {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,244}, - - -/* 0100 1101 ddN0 0010 address_dst *** neg address_dst(rd) */ -{ -#ifdef NICENAMES -"neg address_dst(rd)",16,16, -0x3c, -#endif -"neg",OPC_neg,0,{CLASS_X+(ARG_RD),}, - {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,245}, - - -/* 1000 1101 dddd 0010 *** neg rd */ -{ -#ifdef NICENAMES -"neg rd",16,7, -0x3c, -#endif -"neg",OPC_neg,0,{CLASS_REG_WORD+(ARG_RD),}, - {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,246}, - - -/* 0000 1100 ddN0 0010 *** negb @rd */ -{ -#ifdef NICENAMES -"negb @rd",8,12, -0x3c, -#endif -"negb",OPC_negb,0,{CLASS_IR+(ARG_RD),}, - {CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,247}, - - -/* 0100 1100 0000 0010 address_dst *** negb address_dst */ -{ -#ifdef NICENAMES -"negb address_dst",8,15, -0x3c, -#endif -"negb",OPC_negb,0,{CLASS_DA+(ARG_DST),}, - {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,248}, - - -/* 0100 1100 ddN0 0010 address_dst *** negb address_dst(rd) */ -{ -#ifdef NICENAMES -"negb address_dst(rd)",8,16, -0x3c, -#endif -"negb",OPC_negb,0,{CLASS_X+(ARG_RD),}, - {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+2,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,249}, - - -/* 1000 1100 dddd 0010 *** negb rbd */ -{ -#ifdef NICENAMES -"negb rbd",8,7, -0x3c, -#endif -"negb",OPC_negb,0,{CLASS_REG_BYTE+(ARG_RD),}, - {CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+2,0,0,0,0,0,},1,2,250}, - - -/* 1000 1101 0000 0111 *** nop */ -{ -#ifdef NICENAMES -"nop",16,7, -0x00, -#endif -"nop",OPC_nop,0,{0}, - {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+7,0,0,0,0,0,},0,2,251}, - - -/* 0000 0101 ssN0 dddd *** or rd,@rs */ -{ -#ifdef NICENAMES -"or rd,@rs",16,7, -0x38, -#endif -"or",OPC_or,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+0,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,252}, - - -/* 0100 0101 0000 dddd address_src *** or rd,address_src */ -{ -#ifdef NICENAMES -"or rd,address_src",16,9, -0x38, -#endif -"or",OPC_or,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+4,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,253}, - - -/* 0100 0101 ssN0 dddd address_src *** or rd,address_src(rs) */ -{ -#ifdef NICENAMES -"or rd,address_src(rs)",16,10, -0x38, -#endif -"or",OPC_or,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+4,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,254}, - - -/* 0000 0101 0000 dddd imm16 *** or rd,imm16 */ -{ -#ifdef NICENAMES -"or rd,imm16",16,7, -0x38, -#endif -"or",OPC_or,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+0,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,255}, - - -/* 1000 0101 ssss dddd *** or rd,rs */ -{ -#ifdef NICENAMES -"or rd,rs",16,4, -0x38, -#endif -"or",OPC_or,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+8,CLASS_BIT+5,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,256}, - - -/* 0000 0100 ssN0 dddd *** orb rbd,@rs */ -{ -#ifdef NICENAMES -"orb rbd,@rs",8,7, -0x3c, -#endif -"orb",OPC_orb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+0,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,257}, - - -/* 0100 0100 0000 dddd address_src *** orb rbd,address_src */ -{ -#ifdef NICENAMES -"orb rbd,address_src",8,9, -0x3c, -#endif -"orb",OPC_orb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+4,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,258}, - - -/* 0100 0100 ssN0 dddd address_src *** orb rbd,address_src(rs) */ -{ -#ifdef NICENAMES -"orb rbd,address_src(rs)",8,10, -0x3c, -#endif -"orb",OPC_orb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+4,CLASS_BIT+4,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,259}, - - -/* 0000 0100 0000 dddd imm8 imm8 *** orb rbd,imm8 */ -{ -#ifdef NICENAMES -"orb rbd,imm8",8,7, -0x3c, -#endif -"orb",OPC_orb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,260}, - - -/* 1000 0100 ssss dddd *** orb rbd,rbs */ -{ -#ifdef NICENAMES -"orb rbd,rbs",8,4, -0x3c, -#endif -"orb",OPC_orb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+8,CLASS_BIT+4,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,261}, - - -/* 0011 1111 ddN0 ssss *** out @rd,rs */ -{ -#ifdef NICENAMES -"out @rd,rs",16,0, -0x04, -#endif -"out",OPC_out,0,{CLASS_IR+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+0xf,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,262}, - - -/* 0011 1011 ssss 0110 imm16 *** out imm16,rs */ -{ -#ifdef NICENAMES -"out imm16,rs",16,0, -0x04, -#endif -"out",OPC_out,0,{CLASS_IMM+(ARG_IMM16),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+6,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,263}, - - -/* 0011 1110 ddN0 ssss *** outb @rd,rbs */ -{ -#ifdef NICENAMES -"outb @rd,rbs",8,0, -0x04, -#endif -"outb",OPC_outb,0,{CLASS_IR+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+0xe,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,264}, - - -/* 0011 1010 ssss 0110 imm16 *** outb imm16,rbs */ -{ -#ifdef NICENAMES -"outb imm16,rbs",8,0, -0x04, -#endif -"outb",OPC_outb,0,{CLASS_IMM+(ARG_IMM16),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+6,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,265}, - - -/* 0011 1011 ssN0 1010 0000 aaaa ddN0 1000 *** outd @rd,@rs,ra */ -{ -#ifdef NICENAMES -"outd @rd,@rs,ra",16,0, -0x04, -#endif -"outd",OPC_outd,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,266}, - - -/* 0011 1010 ssN0 1010 0000 aaaa ddN0 1000 *** outdb @rd,@rs,rba */ -{ -#ifdef NICENAMES -"outdb @rd,@rs,rba",16,0, -0x04, -#endif -"outdb",OPC_outdb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,267}, - - -/* 0011 1011 ssN0 0010 0000 aaaa ddN0 1000 *** outi @rd,@rs,ra */ -{ -#ifdef NICENAMES -"outi @rd,@rs,ra",16,0, -0x04, -#endif -"outi",OPC_outi,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,268}, - - -/* 0011 1010 ssN0 0010 0000 aaaa ddN0 1000 *** outib @rd,@rs,ra */ -{ -#ifdef NICENAMES -"outib @rd,@rs,ra",16,0, -0x04, -#endif -"outib",OPC_outib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,269}, - - -/* 0011 1010 ssN0 0010 0000 aaaa ddN0 0000 *** outibr @rd,@rs,ra */ -{ -#ifdef NICENAMES -"outibr @rd,@rs,ra",16,0, -0x04, -#endif -"outibr",OPC_outibr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,270}, - - -/* 0001 0111 ssN0 ddN0 *** pop @rd,@rs */ -{ -#ifdef NICENAMES -"pop @rd,@rs",16,12, -0x00, -#endif -"pop",OPC_pop,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+1,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),0,0,0,0,0,},2,2,271}, - - -/* 0101 0111 ssN0 ddN0 address_dst *** pop address_dst(rd),@rs */ -{ -#ifdef NICENAMES -"pop address_dst(rd),@rs",16,16, -0x00, -#endif -"pop",OPC_pop,0,{CLASS_X+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,272}, - - -/* 0101 0111 ssN0 0000 address_dst *** pop address_dst,@rs */ -{ -#ifdef NICENAMES -"pop address_dst,@rs",16,16, -0x00, -#endif -"pop",OPC_pop,0,{CLASS_DA+(ARG_DST),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,273}, - - -/* 1001 0111 ssN0 dddd *** pop rd,@rs */ -{ -#ifdef NICENAMES -"pop rd,@rs",16,8, -0x00, -#endif -"pop",OPC_pop,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+9,CLASS_BIT+7,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,274}, - - -/* 0001 0101 ssN0 ddN0 *** popl @rd,@rs */ -{ -#ifdef NICENAMES -"popl @rd,@rs",32,19, -0x00, -#endif -"popl",OPC_popl,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+1,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),0,0,0,0,0,},2,2,275}, - - -/* 0101 0101 ssN0 ddN0 address_dst *** popl address_dst(rd),@rs */ -{ -#ifdef NICENAMES -"popl address_dst(rd),@rs",32,23, -0x00, -#endif -"popl",OPC_popl,0,{CLASS_X+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REGN0+(ARG_RD),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,276}, - - -/* 0101 0101 ssN0 0000 address_dst *** popl address_dst,@rs */ -{ -#ifdef NICENAMES -"popl address_dst,@rs",32,23, -0x00, -#endif -"popl",OPC_popl,0,{CLASS_DA+(ARG_DST),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_BIT+0,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,277}, - - -/* 1001 0101 ssN0 dddd *** popl rrd,@rs */ -{ -#ifdef NICENAMES -"popl rrd,@rs",32,12, -0x00, -#endif -"popl",OPC_popl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+9,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,278}, - - -/* 0001 0011 ddN0 ssN0 *** push @rd,@rs */ -{ -#ifdef NICENAMES -"push @rd,@rs",16,13, -0x00, -#endif -"push",OPC_push,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+1,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),0,0,0,0,0,},2,2,279}, - - -/* 0101 0011 ddN0 0000 address_src *** push @rd,address_src */ -{ -#ifdef NICENAMES -"push @rd,address_src",16,14, -0x00, -#endif -"push",OPC_push,0,{CLASS_IR+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+5,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,280}, - - -/* 0101 0011 ddN0 ssN0 address_src *** push @rd,address_src(rs) */ -{ -#ifdef NICENAMES -"push @rd,address_src(rs)",16,14, -0x00, -#endif -"push",OPC_push,0,{CLASS_IR+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,281}, - - -/* 0000 1101 ddN0 1001 imm16 *** push @rd,imm16 */ -{ -#ifdef NICENAMES -"push @rd,imm16",16,12, -0x00, -#endif -"push",OPC_push,0,{CLASS_IR+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,282}, - - -/* 1001 0011 ddN0 ssss *** push @rd,rs */ -{ -#ifdef NICENAMES -"push @rd,rs",16,9, -0x00, -#endif -"push",OPC_push,0,{CLASS_IR+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+9,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,283}, - - -/* 0001 0001 ddN0 ssN0 *** pushl @rd,@rs */ -{ -#ifdef NICENAMES -"pushl @rd,@rs",32,20, -0x00, -#endif -"pushl",OPC_pushl,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+1,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),0,0,0,0,0,},2,2,284}, - - -/* 0101 0001 ddN0 0000 address_src *** pushl @rd,address_src */ -{ -#ifdef NICENAMES -"pushl @rd,address_src",32,21, -0x00, -#endif -"pushl",OPC_pushl,0,{CLASS_IR+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+5,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,285}, - - -/* 0101 0001 ddN0 ssN0 address_src *** pushl @rd,address_src(rs) */ -{ -#ifdef NICENAMES -"pushl @rd,address_src(rs)",32,21, -0x00, -#endif -"pushl",OPC_pushl,0,{CLASS_IR+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_REGN0+(ARG_RS),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,286}, - - -/* 1001 0001 ddN0 ssss *** pushl @rd,rrs */ -{ -#ifdef NICENAMES -"pushl @rd,rrs",32,12, -0x00, -#endif -"pushl",OPC_pushl,0,{CLASS_IR+(ARG_RD),CLASS_REG_LONG+(ARG_RS),}, - {CLASS_BIT+9,CLASS_BIT+1,CLASS_REGN0+(ARG_RD),CLASS_REG+(ARG_RS),0,0,0,0,0,},2,2,287}, - - -/* 0010 0011 ddN0 imm4 *** res @rd,imm4 */ -{ -#ifdef NICENAMES -"res @rd,imm4",16,11, -0x00, -#endif -"res",OPC_res,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+2,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,288}, - - -/* 0110 0011 ddN0 imm4 address_dst *** res address_dst(rd),imm4 */ -{ -#ifdef NICENAMES -"res address_dst(rd),imm4",16,14, -0x00, -#endif -"res",OPC_res,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+6,CLASS_BIT+3,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,289}, - - -/* 0110 0011 0000 imm4 address_dst *** res address_dst,imm4 */ -{ -#ifdef NICENAMES -"res address_dst,imm4",16,13, -0x00, -#endif -"res",OPC_res,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+6,CLASS_BIT+3,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,290}, - - -/* 1010 0011 dddd imm4 *** res rd,imm4 */ -{ -#ifdef NICENAMES -"res rd,imm4",16,4, -0x00, -#endif -"res",OPC_res,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+0xa,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,291}, - - -/* 0010 0011 0000 ssss 0000 dddd 0000 0000 *** res rd,rs */ -{ -#ifdef NICENAMES -"res rd,rs",16,10, -0x00, -#endif -"res",OPC_res,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+2,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,292}, - - -/* 0010 0010 ddN0 imm4 *** resb @rd,imm4 */ -{ -#ifdef NICENAMES -"resb @rd,imm4",8,11, -0x00, -#endif -"resb",OPC_resb,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+2,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,293}, - - -/* 0110 0010 ddN0 imm4 address_dst *** resb address_dst(rd),imm4 */ -{ -#ifdef NICENAMES -"resb address_dst(rd),imm4",8,14, -0x00, -#endif -"resb",OPC_resb,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+6,CLASS_BIT+2,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,294}, - - -/* 0110 0010 0000 imm4 address_dst *** resb address_dst,imm4 */ -{ -#ifdef NICENAMES -"resb address_dst,imm4",8,13, -0x00, -#endif -"resb",OPC_resb,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+6,CLASS_BIT+2,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,295}, - - -/* 1010 0010 dddd imm4 *** resb rbd,imm4 */ -{ -#ifdef NICENAMES -"resb rbd,imm4",8,4, -0x00, -#endif -"resb",OPC_resb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+0xa,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,296}, - - -/* 0010 0010 0000 ssss 0000 dddd 0000 0000 *** resb rbd,rs */ -{ -#ifdef NICENAMES -"resb rbd,rs",8,10, -0x00, -#endif -"resb",OPC_resb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+2,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,297}, - - -/* 1000 1101 flags 0011 *** resflg flags */ -{ -#ifdef NICENAMES -"resflg flags",16,7, -0x3c, -#endif -"resflg",OPC_resflg,0,{CLASS_FLAGS,}, - {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_FLAGS,CLASS_BIT+3,0,0,0,0,0,},1,2,298}, - - -/* 1001 1110 0000 cccc *** ret cc */ -{ -#ifdef NICENAMES -"ret cc",16,10, -0x00, -#endif -"ret",OPC_ret,0,{CLASS_CC,}, - {CLASS_BIT+9,CLASS_BIT+0xe,CLASS_BIT+0,CLASS_CC,0,0,0,0,0,},1,2,299}, - - -/* 1011 0011 dddd 00I0 *** rl rd,imm1or2 */ -{ -#ifdef NICENAMES -"rl rd,imm1or2",16,6, -0x3c, -#endif -"rl",OPC_rl,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0,0,0,0,0,0,},2,2,300}, - - -/* 1011 0010 dddd 00I0 *** rlb rbd,imm1or2 */ -{ -#ifdef NICENAMES -"rlb rbd,imm1or2",8,6, -0x3c, -#endif -"rlb",OPC_rlb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),}, - {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0,0,0,0,0,0,},2,2,301}, - - -/* 1011 0011 dddd 10I0 *** rlc rd,imm1or2 */ -{ -#ifdef NICENAMES -"rlc rd,imm1or2",16,6, -0x3c, -#endif -"rlc",OPC_rlc,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+8,0,0,0,0,0,},2,2,302}, - - -/* 1011 0010 dddd 10I0 *** rlcb rbd,imm1or2 */ -{ -#ifdef NICENAMES -"rlcb rbd,imm1or2",8,9, -0x10, -#endif -"rlcb",OPC_rlcb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),}, - {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+8,0,0,0,0,0,},2,2,303}, - - -/* 1011 1110 aaaa bbbb *** rldb rbb,rba */ -{ -#ifdef NICENAMES -"rldb rbb,rba",8,9, -0x10, -#endif -"rldb",OPC_rldb,0,{CLASS_REG_BYTE+(ARG_RB),CLASS_REG_BYTE+(ARG_RA),}, - {CLASS_BIT+0xb,CLASS_BIT+0xe,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RB),0,0,0,0,0,},2,2,304}, - - -/* 1011 0011 dddd 01I0 *** rr rd,imm1or2 */ -{ -#ifdef NICENAMES -"rr rd,imm1or2",16,6, -0x3c, -#endif -"rr",OPC_rr,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+4,0,0,0,0,0,},2,2,305}, - - -/* 1011 0010 dddd 01I0 *** rrb rbd,imm1or2 */ -{ -#ifdef NICENAMES -"rrb rbd,imm1or2",8,6, -0x3c, -#endif -"rrb",OPC_rrb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),}, - {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+4,0,0,0,0,0,},2,2,306}, - - -/* 1011 0011 dddd 11I0 *** rrc rd,imm1or2 */ -{ -#ifdef NICENAMES -"rrc rd,imm1or2",16,6, -0x3c, -#endif -"rrc",OPC_rrc,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0xc,0,0,0,0,0,},2,2,307}, - - -/* 1011 0010 dddd 11I0 *** rrcb rbd,imm1or2 */ -{ -#ifdef NICENAMES -"rrcb rbd,imm1or2",8,9, -0x10, -#endif -"rrcb",OPC_rrcb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM1OR2),}, - {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT_1OR2+0xc,0,0,0,0,0,},2,2,308}, - - -/* 1011 1100 aaaa bbbb *** rrdb rbb,rba */ -{ -#ifdef NICENAMES -"rrdb rbb,rba",8,9, -0x10, -#endif -"rrdb",OPC_rrdb,0,{CLASS_REG_BYTE+(ARG_RB),CLASS_REG_BYTE+(ARG_RA),}, - {CLASS_BIT+0xb,CLASS_BIT+0xc,CLASS_REG+(ARG_RA),CLASS_REG+(ARG_RB),0,0,0,0,0,},2,2,309}, - - -/* 0011 0110 imm8 *** rsvd36 */ -{ -#ifdef NICENAMES -"rsvd36",8,10, -0x00, -#endif -"rsvd36",OPC_rsvd36,0,{0}, - {CLASS_BIT+3,CLASS_BIT+6,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,310}, - - -/* 0011 1000 imm8 *** rsvd38 */ -{ -#ifdef NICENAMES -"rsvd38",8,10, -0x00, -#endif -"rsvd38",OPC_rsvd38,0,{0}, - {CLASS_BIT+3,CLASS_BIT+8,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,311}, - - -/* 0111 1000 imm8 *** rsvd78 */ -{ -#ifdef NICENAMES -"rsvd78",8,10, -0x00, -#endif -"rsvd78",OPC_rsvd78,0,{0}, - {CLASS_BIT+7,CLASS_BIT+8,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,312}, - - -/* 0111 1110 imm8 *** rsvd7e */ -{ -#ifdef NICENAMES -"rsvd7e",8,10, -0x00, -#endif -"rsvd7e",OPC_rsvd7e,0,{0}, - {CLASS_BIT+7,CLASS_BIT+0xe,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,313}, - - -/* 1001 1101 imm8 *** rsvd9d */ -{ -#ifdef NICENAMES -"rsvd9d",8,10, -0x00, -#endif -"rsvd9d",OPC_rsvd9d,0,{0}, - {CLASS_BIT+9,CLASS_BIT+0xd,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,314}, - - -/* 1001 1111 imm8 *** rsvd9f */ -{ -#ifdef NICENAMES -"rsvd9f",8,10, -0x00, -#endif -"rsvd9f",OPC_rsvd9f,0,{0}, - {CLASS_BIT+9,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,315}, - - -/* 1011 1001 imm8 *** rsvdb9 */ -{ -#ifdef NICENAMES -"rsvdb9",8,10, -0x00, -#endif -"rsvdb9",OPC_rsvdb9,0,{0}, - {CLASS_BIT+0xb,CLASS_BIT+9,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,316}, - - -/* 1011 1111 imm8 *** rsvdbf */ -{ -#ifdef NICENAMES -"rsvdbf",8,10, -0x00, -#endif -"rsvdbf",OPC_rsvdbf,0,{0}, - {CLASS_BIT+0xb,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},0,2,317}, - - -/* 1011 0111 ssss dddd *** sbc rd,rs */ -{ -#ifdef NICENAMES -"sbc rd,rs",16,5, -0x3c, -#endif -"sbc",OPC_sbc,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+0xb,CLASS_BIT+7,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,318}, - - -/* 1011 0110 ssss dddd *** sbcb rbd,rbs */ -{ -#ifdef NICENAMES -"sbcb rbd,rbs",8,5, -0x3f, -#endif -"sbcb",OPC_sbcb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+0xb,CLASS_BIT+6,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,319}, - - -/* 0111 1111 imm8 *** sc imm8 */ -{ -#ifdef NICENAMES -"sc imm8",8,33, -0x3f, -#endif -"sc",OPC_sc,0,{CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+7,CLASS_BIT+0xf,CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},1,2,320}, - - -/* 1011 0011 dddd 1011 0000 ssss 0000 0000 *** sda rd,rs */ -{ -#ifdef NICENAMES -"sda rd,rs",16,15, -0x3c, -#endif -"sda",OPC_sda,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,321}, - - -/* 1011 0010 dddd 1011 0000 ssss 0000 0000 *** sdab rbd,rs */ -{ -#ifdef NICENAMES -"sdab rbd,rs",8,15, -0x3c, -#endif -"sdab",OPC_sdab,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,322}, - - -/* 1011 0011 dddd 1111 0000 ssss 0000 0000 *** sdal rrd,rs */ -{ -#ifdef NICENAMES -"sdal rrd,rs",32,15, -0x3c, -#endif -"sdal",OPC_sdal,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xf,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,323}, - - -/* 1011 0011 dddd 0011 0000 ssss 0000 0000 *** sdl rd,rs */ -{ -#ifdef NICENAMES -"sdl rd,rs",16,15, -0x38, -#endif -"sdl",OPC_sdl,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,324}, - - -/* 1011 0010 dddd 0011 0000 ssss 0000 0000 *** sdlb rbd,rs */ -{ -#ifdef NICENAMES -"sdlb rbd,rs",8,15, -0x38, -#endif -"sdlb",OPC_sdlb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,325}, - - -/* 1011 0011 dddd 0111 0000 ssss 0000 0000 *** sdll rrd,rs */ -{ -#ifdef NICENAMES -"sdll rrd,rs",32,15, -0x38, -#endif -"sdll",OPC_sdll,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+7,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,326}, - - -/* 0010 0101 ddN0 imm4 *** set @rd,imm4 */ -{ -#ifdef NICENAMES -"set @rd,imm4",16,11, -0x00, -#endif -"set",OPC_set,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+2,CLASS_BIT+5,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,327}, - - -/* 0110 0101 ddN0 imm4 address_dst *** set address_dst(rd),imm4 */ -{ -#ifdef NICENAMES -"set address_dst(rd),imm4",16,14, -0x00, -#endif -"set",OPC_set,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+6,CLASS_BIT+5,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,328}, - - -/* 0110 0101 0000 imm4 address_dst *** set address_dst,imm4 */ -{ -#ifdef NICENAMES -"set address_dst,imm4",16,13, -0x00, -#endif -"set",OPC_set,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+6,CLASS_BIT+5,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,329}, - - -/* 1010 0101 dddd imm4 *** set rd,imm4 */ -{ -#ifdef NICENAMES -"set rd,imm4",16,4, -0x00, -#endif -"set",OPC_set,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+0xa,CLASS_BIT+5,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,330}, - - -/* 0010 0101 0000 ssss 0000 dddd 0000 0000 *** set rd,rs */ -{ -#ifdef NICENAMES -"set rd,rs",16,10, -0x00, -#endif -"set",OPC_set,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+2,CLASS_BIT+5,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,331}, - - -/* 0010 0100 ddN0 imm4 *** setb @rd,imm4 */ -{ -#ifdef NICENAMES -"setb @rd,imm4",8,11, -0x00, -#endif -"setb",OPC_setb,0,{CLASS_IR+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+2,CLASS_BIT+4,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,332}, - - -/* 0110 0100 ddN0 imm4 address_dst *** setb address_dst(rd),imm4 */ -{ -#ifdef NICENAMES -"setb address_dst(rd),imm4",8,14, -0x00, -#endif -"setb",OPC_setb,0,{CLASS_X+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+6,CLASS_BIT+4,CLASS_REGN0+(ARG_RD),CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,333}, - - -/* 0110 0100 0000 imm4 address_dst *** setb address_dst,imm4 */ -{ -#ifdef NICENAMES -"setb address_dst,imm4",8,13, -0x00, -#endif -"setb",OPC_setb,0,{CLASS_DA+(ARG_DST),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+6,CLASS_BIT+4,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),CLASS_ADDRESS+(ARG_DST),0,0,0,0,},2,4,334}, - - -/* 1010 0100 dddd imm4 *** setb rbd,imm4 */ -{ -#ifdef NICENAMES -"setb rbd,imm4",8,4, -0x00, -#endif -"setb",OPC_setb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4),}, - {CLASS_BIT+0xa,CLASS_BIT+4,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM4),0,0,0,0,0,},2,2,335}, - - -/* 0010 0100 0000 ssss 0000 dddd 0000 0000 *** setb rbd,rs */ -{ -#ifdef NICENAMES -"setb rbd,rs",8,10, -0x00, -#endif -"setb",OPC_setb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+2,CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,336}, - - -/* 1000 1101 flags 0001 *** setflg flags */ -{ -#ifdef NICENAMES -"setflg flags",16,7, -0x3c, -#endif -"setflg",OPC_setflg,0,{CLASS_FLAGS,}, - {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_FLAGS,CLASS_BIT+1,0,0,0,0,0,},1,2,337}, - - -/* 0011 1010 dddd 0101 imm16 *** sinb rbd,imm16 */ -{ -#ifdef NICENAMES -"sinb rbd,imm16",8,0, -0x00, -#endif -"sinb",OPC_sinb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,338}, - - -/* 0011 1011 dddd 0101 imm16 *** sinb rd,imm16 */ -{ -#ifdef NICENAMES -"sinb rd,imm16",8,0, -0x00, -#endif -"sinb",OPC_sinb,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,339}, - - -/* 0011 1011 ssN0 1000 0001 aaaa ddN0 1000 *** sind @rd,@rs,ra */ -{ -#ifdef NICENAMES -"sind @rd,@rs,ra",16,0, -0x00, -#endif -"sind",OPC_sind,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+1,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,340}, - - -/* 0011 1010 ssN0 1000 0001 aaaa ddN0 1000 *** sindb @rd,@rs,rba */ -{ -#ifdef NICENAMES -"sindb @rd,@rs,rba",8,0, -0x00, -#endif -"sindb",OPC_sindb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+8,CLASS_BIT+1,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,341}, - - -/* 0011 1010 ssN0 0001 0000 aaaa ddN0 1000 *** sinib @rd,@rs,ra */ -{ -#ifdef NICENAMES -"sinib @rd,@rs,ra",8,0, -0x00, -#endif -"sinib",OPC_sinib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,342}, - - -/* 0011 1010 ssN0 0001 0000 aaaa ddN0 0000 *** sinibr @rd,@rs,ra */ -{ -#ifdef NICENAMES -"sinibr @rd,@rs,ra",16,0, -0x00, -#endif -"sinibr",OPC_sinibr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,343}, - - -/* 1011 0011 dddd 1001 0000 0000 imm8 *** sla rd,imm8 */ -{ -#ifdef NICENAMES -"sla rd,imm8",16,13, -0x3c, -#endif -"sla",OPC_sla,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,344}, - - -/* 1011 0010 dddd 1001 0000 0000 imm8 *** slab rbd,imm8 */ -{ -#ifdef NICENAMES -"slab rbd,imm8",8,13, -0x3c, -#endif -"slab",OPC_slab,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,345}, - - -/* 1011 0011 dddd 1101 0000 0000 imm8 *** slal rrd,imm8 */ -{ -#ifdef NICENAMES -"slal rrd,imm8",32,13, -0x3c, -#endif -"slal",OPC_slal,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,346}, - - -/* 1011 0011 dddd 0001 0000 0000 imm8 *** sll rd,imm8 */ -{ -#ifdef NICENAMES -"sll rd,imm8",16,13, -0x38, -#endif -"sll",OPC_sll,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,347}, - - -/* 1011 0010 dddd 0001 0000 0000 imm8 *** sllb rbd,imm8 */ -{ -#ifdef NICENAMES -"sllb rbd,imm8",8,13, -0x38, -#endif -"sllb",OPC_sllb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,348}, - - -/* 1011 0011 dddd 0101 0000 0000 imm8 *** slll rrd,imm8 */ -{ -#ifdef NICENAMES -"slll rrd,imm8",32,13, -0x38, -#endif -"slll",OPC_slll,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,349}, - - -/* 0011 1011 ssss 0111 imm16 *** sout imm16,rs */ -{ -#ifdef NICENAMES -"sout imm16,rs",16,0, -0x00, -#endif -"sout",OPC_sout,0,{CLASS_IMM+(ARG_IMM16),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REG+(ARG_RS),CLASS_BIT+7,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,350}, - - -/* 0011 1010 ssss 0111 imm16 *** soutb imm16,rbs */ -{ -#ifdef NICENAMES -"soutb imm16,rbs",8,0, -0x00, -#endif -"soutb",OPC_soutb,0,{CLASS_IMM+(ARG_IMM16),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REG+(ARG_RS),CLASS_BIT+7,CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,351}, - - -/* 0011 1011 ssN0 1011 0000 aaaa ddN0 1000 *** soutd @rd,@rs,ra */ -{ -#ifdef NICENAMES -"soutd @rd,@rs,ra",16,0, -0x00, -#endif -"soutd",OPC_soutd,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xb,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,352}, - - -/* 0011 1010 ssN0 1011 0000 aaaa ddN0 1000 *** soutdb @rd,@rs,rba */ -{ -#ifdef NICENAMES -"soutdb @rd,@rs,rba",8,0, -0x00, -#endif -"soutdb",OPC_soutdb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+0xb,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,353}, - - -/* 0011 1010 ssN0 0011 0000 aaaa ddN0 1000 *** soutib @rd,@rs,ra */ -{ -#ifdef NICENAMES -"soutib @rd,@rs,ra",8,0, -0x00, -#endif -"soutib",OPC_soutib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,},3,4,354}, - - -/* 0011 1010 ssN0 0011 0000 aaaa ddN0 0000 *** soutibr @rd,@rs,ra */ -{ -#ifdef NICENAMES -"soutibr @rd,@rs,ra",16,0, -0x00, -#endif -"soutibr",OPC_soutibr,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_WORD+(ARG_RA),}, - {CLASS_BIT+3,CLASS_BIT+0xa,CLASS_REGN0+(ARG_RS),CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RD),CLASS_BIT+0,0,},3,4,355}, - - -/* 1011 0011 dddd 1001 1111 1111 nim8 *** sra rd,imm8 */ -{ -#ifdef NICENAMES -"sra rd,imm8",16,13, -0x3c, -#endif -"sra",OPC_sra,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,356}, - - -/* 1011 0010 dddd 1001 0000 0000 nim8 *** srab rbd,imm8 */ -{ -#ifdef NICENAMES -"srab rbd,imm8",8,13, -0x3c, -#endif -"srab",OPC_srab,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_NIM8),0,0,},2,4,357}, - - -/* 1011 0011 dddd 1101 1111 1111 nim8 *** sral rrd,imm8 */ -{ -#ifdef NICENAMES -"sral rrd,imm8",32,13, -0x3c, -#endif -"sral",OPC_sral,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+0xd,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,358}, - - -/* 1011 0011 dddd 0001 1111 1111 nim8 *** srl rd,imm8 */ -{ -#ifdef NICENAMES -"srl rd,imm8",16,13, -0x3c, -#endif -"srl",OPC_srl,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,359}, - - -/* 1011 0010 dddd 0001 0000 0000 nim8 *** srlb rbd,imm8 */ -{ -#ifdef NICENAMES -"srlb rbd,imm8",8,13, -0x3c, -#endif -"srlb",OPC_srlb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_NIM8),0,0,},2,4,360}, - - -/* 1011 0011 dddd 0101 1111 1111 nim8 *** srll rrd,imm8 */ -{ -#ifdef NICENAMES -"srll rrd,imm8",32,13, -0x3c, -#endif -"srll",OPC_srll,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+5,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,361}, - - -/* 0000 0011 ssN0 dddd *** sub rd,@rs */ -{ -#ifdef NICENAMES -"sub rd,@rs",16,7, -0x3c, -#endif -"sub",OPC_sub,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+0,CLASS_BIT+3,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,362}, - - -/* 0100 0011 0000 dddd address_src *** sub rd,address_src */ -{ -#ifdef NICENAMES -"sub rd,address_src",16,9, -0x3c, -#endif -"sub",OPC_sub,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+4,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,363}, - - -/* 0100 0011 ssN0 dddd address_src *** sub rd,address_src(rs) */ -{ -#ifdef NICENAMES -"sub rd,address_src(rs)",16,10, -0x3c, -#endif -"sub",OPC_sub,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+4,CLASS_BIT+3,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,364}, - - -/* 0000 0011 0000 dddd imm16 *** sub rd,imm16 */ -{ -#ifdef NICENAMES -"sub rd,imm16",16,7, -0x3c, -#endif -"sub",OPC_sub,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+0,CLASS_BIT+3,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,365}, - - -/* 1000 0011 ssss dddd *** sub rd,rs */ -{ -#ifdef NICENAMES -"sub rd,rs",16,4, -0x3c, -#endif -"sub",OPC_sub,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+8,CLASS_BIT+3,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,366}, - - -/* 0000 0010 ssN0 dddd *** subb rbd,@rs */ -{ -#ifdef NICENAMES -"subb rbd,@rs",8,7, -0x3f, -#endif -"subb",OPC_subb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+0,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,367}, - - -/* 0100 0010 0000 dddd address_src *** subb rbd,address_src */ -{ -#ifdef NICENAMES -"subb rbd,address_src",8,9, -0x3f, -#endif -"subb",OPC_subb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+4,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,368}, - - -/* 0100 0010 ssN0 dddd address_src *** subb rbd,address_src(rs) */ -{ -#ifdef NICENAMES -"subb rbd,address_src(rs)",8,10, -0x3f, -#endif -"subb",OPC_subb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+4,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,369}, - - -/* 0000 0010 0000 dddd imm8 imm8 *** subb rbd,imm8 */ -{ -#ifdef NICENAMES -"subb rbd,imm8",8,7, -0x3f, -#endif -"subb",OPC_subb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,370}, - - -/* 1000 0010 ssss dddd *** subb rbd,rbs */ -{ -#ifdef NICENAMES -"subb rbd,rbs",8,4, -0x3f, -#endif -"subb",OPC_subb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+8,CLASS_BIT+2,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,371}, - - -/* 0001 0010 ssN0 dddd *** subl rrd,@rs */ -{ -#ifdef NICENAMES -"subl rrd,@rs",32,14, -0x3c, -#endif -"subl",OPC_subl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+1,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,372}, - - -/* 0101 0010 0000 dddd address_src *** subl rrd,address_src */ -{ -#ifdef NICENAMES -"subl rrd,address_src",32,15, -0x3c, -#endif -"subl",OPC_subl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+5,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,373}, - - -/* 0101 0010 ssN0 dddd address_src *** subl rrd,address_src(rs) */ -{ -#ifdef NICENAMES -"subl rrd,address_src(rs)",32,16, -0x3c, -#endif -"subl",OPC_subl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+5,CLASS_BIT+2,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,374}, - - -/* 0001 0010 0000 dddd imm32 *** subl rrd,imm32 */ -{ -#ifdef NICENAMES -"subl rrd,imm32",32,14, -0x3c, -#endif -"subl",OPC_subl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_IMM+(ARG_IMM32),}, - {CLASS_BIT+1,CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM32),0,0,0,0,},2,6,375}, - - -/* 1001 0010 ssss dddd *** subl rrd,rrs */ -{ -#ifdef NICENAMES -"subl rrd,rrs",32,8, -0x3c, -#endif -"subl",OPC_subl,0,{CLASS_REG_LONG+(ARG_RD),CLASS_REG_LONG+(ARG_RS),}, - {CLASS_BIT+9,CLASS_BIT+2,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,376}, - - -/* 1010 1111 dddd cccc *** tcc cc,rd */ -{ -#ifdef NICENAMES -"tcc cc,rd",16,5, -0x00, -#endif -"tcc",OPC_tcc,0,{CLASS_CC,CLASS_REG_WORD+(ARG_RD),}, - {CLASS_BIT+0xa,CLASS_BIT+0xf,CLASS_REG+(ARG_RD),CLASS_CC,0,0,0,0,0,},2,2,377}, - - -/* 1010 1110 dddd cccc *** tccb cc,rbd */ -{ -#ifdef NICENAMES -"tccb cc,rbd",8,5, -0x00, -#endif -"tccb",OPC_tccb,0,{CLASS_CC,CLASS_REG_BYTE+(ARG_RD),}, - {CLASS_BIT+0xa,CLASS_BIT+0xe,CLASS_REG+(ARG_RD),CLASS_CC,0,0,0,0,0,},2,2,378}, - - -/* 0000 1101 ddN0 0100 *** test @rd */ -{ -#ifdef NICENAMES -"test @rd",16,8, -0x18, -#endif -"test",OPC_test,0,{CLASS_IR+(ARG_RD),}, - {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,379}, - - -/* 0100 1101 0000 0100 address_dst *** test address_dst */ -{ -#ifdef NICENAMES -"test address_dst",16,11, -0x00, -#endif -"test",OPC_test,0,{CLASS_DA+(ARG_DST),}, - {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,380}, - - -/* 0100 1101 ddN0 0100 address_dst *** test address_dst(rd) */ -{ -#ifdef NICENAMES -"test address_dst(rd)",16,12, -0x00, -#endif -"test",OPC_test,0,{CLASS_X+(ARG_RD),}, - {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,381}, - - -/* 1000 1101 dddd 0100 *** test rd */ -{ -#ifdef NICENAMES -"test rd",16,7, -0x00, -#endif -"test",OPC_test,0,{CLASS_REG_WORD+(ARG_RD),}, - {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,382}, - - -/* 0000 1100 ddN0 0100 *** testb @rd */ -{ -#ifdef NICENAMES -"testb @rd",8,8, -0x1c, -#endif -"testb",OPC_testb,0,{CLASS_IR+(ARG_RD),}, - {CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,383}, - - -/* 0100 1100 0000 0100 address_dst *** testb address_dst */ -{ -#ifdef NICENAMES -"testb address_dst",8,11, -0x1c, -#endif -"testb",OPC_testb,0,{CLASS_DA+(ARG_DST),}, - {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,384}, - - -/* 0100 1100 ddN0 0100 address_dst *** testb address_dst(rd) */ -{ -#ifdef NICENAMES -"testb address_dst(rd)",8,12, -0x1c, -#endif -"testb",OPC_testb,0,{CLASS_X+(ARG_RD),}, - {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,385}, - - -/* 1000 1100 dddd 0100 *** testb rbd */ -{ -#ifdef NICENAMES -"testb rbd",8,7, -0x1c, -#endif -"testb",OPC_testb,0,{CLASS_REG_BYTE+(ARG_RD),}, - {CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+4,0,0,0,0,0,},1,2,386}, - - -/* 0001 1100 ddN0 1000 *** testl @rd */ -{ -#ifdef NICENAMES -"testl @rd",32,13, -0x18, -#endif -"testl",OPC_testl,0,{CLASS_IR+(ARG_RD),}, - {CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,387}, - - -/* 0101 1100 0000 1000 address_dst *** testl address_dst */ -{ -#ifdef NICENAMES -"testl address_dst",32,16, -0x18, -#endif -"testl",OPC_testl,0,{CLASS_DA+(ARG_DST),}, - {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,388}, - - -/* 0101 1100 ddN0 1000 address_dst *** testl address_dst(rd) */ -{ -#ifdef NICENAMES -"testl address_dst(rd)",32,17, -0x18, -#endif -"testl",OPC_testl,0,{CLASS_X+(ARG_RD),}, - {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,389}, - - -/* 1001 1100 dddd 1000 *** testl rrd */ -{ -#ifdef NICENAMES -"testl rrd",32,13, -0x18, -#endif -"testl",OPC_testl,0,{CLASS_REG_LONG+(ARG_RD),}, - {CLASS_BIT+9,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+8,0,0,0,0,0,},1,2,390}, - - -/* 1011 1000 ddN0 1000 0000 aaaa ssN0 0000 *** trdb @rd,@rs,rba */ -{ -#ifdef NICENAMES -"trdb @rd,@rs,rba",8,25, -0x1c, -#endif -"trdb",OPC_trdb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),}, - {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,391}, - - -/* 1011 1000 ddN0 1100 0000 aaaa ssN0 0000 *** trdrb @rd,@rs,rba */ -{ -#ifdef NICENAMES -"trdrb @rd,@rs,rba",8,25, -0x1c, -#endif -"trdrb",OPC_trdrb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RA),}, - {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+0xc,CLASS_BIT+0,CLASS_REG+(ARG_RA),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,392}, - - -/* 1011 1000 ddN0 0000 0000 rrrr ssN0 0000 *** trib @rd,@rs,rbr */ -{ -#ifdef NICENAMES -"trib @rd,@rs,rbr",8,25, -0x1c, -#endif -"trib",OPC_trib,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RR),}, - {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,393}, - - -/* 1011 1000 ddN0 0100 0000 rrrr ssN0 0000 *** trirb @rd,@rs,rbr */ -{ -#ifdef NICENAMES -"trirb @rd,@rs,rbr",8,25, -0x1c, -#endif -"trirb",OPC_trirb,0,{CLASS_IR+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_REG_BYTE+(ARG_RR),}, - {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RD),CLASS_BIT+4,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RS),CLASS_BIT+0,0,},3,4,394}, - - -/* 1011 1000 aaN0 1010 0000 rrrr bbN0 0000 *** trtdb @ra,@rb,rbr */ -{ -#ifdef NICENAMES -"trtdb @ra,@rb,rbr",8,25, -0x1c, -#endif -"trtdb",OPC_trtdb,0,{CLASS_IR+(ARG_RA),CLASS_IR+(ARG_RB),CLASS_REG_BYTE+(ARG_RR),}, - {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+0xa,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0,0,},3,4,395}, - - -/* 1011 1000 aaN0 1110 0000 rrrr bbN0 1110 *** trtdrb @ra,@rb,rbr */ -{ -#ifdef NICENAMES -"trtdrb @ra,@rb,rbr",8,25, -0x1c, -#endif -"trtdrb",OPC_trtdrb,0,{CLASS_IR+(ARG_RA),CLASS_IR+(ARG_RB),CLASS_REG_BYTE+(ARG_RR),}, - {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+0xe,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0xe,0,},3,4,396}, - - -/* 1011 1000 aaN0 0010 0000 rrrr bbN0 0000 *** trtib @ra,@rb,rbr */ -{ -#ifdef NICENAMES -"trtib @ra,@rb,rbr",8,25, -0x1c, -#endif -"trtib",OPC_trtib,0,{CLASS_IR+(ARG_RA),CLASS_IR+(ARG_RB),CLASS_REG_BYTE+(ARG_RR),}, - {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+2,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0,0,},3,4,397}, - - -/* 1011 1000 aaN0 0110 0000 rrrr bbN0 1110 *** trtirb @ra,@rb,rbr */ -{ -#ifdef NICENAMES -"trtirb @ra,@rb,rbr",8,25, -0x1c, -#endif -"trtirb",OPC_trtirb,0,{CLASS_IR+(ARG_RA),CLASS_IR+(ARG_RB),CLASS_REG_BYTE+(ARG_RR),}, - {CLASS_BIT+0xb,CLASS_BIT+8,CLASS_REGN0+(ARG_RA),CLASS_BIT+6,CLASS_BIT+0,CLASS_REG+(ARG_RR),CLASS_REGN0+(ARG_RB),CLASS_BIT+0xe,0,},3,4,398}, - - -/* 0000 1101 ddN0 0110 *** tset @rd */ -{ -#ifdef NICENAMES -"tset @rd",16,11, -0x08, -#endif -"tset",OPC_tset,0,{CLASS_IR+(ARG_RD),}, - {CLASS_BIT+0,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,399}, - - -/* 0100 1101 0000 0110 address_dst *** tset address_dst */ -{ -#ifdef NICENAMES -"tset address_dst",16,14, -0x08, -#endif -"tset",OPC_tset,0,{CLASS_DA+(ARG_DST),}, - {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_BIT+0,CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,400}, - - -/* 0100 1101 ddN0 0110 address_dst *** tset address_dst(rd) */ -{ -#ifdef NICENAMES -"tset address_dst(rd)",16,15, -0x08, -#endif -"tset",OPC_tset,0,{CLASS_X+(ARG_RD),}, - {CLASS_BIT+4,CLASS_BIT+0xd,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,401}, - - -/* 1000 1101 dddd 0110 *** tset rd */ -{ -#ifdef NICENAMES -"tset rd",16,7, -0x08, -#endif -"tset",OPC_tset,0,{CLASS_REG_WORD+(ARG_RD),}, - {CLASS_BIT+8,CLASS_BIT+0xd,CLASS_REG+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,402}, - - -/* 0000 1100 ddN0 0110 *** tsetb @rd */ -{ -#ifdef NICENAMES -"tsetb @rd",8,11, -0x08, -#endif -"tsetb",OPC_tsetb,0,{CLASS_IR+(ARG_RD),}, - {CLASS_BIT+0,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,403}, - - -/* 0100 1100 0000 0110 address_dst *** tsetb address_dst */ -{ -#ifdef NICENAMES -"tsetb address_dst",8,14, -0x08, -#endif -"tsetb",OPC_tsetb,0,{CLASS_DA+(ARG_DST),}, - {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,404}, - - -/* 0100 1100 ddN0 0110 address_dst *** tsetb address_dst(rd) */ -{ -#ifdef NICENAMES -"tsetb address_dst(rd)",8,15, -0x08, -#endif -"tsetb",OPC_tsetb,0,{CLASS_X+(ARG_RD),}, - {CLASS_BIT+4,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+6,CLASS_ADDRESS+(ARG_DST),0,0,0,0,},1,4,405}, - - -/* 1000 1100 dddd 0110 *** tsetb rbd */ -{ -#ifdef NICENAMES -"tsetb rbd",8,7, -0x08, -#endif -"tsetb",OPC_tsetb,0,{CLASS_REG_BYTE+(ARG_RD),}, - {CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+6,0,0,0,0,0,},1,2,406}, - - -/* 0000 1001 ssN0 dddd *** xor rd,@rs */ -{ -#ifdef NICENAMES -"xor rd,@rs",16,7, -0x18, -#endif -"xor",OPC_xor,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+0,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,407}, - - -/* 0100 1001 0000 dddd address_src *** xor rd,address_src */ -{ -#ifdef NICENAMES -"xor rd,address_src",16,9, -0x18, -#endif -"xor",OPC_xor,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+4,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,408}, - - -/* 0100 1001 ssN0 dddd address_src *** xor rd,address_src(rs) */ -{ -#ifdef NICENAMES -"xor rd,address_src(rs)",16,10, -0x18, -#endif -"xor",OPC_xor,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+4,CLASS_BIT+9,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,409}, - - -/* 0000 1001 0000 dddd imm16 *** xor rd,imm16 */ -{ -#ifdef NICENAMES -"xor rd,imm16",16,7, -0x18, -#endif -"xor",OPC_xor,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IMM+(ARG_IMM16),}, - {CLASS_BIT+0,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM16),0,0,0,0,},2,4,410}, - - -/* 1000 1001 ssss dddd *** xor rd,rs */ -{ -#ifdef NICENAMES -"xor rd,rs",16,4, -0x18, -#endif -"xor",OPC_xor,0,{CLASS_REG_WORD+(ARG_RD),CLASS_REG_WORD+(ARG_RS),}, - {CLASS_BIT+8,CLASS_BIT+9,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,411}, - - -/* 0000 1000 ssN0 dddd *** xorb rbd,@rs */ -{ -#ifdef NICENAMES -"xorb rbd,@rs",8,7, -0x1c, -#endif -"xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IR+(ARG_RS),}, - {CLASS_BIT+0,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,412}, - - -/* 0100 1000 0000 dddd address_src *** xorb rbd,address_src */ -{ -#ifdef NICENAMES -"xorb rbd,address_src",8,9, -0x1c, -#endif -"xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_DA+(ARG_SRC),}, - {CLASS_BIT+4,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,413}, - - -/* 0100 1000 ssN0 dddd address_src *** xorb rbd,address_src(rs) */ -{ -#ifdef NICENAMES -"xorb rbd,address_src(rs)",8,10, -0x1c, -#endif -"xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),}, - {CLASS_BIT+4,CLASS_BIT+8,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,414}, - - -/* 0000 1000 0000 dddd imm8 imm8 *** xorb rbd,imm8 */ -{ -#ifdef NICENAMES -"xorb rbd,imm8",8,7, -0x1c, -#endif -"xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0,CLASS_BIT+8,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,415}, - - -/* 1000 1000 ssss dddd *** xorb rbd,rbs */ -{ -#ifdef NICENAMES -"xorb rbd,rbs",8,4, -0x1c, -#endif -"xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+8,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,416}, - - -/* 1000 1000 ssss dddd *** xorb rbd,rbs */ -{ -#ifdef NICENAMES -"xorb rbd,rbs",8,4, -0x01, -#endif -"xorb",OPC_xorb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_REG_BYTE+(ARG_RS),}, - {CLASS_BIT+8,CLASS_BIT+8,CLASS_REG+(ARG_RS),CLASS_REG+(ARG_RD),0,0,0,0,0,},2,2,417}, -0,0}; -#endif diff --git a/contrib/binutils/opcodes/z8kgen.c b/contrib/binutils/opcodes/z8kgen.c deleted file mode 100644 index c8f3970d096f..000000000000 --- a/contrib/binutils/opcodes/z8kgen.c +++ /dev/null @@ -1,1313 +0,0 @@ -/* - Copyright 2001 Free Software Foundation, Inc. - - This file is part of GNU Binutils. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This program generates z8k-opc.h */ - -#include "sysdep.h" - -#define BYTE_INFO_LEN 10 - -struct op -{ - char *flags; - int cycles; - char type; - char *bits; - char *name; - char *flavor; -}; - -#define iswhite(x) ((x) == ' ' || (x) == '\t') -struct op opt[] = -{ - "------", 10, 8, "0000 1110 imm8", "ext0e imm8", 0, - "------", 10, 8, "0000 1111 imm8", "ext0f imm8", 0, - "------", 10, 8, "1000 1110 imm8", "ext8e imm8", 0, - "------", 10, 8, "1000 1111 imm8", "ext8f imm8", 0, - - "------", 10, 8, "0011 0110 imm8", "rsvd36", 0, - "------", 10, 8, "0011 1000 imm8", "rsvd38", 0, - "------", 10, 8, "0111 1000 imm8", "rsvd78", 0, - "------", 10, 8, "0111 1110 imm8", "rsvd7e", 0, - - "------", 10, 8, "1001 1101 imm8", "rsvd9d", 0, - "------", 10, 8, "1001 1111 imm8", "rsvd9f", 0, - - "------", 10, 8, "1011 1001 imm8", "rsvdb9", 0, - "------", 10, 8, "1011 1111 imm8", "rsvdbf", 0, - - "---V--", 11, 16, "1011 1011 ssN0 1001 0000 rrrr ddN0 1000", "ldd @rs,@rd,rr", 0, - "---V--", 11, 16, "1011 1011 ssN0 1001 0000 rrrr ddN0 0000", "lddr @rs,@rd,rr", 0, - "---V--", 11, 8, "1011 1011 ssN0 1001 0000 rrrr ddN0 0000", "lddrb @rs,@rd,rr", 0, - "---V--", 11, 16, "1011 1011 ssN0 0001 0000 rrrr ddN0 0000", "ldir @rd,@rs,rr", 0, - "CZSV--", 11, 16, "1011 1011 ssN0 0000 0000 rrrr dddd cccc", "cpi rd,@rs,rr,cc", 0, - "CZSV--", 11, 16, "1011 1011 ssN0 0100 0000 rrrr dddd cccc", "cpir rd,@rs,rr,cc", 0, - "CZSV--", 11, 16, "1011 1011 ssN0 1100 0000 rrrr dddd cccc", "cpdr rd,@rs,rr,cc", 0, - "---V--", 11, 16, "1011 1011 ssN0 0001 0000 rrrr ddN0 1000", "ldi @rd,@rs,rr", 0, - "CZSV--", 11, 16, "1011 1011 ssN0 1000 0000 rrrr dddd cccc", "cpd rd,@rs,rr,cc", 0, - "---V--", 11, 8, "1011 1010 ssN0 0001 0000 rrrr ddN0 0000", "ldirb @rd,@rs,rr", 0, - "---V--", 11, 8, "1011 1010 ssN0 1001 0000 rrrr ddN0 1000", "lddb @rs,@rd,rr", 0, - "---V--", 11, 8, "1011 1010 ssN0 0001 0000 rrrr ddN0 1000", "ldib @rd,@rs,rr", 0, - "CZSV--", 11, 8, "1011 1010 ssN0 1000 0000 rrrr dddd cccc", "cpdb rbd,@rs,rr,cc", 0, - "CZSV--", 11, 8, "1011 1010 ssN0 1100 0000 rrrr dddd cccc", "cpdrb rbd,@rs,rr,cc", 0, - "CZSV--", 11, 8, "1011 1010 ssN0 0000 0000 rrrr dddd cccc", "cpib rbd,@rs,rr,cc", 0, - "CZSV--", 11, 8, "1011 1010 ssN0 0100 0000 rrrr dddd cccc", "cpirb rbd,@rs,rr,cc", 0, - "CZSV--", 11, 16, "1011 1011 ssN0 1010 0000 rrrr ddN0 cccc", "cpsd @rd,@rs,rr,cc", 0, - "CZSV--", 11, 8, "1011 1010 ssN0 1010 0000 rrrr ddN0 cccc", "cpsdb @rd,@rs,rr,cc", 0, - "CZSV--", 11, 16, "1011 1011 ssN0 1110 0000 rrrr ddN0 cccc", "cpsdr @rd,@rs,rr,cc", 0, - "CZSV--", 11, 8, "1011 1010 ssN0 1110 0000 rrrr ddN0 cccc", "cpsdrb @rd,@rs,rr,cc", 0, - "CZSV--", 11, 16, "1011 1011 ssN0 0010 0000 rrrr ddN0 cccc", "cpsi @rd,@rs,rr,cc", 0, - "CZSV--", 11, 8, "1011 1010 ssN0 0010 0000 rrrr ddN0 cccc", "cpsib @rd,@rs,rr,cc", 0, - "CZSV--", 11, 16, "1011 1011 ssN0 0110 0000 rrrr ddN0 cccc", "cpsir @rd,@rs,rr,cc", 0, - "CZSV--", 11, 8, "1011 1010 ssN0 0110 0000 rrrr ddN0 cccc", "cpsirb @rd,@rs,rr,cc", 0, - - "------", 2, 8, "0011 0110 0000 0000", "bpt", 0, - "CZSV--", 5, 16, "1011 0101 ssss dddd", "adc rd,rs", 0, - "CZSVDH", 5, 8, "1011 0100 ssss dddd", "adcb rbd,rbs", 0, - "CZSV--", 7, 16, "0000 0001 ssN0 dddd", "add rd,@rs", 0, -"CZSV--", 9, 16, "0100 0001 0000 dddd address_src", "add rd,address_src", 0, - "CZSV--", 10, 16, "0100 0001 ssN0 dddd address_src", "add rd,address_src(rs)", 0, - "CZSV--", 7, 16, "0000 0001 0000 dddd imm16", "add rd,imm16", 0, - "CZSV--", 4, 16, "1000 0001 ssss dddd", "add rd,rs", 0, - "CZSVDH", 7, 8, "0000 0000 ssN0 dddd", "addb rbd,@rs", 0, -"CZSVDH", 9, 8, "0100 0000 0000 dddd address_src", "addb rbd,address_src", 0, - "CZSVDH", 10, 8, "0100 0000 ssN0 dddd address_src", "addb rbd,address_src(rs)", 0, - "CZSVDH", 7, 8, "0000 0000 0000 dddd imm8 imm8", "addb rbd,imm8", 0, - "CZSVDH", 4, 8, "1000 0000 ssss dddd", "addb rbd,rbs", 0, - "CZSV--", 14, 32, "0001 0110 ssN0 dddd", "addl rrd,@rs", 0, - "CZSV--", 15, 32, "0101 0110 0000 dddd address_src", "addl rrd,address_src", 0, - "CZSV--", 16, 32, "0101 0110 ssN0 dddd address_src", "addl rrd,address_src(rs)", 0, - "CZSV--", 14, 32, "0001 0110 0000 dddd imm32", "addl rrd,imm32", 0, - "CZSV--", 8, 32, "1001 0110 ssss dddd", "addl rrd,rrs", 0, - - "-ZS---", 7, 16, "0000 0111 ssN0 dddd", "and rd,@rs", 0, -"-ZS---", 9, 16, "0100 0111 0000 dddd address_src", "and rd,address_src", 0, - "-ZS---", 10, 16, "0100 0111 ssN0 dddd address_src", "and rd,address_src(rs)", 0, - "-ZS---", 7, 16, "0000 0111 0000 dddd imm16", "and rd,imm16", 0, - "-ZS---", 4, 16, "1000 0111 ssss dddd", "and rd,rs", 0, - "-ZSP--", 7, 8, "0000 0110 ssN0 dddd", "andb rbd,@rs", 0, -"-ZSP--", 9, 8, "0100 0110 0000 dddd address_src", "andb rbd,address_src", 0, - "-ZSP--", 10, 8, "0100 0110 ssN0 dddd address_src", "andb rbd,address_src(rs)", 0, - "-ZSP--", 7, 8, "0000 0110 0000 dddd imm8 imm8", "andb rbd,imm8", 0, - "-ZSP--", 4, 8, "1000 0110 ssss dddd", "andb rbd,rbs", 0, - - "-Z----", 8, 16, "0010 0111 ddN0 imm4", "bit @rd,imm4", 0, - "-Z----", 11, 16, "0110 0111 ddN0 imm4 address_dst", "bit address_dst(rd),imm4", 0, - "-Z----", 10, 16, "0110 0111 0000 imm4 address_dst", "bit address_dst,imm4", 0, - "-Z----", 4, 16, "1010 0111 dddd imm4", "bit rd,imm4", 0, -"-Z----", 10, 16, "0010 0111 0000 ssss 0000 dddd 0000 0000", "bit rd,rs", 0, - - "-Z----", 8, 8, "0010 0110 ddN0 imm4", "bitb @rd,imm4", 0, - "-Z----", 11, 8, "0110 0110 ddN0 imm4 address_dst", "bitb address_dst(rd),imm4", 0, - "-Z----", 10, 8, "0110 0110 0000 imm4 address_dst", "bitb address_dst,imm4", 0, - "-Z----", 4, 8, "1010 0110 dddd imm4", "bitb rbd,imm4", 0, -"-Z----", 10, 8, "0010 0110 0000 ssss 0000 dddd 0000 0000", "bitb rbd,rs", 0, - - "------", 10, 32, "0001 1111 ddN0 0000", "call @rd", 0, - "------", 12, 32, "0101 1111 0000 0000 address_dst", "call address_dst", 0, - "------", 13, 32, "0101 1111 ddN0 0000 address_dst", "call address_dst(rd)", 0, - "------", 10, 16, "1101 disp12", "calr disp12", 0, - - "------", 8, 16, "0000 1101 ddN0 1000", "clr @rd", 0, - "------", 11, 16, "0100 1101 0000 1000 address_dst", "clr address_dst", 0, - "------", 12, 16, "0100 1101 ddN0 1000 address_dst", "clr address_dst(rd)", 0, - "------", 7, 16, "1000 1101 dddd 1000", "clr rd", 0, - "------", 8, 8, "0000 1100 ddN0 1000", "clrb @rd", 0, - "------", 11, 8, "0100 1100 0000 1000 address_dst", "clrb address_dst", 0, - "------", 12, 8, "0100 1100 ddN0 1000 address_dst", "clrb address_dst(rd)", 0, - "------", 7, 8, "1000 1100 dddd 1000", "clrb rbd", 0, - "-ZS---", 12, 16, "0000 1101 ddN0 0000", "com @rd", 0, - "-ZS---", 15, 16, "0100 1101 0000 0000 address_dst", "com address_dst", 0, - "-ZS---", 16, 16, "0100 1101 ddN0 0000 address_dst", "com address_dst(rd)", 0, - "-ZS---", 7, 16, "1000 1101 dddd 0000", "com rd", 0, - "-ZSP--", 12, 8, "0000 1100 ddN0 0000", "comb @rd", 0, - "-ZSP--", 15, 8, "0100 1100 0000 0000 address_dst", "comb address_dst", 0, - "-ZSP--", 16, 8, "0100 1100 ddN0 0000 address_dst", "comb address_dst(rd)", 0, - "-ZSP--", 7, 8, "1000 1100 dddd 0000", "comb rbd", 0, - "CZSP--", 7, 16, "1000 1101 imm4 0101", "comflg flags", 0, - - "CZSV--", 11, 16, "0000 1101 ddN0 0001 imm16", "cp @rd,imm16", 0, - "CZSV--", 15, 16, "0100 1101 ddN0 0001 address_dst imm16", "cp address_dst(rd),imm16", 0, - "CZSV--", 14, 16, "0100 1101 0000 0001 address_dst imm16", "cp address_dst,imm16", 0, - - "CZSV--", 7, 16, "0000 1011 ssN0 dddd", "cp rd,@rs", 0, - "CZSV--", 9, 16, "0100 1011 0000 dddd address_src", "cp rd,address_src", 0, - "CZSV--", 10, 16, "0100 1011 ssN0 dddd address_src", "cp rd,address_src(rs)", 0, - "CZSV--", 7, 16, "0000 1011 0000 dddd imm16", "cp rd,imm16", 0, - "CZSV--", 4, 16, "1000 1011 ssss dddd", "cp rd,rs", 0, - - "CZSV--", 11, 8, "0000 1100 ddN0 0001 imm8 imm8", "cpb @rd,imm8", 0, - "CZSV--", 15, 8, "0100 1100 ddN0 0001 address_dst imm8 imm8", "cpb address_dst(rd),imm8", 0, - "CZSV--", 14, 8, "0100 1100 0000 0001 address_dst imm8 imm8", "cpb address_dst,imm8", 0, - "CZSV--", 7, 8, "0000 1010 ssN0 dddd", "cpb rbd,@rs", 0, -"CZSV--", 9, 8, "0100 1010 0000 dddd address_src", "cpb rbd,address_src", 0, - "CZSV--", 10, 8, "0100 1010 ssN0 dddd address_src", "cpb rbd,address_src(rs)", 0, - "CZSV--", 7, 8, "0000 1010 0000 dddd imm8 imm8", "cpb rbd,imm8", 0, - "CZSV--", 4, 8, "1000 1010 ssss dddd", "cpb rbd,rbs", 0, - - "CZSV--", 14, 32, "0001 0000 ssN0 dddd", "cpl rrd,@rs", 0, - "CZSV--", 15, 32, "0101 0000 0000 dddd address_src", "cpl rrd,address_src", 0, - "CZSV--", 16, 32, "0101 0000 ssN0 dddd address_src", "cpl rrd,address_src(rs)", 0, - "CZSV--", 14, 32, "0001 0000 0000 dddd imm32", "cpl rrd,imm32", 0, - "CZSV--", 8, 32, "1001 0000 ssss dddd", "cpl rrd,rrs", 0, - - "CZS---", 5, 8, "1011 0000 dddd 0000", "dab rbd", 0, - "------", 11, 16, "1111 dddd 1disp7", "dbjnz rbd,disp7", 0, - "-ZSV--", 11, 16, "0010 1011 ddN0 imm4m1", "dec @rd,imm4m1", 0, - "-ZSV--", 14, 16, "0110 1011 ddN0 imm4m1 address_dst", "dec address_dst(rd),imm4m1", 0, - "-ZSV--", 13, 16, "0110 1011 0000 imm4m1 address_dst", "dec address_dst,imm4m1", 0, - "-ZSV--", 4, 16, "1010 1011 dddd imm4m1", "dec rd,imm4m1", 0, - "-ZSV--", 11, 8, "0010 1010 ddN0 imm4m1", "decb @rd,imm4m1", 0, - "-ZSV--", 14, 8, "0110 1010 ddN0 imm4m1 address_dst", "decb address_dst(rd),imm4m1", 0, - "-ZSV--", 13, 8, "0110 1010 0000 imm4m1 address_dst", "decb address_dst,imm4m1", 0, - "-ZSV--", 4, 8, "1010 1010 dddd imm4m1", "decb rbd,imm4m1", 0, - - "------", 7, 16, "0111 1100 0000 00ii", "di i2", 0, - "CZSV--", 107, 16, "0001 1011 ssN0 dddd", "div rrd,@rs", 0, - "CZSV--", 107, 16, "0101 1011 0000 dddd address_src", "div rrd,address_src", 0, - "CZSV--", 107, 16, "0101 1011 ssN0 dddd address_src", "div rrd,address_src(rs)", 0, - "CZSV--", 107, 16, "0001 1011 0000 dddd imm16", "div rrd,imm16", 0, - "CZSV--", 107, 16, "1001 1011 ssss dddd", "div rrd,rs", 0, - "CZSV--", 744, 32, "0001 1010 ssN0 dddd", "divl rqd,@rs", 0, - "CZSV--", 745, 32, "0101 1010 0000 dddd address_src", "divl rqd,address_src", 0, - "CZSV--", 746, 32, "0101 1010 ssN0 dddd address_src", "divl rqd,address_src(rs)", 0, - "CZSV--", 744, 32, "0001 1010 0000 dddd imm32", "divl rqd,imm32", 0, - "CZSV--", 744, 32, "1001 1010 ssss dddd", "divl rqd,rrs", 0, - - "------", 11, 16, "1111 dddd 0disp7", "djnz rd,disp7", 0, - "------", 7, 16, "0111 1100 0000 01ii", "ei i2", 0, - "------", 6, 16, "1010 1101 ssss dddd", "ex rd,rs", 0, - "------", 12, 16, "0010 1101 ssN0 dddd", "ex rd,@rs", 0, -"------", 15, 16, "0110 1101 0000 dddd address_src", "ex rd,address_src", 0, - "------", 16, 16, "0110 1101 ssN0 dddd address_src", "ex rd,address_src(rs)", 0, - - "------", 12, 8, "0010 1100 ssN0 dddd", "exb rbd,@rs", 0, -"------", 15, 8, "0110 1100 0000 dddd address_src", "exb rbd,address_src", 0, - "------", 16, 8, "0110 1100 ssN0 dddd address_src", "exb rbd,address_src(rs)", 0, - "------", 6, 8, "1010 1100 ssss dddd", "exb rbd,rbs", 0, - - "------", 11, 16, "1011 0001 dddd 1010", "exts rrd", 0, - "------", 11, 8, "1011 0001 dddd 0000", "extsb rd", 0, - "------", 11, 32, "1011 0001 dddd 0111", "extsl rqd", 0, - - "------", 8, 16, "0111 1010 0000 0000", "halt", 0, - "------", 10, 16, "0011 1101 ssN0 dddd", "in rd,@rs", 0, - "------", 12, 16, "0011 1101 dddd 0100 imm16", "in rd,imm16", 0, - "------", 12, 8, "0011 1100 ssN0 dddd", "inb rbd,@rs", 0, - "------", 10, 8, "0011 1100 dddd 0100 imm16", "inb rbd,imm16", 0, - "-ZSV--", 11, 16, "0010 1001 ddN0 imm4m1", "inc @rd,imm4m1", 0, - "-ZSV--", 14, 16, "0110 1001 ddN0 imm4m1 address_dst", "inc address_dst(rd),imm4m1", 0, - "-ZSV--", 13, 16, "0110 1001 0000 imm4m1 address_dst", "inc address_dst,imm4m1", 0, - "-ZSV--", 4, 16, "1010 1001 dddd imm4m1", "inc rd,imm4m1", 0, - "-ZSV--", 11, 8, "0010 1000 ddN0 imm4m1", "incb @rd,imm4m1", 0, - "-ZSV--", 14, 8, "0110 1000 ddN0 imm4m1 address_dst", "incb address_dst(rd),imm4m1", 0, - "-ZSV--", 13, 8, "0110 1000 0000 imm4m1 address_dst", "incb address_dst,imm4m1", 0, - "-ZSV--", 4, 8, "1010 1000 dddd imm4m1", "incb rbd,imm4m1", 0, - "---V--", 21, 16, "0011 1011 ssN0 1000 0000 aaaa ddN0 1000", "ind @rd,@rs,ra", 0, - "---V--", 21, 8, "0011 1010 ssN0 1000 0000 aaaa ddN0 1000", "indb @rd,@rs,rba", 0, - "---V--", 21, 8, "0011 1100 ssN0 0000 0000 aaaa ddN0 1000", "inib @rd,@rs,ra", 0, - "---V--", 21, 16, "0011 1100 ssN0 0000 0000 aaaa ddN0 0000", "inibr @rd,@rs,ra", 0, - "CZSVDH", 13, 16, "0111 1011 0000 0000", "iret", 0, - "------", 10, 16, "0001 1110 ddN0 cccc", "jp cc,@rd", 0, - "------", 7, 16, "0101 1110 0000 cccc address_dst", "jp cc,address_dst", 0, - "------", 8, 16, "0101 1110 ddN0 cccc address_dst", "jp cc,address_dst(rd)", 0, - "------", 6, 16, "1110 cccc disp8", "jr cc,disp8", 0, - - "------", 7, 16, "0000 1101 ddN0 0101 imm16", "ld @rd,imm16", 0, - "------", 8, 16, "0010 1111 ddN0 ssss", "ld @rd,rs", 0, - "------", 15, 16, "0100 1101 ddN0 0101 address_dst imm16", "ld address_dst(rd),imm16", 0, - "------", 12, 16, "0110 1111 ddN0 ssss address_dst", "ld address_dst(rd),rs", 0, - "------", 14, 16, "0100 1101 0000 0101 address_dst imm16", "ld address_dst,imm16", 0, -"------", 11, 16, "0110 1111 0000 ssss address_dst", "ld address_dst,rs", 0, - "------", 14, 16, "0011 0011 ddN0 ssss imm16", "ld rd(imm16),rs", 0, - "------", 14, 16, "0111 0011 ddN0 ssss 0000 xxxx 0000 0000", "ld rd(rx),rs", 0, - "------", 7, 16, "0010 0001 ssN0 dddd", "ld rd,@rs", 0, - "------", 9, 16, "0110 0001 0000 dddd address_src", "ld rd,address_src", 0, - "------", 10, 16, "0110 0001 ssN0 dddd address_src", "ld rd,address_src(rs)", 0, - "------", 7, 16, "0010 0001 0000 dddd imm16", "ld rd,imm16", 0, - "------", 3, 16, "1010 0001 ssss dddd", "ld rd,rs", 0, - "------", 14, 16, "0011 0001 ssN0 dddd imm16", "ld rd,rs(imm16)", 0, - "------", 14, 16, "0111 0001 ssN0 dddd 0000 xxxx 0000 0000", "ld rd,rs(rx)", 0, - - "------", 7, 8, "0000 1100 ddN0 0101 imm8 imm8", "ldb @rd,imm8", 0, - "------", 8, 8, "0010 1110 ddN0 ssss", "ldb @rd,rbs", 0, - "------", 15, 8, "0100 1100 ddN0 0101 address_dst imm8 imm8", "ldb address_dst(rd),imm8", 0, - "------", 12, 8, "0100 1110 ddN0 ssN0 address_dst", "ldb address_dst(rd),rbs", 0, - "------", 14, 8, "0100 1100 0000 0101 address_dst imm8 imm8", "ldb address_dst,imm8", 0, -"------", 11, 8, "0110 1110 0000 ssss address_dst", "ldb address_dst,rbs", 0, - "------", 14, 8, "0011 0010 ddN0 ssss imm16", "ldb rd(imm16),rbs", 0, - "------", 14, 8, "0111 0010 ddN0 ssss 0000 xxxx 0000 0000", "ldb rd(rx),rbs", 0, - "------", 7, 8, "0010 0000 ssN0 dddd", "ldb rbd,@rs", 0, -"------", 9, 8, "0110 0000 0000 dddd address_src", "ldb rbd,address_src", 0, - "------", 10, 8, "0110 0000 ssN0 dddd address_src", "ldb rbd,address_src(rs)", 0, - "------", 5, 8, "1100 dddd imm8", "ldb rbd,imm8", 0, - "------", 3, 8, "1010 0000 ssss dddd", "ldb rbd,rbs", 0, - "------", 14, 8, "0011 0000 ssN0 dddd imm16", "ldb rbd,rs(imm16)", 0, - "------", 14, 8, "0111 0000 ssN0 dddd 0000 xxxx 0000 0000", "ldb rbd,rs(rx)", 0, - - "------", 11, 32, "0001 1101 ddN0 ssss", "ldl @rd,rrs", 0, - "------", 14, 32, "0101 1101 ddN0 ssss address_dst", "ldl address_dst(rd),rrs", 0, - "------", 15, 32, "0101 1101 0000 ssss address_dst", "ldl address_dst,rrs", 0, - "------", 17, 32, "0011 0111 ddN0 ssss imm16", "ldl rd(imm16),rrs", 0, - "------", 17, 32, "0111 0111 ddN0 ssss 0000 xxxx 0000 0000", "ldl rd(rx),rrs", 0, - "------", 11, 32, "0001 0100 ssN0 dddd", "ldl rrd,@rs", 0, - "------", 12, 32, "0101 0100 0000 dddd address_src", "ldl rrd,address_src", 0, - "------", 13, 32, "0101 0100 ssN0 dddd address_src", "ldl rrd,address_src(rs)", 0, - "------", 11, 32, "0001 0100 0000 dddd imm32", "ldl rrd,imm32", 0, - "------", 5, 32, "1001 0100 ssss dddd", "ldl rrd,rrs", 0, - "------", 17, 32, "0011 0101 ssN0 dddd imm16", "ldl rrd,rs(imm16)", 0, - "------", 17, 32, "0111 0101 ssN0 dddd 0000 xxxx 0000 0000", "ldl rrd,rs(rx)", 0, - - "------", 12, 16, "0111 0110 0000 dddd address_src", "lda prd,address_src", 0, - "------", 13, 16, "0111 0110 ssN0 dddd address_src", "lda prd,address_src(rs)", 0, - "------", 15, 16, "0011 0100 ssN0 dddd imm16", "lda prd,rs(imm16)", 0, - "------", 15, 16, "0111 0100 ssN0 dddd 0000 xxxx 0000 0000", "lda prd,rs(rx)", 0, - "------", 15, 16, "0011 0100 0000 dddd disp16", "ldar prd,disp16", 0, - "------", 7, 32, "0111 1101 ssss 1ccc", "ldctl ctrl,rs", 0, - "------", 7, 32, "0111 1101 dddd 0ccc", "ldctl rd,ctrl", 0, - - "------", 5, 16, "1011 1101 dddd imm4", "ldk rd,imm4", 0, - - "------", 11, 16, "0001 1100 ddN0 1001 0000 ssss 0000 nminus1", "ldm @rd,rs,n", 0, - "------", 15, 16, "0101 1100 ddN0 1001 0000 ssN0 0000 nminus1 address_dst", "ldm address_dst(rd),rs,n", 0, - "------", 14, 16, "0101 1100 0000 1001 0000 ssss 0000 nminus1 address_dst", "ldm address_dst,rs,n", 0, - "------", 11, 16, "0001 1100 ssN0 0001 0000 dddd 0000 nminus1", "ldm rd,@rs,n", 0, - "------", 15, 16, "0101 1100 ssN0 0001 0000 dddd 0000 nminus1 address_src", "ldm rd,address_src(rs),n", 0, - "------", 14, 16, "0101 1100 0000 0001 0000 dddd 0000 nminus1 address_src", "ldm rd,address_src,n", 0, - - "CZSVDH", 12, 16, "0011 1001 ssN0 0000", "ldps @rs", 0, - "CZSVDH", 16, 16, "0111 1001 0000 0000 address_src", "ldps address_src", 0, - "CZSVDH", 17, 16, "0111 1001 ssN0 0000 address_src", "ldps address_src(rs)", 0, - - "------", 14, 16, "0011 0011 0000 ssss disp16", "ldr disp16,rs", 0, - "------", 14, 16, "0011 0001 0000 dddd disp16", "ldr rd,disp16", 0, - "------", 14, 8, "0011 0010 0000 ssss disp16", "ldrb disp16,rbs", 0, - "------", 14, 8, "0011 0000 0000 dddd disp16", "ldrb rbd,disp16", 0, - "------", 17, 32, "0011 0111 0000 ssss disp16", "ldrl disp16,rrs", 0, - "------", 17, 32, "0011 0101 0000 dddd disp16", "ldrl rrd,disp16", 0, - - "CZS---", 7, 16, "0111 1011 0000 1010", "mbit", 0, - "-ZS---", 12, 16, "0111 1011 dddd 1101", "mreq rd", 0, - "------", 5, 16, "0111 1011 0000 1001", "mres", 0, - "------", 5, 16, "0111 1011 0000 1000", "mset", 0, - - "CZSV--", 70, 16, "0001 1001 ssN0 dddd", "mult rrd,@rs", 0, - "CZSV--", 70, 16, "0101 1001 0000 dddd address_src", "mult rrd,address_src", 0, - "CZSV--", 70, 16, "0101 1001 ssN0 dddd address_src", "mult rrd,address_src(rs)", 0, - "CZSV--", 70, 16, "0001 1001 0000 dddd imm16", "mult rrd,imm16", 0, - "CZSV--", 70, 16, "1001 1001 ssss dddd", "mult rrd,rs", 0, - "CZSV--", 282, 32, "0001 1000 ssN0 dddd", "multl rqd,@rs", 0, - "CZSV--", 282, 32, "0101 1000 0000 dddd address_src", "multl rqd,address_src", 0, - "CZSV--", 282, 32, "0101 1000 ssN0 dddd address_src", "multl rqd,address_src(rs)", 0, - "CZSV--", 282, 32, "0001 1000 0000 dddd imm32", "multl rqd,imm32", 0, - "CZSV--", 282, 32, "1001 1000 ssss dddd", "multl rqd,rrs", 0, - "CZSV--", 12, 16, "0000 1101 ddN0 0010", "neg @rd", 0, - "CZSV--", 15, 16, "0100 1101 0000 0010 address_dst", "neg address_dst", 0, - "CZSV--", 16, 16, "0100 1101 ddN0 0010 address_dst", "neg address_dst(rd)", 0, - "CZSV--", 7, 16, "1000 1101 dddd 0010", "neg rd", 0, - "CZSV--", 12, 8, "0000 1100 ddN0 0010", "negb @rd", 0, - "CZSV--", 15, 8, "0100 1100 0000 0010 address_dst", "negb address_dst", 0, - "CZSV--", 16, 8, "0100 1100 ddN0 0010 address_dst", "negb address_dst(rd)", 0, - "CZSV--", 7, 8, "1000 1100 dddd 0010", "negb rbd", 0, - - "------", 7, 16, "1000 1101 0000 0111", "nop", 0, - - "CZS---", 7, 16, "0000 0101 ssN0 dddd", "or rd,@rs", 0, - "CZS---", 9, 16, "0100 0101 0000 dddd address_src", "or rd,address_src", 0, - "CZS---", 10, 16, "0100 0101 ssN0 dddd address_src", "or rd,address_src(rs)", 0, - "CZS---", 7, 16, "0000 0101 0000 dddd imm16", "or rd,imm16", 0, - "CZS---", 4, 16, "1000 0101 ssss dddd", "or rd,rs", 0, - - "CZSP--", 7, 8, "0000 0100 ssN0 dddd", "orb rbd,@rs", 0, -"CZSP--", 9, 8, "0100 0100 0000 dddd address_src", "orb rbd,address_src", 0, - "CZSP--", 10, 8, "0100 0100 ssN0 dddd address_src", "orb rbd,address_src(rs)", 0, - "CZSP--", 7, 8, "0000 0100 0000 dddd imm8 imm8", "orb rbd,imm8", 0, - "CZSP--", 4, 8, "1000 0100 ssss dddd", "orb rbd,rbs", 0, - - "---V--", 0, 16, "0011 1111 ddN0 ssss", "out @rd,rs", 0, - "---V--", 0, 16, "0011 1011 ssss 0110 imm16", "out imm16,rs", 0, - "---V--", 0, 8, "0011 1110 ddN0 ssss", "outb @rd,rbs", 0, - "---V--", 0, 8, "0011 1010 ssss 0110 imm16", "outb imm16,rbs", 0, - "---V--", 0, 16, "0011 1011 ssN0 1010 0000 aaaa ddN0 1000", "outd @rd,@rs,ra", 0, - "---V--", 0, 8, "0011 1010 ssN0 1010 0000 aaaa ddN0 1000", "outdb @rd,@rs,rba", 0, - "---V--", 0, 8, "0011 1100 ssN0 0010 0000 aaaa ddN0 1000", "outib @rd,@rs,ra", 0, - "---V--", 0, 16, "0011 1100 ssN0 0010 0000 aaaa ddN0 0000", "outibr @rd,@rs,ra", 0, - - "------", 12, 16, "0001 0111 ssN0 ddN0", "pop @rd,@rs", 0, - "------", 16, 16, "0101 0111 ssN0 ddN0 address_dst", "pop address_dst(rd),@rs", 0, - "------", 16, 16, "0101 0111 ssN0 0000 address_dst", "pop address_dst,@rs", 0, - "------", 8, 16, "1001 0111 ssN0 dddd", "pop rd,@rs", 0, - - "------", 19, 32, "0001 0101 ssN0 ddN0", "popl @rd,@rs", 0, - "------", 23, 32, "0101 0101 ssN0 ddN0 address_dst", "popl address_dst(rd),@rs", 0, - "------", 23, 32, "0101 0101 ssN0 0000 address_dst", "popl address_dst,@rs", 0, - "------", 12, 32, "1001 0101 ssN0 dddd", "popl rrd,@rs", 0, - - "------", 13, 16, "0001 0011 ddN0 ssN0", "push @rd,@rs", 0, - "------", 14, 16, "0101 0011 ddN0 0000 address_src", "push @rd,address_src", 0, - "------", 14, 16, "0101 0011 ddN0 ssN0 address_src", "push @rd,address_src(rs)", 0, - "------", 12, 16, "0000 1101 ddN0 1001 imm16", "push @rd,imm16", 0, - "------", 9, 16, "1001 0011 ddN0 ssss", "push @rd,rs", 0, - - "------", 20, 32, "0001 0001 ddN0 ssN0", "pushl @rd,@rs", 0, - "------", 21, 32, "0101 0001 ddN0 ssN0 address_src", "pushl @rd,address_src(rs)", 0, - "------", 21, 32, "0101 0001 ddN0 0000 address_src", "pushl @rd,address_src", 0, - "------", 12, 32, "1001 0001 ddN0 ssss", "pushl @rd,rrs", 0, - - "------", 11, 16, "0010 0011 ddN0 imm4", "res @rd,imm4", 0, - "------", 14, 16, "0110 0011 ddN0 imm4 address_dst", "res address_dst(rd),imm4", 0, - "------", 13, 16, "0110 0011 0000 imm4 address_dst", "res address_dst,imm4", 0, - "------", 4, 16, "1010 0011 dddd imm4", "res rd,imm4", 0, -"------", 10, 16, "0010 0011 0000 ssss 0000 dddd 0000 0000", "res rd,rs", 0, - - "------", 11, 8, "0010 0010 ddN0 imm4", "resb @rd,imm4", 0, - "------", 14, 8, "0110 0010 ddN0 imm4 address_dst", "resb address_dst(rd),imm4", 0, - "------", 13, 8, "0110 0010 0000 imm4 address_dst", "resb address_dst,imm4", 0, - "------", 4, 8, "1010 0010 dddd imm4", "resb rbd,imm4", 0, -"------", 10, 8, "0010 0010 0000 ssss 0000 dddd 0000 0000", "resb rbd,rs", 0, - - "CZSV--", 7, 16, "1000 1101 imm4 0011", "resflg imm4", 0, - "------", 10, 16, "1001 1110 0000 cccc", "ret cc", 0, - - "CZSV--", 6, 16, "1011 0011 dddd 00I0", "rl rd,imm1or2", 0, - "CZSV--", 6, 8, "1011 0010 dddd 00I0", "rlb rbd,imm1or2", 0, - "CZSV--", 6, 16, "1011 0011 dddd 10I0", "rlc rd,imm1or2", 0, - - "-Z----", 9, 8, "1011 0010 dddd 10I0", "rlcb rbd,imm1or2", 0, - "-Z----", 9, 8, "1011 1110 aaaa bbbb", "rldb rbb,rba", 0, - - "CZSV--", 6, 16, "1011 0011 dddd 01I0", "rr rd,imm1or2", 0, - "CZSV--", 6, 8, "1011 0010 dddd 01I0", "rrb rbd,imm1or2", 0, - "CZSV--", 6, 16, "1011 0011 dddd 11I0", "rrc rd,imm1or2", 0, - - "-Z----", 9, 8, "1011 0010 dddd 11I0", "rrcb rbd,imm1or2", 0, - "-Z----", 9, 8, "1011 1100 aaaa bbbb", "rrdb rbb,rba", 0, - "CZSV--", 5, 16, "1011 0111 ssss dddd", "sbc rd,rs", 0, - "CZSVDH", 5, 8, "1011 0110 ssss dddd", "sbcb rbd,rbs", 0, - - "CZSVDH", 33, 8, "0111 1111 imm8", "sc imm8", 0, - -"CZSV--", 15, 16, "1011 0011 dddd 1011 0000 ssss 0000 0000", "sda rd,rs", 0, -"CZSV--", 15, 8, "1011 0010 dddd 1011 0000 ssss 0000 0000", "sdab rbd,rs", 0, - "CZSV--", 15, 32, "1011 0011 dddd 1111 0000 ssss 0000 0000", "sdal rrd,rs", 0, - -"CZS---", 15, 16, "1011 0011 dddd 0011 0000 ssss 0000 0000", "sdl rd,rs", 0, -"CZS---", 15, 8, "1011 0010 dddd 0011 0000 ssss 0000 0000", "sdlb rbd,rs", 0, - "CZS---", 15, 32, "1011 0011 dddd 0111 0000 ssss 0000 0000", "sdll rrd,rs", 0, - - "------", 11, 16, "0010 0101 ddN0 imm4", "set @rd,imm4", 0, - "------", 14, 16, "0110 0101 ddN0 imm4 address_dst", "set address_dst(rd),imm4", 0, - "------", 13, 16, "0110 0101 0000 imm4 address_dst", "set address_dst,imm4", 0, - "------", 4, 16, "1010 0101 dddd imm4", "set rd,imm4", 0, -"------", 10, 16, "0010 0101 0000 ssss 0000 dddd 0000 0000", "set rd,rs", 0, - "------", 11, 8, "0010 0100 ddN0 imm4", "setb @rd,imm4", 0, - "------", 14, 8, "0110 0100 ddN0 imm4 address_dst", "setb address_dst(rd),imm4", 0, - "------", 13, 8, "0110 0100 0000 imm4 address_dst", "setb address_dst,imm4", 0, - "------", 4, 8, "1010 0100 dddd imm4", "setb rbd,imm4", 0, -"------", 10, 8, "0010 0100 0000 ssss 0000 dddd 0000 0000", "setb rbd,rs", 0, - - "CZSV--", 7, 16, "1000 1101 imm4 0001", "setflg imm4", 0, - - "------", 0, 8, "0011 1100 dddd 0101 imm16", "sinb rbd,imm16", 0, - "------", 0, 8, "0011 1101 dddd 0101 imm16", "sinb rd,imm16", 0, - "------", 0, 16, "0011 1011 ssN0 1000 0001 aaaa ddN0 1000", "sind @rd,@rs,ra", 0, - "------", 0, 8, "0011 1010 ssN0 1000 0001 aaaa ddN0 1000", "sindb @rd,@rs,rba", 0, - "------", 0, 8, "0011 1100 ssN0 0001 0000 aaaa ddN0 1000", "sinib @rd,@rs,ra", 0, - "------", 0, 16, "0011 1100 ssN0 0001 0000 aaaa ddN0 0000", "sinibr @rd,@rs,ra", 0, - - "CZSV--", 13, 16, "1011 0011 dddd 1001 0000 0000 imm8", "sla rd,imm8", 0, - "CZSV--", 13, 8, "1011 0010 dddd 1001 0000 0000 imm8", "slab rbd,imm8", 0, - "CZSV--", 13, 32, "1011 0011 dddd 1101 0000 0000 imm8", "slal rrd,imm8", 0, - - "CZS---", 13, 16, "1011 0011 dddd 0001 0000 0000 imm8", "sll rd,imm8", 0, - "CZS---", 13, 8, "1011 0010 dddd 0001 0000 0000 imm8", "sllb rbd,imm8", 0, - "CZS---", 13, 32, "1011 0011 dddd 0101 0000 0000 imm8", "slll rrd,imm8", 0, - - "------", 0, 16, "0011 1011 ssss 0111 imm16", "sout imm16,rs", 0, - "------", 0, 8, "0011 1010 ssss 0111 imm16", "soutb imm16,rbs", 0, - "------", 0, 16, "0011 1011 ssN0 1011 0000 aaaa ddN0 1000", "soutd @rd,@rs,ra", 0, - "------", 0, 8, "0011 1010 ssN0 1011 0000 aaaa ddN0 1000", "soutdb @rd,@rs,rba", 0, - "------", 0, 8, "0011 1100 ssN0 0011 0000 aaaa ddN0 1000", "soutib @rd,@rs,ra", 0, - "------", 0, 16, "0011 1100 ssN0 0011 0000 aaaa ddN0 0000", "soutibr @rd,@rs,ra", 0, - - "CZSV--", 13, 16, "1011 0011 dddd 1001 1111 1111 nim8", "sra rd,imm8", 0, - "CZSV--", 13, 8, "1011 0010 dddd 1001 1111 1111 nim8", "srab rbd,imm8", 0, - "CZSV--", 13, 32, "1011 0011 dddd 1101 1111 1111 nim8", "sral rrd,imm8", 0, - - "CZSV--", 13, 16, "1011 0011 dddd 0001 1111 1111 nim8", "srl rd,imm8", 0, - "CZSV--", 13, 8, "1011 0010 dddd 0001 1111 1111 nim8", "srlb rbd,imm8", 0, - "CZSV--", 13, 32, "1011 0011 dddd 0101 1111 1111 nim8", "srll rrd,imm8", 0, - - "CZSV--", 7, 16, "0000 0011 ssN0 dddd", "sub rd,@rs", 0, -"CZSV--", 9, 16, "0100 0011 0000 dddd address_src", "sub rd,address_src", 0, - "CZSV--", 10, 16, "0100 0011 ssN0 dddd address_src", "sub rd,address_src(rs)", 0, - "CZSV--", 7, 16, "0000 0010 0000 dddd imm16", "sub rd,imm16", 0, - "CZSV--", 4, 16, "1000 0011 ssss dddd", "sub rd,rs", 0, - - "CZSVDH", 7, 8, "0000 0010 ssN0 dddd", "subb rbd,@rs", 0, -"CZSVDH", 9, 8, "0100 0010 0000 dddd address_src", "subb rbd,address_src", 0, - "CZSVDH", 10, 8, "0100 0010 ssN0 dddd address_src", "subb rbd,address_src(rs)", 0, - "CZSVDH", 7, 8, "0000 0010 0000 dddd imm8 imm8", "subb rbd,imm8", 0, - "CZSVDH", 4, 8, "1000 0010 ssss dddd", "subb rbd,rbs", 0, - - "CZSV--", 14, 32, "0001 0010 ssN0 dddd", "subl rrd,@rs", 0, - "CZSV--", 15, 32, "0101 0010 0000 dddd address_src", "subl rrd,address_src", 0, - "CZSV--", 16, 32, "0101 0010 ssN0 dddd address_src", "subl rrd,address_src(rs)", 0, - "CZSV--", 14, 32, "0001 0010 0000 dddd imm32", "subl rrd,imm32", 0, - "CZSV--", 8, 32, "1001 0010 ssss dddd", "subl rrd,rrs", 0, - - "------", 5, 16, "1010 1111 dddd cccc", "tcc cc,rd", 0, - "------", 5, 8, "1010 1110 dddd cccc", "tccb cc,rbd", 0, - - "-ZS---", 8, 16, "0000 1101 ddN0 0100", "test @rd", 0, - "------", 11, 16, "0100 1101 0000 0100 address_dst", "test address_dst", 0, - "------", 12, 16, "0100 1101 ddN0 0100 address_dst", "test address_dst(rd)", 0, - "------", 7, 16, "1000 1101 dddd 0100", "test rd", 0, - - "-ZSP--", 8, 8, "0000 1100 ddN0 0100", "testb @rd", 0, - "-ZSP--", 11, 8, "0100 1100 0000 0100 address_dst", "testb address_dst", 0, - "-ZSP--", 12, 8, "0100 1100 ddN0 0100 address_dst", "testb address_dst(rd)", 0, - "-ZSP--", 7, 8, "1000 1100 dddd 0100", "testb rbd", 0, - - "-ZS---", 13, 32, "0001 1100 ddN0 1000", "testl @rd", 0, -"-ZS---", 16, 32, "0101 1100 0000 1000 address_dst", "testl address_dst", 0, - "-ZS---", 17, 32, "0101 1100 ddN0 1000 address_dst", "testl address_dst(rd)", 0, - "-ZS---", 13, 32, "1001 1100 dddd 1000", "testl rrd", 0, - - "-ZSV--", 25, 8, "1011 1000 ddN0 1000 0000 aaaa ssN0 0000", "trdb @rd,@rs,rba", 0, - "-ZSV--", 25, 8, "1011 1000 ddN0 1100 0000 aaaa ssN0 0000", "trdrb @rd,@rs,rba", 0, - "-ZSV--", 25, 8, "1011 1000 ddN0 0000 0000 rrrr ssN0 0000", "trib @rd,@rs,rbr", 0, - "-ZSV--", 25, 8, "1011 1000 ddN0 0100 0000 rrrr ssN0 0000", "trirb @rd,@rs,rbr", 0, - "-ZSV--", 25, 8, "1011 1000 aaN0 1110 0000 rrrr bbN0 1110", "trtdrb @ra,@rb,rbr", 0, - "-ZSV--", 25, 8, "1011 1000 aaN0 0010 0000 rrrr bbN0 0000", "trtib @ra,@rb,rr", 0, - "-ZSV--", 25, 8, "1011 1000 aaN0 0110 0000 rrrr bbN0 1110", "trtirb @ra,@rb,rbr", 0, - "-ZSV--", 25, 8, "1011 1000 aaN0 1010 0000 rrrr bbN0 0000", "trtrb @ra,@rb,rbr", 0, - - "--S---", 11, 16, "0000 1101 ddN0 0110", "tset @rd", 0, - "--S---", 14, 16, "0100 1101 0000 0110 address_dst", "tset address_dst", 0, - "--S---", 15, 16, "0100 1101 ddN0 0110 address_dst", "tset address_dst(rd)", 0, - "--S---", 7, 16, "1000 1101 dddd 0110", "tset rd", 0, - - "--S---", 11, 8, "0000 1100 ddN0 0110", "tsetb @rd", 0, - "--S---", 14, 8, "0100 1100 0000 0110 address_dst", "tsetb address_dst", 0, - "--S---", 15, 8, "0100 1100 ddN0 0110 address_dst", "tsetb address_dst(rd)", 0, - "--S---", 7, 8, "1000 1100 dddd 0110", "tsetb rbd", 0, - - "-ZS---", 7, 16, "0000 1001 ssN0 dddd", "xor rd,@rs", 0, -"-ZS---", 9, 16, "0100 1001 0000 dddd address_src", "xor rd,address_src", 0, - "-ZS---", 10, 16, "0100 1001 ssN0 dddd address_src", "xor rd,address_src(rs)", 0, - "-ZS---", 7, 16, "0000 1001 0000 dddd imm16", "xor rd,imm16", 0, - "-ZS---", 4, 16, "1000 1001 ssss dddd", "xor rd,rs", 0, - - "-ZSP--", 7, 8, "0000 1000 ssN0 dddd", "xorb rbd,@rs", 0, -"-ZSP--", 9, 8, "0100 1000 0000 dddd address_src", "xorb rbd,address_src", 0, - "-ZSP--", 10, 8, "0100 1000 ssN0 dddd address_src", "xorb rbd,address_src(rs)", 0, - "-ZSP--", 7, 8, "0000 1000 0000 dddd imm8 imm8", "xorb rbd,imm8", 0, - "-ZSP--", 4, 8, "1000 1000 ssss dddd", "xorb rbd,rbs", 0, - "*", 4, 8, "1000 1000 ssss dddd", "xorb rbd,rbs", 0, - "*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -int -count () -{ - struct op *p = opt; - int r = 0; - - while (p->name) - { - r++; - p++; - } - return r; - -} - -static -int -func (a, b) - struct op *a; - struct op *b; -{ - return strcmp ((a)->name, (b)->name); -} - - -/* opcode - - literal 0000 nnnn insert nnn into stream - operand 0001 nnnn insert operand reg nnn into stream -*/ - -struct tok_struct -{ - - char *match; - char *token; - int length; -}; - -struct tok_struct args[] = -{ - - {"address_src(rs)", "CLASS_X+(ARG_RS)",}, - {"address_dst(rd)", "CLASS_X+(ARG_RD)",}, - - {"rs(imm16)", "CLASS_BA+(ARG_RS)",}, - {"rd(imm16)", "CLASS_BA+(ARG_RD)",}, - {"prd", "CLASS_PR+(ARG_RD)",}, - {"address_src", "CLASS_DA+(ARG_SRC)",}, - {"address_dst", "CLASS_DA+(ARG_DST)",}, - {"rd(rx)", "CLASS_BX+(ARG_RD)",}, - {"rs(rx)", "CLASS_BX+(ARG_RS)",}, - - {"disp16", "CLASS_DISP",}, - {"disp12", "CLASS_DISP",}, - {"disp7", "CLASS_DISP",}, - {"disp8", "CLASS_DISP",}, - {"flags", "CLASS_FLAGS",}, - - {"imm16", "CLASS_IMM+(ARG_IMM16)",}, - {"imm1or2", "CLASS_IMM+(ARG_IMM1OR2)",}, - {"imm32", "CLASS_IMM+(ARG_IMM32)",}, - {"imm4m1", "CLASS_IMM +(ARG_IMM4M1)",}, - {"imm4", "CLASS_IMM +(ARG_IMM4)",}, - {"n", "CLASS_IMM + (ARG_IMMN)",}, - {"ctrl", "CLASS_CTRL",}, - {"rba", "CLASS_REG_BYTE+(ARG_RA)",}, - {"rbb", "CLASS_REG_BYTE+(ARG_RB)",}, - {"rbd", "CLASS_REG_BYTE+(ARG_RD)",}, - {"rbs", "CLASS_REG_BYTE+(ARG_RS)",}, - {"rbr", "CLASS_REG_BYTE+(ARG_RR)",}, - - {"rrd", "CLASS_REG_LONG+(ARG_RD)",}, - {"rrs", "CLASS_REG_LONG+(ARG_RS)",}, - - {"rqd", "CLASS_REG_QUAD+(ARG_RD)",}, - - {"rd", "CLASS_REG_WORD+(ARG_RD)",}, - {"rs", "CLASS_REG_WORD+(ARG_RS)",}, - - {"@rd", "CLASS_IR+(ARG_RD)",}, - {"@ra", "CLASS_IR+(ARG_RA)",}, - {"@rb", "CLASS_IR+(ARG_RB)",}, - {"@rs", "CLASS_IR+(ARG_RS)",}, - - {"imm8", "CLASS_IMM+(ARG_IMM8)",}, - {"i2", "CLASS_IMM+(ARG_IMM2)",}, - {"cc", "CLASS_CC",}, - - {"rr", "CLASS_REG_WORD+(ARG_RR)",}, - {"ra", "CLASS_REG_WORD+(ARG_RA)",}, - {"rs", "CLASS_REG_WORD+(ARG_RS)",}, - - {"1", "CLASS_IMM+(ARG_IMM_1)",}, - {"2", "CLASS_IMM+(ARG_IMM_2)",}, - - 0, 0 -}; - -struct tok_struct toks[] = -{ - "0000", "CLASS_BIT+0", 1, - "0001", "CLASS_BIT+1", 1, - "0010", "CLASS_BIT+2", 1, - "0011", "CLASS_BIT+3", 1, - "0100", "CLASS_BIT+4", 1, - "0101", "CLASS_BIT+5", 1, - "0110", "CLASS_BIT+6", 1, - "0111", "CLASS_BIT+7", 1, - "1000", "CLASS_BIT+8", 1, - "1001", "CLASS_BIT+9", 1, - "1010", "CLASS_BIT+0xa", 1, - "1011", "CLASS_BIT+0xb", 1, - "1100", "CLASS_BIT+0xc", 1, - "1101", "CLASS_BIT+0xd", 1, - "1110", "CLASS_BIT+0xe", 1, - "1111", "CLASS_BIT+0xf", 1, - - "00I0", "CLASS_BIT_1OR2+0", 1, - "00I0", "CLASS_BIT_1OR2+1", 1, - "00I0", "CLASS_BIT_1OR2+2", 1, - "00I0", "CLASS_BIT_1OR2+3", 1, - "01I0", "CLASS_BIT_1OR2+4", 1, - "01I0", "CLASS_BIT_1OR2+5", 1, - "01I0", "CLASS_BIT_1OR2+6", 1, - "01I0", "CLASS_BIT_1OR2+7", 1, - "10I0", "CLASS_BIT_1OR2+8", 1, - "10I0", "CLASS_BIT_1OR2+9", 1, - "10I0", "CLASS_BIT_1OR2+0xa", 1, - "10I0", "CLASS_BIT_1OR2+0xb", 1, - "11I0", "CLASS_BIT_1OR2+0xc", 1, - "11I0", "CLASS_BIT_1OR2+0xd", 1, - "11I0", "CLASS_BIT_1OR2+0xe", 1, - "11I0", "CLASS_BIT_1OR2+0xf", 1, - - "ssss", "CLASS_REG+(ARG_RS)", 1, - "dddd", "CLASS_REG+(ARG_RD)", 1, - "aaaa", "CLASS_REG+(ARG_RA)", 1, - "bbbb", "CLASS_REG+(ARG_RB)", 1, - "rrrr", "CLASS_REG+(ARG_RR)", 1, - - "ssN0", "CLASS_REGN0+(ARG_RS)", 1, - "ddN0", "CLASS_REGN0+(ARG_RD)", 1, - "aaN0", "CLASS_REGN0+(ARG_RA)", 1, - "bbN0", "CLASS_REGN0+(ARG_RB)", 1, - "rrN0", "CLASS_REGN0+(ARG_RR)", 1, - - "cccc", "CLASS_CC", 1, - "nnnn", "CLASS_IMM+(ARG_IMMN)", 1, - "xxxx", "CLASS_REG+(ARG_RX)", 1, - "xxN0", "CLASS_REGN0+(ARG_RX)", 1, - "nminus1", "CLASS_IMM+(ARG_IMMNMINUS1)", 1, - - "disp16", "CLASS_DISP+(ARG_DISP16)", 4, - "disp12", "CLASS_DISP+(ARG_DISP12)", 3, - "flags", "CLASS_FLAGS", 1, - "address_dst", "CLASS_ADDRESS+(ARG_DST)", 4, - "address_src", "CLASS_ADDRESS+(ARG_SRC)", 4, - "imm4m1", "CLASS_IMM+(ARG_IMM4M1)", 1, - "imm4", "CLASS_IMM+(ARG_IMM4)", 1, - - "imm8", "CLASS_IMM+(ARG_IMM8)", 2, - "imm16", "CLASS_IMM+(ARG_IMM16)", 4, - "imm32", "CLASS_IMM+(ARG_IMM32)", 8, - "nim8", "CLASS_IMM+(ARG_NIM8)", 2, - "0ccc", "CLASS_0CCC", 1, - "1ccc", "CLASS_1CCC", 1, - "disp8", "CLASS_DISP8", 2, - "0disp7", "CLASS_0DISP7", 2, - "1disp7", "CLASS_1DISP7", 2, - "01ii", "CLASS_01II", 1, - "00ii", "CLASS_00II", 1, - 0, 0 - -}; - -char * -translate (table, x, length) - struct tok_struct *table; - char *x; - int *length; -{ - - int found; - - found = 0; - while (table->match) - { - int l = strlen (table->match); - - if (strncmp (table->match, x, l) == 0) - { - /* Got a hit */ - printf ("%s", table->token); - *length += table->length; - return x + l; - } - - table++; - } - fprintf (stderr, "Can't find %s\n", x); - printf ("**** Can't find %s\n", x); - while (*x) - x++; - return x; -} - -void -chewbits (bits, length) - char *bits; - int *length; -{ - int n = 0; - - *length = 0; - printf ("{"); - while (*bits) - { - while (*bits == ' ') - { - bits++; - } - bits = translate (toks, bits, length); - n++; - printf (","); - - } - while (n < BYTE_INFO_LEN - 1) - { - printf ("0,"); - n++; - } - printf ("}"); -} - - -static -int -chewname (name) - char *name; -{ - char *n; - int nargs = 0; - - n = name; - printf ("\""); - while (*n && !iswhite (*n)) - { - printf ("%c", *n); - n++; - } - printf ("\","); /* Scan the operands and make entires for - them -remember indirect things */ - - n = name; - printf ("OPC_"); - while (*n && !iswhite (*n)) - { - printf ("%c", *n); - n++; - } - printf (",0,{"); - - while (*n) - { - int d; - - while (*n == ',' || iswhite (*n)) - n++; - nargs++; - n = translate (args, n, &d); - printf (","); - } - if (nargs == 0) - { - printf ("0"); - } - printf ("},"); - return nargs; -} - -static -void -sub (x, c) - char *x; - char c; -{ - while (*x) - { - if (x[0] == c && x[1] == c && - x[2] == c && x[3] == c) - { - x[2] = 'N'; - x[3] = '0'; - } - x++; - } -} - - -#if 0 -#define D(x) ((x) == '1' || (x) =='0') -#define M(y) (strncmp(y,x,4)==0) -printmangled (x) - char *x; -{ - return; - while (*x) - { - if (D (x[0]) && D (x[1]) && D (x[2]) && D (x[3])) - { - printf ("XXXX"); - } - else if (M ("ssss")) - { - printf ("ssss"); - } - else if (M ("dddd")) - { - printf ("dddd"); - } - else - printf ("____"); - - x += 4; - - if (x[0] == ' ') - { - printf ("_"); - x++; - } - } - -} - -#endif -/*#define WORK_TYPE*/ -void -print_type (n) - struct op *n; -{ -#ifdef WORK_TYPE - while (*s && !iswhite (*s)) - { - l = *s; - s++; - } - switch (l) - { - case 'l': - printf ("32,"); - break; - case 'b': - printf ("8,"); - break; - default: - printf ("16,"); - break; - } -#else - printf ("%2d,", n->type); -#endif -} - - -void -internal () -{ - int c = count (); - struct op *new = xmalloc (sizeof (struct op) * c); - struct op *p = opt; - memcpy (new, p, c * sizeof (struct op)); - - /* sort all names in table alphabetically */ - qsort (new, c, sizeof (struct op), func); - - p = new; - while (p->flags[0] != '*') - { - /* If there are any @rs, sub the ssss into a ssn0, - (rs), (ssn0) - */ - int loop = 1; - - printf ("\"%s\",%2d, ", p->flags, p->cycles); - while (loop) - { - char *s = p->name; - - loop = 0; - while (*s) - { - if (s[0] == '@') - { - char c; - - /* skip the r and sub the string */ - s++; - c = s[1]; - sub (p->bits, c); - } - if (s[0] == '(' && s[3] == ')') - { - sub (p->bits, s[2]); - } - if (s[0] == '(') - { - sub (p->bits, s[-1]); - } - - s++; - } - - } - print_type (p); - printf ("\"%s\",\"%s\",0,\n", p->bits, p->name); - p++; - } -} - -static -void -gas () -{ - int c = count (); - struct op *p = opt; - int idx = 0; - char *oldname = ""; - struct op *new = xmalloc (sizeof (struct op) * c); - - memcpy (new, p, c * sizeof (struct op)); - - /* sort all names in table alphabetically */ - qsort (new, c, sizeof (struct op), func); - - printf (" /* THIS FILE IS AUTOMAGICALLY GENERATED, DON'T EDIT IT */\n"); - - printf ("#define ARG_MASK 0x0f\n"); - - printf ("#define ARG_SRC 0x01\n"); - printf ("#define ARG_DST 0x02\n"); - - printf ("#define ARG_RS 0x01\n"); - printf ("#define ARG_RD 0x02\n"); - printf ("#define ARG_RA 0x03\n"); - printf ("#define ARG_RB 0x04\n"); - printf ("#define ARG_RR 0x05\n"); - printf ("#define ARG_RX 0x06\n"); - printf ("#define ARG_IMM4 0x01\n"); - printf ("#define ARG_IMM8 0x02\n"); - printf ("#define ARG_IMM16 0x03\n"); - printf ("#define ARG_IMM32 0x04\n"); - printf ("#define ARG_IMMN 0x05\n"); - printf ("#define ARG_IMMNMINUS1 0x05\n"); - printf ("#define ARG_IMM_1 0x06\n"); - printf ("#define ARG_IMM_2 0x07\n"); - printf ("#define ARG_DISP16 0x08\n"); - printf ("#define ARG_NIM8 0x09\n"); - printf ("#define ARG_IMM2 0x0a\n"); - printf ("#define ARG_IMM1OR2 0x0b\n"); - - printf ("#define ARG_DISP12 0x0b\n"); - printf ("#define ARG_DISP8 0x0c\n"); - printf ("#define ARG_IMM4M1 0x0d\n"); - printf ("#define CLASS_MASK 0x1fff0\n"); - printf ("#define CLASS_X 0x10\n"); - printf ("#define CLASS_BA 0x20\n"); - printf ("#define CLASS_DA 0x30\n"); - printf ("#define CLASS_BX 0x40\n"); - printf ("#define CLASS_DISP 0x50\n"); - printf ("#define CLASS_IMM 0x60\n"); - printf ("#define CLASS_CC 0x70\n"); - printf ("#define CLASS_CTRL 0x80\n"); - printf ("#define CLASS_ADDRESS 0xd0\n"); - printf ("#define CLASS_0CCC 0xe0\n"); - printf ("#define CLASS_1CCC 0xf0\n"); - printf ("#define CLASS_0DISP7 0x100\n"); - printf ("#define CLASS_1DISP7 0x200\n"); - printf ("#define CLASS_01II 0x300\n"); - printf ("#define CLASS_00II 0x400\n"); - printf ("#define CLASS_BIT 0x500\n"); - printf ("#define CLASS_FLAGS 0x600\n"); - printf ("#define CLASS_IR 0x700\n"); - printf ("#define CLASS_DISP8 0x800\n"); - - printf ("#define CLASS_BIT_1OR2 0x900\n"); - printf ("#define CLASS_REG 0x7000\n"); - printf ("#define CLASS_REG_BYTE 0x2000\n"); - printf ("#define CLASS_REG_WORD 0x3000\n"); - printf ("#define CLASS_REG_QUAD 0x4000\n"); - printf ("#define CLASS_REG_LONG 0x5000\n"); - printf ("#define CLASS_REGN0 0x8000\n"); - printf ("#define CLASS_PR 0x10000\n"); - - printf ("#define OPC_adc 0\n"); - printf ("#define OPC_adcb 1\n"); - printf ("#define OPC_add 2\n"); - printf ("#define OPC_addb 3\n"); - printf ("#define OPC_addl 4\n"); - printf ("#define OPC_and 5\n"); - printf ("#define OPC_andb 6\n"); - printf ("#define OPC_bit 7\n"); - printf ("#define OPC_bitb 8\n"); - printf ("#define OPC_call 9\n"); - printf ("#define OPC_calr 10\n"); - printf ("#define OPC_clr 11\n"); - printf ("#define OPC_clrb 12\n"); - printf ("#define OPC_com 13\n"); - printf ("#define OPC_comb 14\n"); - printf ("#define OPC_comflg 15\n"); - printf ("#define OPC_cp 16\n"); - printf ("#define OPC_cpb 17\n"); - printf ("#define OPC_cpd 18\n"); - printf ("#define OPC_cpdb 19\n"); - printf ("#define OPC_cpdr 20\n"); - printf ("#define OPC_cpdrb 21\n"); - printf ("#define OPC_cpi 22\n"); - printf ("#define OPC_cpib 23\n"); - printf ("#define OPC_cpir 24\n"); - printf ("#define OPC_cpirb 25\n"); - printf ("#define OPC_cpl 26\n"); - printf ("#define OPC_cpsd 27\n"); - printf ("#define OPC_cpsdb 28\n"); - printf ("#define OPC_cpsdr 29\n"); - printf ("#define OPC_cpsdrb 30\n"); - printf ("#define OPC_cpsi 31\n"); - printf ("#define OPC_cpsib 32\n"); - printf ("#define OPC_cpsir 33\n"); - printf ("#define OPC_cpsirb 34\n"); - printf ("#define OPC_dab 35\n"); - printf ("#define OPC_dbjnz 36\n"); - printf ("#define OPC_dec 37\n"); - printf ("#define OPC_decb 38\n"); - printf ("#define OPC_di 39\n"); - printf ("#define OPC_div 40\n"); - printf ("#define OPC_divl 41\n"); - printf ("#define OPC_djnz 42\n"); - printf ("#define OPC_ei 43\n"); - printf ("#define OPC_ex 44\n"); - printf ("#define OPC_exb 45\n"); - printf ("#define OPC_exts 46\n"); - printf ("#define OPC_extsb 47\n"); - printf ("#define OPC_extsl 48\n"); - printf ("#define OPC_halt 49\n"); - printf ("#define OPC_in 50\n"); - printf ("#define OPC_inb 51\n"); - printf ("#define OPC_inc 52\n"); - printf ("#define OPC_incb 53\n"); - printf ("#define OPC_ind 54\n"); - printf ("#define OPC_indb 55\n"); - printf ("#define OPC_inib 56\n"); - printf ("#define OPC_inibr 57\n"); - printf ("#define OPC_iret 58\n"); - printf ("#define OPC_jp 59\n"); - printf ("#define OPC_jr 60\n"); - printf ("#define OPC_ld 61\n"); - printf ("#define OPC_lda 62\n"); - printf ("#define OPC_ldar 63\n"); - printf ("#define OPC_ldb 64\n"); - printf ("#define OPC_ldctl 65\n"); - printf ("#define OPC_ldir 66\n"); - printf ("#define OPC_ldirb 67\n"); - printf ("#define OPC_ldk 68\n"); - printf ("#define OPC_ldl 69\n"); - printf ("#define OPC_ldm 70\n"); - printf ("#define OPC_ldps 71\n"); - printf ("#define OPC_ldr 72\n"); - printf ("#define OPC_ldrb 73\n"); - printf ("#define OPC_ldrl 74\n"); - printf ("#define OPC_mbit 75\n"); - printf ("#define OPC_mreq 76\n"); - printf ("#define OPC_mres 77\n"); - printf ("#define OPC_mset 78\n"); - printf ("#define OPC_mult 79\n"); - printf ("#define OPC_multl 80\n"); - printf ("#define OPC_neg 81\n"); - printf ("#define OPC_negb 82\n"); - printf ("#define OPC_nop 83\n"); - printf ("#define OPC_or 84\n"); - printf ("#define OPC_orb 85\n"); - printf ("#define OPC_out 86\n"); - printf ("#define OPC_outb 87\n"); - printf ("#define OPC_outd 88\n"); - printf ("#define OPC_outdb 89\n"); - printf ("#define OPC_outib 90\n"); - printf ("#define OPC_outibr 91\n"); - printf ("#define OPC_pop 92\n"); - printf ("#define OPC_popl 93\n"); - printf ("#define OPC_push 94\n"); - printf ("#define OPC_pushl 95\n"); - printf ("#define OPC_res 96\n"); - printf ("#define OPC_resb 97\n"); - printf ("#define OPC_resflg 98\n"); - printf ("#define OPC_ret 99\n"); - printf ("#define OPC_rl 100\n"); - printf ("#define OPC_rlb 101\n"); - printf ("#define OPC_rlc 102\n"); - printf ("#define OPC_rlcb 103\n"); - printf ("#define OPC_rldb 104\n"); - printf ("#define OPC_rr 105\n"); - printf ("#define OPC_rrb 106\n"); - printf ("#define OPC_rrc 107\n"); - printf ("#define OPC_rrcb 108\n"); - printf ("#define OPC_rrdb 109\n"); - printf ("#define OPC_sbc 110\n"); - printf ("#define OPC_sbcb 111\n"); - printf ("#define OPC_sda 112\n"); - printf ("#define OPC_sdab 113\n"); - printf ("#define OPC_sdal 114\n"); - printf ("#define OPC_sdl 115\n"); - printf ("#define OPC_sdlb 116\n"); - printf ("#define OPC_sdll 117\n"); - printf ("#define OPC_set 118\n"); - printf ("#define OPC_setb 119\n"); - printf ("#define OPC_setflg 120\n"); - printf ("#define OPC_sinb 121\n"); - printf ("#define OPC_sind 122\n"); - printf ("#define OPC_sindb 123\n"); - printf ("#define OPC_sinib 124\n"); - printf ("#define OPC_sinibr 125\n"); - printf ("#define OPC_sla 126\n"); - printf ("#define OPC_slab 127\n"); - printf ("#define OPC_slal 128\n"); - printf ("#define OPC_sll 129\n"); - printf ("#define OPC_sllb 130\n"); - printf ("#define OPC_slll 131\n"); - printf ("#define OPC_sout 132\n"); - printf ("#define OPC_soutb 133\n"); - printf ("#define OPC_soutd 134\n"); - printf ("#define OPC_soutdb 135\n"); - printf ("#define OPC_soutib 136\n"); - printf ("#define OPC_soutibr 137\n"); - printf ("#define OPC_sra 138\n"); - printf ("#define OPC_srab 139\n"); - printf ("#define OPC_sral 140\n"); - printf ("#define OPC_srl 141\n"); - printf ("#define OPC_srlb 142\n"); - printf ("#define OPC_srll 143\n"); - printf ("#define OPC_sub 144\n"); - printf ("#define OPC_subb 145\n"); - printf ("#define OPC_subl 146\n"); - printf ("#define OPC_tcc 147\n"); - printf ("#define OPC_tccb 148\n"); - printf ("#define OPC_test 149\n"); - printf ("#define OPC_testb 150\n"); - printf ("#define OPC_testl 151\n"); - printf ("#define OPC_trdb 152\n"); - printf ("#define OPC_trdrb 153\n"); - printf ("#define OPC_trib 154\n"); - printf ("#define OPC_trirb 155\n"); - printf ("#define OPC_trtdrb 156\n"); - printf ("#define OPC_trtib 157\n"); - printf ("#define OPC_trtirb 158\n"); - printf ("#define OPC_trtrb 159\n"); - printf ("#define OPC_tset 160\n"); - printf ("#define OPC_tsetb 161\n"); - printf ("#define OPC_xor 162\n"); - printf ("#define OPC_xorb 163\n"); - - printf ("#define OPC_ldd 164 \n"); - printf ("#define OPC_lddb 165 \n"); - printf ("#define OPC_lddr 166 \n"); - printf ("#define OPC_lddrb 167 \n"); - printf ("#define OPC_ldi 168 \n"); - printf ("#define OPC_ldib 169 \n"); - printf ("#define OPC_sc 170\n"); - printf ("#define OPC_bpt 171\n"); - printf ("#define OPC_ext0e 172\n"); - printf ("#define OPC_ext0f 172\n"); - printf ("#define OPC_ext8e 172\n"); - printf ("#define OPC_ext8f 172\n"); - printf ("#define OPC_rsvd36 172\n"); - printf ("#define OPC_rsvd38 172\n"); - printf ("#define OPC_rsvd78 172\n"); - printf ("#define OPC_rsvd7e 172\n"); - printf ("#define OPC_rsvd9d 172\n"); - printf ("#define OPC_rsvd9f 172\n"); - printf ("#define OPC_rsvdb9 172\n"); - printf ("#define OPC_rsvdbf 172\n"); -#if 0 - for (i = 0; toks[i].token; i++) - printf ("#define %s\t0x%x\n", toks[i].token, i * 16); -#endif - printf ("typedef struct {\n"); - - printf ("#ifdef NICENAMES\n"); - printf ("char *nicename;\n"); - printf ("int type;\n"); - printf ("int cycles;\n"); - printf ("int flags;\n"); - printf ("#endif\n"); - printf ("char *name;\n"); - printf ("unsigned char opcode;\n"); - printf ("void (*func)();\n"); - printf ("unsigned int arg_info[4];\n"); - printf ("unsigned int byte_info[%d];\n", BYTE_INFO_LEN); - printf ("int noperands;\n"); - printf ("int length;\n"); - printf ("int idx;\n"); - printf ("} opcode_entry_type;\n"); - printf ("#ifdef DEFINE_TABLE\n"); - printf ("opcode_entry_type z8k_table[] = {\n"); - - while (new->flags && new->flags[0]) - { - int nargs; - int length; - - printf ("\n\n/* %s *** %s */\n", new->bits, new->name); - printf ("{\n"); - - printf ("#ifdef NICENAMES\n"); - printf ("\"%s\",%d,%d,\n", new->name, new->type, new->cycles); - { - int answer = 0; - char *p = new->flags; - - while (*p) - { - answer <<= 1; - - if (*p != '-') - answer |= 1; - p++; - } - printf ("0x%02x,\n", answer); - } - - printf ("#endif\n"); - - nargs = chewname (new->name); - - printf ("\n\t"); - chewbits (new->bits, &length); - length /= 2; - if (length & 1) - abort(); - - printf (",%d,%d,%d", nargs, length, idx); - idx++; - oldname = new->name; - printf ("},\n"); - new++; - } - printf ("0,0};\n"); - printf ("#endif\n"); -} - - -int -main (ac, av) - int ac; - char **av; -{ - struct op *p = opt; - - if (ac == 2 && strcmp (av[1], "-t") == 0) - { - internal (); - } - else if (ac == 2 && strcmp (av[1], "-h") == 0) - { - while (p->name) - { - printf ("%-25s\t%s\n", p->name, p->bits); - p++; - } - } - - else if (ac == 2 && strcmp (av[1], "-a") == 0) - { - gas (); - } - else if (ac == 2 && strcmp (av[1], "-d") == 0) - { - /*dis();*/ - } - else - { - printf ("Usage: %s -t\n", av[0]); - printf ("-t : generate new z8.c internal table\n"); - printf ("-a : generate new table for gas\n"); - printf ("-d : generate new table for disassemble\n"); - printf ("-h : generate new table for humans\n"); - } -return 0; -} |