summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2002-12-02 09:14:25 +0000
committerobrien <obrien@FreeBSD.org>2002-12-02 09:14:25 +0000
commitde862b42e96a0599ff796b3272498dabd1ecb530 (patch)
treeb14548779fa59ecad702a3f7790d070a86856ac0 /contrib
parent225c3b110193aa0853fcc74fb69ddc504972f91f (diff)
downloadFreeBSD-src-de862b42e96a0599ff796b3272498dabd1ecb530.zip
FreeBSD-src-de862b42e96a0599ff796b3272498dabd1ecb530.tar.gz
GC some stuff I thought was long gone.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/binutils/bfd/aout-tic30.c1098
-rw-r--r--contrib/binutils/bfd/coff-mips.c2736
-rw-r--r--contrib/binutils/bfd/coff-tic30.c210
-rw-r--r--contrib/binutils/bfd/coff-z8k.c338
-rw-r--r--contrib/binutils/bfd/cpu-mips.c120
-rw-r--r--contrib/binutils/bfd/cpu-tic30.c39
-rw-r--r--contrib/binutils/bfd/cpu-v850.c100
-rw-r--r--contrib/binutils/bfd/cpu-z8k.c193
-rw-r--r--contrib/binutils/bfd/elf32-mips.c10405
-rw-r--r--contrib/binutils/bfd/elf32-v850.c2220
-rw-r--r--contrib/binutils/bfd/elf64-mips.c7092
-rw-r--r--contrib/binutils/bfd/mipsbsd.c487
-rw-r--r--contrib/binutils/bfd/pe-mips.c998
-rw-r--r--contrib/binutils/binutils/rcparse.c3447
-rw-r--r--contrib/binutils/binutils/rcparse.h134
-rw-r--r--contrib/binutils/gas/config/tc-tic30.c1881
-rw-r--r--contrib/binutils/gas/config/tc-tic30.h55
-rw-r--r--contrib/binutils/gas/config/tc-v850.c2434
-rw-r--r--contrib/binutils/gas/config/tc-v850.h98
-rw-r--r--contrib/binutils/gas/config/tc-z8k.c1566
-rw-r--r--contrib/binutils/gas/config/tc-z8k.h53
-rw-r--r--contrib/binutils/gas/doc/c-v850.texi363
-rw-r--r--contrib/binutils/gas/doc/c-z8k.texi380
-rw-r--r--contrib/binutils/include/opcode/mips.h789
-rw-r--r--contrib/binutils/include/opcode/tic30.h691
-rw-r--r--contrib/binutils/include/opcode/v850.h165
-rwxr-xr-xcontrib/binutils/ld/emulparams/shelf.sh32
-rw-r--r--contrib/binutils/ld/emulparams/shelf_linux.sh2
-rwxr-xr-xcontrib/binutils/ld/emulparams/tic30aout.sh7
-rwxr-xr-xcontrib/binutils/ld/emulparams/tic30coff.sh7
-rw-r--r--contrib/binutils/ld/emulparams/v850.sh14
-rw-r--r--contrib/binutils/ld/emulparams/z8001.sh7
-rw-r--r--contrib/binutils/ld/emulparams/z8002.sh6
-rw-r--r--contrib/binutils/ld/scripttempl/tic30aout.sc34
-rw-r--r--contrib/binutils/ld/scripttempl/tic30coff.sc58
-rw-r--r--contrib/binutils/ld/scripttempl/v850.sc230
-rw-r--r--contrib/binutils/ld/scripttempl/z8000.sc57
-rw-r--r--contrib/binutils/opcodes/tic30-dis.c710
-rw-r--r--contrib/binutils/opcodes/v850-dis.c384
-rw-r--r--contrib/binutils/opcodes/v850-opc.c813
-rw-r--r--contrib/binutils/opcodes/z8k-dis.c587
-rw-r--r--contrib/binutils/opcodes/z8k-opc.h4479
-rw-r--r--contrib/binutils/opcodes/z8kgen.c1325
43 files changed, 0 insertions, 46844 deletions
diff --git a/contrib/binutils/bfd/aout-tic30.c b/contrib/binutils/bfd/aout-tic30.c
deleted file mode 100644
index a39a5b1..0000000
--- a/contrib/binutils/bfd/aout-tic30.c
+++ /dev/null
@@ -1,1098 +0,0 @@
-/* BFD back-end for TMS320C30 a.out binaries.
- Copyright 1998, 1999, 2000, 2001, 2002 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
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (tic30_aout_,OP)
-#define TARGETNAME "a.out-tic30"
-#define NAME(x,y) CONCAT3 (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 *));
-static const bfd_target * tic30_aout_callback PARAMS ((bfd *));
-static boolean MY_bfd_copy_private_section_data
- PARAMS ((bfd *, asection *, bfd *, asection *));
-static boolean MY_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *));
-reloc_howto_type * tic30_aout_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-enum machine_type tic30_aout_machine_type
- PARAMS ((enum bfd_architecture, unsigned long, boolean *));
-boolean tic30_aout_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-
-#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)
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-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, 0L);
-#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)
- != ((bfd_vma) -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;
- bfd_size_type amt = EXEC_BYTES_SIZE;
-
- if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
- {
- 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 = 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)
- {
- bfd_size_type amt;
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- return false;
- amt = adata (abfd).exec_bytes_size;
- if (bfd_bwrite ((PTR) &exec_bytes, amt, abfd) != amt)
- 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_merge_sections
-#define MY_bfd_merge_sections bfd_generic_merge_sections
-#endif
-#ifndef MY_bfd_discard_group
-#define MY_bfd_discard_group bfd_generic_discard_group
-#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_hash_table_free
-#define MY_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-#endif
-#ifndef MY_bfd_link_add_symbols
-#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols)
-#endif
-#ifndef MY_bfd_link_just_syms
-#define MY_bfd_link_just_syms _bfd_generic_link_just_syms
-#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 672b07f..0000000
--- a/contrib/binutils/bfd/coff-mips.c
+++ /dev/null
@@ -1,2736 +0,0 @@
-/* BFD back-end for MIPS Extended-Coff files.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001
- 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 an 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 = H_GET_32 (abfd, 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;
- }
-
- H_PUT_32 (abfd, intern->r_vaddr, 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 ((bfd_size_type) 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 &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff);
- bfd_put_32 (abfd, (bfd_vma) 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 &~ (unsigned) 0xffff) | (val & 0xffff);
- bfd_put_32 (abfd, (bfd_vma) 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 ((long) val >= 0x8000 || (long) val < -0x8000)
- 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 ((bfd_size_type) 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 &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff);
- bfd_put_32 (abfd, (bfd_vma) 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. */
-
-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_GPREL16:
- 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 &~ (unsigned) 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_size_type amt;
-
- 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)
- {
- amt = NUM_RELOC_SECTIONS * sizeof (asection *);
- symndx_to_section = (asection **) bfd_alloc (input_bfd, amt);
- 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 used 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;
- bfd_size_type amt;
-
- section_tdata = ecoff_section_data (abfd, sec);
- if (section_tdata == (struct ecoff_section_tdata *) NULL)
- {
- amt = sizeof (struct ecoff_section_tdata);
- sec->used_by_bfd = (PTR) bfd_alloc (abfd, amt);
- 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)
- {
- amt = ecoff_backend (abfd)->external_reloc_size;
- amt *= sec->reloc_count;
- section_tdata->external_relocs = (PTR) bfd_alloc (abfd, amt);
- if (section_tdata->external_relocs == NULL && amt != 0)
- return false;
-
- if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0
- || bfd_bread (section_tdata->external_relocs, amt, abfd) != amt)
- 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;
- bfd_size_type amt;
-
- /* 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 (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)
- {
- bfd_size_type size;
-
- size = (bfd_size_type) sec->reloc_count * sizeof (long);
- offsets = (long *) bfd_alloc (abfd, size);
- if (offsets == (long *) NULL)
- goto error_return;
- memset (offsets, 0, (size_t) 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. */
- amt = sizeof (struct ecoff_value_adjust);
- adjust = (struct ecoff_value_adjust *) bfd_alloc (abfd, amt);
- 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, (bfd_vma) 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,
- (bfd_vma) 0x003f0821, location + 12); /* addu $at,$at,$ra */
- bfd_put_32 (input_bfd,
- (bfd_vma) 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_size_type amt;
-
- 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;
-
- amt = (bfd_size_type) datasec->reloc_count * 4;
- relsec->contents = (bfd_byte *) bfd_alloc (abfd, amt);
- 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, false, 2,
- 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
-
-/* Merging of sections is not done. */
-#define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_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-tic30.c b/contrib/binutils/bfd/coff-tic30.c
deleted file mode 100644
index a3bbc4c..0000000
--- a/contrib/binutils/bfd/coff-tic30.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/* BFD back-end for TMS320C30 coff binaries.
- Copyright 1998, 1999, 2000, 2001 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"
-
-static int coff_tic30_select_reloc PARAMS ((reloc_howto_type *));
-static void rtype2howto PARAMS ((arelent *, struct internal_reloc *));
-static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *));
-
-reloc_howto_type * tic30_coff_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-#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 H_GET_32
-#define SWAP_OUT_RELOC_OFFSET 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 c626cd7..0000000
--- a/contrib/binutils/bfd/coff-z8k.c
+++ /dev/null
@@ -1,338 +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"
-
-static void extra_case PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, bfd_byte *, unsigned int *, unsigned int *));
-static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *));
-static void rtype2howto PARAMS ((arelent *, struct internal_reloc *));
-static int coff_z8k_select_reloc PARAMS ((reloc_howto_type *));
-
-#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1)
-
-static reloc_howto_type r_imm32 =
-HOWTO (R_IMM32, 0, 2, 32, false, 0,
- complain_overflow_bitfield, 0, "r_imm32", true, 0xffffffff,
- 0xffffffff, false);
-
-static reloc_howto_type r_imm4l =
-HOWTO (R_IMM4L, 0, 0, 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, 0, 8, false, 0,
- complain_overflow_bitfield, 0, "r_imm8", true, 0x000000ff, 0x000000ff,
- false);
-
-static reloc_howto_type r_rel16 =
-HOWTO (R_REL16, 0, 1, 16, false, 0,
- complain_overflow_bitfield, 0, "r_rel16", true, 0x0000ffff, 0x0000ffff,
- true);
-
-static reloc_howto_type r_jr =
-HOWTO (R_JR, 0, 0, 8, true, 0, complain_overflow_signed, 0,
- "r_jr", true, 0, 0, true);
-
-static reloc_howto_type r_disp7 =
-HOWTO (R_DISP7, 0, 0, 7, true, 0, complain_overflow_bitfield, 0,
- "r_disp7", true, 0, 0, true);
-
-static reloc_howto_type r_callr =
-HOWTO (R_CALLR, 0, 1, 12, true, 0, complain_overflow_signed, 0,
- "r_callr", true, 0xfff, 0xfff, 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 H_GET_32
-#define SWAP_OUT_RELOC_OFFSET 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_DISP7:
- internal->howto = &r_disp7;
- break;
- case R_CALLR:
- internal->howto = &r_callr;
- break;
- case R_REL16:
- internal->howto = &r_rel16;
- 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,
- /* 0x80000000 indicates a long segmented address. */
- bfd_coff_reloc16_get_value (reloc, link_info, input_section) | 0x80000000,
- 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 we're 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;
- }
-
- case R_DISP7:
- {
- 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 we're in the odd byte of the
- word and the pc's been incremented. */
-
- if (gap & 1)
- abort ();
- gap /= 2;
-
- if (gap > 0 || 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,
- (bfd_get_8 ( in_abfd, data + *dst_ptr) & 0x80) + (-gap & 0x7f),
- data + *dst_ptr);
- (*dst_ptr)++;
- (*src_ptr)++;
- break;
- }
-
- case R_CALLR:
- {
- 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 - 2;
-
- if (gap & 1)
- abort ();
- gap /= 2;
- if (gap > 8191 || gap < -8192)
- {
- 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_16 (in_abfd,
- (bfd_get_16 ( in_abfd, data + *dst_ptr) & 0xf000) | (-gap & 0x0fff),
- data + *dst_ptr);
- (*dst_ptr) += 2;
- (*src_ptr) += 2;
- break;
- }
-
- case R_REL16:
- {
- 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 - 2;
-
- if (gap > 32767 || gap < -32768)
- {
- 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_16 (in_abfd, (bfd_vma) gap, data + *dst_ptr);
- (*dst_ptr) += 2;
- (*src_ptr) += 2;
- 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 d54b0a5..0000000
--- a/contrib/binutils/bfd/cpu-mips.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/* bfd back-end for mips support
- Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002
- 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"
-
-static const bfd_arch_info_type *mips_compatible
- PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
-
-/* The default routine tests bits_per_word, which is wrong on mips as
- mips word size doesn't correlate with reloc size. */
-
-static const bfd_arch_info_type *
-mips_compatible (a, b)
- const bfd_arch_info_type *a;
- const bfd_arch_info_type *b;
-{
- if (a->arch != b->arch)
- return NULL;
-
- if (a->mach > b->mach)
- return a;
-
- if (b->mach > a->mach)
- return b;
-
- return a;
-}
-
-#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, \
- mips_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_mips12000,
- I_mips16,
- I_mips5,
- I_mipsisa32,
- I_mipsisa64,
- I_sb1,
-};
-
-#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_mips12000,"mips:12000", false, NN(I_mips12000)),
- N (64, 64, bfd_mach_mips16, "mips:16", false, NN(I_mips16)),
- N (64, 64, bfd_mach_mips5, "mips:mips5", false, NN(I_mips5)),
- N (32, 32, bfd_mach_mipsisa32, "mips:isa32", false, NN(I_mipsisa32)),
- N (64, 64, bfd_mach_mipsisa64, "mips:isa64", false, NN(I_mipsisa64)),
- N (64, 64, bfd_mach_mips_sb1, "mips:sb1", 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-tic30.c b/contrib/binutils/bfd/cpu-tic30.c
deleted file mode 100644
index dd723f7..0000000
--- 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 8836362..0000000
--- a/contrib/binutils/bfd/cpu-v850.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* BFD support for the NEC V850 processor
- Copyright 1996, 1997, 1998, 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. */
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "safe-ctype.h"
-
-static boolean scan PARAMS ((const struct bfd_arch_info *, const char *));
-
-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;
- if there is a colon present skip it. */
- 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 (*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 0afdfc7..0000000
--- a/contrib/binutils/bfd/cpu-z8k.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/* BFD library support routines for the Z800n architecture.
- Copyright 1992, 1993, 1994, 2000, 2001 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
- PARAMS ((const struct bfd_arch_info *, const char *));
-static const bfd_arch_info_type *compatible
- PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
-
-#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
-
-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/elf32-mips.c b/contrib/binutils/bfd/elf32-mips.c
deleted file mode 100644
index ddfe4a0..0000000
--- a/contrib/binutils/bfd/elf32-mips.c
+++ /dev/null
@@ -1,10405 +0,0 @@
-/* MIPS-specific support for 32-bit ELF
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
- 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>
- Traditional MIPS targets support added by Koundinya.K, Dansk Data
- Elektronik & Operations Research Group. <kk@ddeorg.soft.net>
-
-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_SIGNED_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;
-
- /* If the R_MIPS_32, R_MIPS_REL32, or R_MIPS_64 reloc is against
- a readonly section. */
- boolean readonly_reloc;
-
- /* The index of the first dynamic relocation (in the .rel.dyn
- section) against this symbol. */
- unsigned int min_dyn_reloc_index;
-
- /* We must not create a stub for a symbol that has relocations
- related to taking the function's address, i.e. any but
- R_MIPS_CALL*16 ones -- see "MIPS ABI Supplement, 3rd Edition",
- p. 4-20. */
- boolean no_fn_stub;
-
- /* 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;
-
- /* Are we forced local? .*/
- boolean forced_local;
-};
-
-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 unsigned long 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 **, boolean));
-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, boolean));
-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 *));
-static int sort_dynamic_relocs
- PARAMS ((const void *, const void *));
-static void _bfd_mips_elf_hide_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
-static void _bfd_mips_elf_copy_indirect_symbol
- PARAMS ((struct elf_link_hash_entry *,
- struct elf_link_hash_entry *));
-static boolean _bfd_elf32_mips_grok_prstatus
- PARAMS ((bfd *, Elf_Internal_Note *));
-static boolean _bfd_elf32_mips_grok_psinfo
- PARAMS ((bfd *, Elf_Internal_Note *));
-static boolean _bfd_elf32_mips_discard_info
- PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *));
-static boolean _bfd_elf32_mips_ignore_discarded_relocs
- PARAMS ((asection *));
-static boolean _bfd_elf32_mips_write_section
- PARAMS ((bfd *, asection *, bfd_byte *));
-
-extern const bfd_target bfd_elf32_tradbigmips_vec;
-extern const bfd_target bfd_elf32_tradlittlemips_vec;
-#ifdef BFD64
-extern const bfd_target bfd_elf64_tradbigmips_vec;
-extern const bfd_target bfd_elf64_tradlittlemips_vec;
-#endif
-
-/* The level of IRIX compatibility we're striving for. */
-
-typedef enum {
- ict_none,
- ict_irix5,
- ict_irix6
-} irix_compat_t;
-
-/* This will be used when we sort the dynamic relocation records. */
-static bfd *reldyn_sorting_bfd;
-
-/* 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. */
-#define ABI_64_P(abfd) \
- ((elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64) != 0)
-
-/* Depending on the target vector we generate some version of Irix
- executables or "normal" MIPS ELF ABI executables. */
-#ifdef BFD64
-#define IRIX_COMPAT(abfd) \
- (((abfd->xvec == &bfd_elf64_tradbigmips_vec) || \
- (abfd->xvec == &bfd_elf64_tradlittlemips_vec) || \
- (abfd->xvec == &bfd_elf32_tradbigmips_vec) || \
- (abfd->xvec == &bfd_elf32_tradlittlemips_vec)) ? ict_none : \
- ((ABI_N32_P (abfd) || ABI_64_P (abfd)) ? ict_irix6 : ict_irix5))
-#else
-#define IRIX_COMPAT(abfd) \
- (((abfd->xvec == &bfd_elf32_tradbigmips_vec) || \
- (abfd->xvec == &bfd_elf32_tradlittlemips_vec)) ? ict_none : \
- ((ABI_N32_P (abfd) || ABI_64_P (abfd)) ? ict_irix6 : ict_irix5))
-#endif
-
-#define NEWABI_P(abfd) (ABI_N32_P(abfd) || ABI_64_P(abfd))
-
-/* 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, (bfd_vma) tag, (bfd_vma) val) \
- : bfd_elf32_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) val))
-#else
-#define MIPS_ELF_ADD_DYNAMIC_ENTRY(info, tag, val) \
- (ABI_64_P (elf_hash_table (info)->dynobj) \
- ? (boolean) (abort (), false) \
- : bfd_elf32_add_dynamic_entry (info, (bfd_vma) tag, (bfd_vma) 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) */ \
- : 0x8f998010) /* lw t9,0x8000(gp) */
-#define STUB_MOVE(abfd) \
- (SGI_COMPAT (abfd) ? 0x03e07825 : 0x03e07821) /* move t7,ra */
-#define STUB_JALR 0x0320f809 /* jal t9 */
-#define STUB_LI16(abfd) \
- (SGI_COMPAT (abfd) ? 0x34180000 : 0x24180000) /* 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 *));
-
-/* 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 relocation table used for SHT_REL sections. */
-
-static reloc_howto_type elf_mips_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 */
- 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_16", /* name */
- true, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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_dont, /* 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_dont, /* 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 jump 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 + 4. */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_26", /* name */
- true, /* partial_inplace */
- 0x03ffffff, /* src_mask */
- 0x03ffffff, /* 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 */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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 */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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 */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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 */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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 */
- true, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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 */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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 */
- true, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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_dont, /* 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_dont, /* 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_signed, /* 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_signed, /* 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_signed, /* 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_dont, /* 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 */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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 */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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 */
- true, /* 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 */
- 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_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 elf_mips_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 */
- 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_16", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000, /* 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_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_32", /* name */
- false, /* 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_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_REL32", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* 26 bit jump 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 36
- bits must match the PC + 4. */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_26", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x03ffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* R_MIPS_HI16 and R_MIPS_LO16 are unsupported for 64 bit REL. */
- /* 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 */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* 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 */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* 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 */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* 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 */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* 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 */
- 0x0000ffff, /* 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 */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- true), /* 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 */
- 0x0000ffff, /* 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_dont, /* complain_on_overflow */
- _bfd_mips_elf_gprel32_reloc, /* special_function */
- "R_MIPS_GPREL32", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- 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 */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x000007c0, /* dst_mask */
- false), /* pcrel_offset */
-
- /* A 6 bit shift field. */
- /* FIXME: Not handled correctly. */
- 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 */
- false, /* 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_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_64", /* name */
- false, /* 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_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_DISP", /* name */
- false, /* 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_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_PAGE", /* name */
- false, /* 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_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_OFST", /* name */
- false, /* 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 */
- false, /* 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 */
- false, /* 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_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_SUB", /* name */
- false, /* 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 */
- 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_INSERT_A", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* 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 */
- 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_INSERT_B", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* Delete a 32 bit instruction. */
- /* FIXME: Not handled correctly. */
- HOWTO (R_MIPS_DELETE, /* 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_DELETE", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* 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 */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* 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 */
- false, /* 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_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 */
- false, /* 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 */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* Section displacement, used by an associated event location section. */
- /* FIXME: Not handled correctly. */
- 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 */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- HOWTO (R_MIPS_REL16, /* type */
- 0, /* rightshift */
- 1, /* 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_REL16", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* These two are obsolete. */
- EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
- EMPTY_HOWTO (R_MIPS_PJUMP),
-
- /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
- It must be used for multigot GOT's (and only there). */
- HOWTO (R_MIPS_RELGOT, /* 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_RELGOT", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* 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 */
- 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_JALR", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* 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, for non-pc-relative relocations, 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.
-
- This cannot be done for PC-relative relocations because both the HI16
- and LO16 parts of the relocations must be done relative to the LO16
- part, and there can be carry to or borrow from the HI16 part. */
-
-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 ((bfd_size_type) 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);
-
- /* The low order 16 bits are always treated as a signed
- value. */
- vallo = ((vallo & 0xffff) ^ 0x8000) - 0x8000;
- val = ((insn & 0xffff) << 16) + vallo;
- val += l->addend;
-
- /* If PC-relative, we need to subtract out the address of the LO
- half of the HI/LO. (The actual relocation is relative
- to that instruction.) */
- if (reloc_entry->howto->pc_relative)
- val -= reloc_entry->address;
-
- /* At this point, "val" has the value of the combined HI/LO
- pair. If the low order 16 bits (which will be used for
- the LO16 insn) are negative, then we will need an
- adjustment for the high order 16 bits. */
- val += 0x8000;
- val = (val >> 16) & 0xffff;
-
- insn &= ~ (bfd_vma) 0xffff;
- insn |= val;
- bfd_put_32 (abfd, (bfd_vma) 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 ((long) val >= 0x8000 || (long) val < -0x8000)
- 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, (bfd_vma) 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 addresses are 64 bits. The upper 32 bits are a simple
- 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_rel[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, (bfd_vma) 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,
- (bfd_vma) (((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,
- (bfd_vma) ((extend & 0xf800)
- | ((final >> 11) & 0x1f)
- | (final & 0x7e0)),
- (bfd_byte *) data + reloc_entry->address);
- bfd_put_16 (abfd,
- (bfd_vma) ((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;
- case E_MIPS_ARCH_5:
- return 5;
- case E_MIPS_ARCH_32:
- return 32;
- case E_MIPS_ARCH_64:
- return 64;
- }
- return 4;
-}
-
-/* Return the MACH for a MIPS e_flags value. */
-
-static INLINE unsigned long
-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;
-
- case E_MIPS_MACH_SB1:
- return bfd_mach_mips_sb1;
-
- 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;
-
- case E_MIPS_ARCH_5:
- return bfd_mach_mips5;
- break;
-
- case E_MIPS_ARCH_32:
- return bfd_mach_mipsisa32;
- break;
-
- case E_MIPS_ARCH_64:
- return bfd_mach_mipsisa64;
- break;
- }
- }
-
- return 0;
-}
-
-/* Return printable name for ABI. */
-
-static INLINE char *
-elf_mips_abi_name (abfd)
- bfd *abfd;
-{
- flagword flags;
-
- flags = elf_elfheader (abfd)->e_flags;
- switch (flags & EF_MIPS_ABI)
- {
- case 0:
- if (ABI_N32_P (abfd))
- return "N32";
- else if (ABI_64_P (abfd))
- return "64";
- else
- 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_GPREL16, 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_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_rel[(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_rel[(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_rel[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 = H_GET_32 (abfd, ex->ri_gprmask);
- in->ri_cprmask[0] = H_GET_32 (abfd, ex->ri_cprmask[0]);
- in->ri_cprmask[1] = H_GET_32 (abfd, ex->ri_cprmask[1]);
- in->ri_cprmask[2] = H_GET_32 (abfd, ex->ri_cprmask[2]);
- in->ri_cprmask[3] = H_GET_32 (abfd, ex->ri_cprmask[3]);
- in->ri_gp_value = H_GET_32 (abfd, ex->ri_gp_value);
-}
-
-void
-bfd_mips_elf32_swap_reginfo_out (abfd, in, ex)
- bfd *abfd;
- const Elf32_RegInfo *in;
- Elf32_External_RegInfo *ex;
-{
- H_PUT_32 (abfd, in->ri_gprmask, ex->ri_gprmask);
- H_PUT_32 (abfd, in->ri_cprmask[0], ex->ri_cprmask[0]);
- H_PUT_32 (abfd, in->ri_cprmask[1], ex->ri_cprmask[1]);
- H_PUT_32 (abfd, in->ri_cprmask[2], ex->ri_cprmask[2]);
- H_PUT_32 (abfd, in->ri_cprmask[3], ex->ri_cprmask[3]);
- H_PUT_32 (abfd, in->ri_gp_value, 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 = H_GET_32 (abfd, ex->ri_gprmask);
- in->ri_pad = H_GET_32 (abfd, ex->ri_pad);
- in->ri_cprmask[0] = H_GET_32 (abfd, ex->ri_cprmask[0]);
- in->ri_cprmask[1] = H_GET_32 (abfd, ex->ri_cprmask[1]);
- in->ri_cprmask[2] = H_GET_32 (abfd, ex->ri_cprmask[2]);
- in->ri_cprmask[3] = H_GET_32 (abfd, ex->ri_cprmask[3]);
- in->ri_gp_value = H_GET_64 (abfd, 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;
-{
- H_PUT_32 (abfd, in->ri_gprmask, ex->ri_gprmask);
- H_PUT_32 (abfd, in->ri_pad, ex->ri_pad);
- H_PUT_32 (abfd, in->ri_cprmask[0], ex->ri_cprmask[0]);
- H_PUT_32 (abfd, in->ri_cprmask[1], ex->ri_cprmask[1]);
- H_PUT_32 (abfd, in->ri_cprmask[2], ex->ri_cprmask[2]);
- H_PUT_32 (abfd, in->ri_cprmask[3], ex->ri_cprmask[3]);
- H_PUT_64 (abfd, in->ri_gp_value, 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 = H_GET_32 (abfd, ex->gt_entry.gt_g_value);
- in->gt_entry.gt_bytes = 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;
-{
- H_PUT_32 (abfd, in->gt_entry.gt_g_value, ex->gt_entry.gt_g_value);
- H_PUT_32 (abfd, 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;
-{
- H_PUT_32 (abfd, in->id1, ex->id1);
- H_PUT_32 (abfd, in->num, ex->num);
- H_PUT_32 (abfd, in->id2, ex->id2);
- H_PUT_32 (abfd, in->offset, ex->offset);
- H_PUT_32 (abfd, in->reserved0, ex->reserved0);
- H_PUT_32 (abfd, 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));
- H_PUT_32 (abfd, l, ex->info);
- H_PUT_32 (abfd, in->konst, ex->konst);
- H_PUT_32 (abfd, 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 = H_GET_8 (abfd, ex->kind);
- in->size = H_GET_8 (abfd, ex->size);
- in->section = H_GET_16 (abfd, ex->section);
- in->info = 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;
-{
- H_PUT_8 (abfd, in->kind, ex->kind);
- H_PUT_8 (abfd, in->size, ex->size);
- H_PUT_16 (abfd, in->section, ex->section);
- 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 = H_GET_32 (abfd, ex->ms_hash_value);
- in->ms_info = 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;
-{
- H_PUT_32 (abfd, in->ms_hash_value, ex->ms_hash_value);
- 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. */
-
-static boolean
-mips_elf_sym_is_global (abfd, sym)
- bfd *abfd ATTRIBUTE_UNUSED;
- asymbol *sym;
-{
- if (SGI_COMPAT (abfd))
- return (sym->flags & BSF_SECTION_SYM) == 0;
- else
- return ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
- || bfd_is_und_section (bfd_get_section (sym))
- || bfd_is_com_section (bfd_get_section (sym)));
-}
-
-/* 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 are 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. */
- if (SGI_COMPAT(abfd))
- 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. */
-
-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:
- case bfd_mach_mips4400:
- case bfd_mach_mips4600:
- 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_mips5000:
- case bfd_mach_mips8000:
- case bfd_mach_mips10000:
- case bfd_mach_mips12000:
- val = E_MIPS_ARCH_4;
- break;
-
- case bfd_mach_mips5:
- val = E_MIPS_ARCH_5;
- break;
-
- case bfd_mach_mips_sb1:
- val = E_MIPS_ARCH_64 | E_MIPS_MACH_SB1;
- break;
-
- case bfd_mach_mipsisa32:
- val = E_MIPS_ARCH_32;
- break;
-
- case bfd_mach_mipsisa64:
- val = E_MIPS_ARCH_64;
- }
-
- 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_numsections (abfd);
- 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;
-}
-
-/* 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;
- boolean null_input_bfd = true;
- asection *sec;
-
- /* Check if we have the same endianess */
- if (_bfd_generic_verify_endian_match (ibfd, obfd) == false)
- 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;
-
- /* Check to see if the input BFD actually contains any sections.
- If not, its flags may not have been initialised either, but it cannot
- actually cause any incompatibility. */
- for (sec = ibfd->sections; sec != NULL; sec = sec->next)
- {
- /* Ignore synthetic sections and empty .text, .data and .bss sections
- which are automatically generated by gas. */
- if (strcmp (sec->name, ".reginfo")
- && strcmp (sec->name, ".mdebug")
- && ((!strcmp (sec->name, ".text")
- || !strcmp (sec->name, ".data")
- || !strcmp (sec->name, ".bss"))
- && sec->_raw_size != 0))
- {
- null_input_bfd = false;
- break;
- }
- }
- if (null_input_bfd)
- 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_archive_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_archive_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 code using 32-bit ISAs, or mixing code
- using 64-bit ISAs. They will normally use the same data sizes
- and calling conventions. */
-
- if (( (new_isa == 1 || new_isa == 2 || new_isa == 32)
- ^ (old_isa == 1 || old_isa == 2 || old_isa == 32)) != 0)
- {
- (*_bfd_error_handler)
- (_("%s: ISA mismatch (-mips%d) with previous modules (-mips%d)"),
- bfd_archive_filename (ibfd), new_isa, old_isa);
- ok = false;
- }
- else
- {
- /* Do we need to update the mach field? */
- if (old_mach == 0 && new_mach != 0)
- elf_elfheader (obfd)->e_flags |= new_mach;
-
- /* Do we need to update the ISA field? */
- if (new_isa > old_isa)
- {
- elf_elfheader (obfd)->e_flags &= ~EF_MIPS_ARCH;
- elf_elfheader (obfd)->e_flags
- |= new_flags & EF_MIPS_ARCH;
- }
- }
- }
- else
- {
- (*_bfd_error_handler)
- (_("%s: ISA mismatch (%d) with previous modules (%d)"),
- bfd_archive_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_archive_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_archive_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 if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_5)
- fprintf (file, _(" [mips5]"));
- else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32)
- fprintf (file, _(" [mips32]"));
- else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64)
- fprintf (file, _(" [mips64]"));
- 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,
- (bfd_size_type) 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))
- {
- if ((abfd->flags & DYNAMIC) != 0)
- hdr->sh_entsize = sizeof (Elf32_External_RegInfo);
- else
- hdr->sh_entsize = 1;
- }
- else
- hdr->sh_entsize = sizeof (Elf32_External_RegInfo);
- }
- else if (SGI_COMPAT (abfd)
- && (strcmp (name, ".hash") == 0
- || strcmp (name, ".dynamic") == 0
- || strcmp (name, ".dynstr") == 0))
- {
- if (SGI_COMPAT (abfd))
- 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.
-
- This is not necessary for the O32 ABI since that only uses Elf32_Rel
- relocations (cf. System V ABI, MIPS RISC Processor Supplement,
- 3rd Edition, p. 4-17). It breaks the IRIX 5/6 32-bit ld, since one
- of the resulting empty .rela.<section> sections starts with
- sh_offset == object size, and ld doesn't allow that. While the check
- is arguably bogus for empty or SHT_NOBITS sections, it can easily be
- avoided by not emitting those useless sections in the first place. */
- if (IRIX_COMPAT (abfd) != ict_irix5 && (sec->flags & SEC_RELOC) != 0)
- {
- struct bfd_elf_section_data *esd;
- bfd_size_type amt = sizeof (Elf_Internal_Shdr);
-
- esd = elf_section_data (sec);
- BFD_ASSERT (esd->rel_hdr2 == NULL);
- esd->rel_hdr2 = (Elf_Internal_Shdr *) bfd_zalloc (abfd, amt);
- 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, sec, retval)
- bfd *abfd 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)
- {
- bfd_size_type amt = sizeof (struct bfd_elf_section_data);
- section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
- 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, (size_t) 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) != 0)
- return false;
- H_PUT_32 (abfd, elf_gp (abfd), buf);
- if (bfd_bwrite (buf, (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) != 0)
- return false;
- H_PUT_64 (abfd, elf_gp (abfd), buf);
- if (bfd_bwrite (buf, (bfd_size_type) 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) != 0)
- return false;
- H_PUT_32 (abfd, elf_gp (abfd), buf);
- if (bfd_bwrite (buf, (bfd_size_type) 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;
-
-/* 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;
-
- /* 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;
- bfd_size_type amt;
-
- /* 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)
- {
- amt = sizeof *m;
- m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
- 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)
- {
- 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;
-
- amt = sizeof (struct elf_segment_map);
- options_segment = bfd_zalloc (abfd, amt);
- 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 (IRIX_COMPAT (abfd) == ict_irix5)
- {
- /* 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)
- {
- amt = sizeof *m;
- m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
- 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 && IRIX_COMPAT (abfd) == ict_none)
- {
- /* For a normal mips executable the permissions for the PT_DYNAMIC
- segment are read, write and execute. We do that here since
- the code in elf.c sets only the read permission. This matters
- sometimes for the dynamic linker. */
- if (bfd_get_section_by_name (abfd, ".dynamic") != NULL)
- {
- m->p_flags = PF_R | PF_W | PF_X;
- m->p_flags_valid = 1;
- }
- }
- 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;
-
- amt = sizeof *n + (bfd_size_type) (c - 1) * sizeof (asection *);
- n = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
- 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, ex->p_adr);
- H_PUT_32 (abfd, in->regmask, ex->p_regmask);
- H_PUT_32 (abfd, in->regoffset, ex->p_regoffset);
- H_PUT_32 (abfd, in->fregmask, ex->p_fregmask);
- H_PUT_32 (abfd, in->fregoffset, ex->p_fregoffset);
- H_PUT_32 (abfd, in->frameoffset, ex->p_frameoffset);
-
- H_PUT_16 (abfd, in->framereg, ex->p_framereg);
- H_PUT_16 (abfd, in->pcreg, ex->p_pcreg);
-
- H_PUT_32 (abfd, in->irpss, ex->p_irpss);
-#if 0 /* FIXME */
- ECOFF_PUT_OFF (abfd, in->exception_info, 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 (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 \
- { \
- bfd_size_type amt = (bfd_size_type) size * symhdr->count; \
- debug->ptr = (type) bfd_malloc (amt); \
- if (debug->ptr == NULL) \
- goto error_return; \
- if (bfd_seek (abfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \
- || bfd_bread (debug->ptr, amt, abfd) != amt) \
- 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'. */
-
-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,
- (unsigned) (ABI_64_P (abfd) ? 8 : 0),
- &elf_tdata (abfd)->dwarf2_find_line_info))
- 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;
- bfd_size_type amt = sizeof (struct mips_elf_find_line);
-
- fi = (struct mips_elf_find_line *) bfd_zalloc (abfd, amt);
- 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. */
- amt = fi->d.symbolic_header.ifdMax * sizeof (struct fdr);
- fi->d.fdr = (struct fdr *) bfd_alloc (abfd, amt);
- 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->readonly_reloc = false;
- ret->min_dyn_reloc_index = 0;
- ret->no_fn_stub = false;
- ret->fn_stub = NULL;
- ret->need_fn_stub = false;
- ret->call_stub = NULL;
- ret->call_fp_stub = NULL;
- ret->forced_local = false;
- }
-
- return (struct bfd_hash_entry *) ret;
-}
-
-static void
-_bfd_mips_elf_hide_symbol (info, entry, force_local)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *entry;
- boolean force_local;
-{
- bfd *dynobj;
- asection *got;
- struct mips_got_info *g;
- struct mips_elf_link_hash_entry *h;
-
- h = (struct mips_elf_link_hash_entry *) entry;
- if (h->forced_local)
- return;
- h->forced_local = true;
-
- dynobj = elf_hash_table (info)->dynobj;
- got = bfd_get_section_by_name (dynobj, ".got");
- g = (struct mips_got_info *) elf_section_data (got)->tdata;
-
- _bfd_elf_link_hash_hide_symbol (info, &h->root, force_local);
-
- /* FIXME: Do we allocate too much GOT space here? */
- g->local_gotno++;
- got->_raw_size += MIPS_ELF_GOT_SIZE (dynobj);
-}
-
-/* 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;
- bfd_size_type amt = sizeof (struct mips_elf_link_hash_table);
-
- ret = (struct mips_elf_link_hash_table *) bfd_alloc (abfd, amt);
- 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. */
-
-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 (elf_tdata (abfd)->elf_text_section == NULL)
- {
- asymbol *elf_text_symbol;
- asection *elf_text_section;
- bfd_size_type amt = sizeof (asection);
-
- elf_text_section = bfd_zalloc (abfd, amt);
- if (elf_text_section == NULL)
- return false;
-
- amt = sizeof (asymbol);
- elf_text_symbol = bfd_zalloc (abfd, amt);
- if (elf_text_symbol == NULL)
- return false;
-
- /* Initialize the section. */
-
- elf_tdata (abfd)->elf_text_section = elf_text_section;
- elf_tdata (abfd)->elf_text_symbol = elf_text_symbol;
-
- elf_text_section->symbol = elf_text_symbol;
- elf_text_section->symbol_ptr_ptr = &elf_tdata (abfd)->elf_text_symbol;
-
- elf_text_section->name = ".text";
- elf_text_section->flags = SEC_NO_FLAGS;
- elf_text_section->output_section = NULL;
- elf_text_section->owner = abfd;
- elf_text_symbol->name = ".text";
- elf_text_symbol->flags = BSF_SECTION_SYM | BSF_DYNAMIC;
- elf_text_symbol->section = 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 = elf_tdata (abfd)->elf_text_section;
- 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 (elf_tdata (abfd)->elf_data_section == NULL)
- {
- asymbol *elf_data_symbol;
- asection *elf_data_section;
- bfd_size_type amt = sizeof (asection);
-
- elf_data_section = bfd_zalloc (abfd, amt);
- if (elf_data_section == NULL)
- return false;
-
- amt = sizeof (asymbol);
- elf_data_symbol = bfd_zalloc (abfd, amt);
- if (elf_data_symbol == NULL)
- return false;
-
- /* Initialize the section. */
-
- elf_tdata (abfd)->elf_data_section = elf_data_section;
- elf_tdata (abfd)->elf_data_symbol = elf_data_symbol;
-
- elf_data_section->symbol = elf_data_symbol;
- elf_data_section->symbol_ptr_ptr = &elf_tdata (abfd)->elf_data_symbol;
-
- elf_data_section->name = ".data";
- elf_data_section->flags = SEC_NO_FLAGS;
- elf_data_section->output_section = NULL;
- elf_data_section->owner = abfd;
- elf_data_symbol->name = ".data";
- elf_data_symbol->flags = BSF_SECTION_SYM | BSF_DYNAMIC;
- elf_data_symbol->section = 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 = elf_tdata (abfd)->elf_data_section;
- 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.root.type == bfd_link_hash_warning)
- h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-
- 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 (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)
- {
- struct mips_elf_link_hash_entry *hd = h;
- boolean no_fn_stub = h->no_fn_stub;
-
- while (hd->root.root.type == bfd_link_hash_indirect)
- {
- hd = (struct mips_elf_link_hash_entry *)h->root.root.u.i.link;
- no_fn_stub = no_fn_stub || hd->no_fn_stub;
- }
-
- if (!no_fn_stub)
- {
- /* Set type and value for a symbol with a function stub. */
- h->esym.asym.st = stProc;
- sec = hd->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 = (hd->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;
- bfd_size_type size;
- bfd_size_type 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;
-
- size = sizeof (char *);
- sv = (char **) bfd_malloc (size * 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 < (unsigned long) 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, -1, (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;
- asection *s;
- EXTR esym;
- unsigned int i;
- bfd_size_type amt;
-
- static const char * const secname[] =
- {
- ".text", ".init", ".fini", ".data",
- ".rodata", ".sdata", ".sbss", ".bss"
- };
- static const int sc[] =
- {
- scText, scInit, scFini, scData,
- scRData, scSData, scSBss, scBss
- };
-
- /* 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 || IRIX_COMPAT (abfd) == ict_none)
- 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;
- bfd_section_list_remove (abfd, secpp);
- --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 (&reginfo, 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,
- (bfd_size_type) 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;
- bfd_vma last;
-
- /* 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;
-
- 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 < sizeof (secname) / sizeof (secname[0]); i++)
- {
- esym.asym.sc = sc[i];
- s = bfd_get_section_by_name (abfd, secname[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,
- secname[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 j;
-
- /* 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)
- {
- 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)
- ;
- bfd_section_list_remove (abfd, secpp);
- --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;
- amt = c * sizeof (Elf32_gptab);
- tab = (Elf32_gptab *) bfd_malloc (amt);
- 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,
- (file_ptr) gpentry,
- (bfd_size_type) 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. */
- amt = (bfd_size_type) (c + 1) * sizeof (Elf32_gptab);
- new_tab = (Elf32_gptab *) bfd_realloc ((PTR) tab, amt);
- 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. */
- amt = (bfd_size_type) c * sizeof (Elf32_External_gptab);
- ext_tab = (Elf32_External_gptab *) bfd_alloc (abfd, amt);
- if (ext_tab == NULL)
- {
- free (tab);
- return false;
- }
-
- for (j = 0; j < c; j++)
- bfd_mips_elf32_swap_gptab_out (abfd, tab + j, ext_tab + j);
- 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, &reginfo, &ext);
- if (! bfd_set_section_contents (abfd, reginfo_sec, (PTR) &ext,
- (file_ptr) 0, (bfd_size_type) 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;
-}
-
-/* This function is called via qsort() to sort the dynamic relocation
- entries by increasing r_symndx value. */
-
-static int
-sort_dynamic_relocs (arg1, arg2)
- const PTR arg1;
- const PTR arg2;
-{
- const Elf32_External_Rel *ext_reloc1 = (const Elf32_External_Rel *) arg1;
- const Elf32_External_Rel *ext_reloc2 = (const Elf32_External_Rel *) arg2;
-
- Elf_Internal_Rel int_reloc1;
- Elf_Internal_Rel int_reloc2;
-
- bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, ext_reloc1, &int_reloc1);
- bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, ext_reloc2, &int_reloc2);
-
- return (ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info));
-}
-
-/* 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,
- check_forced)
- bfd *input_bfd;
- const Elf_Internal_Rela *relocation;
- asection **local_sections;
- boolean check_forced;
-{
- unsigned long r_symndx;
- Elf_Internal_Shdr *symtab_hdr;
- struct mips_elf_link_hash_entry *h;
- size_t extsymoff;
-
- r_symndx = ELF32_R_SYM (relocation->r_info);
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- extsymoff = (elf_bad_symtab (input_bfd)) ? 0 : symtab_hdr->sh_info;
-
- if (r_symndx < extsymoff)
- return true;
- if (elf_bad_symtab (input_bfd) && local_sections[r_symndx] != NULL)
- return true;
-
- if (check_forced)
- {
- /* Look up the hash table to check whether the symbol
- was forced local. */
- 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.root.type == bfd_link_hash_indirect
- || h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
- if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
- return true;
- }
-
- return false;
-}
-
-/* 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)
- {
- switch (ELF_ST_VISIBILITY (h->other))
- {
- case STV_INTERNAL:
- case STV_HIDDEN:
- _bfd_mips_elf_hide_symbol (info, h, true);
- break;
- }
- if (!bfd_elf32_link_record_dynamic_symbol (info, h))
- return false;
- }
-
- /* If we've already marked this entry as needing 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. Avoid using zero, as the
- generic ELF copy_indirect_symbol tests for <= 0. */
- h->got.offset = 1;
-
- 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;
-
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-
- /* Symbols without dynamic symbol table entries aren't interesting
- at all. */
- if (h->root.dynindx == -1)
- return true;
-
- if (h->root.got.offset != 1)
- 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 should have been enough room in the symbol table to
- accomodate both the GOT and non-GOT symbols. */
- BFD_ASSERT (hsd.max_non_got_dynindx <= hsd.min_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, external)
- bfd *abfd;
- struct bfd_link_info *info;
- bfd_vma value;
- boolean external;
-{
- asection *sgot;
- struct mips_got_info *g;
- bfd_byte *entry;
- bfd_byte *last_entry;
- bfd_vma index = 0;
- bfd_vma address;
-
- if (! external)
- {
- /* 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 == value)
- {
- /* This entry has the right high-order 16 bits, and the low-order
- 16 bits are set to zero. */
- 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
- dynamic 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);
- BFD_ASSERT (sreloc->contents != NULL);
- BFD_ASSERT (sreloc->reloc_count * MIPS_ELF_REL_SIZE (output_bfd)
- < sreloc->_raw_size);
-
- skip = false;
- outrel.r_offset =
- _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset);
- if (outrel.r_offset == (bfd_vma) -1)
- skip = true;
- /* FIXME: For -2 runtime relocation needs to be skipped, but
- properly resolved statically and installed. */
- BFD_ASSERT (outrel.r_offset != (bfd_vma) -2);
-
- /* If we've decided to skip this relocation, just output an empty
- 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;
- /* h->root.dynindx may be -1 if this symbol was marked to
- become local. */
- if (indx == -1)
- indx = 0;
- }
- 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 += section_offset;
- /* Now, the relocation is just against the section. */
- symbol = sec->output_section->vma;
- }
-
- /* If the relocation was previously an absolute relocation and
- this symbol will not be referred to by the relocation, we must
- adjust it by the value we give it in the dynamic symbol table.
- Otherwise leave the job up to the dynamic linker. */
- if (!indx && 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, false);
- 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.root.type == bfd_link_hash_indirect
- || h->root.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->allow_shlib_undefined)
- && !info->no_undefined
- && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT)
- symbol = 0;
- else if (strcmp (h->root.root.root.string, "_DYNAMIC_LINK") == 0 ||
- strcmp (h->root.root.root.string, "_DYNAMIC_LINKING") == 0)
- {
- /* If this is a dynamic link, we should have created a
- _DYNAMIC_LINK symbol or _DYNAMIC_LINKING(for normal mips) symbol
- in 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)
- || ((r_type == R_MIPS_26) && target_is_16_bit_code_p)));
-
- local_p = mips_elf_local_relocation_p (input_bfd, relocation,
- local_sections, true);
-
- /* 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);
- if (! elf_hash_table(info)->dynamic_sections_created
- || (info->shared
- && (info->symbolic || h->root.dynindx == -1)
- && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
- {
- /* This is a static link or a -Bsymbolic link. The
- symbol is defined locally, or was forced to be local.
- We must initialize this entry in the GOT. */
- asection *sgot = mips_elf_got_section(elf_hash_table
- (info)->dynobj);
- MIPS_ELF_PUT_WORD (elf_hash_table (info)->dynobj,
- symbol + addend, sgot->contents + g);
- }
- }
- else if (r_type == R_MIPS_GOT16 || r_type == R_MIPS_CALL16)
- /* 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 bfd_reloc_outofrange;
- }
-
- /* 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_MIPS16_GPREL:
- 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_DYNAMIC) != 0)
- && ((h->root.elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)))
- && r_symndx != 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 bfd_reloc_undefined;
- }
- 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:
- /* Instead of subtracting 'p' here, we should be subtracting the
- equivalent value for the LO part of the reloc, since the value
- here is relative to that address. Because that's not easy to do,
- we adjust 'addend' in _bfd_mips_elf_relocate_section(). See also
- the comment there for more information. */
- value = mips_elf_high (addend + symbol - p);
- value &= howto->dst_mask;
- break;
-
- case R_MIPS16_26:
- /* The calculation for R_MIPS16_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 + 4) & 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:
- case R_MIPS_CALL16:
- if (local_p)
- {
- boolean forced;
-
- /* The special case is when the symbol is forced to be local. We
- need the full address in the GOT since no R_MIPS_LO16 relocation
- follows. */
- forced = ! mips_elf_local_relocation_p (input_bfd, relocation,
- local_sections, false);
- value = mips_elf_got16_entry (abfd, info, symbol + addend, forced);
- if (value == (bfd_vma) -1)
- return bfd_reloc_outofrange;
- 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_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;
- overflowed_p = mips_elf_overflow_p (value, 16);
- value = (bfd_vma) ((bfd_signed_vma) value / 4);
- 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 bfd_reloc_outofrange;
- 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 (((bfd_vma)(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 + 4) & 0xf0000000) + S) >> 2)
- When producing a fully linked file, the calculation is
- let R = (((A < 2) | ((P + 4) & 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_archive_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;
- unsigned int r_type = ELF32_R_TYPE (rel->r_info);
- const char * msg = (const char *) NULL;
-
- /* 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_rel + 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)
- >= (NUM_SHDR_ENTRIES (rel_hdr) * 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, false)))
- {
- bfd_vma l;
- const Elf_Internal_Rela *lo16_relocation;
- reloc_howto_type *lo16_howto;
- unsigned 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;
-
- /* If PC-relative, subtract the difference between the
- address of the LO part of the reloc and the address of
- the HI part. The relocation is relative to the LO
- part, but mips_elf_calculate_relocation() doesn't know
- it address or the difference from the HI part, so
- we subtract that difference here. See also the
- comment in mips_elf_calculate_relocation(). */
- if (r_type == R_MIPS_GNU_REL_HI16)
- addend -= (lo16_relocation->r_offset - rel->r_offset);
- }
- 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,
- false))
- /* 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 & ((bfd_vma) 1 << 31))
-#ifdef BFD64
- sign_bits = ((bfd_vma) 1 << 32) - 1;
-#else
- sign_bits = -1;
-#endif
- 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:
- msg = _("internal error: unsupported relocation error");
- info->callbacks->warning
- (info, msg, name, input_bfd, input_section, rel->r_offset);
- return false;
-
- 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 & ((bfd_vma) 1 << 31))
-#ifdef BFD64
- sign_bits = ((bfd_vma) 1 << 32) - 1;
-#else
- sign_bits = -1;
-#endif
- 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. */
-
-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 || IRIX_COMPAT (abfd) == ict_none)
- && !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 &~ (flagword) 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 (SGI_COMPAT (abfd))
- {
- 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 (SGI_COMPAT (abfd))
- {
- 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;
- }
- else
- {
- /* For normal mips it is _DYNAMIC_LINKING. */
- if (!(_bfd_generic_link_add_one_symbol
- (info, abfd, "_DYNAMIC_LINKING", 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 (SGI_COMPAT (abfd))
- {
- 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;
- }
- else
- {
- /* For normal mips the symbol is __RLD_MAP. */
- 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;
- bfd_size_type amt;
-
- /* 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);
-
- amt = sizeof (struct mips_got_info);
- g = (struct mips_got_info *) bfd_alloc (abfd, amt);
- 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)
- {
- amt = sizeof (struct bfd_elf_section_data);
- s->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
- 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;
- bfd_size_type amt;
-
- if (elf_bad_symtab (abfd))
- symcount = NUM_SHDR_ENTRIES (symtab_hdr);
- else
- symcount = symtab_hdr->sh_info;
- amt = symcount * sizeof (asection *);
- n = (asection **) bfd_zalloc (abfd, amt);
- 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;
- unsigned 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 if (r_symndx >= extsymoff + NUM_SHDR_ENTRIES (symtab_hdr))
- {
- (*_bfd_error_handler)
- (_("%s: Malformed reloc detected for section %s"),
- bfd_archive_filename (abfd), name);
- bfd_set_error (bfd_error_bad_value);
- return false;
- }
- 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 and
- R_MIPS_CALL16. 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_archive_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 *dname = MIPS_ELF_REL_DYN_SECTION_NAME (dynobj);
-
- sreloc = bfd_get_section_by_name (dynobj, dname);
- if (sreloc == NULL)
- {
- sreloc = bfd_make_section (dynobj, dname);
- 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;
- }
- }
-#define MIPS_READONLY_SECTION (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
- 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);
- if ((sec->flags & MIPS_READONLY_SECTION)
- == MIPS_READONLY_SECTION)
- /* We tell the dynamic linker that there are
- relocations against the text segment. */
- info->flags |= DF_TEXTREL;
- }
- 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;
- if ((sec->flags & MIPS_READONLY_SECTION)
- == MIPS_READONLY_SECTION)
- /* We need it to tell the dynamic linker if there
- are relocations against the text segment. */
- hmips->readonly_reloc = true;
- }
-
- /* 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 (abfd))
- 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 (abfd))
- 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;
- }
-
- /* We must not create a stub for a symbol that has relocations
- related to taking the function's address. */
- switch (r_type)
- {
- default:
- if (h != NULL)
- {
- struct mips_elf_link_hash_entry *mh;
-
- mh = (struct mips_elf_link_hash_entry *) h;
- mh->no_fn_stub = true;
- }
- break;
- case R_MIPS_CALL16:
- case R_MIPS_CALL_HI16:
- case R_MIPS_CALL_LO16:
- 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
- {
- 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;
-}
-
-/* Copy data from a MIPS ELF indirect symbol to its direct symbol,
- hiding the old indirect symbol. Process additional relocation
- information. Also called for weakdefs, in which case we just let
- _bfd_elf_link_hash_copy_indirect copy the flags for us. */
-
-static void
-_bfd_mips_elf_copy_indirect_symbol (dir, ind)
- struct elf_link_hash_entry *dir, *ind;
-{
- struct mips_elf_link_hash_entry *dirmips, *indmips;
-
- _bfd_elf_link_hash_copy_indirect (dir, ind);
-
- if (ind->root.type != bfd_link_hash_indirect)
- return;
-
- dirmips = (struct mips_elf_link_hash_entry *) dir;
- indmips = (struct mips_elf_link_hash_entry *) ind;
- dirmips->possibly_dynamic_relocs += indmips->possibly_dynamic_relocs;
- if (indmips->readonly_reloc)
- dirmips->readonly_reloc = true;
- if (dirmips->min_dyn_reloc_index == 0
- || (indmips->min_dyn_reloc_index != 0
- && indmips->min_dyn_reloc_index < dirmips->min_dyn_reloc_index))
- dirmips->min_dyn_reloc_index = indmips->min_dyn_reloc_index;
- if (indmips->no_fn_stub)
- dirmips->no_fn_stub = 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->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
- {
- mips_elf_allocate_dynamic_relocations (dynobj,
- hmips->possibly_dynamic_relocs);
- if (hmips->readonly_reloc)
- /* We tell the dynamic linker that there are relocations
- against the text segment. */
- info->flags |= DF_TEXTREL;
- }
-
- /* For a function, create a stub, if allowed. */
- if (! hmips->no_fn_stub
- && (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;
- }
- }
- else if ((h->type == STT_FUNC)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0)
- {
- /* This will set the entry for this symbol in the GOT to 0, and
- the dynamic linker will take care of this. */
- h->root.u.def.value = 0;
- 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,
- (bfd_size_type) 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. */
-
-static boolean
-mips_elf_check_mips16_stubs (h, data)
- struct mips_elf_link_hash_entry *h;
- PTR data ATTRIBUTE_UNUSED;
-{
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-
- 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;
- 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)
- &~ (bfd_size_type) 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)
- {
- /* 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;
- if (!SGI_COMPAT (output_bfd))
- {
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
- return false;
- }
- }
- else
- {
- /* Shared libraries on traditional mips have DT_DEBUG. */
- if (!SGI_COMPAT (output_bfd))
- {
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
- return false;
- }
- }
-
- if (reltext && SGI_COMPAT (output_bfd))
- info->flags |= DF_TEXTREL;
-
- if ((info->flags & DF_TEXTREL) != 0)
- {
- 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 (SGI_COMPAT (output_bfd))
- {
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICTNO, 0))
- return false;
- }
-
- if (SGI_COMPAT (output_bfd))
- {
- 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, (bfd_vma) STUB_LW (output_bfd), p);
- p += 4;
- bfd_put_32 (output_bfd, (bfd_vma) STUB_MOVE (output_bfd), p);
- p += 4;
-
- /* FIXME: Can h->dynindex be more than 64K? */
- if (h->dynindx & 0xffff0000)
- return false;
-
- bfd_put_32 (output_bfd, (bfd_vma) STUB_JALR, p);
- p += 4;
- bfd_put_32 (output_bfd, (bfd_vma) STUB_LI16 (output_bfd) + 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
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0);
-
- 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.) */
-
- if (info->shared && h->root.type == bfd_link_hash_undefined)
- value = 0;
- else
- 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
- || strcmp (name, "_DYNAMIC_LINKING") == 0)
- {
- sym->st_shndx = SHN_ABS;
- sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
- sym->st_value = 1;
- }
- else 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 (SGI_COMPAT (output_bfd))
- {
- 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 (! info->shared)
- {
- if (! mips_elf_hash_table (info)->use_rld_obj_head
- && (strcmp (name, "__rld_map") == 0
- || 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
- || IRIX_COMPAT (output_bfd) == ict_none)
- 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_elf_strtab_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 & ~(bfd_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);
- }
- }
- }
-
- /* We need to sort the entries of the dynamic relocation section. */
-
- if (!ABI_64_P (output_bfd))
- {
- asection *reldyn;
-
- reldyn = bfd_get_section_by_name (dynobj,
- MIPS_ELF_REL_DYN_SECTION_NAME (dynobj));
- if (reldyn != NULL && reldyn->reloc_count > 2)
- {
- reldyn_sorting_bfd = output_bfd;
- qsort ((Elf32_External_Rel *) reldyn->contents + 1,
- (size_t) reldyn->reloc_count - 1,
- sizeof (Elf32_External_Rel), sort_dynamic_relocs);
- }
- }
-
- /* 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;
-}
-
-/* Support for core dump NOTE sections */
-static boolean
-_bfd_elf32_mips_grok_prstatus (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
-{
- int offset;
- unsigned int raw_size;
-
- switch (note->descsz)
- {
- default:
- return false;
-
- case 256: /* Linux/MIPS */
- /* pr_cursig */
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
-
- /* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
-
- /* pr_reg */
- offset = 72;
- raw_size = 180;
-
- break;
- }
-
- /* Make a ".reg/999" section. */
- return _bfd_elfcore_make_pseudosection (abfd, ".reg",
- raw_size, note->descpos + offset);
-}
-
-static boolean
-_bfd_elf32_mips_grok_psinfo (abfd, note)
- bfd *abfd;
- Elf_Internal_Note *note;
-{
- switch (note->descsz)
- {
- default:
- return false;
-
- case 128: /* Linux/MIPS elf_prpsinfo */
- elf_tdata (abfd)->core_program
- = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
- elf_tdata (abfd)->core_command
- = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
- }
-
- /* Note that for some reason, a spurious space is tacked
- onto the end of the args in some (at least one anyway)
- implementations, so strip it off if it exists. */
-
- {
- char *command = elf_tdata (abfd)->core_command;
- int n = strlen (command);
-
- if (0 < n && command[n - 1] == ' ')
- command[n - 1] = '\0';
- }
-
- return true;
-}
-
-#define PDR_SIZE 32
-
-static boolean
-_bfd_elf32_mips_discard_info (abfd, cookie, info)
- bfd *abfd;
- struct elf_reloc_cookie *cookie;
- struct bfd_link_info *info;
-{
- asection *o;
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
- boolean ret = false;
- unsigned char *tdata;
- size_t i, skip;
-
- o = bfd_get_section_by_name (abfd, ".pdr");
- if (! o)
- return false;
- if (o->_raw_size == 0)
- return false;
- if (o->_raw_size % PDR_SIZE != 0)
- return false;
- if (o->output_section != NULL
- && bfd_is_abs_section (o->output_section))
- return false;
-
- tdata = bfd_zmalloc (o->_raw_size / PDR_SIZE);
- if (! tdata)
- return false;
-
- cookie->rels = _bfd_elf32_link_read_relocs (abfd, o, (PTR) NULL,
- (Elf_Internal_Rela *) NULL,
- info->keep_memory);
- if (!cookie->rels)
- {
- free (tdata);
- return false;
- }
-
- cookie->rel = cookie->rels;
- cookie->relend =
- cookie->rels + o->reloc_count * bed->s->int_rels_per_ext_rel;
-
- for (i = 0, skip = 0; i < o->_raw_size; i ++)
- {
- if (_bfd_elf32_reloc_symbol_deleted_p (i * PDR_SIZE, cookie))
- {
- tdata[i] = 1;
- skip ++;
- }
- }
-
- if (skip != 0)
- {
- elf_section_data (o)->tdata = tdata;
- o->_cooked_size = o->_raw_size - skip * PDR_SIZE;
- ret = true;
- }
- else
- free (tdata);
-
- if (! info->keep_memory)
- free (cookie->rels);
-
- return ret;
-}
-
-static boolean
-_bfd_elf32_mips_ignore_discarded_relocs (sec)
- asection *sec;
-{
- if (strcmp (sec->name, ".pdr") == 0)
- return true;
- return false;
-}
-
-static boolean
-_bfd_elf32_mips_write_section (output_bfd, sec, contents)
- bfd *output_bfd;
- asection *sec;
- bfd_byte *contents;
-{
- bfd_byte *to, *from, *end;
- int i;
-
- if (strcmp (sec->name, ".pdr") != 0)
- return false;
-
- if (elf_section_data (sec)->tdata == NULL)
- return false;
-
- to = contents;
- end = contents + sec->_raw_size;
- for (from = contents, i = 0;
- from < end;
- from += PDR_SIZE, i++)
- {
- if (((unsigned char *)elf_section_data (sec)->tdata)[i] == 1)
- continue;
- if (to != from)
- memcpy (to, from, PDR_SIZE);
- to += PDR_SIZE;
- }
- bfd_set_section_contents (output_bfd, sec->output_section, contents,
- (file_ptr) sec->output_offset,
- sec->_cooked_size);
- return true;
-}
-
-/* Given a data section and an in-memory embedded reloc section, store
- relocation information into the embedded reloc section which can be
- used at runtime to relocate the data 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. */
-
-boolean
-bfd_mips_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *datasec;
- asection *relsec;
- char **errmsg;
-{
- Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Shdr *shndx_hdr;
- Elf32_External_Sym *extsyms;
- Elf32_External_Sym *free_extsyms = NULL;
- Elf_External_Sym_Shndx *shndx_buf = NULL;
- Elf_Internal_Rela *internal_relocs;
- Elf_Internal_Rela *free_relocs = NULL;
- Elf_Internal_Rela *irel, *irelend;
- bfd_byte *p;
- bfd_size_type amt;
-
- BFD_ASSERT (! info->relocateable);
-
- *errmsg = NULL;
-
- if (datasec->reloc_count == 0)
- return true;
-
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- /* Read this BFD's symbols if we haven't done so already, or get the cached
- copy if it exists. */
- if (symtab_hdr->contents != NULL)
- extsyms = (Elf32_External_Sym *) symtab_hdr->contents;
- else
- {
- /* Go get them off disk. */
- if (info->keep_memory)
- extsyms = ((Elf32_External_Sym *)
- bfd_alloc (abfd, symtab_hdr->sh_size));
- else
- extsyms = ((Elf32_External_Sym *)
- bfd_malloc (symtab_hdr->sh_size));
- if (extsyms == NULL)
- goto error_return;
- if (! info->keep_memory)
- free_extsyms = extsyms;
- if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_bread (extsyms, symtab_hdr->sh_size, abfd)
- != symtab_hdr->sh_size))
- goto error_return;
- if (info->keep_memory)
- symtab_hdr->contents = (unsigned char *) extsyms;
- }
-
- shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
- if (shndx_hdr->sh_size != 0)
- {
- amt = symtab_hdr->sh_info * sizeof (Elf_External_Sym_Shndx);
- shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
- if (shndx_buf == NULL)
- goto error_return;
- if (bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0
- || bfd_bread ((PTR) shndx_buf, amt, abfd) != amt)
- goto error_return;
- }
-
- /* Get a copy of the native relocations. */
- internal_relocs = (_bfd_elf32_link_read_relocs
- (abfd, datasec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
- info->keep_memory));
- if (internal_relocs == NULL)
- goto error_return;
- if (! info->keep_memory)
- free_relocs = internal_relocs;
-
- relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 12);
- if (relsec->contents == NULL)
- goto error_return;
-
- p = relsec->contents;
-
- irelend = internal_relocs + datasec->reloc_count;
-
- for (irel = internal_relocs; irel < irelend; irel++, p += 12)
- {
- asection *targetsec;
-
- /* We are going to write a four byte longword into the runtime
- reloc section. The longword will be the address in the data
- section which must be relocated. It is followed by the name
- of the target section NUL-padded or truncated to 8
- characters. */
-
- /* We can only relocate absolute longword relocs at run time. */
- if ((ELF32_R_TYPE (irel->r_info) != (int) R_MIPS_32) &&
- (ELF32_R_TYPE (irel->r_info) != (int) R_MIPS_64))
- {
- *errmsg = _("unsupported reloc type");
- bfd_set_error (bfd_error_bad_value);
- goto error_return;
- }
- /* Get the target section referred to by the reloc. */
- if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
- {
- Elf32_External_Sym *esym;
- Elf_External_Sym_Shndx *shndx;
- Elf_Internal_Sym isym;
-
- /* A local symbol. */
- esym = extsyms + ELF32_R_SYM (irel->r_info);
- shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0);
- bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
-
- targetsec = bfd_section_from_elf_index (abfd, isym.st_shndx);
- }
- else
- {
- unsigned long indx;
- struct elf_link_hash_entry *h;
-
- /* An external symbol. */
- indx = ELF32_R_SYM (irel->r_info);
- h = elf_sym_hashes (abfd)[indx];
- targetsec = NULL;
- /*
- * For some reason, in certain programs, the symbol will
- * not be in the hash table. It seems to happen when you
- * declare a static table of pointers to const external structures.
- * In this case, the relocs are relative to data, not
- * text, so just treating it like an undefined link
- * should be sufficient.
- */
- BFD_ASSERT(h != NULL);
- if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- targetsec = h->root.u.def.section;
- }
-
-
- /*
- * Set the low bit of the relocation offset if it's a MIPS64 reloc.
- * Relocations will always be on (at least) 32-bit boundaries.
- */
-
- bfd_put_32 (abfd, ((irel->r_offset + datasec->output_offset) +
- ((ELF32_R_TYPE (irel->r_info) == (int) R_MIPS_64) ? 1 : 0)),
- p);
- memset (p + 4, 0, 8);
- if (targetsec != NULL)
- strncpy (p + 4, targetsec->output_section->name, 8);
- }
-
- if (shndx_buf != NULL)
- free (shndx_buf);
- if (free_extsyms != NULL)
- free (free_extsyms);
- if (free_relocs != NULL)
- free (free_relocs);
- return true;
-
- error_return:
- if (shndx_buf != NULL)
- free (shndx_buf);
- if (free_extsyms != NULL)
- free (free_extsyms);
- if (free_relocs != NULL)
- free (free_relocs);
- return false;
-}
-
-/* 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 ((bfd_size_type) 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,
- (file_ptr) 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 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_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_symbol_processing _bfd_mips_elf_symbol_processing
-#define elf_backend_section_processing _bfd_mips_elf_section_processing
-#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_add_symbol_hook _bfd_mips_elf_add_symbol_hook
-#define elf_backend_link_output_symbol_hook \
- _bfd_mips_elf_link_output_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_finish_dynamic_symbol \
- _bfd_mips_elf_finish_dynamic_symbol
-#define elf_backend_finish_dynamic_sections \
- _bfd_mips_elf_finish_dynamic_sections
-#define elf_backend_final_write_processing \
- _bfd_mips_elf_final_write_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_gc_mark_hook _bfd_mips_elf_gc_mark_hook
-#define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
-#define elf_backend_copy_indirect_symbol \
- _bfd_mips_elf_copy_indirect_symbol
-#define elf_backend_hide_symbol _bfd_mips_elf_hide_symbol
-#define elf_backend_grok_prstatus _bfd_elf32_mips_grok_prstatus
-#define elf_backend_grok_psinfo _bfd_elf32_mips_grok_psinfo
-#define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap
-
-#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
-#define elf_backend_may_use_rela_p 0
-#define elf_backend_default_use_rela_p 0
-#define elf_backend_sign_extend_vma true
-
-#define elf_backend_discard_info _bfd_elf32_mips_discard_info
-#define elf_backend_ignore_discarded_relocs \
- _bfd_elf32_mips_ignore_discarded_relocs
-#define elf_backend_write_section _bfd_elf32_mips_write_section
-
-#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_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
-
-/* Support for SGI-ish mips targets. */
-#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"
-
-#include "elf32-target.h"
-
-/* Support for traditional mips targets. */
-#define INCLUDED_TARGET_FILE /* More a type of flag. */
-
-#undef TARGET_LITTLE_SYM
-#undef TARGET_LITTLE_NAME
-#undef TARGET_BIG_SYM
-#undef TARGET_BIG_NAME
-
-#define TARGET_LITTLE_SYM bfd_elf32_tradlittlemips_vec
-#define TARGET_LITTLE_NAME "elf32-tradlittlemips"
-#define TARGET_BIG_SYM bfd_elf32_tradbigmips_vec
-#define TARGET_BIG_NAME "elf32-tradbigmips"
-
-/* Include the target file again for this target */
-#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 6762190..0000000
--- a/contrib/binutils/bfd/elf32-v850.c
+++ /dev/null
@@ -1,2220 +0,0 @@
-/* V850-specific support for 32-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
- 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"
-#include "libiberty.h"
-
-/* Sign-extend a 24-bit number. */
-#define SEXT24(x) ((((x) & 0xffffff) ^ 0x800000) - 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 *, unsigned 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_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 *, 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 *, const char *));
-static boolean v850_elf_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-static asection * v850_elf_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *,
- Elf_Internal_Rela *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *));
-
-/* 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 int 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 = ARRAY_SIZE (v850_elf_reloc_map); i --;)
- if (v850_elf_reloc_map[i].bfd_reloc_val == code)
- {
- unsigned int elf_reloc_val = v850_elf_reloc_map[i].elf_reloc_val;
-
- BFD_ASSERT (v850_elf_howto_table[elf_reloc_val].type == elf_reloc_val);
-
- return v850_elf_howto_table + 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_archive_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)
- {
- /* Flag which type of relocation was used. */
- h->other |= other;
- 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,
- (bfd_vma) 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;
-
- 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;
- bfd_size_type amt = sizeof (* free_hi16s);
-
- /* Find a free structure. */
- if (free_hi16s == NULL)
- free_hi16s = (hi16s_location *) bfd_zalloc (abfd, amt);
-
- 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;
- unsigned 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, (bfd_vma) 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, (bfd_vma) 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 &~ (bfd_vma) 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 &~ (bfd_vma) 1) << 16;
-
- bfd_put_32 (abfd, (bfd_vma) 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, (bfd_vma) 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)
- {
- /* 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 int 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;
-
- /* Only the bottom 24 bits of the PC are valid */
- value = SEXT24 (value);
- 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)
- /* Actually this indicates that __ep could not be found. */
- return bfd_reloc_continue;
-
- 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)
- /* Actually this indicates that __ctbp could not be found. */
- return bfd_reloc_dangerous + 1;
-
- 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, (bfd_vma) 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 = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
-#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 (sec, info, rel, h, sym)
- asection *sec;
- 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
- return bfd_section_from_elf_index (sec->owner, 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;
-}
-
-/* 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_archive_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, sec, retval)
- bfd * abfd 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 int indx;
-
- indx = 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 (indx < elf_numsections (abfd))
- switch (elf_elfsections(abfd)[indx]->sh_type)
- {
- case SHT_V850_SCOMMON:
- indx = SHN_V850_SCOMMON;
- break;
-
- case SHT_V850_TCOMMON:
- indx = SHN_V850_TCOMMON;
- break;
-
- case SHT_V850_ZCOMMON:
- indx = SHN_V850_ZCOMMON;
- break;
-
- default:
- break;
- }
-
- switch (indx)
- {
- 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;
-{
- unsigned int indx = 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 (indx < elf_numsections (abfd))
- switch (elf_elfsections(abfd)[indx]->sh_type)
- {
- case SHT_V850_SCOMMON:
- indx = SHN_V850_SCOMMON;
- break;
-
- case SHT_V850_TCOMMON:
- indx = SHN_V850_TCOMMON;
- break;
-
- case SHT_V850_ZCOMMON:
- indx = SHN_V850_ZCOMMON;
- break;
-
- default:
- break;
- }
-
- switch (indx)
- {
- 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;
-}
-
-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;
- const 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_V850
-#define ELF_MACHINE_ALT1 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_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 f2f5dcbc..0000000
--- a/contrib/binutils/bfd/elf64-mips.c
+++ /dev/null
@@ -1,7092 +0,0 @@
-/* MIPS-specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
- 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. */
-
-/* TODO: Many things are unsupported, even if there is some code for it
- . (which was mostly stolen from elf32-mips.c and slightly adapted).
- .
- . - Relocation handling for REL relocs is wrong in many cases and
- . generally untested.
- . - Relocation handling for RELA relocs related to GOT support are
- . also likely to be wrong.
- . - Support for MIPS16 is only partially implemented.
- . - Embedded PIC is only partially implemented (is it needed?).
- . - Combined relocs with RSS_* entries are unsupported.
- . - The whole GOT handling for NewABI is missing, some parts of
- . the OldABI version is still lying around and shold be removed.
- */
-
-#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_SIGNED_64
-#include "ecoffswap.h"
-
-struct mips_elf64_link_hash_entry;
-
-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 bfd_vma mips_elf64_high PARAMS ((bfd_vma));
-static bfd_vma mips_elf64_higher PARAMS ((bfd_vma));
-static bfd_vma mips_elf64_highest PARAMS ((bfd_vma));
-static reloc_howto_type *mips_elf64_reloc_type_lookup
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void mips_elf64_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf64_Internal_Rel *));
-static void mips_elf64_info_to_howto_rela
- PARAMS ((bfd *, arelent *, Elf64_Internal_Rela *));
-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 void mips_elf64_write_rel
- PARAMS((bfd *, asection *, Elf_Internal_Shdr *, int *, PTR));
-static void mips_elf64_write_rela
- PARAMS((bfd *, asection *, Elf_Internal_Shdr *, int *, PTR));
-static struct bfd_hash_entry *mips_elf64_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static bfd_reloc_status_type mips_elf64_hi16_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type mips_elf64_higher_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type mips_elf64_highest_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type mips_elf64_gprel16_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type mips_elf64_gprel16_reloca
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type mips_elf64_literal_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type mips_elf64_gprel32_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type mips_elf64_shift6_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static bfd_reloc_status_type mips_elf64_got16_reloc
- PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-static boolean mips_elf64_assign_gp PARAMS ((bfd *, bfd_vma *));
-static bfd_reloc_status_type mips_elf64_final_gp
- PARAMS ((bfd *, asymbol *, boolean, char **, bfd_vma *));
-static bfd_reloc_status_type gprel16_with_gp
- PARAMS ((bfd *, asymbol *, arelent *, asection *, boolean, PTR, bfd_vma));
-static int mips_elf64_additional_program_headers PARAMS ((bfd *));
-static struct bfd_link_hash_table *mips_elf64_link_hash_table_create
- PARAMS((bfd *));
-static bfd_vma mips_elf64_got_offset_from_index
- PARAMS ((bfd *, bfd *, bfd_vma));
-static struct mips_elf64_got_info *_mips_elf64_got_info
- PARAMS ((bfd *, asection **));
-static bfd_vma mips_elf64_sign_extend PARAMS ((bfd_vma, int));
-static boolean mips_elf64_overflow_p PARAMS ((bfd_vma, int));
-static bfd_vma mips_elf64_global_got_index
- PARAMS ((bfd *, struct elf_link_hash_entry *));
-static boolean mips_elf64_sort_hash_table_f
- PARAMS ((struct mips_elf64_link_hash_entry *, PTR));
-static boolean mips_elf64_sort_hash_table
- PARAMS ((struct bfd_link_info *, unsigned long));
-static void mips_elf64_swap_msym_out
- PARAMS ((bfd *, const Elf32_Internal_Msym *, Elf32_External_Msym *));
-static bfd_vma mips_elf64_create_local_got_entry
- PARAMS ((bfd *abfd, struct mips_elf64_got_info *, asection *,
- bfd_vma value));
-static bfd_vma mips_elf64_local_got_index
- PARAMS ((bfd *, struct bfd_link_info *, bfd_vma));
-static bfd_vma mips_elf64_got_page
- PARAMS ((bfd *, struct bfd_link_info *, bfd_vma, bfd_vma *));
-static bfd_vma mips_elf64_got16_entry
- PARAMS ((bfd *, struct bfd_link_info *, bfd_vma, boolean));
-static boolean mips_elf64_local_relocation_p
- PARAMS ((bfd *, const Elf_Internal_Rela *, asection **, boolean));
-static const Elf_Internal_Rela *mips_elf64_next_relocation
- PARAMS ((unsigned int, const Elf_Internal_Rela *,
- const Elf_Internal_Rela *));
-static boolean mips_elf64_create_dynamic_relocation
- PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Rela *,
- struct mips_elf64_link_hash_entry *, asection *, bfd_vma,
- bfd_vma *, asection *));
-static bfd_reloc_status_type mips_elf64_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_elf64_obtain_contents
- PARAMS ((reloc_howto_type *, const Elf_Internal_Rela *, bfd *, bfd_byte *));
-static boolean mips_elf64_perform_relocation
- PARAMS ((struct bfd_link_info *, reloc_howto_type *,
- const Elf_Internal_Rela *, bfd_vma,
- bfd *, asection *, bfd_byte *, boolean));
-static boolean mips_elf64_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-boolean mips_elf64_create_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-boolean mips_elf64_adjust_dynamic_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *h));
-boolean mips_elf64_always_size_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-static boolean mips_elf64_check_mips16_stubs
- PARAMS ((struct mips_elf64_link_hash_entry *, PTR));
-boolean mips_elf64_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-boolean mips_elf64_finish_dynamic_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *));
-boolean mips_elf64_finish_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *info));
-asection *mips_elf64_gc_mark_hook
- PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-boolean mips_elf64_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-static boolean mips_elf64_create_got_section
- PARAMS ((bfd *, struct bfd_link_info *));
-static boolean mips_elf64_record_global_got_symbol
- PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *,
- struct mips_elf64_got_info *));
-static asection *mips_elf64_create_msym_section PARAMS((bfd *));
-static void mips_elf64_allocate_dynamic_relocations
- PARAMS ((bfd *, unsigned int));
-static boolean mips_elf64_stub_section_p PARAMS ((bfd *, asection *));
-boolean mips_elf64_check_relocs
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
-static boolean mips_elf64_output_extsym
- PARAMS ((struct mips_elf64_link_hash_entry *, PTR));
-static void mips_elf64_swap_gptab_in
- PARAMS ((bfd *, const Elf32_External_gptab *, Elf32_gptab *));
-static void mips_elf64_swap_gptab_out
- PARAMS ((bfd *, const Elf32_gptab *, Elf32_External_gptab *));
-static int gptab_compare PARAMS ((const PTR, const PTR));
-boolean mips_elf64_final_link PARAMS ((bfd *, struct bfd_link_info *));
-
-extern const bfd_target bfd_elf64_bigmips_vec;
-extern const bfd_target bfd_elf64_littlemips_vec;
-
-static bfd_vma prev_reloc_addend = 0;
-static bfd_size_type prev_reloc_address = 0;
-
-/* Whether we are trying to be compatible with IRIX6 (or little endianers
- which are otherwise IRIX-ABI compliant). */
-#define SGI_COMPAT(abfd) \
- ((abfd->xvec == &bfd_elf64_bigmips_vec) \
- || (abfd->xvec == &bfd_elf64_littlemips_vec) ? true : false)
-
-/* 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)
-
-/* Instructions which appear in a stub. */
-#define ELF_MIPS_GP_OFFSET(abfd) 0x7ff0
-#define STUB_LW 0xdf998010 /* ld t9,0x8010(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)
-
-/* The relocation table used for SHT_REL sections. */
-
-#define UNUSED_RELOC(num) { num, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
-
-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 */
- 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_16", /* name */
- true, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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_dont, /* 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_dont, /* 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 jump 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 36
- bits must match the PC + 4. */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_26", /* name */
- true, /* partial_inplace */
- 0x03ffffff, /* src_mask */
- 0x03ffffff, /* 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 */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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 */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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 */
- mips_elf64_gprel16_reloc, /* special_function */
- "R_MIPS_GPREL16", /* name */
- true, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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 */
- mips_elf64_literal_reloc, /* special_function */
- "R_MIPS_LITERAL", /* name */
- true, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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 */
- mips_elf64_got16_reloc, /* special_function */
- "R_MIPS_GOT16", /* name */
- true, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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 */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
- true), /* 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 */
- true, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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_dont, /* complain_on_overflow */
- mips_elf64_gprel32_reloc, /* special_function */
- "R_MIPS_GPREL32", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- UNUSED_RELOC (13),
- UNUSED_RELOC (14),
- UNUSED_RELOC (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. */
- 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 */
- mips_elf64_shift6_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_dont, /* 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_signed, /* 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_signed, /* 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_signed, /* 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_dont, /* 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 */
- 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_INSERT_A", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* 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 */
- 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_INSERT_B", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* Delete a 32 bit instruction. */
- /* FIXME: Not handled correctly. */
- HOWTO (R_MIPS_DELETE, /* 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_DELETE", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* 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 */
- mips_elf64_higher_reloc, /* special_function */
- "R_MIPS_HIGHER", /* name */
- true, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* 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 */
- mips_elf64_highest_reloc, /* special_function */
- "R_MIPS_HIGHEST", /* 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_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 */
-
- /* Section displacement, used by an associated event location section. */
- /* FIXME: Not handled correctly. */
- 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 */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- HOWTO (R_MIPS_REL16, /* type */
- 0, /* rightshift */
- 1, /* 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_REL16", /* name */
- true, /* partial_inplace */
- 0xffff, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* These two are obsolete. */
- EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
- EMPTY_HOWTO (R_MIPS_PJUMP),
-
- /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
- It must be used for multigot GOT's (and only there). */
- HOWTO (R_MIPS_RELGOT, /* 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_RELGOT", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* 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 */
- 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_JALR", /* name */
- false, /* partial_inplace */
- 0, /* 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 */
- 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_16", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* 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_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_32", /* name */
- false, /* 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_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_REL32", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* 26 bit jump 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 36
- bits must match the PC + 4. */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_26", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x03ffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* R_MIPS_HI16 and R_MIPS_LO16 are unsupported for 64 bit REL. */
- /* 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 */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* 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 */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* 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 */
- mips_elf64_gprel16_reloca, /* special_function */
- "R_MIPS_GPREL16", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* 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 */
- mips_elf64_literal_reloc, /* special_function */
- "R_MIPS_LITERAL", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* 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 */
- 0x0000ffff, /* 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 */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- true), /* 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 */
- 0x0000ffff, /* 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_dont, /* complain_on_overflow */
- mips_elf64_gprel32_reloc, /* special_function */
- "R_MIPS_GPREL32", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- UNUSED_RELOC (13),
- UNUSED_RELOC (14),
- UNUSED_RELOC (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 */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x000007c0, /* dst_mask */
- false), /* pcrel_offset */
-
- /* A 6 bit shift field. */
- 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 */
- mips_elf64_shift6_reloc, /* special_function */
- "R_MIPS_SHIFT6", /* name */
- false, /* 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_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_64", /* name */
- false, /* 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_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_DISP", /* name */
- false, /* 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_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_PAGE", /* name */
- false, /* 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_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_GOT_OFST", /* name */
- false, /* 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 */
- false, /* 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 */
- false, /* 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_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_MIPS_SUB", /* name */
- false, /* 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 */
- 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_INSERT_A", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* 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 */
- 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_INSERT_B", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* Delete a 32 bit instruction. */
- /* FIXME: Not handled correctly. */
- HOWTO (R_MIPS_DELETE, /* 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_DELETE", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* 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 */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* 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 */
- false, /* 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_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 */
- false, /* 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 */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0x0000ffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* Section displacement, used by an associated event location section. */
- /* FIXME: Not handled correctly. */
- 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 */
- 0, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- HOWTO (R_MIPS_REL16, /* type */
- 0, /* rightshift */
- 1, /* 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_REL16", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* These two are obsolete. */
- EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
- EMPTY_HOWTO (R_MIPS_PJUMP),
-
- /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
- It must be used for multigot GOT's (and only there). */
- HOWTO (R_MIPS_RELGOT, /* 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_RELGOT", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0xffffffff, /* 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 */
- 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_JALR", /* name */
- false, /* partial_inplace */
- 0, /* 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 = H_GET_64 (abfd, src->r_offset);
- dst->r_sym = H_GET_32 (abfd, src->r_sym);
- dst->r_ssym = H_GET_8 (abfd, src->r_ssym);
- dst->r_type3 = H_GET_8 (abfd, src->r_type3);
- dst->r_type2 = H_GET_8 (abfd, src->r_type2);
- dst->r_type = H_GET_8 (abfd, 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 = H_GET_64 (abfd, src->r_offset);
- dst->r_sym = H_GET_32 (abfd, src->r_sym);
- dst->r_ssym = H_GET_8 (abfd, src->r_ssym);
- dst->r_type3 = H_GET_8 (abfd, src->r_type3);
- dst->r_type2 = H_GET_8 (abfd, src->r_type2);
- dst->r_type = H_GET_8 (abfd, src->r_type);
- dst->r_addend = H_GET_S64 (abfd, 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;
-{
- H_PUT_64 (abfd, src->r_offset, dst->r_offset);
- H_PUT_32 (abfd, src->r_sym, dst->r_sym);
- H_PUT_8 (abfd, src->r_ssym, dst->r_ssym);
- H_PUT_8 (abfd, src->r_type3, dst->r_type3);
- H_PUT_8 (abfd, src->r_type2, dst->r_type2);
- H_PUT_8 (abfd, src->r_type, 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;
-{
- H_PUT_64 (abfd, src->r_offset, dst->r_offset);
- H_PUT_32 (abfd, src->r_sym, dst->r_sym);
- H_PUT_8 (abfd, src->r_ssym, dst->r_ssym);
- H_PUT_8 (abfd, src->r_type3, dst->r_type3);
- H_PUT_8 (abfd, src->r_type2, dst->r_type2);
- H_PUT_8 (abfd, src->r_type, dst->r_type);
- H_PUT_S64 (abfd, src->r_addend, 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 = ELF64_R_INFO (mirel.r_sym, mirel.r_type);
- dst[1].r_offset = mirel.r_offset;
- dst[1].r_info = ELF64_R_INFO (mirel.r_ssym, mirel.r_type2);
- dst[2].r_offset = mirel.r_offset;
- dst[2].r_info = ELF64_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 = ELF64_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 = ELF64_R_INFO (mirela.r_ssym, mirela.r_type2);
- dst[1].r_addend = 0;
- dst[2].r_offset = mirela.r_offset;
- dst[2].r_info = ELF64_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[0].r_offset;
- BFD_ASSERT(src[0].r_offset == src[1].r_offset);
- BFD_ASSERT(src[0].r_offset == src[2].r_offset);
-
- mirel.r_type = ELF64_MIPS_R_TYPE (src[0].r_info);
- mirel.r_sym = ELF64_R_SYM (src[0].r_info);
- mirel.r_type2 = ELF64_MIPS_R_TYPE2 (src[1].r_info);
- mirel.r_ssym = ELF64_MIPS_R_SSYM (src[1].r_info);
- mirel.r_type3 = ELF64_MIPS_R_TYPE3 (src[2].r_info);
-
- 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[0].r_offset;
- BFD_ASSERT(src[0].r_offset == src[1].r_offset);
- BFD_ASSERT(src[0].r_offset == src[2].r_offset);
-
- mirela.r_type = ELF64_MIPS_R_TYPE (src[0].r_info);
- mirela.r_sym = ELF64_R_SYM (src[0].r_info);
- mirela.r_addend = src[0].r_addend;
- BFD_ASSERT(src[1].r_addend == 0);
- BFD_ASSERT(src[2].r_addend == 0);
-
- mirela.r_type2 = ELF64_MIPS_R_TYPE2 (src[1].r_info);
- mirela.r_ssym = ELF64_MIPS_R_SSYM (src[1].r_info);
- mirela.r_type3 = ELF64_MIPS_R_TYPE3 (src[2].r_info);
-
- mips_elf64_swap_reloca_out (abfd, &mirela,
- (Elf64_Mips_External_Rela *) dst);
-}
-
-/* Calculate the %high function. */
-
-static bfd_vma
-mips_elf64_high (value)
- bfd_vma value;
-{
- return ((value + (bfd_vma) 0x8000) >> 16) & 0xffff;
-}
-
-/* Calculate the %higher function. */
-
-static bfd_vma
-mips_elf64_higher (value)
- bfd_vma value;
-{
- return ((value + (bfd_vma) 0x80008000) >> 32) & 0xffff;
-}
-
-/* Calculate the %highest function. */
-
-static bfd_vma
-mips_elf64_highest (value)
- bfd_vma value;
-{
- return ((value + (bfd_vma) 0x800080008000) >> 48) & 0xffff;
-}
-
-/* Do a R_MIPS_HI16 relocation. */
-
-bfd_reloc_status_type
-mips_elf64_hi16_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 we're relocating, and this is an external symbol, we don't
- want to change anything. */
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (! reloc_entry->howto->partial_inplace
- || reloc_entry->addend == 0))
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- if (((reloc_entry->addend & 0xffff) + 0x8000) & ~0xffff)
- reloc_entry->addend += 0x8000;
-
- return bfd_reloc_continue;
-}
-
-/* Do a R_MIPS_HIGHER relocation. */
-
-bfd_reloc_status_type
-mips_elf64_higher_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 we're relocating, and this is an external symbol, we don't
- want to change anything. */
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (! reloc_entry->howto->partial_inplace
- || reloc_entry->addend == 0))
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- if (((reloc_entry->addend & 0xffffffff) + 0x80008000)
- & ~0xffffffff)
- reloc_entry->addend += 0x80008000;
-
- return bfd_reloc_continue;
-}
-
-/* Do a R_MIPS_HIGHEST relocation. */
-
-bfd_reloc_status_type
-mips_elf64_highest_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 we're relocating, and this is an external symbol, we don't
- want to change anything. */
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (! reloc_entry->howto->partial_inplace
- || reloc_entry->addend == 0))
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- if (((reloc_entry->addend & 0xffffffffffff) + 0x800080008000)
- & ~0xffffffffffff)
- reloc_entry->addend += 0x800080008000;
-
- return bfd_reloc_continue;
-}
-
-/* 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
-mips_elf64_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 mips_elf64_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_elf64_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_elf64_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_elf64_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. */
-
-bfd_reloc_status_type
-mips_elf64_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_elf64_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;
-
- else if ((long) val >= 0x8000 || (long) val < -0x8000)
- return bfd_reloc_overflow;
-
- return bfd_reloc_ok;
-}
-
-/* Do a R_MIPS_GPREL16 RELA relocation. */
-
-bfd_reloc_status_type
-mips_elf64_gprel16_reloca (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section;
- bfd *output_bfd;
- char **error_message;
-{
- boolean relocateable;
- bfd_vma gp;
-
- /* This works only for NewABI. */
- BFD_ASSERT (reloc_entry->howto->src_mask == 0);
-
- /* 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;
- }
-
- if (prev_reloc_address != reloc_entry->address)
- prev_reloc_address = reloc_entry->address;
- else
- {
- mips_elf64_final_gp (output_bfd, symbol, relocateable, error_message,
- &gp);
- prev_reloc_addend = reloc_entry->addend + reloc_entry->address - gp;
- if (symbol->flags & BSF_LOCAL)
- prev_reloc_addend += _bfd_get_gp_value (abfd);
-/*fprintf(stderr, "Addend: %lx, Next Addend: %lx\n", reloc_entry->addend, prev_reloc_addend);*/
- }
-
- return bfd_reloc_ok;
-}
-
-/* Do a R_MIPS_LITERAL relocation. */
-
-bfd_reloc_status_type
-mips_elf64_literal_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 is an external symbol, we don't
- want to change anything. */
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (! reloc_entry->howto->partial_inplace
- || reloc_entry->addend == 0))
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- /* FIXME: The entries in the .lit8 and .lit4 sections should be merged.
- Currently we simply call mips_elf64_gprel16_reloc. */
- return mips_elf64_gprel16_reloc (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message);
-}
-
-/* Do a R_MIPS_GPREL32 relocation. Is this 32 bit value the offset
- from the gp register? XXX */
-
-bfd_reloc_status_type
-mips_elf64_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;
- bfd_vma relocation;
- unsigned long val;
-
- /* 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_elf64_final_gp (output_bfd, symbol, relocateable,
- error_message, &gp);
- if (ret != bfd_reloc_ok)
- return ret;
- }
-
- 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;
-}
-
-/* Do a R_MIPS_SHIFT6 relocation. The MSB of the shift is stored at bit 2,
- the rest is at bits 6-10. The bitpos alredy got right by the howto. */
-
-bfd_reloc_status_type
-mips_elf64_shift6_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 we're relocating, and this is an external symbol, we don't
- want to change anything. */
- if (output_bfd != (bfd *) NULL
- && (symbol->flags & BSF_SECTION_SYM) == 0
- && (! reloc_entry->howto->partial_inplace
- || reloc_entry->addend == 0))
- {
- reloc_entry->address += input_section->output_offset;
- return bfd_reloc_ok;
- }
-
- reloc_entry->addend = (reloc_entry->addend & 0x00007c0)
- | (reloc_entry->addend & 0x00000800) >> 9;
-
- return bfd_reloc_continue;
-}
-
-static int
-mips_elf64_additional_program_headers (abfd)
- bfd *abfd;
-{
- int ret = 0;
-
- /* See if we need a PT_MIPS_OPTIONS segment. */
- if (bfd_get_section_by_name (abfd, ".MIPS.options"))
- ++ret;
-
- return ret;
-}
-
-/* Given a BFD reloc type, return a howto structure. */
-
-static reloc_howto_type *
-mips_elf64_reloc_type_lookup (abfd, code)
- bfd *abfd ATTRIBUTE_UNUSED;
- bfd_reloc_code_real_type code;
-{
- /* FIXME: We default to RELA here instead of choosing the right
- relocation variant. */
- reloc_howto_type *howto_table = mips_elf64_howto_table_rela;
-
- switch (code)
- {
- case BFD_RELOC_NONE:
- return &howto_table[R_MIPS_NONE];
- case BFD_RELOC_16:
- return &howto_table[R_MIPS_16];
- case BFD_RELOC_32:
- return &howto_table[R_MIPS_32];
- case BFD_RELOC_64:
- case BFD_RELOC_CTOR:
- /* We need to handle these 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 &howto_table[R_MIPS_32];
- else
- return &howto_table[R_MIPS_64];
-
- case BFD_RELOC_16_PCREL:
- return &howto_table[R_MIPS_PC16];
- case BFD_RELOC_HI16_S:
- return &howto_table[R_MIPS_HI16];
- case BFD_RELOC_LO16:
- return &howto_table[R_MIPS_LO16];
- case BFD_RELOC_GPREL16:
- return &howto_table[R_MIPS_GPREL16];
- case BFD_RELOC_GPREL32:
- return &howto_table[R_MIPS_GPREL32];
- case BFD_RELOC_MIPS_JMP:
- return &howto_table[R_MIPS_26];
- case BFD_RELOC_MIPS_LITERAL:
- return &howto_table[R_MIPS_LITERAL];
- case BFD_RELOC_MIPS_GOT16:
- return &howto_table[R_MIPS_GOT16];
- case BFD_RELOC_MIPS_CALL16:
- return &howto_table[R_MIPS_CALL16];
- case BFD_RELOC_MIPS_SHIFT5:
- return &howto_table[R_MIPS_SHIFT5];
- case BFD_RELOC_MIPS_SHIFT6:
- return &howto_table[R_MIPS_SHIFT6];
- case BFD_RELOC_MIPS_GOT_DISP:
- return &howto_table[R_MIPS_GOT_DISP];
- case BFD_RELOC_MIPS_GOT_PAGE:
- return &howto_table[R_MIPS_GOT_PAGE];
- case BFD_RELOC_MIPS_GOT_OFST:
- return &howto_table[R_MIPS_GOT_OFST];
- case BFD_RELOC_MIPS_GOT_HI16:
- return &howto_table[R_MIPS_GOT_HI16];
- case BFD_RELOC_MIPS_GOT_LO16:
- return &howto_table[R_MIPS_GOT_LO16];
- case BFD_RELOC_MIPS_SUB:
- return &howto_table[R_MIPS_SUB];
- case BFD_RELOC_MIPS_INSERT_A:
- return &howto_table[R_MIPS_INSERT_A];
- case BFD_RELOC_MIPS_INSERT_B:
- return &howto_table[R_MIPS_INSERT_B];
- case BFD_RELOC_MIPS_DELETE:
- return &howto_table[R_MIPS_DELETE];
- case BFD_RELOC_MIPS_HIGHEST:
- return &howto_table[R_MIPS_HIGHEST];
- case BFD_RELOC_MIPS_HIGHER:
- return &howto_table[R_MIPS_HIGHER];
- case BFD_RELOC_MIPS_CALL_HI16:
- return &howto_table[R_MIPS_CALL_HI16];
- case BFD_RELOC_MIPS_CALL_LO16:
- return &howto_table[R_MIPS_CALL_LO16];
- case BFD_RELOC_MIPS_SCN_DISP:
- return &howto_table[R_MIPS_SCN_DISP];
- case BFD_RELOC_MIPS_REL16:
- return &howto_table[R_MIPS_REL16];
- /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */
- case BFD_RELOC_MIPS_RELGOT:
- return &howto_table[R_MIPS_RELGOT];
- case BFD_RELOC_MIPS_JALR:
- return &howto_table[R_MIPS_JALR];
-/*
- 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;
-*/
- default:
- bfd_set_error (bfd_error_bad_value);
- return NULL;
- }
-}
-
-/* Prevent relocation handling by bfd for MIPS ELF64. */
-
-static void
-mips_elf64_info_to_howto_rel (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr ATTRIBUTE_UNUSED;
- Elf64_Internal_Rel *dst ATTRIBUTE_UNUSED;
-{
- BFD_ASSERT (0);
-}
-
-static void
-mips_elf64_info_to_howto_rela (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr ATTRIBUTE_UNUSED;
- Elf64_Internal_Rela *dst ATTRIBUTE_UNUSED;
-{
- BFD_ASSERT (0);
-}
-
-/* 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 ATTRIBUTE_UNUSED;
- 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;
- bfd_vma count;
- bfd_vma i;
- int entsize;
- reloc_howto_type *howto_table;
-
- allocated = (PTR) bfd_malloc (rel_hdr->sh_size);
- if (allocated == NULL)
- return false;
-
- if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_bread (allocated, 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;
-{
- bfd_size_type amt;
- 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. */
- amt = asect->reloc_count;
- amt *= 3 * sizeof (arelent);
- asect->relocation = (arelent *) bfd_alloc (abfd, amt);
- 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;
- int count;
- Elf_Internal_Shdr *rel_hdr;
- unsigned int idx;
-
- /* 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;
- }
- }
-
- rel_hdr = &elf_section_data (sec)->rel_hdr;
-
- /* Do the actual relocation. */
-
- if (rel_hdr->sh_entsize == sizeof(Elf64_Mips_External_Rel))
- mips_elf64_write_rel (abfd, sec, rel_hdr, &count, data);
- else if (rel_hdr->sh_entsize == sizeof(Elf64_Mips_External_Rela))
- mips_elf64_write_rela (abfd, sec, rel_hdr, &count, data);
- else
- BFD_ASSERT (0);
-}
-
-static void
-mips_elf64_write_rel (abfd, sec, rel_hdr, count, data)
- bfd *abfd;
- asection *sec;
- Elf_Internal_Shdr *rel_hdr;
- int *count;
- PTR data;
-{
- boolean *failedp = (boolean *) data;
- Elf64_Mips_External_Rel *ext_rel;
- unsigned int idx;
- asymbol *last_sym = 0;
- int last_sym_idx = 0;
-
- rel_hdr->sh_size = (bfd_vma)(rel_hdr->sh_entsize * *count);
- rel_hdr->contents = (PTR) bfd_alloc (abfd, rel_hdr->sh_size);
- if (rel_hdr->contents == NULL)
- {
- *failedp = true;
- return;
- }
-
- ext_rel = (Elf64_Mips_External_Rel *) rel_hdr->contents;
- for (idx = 0; idx < sec->reloc_count; idx++, ext_rel++)
- {
- arelent *ptr;
- Elf64_Mips_Internal_Rel int_rel;
- 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_rel.r_offset = ptr->address;
- else
- int_rel.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_rel.r_sym = n;
- int_rel.r_ssym = RSS_UNDEF;
-
- if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
- && ! _bfd_elf_validate_reloc (abfd, ptr))
- {
- *failedp = true;
- return;
- }
-
- int_rel.r_type = ptr->howto->type;
- int_rel.r_type2 = (int) R_MIPS_NONE;
- int_rel.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_rel.r_type2 = r->howto->type;
- else
- int_rel.r_type3 = r->howto->type;
-
- ++idx;
- }
-
- mips_elf64_swap_reloc_out (abfd, &int_rel, ext_rel);
- }
-
- BFD_ASSERT (ext_rel - (Elf64_Mips_External_Rel *) rel_hdr->contents
- == *count);
-}
-
-static void
-mips_elf64_write_rela (abfd, sec, rela_hdr, count, data)
- bfd *abfd;
- asection *sec;
- Elf_Internal_Shdr *rela_hdr;
- int *count;
- PTR data;
-{
- boolean *failedp = (boolean *) data;
- Elf64_Mips_External_Rela *ext_rela;
- unsigned int idx;
- asymbol *last_sym = 0;
- int last_sym_idx = 0;
-
- rela_hdr->sh_size = (bfd_vma)(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);
-}
-
-/* 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_elf64_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 ELF64 linker needs additional information for each symbol in
- the global hash table. */
-
-struct mips_elf64_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;
-
- /* If the R_MIPS_32, R_MIPS_REL32, or R_MIPS_64 reloc is against
- a readonly section. */
- boolean readonly_reloc;
-
- /* The index of the first dynamic relocation (in the .rel.dyn
- section) against this symbol. */
- unsigned int min_dyn_reloc_index;
-
- /* We must not create a stub for a symbol that has relocations
- related to taking the function's address, i.e. any but
- R_MIPS_CALL*16 ones -- see "MIPS ABI Supplement, 3rd Edition",
- p. 4-20. */
- boolean no_fn_stub;
-
- /* 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;
-};
-
- /* 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 ELF64 linker hash table. */
-
-struct mips_elf64_link_hash_table
-{
- struct elf_link_hash_table root;
- /* This is set if we see any mips16 stub sections. */
- boolean mips16_stubs_seen;
-};
-
-/* Look up an entry in a MIPS ELF64 linker hash table. */
-
-#define mips_elf64_link_hash_lookup(table, string, create, copy, follow) \
- ((struct mips_elf64_link_hash_entry *) \
- elf_link_hash_lookup (&(table)->root, (string), (create), \
- (copy), (follow)))
-
-/* Traverse a MIPS ELF linker hash table. */
-
-#define mips_elf64_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 ELF64 linker hash table from a link_info structure. */
-
-#define mips_elf64_hash_table(p) \
- ((struct mips_elf64_link_hash_table *) ((p)->hash))
-
-/* Create an entry in a MIPS ELF64 linker hash table. */
-
-static struct bfd_hash_entry *
-mips_elf64_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
-{
- struct mips_elf64_link_hash_entry *ret =
- (struct mips_elf64_link_hash_entry *) entry;
-
- /* Allocate the structure if it has not already been allocated by a
- subclass. */
- if (ret == (struct mips_elf64_link_hash_entry *) NULL)
- ret = ((struct mips_elf64_link_hash_entry *)
- bfd_hash_allocate (table,
- sizeof (struct mips_elf64_link_hash_entry)));
- if (ret == (struct mips_elf64_link_hash_entry *) NULL)
- return (struct bfd_hash_entry *) ret;
-
- /* Call the allocation method of the superclass. */
- ret = ((struct mips_elf64_link_hash_entry *)
- _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
- table, string));
- if (ret != (struct mips_elf64_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->readonly_reloc = false;
- ret->min_dyn_reloc_index = 0;
- ret->no_fn_stub = false;
- 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 ELF64 linker hash table. */
-
-struct bfd_link_hash_table *
-mips_elf64_link_hash_table_create (abfd)
- bfd *abfd;
-{
- struct mips_elf64_link_hash_table *ret;
-
- ret = ((struct mips_elf64_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct mips_elf64_link_hash_table)));
- if (ret == (struct mips_elf64_link_hash_table *) NULL)
- return NULL;
-
- if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
- mips_elf64_link_hash_newfunc))
- {
- bfd_release (abfd, ret);
- return NULL;
- }
-
- ret->mips16_stubs_seen = false;
-
- return &ret->root.root;
-}
-
-/* Returns the offset for the entry at the INDEXth position
- in the GOT. */
-
-static bfd_vma
-mips_elf64_got_offset_from_index (dynobj, output_bfd, index)
- bfd *dynobj;
- bfd *output_bfd;
- bfd_vma index;
-{
- asection *sgot;
- bfd_vma gp;
-
- sgot = bfd_get_section_by_name (dynobj, ".got");
- gp = _bfd_get_gp_value (output_bfd);
- return (sgot->output_section->vma + sgot->output_offset + index -
- gp);
-}
-
-/* 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_elf64_got_info *
-_mips_elf64_got_info (abfd, sgotp)
- bfd *abfd;
- asection **sgotp;
-{
- asection *sgot;
- struct mips_elf64_got_info *g;
-
- sgot = bfd_get_section_by_name (abfd, ".got");
- BFD_ASSERT (sgot != NULL);
- BFD_ASSERT (elf_section_data (sgot) != NULL);
- g = (struct mips_elf64_got_info *) elf_section_data (sgot)->tdata;
- BFD_ASSERT (g != NULL);
-
- if (sgotp)
- *sgotp = sgot;
- return g;
-}
-
-/* Sign-extend VALUE, which has the indicated number of BITS. */
-
-static bfd_vma
-mips_elf64_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_elf64_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;
-}
-
-/* Returns the GOT index for the global symbol indicated by H. */
-
-static bfd_vma
-mips_elf64_global_got_index (abfd, h)
- bfd *abfd;
- struct elf_link_hash_entry *h;
-{
- bfd_vma index;
- asection *sgot;
- struct mips_elf64_got_info *g;
-
- g = _mips_elf64_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)
- * (get_elf_backend_data (abfd)->s->arch_size / 8));
- BFD_ASSERT (index < sgot->_raw_size);
-
- return index;
-}
-
-struct mips_elf64_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_elf64_sort_hash_table_f (h, data)
- struct mips_elf64_link_hash_entry *h;
- PTR data;
-{
- struct mips_elf64_hash_sort_data *hsd
- = (struct mips_elf64_hash_sort_data *) data;
-
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link;
-
- /* Symbols without dynamic symbol table entries aren't interesting
- at all. */
- if (h->root.dynindx == -1)
- return true;
-
- if (h->root.got.offset != 1)
- 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_elf64_size_dynamic_sections, this value is 1. Afterward, the
- section symbols are added and the count is higher. */
-
-static boolean
-mips_elf64_sort_hash_table (info, max_local)
- struct bfd_link_info *info;
- unsigned long max_local;
-{
- struct mips_elf64_hash_sort_data hsd;
- struct mips_elf64_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_elf64_link_hash_traverse (((struct mips_elf64_link_hash_table *)
- elf_hash_table (info)),
- mips_elf64_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.max_non_got_dynindx <= hsd.min_got_dynindx);
-
- /* Now we know which dynamic symbol has the lowest dynamic symbol
- table index in the GOT. */
- g = _mips_elf64_got_info (dynobj, NULL);
- g->global_gotsym = hsd.low;
-
- return true;
-}
-
-#if 0
-/* Swap in an MSYM entry. */
-
-static void
-mips_elf64_swap_msym_in (abfd, ex, in)
- bfd *abfd;
- const Elf32_External_Msym *ex;
- Elf32_Internal_Msym *in;
-{
- in->ms_hash_value = H_GET_32 (abfd, ex->ms_hash_value);
- in->ms_info = H_GET_32 (abfd, ex->ms_info);
-}
-#endif
-/* Swap out an MSYM entry. */
-
-static void
-mips_elf64_swap_msym_out (abfd, in, ex)
- bfd *abfd;
- const Elf32_Internal_Msym *in;
- Elf32_External_Msym *ex;
-{
- H_PUT_32 (abfd, in->ms_hash_value, ex->ms_hash_value);
- H_PUT_32 (abfd, in->ms_info, ex->ms_info);
-}
-
-/* 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_elf64_create_local_got_entry (abfd, g, sgot, value)
- bfd *abfd;
- struct mips_elf64_got_info *g;
- asection *sgot;
- bfd_vma value;
-{
- CONST bfd_vma got_size = get_elf_backend_data (abfd)->s->arch_size / 8;
-
- 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;
- }
-
- bfd_put_64 (abfd, value, (sgot->contents + got_size * g->assigned_gotno));
- return got_size * 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_elf64_local_got_index (abfd, info, value)
- bfd *abfd;
- struct bfd_link_info *info;
- bfd_vma value;
-{
- CONST bfd_vma got_size = get_elf_backend_data (abfd)->s->arch_size / 8;
- asection *sgot;
- struct mips_elf64_got_info *g;
- bfd_byte *entry;
-
- g = _mips_elf64_got_info (elf_hash_table (info)->dynobj, &sgot);
-
- /* Look to see if we already have an appropriate entry. */
- for (entry = (sgot->contents + got_size * MIPS_RESERVED_GOTNO);
- entry != sgot->contents + got_size * g->assigned_gotno;
- entry += got_size)
- {
- bfd_vma address = bfd_get_64 (abfd, entry);
- if (address == value)
- return entry - sgot->contents;
- }
-
- return mips_elf64_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_elf64_got_page (abfd, info, value, offsetp)
- bfd *abfd;
- struct bfd_link_info *info;
- bfd_vma value;
- bfd_vma *offsetp;
-{
- CONST bfd_vma got_size = get_elf_backend_data (abfd)->s->arch_size / 8;
- asection *sgot;
- struct mips_elf64_got_info *g;
- bfd_byte *entry;
- bfd_byte *last_entry;
- bfd_vma index = 0;
- bfd_vma address;
-
- g = _mips_elf64_got_info (elf_hash_table (info)->dynobj, &sgot);
-
- /* Look to see if we aleady have an appropriate entry. */
- last_entry = sgot->contents + got_size * g->assigned_gotno;
- for (entry = (sgot->contents + got_size * MIPS_RESERVED_GOTNO);
- entry != last_entry;
- entry += got_size)
- {
- address = bfd_get_64 (abfd, entry);
-
- if (!mips_elf64_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_elf64_create_local_got_entry (abfd, g, sgot, value);
-
- if (offsetp)
- {
- address = bfd_get_64 (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_elf64_got16_entry (abfd, info, value, external)
- bfd *abfd;
- struct bfd_link_info *info;
- bfd_vma value;
- boolean external;
-{
- CONST bfd_vma got_size = get_elf_backend_data (abfd)->s->arch_size / 8;
- asection *sgot;
- struct mips_elf64_got_info *g;
- bfd_byte *entry;
- bfd_byte *last_entry;
- bfd_vma index = 0;
- bfd_vma address;
-
- if (! external)
- {
- /* 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_elf64_high (value) << 16;
- }
-
- g = _mips_elf64_got_info (elf_hash_table (info)->dynobj, &sgot);
-
- /* Look to see if we already have an appropriate entry. */
- last_entry = sgot->contents + got_size * g->assigned_gotno;
- for (entry = (sgot->contents + got_size * MIPS_RESERVED_GOTNO);
- entry != last_entry;
- entry += got_size)
- {
- address = bfd_get_64 (abfd, entry);
- if (address == value)
- {
- /* This entry has the right high-order 16 bits, and the low-order
- 16 bits are set to zero. */
- index = entry - sgot->contents;
- break;
- }
- }
-
- /* If we didn't have an appropriate entry, we create one now. */
- if (entry == last_entry)
- index = mips_elf64_create_local_got_entry (abfd, g, sgot, value);
-
- return index;
-}
-
-/* Return whether a relocation is against a local symbol. */
-
-static boolean
-mips_elf64_local_relocation_p (input_bfd, relocation, local_sections,
- check_forced)
- bfd *input_bfd;
- const Elf_Internal_Rela *relocation;
- asection **local_sections;
- boolean check_forced;
-{
- unsigned long r_symndx;
- Elf_Internal_Shdr *symtab_hdr;
- struct mips_elf64_link_hash_entry* h;
- size_t extsymoff;
-
- r_symndx = ELF64_R_SYM (relocation->r_info);
- symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
- extsymoff = (elf_bad_symtab (input_bfd)) ? 0 : symtab_hdr->sh_info;
-
- if (r_symndx < extsymoff)
- return true;
- if (elf_bad_symtab (input_bfd) && local_sections[r_symndx] != NULL)
- return true;
-
- if (check_forced)
- {
- /* Look up the hash table to check whether the symbol
- was forced local. */
- h = (struct mips_elf64_link_hash_entry *)
- elf_sym_hashes (input_bfd) [r_symndx - extsymoff];
- /* Find the real hash-table entry for this symbol. */
- while (h->root.root.type == bfd_link_hash_indirect
- || h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link;
- if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
- return true;
- }
-
- return false;
-}
-
-/* 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_elf64_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 (ELF64_MIPS_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
- dynamic relocation. The ADDENDP is adjusted if necessary; the
- caller should store the result in place of the original addend. */
-
-static boolean
-mips_elf64_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_elf64_link_hash_entry *h;
- asection *sec;
- bfd_vma symbol;
- bfd_vma *addendp;
- asection *input_section;
-{
- Elf_Internal_Rel outrel[3];
- boolean skip;
- asection *sreloc;
- bfd *dynobj;
- int r_type;
-
- r_type = ELF64_MIPS_R_TYPE (rel->r_info);
- dynobj = elf_hash_table (info)->dynobj;
- sreloc = bfd_get_section_by_name (dynobj, ".rel.dyn");
- BFD_ASSERT (sreloc != NULL);
- BFD_ASSERT (sreloc->contents != NULL);
- BFD_ASSERT ((sreloc->reloc_count
- * get_elf_backend_data (output_bfd)->s->sizeof_rel)
- < sreloc->_raw_size);
-
- skip = false;
- outrel[0].r_offset = _bfd_elf_section_offset (output_bfd, info,
- input_section,
- rel[0].r_offset);
- /* FIXME: For -2 runtime relocation needs to be skipped, but
- properly resolved statically and installed. */
- BFD_ASSERT (outrel[0].r_offset != (bfd_vma) -2);
-
- /* 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)->sec_info_type != ELF_INFO_TYPE_STABS)
- {
- outrel[1].r_offset = rel[1].r_offset;
- outrel[2].r_offset = rel[2].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[1].r_offset = outrel[0].r_offset;
- outrel[2].r_offset = outrel[0].r_offset;
- /* If we didn't need the relocation at all, this value will be
- -1. */
- if (outrel[0].r_offset == (bfd_vma) -1)
- skip = true;
- }
-
- /* If we've decided to skip this relocation, just output an empty
- 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 (Elf_Internal_Rel) * 3);
- 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;
- /* h->root.dynindx may be -1 if this symbol was marked to
- become local. */
- if (indx == -1)
- indx = 0;
- }
- 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 += section_offset;
- /* Now, the relocation is just against the section. */
- symbol = sec->output_section->vma;
- }
-
- /* If the relocation was previously an absolute relocation and
- this symbol will not be referred to by the relocation, we must
- adjust it by the value we give it in the dynamic symbol table.
- Otherwise leave the job up to the dynamic linker. */
- if (!indx && 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[0].r_info = ELF64_R_INFO (indx, R_MIPS_REL32);
-
- /* Adjust the output offset of the relocation to reference the
- correct location in the output file. */
- outrel[0].r_offset += (input_section->output_section->vma
- + input_section->output_offset);
- outrel[1].r_offset += (input_section->output_section->vma
- + input_section->output_offset);
- outrel[2].r_offset += (input_section->output_section->vma
- + input_section->output_offset);
- }
-
- /* Put the relocation back out. */
- mips_elf64_be_swap_reloc_out (output_bfd, outrel,
- (sreloc->contents
- + sreloc->reloc_count
- * sizeof (Elf64_Mips_External_Rel)));
-
- /* 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;
-
- 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_elf64_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_elf64_link_hash_entry* h = NULL;
- /* True if the symbol referred to by this relocation is a local
- symbol. */
- boolean local_p;
- 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 = ELF64_R_SYM (relocation->r_info);
- r_type = ELF64_MIPS_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_elf64_local_relocation_p (input_bfd, relocation,
- local_sections, false);
- 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_elf64_link_hash_entry *)
- elf_sym_hashes (input_bfd) [r_symndx - extsymoff]);
- /* Find the real hash-table entry for this symbol. */
- while (h->root.root.type == bfd_link_hash_indirect
- || h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link;
-
- /* Record the name of this symbol, for our caller. */
- *namep = h->root.root.root.string;
-
- /* If this symbol is defined, calculate its address. */
- 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->allow_shlib_undefined)
- && !info->no_undefined
- && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT)
- symbol = 0;
- else if (strcmp (h->root.root.root.string, "_DYNAMIC_LINK") == 0 ||
- strcmp (h->root.root.root.string, "_DYNAMIC_LINKING") == 0)
- {
- /* If this is a dynamic link, we should have created a
- _DYNAMIC_LINK symbol or _DYNAMIC_LINKING(for normal mips) symbol
- in in mips_elf64_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 64-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_elf64_stub_section_p (input_bfd, input_section))
- {
- /* This is a 64-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 64-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));
-
- local_p = mips_elf64_local_relocation_p (input_bfd, relocation,
- local_sections, true);
-
- /* 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_elf64_global_got_index (elf_hash_table (info)->dynobj,
- (struct elf_link_hash_entry*) h);
- if (! elf_hash_table(info)->dynamic_sections_created
- || (info->shared
- && (info->symbolic || h->root.dynindx == -1)
- && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
- {
- /* This is a static link or a -Bsymbolic link. The
- symbol is defined locally, or was forced to be local.
- We must initialize this entry in the GOT. */
- bfd *tmpbfd = elf_hash_table (info)->dynobj;
-
- asection *sgot = bfd_get_section_by_name (tmpbfd, ".got");
- bfd_put_64 (tmpbfd, symbol + addend, sgot->contents + g);
- }
- }
- else if (r_type == R_MIPS_GOT16 || r_type == R_MIPS_CALL16)
- /* 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_elf64_local_got_index (abfd, info, symbol + addend);
- if (g == (bfd_vma) -1)
- return false;
- }
-
- /* Convert GOT indices to actual offsets. */
- g = mips_elf64_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_elf64_sign_extend (addend, 16);
- overflowed_p = mips_elf64_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_DYNAMIC) != 0)
- && ((h->root.elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)))
- && r_symndx != 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_elf64_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_elf64_sign_extend (addend << 2, 18) - p;
- overflowed_p = mips_elf64_overflow_p (value, 18);
- value = (value >> 2) & howto->dst_mask;
- break;
-
- case R_MIPS_GNU_REL_HI16:
- value = mips_elf64_high (addend + symbol - p);
- value &= howto->dst_mask;
- break;
-
- case R_MIPS16_26:
- /* The calculation for R_MIPS16_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 + 4) & 0xf0000000)) + symbol) >> 2;
- else
- value = (mips_elf64_sign_extend (addend << 2, 28) + symbol) >> 2;
- value &= howto->dst_mask;
- break;
-
- case R_MIPS_HI16:
- value = mips_elf64_high (addend + symbol);
- value &= howto->dst_mask;
- break;
-
- case R_MIPS_LO16:
- value = (addend + symbol) & 0xffff;
- value &= howto->dst_mask;
- 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_MIPS_GPREL16:
- if (local_p)
- value = mips_elf64_sign_extend (addend, 16) + symbol + gp0 - gp;
- else
- value = mips_elf64_sign_extend (addend, 16) + symbol - gp;
- overflowed_p = mips_elf64_overflow_p (value, 16);
- break;
-
- case R_MIPS_PC16:
- value = mips_elf64_sign_extend (addend, 16) + symbol - p;
- overflowed_p = mips_elf64_overflow_p (value, 16);
- value = (bfd_vma) ((bfd_signed_vma) value / 4);
- break;
-
- case R_MIPS_GOT16:
- case R_MIPS_CALL16:
- if (local_p)
- {
- boolean forced;
-
- /* The special case is when the symbol is forced to be local. We
- need the full address in the GOT since no R_MIPS_LO16 relocation
- follows. */
- forced = ! mips_elf64_local_relocation_p (input_bfd, relocation,
- local_sections, false);
- value = mips_elf64_got16_entry (abfd, info, symbol + addend, forced);
- if (value == (bfd_vma) -1)
- return false;
- value
- = mips_elf64_got_offset_from_index (elf_hash_table (info)->dynobj,
- abfd,
- value);
- overflowed_p = mips_elf64_overflow_p (value, 16);
- break;
- }
-
- /* Fall through. */
-
- case R_MIPS_GOT_DISP:
- value = g;
- overflowed_p = mips_elf64_overflow_p (value, 16);
- break;
-
- case R_MIPS_GPREL32:
- value = (addend + symbol + gp0 - gp) & howto->dst_mask;
- 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_elf64_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_elf64_got_page (abfd, info, symbol + addend, NULL);
- if (value == (bfd_vma) -1)
- return false;
- value = mips_elf64_got_offset_from_index (elf_hash_table (info)->dynobj,
- abfd,
- value);
- overflowed_p = mips_elf64_overflow_p (value, 16);
- break;
-
- case R_MIPS_GOT_OFST:
- mips_elf64_got_page (abfd, info, symbol + addend, &value);
- overflowed_p = mips_elf64_overflow_p (value, 16);
- break;
-
- case R_MIPS_SUB:
- value = symbol - addend;
- value &= howto->dst_mask;
- break;
-
- case R_MIPS_HIGHER:
- value = mips_elf64_higher (addend + symbol);
- value &= howto->dst_mask;
- break;
-
- case R_MIPS_HIGHEST:
- value = mips_elf64_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_elf64_obtain_contents (howto, relocation, input_bfd, contents)
- reloc_howto_type *howto;
- const Elf_Internal_Rela *relocation;
- bfd *input_bfd;
- bfd_byte *contents;
-{
- bfd_byte *location = contents + relocation->r_offset;
-
- /* Obtain the bytes. */
- return bfd_get (8 * bfd_get_reloc_size (howto), input_bfd, location);
-}
-
-/* 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_elf64_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_elf64_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 + 4) & 0xf0000000) + S) >> 2)
- When producing a fully linked file, the calculation is
- let R = (((A < 2) | ((P + 4) & 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_archive_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_elf64_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 ELF64 section. */
-
-static boolean
-mips_elf64_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 = ELF64_MIPS_R_TYPE (rel->r_info);
- const char *msg = (const char *) NULL;
-
- /* Find the relocation howto for this relocation. */
- howto = &mips_elf64_howto_table_rela[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)
- >= (NUM_SHDR_ENTRIES (rel_hdr) * bed->s->int_rels_per_ext_rel))
- rel_hdr = elf_section_data (input_section)->rel_hdr2;
- if (rel_hdr->sh_entsize
- == (get_elf_backend_data (input_bfd)->s->sizeof_rel))
- {
- /* Note that this is a REL relocation. */
- rela_relocation_p = false;
-
- /* Find the relocation howto for this relocation. */
- howto = &mips_elf64_howto_table_rel[r_type];
-
- /* Get the addend, which is stored in the input file. */
- addend = mips_elf64_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_elf64_local_relocation_p (input_bfd, rel,
- local_sections, false)))
- {
- 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_elf64_next_relocation (lo, rel, relend);
- if (lo16_relocation == NULL)
- return false;
-
- /* Obtain the addend kept there. */
- if (rela_relocation_p == false)
- lo16_howto = &mips_elf64_howto_table_rel[lo];
- else
- lo16_howto = &mips_elf64_howto_table_rela[lo];
- l = mips_elf64_obtain_contents (lo16_howto,
- lo16_relocation,
- input_bfd, contents);
- l &= lo16_howto->src_mask;
- l = mips_elf64_sign_extend (l, 16);
-
- addend <<= 16;
-
- /* Compute the combined addend. */
- addend += l;
- }
- }
- else
- addend = rel->r_addend;
- }
-
- if (info->relocateable)
- {
- Elf_Internal_Sym *sym;
- unsigned long r_symndx;
-
- /* 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_elf64_local_relocation_p (input_bfd, rel, local_sections,
- false))
- /* There's nothing to do for non-local relocations. */
- continue;
-
- if (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_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 = ELF64_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 0
- /* 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_elf64_high (addend);
- else if (r_type == R_MIPS_HIGHER)
- addend = mips_elf64_higher (addend);
- else if (r_type == R_MIPS_HIGHEST)
- addend = mips_elf64_highest (addend);
-#endif
- /* 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. */
- if (r_type == R_MIPS_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 (!mips_elf64_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
- && ELF64_MIPS_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_elf64_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_elf64_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:
- msg = _("internal error: unsupported relocation error");
- info->callbacks->warning
- (info, msg, name, input_bfd, input_section, rel->r_offset);
- return false;
-
- 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;
- }
-
- /* Actually perform the relocation. */
- if (!mips_elf64_perform_relocation (info, howto, rel, value, input_bfd,
- input_section, contents,
- require_jalx))
- return false;
- }
-
- return true;
-}
-
-/* Create dynamic sections when linking against a dynamic object. */
-
-boolean
-mips_elf64_create_dynamic_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- flagword flags;
- register asection *s;
-
- 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_elf64_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 (!mips_elf64_create_msym_section (abfd))
- return false;
-
- /* Create .stub section. */
- if (bfd_get_section_by_name (abfd, ".MIPS.stubs") == NULL)
- {
- s = bfd_make_section (abfd, ".MIPS.stubs");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_CODE)
- || ! bfd_set_section_alignment (abfd, s, 3))
- return false;
- }
-
- 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
-mips_elf64_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
-{
- bfd *dynobj;
- struct mips_elf64_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_elf64_link_hash_entry *) h;
- if (! info->relocateable
- && hmips->possibly_dynamic_relocs != 0
- && (h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
- {
- mips_elf64_allocate_dynamic_relocations (dynobj,
- hmips->possibly_dynamic_relocs);
- if (hmips->readonly_reloc)
- /* We tell the dynamic linker that there are relocations
- against the text segment. */
- info->flags |= DF_TEXTREL;
- }
-
- /* For a function, create a stub, if allowed. */
- if (! hmips->no_fn_stub
- && (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.stubs");
- 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;
- }
- }
- else if ((h->type == STT_FUNC)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0)
- {
- /* This will set the entry for this symbol in the GOT to 0, and
- the dynamic linker will take care of this. */
- h->root.u.def.value = 0;
- 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. */
-
-boolean
-mips_elf64_always_size_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
-{
- if (info->relocateable
- || ! mips_elf64_hash_table (info)->mips16_stubs_seen)
- return true;
-
- mips_elf64_link_hash_traverse (mips_elf64_hash_table (info),
- mips_elf64_check_mips16_stubs,
- (PTR) NULL);
-
- return true;
-}
-
-/* Check the mips16 stubs for a particular symbol, and see if we can
- discard them. */
-
-static boolean
-mips_elf64_check_mips16_stubs (h, data)
- struct mips_elf64_link_hash_entry *h;
- PTR data ATTRIBUTE_UNUSED;
-{
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link;
-
- 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
-mips_elf64_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
-{
- bfd *dynobj;
- asection *s;
- boolean reltext;
- struct mips_elf64_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 ("/usr/lib64/libc.so.1") + 1;
- s->contents = (bfd_byte *) "/usr/lib64/libc.so.1";
- }
- }
-
- /* 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, "rel.dyn") == 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, "rel.dyn") != 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;
- bfd *sub;
-
- BFD_ASSERT (elf_section_data (s) != NULL);
- g = (struct mips_elf64_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;
- /* 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 * 8;
-
- /* 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_elf64_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 * 8;
- }
- else if (strcmp (name, ".MIPS.stubs") == 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 (strcmp (name, ".msym")
- == 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)
- {
- /* SGI object has the equivalence of DT_DEBUG in the
- DT_MIPS_RLD_MAP entry. */
- if (!bfd_elf64_add_dynamic_entry (info, DT_MIPS_RLD_MAP, 0))
- return false;
- if (!SGI_COMPAT (output_bfd))
- {
- if (!bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0))
- return false;
- }
- }
- else
- {
- /* Shared libraries on traditional mips have DT_DEBUG. */
- if (!SGI_COMPAT (output_bfd))
- {
- if (!bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0))
- return false;
- }
- }
-
- if (reltext && SGI_COMPAT (output_bfd))
- info->flags |= DF_TEXTREL;
-
- if ((info->flags & DF_TEXTREL) != 0)
- {
- if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
- return false;
- }
-
- if (! bfd_elf64_add_dynamic_entry (info, DT_PLTGOT, 0))
- return false;
-
- if (bfd_get_section_by_name (dynobj, "rel.dyn"))
- {
- if (! bfd_elf64_add_dynamic_entry (info, DT_REL, 0))
- return false;
-
- if (! bfd_elf64_add_dynamic_entry (info, DT_RELSZ, 0))
- return false;
-
- if (! bfd_elf64_add_dynamic_entry (info, DT_RELENT, 0))
- return false;
- }
-
- if (SGI_COMPAT (output_bfd))
- {
- if (!bfd_elf64_add_dynamic_entry (info, DT_MIPS_CONFLICTNO, 0))
- return false;
- }
-
- if (SGI_COMPAT (output_bfd))
- {
- if (!bfd_elf64_add_dynamic_entry (info, DT_MIPS_LIBLISTNO, 0))
- return false;
- }
-
- if (bfd_get_section_by_name (dynobj, ".conflict") != NULL)
- {
- if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_CONFLICT, 0))
- return false;
-
- s = bfd_get_section_by_name (dynobj, ".liblist");
- BFD_ASSERT (s != NULL);
-
- if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_LIBLIST, 0))
- return false;
- }
-
- if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_RLD_VERSION, 0))
- return false;
-
- if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_FLAGS, 0))
- return false;
-
-#if 0
- /* Time stamps in executable files are a bad idea. */
- if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_TIME_STAMP, 0))
- return false;
-#endif
-
-#if 0 /* FIXME */
- if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_ICHECKSUM, 0))
- return false;
-#endif
-
-#if 0 /* FIXME */
- if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_IVERSION, 0))
- return false;
-#endif
-
- if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_BASE_ADDRESS, 0))
- return false;
-
- if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_LOCAL_GOTNO, 0))
- return false;
-
- if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_SYMTABNO, 0))
- return false;
-
- if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_UNREFEXTNO, 0))
- return false;
-
- if (! bfd_elf64_add_dynamic_entry (info, DT_MIPS_GOTSYM, 0))
- return false;
-
- if ((bfd_get_section_by_name(dynobj, ".MIPS.options"))
- && !bfd_elf64_add_dynamic_entry (info, DT_MIPS_OPTIONS, 0))
- return false;
-
- if (bfd_get_section_by_name (dynobj, ".msym")
- && !bfd_elf64_add_dynamic_entry (info, DT_MIPS_MSYM, 0))
- return false;
- }
-
- return true;
-}
-
-/* Finish up dynamic symbol handling. We set the contents of various
- dynamic sections here. */
-
-boolean
-mips_elf64_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_elf64_got_info *g;
- const char *name;
- struct mips_elf64_link_hash_entry *mh;
-
- dynobj = elf_hash_table (info)->dynobj;
- gval = sym->st_value;
- mh = (struct mips_elf64_link_hash_entry *) h;
-
- if (h->plt.offset != (bfd_vma) -1)
- {
- asection *s;
- 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.stubs");
- BFD_ASSERT (s != NULL);
-
- /* FIXME: Can h->dynindex be more than 64K? */
- if (h->dynindx & 0xffff0000)
- return false;
-
- /* Fill the stub. */
- bfd_put_32 (output_bfd, STUB_LW, stub);
- bfd_put_32 (output_bfd, STUB_MOVE, stub + 4);
- bfd_put_32 (output_bfd, STUB_JALR, stub + 8);
- bfd_put_32 (output_bfd, STUB_LI16 + h->dynindx, stub + 12);
-
- 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
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0);
-
- sgot = bfd_get_section_by_name (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- BFD_ASSERT (elf_section_data (sgot) != NULL);
- g = (struct mips_elf64_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.) */
-
- if (info->shared && h->root.type == bfd_link_hash_undefined)
- value = 0;
- else
- value = h->root.u.def.value;
- }
- offset = mips_elf64_global_got_index (dynobj, h);
- bfd_put_64 (output_bfd, value, sgot->contents + offset);
- }
-
- /* Create a .msym entry, if appropriate. */
- smsym = bfd_get_section_by_name (dynobj, ".msym");
- 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);
- mips_elf64_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
- || strcmp (name, "_DYNAMIC_LINKING") == 0)
- {
- sym->st_shndx = SHN_ABS;
- sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
- sym->st_value = 1;
- }
- 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. */
-
- {
- /* 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;
- }
- }
-
- return true;
-}
-
-/* Finish up the dynamic sections. */
-
-boolean
-mips_elf64_finish_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
-{
- bfd *dynobj;
- asection *sdyn;
- asection *sgot;
- struct mips_elf64_got_info *g;
-
- dynobj = elf_hash_table (info)->dynobj;
-
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
-
- sgot = bfd_get_section_by_name (dynobj, ".got");
- if (sgot == NULL)
- g = NULL;
- else
- {
- BFD_ASSERT (elf_section_data (sgot) != NULL);
- g = (struct mips_elf64_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 += get_elf_backend_data (dynobj)->s->sizeof_dyn)
- {
- 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, "rel.dyn");
- BFD_ASSERT (s != NULL);
- dyn.d_un.d_val = get_elf_backend_data (dynobj)->s->sizeof_rel;
- break;
-
- case DT_STRSZ:
- /* Rewrite DT_STRSZ. */
- dyn.d_un.d_val =
- _bfd_elf_strtab_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 = get_elf_backend_data (output_bfd)->s->sizeof_sym;
- 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_OPTIONS:
- s = bfd_get_section_by_name(output_bfd, ".MIPS.options");
- dyn.d_un.d_ptr = s->vma;
- break;
-
- case DT_MIPS_MSYM:
- s = bfd_get_section_by_name(output_bfd, ".msym");
- 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)
- {
- bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents);
- bfd_put_64 (output_bfd, (bfd_vma) 0x80000000, sgot->contents + 8);
- }
-
- if (sgot != NULL)
- elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 8;
-
- {
- asection *smsym;
- asection *s;
-
- /* ??? 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, ".msym");
- 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;
-
- mips_elf64_swap_msym_out
- (output_bfd, &msym,
- (((Elf32_External_Msym *) smsym->contents)
- + dynindx));
- }
- }
-
- /* Clean up a first relocation in .rel.dyn. */
- s = bfd_get_section_by_name (dynobj, "rel.dyn");
- if (s != NULL && s->_raw_size > 0)
- memset (s->contents, 0, get_elf_backend_data (dynobj)->s->sizeof_rel);
- }
-
- return true;
-}
-
-/* Return the section that should be marked against GC for a given
- relocation. */
-
-asection *
-mips_elf64_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 (ELF64_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
- {
- return bfd_section_from_elf_index (abfd, sym->st_shndx);
- }
-
- return NULL;
-}
-
-/* Update the got entry reference counts for the section being removed. */
-
-boolean
-mips_elf64_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 (ELF64_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;
-}
-
-/* Create the .got section to hold the global offset table. */
-
-static boolean
-mips_elf64_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_elf64_got_info *g;
-
- /* This function may be called more than once. */
- if (bfd_get_section_by_name (abfd, ".got"))
- 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_elf64_link_record_dynamic_symbol (info, h))
- return false;
-
- /* The first several global offset table entries are reserved. */
- s->_raw_size = MIPS_RESERVED_GOTNO * (get_elf_backend_data (abfd)->s->arch_size / 8);
-
- g = (struct mips_elf64_got_info *) bfd_alloc (abfd,
- sizeof (struct mips_elf64_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;
-}
-
-/* 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_elf64_record_global_got_symbol (h, info, g)
- struct elf_link_hash_entry *h;
- struct bfd_link_info *info;
- struct mips_elf64_got_info *g ATTRIBUTE_UNUSED;
-{
- /* A global symbol in the GOT must also be in the dynamic symbol
- table. */
- if (h->dynindx == -1
- && !bfd_elf64_link_record_dynamic_symbol (info, h))
- return false;
-
- /* If we've already marked this entry as needing 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. Avoid using zero, as the
- generic ELF copy_indirect_symbol tests for <= 0. */
- h->got.offset = 1;
-
- return true;
-}
-
-/* Returns the .msym section for ABFD, creating it if it does not
- already exist. Returns NULL to indicate error. */
-
-static asection *
-mips_elf64_create_msym_section (abfd)
- bfd *abfd;
-{
- asection *s;
-
- s = bfd_get_section_by_name (abfd, ".msym");
- if (!s)
- {
- s = bfd_make_section (abfd, ".msym");
- 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, 3))
- return NULL;
- }
-
- return s;
-}
-
-/* Add room for N relocations to the .rel.dyn section in ABFD. */
-
-static void
-mips_elf64_allocate_dynamic_relocations (abfd, n)
- bfd *abfd;
- unsigned int n;
-{
- asection *s;
-
- s = bfd_get_section_by_name (abfd, ".rel.dyn");
- BFD_ASSERT (s != NULL);
-
- if (s->_raw_size == 0)
- {
- /* Make room for a null element. */
- s->_raw_size += get_elf_backend_data (abfd)->s->sizeof_rel;
- ++s->reloc_count;
- }
- s->_raw_size += n * get_elf_backend_data (abfd)->s->sizeof_rel;
-}
-
-/* Look through the relocs for a section during the first phase, and
- allocate space in the global offset table. */
-
-boolean
-mips_elf64_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_elf64_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 = ELF64_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_elf64_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 (ELF64_R_SYM (r->r_info) == r_symndx
- && ELF64_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;
- bfd_size_type amt;
-
- if (elf_bad_symtab (abfd))
- symcount = NUM_SHDR_ENTRIES (symtab_hdr);
- else
- symcount = symtab_hdr->sh_info;
- amt = symcount * sizeof (asection *);
- n = (asection **) bfd_zalloc (abfd, amt);
- 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_elf64_link_hash_entry *h;
-
- h = ((struct mips_elf64_link_hash_entry *)
- sym_hashes[r_symndx - extsymoff]);
-
- /* H is the symbol this stub is for. */
-
- h->fn_stub = sec;
- mips_elf64_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_elf64_link_hash_entry *h;
- asection **loc;
-
- /* Look at the relocation information to figure out which symbol
- this is for. */
-
- r_symndx = ELF64_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_elf64_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_elf64_hash_table (info)->mips16_stubs_seen = true;
- }
-
- if (dynobj == NULL)
- {
- sgot = NULL;
- g = NULL;
- }
- else
- {
- sgot = bfd_get_section_by_name (dynobj, ".got");
- if (sgot == NULL)
- g = NULL;
- else
- {
- BFD_ASSERT (elf_section_data (sgot) != NULL);
- g = (struct mips_elf64_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 = ELF64_R_SYM (rel->r_info);
- r_type = ELF64_MIPS_R_TYPE (rel->r_info);
-
- if (r_symndx < extsymoff)
- h = NULL;
- else if (r_symndx >= extsymoff + NUM_SHDR_ENTRIES (symtab_hdr))
- {
- (*_bfd_error_handler)
- (_("%s: Malformed reloc detected for section %s"),
- bfd_archive_filename (abfd), name);
- bfd_set_error (bfd_error_bad_value);
- return false;
- }
- 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_elf64_create_got_section (dynobj, info))
- return false;
- g = _mips_elf64_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 and
- R_MIPS_CALL16. 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 += get_elf_backend_data (dynobj)->s->arch_size / 8;
- }
-
- switch (r_type)
- {
- case R_MIPS_CALL16:
- if (h == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: CALL16 reloc at 0x%lx not against global symbol"),
- bfd_archive_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_elf64_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_elf64_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 = ".rel.dyn";
-
- 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;
- }
- }
-#define MIPS_READONLY_SECTION (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
- 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_elf64_allocate_dynamic_relocations (dynobj, 1);
- if ((sec->flags & MIPS_READONLY_SECTION)
- == MIPS_READONLY_SECTION)
- /* We tell the dynamic linker that there are
- relocations against the text segment. */
- info->flags |= DF_TEXTREL;
- }
- else
- {
- struct mips_elf64_link_hash_entry *hmips;
-
- /* We only need to copy this reloc if the symbol is
- defined in a dynamic object. */
- hmips = (struct mips_elf64_link_hash_entry *) h;
- ++hmips->possibly_dynamic_relocs;
- if ((sec->flags & MIPS_READONLY_SECTION)
- == MIPS_READONLY_SECTION)
- /* We need it to tell the dynamic linker if there
- are relocations against the text segment. */
- hmips->readonly_reloc = true;
- }
-
- /* 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_elf64_record_global_got_symbol (h, info, g))
- return false;
- }
- break;
-
- case R_MIPS_26:
- case R_MIPS_GPREL16:
- case R_MIPS_LITERAL:
- case R_MIPS_GPREL32:
- break;
-
- /* This relocation describes the C++ object vtable hierarchy.
- Reconstruct it for later use during GC. */
- case R_MIPS_GNU_VTINHERIT:
- if (!_bfd_elf64_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_elf64_gc_record_vtentry (abfd, sec, h, rel->r_offset))
- return false;
- break;
-
- default:
- break;
- }
- }
-
- return true;
-}
-
-/* Structure used to pass information to mips_elf64_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_elf64_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_elf64_output_extsym (h, data)
- struct mips_elf64_link_hash_entry *h;
- PTR data;
-{
- struct extsym_info *einfo = (struct extsym_info *) data;
- boolean strip;
- asection *sec, *output_section;
-
- if (h->root.root.type == bfd_link_hash_warning)
- h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link;
-
- 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 (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;
- 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)
- {
- struct mips_elf64_link_hash_entry *hd = h;
- boolean no_fn_stub = h->no_fn_stub;
-
- while (hd->root.root.type == bfd_link_hash_indirect)
- {
- hd = (struct mips_elf64_link_hash_entry *)h->root.root.u.i.link;
- no_fn_stub = no_fn_stub || hd->no_fn_stub;
- }
-
- if (!no_fn_stub)
- {
- /* Set type and value for a symbol with a function stub. */
- h->esym.asym.st = stProc;
- sec = hd->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 = (hd->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;
-}
-
-/* Swap an entry in a .gptab section. Note that these routines rely
- on the equivalence of the two elements of the union. */
-
-static void
-mips_elf64_swap_gptab_in (abfd, ex, in)
- bfd *abfd;
- const Elf32_External_gptab *ex;
- Elf32_gptab *in;
-{
- in->gt_entry.gt_g_value = H_GET_32 (abfd, ex->gt_entry.gt_g_value);
- in->gt_entry.gt_bytes = H_GET_32 (abfd, ex->gt_entry.gt_bytes);
-}
-
-static void
-mips_elf64_swap_gptab_out (abfd, in, ex)
- bfd *abfd;
- const Elf32_gptab *in;
- Elf32_External_gptab *ex;
-{
- H_PUT_32 (abfd, (bfd_vma) in->gt_entry.gt_g_value,
- ex->gt_entry.gt_g_value);
- H_PUT_32 (abfd, (bfd_vma) in->gt_entry.gt_bytes,
- ex->gt_entry.gt_bytes);
-}
-
-/* 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 .mdebug section.
- We need to merge all instances of this section together, not write
- them all out sequentially. */
-
-boolean
-mips_elf64_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
-{
- asection **secpp;
- asection *o;
- struct bfd_link_order *p;
- asection *mdebug_sec, *gptab_data_sec, *gptab_bss_sec;
- 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;
- asection *s;
- EXTR esym;
- unsigned int i;
- static const char * const secname[] =
- { ".text", ".init", ".fini", ".data",
- ".rodata", ".sdata", ".sbss", ".bss" };
- static const int sc[] = { scText, scInit, scFini, scData,
- scRData, scSData, scSBss, scBss };
-
- /* 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_elf64_got_info *g;
-
- /* When we resort, we must tell mips_elf64_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_elf64_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_elf64_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);
- }
-
- /* We include .MIPS.options, even though we don't process it quite right.
- (Some entries are supposed to be merged.) At IRIX6 empirically we seem
- to be better off including it than not. */
- for (secpp = &abfd->sections; *secpp != NULL; secpp = &(*secpp)->next)
- {
- if (strcmp ((*secpp)->name, ".MIPS.options") == 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;
- bfd_section_list_remove (abfd, secpp);
- --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 = MINUS_ONE;
-
- /* Find the GP-relative section with the lowest offset. */
- for (o = abfd->sections; o != 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 + 0x7ff0);
- }
- 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 .mdebug information. */
- 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, ".mdebug") == 0)
- {
- struct extsym_info einfo;
- bfd_vma last;
-
- /* 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;
-
- 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 < sizeof (secname) / sizeof (secname[0]); i++)
- {
- esym.asym.sc = sc[i];
- s = bfd_get_section_by_name (abfd, secname[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,
- secname[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_elf64_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_elf64_link_hash_lookup (mips_elf64_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;
- }
-
- /* Build the external symbol information. */
- einfo.abfd = abfd;
- einfo.info = info;
- einfo.debug = &debug;
- einfo.swap = swap;
- einfo.failed = false;
- mips_elf64_link_hash_traverse (mips_elf64_hash_table (info),
- mips_elf64_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)
- ;
- bfd_section_list_remove (abfd, secpp);
- --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_archive_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;
- }
-
- mips_elf64_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++)
- mips_elf64_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 (!bfd_elf64_bfd_final_link (abfd, info))
- return false;
-
- /* Now write out the computed sections. */
- 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;
- }
-
- 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 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_info_to_howto mips_elf64_info_to_howto_rela
-#define elf_info_to_howto_rel mips_elf64_info_to_howto_rel
-#define elf_backend_object_p _bfd_mips_elf_object_p
-#define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
-#define elf_backend_section_processing _bfd_mips_elf_section_processing
-#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_add_symbol_hook _bfd_mips_elf_add_symbol_hook
-#define elf_backend_link_output_symbol_hook \
- _bfd_mips_elf_link_output_symbol_hook
-#define elf_backend_create_dynamic_sections \
- mips_elf64_create_dynamic_sections
-#define elf_backend_check_relocs mips_elf64_check_relocs
-#define elf_backend_adjust_dynamic_symbol \
- mips_elf64_adjust_dynamic_symbol
-#define elf_backend_always_size_sections \
- mips_elf64_always_size_sections
-#define elf_backend_size_dynamic_sections \
- mips_elf64_size_dynamic_sections
-#define elf_backend_relocate_section mips_elf64_relocate_section
-#define elf_backend_finish_dynamic_symbol \
- mips_elf64_finish_dynamic_symbol
-#define elf_backend_finish_dynamic_sections \
- mips_elf64_finish_dynamic_sections
-#define elf_backend_final_write_processing \
- _bfd_mips_elf_final_write_processing
-#define elf_backend_additional_program_headers \
- mips_elf64_additional_program_headers
-#define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
-#define elf_backend_gc_mark_hook mips_elf64_gc_mark_hook
-#define elf_backend_gc_sweep_hook mips_elf64_gc_sweep_hook
-#define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap
-#define elf_backend_size_info mips_elf64_size_info
-
-#define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO)
-#define elf_backend_plt_header_size 0
-
-/* MIPS ELF64 can use a mixture of REL and RELA, but some Relocations
- * work better/work only in RELA, so we default to this. */
-#define elf_backend_may_use_rel_p 1
-#define elf_backend_may_use_rela_p 1
-#define elf_backend_default_use_rela_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 \
- mips_elf64_link_hash_table_create
-#define bfd_elf64_bfd_final_link mips_elf64_final_link
-#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
-extern boolean bfd_elf64_archive_slurp_armap
- PARAMS((bfd *));
-extern boolean bfd_elf64_archive_write_armap
- PARAMS((bfd *, unsigned int, struct orl *, unsigned int, int));
-#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_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
-
-/* The SGI style (n)64 NewABI. */
-#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"
-
-#include "elf64-target.h"
-
-#define INCLUDED_TARGET_FILE /* More a type of flag. */
-
-/* The SYSV-style 'traditional' (n)64 NewABI. */
-#undef TARGET_LITTLE_SYM
-#undef TARGET_LITTLE_NAME
-#undef TARGET_BIG_SYM
-#undef TARGET_BIG_NAME
-
-#define TARGET_LITTLE_SYM bfd_elf64_tradlittlemips_vec
-#define TARGET_LITTLE_NAME "elf64-tradlittlemips"
-#define TARGET_BIG_SYM bfd_elf64_tradbigmips_vec
-#define TARGET_BIG_NAME "elf64-tradbigmips"
-
-/* Include the target file again for this target. */
-#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/mipsbsd.c b/contrib/binutils/bfd/mipsbsd.c
deleted file mode 100644
index 85cf0ef..0000000
--- a/contrib/binutils/bfd/mipsbsd.c
+++ /dev/null
@@ -1,487 +0,0 @@
-/* BFD backend for MIPS BSD (a.out) binaries.
- Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001
- 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'
-
-/* Do not "beautify" the CONCAT* macro args. Traditional C will not
- remove whitespace added here, and thus will fail to concatenate
- the tokens. */
-#define MY(OP) CONCAT2 (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, unsigned long 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 CONCAT2
- 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 bfd_reloc_status_type mips_fix_jmp_addr
- PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *,
- bfd *, char **));
-static reloc_howto_type *MY(reloc_howto_type_lookup)
- PARAMS ((bfd *, bfd_reloc_code_real_type));
-
-long MY(canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
-
-static void
-MY(set_arch_mach) (abfd, machtype)
- bfd *abfd;
- unsigned long machtype;
-{
- enum bfd_architecture arch;
- unsigned int 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,
- error_message)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *reloc_entry;
- struct symbol_cache_entry *symbol;
- PTR data ATTRIBUTE_UNUSED;
- asection *input_section;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- 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 c78726d..0000000
--- a/contrib/binutils/bfd/pe-mips.c
+++ /dev/null
@@ -1,998 +0,0 @@
-/* BFD back-end for MIPS PE COFF files.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001 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
-
-static boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
-static reloc_howto_type * coff_mips_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void mips_swap_reloc_in PARAMS ((bfd *, PTR, PTR));
-static unsigned int mips_swap_reloc_out PARAMS ((bfd *, PTR, PTR));
-static boolean coff_pe_mips_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- struct internal_reloc *, struct internal_syment *, asection **));
-
-#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, (bfd_vma) x, addr);
- }
- break;
-
- case 2:
- {
- long x = bfd_get_32 (abfd, addr);
- DOIT (x);
- bfd_put_32 (abfd, (bfd_vma) 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_GPREL16:
- 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 = H_GET_32 (abfd, reloc_src->r_vaddr);
- reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx);
- reloc_dst->r_type = H_GET_16 (abfd, 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 */
- H_PUT_32 (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
- H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
- H_PUT_16 (abfd, MIPS_R_PAIR, reloc_dst->r_type);
- return RELSZ;
- }
- break;
- }
-
- H_PUT_32 (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
- H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
-
- H_PUT_16 (abfd, reloc_src->r_type, 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_archive_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_archive_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_archive_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_archive_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/binutils/rcparse.c b/contrib/binutils/binutils/rcparse.c
deleted file mode 100644
index 9add78f..0000000
--- a/contrib/binutils/binutils/rcparse.c
+++ /dev/null
@@ -1,3447 +0,0 @@
-/* A Bison parser, made from rcparse.y
- by GNU bison 1.35. */
-
-#define YYBISON 1 /* Identify Bison output. */
-
-# define BEG 257
-# define END 258
-# define ACCELERATORS 259
-# define VIRTKEY 260
-# define ASCII 261
-# define NOINVERT 262
-# define SHIFT 263
-# define CONTROL 264
-# define ALT 265
-# define BITMAP 266
-# define CURSOR 267
-# define DIALOG 268
-# define DIALOGEX 269
-# define EXSTYLE 270
-# define CAPTION 271
-# define CLASS 272
-# define STYLE 273
-# define AUTO3STATE 274
-# define AUTOCHECKBOX 275
-# define AUTORADIOBUTTON 276
-# define CHECKBOX 277
-# define COMBOBOX 278
-# define CTEXT 279
-# define DEFPUSHBUTTON 280
-# define EDITTEXT 281
-# define GROUPBOX 282
-# define LISTBOX 283
-# define LTEXT 284
-# define PUSHBOX 285
-# define PUSHBUTTON 286
-# define RADIOBUTTON 287
-# define RTEXT 288
-# define SCROLLBAR 289
-# define STATE3 290
-# define USERBUTTON 291
-# define BEDIT 292
-# define HEDIT 293
-# define IEDIT 294
-# define FONT 295
-# define ICON 296
-# define LANGUAGE 297
-# define CHARACTERISTICS 298
-# define VERSIONK 299
-# define MENU 300
-# define MENUEX 301
-# define MENUITEM 302
-# define SEPARATOR 303
-# define POPUP 304
-# define CHECKED 305
-# define GRAYED 306
-# define HELP 307
-# define INACTIVE 308
-# define MENUBARBREAK 309
-# define MENUBREAK 310
-# define MESSAGETABLE 311
-# define RCDATA 312
-# define STRINGTABLE 313
-# define VERSIONINFO 314
-# define FILEVERSION 315
-# define PRODUCTVERSION 316
-# define FILEFLAGSMASK 317
-# define FILEFLAGS 318
-# define FILEOS 319
-# define FILETYPE 320
-# define FILESUBTYPE 321
-# define BLOCKSTRINGFILEINFO 322
-# define BLOCKVARFILEINFO 323
-# define VALUE 324
-# define BLOCK 325
-# define MOVEABLE 326
-# define FIXED 327
-# define PURE 328
-# define IMPURE 329
-# define PRELOAD 330
-# define LOADONCALL 331
-# define DISCARDABLE 332
-# define NOT 333
-# define QUOTEDSTRING 334
-# define STRING 335
-# define NUMBER 336
-# define SIZEDSTRING 337
-# define IGNORED_TOKEN 338
-# define NEG 339
-
-#line 1 "rcparse.y"
- /* rcparse.y -- parser for Windows rc files
- Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
- Written by Ian Lance Taylor, Cygnus Support.
-
- 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 is a parser for Windows rc files. It is based on the parser
- by Gunther Ebert <gunther.ebert@ixos-leipzig.de>. */
-
-#include "bfd.h"
-#include "bucomm.h"
-#include "libiberty.h"
-#include "windres.h"
-#include "safe-ctype.h"
-
-/* The current language. */
-
-static unsigned short language;
-
-/* The resource information during a sub statement. */
-
-static struct res_res_info sub_res_info;
-
-/* Dialog information. This is built by the nonterminals styles and
- controls. */
-
-static struct dialog dialog;
-
-/* This is used when building a style. It is modified by the
- nonterminal styleexpr. */
-
-static unsigned long style;
-
-/* These are used when building a control. They are set before using
- control_params. */
-
-static unsigned long base_style;
-static unsigned long default_style;
-static unsigned long class;
-
-
-#line 58 "rcparse.y"
-#ifndef YYSTYPE
-typedef union
-{
- struct accelerator acc;
- struct accelerator *pacc;
- struct dialog_control *dialog_control;
- struct menuitem *menuitem;
- struct
- {
- struct rcdata_item *first;
- struct rcdata_item *last;
- } rcdata;
- struct rcdata_item *rcdata_item;
- struct stringtable_data *stringtable;
- struct fixed_versioninfo *fixver;
- struct ver_info *verinfo;
- struct ver_stringinfo *verstring;
- struct ver_varinfo *vervar;
- struct res_id id;
- struct res_res_info res_info;
- struct
- {
- unsigned short on;
- unsigned short off;
- } memflags;
- struct
- {
- unsigned long val;
- /* Nonzero if this number was explicitly specified as long. */
- int dword;
- } i;
- unsigned long il;
- unsigned short is;
- const char *s;
- struct
- {
- unsigned long length;
- const char *s;
- } ss;
-} yystype;
-# define YYSTYPE yystype
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-
-
-
-#define YYFINAL 483
-#define YYFLAG -32768
-#define YYNTBASE 99
-
-/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
-#define YYTRANSLATE(x) ((unsigned)(x) <= 339 ? yytranslate[x] : 189)
-
-/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
-static const char yytranslate[] =
-{
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 92, 87, 2,
- 97, 98, 90, 88, 95, 89, 2, 91, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 96, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 86, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 85, 2, 93, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
- 76, 77, 78, 79, 80, 81, 82, 83, 84, 94
-};
-
-#if YYDEBUG
-static const short yyprhs[] =
-{
- 0, 0, 1, 4, 7, 10, 13, 16, 19, 22,
- 25, 28, 31, 34, 37, 40, 43, 46, 53, 54,
- 57, 60, 65, 67, 69, 71, 75, 78, 80, 82,
- 84, 86, 88, 90, 95, 100, 101, 115, 116, 130,
- 131, 146, 147, 151, 152, 156, 160, 164, 168, 172,
- 178, 185, 193, 202, 206, 210, 215, 219, 220, 223,
- 224, 228, 229, 233, 234, 238, 239, 243, 244, 248,
- 249, 253, 265, 278, 291, 305, 306, 310, 311, 315,
- 316, 320, 321, 325, 326, 330, 337, 346, 357, 369,
- 370, 374, 375, 379, 380, 384, 385, 389, 390, 394,
- 395, 399, 400, 404, 405, 409, 410, 414, 415, 432,
- 440, 450, 461, 462, 464, 467, 468, 472, 473, 477,
- 478, 482, 483, 487, 492, 497, 501, 508, 509, 512,
- 517, 520, 527, 528, 532, 535, 537, 539, 541, 543,
- 545, 547, 554, 555, 558, 561, 565, 571, 574, 580,
- 587, 595, 605, 610, 617, 618, 621, 622, 624, 626,
- 628, 632, 636, 637, 644, 645, 649, 654, 661, 666,
- 673, 674, 681, 688, 692, 696, 700, 704, 708, 709,
- 718, 726, 727, 733, 734, 738, 740, 742, 744, 747,
- 750, 753, 755, 756, 759, 763, 768, 772, 773, 776,
- 777, 780, 782, 784, 786, 788, 790, 792, 794, 796,
- 798, 800, 803, 807, 812, 814, 818, 819, 821, 824,
- 826, 828, 832, 835, 838, 842, 846, 850, 854, 858,
- 862, 866, 870, 873, 875, 877, 881, 884, 888, 892,
- 896, 900, 904, 908, 912
-};
-static const short yyrhs[] =
-{
- -1, 99, 100, 0, 99, 106, 0, 99, 107, 0,
- 99, 108, 0, 99, 146, 0, 99, 147, 0, 99,
- 148, 0, 99, 149, 0, 99, 154, 0, 99, 157,
- 0, 99, 158, 0, 99, 163, 0, 99, 166, 0,
- 99, 167, 0, 99, 84, 0, 172, 5, 175, 3,
- 101, 4, 0, 0, 101, 102, 0, 103, 186, 0,
- 103, 186, 95, 104, 0, 80, 0, 187, 0, 105,
- 0, 104, 95, 105, 0, 104, 105, 0, 6, 0,
- 7, 0, 8, 0, 9, 0, 10, 0, 11, 0,
- 172, 12, 177, 179, 0, 172, 13, 176, 179, 0,
- 0, 172, 14, 177, 112, 187, 183, 183, 183, 109,
- 113, 3, 114, 4, 0, 0, 172, 15, 177, 112,
- 187, 183, 183, 183, 110, 113, 3, 114, 4, 0,
- 0, 172, 15, 177, 112, 187, 183, 183, 183, 183,
- 111, 113, 3, 114, 4, 0, 0, 16, 96, 184,
- 0, 0, 113, 17, 80, 0, 113, 18, 172, 0,
- 113, 19, 180, 0, 113, 16, 184, 0, 113, 18,
- 80, 0, 113, 41, 184, 95, 80, 0, 113, 41,
- 184, 95, 80, 183, 0, 113, 41, 184, 95, 80,
- 183, 183, 0, 113, 41, 184, 95, 80, 183, 183,
- 183, 0, 113, 46, 172, 0, 113, 44, 184, 0,
- 113, 43, 184, 183, 0, 113, 45, 184, 0, 0,
- 114, 115, 0, 0, 20, 116, 137, 0, 0, 21,
- 117, 137, 0, 0, 22, 118, 137, 0, 0, 38,
- 119, 137, 0, 0, 23, 120, 137, 0, 0, 24,
- 121, 137, 0, 10, 138, 184, 183, 140, 183, 183,
- 183, 183, 182, 139, 0, 10, 138, 184, 183, 140,
- 183, 183, 183, 183, 183, 183, 139, 0, 10, 138,
- 184, 95, 80, 140, 183, 183, 183, 183, 182, 139,
- 0, 10, 138, 184, 95, 80, 140, 183, 183, 183,
- 183, 183, 183, 139, 0, 0, 25, 122, 137, 0,
- 0, 26, 123, 137, 0, 0, 27, 124, 137, 0,
- 0, 28, 125, 137, 0, 0, 39, 126, 137, 0,
- 42, 174, 184, 183, 183, 139, 0, 42, 174, 184,
- 183, 183, 183, 183, 139, 0, 42, 174, 184, 183,
- 183, 183, 183, 142, 182, 139, 0, 42, 174, 184,
- 183, 183, 183, 183, 142, 183, 183, 139, 0, 0,
- 40, 127, 137, 0, 0, 29, 128, 137, 0, 0,
- 30, 129, 137, 0, 0, 31, 130, 137, 0, 0,
- 32, 131, 137, 0, 0, 33, 132, 137, 0, 0,
- 34, 133, 137, 0, 0, 35, 134, 137, 0, 0,
- 36, 135, 137, 0, 0, 37, 80, 95, 184, 95,
- 184, 95, 184, 95, 184, 95, 184, 95, 136, 180,
- 182, 0, 138, 184, 183, 183, 183, 183, 139, 0,
- 138, 184, 183, 183, 183, 183, 144, 182, 139, 0,
- 138, 184, 183, 183, 183, 183, 144, 183, 183, 139,
- 0, 0, 80, 0, 80, 95, 0, 0, 3, 159,
- 4, 0, 0, 95, 141, 180, 0, 0, 95, 143,
- 180, 0, 0, 95, 145, 180, 0, 172, 41, 176,
- 179, 0, 172, 42, 176, 179, 0, 43, 184, 183,
- 0, 172, 46, 175, 3, 150, 4, 0, 0, 150,
- 151, 0, 48, 80, 183, 152, 0, 48, 49, 0,
- 50, 80, 152, 3, 150, 4, 0, 0, 152, 95,
- 153, 0, 152, 153, 0, 51, 0, 52, 0, 53,
- 0, 54, 0, 55, 0, 56, 0, 172, 47, 175,
- 3, 155, 4, 0, 0, 155, 156, 0, 48, 80,
- 0, 48, 80, 183, 0, 48, 80, 183, 183, 182,
- 0, 48, 49, 0, 50, 80, 3, 155, 4, 0,
- 50, 80, 183, 3, 155, 4, 0, 50, 80, 183,
- 183, 3, 155, 4, 0, 50, 80, 183, 183, 183,
- 182, 3, 155, 4, 0, 172, 57, 177, 179, 0,
- 172, 58, 175, 3, 159, 4, 0, 0, 160, 161,
- 0, 0, 162, 0, 83, 0, 185, 0, 162, 95,
- 83, 0, 162, 95, 185, 0, 0, 59, 175, 3,
- 164, 165, 4, 0, 0, 165, 184, 80, 0, 165,
- 184, 95, 80, 0, 172, 172, 175, 3, 159, 4,
- 0, 172, 172, 175, 179, 0, 172, 60, 168, 3,
- 169, 4, 0, 0, 168, 61, 184, 183, 183, 183,
- 0, 168, 62, 184, 183, 183, 183, 0, 168, 63,
- 184, 0, 168, 64, 184, 0, 168, 65, 184, 0,
- 168, 66, 184, 0, 168, 67, 184, 0, 0, 169,
- 68, 3, 71, 3, 170, 4, 4, 0, 169, 69,
- 3, 70, 80, 171, 4, 0, 0, 170, 70, 80,
- 95, 80, 0, 0, 171, 183, 183, 0, 187, 0,
- 81, 0, 80, 0, 80, 95, 0, 81, 95, 0,
- 187, 95, 0, 173, 0, 0, 175, 178, 0, 175,
- 44, 184, 0, 175, 43, 184, 183, 0, 175, 45,
- 184, 0, 0, 176, 178, 0, 0, 177, 178, 0,
- 72, 0, 73, 0, 74, 0, 75, 0, 76, 0,
- 77, 0, 78, 0, 80, 0, 81, 0, 181, 0,
- 79, 181, 0, 180, 85, 181, 0, 180, 85, 79,
- 181, 0, 82, 0, 97, 184, 98, 0, 0, 183,
- 0, 95, 184, 0, 185, 0, 82, 0, 97, 185,
- 98, 0, 93, 185, 0, 89, 185, 0, 185, 90,
- 185, 0, 185, 91, 185, 0, 185, 92, 185, 0,
- 185, 88, 185, 0, 185, 89, 185, 0, 185, 87,
- 185, 0, 185, 86, 185, 0, 185, 85, 185, 0,
- 95, 187, 0, 188, 0, 82, 0, 97, 185, 98,
- 0, 93, 185, 0, 188, 90, 185, 0, 188, 91,
- 185, 0, 188, 92, 185, 0, 188, 88, 185, 0,
- 188, 89, 185, 0, 188, 87, 185, 0, 188, 86,
- 185, 0, 188, 85, 185, 0
-};
-
-#endif
-
-#if YYDEBUG
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const short yyrline[] =
-{
- 0, 154, 156, 157, 158, 159, 160, 161, 162, 163,
- 164, 165, 166, 167, 168, 169, 170, 175, 185, 190,
- 210, 216, 227, 249, 258, 263, 268, 274, 279, 284,
- 288, 292, 296, 304, 316, 328, 328, 354, 354, 381,
- 381, 411, 416, 422, 424, 430, 434, 439, 443, 447,
- 460, 475, 490, 505, 509, 513, 517, 523, 525, 535,
- 535, 546, 546, 556, 556, 566, 566, 579, 579, 589,
- 589, 599, 610, 619, 632, 643, 643, 653, 653, 663,
- 663, 673, 673, 683, 683, 696, 701, 707, 713, 719,
- 719, 732, 732, 742, 742, 752, 752, 762, 762, 772,
- 772, 782, 782, 792, 792, 802, 802, 812, 812, 829,
- 842, 853, 864, 869, 873, 879, 884, 892, 892, 898,
- 898, 904, 904, 912, 924, 937, 946, 956, 961, 977,
- 982, 986, 992, 997, 1001, 1007, 1012, 1016, 1020, 1024,
- 1028, 1036, 1046, 1051, 1067, 1072, 1076, 1080, 1084, 1088,
- 1092, 1096, 1105, 1117, 1130, 1130, 1141, 1147, 1153, 1162,
- 1170, 1179, 1192, 1192, 1198, 1200, 1207, 1219, 1227, 1238,
- 1248, 1255, 1261, 1267, 1272, 1277, 1282, 1287, 1300, 1305,
- 1309, 1315, 1320, 1326, 1331, 1339, 1345, 1360, 1365, 1369,
- 1376, 1382, 1398, 1406, 1412, 1417, 1422, 1431, 1438, 1448,
- 1455, 1466, 1472, 1477, 1482, 1487, 1492, 1497, 1506, 1511,
- 1527, 1532, 1536, 1540, 1546, 1551, 1559, 1564, 1572, 1581,
- 1590, 1595, 1599, 1604, 1609, 1614, 1619, 1624, 1629, 1634,
- 1639, 1644, 1654, 1663, 1674, 1679, 1683, 1688, 1693, 1698,
- 1703, 1708, 1713, 1718, 1723
-};
-#endif
-
-
-#if (YYDEBUG) || defined YYERROR_VERBOSE
-
-/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
-static const char *const yytname[] =
-{
- "$", "error", "$undefined.", "BEG", "END", "ACCELERATORS", "VIRTKEY",
- "ASCII", "NOINVERT", "SHIFT", "CONTROL", "ALT", "BITMAP", "CURSOR",
- "DIALOG", "DIALOGEX", "EXSTYLE", "CAPTION", "CLASS", "STYLE",
- "AUTO3STATE", "AUTOCHECKBOX", "AUTORADIOBUTTON", "CHECKBOX", "COMBOBOX",
- "CTEXT", "DEFPUSHBUTTON", "EDITTEXT", "GROUPBOX", "LISTBOX", "LTEXT",
- "PUSHBOX", "PUSHBUTTON", "RADIOBUTTON", "RTEXT", "SCROLLBAR", "STATE3",
- "USERBUTTON", "BEDIT", "HEDIT", "IEDIT", "FONT", "ICON", "LANGUAGE",
- "CHARACTERISTICS", "VERSIONK", "MENU", "MENUEX", "MENUITEM",
- "SEPARATOR", "POPUP", "CHECKED", "GRAYED", "HELP", "INACTIVE",
- "MENUBARBREAK", "MENUBREAK", "MESSAGETABLE", "RCDATA", "STRINGTABLE",
- "VERSIONINFO", "FILEVERSION", "PRODUCTVERSION", "FILEFLAGSMASK",
- "FILEFLAGS", "FILEOS", "FILETYPE", "FILESUBTYPE", "BLOCKSTRINGFILEINFO",
- "BLOCKVARFILEINFO", "VALUE", "BLOCK", "MOVEABLE", "FIXED", "PURE",
- "IMPURE", "PRELOAD", "LOADONCALL", "DISCARDABLE", "NOT", "QUOTEDSTRING",
- "STRING", "NUMBER", "SIZEDSTRING", "IGNORED_TOKEN", "'|'", "'^'", "'&'",
- "'+'", "'-'", "'*'", "'/'", "'%'", "'~'", "NEG", "','", "'='", "'('",
- "')'", "input", "accelerator", "acc_entries", "acc_entry", "acc_event",
- "acc_options", "acc_option", "bitmap", "cursor", "dialog", "@1", "@2",
- "@3", "exstyle", "styles", "controls", "control", "@4", "@5", "@6",
- "@7", "@8", "@9", "@10", "@11", "@12", "@13", "@14", "@15", "@16",
- "@17", "@18", "@19", "@20", "@21", "@22", "@23", "@24",
- "control_params", "optstringc", "opt_control_data", "control_styleexpr",
- "@25", "icon_styleexpr", "@26", "control_params_styleexpr", "@27",
- "font", "icon", "language", "menu", "menuitems", "menuitem",
- "menuitem_flags", "menuitem_flag", "menuex", "menuexitems",
- "menuexitem", "messagetable", "rcdata", "optrcdata_data", "@28",
- "optrcdata_data_int", "rcdata_data", "stringtable", "@29",
- "string_data", "user", "versioninfo", "fixedverinfo", "verblocks",
- "vervals", "vertrans", "id", "resname", "resref", "suboptions",
- "memflags_move_discard", "memflags_move", "memflag", "file_name",
- "styleexpr", "parennumber", "optcnumexpr", "cnumexpr", "numexpr",
- "sizednumexpr", "cposnumexpr", "posnumexpr", "sizedposnumexpr", 0
-};
-#endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const short yyr1[] =
-{
- 0, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 100, 101, 101,
- 102, 102, 103, 103, 104, 104, 104, 105, 105, 105,
- 105, 105, 105, 106, 107, 109, 108, 110, 108, 111,
- 108, 112, 112, 113, 113, 113, 113, 113, 113, 113,
- 113, 113, 113, 113, 113, 113, 113, 114, 114, 116,
- 115, 117, 115, 118, 115, 119, 115, 120, 115, 121,
- 115, 115, 115, 115, 115, 122, 115, 123, 115, 124,
- 115, 125, 115, 126, 115, 115, 115, 115, 115, 127,
- 115, 128, 115, 129, 115, 130, 115, 131, 115, 132,
- 115, 133, 115, 134, 115, 135, 115, 136, 115, 137,
- 137, 137, 138, 138, 138, 139, 139, 141, 140, 143,
- 142, 145, 144, 146, 147, 148, 149, 150, 150, 151,
- 151, 151, 152, 152, 152, 153, 153, 153, 153, 153,
- 153, 154, 155, 155, 156, 156, 156, 156, 156, 156,
- 156, 156, 157, 158, 160, 159, 161, 161, 162, 162,
- 162, 162, 164, 163, 165, 165, 165, 166, 166, 167,
- 168, 168, 168, 168, 168, 168, 168, 168, 169, 169,
- 169, 170, 170, 171, 171, 172, 172, 173, 173, 173,
- 174, 174, 175, 175, 175, 175, 175, 176, 176, 177,
- 177, 178, 178, 178, 178, 178, 178, 178, 179, 179,
- 180, 180, 180, 180, 181, 181, 182, 182, 183, 184,
- 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
- 185, 185, 186, 187, 188, 188, 188, 188, 188, 188,
- 188, 188, 188, 188, 188
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const short yyr2[] =
-{
- 0, 0, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 6, 0, 2,
- 2, 4, 1, 1, 1, 3, 2, 1, 1, 1,
- 1, 1, 1, 4, 4, 0, 13, 0, 13, 0,
- 14, 0, 3, 0, 3, 3, 3, 3, 3, 5,
- 6, 7, 8, 3, 3, 4, 3, 0, 2, 0,
- 3, 0, 3, 0, 3, 0, 3, 0, 3, 0,
- 3, 11, 12, 12, 13, 0, 3, 0, 3, 0,
- 3, 0, 3, 0, 3, 6, 8, 10, 11, 0,
- 3, 0, 3, 0, 3, 0, 3, 0, 3, 0,
- 3, 0, 3, 0, 3, 0, 3, 0, 16, 7,
- 9, 10, 0, 1, 2, 0, 3, 0, 3, 0,
- 3, 0, 3, 4, 4, 3, 6, 0, 2, 4,
- 2, 6, 0, 3, 2, 1, 1, 1, 1, 1,
- 1, 6, 0, 2, 2, 3, 5, 2, 5, 6,
- 7, 9, 4, 6, 0, 2, 0, 1, 1, 1,
- 3, 3, 0, 6, 0, 3, 4, 6, 4, 6,
- 0, 6, 6, 3, 3, 3, 3, 3, 0, 8,
- 7, 0, 5, 0, 3, 1, 1, 1, 2, 2,
- 2, 1, 0, 2, 3, 4, 3, 0, 2, 0,
- 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 3, 4, 1, 3, 0, 1, 2, 1,
- 1, 3, 2, 2, 3, 3, 3, 3, 3, 3,
- 3, 3, 2, 1, 1, 3, 2, 3, 3, 3,
- 3, 3, 3, 3, 3
-};
-
-/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
- doesn't specify something else to do. Zero means the default is an
- error. */
-static const short yydefact[] =
-{
- 1, 0, 0, 192, 186, 234, 16, 0, 0, 2,
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
- 13, 14, 15, 0, 185, 233, 220, 0, 0, 0,
- 0, 219, 0, 236, 0, 192, 199, 197, 199, 199,
- 197, 197, 192, 192, 199, 192, 170, 192, 0, 0,
- 0, 0, 0, 0, 0, 0, 223, 222, 0, 0,
- 125, 0, 0, 0, 0, 0, 0, 0, 0, 162,
- 0, 0, 0, 201, 202, 203, 204, 205, 206, 207,
- 193, 235, 0, 0, 0, 41, 41, 0, 0, 0,
- 0, 0, 0, 0, 0, 244, 243, 242, 240, 241,
- 237, 238, 239, 221, 218, 231, 230, 229, 227, 228,
- 224, 225, 226, 164, 0, 194, 196, 18, 208, 209,
- 200, 33, 198, 34, 0, 0, 0, 123, 124, 127,
- 142, 152, 154, 178, 0, 0, 0, 0, 0, 0,
- 0, 154, 168, 0, 195, 0, 0, 0, 0, 0,
- 0, 0, 156, 0, 0, 0, 173, 174, 175, 176,
- 177, 0, 163, 0, 17, 22, 19, 0, 23, 42,
- 0, 0, 126, 0, 0, 128, 141, 0, 0, 143,
- 153, 158, 155, 157, 159, 169, 0, 0, 0, 0,
- 167, 165, 0, 0, 20, 0, 0, 130, 0, 132,
- 147, 144, 0, 0, 0, 0, 0, 0, 166, 232,
- 0, 35, 37, 132, 0, 145, 142, 0, 160, 161,
- 0, 0, 171, 172, 27, 28, 29, 30, 31, 32,
- 21, 24, 43, 43, 39, 129, 127, 135, 136, 137,
- 138, 139, 140, 0, 134, 216, 0, 142, 0, 181,
- 183, 0, 26, 0, 0, 43, 0, 133, 146, 217,
- 148, 0, 142, 216, 0, 0, 25, 57, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 57, 0, 131,
- 149, 0, 0, 0, 0, 180, 0, 0, 47, 44,
- 48, 45, 0, 214, 0, 46, 210, 0, 0, 54,
- 56, 53, 0, 57, 150, 142, 179, 0, 184, 36,
- 112, 59, 61, 63, 67, 69, 75, 77, 79, 81,
- 91, 93, 95, 97, 99, 101, 103, 105, 0, 65,
- 83, 89, 0, 58, 211, 0, 0, 0, 55, 38,
- 0, 0, 0, 113, 0, 112, 112, 112, 112, 112,
- 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
- 112, 112, 0, 112, 112, 112, 187, 0, 191, 0,
- 0, 215, 0, 212, 49, 40, 151, 182, 114, 0,
- 60, 0, 62, 64, 68, 70, 76, 78, 80, 82,
- 92, 94, 96, 98, 100, 102, 104, 106, 0, 66,
- 84, 90, 188, 189, 0, 190, 213, 50, 0, 0,
- 0, 0, 0, 51, 0, 117, 0, 0, 0, 115,
- 52, 0, 0, 0, 0, 0, 154, 85, 0, 0,
- 118, 0, 0, 0, 0, 115, 0, 0, 115, 0,
- 116, 119, 86, 216, 0, 216, 121, 109, 216, 0,
- 0, 115, 217, 216, 115, 217, 0, 115, 217, 0,
- 120, 87, 115, 115, 217, 71, 115, 122, 110, 115,
- 0, 88, 73, 115, 72, 111, 0, 74, 107, 0,
- 216, 108, 0, 0
-};
-
-static const short yydefgoto[] =
-{
- 1, 9, 145, 166, 167, 230, 231, 10, 11, 12,
- 232, 233, 255, 125, 253, 287, 333, 345, 346, 347,
- 363, 348, 349, 350, 351, 352, 353, 364, 365, 354,
- 355, 356, 357, 358, 359, 360, 361, 479, 380, 381,
- 427, 416, 422, 443, 450, 448, 456, 13, 14, 15,
- 16, 149, 175, 214, 244, 17, 150, 179, 18, 19,
- 151, 152, 182, 183, 20, 113, 143, 21, 22, 93,
- 153, 264, 265, 23, 368, 369, 32, 84, 83, 80,
- 121, 295, 296, 258, 259, 104, 31, 194, 24, 25
-};
-
-static const short yypact[] =
-{
- -32768, 13, 412,-32768,-32768,-32768,-32768, 412, 412,-32768,
- -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- -32768,-32768,-32768, 111,-32768, 511,-32768, 412, 412, 412,
- -79, 600, 244,-32768, 562,-32768,-32768,-32768,-32768,-32768,
- -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 412, 412,
- 412, 412, 412, 412, 412, 412,-32768,-32768, 576, 412,
- -32768, 412, 412, 412, 412, 412, 412, 412, 412,-32768,
- 412, 412, 412,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- -32768,-32768, 256, 603, 603, 297, 297, 603, 603, 280,
- 337, 603, 345, 100, 231, 607, 613, 567, 172, 172,
- -32768,-32768,-32768,-32768,-32768, 607, 613, 567, 172, 172,
- -32768,-32768,-32768,-32768, -79,-32768,-32768,-32768,-32768,-32768,
- -32768,-32768,-32768,-32768, -60, 63, 63,-32768,-32768,-32768,
- -32768,-32768,-32768,-32768, 412, 412, 412, 412, 412, 412,
- 412,-32768,-32768, 7,-32768, 5, 412, -79, -79, 33,
- 34, 35, 254, 51, -79, -79,-32768,-32768,-32768,-32768,
- -32768, 36,-32768, 60,-32768,-32768,-32768, -38,-32768,-32768,
- -79, -79,-32768, -39, 11,-32768,-32768, 59, 25,-32768,
- -32768,-32768,-32768, 27, 600,-32768, 127, 144, -79, -79,
- -32768,-32768, 74, 63, 87, -79, -79,-32768, -79,-32768,
- -32768, -79, 12, 294, 118, 128, -79, -79,-32768,-32768,
- 700,-32768, -79,-32768, 22, -79,-32768, 14,-32768, 600,
- 194, 121,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- 23,-32768,-32768,-32768,-32768, 309,-32768,-32768,-32768,-32768,
- -32768,-32768,-32768, 661,-32768, -79, 38,-32768, 16,-32768,
- -32768, 700,-32768, 383, 472,-32768, 42,-32768,-32768,-32768,
- -32768, 124,-32768, -79, 10, 4,-32768,-32768, 412, 126,
- 187, 99, 412, 412, 412, 412, 200,-32768, 480,-32768,
- -32768, 125, 204, 207, 135,-32768, -79, 510,-32768,-32768,
- -32768,-32768, 49,-32768, 412, 136,-32768, 133, -79,-32768,
- -32768,-32768, 547,-32768,-32768,-32768,-32768, 134,-32768,-32768,
- 152,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 153,-32768,
- -32768,-32768, 374,-32768,-32768, 140, 112, 157,-32768,-32768,
- 584, 138, 160, 148, 412, 152, 152, 152, 152, 152,
- 152, 152, 152, 152, 152, 152, 152, 152, 152, 152,
- 152, 152, 158, 152, 152, 152, 161, 163,-32768, 412,
- 165,-32768, 49,-32768, -79,-32768,-32768,-32768,-32768, 170,
- -32768, 412,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 412,-32768,
- -32768,-32768,-32768,-32768, -79,-32768,-32768, -79, 123, 183,
- -79, 184, -79, -79, 183,-32768, -79, -79, 412, 17,
- -32768, -79, 99, -79, -79, 190,-32768,-32768, -79, -79,
- 136, -79, -79, 412, 248, 18, -79, -79, 19, 195,
- -32768,-32768,-32768, -79, -79, -79,-32768,-32768, -79, 412,
- 99, 245, -79, -79, 245, -79, 99, 245, -79, 196,
- 136,-32768, 245, 245, -79,-32768, 245, 136,-32768, 245,
- 412,-32768,-32768, 245,-32768,-32768, 201,-32768,-32768, 99,
- 64,-32768, 295,-32768
-};
-
-static const short yypgoto[] =
-{
- -32768,-32768,-32768,-32768,-32768,-32768, -206,-32768,-32768,-32768,
- -32768,-32768,-32768, 212, -85, -259,-32768,-32768,-32768,-32768,
- -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 281, -8,
- -212, -104,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- -32768, 78,-32768, 113, 92,-32768, -204,-32768,-32768,-32768,
- -140,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- -32768,-32768,-32768, -21,-32768,-32768, 350, 139, 175, 475,
- 416, -329, -257, -258, 29, -2, -1,-32768, -122,-32768
-};
-
-
-#define YYLAST 717
-
-
-static const short yytable[] =
-{
- 30, 161, 47, 147, 148, 282, 33, 34, 285, 164,
- 197, 162, 246, 482, 283, 216, 59, 247, 302, 262,
- 426, 426, 426, 168, 252, 236, 56, 57, 58, 224,
- 225, 226, 227, 228, 229, 334, 146, 172, 176, 180,
- 190, 198, 260, 261, 340, 266, 279, 95, 96, 97,
- 98, 99, 100, 101, 102, 185, 2, 193, 281, 60,
- 105, 106, 107, 108, 109, 110, 111, 112, 114, 115,
- 116, 209, 3, 237, 238, 239, 240, 241, 242, 373,
- 284, 173, 177, 174, 178, 165, 177, 5, 178, 26,
- 173, 199, 174, 430, 4, 5, 27, 6, 7, 59,
- 28, 341, 8, 133, 29, 202, 7, 59, 200, 59,
- 8, 59, 59, 441, 446, 406, 35, 243, 251, 186,
- 187, 460, 203, 36, 37, 38, 39, 467, 280, 304,
- 204, 293, 154, 155, 156, 157, 158, 159, 160, 201,
- 191, 163, 376, 144, 169, 5, 294, 205, 254, 336,
- 480, 184, 40, 41, 208, 192, 7, 42, 43, 59,
- 8, 134, 135, 136, 137, 138, 139, 140, 44, 45,
- 278, 46, 177, 177, 178, 178, 170, 171, 292, 87,
- 88, 293, 210, 188, 189, 451, 177, 454, 178, 220,
- 457, 372, 4, 5, 293, 463, 294, 249, 221, 195,
- 196, 250, 219, 414, 7, 26, 289, 305, 8, 294,
- 370, 306, 27, 85, 86, 307, 28, 206, 207, 91,
- 29, 336, 481, 442, 211, 212, 447, 213, 337, 342,
- 215, 217, 343, 362, 141, 222, 223, 374, 371, 461,
- 377, 234, 465, 378, 245, 468, 248, 69, 426, 291,
- 471, 472, 440, 398, 474, 301, 402, 475, 403, 117,
- 405, 477, 66, 67, 68, 408, 288, 290, 4, 5,
- 297, 298, 299, 300, 70, 71, 72, 263, 415, 418,
- 7, 4, 5, 129, 8, 433, 434, 70, 71, 72,
- 449, 470, 335, 7, 286, 483, 478, 8, 126, 70,
- 71, 72, 344, 73, 74, 75, 76, 77, 78, 79,
- 421, 118, 119, 124, 256, 308, 73, 74, 75, 76,
- 77, 78, 79, 70, 71, 72, 235, 338, 73, 74,
- 75, 76, 77, 78, 79, 257, 26, 181, 0, 0,
- 130, 0, 379, 27, 0, 0, 0, 28, 132, 0,
- 0, 29, 73, 74, 75, 76, 77, 78, 79, 0,
- 237, 238, 239, 240, 241, 242, 0, 404, 0, 73,
- 74, 75, 76, 77, 78, 79, 26, 218, 0, 410,
- 70, 71, 72, 27, 0, 82, 267, 28, 70, 71,
- 72, 29, 89, 90, 0, 92, 411, 94, 0, 268,
- 269, 270, 271, 407, 243, 0, 0, 0, 409, 73,
- 74, 75, 76, 77, 78, 79, 425, 73, 74, 75,
- 76, 77, 78, 79, 272, 0, 273, 274, 275, 276,
- 0, 439, 0, 412, 0, 0, 413, 0, 0, 417,
- 0, 419, 420, 0, 0, 423, 424, 459, 428, 0,
- 429, 0, 431, 432, 366, 367, 5, 435, 436, 0,
- 437, 438, 0, 0, 0, 444, 445, 7, 476, 0,
- 0, 8, 452, 453, 455, 277, 0, 458, 0, 0,
- 0, 462, 464, 303, 466, 0, 0, 469, 268, 269,
- 270, 271, 0, 473, 26, 0, 268, 269, 270, 271,
- 123, 27, 0, 127, 128, 28, 0, 131, 0, 29,
- 142, 0, 0, 272, 309, 273, 274, 275, 276, 0,
- 310, 272, 0, 273, 274, 275, 276, 0, 0, 0,
- 311, 312, 313, 314, 315, 316, 317, 318, 319, 320,
- 321, 322, 323, 324, 325, 326, 327, 328, 329, 330,
- 331, 339, 332, 0, 0, 0, 0, 310, 120, 122,
- 120, 120, 122, 122, 0, 0, 120, 311, 312, 313,
- 314, 315, 316, 317, 318, 319, 320, 321, 322, 323,
- 324, 325, 326, 327, 328, 329, 330, 331, 375, 332,
- 0, 0, 0, 0, 310, 0, 48, 49, 50, 51,
- 52, 53, 54, 55, 311, 312, 313, 314, 315, 316,
- 317, 318, 319, 320, 321, 322, 323, 324, 325, 326,
- 327, 328, 329, 330, 331, 0, 332, 382, 383, 384,
- 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
- 395, 396, 397, 0, 399, 400, 401, 61, 62, 63,
- 64, 65, 66, 67, 68, 64, 65, 66, 67, 68,
- 81, 61, 62, 63, 64, 65, 66, 67, 68, 0,
- 0, 0, 0, 0, 103, 73, 74, 75, 76, 77,
- 78, 79, 0, 118, 119, 61, 62, 63, 64, 65,
- 66, 67, 68, 62, 63, 64, 65, 66, 67, 68,
- 63, 64, 65, 66, 67, 68, 224, 225, 226, 227,
- 228, 229, 237, 238, 239, 240, 241, 242
-};
-
-static const short yycheck[] =
-{
- 2, 141, 23, 125, 126, 263, 7, 8, 4, 4,
- 49, 4, 216, 0, 4, 3, 95, 3, 277, 3,
- 3, 3, 3, 145, 230, 3, 27, 28, 29, 6,
- 7, 8, 9, 10, 11, 292, 96, 4, 4, 4,
- 4, 80, 4, 247, 303, 251, 4, 48, 49, 50,
- 51, 52, 53, 54, 55, 4, 43, 95, 262, 30,
- 61, 62, 63, 64, 65, 66, 67, 68, 70, 71,
- 72, 193, 59, 51, 52, 53, 54, 55, 56, 336,
- 70, 48, 48, 50, 50, 80, 48, 82, 50, 82,
- 48, 80, 50, 422, 81, 82, 89, 84, 93, 95,
- 93, 305, 97, 3, 97, 80, 93, 95, 49, 95,
- 97, 95, 95, 95, 95, 372, 5, 95, 95, 68,
- 69, 450, 95, 12, 13, 14, 15, 456, 4, 4,
- 3, 82, 134, 135, 136, 137, 138, 139, 140, 80,
- 80, 143, 4, 114, 146, 82, 97, 3, 233, 85,
- 479, 152, 41, 42, 80, 95, 93, 46, 47, 95,
- 97, 61, 62, 63, 64, 65, 66, 67, 57, 58,
- 255, 60, 48, 48, 50, 50, 147, 148, 79, 40,
- 41, 82, 95, 154, 155, 443, 48, 445, 50, 71,
- 448, 79, 81, 82, 82, 453, 97, 3, 70, 170,
- 171, 80, 203, 80, 93, 82, 80, 3, 97, 97,
- 332, 4, 89, 38, 39, 80, 93, 188, 189, 44,
- 97, 85, 480, 435, 195, 196, 438, 198, 95, 95,
- 201, 202, 80, 80, 3, 206, 207, 80, 98, 451,
- 80, 212, 454, 95, 215, 457, 217, 3, 3, 270,
- 462, 463, 4, 95, 466, 276, 95, 469, 95, 3,
- 95, 473, 90, 91, 92, 95, 268, 80, 81, 82,
- 272, 273, 274, 275, 43, 44, 45, 248, 95, 95,
- 93, 81, 82, 3, 97, 95, 426, 43, 44, 45,
- 95, 95, 294, 93, 265, 0, 95, 97, 86, 43,
- 44, 45, 310, 72, 73, 74, 75, 76, 77, 78,
- 414, 80, 81, 16, 236, 286, 72, 73, 74, 75,
- 76, 77, 78, 43, 44, 45, 213, 298, 72, 73,
- 74, 75, 76, 77, 78, 243, 82, 83, -1, -1,
- 3, -1, 344, 89, -1, -1, -1, 93, 3, -1,
- -1, 97, 72, 73, 74, 75, 76, 77, 78, -1,
- 51, 52, 53, 54, 55, 56, -1, 369, -1, 72,
- 73, 74, 75, 76, 77, 78, 82, 83, -1, 381,
- 43, 44, 45, 89, -1, 35, 3, 93, 43, 44,
- 45, 97, 42, 43, -1, 45, 398, 47, -1, 16,
- 17, 18, 19, 374, 95, -1, -1, -1, 379, 72,
- 73, 74, 75, 76, 77, 78, 418, 72, 73, 74,
- 75, 76, 77, 78, 41, -1, 43, 44, 45, 46,
- -1, 433, -1, 404, -1, -1, 407, -1, -1, 410,
- -1, 412, 413, -1, -1, 416, 417, 449, 419, -1,
- 421, -1, 423, 424, 80, 81, 82, 428, 429, -1,
- 431, 432, -1, -1, -1, 436, 437, 93, 470, -1,
- -1, 97, 443, 444, 445, 3, -1, 448, -1, -1,
- -1, 452, 453, 3, 455, -1, -1, 458, 16, 17,
- 18, 19, -1, 464, 82, -1, 16, 17, 18, 19,
- 84, 89, -1, 87, 88, 93, -1, 91, -1, 97,
- 94, -1, -1, 41, 4, 43, 44, 45, 46, -1,
- 10, 41, -1, 43, 44, 45, 46, -1, -1, -1,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
- 40, 4, 42, -1, -1, -1, -1, 10, 83, 84,
- 85, 86, 87, 88, -1, -1, 91, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 38, 39, 40, 4, 42,
- -1, -1, -1, -1, 10, -1, 85, 86, 87, 88,
- 89, 90, 91, 92, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 38, 39, 40, -1, 42, 346, 347, 348,
- 349, 350, 351, 352, 353, 354, 355, 356, 357, 358,
- 359, 360, 361, -1, 363, 364, 365, 85, 86, 87,
- 88, 89, 90, 91, 92, 88, 89, 90, 91, 92,
- 98, 85, 86, 87, 88, 89, 90, 91, 92, -1,
- -1, -1, -1, -1, 98, 72, 73, 74, 75, 76,
- 77, 78, -1, 80, 81, 85, 86, 87, 88, 89,
- 90, 91, 92, 86, 87, 88, 89, 90, 91, 92,
- 87, 88, 89, 90, 91, 92, 6, 7, 8, 9,
- 10, 11, 51, 52, 53, 54, 55, 56
-};
-/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "/usr/share/bison/bison.simple"
-
-/* Skeleton output parser for bison,
-
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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, 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. */
-
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
-
-/* This is the parser code that is written into each bison parser when
- the %semantic_parser declaration is not specified in the grammar.
- It was written by Richard Stallman by simplifying the hairy parser
- used when %semantic_parser is specified. */
-
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
-
-/* The parser invokes alloca or malloc; define the necessary symbols. */
-
-# if YYSTACK_USE_ALLOCA
-# define YYSTACK_ALLOC alloca
-# else
-# ifndef YYSTACK_USE_ALLOCA
-# if defined (alloca) || defined (_ALLOCA_H)
-# define YYSTACK_ALLOC alloca
-# else
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# endif
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-# else
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
-# define YYSTACK_ALLOC malloc
-# define YYSTACK_FREE free
-# endif
-#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
-
-
-#if (! defined (yyoverflow) \
- && (! defined (__cplusplus) \
- || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- short yyss;
- YYSTYPE yyvs;
-# if YYLSP_NEEDED
- YYLTYPE yyls;
-# endif
-};
-
-/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# if YYLSP_NEEDED
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
- + 2 * YYSTACK_GAP_MAX)
-# else
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAX)
-# endif
-
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- register YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (0)
-# endif
-# endif
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (0)
-
-#endif
-
-
-#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
-# define YYSIZE_T __SIZE_TYPE__
-#endif
-#if ! defined (YYSIZE_T) && defined (size_t)
-# define YYSIZE_T size_t
-#endif
-#if ! defined (YYSIZE_T)
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
-#endif
-#if ! defined (YYSIZE_T)
-# define YYSIZE_T unsigned int
-#endif
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY -2
-#define YYEOF 0
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrlab1
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
-#define YYFAIL goto yyerrlab
-#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- yychar1 = YYTRANSLATE (yychar); \
- YYPOPSTACK; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror ("syntax error: cannot back up"); \
- YYERROR; \
- } \
-while (0)
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-
-/* YYLLOC_DEFAULT -- Compute the default location (before the actions
- are run).
-
- When YYLLOC_DEFAULT is run, CURRENT is set the location of the
- first token. By default, to implement support for ranges, extend
- its range to the last symbol. */
-
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- Current.last_line = Rhs[N].last_line; \
- Current.last_column = Rhs[N].last_column;
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments. */
-
-#if YYPURE
-# if YYLSP_NEEDED
-# ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
-# else
-# define YYLEX yylex (&yylval, &yylloc)
-# endif
-# else /* !YYLSP_NEEDED */
-# ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
-# else
-# define YYLEX yylex (&yylval)
-# endif
-# endif /* !YYLSP_NEEDED */
-#else /* !YYPURE */
-# define YYLEX yylex ()
-#endif /* !YYPURE */
-
-
-/* Enable debugging if requested. */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-#endif /* !YYDEBUG */
-
-/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
- if the built-in stack extension method is used).
-
- Do not make this value too large; the results are undefined if
- SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
- evaluated with infinite-precision integer arithmetic. */
-
-#if YYMAXDEPTH == 0
-# undef YYMAXDEPTH
-#endif
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-#ifdef YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined (__GLIBC__) && defined (_STRING_H)
-# define yystrlen strlen
-# else
-/* Return the length of YYSTR. */
-static YYSIZE_T
-# if defined (__STDC__) || defined (__cplusplus)
-yystrlen (const char *yystr)
-# else
-yystrlen (yystr)
- const char *yystr;
-# endif
-{
- register const char *yys = yystr;
-
- while (*yys++ != '\0')
- continue;
-
- return yys - yystr - 1;
-}
-# endif
-# endif
-
-# ifndef yystpcpy
-# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-static char *
-# if defined (__STDC__) || defined (__cplusplus)
-yystpcpy (char *yydest, const char *yysrc)
-# else
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-# endif
-{
- register char *yyd = yydest;
- register const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-# endif
-#endif
-
-#line 315 "/usr/share/bison/bison.simple"
-
-
-/* The user can define YYPARSE_PARAM as the name of an argument to be passed
- into yyparse. The argument should have type void *.
- It should actually point to an object.
- Grammar actions can access the variable by casting it
- to the proper pointer type. */
-
-#ifdef YYPARSE_PARAM
-# if defined (__STDC__) || defined (__cplusplus)
-# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
-# define YYPARSE_PARAM_DECL
-# else
-# define YYPARSE_PARAM_ARG YYPARSE_PARAM
-# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
-# endif
-#else /* !YYPARSE_PARAM */
-# define YYPARSE_PARAM_ARG
-# define YYPARSE_PARAM_DECL
-#endif /* !YYPARSE_PARAM */
-
-/* Prevent warning if -Wstrict-prototypes. */
-#ifdef __GNUC__
-# ifdef YYPARSE_PARAM
-int yyparse (void *);
-# else
-int yyparse (void);
-# endif
-#endif
-
-/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
- variables are global, or local to YYPARSE. */
-
-#define YY_DECL_NON_LSP_VARIABLES \
-/* The lookahead symbol. */ \
-int yychar; \
- \
-/* The semantic value of the lookahead symbol. */ \
-YYSTYPE yylval; \
- \
-/* Number of parse errors so far. */ \
-int yynerrs;
-
-#if YYLSP_NEEDED
-# define YY_DECL_VARIABLES \
-YY_DECL_NON_LSP_VARIABLES \
- \
-/* Location data for the lookahead symbol. */ \
-YYLTYPE yylloc;
-#else
-# define YY_DECL_VARIABLES \
-YY_DECL_NON_LSP_VARIABLES
-#endif
-
-
-/* If nonreentrant, generate the variables here. */
-
-#if !YYPURE
-YY_DECL_VARIABLES
-#endif /* !YYPURE */
-
-int
-yyparse (YYPARSE_PARAM_ARG)
- YYPARSE_PARAM_DECL
-{
- /* If reentrant, generate the variables here. */
-#if YYPURE
- YY_DECL_VARIABLES
-#endif /* !YYPURE */
-
- register int yystate;
- register int yyn;
- int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Lookahead token as an internal (translated) token number. */
- int yychar1 = 0;
-
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
-
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
-
- /* The state stack. */
- short yyssa[YYINITDEPTH];
- short *yyss = yyssa;
- register short *yyssp;
-
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- register YYSTYPE *yyvsp;
-
-#if YYLSP_NEEDED
- /* The location stack. */
- YYLTYPE yylsa[YYINITDEPTH];
- YYLTYPE *yyls = yylsa;
- YYLTYPE *yylsp;
-#endif
-
-#if YYLSP_NEEDED
-# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
-#else
-# define YYPOPSTACK (yyvsp--, yyssp--)
-#endif
-
- YYSIZE_T yystacksize = YYINITDEPTH;
-
-
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
-#if YYLSP_NEEDED
- YYLTYPE yyloc;
-#endif
-
- /* When reducing, the number of symbols on the RHS of the reduced
- rule. */
- int yylen;
-
- YYDPRINTF ((stderr, "Starting parse\n"));
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
-
- yyssp = yyss;
- yyvsp = yyvs;
-#if YYLSP_NEEDED
- yylsp = yyls;
-#endif
- goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
-`------------------------------------------------------------*/
- yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. so pushing a state here evens the stacks.
- */
- yyssp++;
-
- yysetstate:
- *yyssp = yystate;
-
- if (yyssp >= yyss + yystacksize - 1)
- {
- /* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- {
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- short *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. */
-# if YYLSP_NEEDED
- YYLTYPE *yyls1 = yyls;
- /* This used to be a conditional around just the two extra args,
- but that might be undefined if yyoverflow is a macro. */
- yyoverflow ("parser stack overflow",
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yyls1, yysize * sizeof (*yylsp),
- &yystacksize);
- yyls = yyls1;
-# else
- yyoverflow ("parser stack overflow",
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-# endif
- yyss = yyss1;
- yyvs = yyvs1;
- }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyoverflowlab;
-# else
- /* Extend the stack our own way. */
- if (yystacksize >= YYMAXDEPTH)
- goto yyoverflowlab;
- yystacksize *= 2;
- if (yystacksize > YYMAXDEPTH)
- yystacksize = YYMAXDEPTH;
-
- {
- short *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyoverflowlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
-# if YYLSP_NEEDED
- YYSTACK_RELOCATE (yyls);
-# endif
-# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
-# endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
-#if YYLSP_NEEDED
- yylsp = yyls + yysize - 1;
-#endif
-
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
-
- if (yyssp >= yyss + yystacksize - 1)
- YYABORT;
- }
-
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
- goto yybackup;
-
-
-/*-----------.
-| yybackup. |
-`-----------*/
-yybackup:
-
-/* Do appropriate processing given the current state. */
-/* Read a lookahead token if we need one and don't already have one. */
-/* yyresume: */
-
- /* First try to decide what to do without reference to lookahead token. */
-
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* yychar is either YYEMPTY or YYEOF
- or a valid token in external form. */
-
- if (yychar == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
- }
-
- /* Convert token to internal form (in yychar1) for indexing tables with */
-
- if (yychar <= 0) /* This means end of input. */
- {
- yychar1 = 0;
- yychar = YYEOF; /* Don't call YYLEX any more */
-
- YYDPRINTF ((stderr, "Now at end of input.\n"));
- }
- else
- {
- yychar1 = YYTRANSLATE (yychar);
-
-#if YYDEBUG
- /* We have to keep this `#if YYDEBUG', since we use variables
- which are defined only if `YYDEBUG' is set. */
- if (yydebug)
- {
- YYFPRINTF (stderr, "Next token is %d (%s",
- yychar, yytname[yychar1]);
- /* Give the individual parser a way to print the precise
- meaning of a token, for further debugging info. */
-# ifdef YYPRINT
- YYPRINT (stderr, yychar, yylval);
-# endif
- YYFPRINTF (stderr, ")\n");
- }
-#endif
- }
-
- yyn += yychar1;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
- goto yydefault;
-
- yyn = yytable[yyn];
-
- /* yyn is what to do for this token type in this state.
- Negative => reduce, -yyn is rule number.
- Positive => shift, yyn is new state.
- New state is final state => don't bother to shift,
- just return success.
- 0, or most negative number => error. */
-
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrlab;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- /* Shift the lookahead token. */
- YYDPRINTF ((stderr, "Shifting token %d (%s), ",
- yychar, yytname[yychar1]));
-
- /* Discard the token being shifted unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
-
- *++yyvsp = yylval;
-#if YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state. |
-`-----------------------------------------------------------*/
-yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction. |
-`-----------------------------*/
-yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
-
- /* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
-
- Otherwise, the following line sets YYVAL to the semantic value of
- the lookahead token. This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
-
-#if YYLSP_NEEDED
- /* Similarly for the default location. Let the user run additional
- commands if for instance locations are ranges. */
- yyloc = yylsp[1-yylen];
- YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
-#endif
-
-#if YYDEBUG
- /* We have to keep this `#if YYDEBUG', since we use variables which
- are defined only if `YYDEBUG' is set. */
- if (yydebug)
- {
- int yyi;
-
- YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
- yyn, yyrline[yyn]);
-
- /* Print the symbols being reduced, and their result. */
- for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
- YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
- YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
- }
-#endif
-
- switch (yyn) {
-
-case 17:
-#line 177 "rcparse.y"
-{
- define_accelerator (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].pacc);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 18:
-#line 187 "rcparse.y"
-{
- yyval.pacc = NULL;
- }
- break;
-case 19:
-#line 191 "rcparse.y"
-{
- struct accelerator *a;
-
- a = (struct accelerator *) res_alloc (sizeof *a);
- *a = yyvsp[0].acc;
- if (yyvsp[-1].pacc == NULL)
- yyval.pacc = a;
- else
- {
- struct accelerator **pp;
-
- for (pp = &yyvsp[-1].pacc->next; *pp != NULL; pp = &(*pp)->next)
- ;
- *pp = a;
- yyval.pacc = yyvsp[-1].pacc;
- }
- }
- break;
-case 20:
-#line 212 "rcparse.y"
-{
- yyval.acc = yyvsp[-1].acc;
- yyval.acc.id = yyvsp[0].il;
- }
- break;
-case 21:
-#line 217 "rcparse.y"
-{
- yyval.acc = yyvsp[-3].acc;
- yyval.acc.id = yyvsp[-2].il;
- yyval.acc.flags |= yyvsp[0].is;
- if ((yyval.acc.flags & ACC_VIRTKEY) == 0
- && (yyval.acc.flags & (ACC_SHIFT | ACC_CONTROL | ACC_ALT)) != 0)
- rcparse_warning (_("inappropriate modifiers for non-VIRTKEY"));
- }
- break;
-case 22:
-#line 229 "rcparse.y"
-{
- const char *s = yyvsp[0].s;
- char ch;
-
- yyval.acc.next = NULL;
- yyval.acc.id = 0;
- ch = *s;
- if (ch != '^')
- yyval.acc.flags = 0;
- else
- {
- yyval.acc.flags = ACC_CONTROL | ACC_VIRTKEY;
- ++s;
- ch = *s;
- ch = TOUPPER (ch);
- }
- yyval.acc.key = ch;
- if (s[1] != '\0')
- rcparse_warning (_("accelerator should only be one character"));
- }
- break;
-case 23:
-#line 250 "rcparse.y"
-{
- yyval.acc.next = NULL;
- yyval.acc.flags = 0;
- yyval.acc.id = 0;
- yyval.acc.key = yyvsp[0].il;
- }
- break;
-case 24:
-#line 260 "rcparse.y"
-{
- yyval.is = yyvsp[0].is;
- }
- break;
-case 25:
-#line 264 "rcparse.y"
-{
- yyval.is = yyvsp[-2].is | yyvsp[0].is;
- }
- break;
-case 26:
-#line 269 "rcparse.y"
-{
- yyval.is = yyvsp[-1].is | yyvsp[0].is;
- }
- break;
-case 27:
-#line 276 "rcparse.y"
-{
- yyval.is = ACC_VIRTKEY;
- }
- break;
-case 28:
-#line 280 "rcparse.y"
-{
- /* This is just the absence of VIRTKEY. */
- yyval.is = 0;
- }
- break;
-case 29:
-#line 285 "rcparse.y"
-{
- yyval.is = ACC_NOINVERT;
- }
- break;
-case 30:
-#line 289 "rcparse.y"
-{
- yyval.is = ACC_SHIFT;
- }
- break;
-case 31:
-#line 293 "rcparse.y"
-{
- yyval.is = ACC_CONTROL;
- }
- break;
-case 32:
-#line 297 "rcparse.y"
-{
- yyval.is = ACC_ALT;
- }
- break;
-case 33:
-#line 306 "rcparse.y"
-{
- define_bitmap (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 34:
-#line 318 "rcparse.y"
-{
- define_cursor (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 35:
-#line 331 "rcparse.y"
-{
- memset (&dialog, 0, sizeof dialog);
- dialog.x = yyvsp[-3].il;
- dialog.y = yyvsp[-2].il;
- dialog.width = yyvsp[-1].il;
- dialog.height = yyvsp[0].il;
- dialog.style = WS_POPUP | WS_BORDER | WS_SYSMENU;
- dialog.exstyle = yyvsp[-4].il;
- dialog.menu.named = 1;
- dialog.class.named = 1;
- dialog.font = NULL;
- dialog.ex = NULL;
- dialog.controls = NULL;
- sub_res_info = yyvsp[-5].res_info;
- style = 0;
- }
- break;
-case 36:
-#line 348 "rcparse.y"
-{
- define_dialog (yyvsp[-12].id, &sub_res_info, &dialog);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 37:
-#line 356 "rcparse.y"
-{
- memset (&dialog, 0, sizeof dialog);
- dialog.x = yyvsp[-3].il;
- dialog.y = yyvsp[-2].il;
- dialog.width = yyvsp[-1].il;
- dialog.height = yyvsp[0].il;
- dialog.style = WS_POPUP | WS_BORDER | WS_SYSMENU;
- dialog.exstyle = yyvsp[-4].il;
- dialog.menu.named = 1;
- dialog.class.named = 1;
- dialog.font = NULL;
- dialog.ex = ((struct dialog_ex *)
- res_alloc (sizeof (struct dialog_ex)));
- memset (dialog.ex, 0, sizeof (struct dialog_ex));
- dialog.controls = NULL;
- sub_res_info = yyvsp[-5].res_info;
- style = 0;
- }
- break;
-case 38:
-#line 375 "rcparse.y"
-{
- define_dialog (yyvsp[-12].id, &sub_res_info, &dialog);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 39:
-#line 383 "rcparse.y"
-{
- memset (&dialog, 0, sizeof dialog);
- dialog.x = yyvsp[-4].il;
- dialog.y = yyvsp[-3].il;
- dialog.width = yyvsp[-2].il;
- dialog.height = yyvsp[-1].il;
- dialog.style = WS_POPUP | WS_BORDER | WS_SYSMENU;
- dialog.exstyle = yyvsp[-5].il;
- dialog.menu.named = 1;
- dialog.class.named = 1;
- dialog.font = NULL;
- dialog.ex = ((struct dialog_ex *)
- res_alloc (sizeof (struct dialog_ex)));
- memset (dialog.ex, 0, sizeof (struct dialog_ex));
- dialog.ex->help = yyvsp[0].il;
- dialog.controls = NULL;
- sub_res_info = yyvsp[-6].res_info;
- style = 0;
- }
- break;
-case 40:
-#line 403 "rcparse.y"
-{
- define_dialog (yyvsp[-13].id, &sub_res_info, &dialog);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 41:
-#line 413 "rcparse.y"
-{
- yyval.il = 0;
- }
- break;
-case 42:
-#line 417 "rcparse.y"
-{
- yyval.il = yyvsp[0].il;
- }
- break;
-case 44:
-#line 425 "rcparse.y"
-{
- dialog.style |= WS_CAPTION;
- style |= WS_CAPTION;
- unicode_from_ascii ((int *) NULL, &dialog.caption, yyvsp[0].s);
- }
- break;
-case 45:
-#line 431 "rcparse.y"
-{
- dialog.class = yyvsp[0].id;
- }
- break;
-case 46:
-#line 436 "rcparse.y"
-{
- dialog.style = style;
- }
- break;
-case 47:
-#line 440 "rcparse.y"
-{
- dialog.exstyle = yyvsp[0].il;
- }
- break;
-case 48:
-#line 444 "rcparse.y"
-{
- res_string_to_id (& dialog.class, yyvsp[0].s);
- }
- break;
-case 49:
-#line 448 "rcparse.y"
-{
- dialog.style |= DS_SETFONT;
- style |= DS_SETFONT;
- dialog.pointsize = yyvsp[-2].il;
- unicode_from_ascii ((int *) NULL, &dialog.font, yyvsp[0].s);
- if (dialog.ex != NULL)
- {
- dialog.ex->weight = 0;
- dialog.ex->italic = 0;
- dialog.ex->charset = 1;
- }
- }
- break;
-case 50:
-#line 461 "rcparse.y"
-{
- dialog.style |= DS_SETFONT;
- style |= DS_SETFONT;
- dialog.pointsize = yyvsp[-3].il;
- unicode_from_ascii ((int *) NULL, &dialog.font, yyvsp[-1].s);
- if (dialog.ex == NULL)
- rcparse_warning (_("extended FONT requires DIALOGEX"));
- else
- {
- dialog.ex->weight = yyvsp[0].il;
- dialog.ex->italic = 0;
- dialog.ex->charset = 1;
- }
- }
- break;
-case 51:
-#line 476 "rcparse.y"
-{
- dialog.style |= DS_SETFONT;
- style |= DS_SETFONT;
- dialog.pointsize = yyvsp[-4].il;
- unicode_from_ascii ((int *) NULL, &dialog.font, yyvsp[-2].s);
- if (dialog.ex == NULL)
- rcparse_warning (_("extended FONT requires DIALOGEX"));
- else
- {
- dialog.ex->weight = yyvsp[-1].il;
- dialog.ex->italic = yyvsp[0].il;
- dialog.ex->charset = 1;
- }
- }
- break;
-case 52:
-#line 491 "rcparse.y"
-{
- dialog.style |= DS_SETFONT;
- style |= DS_SETFONT;
- dialog.pointsize = yyvsp[-5].il;
- unicode_from_ascii ((int *) NULL, &dialog.font, yyvsp[-3].s);
- if (dialog.ex == NULL)
- rcparse_warning (_("extended FONT requires DIALOGEX"));
- else
- {
- dialog.ex->weight = yyvsp[-2].il;
- dialog.ex->italic = yyvsp[-1].il;
- dialog.ex->charset = yyvsp[0].il;
- }
- }
- break;
-case 53:
-#line 506 "rcparse.y"
-{
- dialog.menu = yyvsp[0].id;
- }
- break;
-case 54:
-#line 510 "rcparse.y"
-{
- sub_res_info.characteristics = yyvsp[0].il;
- }
- break;
-case 55:
-#line 514 "rcparse.y"
-{
- sub_res_info.language = yyvsp[-1].il | (yyvsp[0].il << SUBLANG_SHIFT);
- }
- break;
-case 56:
-#line 518 "rcparse.y"
-{
- sub_res_info.version = yyvsp[0].il;
- }
- break;
-case 58:
-#line 526 "rcparse.y"
-{
- struct dialog_control **pp;
-
- for (pp = &dialog.controls; *pp != NULL; pp = &(*pp)->next)
- ;
- *pp = yyvsp[0].dialog_control;
- }
- break;
-case 59:
-#line 537 "rcparse.y"
-{
- default_style = BS_AUTO3STATE | WS_TABSTOP;
- base_style = BS_AUTO3STATE;
- class = CTL_BUTTON;
- }
- break;
-case 60:
-#line 543 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 61:
-#line 547 "rcparse.y"
-{
- default_style = BS_AUTOCHECKBOX | WS_TABSTOP;
- base_style = BS_AUTOCHECKBOX;
- class = CTL_BUTTON;
- }
- break;
-case 62:
-#line 553 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 63:
-#line 557 "rcparse.y"
-{
- default_style = BS_AUTORADIOBUTTON | WS_TABSTOP;
- base_style = BS_AUTORADIOBUTTON;
- class = CTL_BUTTON;
- }
- break;
-case 64:
-#line 563 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 65:
-#line 567 "rcparse.y"
-{
- default_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
- base_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
- class = CTL_EDIT;
- }
- break;
-case 66:
-#line 573 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- if (dialog.ex == NULL)
- rcparse_warning (_("BEDIT requires DIALOGEX"));
- res_string_to_id (&yyval.dialog_control->class, "BEDIT");
- }
- break;
-case 67:
-#line 580 "rcparse.y"
-{
- default_style = BS_CHECKBOX | WS_TABSTOP;
- base_style = BS_CHECKBOX | WS_TABSTOP;
- class = CTL_BUTTON;
- }
- break;
-case 68:
-#line 586 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 69:
-#line 590 "rcparse.y"
-{
- default_style = CBS_SIMPLE | WS_TABSTOP;
- base_style = 0;
- class = CTL_COMBOBOX;
- }
- break;
-case 70:
-#line 596 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 71:
-#line 601 "rcparse.y"
-{
- yyval.dialog_control = define_control (yyvsp[-9].s, yyvsp[-8].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-2].il, yyvsp[-7].il, style, yyvsp[-1].il);
- if (yyvsp[0].rcdata_item != NULL)
- {
- if (dialog.ex == NULL)
- rcparse_warning (_("control data requires DIALOGEX"));
- yyval.dialog_control->data = yyvsp[0].rcdata_item;
- }
- }
- break;
-case 72:
-#line 612 "rcparse.y"
-{
- yyval.dialog_control = define_control (yyvsp[-10].s, yyvsp[-9].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-8].il, style, yyvsp[-2].il);
- if (dialog.ex == NULL)
- rcparse_warning (_("help ID requires DIALOGEX"));
- yyval.dialog_control->help = yyvsp[-1].il;
- yyval.dialog_control->data = yyvsp[0].rcdata_item;
- }
- break;
-case 73:
-#line 621 "rcparse.y"
-{
- yyval.dialog_control = define_control (yyvsp[-10].s, yyvsp[-9].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-2].il, 0, style, yyvsp[-1].il);
- if (yyvsp[0].rcdata_item != NULL)
- {
- if (dialog.ex == NULL)
- rcparse_warning ("control data requires DIALOGEX");
- yyval.dialog_control->data = yyvsp[0].rcdata_item;
- }
- yyval.dialog_control->class.named = 1;
- unicode_from_ascii (&yyval.dialog_control->class.u.n.length, &yyval.dialog_control->class.u.n.name, yyvsp[-7].s);
- }
- break;
-case 74:
-#line 634 "rcparse.y"
-{
- yyval.dialog_control = define_control (yyvsp[-11].s, yyvsp[-10].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, 0, style, yyvsp[-2].il);
- if (dialog.ex == NULL)
- rcparse_warning ("help ID requires DIALOGEX");
- yyval.dialog_control->help = yyvsp[-1].il;
- yyval.dialog_control->data = yyvsp[0].rcdata_item;
- yyval.dialog_control->class.named = 1;
- unicode_from_ascii (&yyval.dialog_control->class.u.n.length, &yyval.dialog_control->class.u.n.name, yyvsp[-8].s);
- }
- break;
-case 75:
-#line 644 "rcparse.y"
-{
- default_style = SS_CENTER | WS_GROUP;
- base_style = SS_CENTER;
- class = CTL_STATIC;
- }
- break;
-case 76:
-#line 650 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 77:
-#line 654 "rcparse.y"
-{
- default_style = BS_DEFPUSHBUTTON | WS_TABSTOP;
- base_style = BS_DEFPUSHBUTTON | WS_TABSTOP;
- class = CTL_BUTTON;
- }
- break;
-case 78:
-#line 660 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 79:
-#line 664 "rcparse.y"
-{
- default_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
- base_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
- class = CTL_EDIT;
- }
- break;
-case 80:
-#line 670 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 81:
-#line 674 "rcparse.y"
-{
- default_style = BS_GROUPBOX;
- base_style = BS_GROUPBOX;
- class = CTL_BUTTON;
- }
- break;
-case 82:
-#line 680 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 83:
-#line 684 "rcparse.y"
-{
- default_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
- base_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
- class = CTL_EDIT;
- }
- break;
-case 84:
-#line 690 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- if (dialog.ex == NULL)
- rcparse_warning (_("IEDIT requires DIALOGEX"));
- res_string_to_id (&yyval.dialog_control->class, "HEDIT");
- }
- break;
-case 85:
-#line 697 "rcparse.y"
-{
- yyval.dialog_control = define_icon_control (yyvsp[-4].id, yyvsp[-3].il, yyvsp[-2].il, yyvsp[-1].il, 0, 0, 0, yyvsp[0].rcdata_item,
- dialog.ex);
- }
- break;
-case 86:
-#line 703 "rcparse.y"
-{
- yyval.dialog_control = define_icon_control (yyvsp[-6].id, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, 0, 0, 0, yyvsp[0].rcdata_item,
- dialog.ex);
- }
- break;
-case 87:
-#line 709 "rcparse.y"
-{
- yyval.dialog_control = define_icon_control (yyvsp[-8].id, yyvsp[-7].il, yyvsp[-6].il, yyvsp[-5].il, style, yyvsp[-1].il, 0, yyvsp[0].rcdata_item,
- dialog.ex);
- }
- break;
-case 88:
-#line 715 "rcparse.y"
-{
- yyval.dialog_control = define_icon_control (yyvsp[-9].id, yyvsp[-8].il, yyvsp[-7].il, yyvsp[-6].il, style, yyvsp[-2].il, yyvsp[-1].il, yyvsp[0].rcdata_item,
- dialog.ex);
- }
- break;
-case 89:
-#line 720 "rcparse.y"
-{
- default_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
- base_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
- class = CTL_EDIT;
- }
- break;
-case 90:
-#line 726 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- if (dialog.ex == NULL)
- rcparse_warning (_("IEDIT requires DIALOGEX"));
- res_string_to_id (&yyval.dialog_control->class, "IEDIT");
- }
- break;
-case 91:
-#line 733 "rcparse.y"
-{
- default_style = LBS_NOTIFY | WS_BORDER;
- base_style = LBS_NOTIFY | WS_BORDER;
- class = CTL_LISTBOX;
- }
- break;
-case 92:
-#line 739 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 93:
-#line 743 "rcparse.y"
-{
- default_style = SS_LEFT | WS_GROUP;
- base_style = SS_LEFT;
- class = CTL_STATIC;
- }
- break;
-case 94:
-#line 749 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 95:
-#line 753 "rcparse.y"
-{
- default_style = BS_PUSHBOX | WS_TABSTOP;
- base_style = BS_PUSHBOX;
- class = CTL_BUTTON;
- }
- break;
-case 96:
-#line 759 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 97:
-#line 763 "rcparse.y"
-{
- default_style = BS_PUSHBUTTON | WS_TABSTOP;
- base_style = BS_PUSHBUTTON | WS_TABSTOP;
- class = CTL_BUTTON;
- }
- break;
-case 98:
-#line 769 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 99:
-#line 773 "rcparse.y"
-{
- default_style = BS_RADIOBUTTON | WS_TABSTOP;
- base_style = BS_RADIOBUTTON;
- class = CTL_BUTTON;
- }
- break;
-case 100:
-#line 779 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 101:
-#line 783 "rcparse.y"
-{
- default_style = SS_RIGHT | WS_GROUP;
- base_style = SS_RIGHT;
- class = CTL_STATIC;
- }
- break;
-case 102:
-#line 789 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 103:
-#line 793 "rcparse.y"
-{
- default_style = SBS_HORZ;
- base_style = 0;
- class = CTL_SCROLLBAR;
- }
- break;
-case 104:
-#line 799 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 105:
-#line 803 "rcparse.y"
-{
- default_style = BS_3STATE | WS_TABSTOP;
- base_style = BS_3STATE;
- class = CTL_BUTTON;
- }
- break;
-case 106:
-#line 809 "rcparse.y"
-{
- yyval.dialog_control = yyvsp[0].dialog_control;
- }
- break;
-case 107:
-#line 814 "rcparse.y"
-{ style = WS_CHILD | WS_VISIBLE; }
- break;
-case 108:
-#line 816 "rcparse.y"
-{
- yyval.dialog_control = define_control (yyvsp[-14].s, yyvsp[-12].il, yyvsp[-10].il, yyvsp[-8].il, yyvsp[-6].il, yyvsp[-4].il, CTL_BUTTON,
- style, yyvsp[0].il);
- }
- break;
-case 109:
-#line 832 "rcparse.y"
-{
- yyval.dialog_control = define_control (yyvsp[-6].s, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-2].il, yyvsp[-1].il, class,
- default_style | WS_CHILD | WS_VISIBLE, 0);
- if (yyvsp[0].rcdata_item != NULL)
- {
- if (dialog.ex == NULL)
- rcparse_warning (_("control data requires DIALOGEX"));
- yyval.dialog_control->data = yyvsp[0].rcdata_item;
- }
- }
- break;
-case 110:
-#line 844 "rcparse.y"
-{
- yyval.dialog_control = define_control (yyvsp[-8].s, yyvsp[-7].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, class, style, yyvsp[-1].il);
- if (yyvsp[0].rcdata_item != NULL)
- {
- if (dialog.ex == NULL)
- rcparse_warning (_("control data requires DIALOGEX"));
- yyval.dialog_control->data = yyvsp[0].rcdata_item;
- }
- }
- break;
-case 111:
-#line 855 "rcparse.y"
-{
- yyval.dialog_control = define_control (yyvsp[-9].s, yyvsp[-8].il, yyvsp[-7].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, class, style, yyvsp[-2].il);
- if (dialog.ex == NULL)
- rcparse_warning (_("help ID requires DIALOGEX"));
- yyval.dialog_control->help = yyvsp[-1].il;
- yyval.dialog_control->data = yyvsp[0].rcdata_item;
- }
- break;
-case 112:
-#line 866 "rcparse.y"
-{
- yyval.s = NULL;
- }
- break;
-case 113:
-#line 870 "rcparse.y"
-{
- yyval.s = yyvsp[0].s;
- }
- break;
-case 114:
-#line 874 "rcparse.y"
-{
- yyval.s = yyvsp[-1].s;
- }
- break;
-case 115:
-#line 881 "rcparse.y"
-{
- yyval.rcdata_item = NULL;
- }
- break;
-case 116:
-#line 885 "rcparse.y"
-{
- yyval.rcdata_item = yyvsp[-1].rcdata.first;
- }
- break;
-case 117:
-#line 894 "rcparse.y"
-{ style = WS_CHILD | WS_VISIBLE; }
- break;
-case 119:
-#line 900 "rcparse.y"
-{ style = SS_ICON | WS_CHILD | WS_VISIBLE; }
- break;
-case 121:
-#line 906 "rcparse.y"
-{ style = base_style | WS_CHILD | WS_VISIBLE; }
- break;
-case 123:
-#line 914 "rcparse.y"
-{
- define_font (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 124:
-#line 926 "rcparse.y"
-{
- define_icon (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 125:
-#line 939 "rcparse.y"
-{
- language = yyvsp[-1].il | (yyvsp[0].il << SUBLANG_SHIFT);
- }
- break;
-case 126:
-#line 948 "rcparse.y"
-{
- define_menu (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].menuitem);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 127:
-#line 958 "rcparse.y"
-{
- yyval.menuitem = NULL;
- }
- break;
-case 128:
-#line 962 "rcparse.y"
-{
- if (yyvsp[-1].menuitem == NULL)
- yyval.menuitem = yyvsp[0].menuitem;
- else
- {
- struct menuitem **pp;
-
- for (pp = &yyvsp[-1].menuitem->next; *pp != NULL; pp = &(*pp)->next)
- ;
- *pp = yyvsp[0].menuitem;
- yyval.menuitem = yyvsp[-1].menuitem;
- }
- }
- break;
-case 129:
-#line 979 "rcparse.y"
-{
- yyval.menuitem = define_menuitem (yyvsp[-2].s, yyvsp[-1].il, yyvsp[0].is, 0, 0, NULL);
- }
- break;
-case 130:
-#line 983 "rcparse.y"
-{
- yyval.menuitem = define_menuitem (NULL, 0, 0, 0, 0, NULL);
- }
- break;
-case 131:
-#line 987 "rcparse.y"
-{
- yyval.menuitem = define_menuitem (yyvsp[-4].s, 0, yyvsp[-3].is, 0, 0, yyvsp[-1].menuitem);
- }
- break;
-case 132:
-#line 994 "rcparse.y"
-{
- yyval.is = 0;
- }
- break;
-case 133:
-#line 998 "rcparse.y"
-{
- yyval.is = yyvsp[-2].is | yyvsp[0].is;
- }
- break;
-case 134:
-#line 1002 "rcparse.y"
-{
- yyval.is = yyvsp[-1].is | yyvsp[0].is;
- }
- break;
-case 135:
-#line 1009 "rcparse.y"
-{
- yyval.is = MENUITEM_CHECKED;
- }
- break;
-case 136:
-#line 1013 "rcparse.y"
-{
- yyval.is = MENUITEM_GRAYED;
- }
- break;
-case 137:
-#line 1017 "rcparse.y"
-{
- yyval.is = MENUITEM_HELP;
- }
- break;
-case 138:
-#line 1021 "rcparse.y"
-{
- yyval.is = MENUITEM_INACTIVE;
- }
- break;
-case 139:
-#line 1025 "rcparse.y"
-{
- yyval.is = MENUITEM_MENUBARBREAK;
- }
- break;
-case 140:
-#line 1029 "rcparse.y"
-{
- yyval.is = MENUITEM_MENUBREAK;
- }
- break;
-case 141:
-#line 1038 "rcparse.y"
-{
- define_menu (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].menuitem);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 142:
-#line 1048 "rcparse.y"
-{
- yyval.menuitem = NULL;
- }
- break;
-case 143:
-#line 1052 "rcparse.y"
-{
- if (yyvsp[-1].menuitem == NULL)
- yyval.menuitem = yyvsp[0].menuitem;
- else
- {
- struct menuitem **pp;
-
- for (pp = &yyvsp[-1].menuitem->next; *pp != NULL; pp = &(*pp)->next)
- ;
- *pp = yyvsp[0].menuitem;
- yyval.menuitem = yyvsp[-1].menuitem;
- }
- }
- break;
-case 144:
-#line 1069 "rcparse.y"
-{
- yyval.menuitem = define_menuitem (yyvsp[0].s, 0, 0, 0, 0, NULL);
- }
- break;
-case 145:
-#line 1073 "rcparse.y"
-{
- yyval.menuitem = define_menuitem (yyvsp[-1].s, yyvsp[0].il, 0, 0, 0, NULL);
- }
- break;
-case 146:
-#line 1077 "rcparse.y"
-{
- yyval.menuitem = define_menuitem (yyvsp[-3].s, yyvsp[-2].il, yyvsp[-1].il, yyvsp[0].il, 0, NULL);
- }
- break;
-case 147:
-#line 1081 "rcparse.y"
-{
- yyval.menuitem = define_menuitem (NULL, 0, 0, 0, 0, NULL);
- }
- break;
-case 148:
-#line 1085 "rcparse.y"
-{
- yyval.menuitem = define_menuitem (yyvsp[-3].s, 0, 0, 0, 0, yyvsp[-1].menuitem);
- }
- break;
-case 149:
-#line 1089 "rcparse.y"
-{
- yyval.menuitem = define_menuitem (yyvsp[-4].s, yyvsp[-3].il, 0, 0, 0, yyvsp[-1].menuitem);
- }
- break;
-case 150:
-#line 1093 "rcparse.y"
-{
- yyval.menuitem = define_menuitem (yyvsp[-5].s, yyvsp[-4].il, yyvsp[-3].il, 0, 0, yyvsp[-1].menuitem);
- }
- break;
-case 151:
-#line 1098 "rcparse.y"
-{
- yyval.menuitem = define_menuitem (yyvsp[-7].s, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-1].menuitem);
- }
- break;
-case 152:
-#line 1107 "rcparse.y"
-{
- define_messagetable (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 153:
-#line 1119 "rcparse.y"
-{
- define_rcdata (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].rcdata.first);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 154:
-#line 1131 "rcparse.y"
-{
- rcparse_rcdata ();
- }
- break;
-case 155:
-#line 1135 "rcparse.y"
-{
- rcparse_normal ();
- yyval.rcdata = yyvsp[0].rcdata;
- }
- break;
-case 156:
-#line 1143 "rcparse.y"
-{
- yyval.rcdata.first = NULL;
- yyval.rcdata.last = NULL;
- }
- break;
-case 157:
-#line 1148 "rcparse.y"
-{
- yyval.rcdata = yyvsp[0].rcdata;
- }
- break;
-case 158:
-#line 1155 "rcparse.y"
-{
- struct rcdata_item *ri;
-
- ri = define_rcdata_string (yyvsp[0].ss.s, yyvsp[0].ss.length);
- yyval.rcdata.first = ri;
- yyval.rcdata.last = ri;
- }
- break;
-case 159:
-#line 1163 "rcparse.y"
-{
- struct rcdata_item *ri;
-
- ri = define_rcdata_number (yyvsp[0].i.val, yyvsp[0].i.dword);
- yyval.rcdata.first = ri;
- yyval.rcdata.last = ri;
- }
- break;
-case 160:
-#line 1171 "rcparse.y"
-{
- struct rcdata_item *ri;
-
- ri = define_rcdata_string (yyvsp[0].ss.s, yyvsp[0].ss.length);
- yyval.rcdata.first = yyvsp[-2].rcdata.first;
- yyvsp[-2].rcdata.last->next = ri;
- yyval.rcdata.last = ri;
- }
- break;
-case 161:
-#line 1180 "rcparse.y"
-{
- struct rcdata_item *ri;
-
- ri = define_rcdata_number (yyvsp[0].i.val, yyvsp[0].i.dword);
- yyval.rcdata.first = yyvsp[-2].rcdata.first;
- yyvsp[-2].rcdata.last->next = ri;
- yyval.rcdata.last = ri;
- }
- break;
-case 162:
-#line 1194 "rcparse.y"
-{ sub_res_info = yyvsp[-1].res_info; }
- break;
-case 165:
-#line 1201 "rcparse.y"
-{
- define_stringtable (&sub_res_info, yyvsp[-1].il, yyvsp[0].s);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 166:
-#line 1208 "rcparse.y"
-{
- define_stringtable (&sub_res_info, yyvsp[-2].il, yyvsp[0].s);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 167:
-#line 1221 "rcparse.y"
-{
- define_user_data (yyvsp[-5].id, yyvsp[-4].id, &yyvsp[-3].res_info, yyvsp[-1].rcdata.first);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 168:
-#line 1228 "rcparse.y"
-{
- define_user_file (yyvsp[-3].id, yyvsp[-2].id, &yyvsp[-1].res_info, yyvsp[0].s);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 169:
-#line 1240 "rcparse.y"
-{
- define_versioninfo (yyvsp[-5].id, language, yyvsp[-3].fixver, yyvsp[-1].verinfo);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- break;
-case 170:
-#line 1250 "rcparse.y"
-{
- yyval.fixver = ((struct fixed_versioninfo *)
- res_alloc (sizeof (struct fixed_versioninfo)));
- memset (yyval.fixver, 0, sizeof (struct fixed_versioninfo));
- }
- break;
-case 171:
-#line 1256 "rcparse.y"
-{
- yyvsp[-5].fixver->file_version_ms = (yyvsp[-3].il << 16) | yyvsp[-2].il;
- yyvsp[-5].fixver->file_version_ls = (yyvsp[-1].il << 16) | yyvsp[0].il;
- yyval.fixver = yyvsp[-5].fixver;
- }
- break;
-case 172:
-#line 1262 "rcparse.y"
-{
- yyvsp[-5].fixver->product_version_ms = (yyvsp[-3].il << 16) | yyvsp[-2].il;
- yyvsp[-5].fixver->product_version_ls = (yyvsp[-1].il << 16) | yyvsp[0].il;
- yyval.fixver = yyvsp[-5].fixver;
- }
- break;
-case 173:
-#line 1268 "rcparse.y"
-{
- yyvsp[-2].fixver->file_flags_mask = yyvsp[0].il;
- yyval.fixver = yyvsp[-2].fixver;
- }
- break;
-case 174:
-#line 1273 "rcparse.y"
-{
- yyvsp[-2].fixver->file_flags = yyvsp[0].il;
- yyval.fixver = yyvsp[-2].fixver;
- }
- break;
-case 175:
-#line 1278 "rcparse.y"
-{
- yyvsp[-2].fixver->file_os = yyvsp[0].il;
- yyval.fixver = yyvsp[-2].fixver;
- }
- break;
-case 176:
-#line 1283 "rcparse.y"
-{
- yyvsp[-2].fixver->file_type = yyvsp[0].il;
- yyval.fixver = yyvsp[-2].fixver;
- }
- break;
-case 177:
-#line 1288 "rcparse.y"
-{
- yyvsp[-2].fixver->file_subtype = yyvsp[0].il;
- yyval.fixver = yyvsp[-2].fixver;
- }
- break;
-case 178:
-#line 1302 "rcparse.y"
-{
- yyval.verinfo = NULL;
- }
- break;
-case 179:
-#line 1306 "rcparse.y"
-{
- yyval.verinfo = append_ver_stringfileinfo (yyvsp[-7].verinfo, yyvsp[-4].s, yyvsp[-2].verstring);
- }
- break;
-case 180:
-#line 1310 "rcparse.y"
-{
- yyval.verinfo = append_ver_varfileinfo (yyvsp[-6].verinfo, yyvsp[-2].s, yyvsp[-1].vervar);
- }
- break;
-case 181:
-#line 1317 "rcparse.y"
-{
- yyval.verstring = NULL;
- }
- break;
-case 182:
-#line 1321 "rcparse.y"
-{
- yyval.verstring = append_verval (yyvsp[-4].verstring, yyvsp[-2].s, yyvsp[0].s);
- }
- break;
-case 183:
-#line 1328 "rcparse.y"
-{
- yyval.vervar = NULL;
- }
- break;
-case 184:
-#line 1332 "rcparse.y"
-{
- yyval.vervar = append_vertrans (yyvsp[-2].vervar, yyvsp[-1].il, yyvsp[0].il);
- }
- break;
-case 185:
-#line 1341 "rcparse.y"
-{
- yyval.id.named = 0;
- yyval.id.u.id = yyvsp[0].il;
- }
- break;
-case 186:
-#line 1346 "rcparse.y"
-{
- char *copy, *s;
-
- /* It seems that resource ID's are forced to upper case. */
- copy = xstrdup (yyvsp[0].s);
- for (s = copy; *s != '\0'; s++)
- *s = TOUPPER (*s);
- res_string_to_id (&yyval.id, copy);
- free (copy);
- }
- break;
-case 187:
-#line 1362 "rcparse.y"
-{
- yyval.s = yyvsp[0].s;
- }
- break;
-case 188:
-#line 1366 "rcparse.y"
-{
- yyval.s = yyvsp[-1].s;
- }
- break;
-case 189:
-#line 1370 "rcparse.y"
-{
- yyval.s = yyvsp[-1].s;
- }
- break;
-case 190:
-#line 1378 "rcparse.y"
-{
- yyval.id.named = 0;
- yyval.id.u.id = yyvsp[-1].il;
- }
- break;
-case 191:
-#line 1383 "rcparse.y"
-{
- char *copy, *s;
-
- /* It seems that resource ID's are forced to upper case. */
- copy = xstrdup (yyvsp[0].s);
- for (s = copy; *s != '\0'; s++)
- *s = TOUPPER (*s);
- res_string_to_id (&yyval.id, copy);
- free (copy);
- }
- break;
-case 192:
-#line 1400 "rcparse.y"
-{
- memset (&yyval.res_info, 0, sizeof (struct res_res_info));
- yyval.res_info.language = language;
- /* FIXME: Is this the right default? */
- yyval.res_info.memflags = MEMFLAG_MOVEABLE | MEMFLAG_PURE | MEMFLAG_DISCARDABLE;
- }
- break;
-case 193:
-#line 1407 "rcparse.y"
-{
- yyval.res_info = yyvsp[-1].res_info;
- yyval.res_info.memflags |= yyvsp[0].memflags.on;
- yyval.res_info.memflags &=~ yyvsp[0].memflags.off;
- }
- break;
-case 194:
-#line 1413 "rcparse.y"
-{
- yyval.res_info = yyvsp[-2].res_info;
- yyval.res_info.characteristics = yyvsp[0].il;
- }
- break;
-case 195:
-#line 1418 "rcparse.y"
-{
- yyval.res_info = yyvsp[-3].res_info;
- yyval.res_info.language = yyvsp[-1].il | (yyvsp[0].il << SUBLANG_SHIFT);
- }
- break;
-case 196:
-#line 1423 "rcparse.y"
-{
- yyval.res_info = yyvsp[-2].res_info;
- yyval.res_info.version = yyvsp[0].il;
- }
- break;
-case 197:
-#line 1433 "rcparse.y"
-{
- memset (&yyval.res_info, 0, sizeof (struct res_res_info));
- yyval.res_info.language = language;
- yyval.res_info.memflags = MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE;
- }
- break;
-case 198:
-#line 1439 "rcparse.y"
-{
- yyval.res_info = yyvsp[-1].res_info;
- yyval.res_info.memflags |= yyvsp[0].memflags.on;
- yyval.res_info.memflags &=~ yyvsp[0].memflags.off;
- }
- break;
-case 199:
-#line 1450 "rcparse.y"
-{
- memset (&yyval.res_info, 0, sizeof (struct res_res_info));
- yyval.res_info.language = language;
- yyval.res_info.memflags = MEMFLAG_MOVEABLE | MEMFLAG_PURE | MEMFLAG_DISCARDABLE;
- }
- break;
-case 200:
-#line 1456 "rcparse.y"
-{
- yyval.res_info = yyvsp[-1].res_info;
- yyval.res_info.memflags |= yyvsp[0].memflags.on;
- yyval.res_info.memflags &=~ yyvsp[0].memflags.off;
- }
- break;
-case 201:
-#line 1468 "rcparse.y"
-{
- yyval.memflags.on = MEMFLAG_MOVEABLE;
- yyval.memflags.off = 0;
- }
- break;
-case 202:
-#line 1473 "rcparse.y"
-{
- yyval.memflags.on = 0;
- yyval.memflags.off = MEMFLAG_MOVEABLE;
- }
- break;
-case 203:
-#line 1478 "rcparse.y"
-{
- yyval.memflags.on = MEMFLAG_PURE;
- yyval.memflags.off = 0;
- }
- break;
-case 204:
-#line 1483 "rcparse.y"
-{
- yyval.memflags.on = 0;
- yyval.memflags.off = MEMFLAG_PURE;
- }
- break;
-case 205:
-#line 1488 "rcparse.y"
-{
- yyval.memflags.on = MEMFLAG_PRELOAD;
- yyval.memflags.off = 0;
- }
- break;
-case 206:
-#line 1493 "rcparse.y"
-{
- yyval.memflags.on = 0;
- yyval.memflags.off = MEMFLAG_PRELOAD;
- }
- break;
-case 207:
-#line 1498 "rcparse.y"
-{
- yyval.memflags.on = MEMFLAG_DISCARDABLE;
- yyval.memflags.off = 0;
- }
- break;
-case 208:
-#line 1508 "rcparse.y"
-{
- yyval.s = yyvsp[0].s;
- }
- break;
-case 209:
-#line 1512 "rcparse.y"
-{
- yyval.s = yyvsp[0].s;
- }
- break;
-case 210:
-#line 1529 "rcparse.y"
-{
- style |= yyvsp[0].il;
- }
- break;
-case 211:
-#line 1533 "rcparse.y"
-{
- style &=~ yyvsp[0].il;
- }
- break;
-case 212:
-#line 1537 "rcparse.y"
-{
- style |= yyvsp[0].il;
- }
- break;
-case 213:
-#line 1541 "rcparse.y"
-{
- style &=~ yyvsp[0].il;
- }
- break;
-case 214:
-#line 1548 "rcparse.y"
-{
- yyval.il = yyvsp[0].i.val;
- }
- break;
-case 215:
-#line 1552 "rcparse.y"
-{
- yyval.il = yyvsp[-1].il;
- }
- break;
-case 216:
-#line 1561 "rcparse.y"
-{
- yyval.il = 0;
- }
- break;
-case 217:
-#line 1565 "rcparse.y"
-{
- yyval.il = yyvsp[0].il;
- }
- break;
-case 218:
-#line 1574 "rcparse.y"
-{
- yyval.il = yyvsp[0].il;
- }
- break;
-case 219:
-#line 1583 "rcparse.y"
-{
- yyval.il = yyvsp[0].i.val;
- }
- break;
-case 220:
-#line 1592 "rcparse.y"
-{
- yyval.i = yyvsp[0].i;
- }
- break;
-case 221:
-#line 1596 "rcparse.y"
-{
- yyval.i = yyvsp[-1].i;
- }
- break;
-case 222:
-#line 1600 "rcparse.y"
-{
- yyval.i.val = ~ yyvsp[0].i.val;
- yyval.i.dword = yyvsp[0].i.dword;
- }
- break;
-case 223:
-#line 1605 "rcparse.y"
-{
- yyval.i.val = - yyvsp[0].i.val;
- yyval.i.dword = yyvsp[0].i.dword;
- }
- break;
-case 224:
-#line 1610 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val * yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-case 225:
-#line 1615 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val / yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-case 226:
-#line 1620 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val % yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-case 227:
-#line 1625 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val + yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-case 228:
-#line 1630 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val - yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-case 229:
-#line 1635 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val & yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-case 230:
-#line 1640 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val ^ yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-case 231:
-#line 1645 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val | yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-case 232:
-#line 1656 "rcparse.y"
-{
- yyval.il = yyvsp[0].il;
- }
- break;
-case 233:
-#line 1665 "rcparse.y"
-{
- yyval.il = yyvsp[0].i.val;
- }
- break;
-case 234:
-#line 1676 "rcparse.y"
-{
- yyval.i = yyvsp[0].i;
- }
- break;
-case 235:
-#line 1680 "rcparse.y"
-{
- yyval.i = yyvsp[-1].i;
- }
- break;
-case 236:
-#line 1684 "rcparse.y"
-{
- yyval.i.val = ~ yyvsp[0].i.val;
- yyval.i.dword = yyvsp[0].i.dword;
- }
- break;
-case 237:
-#line 1689 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val * yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-case 238:
-#line 1694 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val / yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-case 239:
-#line 1699 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val % yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-case 240:
-#line 1704 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val + yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-case 241:
-#line 1709 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val - yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-case 242:
-#line 1714 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val & yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-case 243:
-#line 1719 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val ^ yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-case 244:
-#line 1724 "rcparse.y"
-{
- yyval.i.val = yyvsp[-2].i.val | yyvsp[0].i.val;
- yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword;
- }
- break;
-}
-
-#line 705 "/usr/share/bison/bison.simple"
-
-
- yyvsp -= yylen;
- yyssp -= yylen;
-#if YYLSP_NEEDED
- yylsp -= yylen;
-#endif
-
-#if YYDEBUG
- if (yydebug)
- {
- short *yyssp1 = yyss - 1;
- YYFPRINTF (stderr, "state stack now");
- while (yyssp1 != yyssp)
- YYFPRINTF (stderr, " %d", *++yyssp1);
- YYFPRINTF (stderr, "\n");
- }
-#endif
-
- *++yyvsp = yyval;
-#if YYLSP_NEEDED
- *++yylsp = yyloc;
-#endif
-
- /* Now `shift' the result of the reduction. Determine what state
- that goes to, based on the state we popped back to and the rule
- number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
- if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTBASE];
-
- goto yynewstate;
-
-
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
-yyerrlab:
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus)
- {
- ++yynerrs;
-
-#ifdef YYERROR_VERBOSE
- yyn = yypact[yystate];
-
- if (yyn > YYFLAG && yyn < YYLAST)
- {
- YYSIZE_T yysize = 0;
- char *yymsg;
- int yyx, yycount;
-
- yycount = 0;
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- for (yyx = yyn < 0 ? -yyn : 0;
- yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
- if (yycheck[yyx + yyn] == yyx)
- yysize += yystrlen (yytname[yyx]) + 15, yycount++;
- yysize += yystrlen ("parse error, unexpected ") + 1;
- yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
- yymsg = (char *) YYSTACK_ALLOC (yysize);
- if (yymsg != 0)
- {
- char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
- yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
-
- if (yycount < 5)
- {
- yycount = 0;
- for (yyx = yyn < 0 ? -yyn : 0;
- yyx < (int) (sizeof (yytname) / sizeof (char *));
- yyx++)
- if (yycheck[yyx + yyn] == yyx)
- {
- const char *yyq = ! yycount ? ", expecting " : " or ";
- yyp = yystpcpy (yyp, yyq);
- yyp = yystpcpy (yyp, yytname[yyx]);
- yycount++;
- }
- }
- yyerror (yymsg);
- YYSTACK_FREE (yymsg);
- }
- else
- yyerror ("parse error; also virtual memory exhausted");
- }
- else
-#endif /* defined (YYERROR_VERBOSE) */
- yyerror ("parse error");
- }
- goto yyerrlab1;
-
-
-/*--------------------------------------------------.
-| yyerrlab1 -- error raised explicitly by an action |
-`--------------------------------------------------*/
-yyerrlab1:
- if (yyerrstatus == 3)
- {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- /* return failure if at end of input */
- if (yychar == YYEOF)
- YYABORT;
- YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
- yychar, yytname[yychar1]));
- yychar = YYEMPTY;
- }
-
- /* Else will try to reuse lookahead token after shifting the error
- token. */
-
- yyerrstatus = 3; /* Each real token shifted decrements this */
-
- goto yyerrhandle;
-
-
-/*-------------------------------------------------------------------.
-| yyerrdefault -- current state does not do anything special for the |
-| error token. |
-`-------------------------------------------------------------------*/
-yyerrdefault:
-#if 0
- /* This is wrong; only states that explicitly want error tokens
- should shift them. */
-
- /* If its default is to accept any token, ok. Otherwise pop it. */
- yyn = yydefact[yystate];
- if (yyn)
- goto yydefault;
-#endif
-
-
-/*---------------------------------------------------------------.
-| yyerrpop -- pop the current state because it cannot handle the |
-| error token |
-`---------------------------------------------------------------*/
-yyerrpop:
- if (yyssp == yyss)
- YYABORT;
- yyvsp--;
- yystate = *--yyssp;
-#if YYLSP_NEEDED
- yylsp--;
-#endif
-
-#if YYDEBUG
- if (yydebug)
- {
- short *yyssp1 = yyss - 1;
- YYFPRINTF (stderr, "Error: state stack now");
- while (yyssp1 != yyssp)
- YYFPRINTF (stderr, " %d", *++yyssp1);
- YYFPRINTF (stderr, "\n");
- }
-#endif
-
-/*--------------.
-| yyerrhandle. |
-`--------------*/
-yyerrhandle:
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yyerrdefault;
-
- yyn += YYTERROR;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
- goto yyerrdefault;
-
- yyn = yytable[yyn];
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrpop;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrpop;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- YYDPRINTF ((stderr, "Shifting error token, "));
-
- *++yyvsp = yylval;
-#if YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here. |
-`-------------------------------------*/
-yyacceptlab:
- yyresult = 0;
- goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here. |
-`-----------------------------------*/
-yyabortlab:
- yyresult = 1;
- goto yyreturn;
-
-/*---------------------------------------------.
-| yyoverflowab -- parser overflow comes here. |
-`---------------------------------------------*/
-yyoverflowlab:
- yyerror ("parser stack overflow");
- yyresult = 2;
- /* Fall through. */
-
-yyreturn:
-#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
-#endif
- return yyresult;
-}
-#line 1730 "rcparse.y"
-
-
-/* Set the language from the command line. */
-
-void
-rcparse_set_language (lang)
- int lang;
-{
- language = lang;
-}
diff --git a/contrib/binutils/binutils/rcparse.h b/contrib/binutils/binutils/rcparse.h
deleted file mode 100644
index 3ad5fd3..0000000
--- a/contrib/binutils/binutils/rcparse.h
+++ /dev/null
@@ -1,134 +0,0 @@
-#ifndef BISON_Y_TAB_H
-# define BISON_Y_TAB_H
-
-#ifndef YYSTYPE
-typedef union
-{
- struct accelerator acc;
- struct accelerator *pacc;
- struct dialog_control *dialog_control;
- struct menuitem *menuitem;
- struct
- {
- struct rcdata_item *first;
- struct rcdata_item *last;
- } rcdata;
- struct rcdata_item *rcdata_item;
- struct stringtable_data *stringtable;
- struct fixed_versioninfo *fixver;
- struct ver_info *verinfo;
- struct ver_stringinfo *verstring;
- struct ver_varinfo *vervar;
- struct res_id id;
- struct res_res_info res_info;
- struct
- {
- unsigned short on;
- unsigned short off;
- } memflags;
- struct
- {
- unsigned long val;
- /* Nonzero if this number was explicitly specified as long. */
- int dword;
- } i;
- unsigned long il;
- unsigned short is;
- const char *s;
- struct
- {
- unsigned long length;
- const char *s;
- } ss;
-} yystype;
-# define YYSTYPE yystype
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-# define BEG 257
-# define END 258
-# define ACCELERATORS 259
-# define VIRTKEY 260
-# define ASCII 261
-# define NOINVERT 262
-# define SHIFT 263
-# define CONTROL 264
-# define ALT 265
-# define BITMAP 266
-# define CURSOR 267
-# define DIALOG 268
-# define DIALOGEX 269
-# define EXSTYLE 270
-# define CAPTION 271
-# define CLASS 272
-# define STYLE 273
-# define AUTO3STATE 274
-# define AUTOCHECKBOX 275
-# define AUTORADIOBUTTON 276
-# define CHECKBOX 277
-# define COMBOBOX 278
-# define CTEXT 279
-# define DEFPUSHBUTTON 280
-# define EDITTEXT 281
-# define GROUPBOX 282
-# define LISTBOX 283
-# define LTEXT 284
-# define PUSHBOX 285
-# define PUSHBUTTON 286
-# define RADIOBUTTON 287
-# define RTEXT 288
-# define SCROLLBAR 289
-# define STATE3 290
-# define USERBUTTON 291
-# define BEDIT 292
-# define HEDIT 293
-# define IEDIT 294
-# define FONT 295
-# define ICON 296
-# define LANGUAGE 297
-# define CHARACTERISTICS 298
-# define VERSIONK 299
-# define MENU 300
-# define MENUEX 301
-# define MENUITEM 302
-# define SEPARATOR 303
-# define POPUP 304
-# define CHECKED 305
-# define GRAYED 306
-# define HELP 307
-# define INACTIVE 308
-# define MENUBARBREAK 309
-# define MENUBREAK 310
-# define MESSAGETABLE 311
-# define RCDATA 312
-# define STRINGTABLE 313
-# define VERSIONINFO 314
-# define FILEVERSION 315
-# define PRODUCTVERSION 316
-# define FILEFLAGSMASK 317
-# define FILEFLAGS 318
-# define FILEOS 319
-# define FILETYPE 320
-# define FILESUBTYPE 321
-# define BLOCKSTRINGFILEINFO 322
-# define BLOCKVARFILEINFO 323
-# define VALUE 324
-# define BLOCK 325
-# define MOVEABLE 326
-# define FIXED 327
-# define PURE 328
-# define IMPURE 329
-# define PRELOAD 330
-# define LOADONCALL 331
-# define DISCARDABLE 332
-# define NOT 333
-# define QUOTEDSTRING 334
-# define STRING 335
-# define NUMBER 336
-# define SIZEDSTRING 337
-# define IGNORED_TOKEN 338
-# define NEG 339
-
-
-extern YYSTYPE yylval;
-
-#endif /* not BISON_Y_TAB_H */
diff --git a/contrib/binutils/gas/config/tc-tic30.c b/contrib/binutils/gas/config/tc-tic30.c
deleted file mode 100644
index 1258b13..0000000
--- a/contrib/binutils/gas/config/tc-tic30.c
+++ /dev/null
@@ -1,1881 +0,0 @@
-/* tc-c30.c -- Assembly code for the Texas Instruments TMS320C30
- Copyright 1998, 1999, 2000, 2001 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 "safe-ctype.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 (&current_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 (&current_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");
-}
-
-void
-md_apply_fix3 (fixP, valP, seg)
- fixS *fixP;
- valueT *valP;
- segT seg ATTRIBUTE_UNUSED;
-{
- 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);
- }
-
- if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
- fixP->fx_done = 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 d55c870..0000000
--- 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 e1e5475..0000000
--- a/contrib/binutils/gas/config/tc-v850.c
+++ /dev/null
@@ -1,2434 +0,0 @@
-/* tc-v850.c -- Assembler code for the NEC V850
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
- 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 "as.h"
-#include "safe-ctype.h"
-#include "subsegs.h"
-#include "opcode/v850.h"
-#include "dwarf2dbg.h"
-
-/* 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},
-};
-
-/* 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;
-
-struct v850_seg_entry
-{
- segT s;
- const char *name;
- flagword flags;
-};
-
-struct v850_seg_entry v850_seg_table[] =
-{
- { NULL, ".sdata",
- SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS
- | SEC_SMALL_DATA },
- { NULL, ".tdata",
- SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS },
- { NULL, ".zdata",
- SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS },
- { NULL, ".sbss",
- SEC_ALLOC | SEC_SMALL_DATA },
- { NULL, ".tbss",
- SEC_ALLOC },
- { NULL, ".zbss",
- SEC_ALLOC},
- { NULL, ".rosdata",
- SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | SEC_DATA
- | SEC_HAS_CONTENTS | SEC_SMALL_DATA },
- { NULL, ".rozdata",
- SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | SEC_DATA
- | SEC_HAS_CONTENTS },
- { NULL, ".scommon",
- SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS
- | SEC_SMALL_DATA | SEC_IS_COMMON },
- { NULL, ".tcommon",
- SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS
- | SEC_IS_COMMON },
- { NULL, ".zcommon",
- SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS
- | SEC_IS_COMMON },
- { NULL, ".call_table_data",
- SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS },
- { NULL, ".call_table_text",
- SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | SEC_CODE
- | SEC_HAS_CONTENTS},
- { NULL, ".bss",
- SEC_ALLOC }
-};
-
-#define SDATA_SECTION 0
-#define TDATA_SECTION 1
-#define ZDATA_SECTION 2
-#define SBSS_SECTION 3
-#define TBSS_SECTION 4
-#define ZBSS_SECTION 5
-#define ROSDATA_SECTION 6
-#define ROZDATA_SECTION 7
-#define SCOMMON_SECTION 8
-#define TCOMMON_SECTION 9
-#define ZCOMMON_SECTION 10
-#define CALL_TABLE_DATA_SECTION 11
-#define CALL_TABLE_TEXT_SECTION 12
-#define BSS_SECTION 13
-
-static void do_v850_seg PARAMS ((int, subsegT));
-
-static void
-do_v850_seg (i, sub)
- int i;
- subsegT sub;
-{
- struct v850_seg_entry *seg = v850_seg_table + i;
-
- obj_elf_section_change_hook ();
- if (seg->s != NULL)
- {
- subseg_set (seg->s, sub);
- }
- else
- {
- seg->s = subseg_new (seg->name, sub);
- bfd_set_section_flags (stdoutput, seg->s, seg->flags);
- if ((seg->flags & SEC_LOAD) == 0)
- seg_info (seg->s)->bss = 1;
- }
-}
-
-static void v850_seg PARAMS ((int i));
-
-static void
-v850_seg (i)
- int i;
-{
- subsegT sub = get_absolute_expression ();
-
- do_v850_seg (i, sub);
- demand_empty_rest_of_line ();
-}
-
-static void v850_offset PARAMS ((int));
-
-static void
-v850_offset (ignore)
- 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 PARAMS ((int));
-
-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 SCOMMON_SECTION:
- do_v850_seg (SBSS_SECTION, 0);
- break;
-
- case ZCOMMON_SECTION:
- do_v850_seg (ZBSS_SECTION, 0);
- break;
-
- case TCOMMON_SECTION:
- do_v850_seg (TBSS_SECTION, 0);
- 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;
-
- record_alignment (now_seg, align);
-
- if (align)
- frag_align (align, 0, 0);
-
- switch (area)
- {
- case SCOMMON_SECTION:
- if (S_GET_SEGMENT (symbolP) == v850_seg_table[SBSS_SECTION].s)
- symbol_get_frag (symbolP)->fr_symbol = 0;
- break;
-
- case ZCOMMON_SECTION:
- if (S_GET_SEGMENT (symbolP) == v850_seg_table[ZBSS_SECTION].s)
- symbol_get_frag (symbolP)->fr_symbol = 0;
- break;
-
- case TCOMMON_SECTION:
- if (S_GET_SEGMENT (symbolP) == v850_seg_table[TBSS_SECTION].s)
- 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 SCOMMON_SECTION:
- S_SET_SEGMENT (symbolP, v850_seg_table[SBSS_SECTION].s);
- break;
-
- case ZCOMMON_SECTION:
- S_SET_SEGMENT (symbolP, v850_seg_table[ZBSS_SECTION].s);
- break;
-
- case TCOMMON_SECTION:
- S_SET_SEGMENT (symbolP, v850_seg_table[TBSS_SECTION].s);
- 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 SCOMMON_SECTION:
- case ZCOMMON_SECTION:
- case TCOMMON_SECTION:
- do_v850_seg (area, 0);
- S_SET_SEGMENT (symbolP, v850_seg_table[area].s);
- 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;
- }
-}
-
-static void set_machine PARAMS ((int));
-
-static void
-set_machine (number)
- 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_seg, SDATA_SECTION },
- { "tdata", v850_seg, TDATA_SECTION },
- { "zdata", v850_seg, ZDATA_SECTION },
- { "sbss", v850_seg, SBSS_SECTION },
- { "tbss", v850_seg, TBSS_SECTION },
- { "zbss", v850_seg, ZBSS_SECTION },
- { "rosdata", v850_seg, ROSDATA_SECTION },
- { "rozdata", v850_seg, ROZDATA_SECTION },
- { "bss", v850_seg, BSS_SECTION },
- { "offset", v850_offset, 0 },
- { "word", cons, 4 },
- { "zcomm", v850_comm, ZCOMMON_SECTION },
- { "scomm", v850_comm, SCOMMON_SECTION },
- { "tcomm", v850_comm, TCOMMON_SECTION },
- { "v850", set_machine, 0 },
- { "call_table_data", v850_seg, CALL_TABLE_DATA_SECTION },
- { "call_table_text", v850_seg, CALL_TABLE_TEXT_SECTION },
- { "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
- PARAMS ((const struct reg_name *, int, const char *, boolean));
-
-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: An 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 PARAMS ((expressionS *));
-
-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: An 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 PARAMS ((expressionS *, boolean, boolean));
-
-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: An 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 PARAMS ((expressionS *));
-
-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 PARAMS ((void));
-
-static void
-skip_white_space ()
-{
- 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
- PARAMS ((unsigned long *, const struct v850_operand *));
-
-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;
-
- 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++;
- }
-
- v850_seg_table[BSS_SECTION].s = bss_section;
- bfd_set_arch_mach (stdoutput, TARGET_ARCH, machine);
-}
-
-static bfd_reloc_code_real_type handle_ctoff
- PARAMS ((const struct v850_operand *));
-
-static bfd_reloc_code_real_type
-handle_ctoff (operand)
- 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
- PARAMS ((const struct v850_operand *));
-
-static bfd_reloc_code_real_type
-handle_sdaoff (operand)
- 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
- PARAMS ((const struct v850_operand *));
-
-static bfd_reloc_code_real_type
-handle_zdaoff (operand)
- 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
- PARAMS ((const struct v850_operand *));
-
-static bfd_reloc_code_real_type
-handle_tdaoff (operand)
- 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
- PARAMS ((const struct v850_operand *));
-
-static bfd_reloc_code_real_type
-v850_reloc_prefix (operand)
- 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
- PARAMS ((unsigned long, const struct v850_operand *, offsetT, char *,
- unsigned int, char *));
-
-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)) - 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_fix3. */
- 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;
-}
-
-void
-md_apply_fix3 (fixP, valueP, seg)
- fixS *fixP;
- valueT *valueP;
- segT seg ATTRIBUTE_UNUSED;
-{
- valueT value = * valueP;
- char *where;
-
- if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
- {
- fixP->fx_done = 0;
- return;
- }
-
- if (fixP->fx_addsy == (symbolS *) NULL)
- fixP->fx_done = 1;
-
- else if (fixP->fx_pcrel)
- ;
-
- 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;
-
- /* 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;
- }
- }
- 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;
-}
-
-/* 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 8257428..0000000
--- a/contrib/binutils/gas/config/tc-v850.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* tc-v850.h -- Header file for tc-v850.c.
- Copyright 1996, 1997, 1998, 2000, 2001, 2002
- 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_operand(x)
-
-#define obj_fix_adjustable(fixP) v850_fix_adjustable(fixP)
-extern boolean v850_fix_adjustable PARAMS ((struct fix *));
-
-#define TC_FORCE_RELOCATION(fixp) v850_force_relocation(fixp)
-extern int v850_force_relocation PARAMS ((struct fix *));
-
-#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
-
-/* 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)
-extern void parse_cons_expression_v850 PARAMS ((expressionS *));
-
-#define TC_CONS_FIX_NEW cons_fix_new_v850
-extern void cons_fix_new_v850 PARAMS ((fragS *, int, int, expressionS *));
-
-#define TC_GENERIC_RELAX_TABLE md_relax_table
-extern const struct relax_type 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 PARAMS ((struct fix *, asection *));
-
-#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 f5b05a6..0000000
--- a/contrib/binutils/gas/config/tc-z8k.c
+++ /dev/null
@@ -1,1566 +0,0 @@
-/* tc-z8k.c -- Assemble code for the Zilog Z800n
- Copyright 1992, 1993, 1994, 1995, 1996, 1998, 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. */
-
-/* Written By Steve Chamberlain <sac@cygnus.com>. */
-
-#define DEFINE_TABLE
-#include <stdio.h>
-
-#include "as.h"
-#include "bfd.h"
-#include "safe-ctype.h"
-#include "opcodes/z8k-opc.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' && (src[2] == 0 || src[2] == ','))
- {
- 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')
- {
- if (src[2] < '0' || src[2] > '9')
- return res; /* Assume no register name but a label starting with 'rr'. */
- *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')
- {
- if (src[2] < '0' || src[2] > '9')
- return res; /* Assume no register name but a label starting with 'rh'. */
- *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')
- {
- if (src[2] < '0' || src[2] > '9')
- return res; /* Assume no register name but a label starting with 'rl'. */
- *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')
- {
- if (src[2] < '0' || src[2] > '9')
- return res; /* Assume no register name but a label starting with 'rq'. */
- *mode = CLASS_REG_QUAD;
- res = whatreg (reg, src + 2);
- regno = *reg;
- if (regno > 12)
- as_warn (_("register rq%d, out of range."), regno);
- }
- else
- {
- if (src[1] < '0' || src[1] > '9')
- return res; /* Assume no register name but a label starting with 'r'. */
- *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, &regn);
-
- 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), &regn);
- 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_fix3 (fixP, valP, segment)
- fixS *fixP;
- valueT * valP;
- segT segment ATTRIBUTE_UNUSED;
-{
- long val = * (long *) valP;
- 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 ();
- }
-
- if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
- fixP->fx_done = 1;
-}
-
-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 d1899e1..0000000
--- 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/doc/c-v850.texi b/contrib/binutils/gas/doc/c-v850.texi
deleted file mode 100644
index 4b36461..0000000
--- 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 d98adea..0000000
--- 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/opcode/mips.h b/contrib/binutils/include/opcode/mips.h
deleted file mode 100644
index 1469e10..0000000
--- a/contrib/binutils/include/opcode/mips.h
+++ /dev/null
@@ -1,789 +0,0 @@
-/* mips.h. Mips opcode list for GDB, the GNU debugger.
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
- 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, and MIPS32 and later
- architectures allow 20 bits to be set with a signal operand
- (using CODE20).
-
- The syscall instruction uses CODE20.
-
- 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_CODE20 0xfffff /* 20 bit syscall/breakpoint code. */
-#define OP_SH_CODE20 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
-#define OP_SH_SEL 0 /* Coprocessor select field. */
-#define OP_MASK_SEL 0x7 /* The sel field of mfcZ and mtcZ. */
-#define OP_SH_CODE19 6 /* 19 bit wait code. */
-#define OP_MASK_CODE19 0x7ffff
-
-/* 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)
- "U" 5 bit same destination register in both OP_*_RD and OP_*_RT
- (used by clo and clz)
- "C" 25 bit coprocessor function code (OP_*_COPZ)
- "B" 20 bit syscall/breakpoint function code (OP_*_CODE20)
- "J" 19 bit wait function code (OP_*_CODE19)
- "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)
- "H" 3 bit sel field for (d)mtc* and (d)mfc* (OP_*_SEL)
- "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:
- "<>(),"
- "ABCDEFGHIJLMNPRSTUVW"
- "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
-
-/* Masks used to mark instructions to indicate which MIPS ISA level
- they were introduced in. ISAs, as defined below, are logical
- ORs of these bits, indicatingthat they support the instructions
- defined at the given level. */
-
-#define INSN_ISA_MASK 0x00000fff
-#define INSN_ISA1 0x00000010
-#define INSN_ISA2 0x00000020
-#define INSN_ISA3 0x00000040
-#define INSN_ISA4 0x00000080
-#define INSN_ISA5 0x00000100
-#define INSN_ISA32 0x00000200
-#define INSN_ISA64 0x00000400
-
-/* Chip specific instructions. These are bitmasks. */
-
-/* MIPS R4650 instruction. */
-#define INSN_4650 0x00010000
-/* LSI R4010 instruction. */
-#define INSN_4010 0x00020000
-/* NEC VR4100 instruction. */
-#define INSN_4100 0x00040000
-/* Toshiba R3900 instruction. */
-#define INSN_3900 0x00080000
-/* MIPS R10000 instruction. */
-#define INSN_10000 0x00100000
-/* Broadcom SB-1 instruction. */
-#define INSN_SB1 0x00200000
-
-/* MIPS ISA defines, use instead of hardcoding ISA level. */
-
-#define ISA_UNKNOWN 0 /* Gas internal use. */
-#define ISA_MIPS1 (INSN_ISA1)
-#define ISA_MIPS2 (ISA_MIPS1 | INSN_ISA2)
-#define ISA_MIPS3 (ISA_MIPS2 | INSN_ISA3)
-#define ISA_MIPS4 (ISA_MIPS3 | INSN_ISA4)
-#define ISA_MIPS5 (ISA_MIPS4 | INSN_ISA5)
-#define ISA_MIPS32 (ISA_MIPS2 | INSN_ISA32)
-#define ISA_MIPS64 (ISA_MIPS5 | INSN_ISA32 | INSN_ISA64)
-
-/* CPU defines, use instead of hardcoding processor number. Keep this
- in sync with bfd/archures.c in order for machine selection to work. */
-#define CPU_UNKNOWN 0 /* Gas internal use. */
-#define CPU_R2000 2000
-#define CPU_R3000 3000
-#define CPU_R3900 3900
-#define CPU_R4000 4000
-#define CPU_R4010 4010
-#define CPU_VR4100 4100
-#define CPU_R4111 4111
-#define CPU_R4300 4300
-#define CPU_R4400 4400
-#define CPU_R4600 4600
-#define CPU_R4650 4650
-#define CPU_R5000 5000
-#define CPU_R6000 6000
-#define CPU_R8000 8000
-#define CPU_R10000 10000
-#define CPU_R12000 12000
-#define CPU_MIPS16 16
-#define CPU_MIPS32 32
-#define CPU_MIPS5 5
-#define CPU_MIPS64 64
-#define CPU_SB1 12310201 /* octal 'SB', 01. */
-
-/* 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. */
-
-#define OPCODE_IS_MEMBER(insn, isa, cpu) \
- (((insn)->membership & isa) != 0 \
- || (cpu == CPU_R4650 && ((insn)->membership & INSN_4650) != 0) \
- || (cpu == CPU_R4010 && ((insn)->membership & INSN_4010) != 0) \
- || ((cpu == CPU_VR4100 || cpu == CPU_R4111) \
- && ((insn)->membership & INSN_4100) != 0) \
- || (cpu == CPU_R3900 && ((insn)->membership & INSN_3900) != 0) \
- || ((cpu == CPU_R10000 || cpu == CPU_R12000) \
- && ((insn)->membership & INSN_10000) != 0) \
- || (cpu == CPU_SB1 && ((insn)->membership & INSN_SB1) != 0) \
- || 0) /* Please keep this term for easier source merging. */
-
-/* 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_MOVE,
- 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 a700275..0000000
--- 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 2183bc8..0000000
--- a/contrib/binutils/include/opcode/v850.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/* v850.h -- Header file for NEC V850 opcode table
- Copyright 1996, 1997, 2001 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
-
-/* 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/ld/emulparams/shelf.sh b/contrib/binutils/ld/emulparams/shelf.sh
deleted file mode 100755
index 5c0c9d6..0000000
--- a/contrib/binutils/ld/emulparams/shelf.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-# If you change this file, please also look at files which source this one:
-# shlelf.sh, shelf_nbsd.sh
-
-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 = .;'
-# This is like setting STACK_ADDR to 0x30000, except that the setting can
-# be overridden, e.g. --defsym _stack=0x0f00, and that we put an extra
-# sentinal value at the bottom.
-# N.B. We can't use PROVIDE to set the default value in a symbol because
-# the address is needed to place the .stack section, which in turn is needed
-# to hold the sentinel value(s).
-OTHER_SECTIONS=" .stack ${RELOCATING-0}${RELOCATING+(DEFINED(_stack) ? _stack : 0x30000)} :
- {
- ${RELOCATING+_stack = .;}
- *(.stack)
- LONG(0xdeaddead)
- }"
-
diff --git a/contrib/binutils/ld/emulparams/shelf_linux.sh b/contrib/binutils/ld/emulparams/shelf_linux.sh
deleted file mode 100644
index b841bef..0000000
--- a/contrib/binutils/ld/emulparams/shelf_linux.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-. ${srcdir}/emulparams/shlelf_linux.sh
-OUTPUT_FORMAT="elf32-shbig-linux"
diff --git a/contrib/binutils/ld/emulparams/tic30aout.sh b/contrib/binutils/ld/emulparams/tic30aout.sh
deleted file mode 100755
index 2a4c13f..0000000
--- 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 df77943..0000000
--- 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 78bfbd3..0000000
--- 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/emulparams/z8001.sh b/contrib/binutils/ld/emulparams/z8001.sh
deleted file mode 100644
index 63645c3..0000000
--- a/contrib/binutils/ld/emulparams/z8001.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-SCRIPT_NAME=z8000
-OUTPUT_FORMAT="coff-z8k"
-OUTPUT_ARCH="z8001"
-TEXT_START_ADDR=0x0
-TARGET_PAGE_SIZE=128
-ARCH=z8k
-BIG=1
diff --git a/contrib/binutils/ld/emulparams/z8002.sh b/contrib/binutils/ld/emulparams/z8002.sh
deleted file mode 100644
index 299b5f5..0000000
--- a/contrib/binutils/ld/emulparams/z8002.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-SCRIPT_NAME=z8000
-OUTPUT_FORMAT="coff-z8k"
-OUTPUT_ARCH="z8002"
-TEXT_START_ADDR=0x0
-TARGET_PAGE_SIZE=128
-ARCH=z8002
diff --git a/contrib/binutils/ld/scripttempl/tic30aout.sc b/contrib/binutils/ld/scripttempl/tic30aout.sc
deleted file mode 100644
index 28baed3..0000000
--- 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 df2d4f7..0000000
--- 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 8958321..0000000
--- a/contrib/binutils/ld/scripttempl/v850.sc
+++ /dev/null
@@ -1,230 +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.gcc_except_table : { *(.rel.gcc_except_table) }
- .rela.gcc_except_table : { *(.rela.gcc_except_table) }
- .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 = .;}
- }
- .jcr :
- {
- KEEP (*(.jcr))
- }
-
- .gcc_except_table : { *(.gcc_except_table) }
-
- .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/ld/scripttempl/z8000.sc b/contrib/binutils/ld/scripttempl/z8000.sc
deleted file mode 100644
index 646c880..0000000
--- a/contrib/binutils/ld/scripttempl/z8000.sc
+++ /dev/null
@@ -1,57 +0,0 @@
-cat <<EOF
-OUTPUT_FORMAT("${OUTPUT_FORMAT}")
-OUTPUT_ARCH("${OUTPUT_ARCH}")
-ENTRY(_start)
-
-SECTIONS
-{
-.text ${BIG+ ${RELOCATING+ 0x0000000}} :
- {
- *(.text)
- *(.strings)
- *(.rdata)
- }
-
-.ctors ${BIG+ ${RELOCATING+ 0x2000000}} :
- {
- ${CONSTRUCTING+ ___ctors = . ; }
- *(.ctors);
- ${CONSTRUCTING+ ___ctors_end = . ; }
- ___dtors = . ;
- *(.dtors);
- ${CONSTRUCTING+ ___dtors_end = . ; }
- }
-
-.data ${BIG+ ${RELOCATING+ 0x3000000}} :
- {
- *(.data)
- }
-
-.bss ${BIG+ ${RELOCATING+ 0x4000000}} :
- {
- ${RELOCATING+ __start_bss = . ; }
- *(.bss);
- *(COMMON);
- ${RELOCATING+ __end_bss = . ; }
- }
-
-.heap ${BIG+ ${RELOCATING+ 0x5000000}} :
- {
- ${RELOCATING+ __start_heap = . ; }
- ${RELOCATING+ . = . + 20k ; }
- ${RELOCATING+ __end_heap = . ; }
- }
-
-.stack ${RELOCATING+ 0xf000 } :
- {
- ${RELOCATING+ _stack = . ; }
- *(.stack)
- ${RELOCATING+ __stack_top = . ; }
- }
-
-}
-EOF
-
-
-
-
diff --git a/contrib/binutils/opcodes/tic30-dis.c b/contrib/binutils/opcodes/tic30-dis.c
deleted file mode 100644
index 67956f7..0000000
--- 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 e72b1e8..0000000
--- a/contrib/binutils/opcodes/v850-dis.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/* Disassemble V850 instructions.
- Copyright 1996, 1997, 1998, 2000, 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. */
-
-
-#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
- PARAMS ((bfd_vma, struct disassemble_info *, unsigned long));
-
-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 43ce2f1..0000000
--- a/contrib/binutils/opcodes/v850-opc.c
+++ /dev/null
@@ -1,813 +0,0 @@
-/* Assemble V850 instructions.
- Copyright 1996, 1997, 1998, 2000, 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. */
-
-#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))
-
-static long unsigned insert_d9 PARAMS ((long unsigned, long, const char **));
-static long unsigned extract_d9 PARAMS ((long unsigned, int *));
-static long unsigned insert_d22 PARAMS ((long unsigned, long, const char **));
-static long unsigned extract_d22 PARAMS ((long unsigned, int *));
-static long unsigned insert_d16_15 PARAMS ((long unsigned, long, const char **));
-static long unsigned extract_d16_15 PARAMS ((long unsigned, int *));
-static long unsigned insert_d8_7 PARAMS ((long unsigned, long, const char **));
-static long unsigned extract_d8_7 PARAMS ((long unsigned, int *));
-static long unsigned insert_d8_6 PARAMS ((long unsigned, long, const char **));
-static long unsigned extract_d8_6 PARAMS ((long unsigned, int *));
-static long unsigned insert_d5_4 PARAMS ((long unsigned, long, const char **));
-static long unsigned extract_d5_4 PARAMS ((long unsigned, int *));
-static long unsigned insert_d16_16 PARAMS ((long unsigned, long, const char **));
-static long unsigned extract_d16_16 PARAMS ((long unsigned, int *));
-static long unsigned insert_i9 PARAMS ((long unsigned, long, const char **));
-static long unsigned extract_i9 PARAMS ((long unsigned, int *));
-static long unsigned insert_u9 PARAMS ((long unsigned, long, const char **));
-static long unsigned extract_u9 PARAMS ((long unsigned, int *));
-static long unsigned insert_spe PARAMS ((long unsigned, long, const char **));
-static long unsigned extract_spe PARAMS ((long unsigned, int *));
-static long unsigned insert_i5div PARAMS ((long unsigned, long, const char **));
-static long unsigned extract_i5div PARAMS ((long unsigned, int *));
-
-
-/* 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 ATTRIBUTE_UNUSED;
-{
- 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 ATTRIBUTE_UNUSED;
-{
- 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 ATTRIBUTE_UNUSED;
-{
- 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 ATTRIBUTE_UNUSED;
-{
- 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 ATTRIBUTE_UNUSED;
-{
- 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 ATTRIBUTE_UNUSED;
-{
- 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 ATTRIBUTE_UNUSED;
-{
- 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 ATTRIBUTE_UNUSED;
-{
- signed long ret = insn & 0x003c0000;
-
- ret <<= 10;
- ret >>= 23;
-
- ret |= (insn & 0x1f);
-
- return ret;
-}
-
-static unsigned long
-insert_u9 (insn, v, errmsg)
- unsigned long insn;
- long v;
- const char ** errmsg;
-{
- unsigned long value = (unsigned long) v;
- 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 ATTRIBUTE_UNUSED;
-{
- unsigned long ret = insn & 0x003c0000;
-
- ret >>= 13;
-
- ret |= (insn & 0x1f);
-
- return ret;
-}
-
-static unsigned long
-insert_spe (insn, v, errmsg)
- unsigned long insn;
- long v;
- const char ** errmsg;
-{
- unsigned long value = (unsigned long) v;
-
- if (value != 3)
- * errmsg = _("invalid register for stack adjustment");
-
- return insn & (~ 0x180000);
-}
-
-static unsigned long
-extract_spe (insn, invalid)
- unsigned long insn ATTRIBUTE_UNUSED;
- int * invalid ATTRIBUTE_UNUSED;
-{
- return 3;
-}
-
-static unsigned long
-insert_i5div (insn, v, errmsg)
- unsigned long insn;
- long v;
- const char ** errmsg;
-{
- unsigned long value = (unsigned long) v;
-
- 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 ATTRIBUTE_UNUSED;
-{
- 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 091d937..0000000
--- a/contrib/binutils/opcodes/z8k-dis.c
+++ /dev/null
@@ -1,587 +0,0 @@
-/* Disassemble z8000 code.
- Copyright 1992, 1993, 1998, 2000, 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. */
-
-#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;
-
-static int fetch_data PARAMS ((struct disassemble_info *, int));
-
-
-/* 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"
-};
-
-static char *ctrl_names[8] = {
- "<invld>",
- "flags",
- "fcw",
- "refresh",
- "psapseg",
- "psapoff",
- "nspseg",
- "nspoff"
-};
-
-static int seg_length;
-static int print_insn_z8k PARAMS ((bfd_vma, disassemble_info *, int));
-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 *, int));
-
-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, is_segmented);
- output_instr (&instr_data, addr, info);
- return z8k_table[instr_data.tabl_index].length + seg_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 ATTRIBUTE_UNUSED;
- 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 + seg_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 int tabl_datum, datum_class;
- unsigned short datum_value;
-
- nibl_count = 0;
- loop = 0;
- seg_length = 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 & ~1];
- instr_word = instr_data->words[nibl_count & ~3];
-
- 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_DISP:
- switch (datum_value)
- {
- case ARG_DISP16:
- instr_data->displacement = instr_data->insn_start + 4
- + (signed short) (instr_word & 0xffff);
- nibl_count += 3;
- break;
- case ARG_DISP12:
- if (instr_word & 0x800)
- {
- /* neg. 12 bit displacement */
- instr_data->displacement = instr_data->insn_start + 2
- - (signed short) ((instr_word & 0xfff) | 0xf000) * 2;
- }
- else
- {
- instr_data->displacement = instr_data->insn_start + 2
- - (instr_word & 0x0fff) * 2;
- }
- 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_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;
- seg_length = 2;
- }
- 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:
- case CLASS_1CCC:
- instr_data->ctrl_code = instr_nibl & 0x7;
- break;
- case CLASS_0DISP7:
- instr_data->displacement =
- instr_data->insn_start + 2 - (instr_byte & 0x7f) * 2;
- nibl_count += 1;
- break;
- case CLASS_1DISP7:
- instr_data->displacement =
- instr_data->insn_start + 2 - (instr_byte & 0x7f) * 2;
- 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:
- instr_data->ctrl_code = instr_nibl & 0x7;
- break;
- case CLASS_FLAGS:
- instr_data->flags = instr_nibl;
- break;
- case CLASS_REG:
- instr_data->arg_reg[datum_value] = instr_nibl;
- break;
- case CLASS_REGN0:
- instr_data->arg_reg[datum_value] = instr_nibl;
- break;
- case CLASS_DISP8:
- instr_data->displacement =
- instr_data->insn_start + 2 + (signed char) instr_byte * 2;
- nibl_count += 1;
- break;
- default:
- abort ();
- break;
- }
-
- loop += 1;
- nibl_count += 1;
- }
-}
-
-static void
-unparse_instr (instr_data, is_segmented)
- instr_data_s *instr_data;
- int is_segmented;
-{
- unsigned short datum_value;
- unsigned int tabl_datum, datum_class;
- 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, "%s", ctrl_names[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:
- if (is_segmented)
- sprintf (tmp_str, "@rr%ld", instr_data->arg_reg[datum_value]);
- else
- 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;
- case CLASS_PR:
- if (is_segmented)
- sprintf (tmp_str, "rr%ld", instr_data->arg_reg[datum_value]);
- else
- sprintf (tmp_str, "r%ld", instr_data->arg_reg[datum_value]);
- strcat (out_str, tmp_str);
- break;
- default:
- abort ();
- 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 c62867c..0000000
--- a/contrib/binutils/opcodes/z8k-opc.h
+++ /dev/null
@@ -1,4479 +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_trtrb 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
-#define OPC_ldctlb 174
-#define OPC_sin 175
-#define OPC_trtdb 176
-typedef struct {
-#ifdef NICENAMES
-char *nicename;
-int type;
-int cycles;
-int flags;
-#endif
-char *name;
-unsigned char opcode;
-void (*func) PARAMS ((void));
-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},
-
-
-/* 1000 1100 ssss 1001 *** ldctlb ctrl,rbs */
-{
-#ifdef NICENAMES
-"ldctlb ctrl,rbs",32,7,
-0x3f,
-#endif
-"ldctlb",OPC_ldctlb,0,{CLASS_CTRL,CLASS_REG_BYTE+(ARG_RS),},
- {CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RS),CLASS_BIT+9,0,0,0,0,0,},2,2,193},
-
-
-/* 1000 1100 dddd 0001 *** ldctlb rbd,ctrl */
-{
-#ifdef NICENAMES
-"ldctlb rbd,ctrl",32,7,
-0x00,
-#endif
-"ldctlb",OPC_ldctlb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_CTRL,},
- {CLASS_BIT+8,CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_BIT+1,0,0,0,0,0,},2,2,194},
-
-
-/* 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,195},
-
-
-/* 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,196},
-
-
-/* 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,197},
-
-
-/* 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,198},
-
-
-/* 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,199},
-
-
-/* 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,200},
-
-
-/* 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,201},
-
-
-/* 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,202},
-
-
-/* 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,203},
-
-
-/* 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,204},
-
-
-/* 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,205},
-
-
-/* 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,206},
-
-
-/* 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,207},
-
-
-/* 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,208},
-
-
-/* 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,209},
-
-
-/* 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,210},
-
-
-/* 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,211},
-
-
-/* 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,212},
-
-
-/* 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,213},
-
-
-/* 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,214},
-
-
-/* 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,215},
-
-
-/* 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,216},
-
-
-/* 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,217},
-
-
-/* 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,218},
-
-
-/* 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,219},
-
-
-/* 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,220},
-
-
-/* 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,221},
-
-
-/* 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,222},
-
-
-/* 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,223},
-
-
-/* 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,224},
-
-
-/* 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,225},
-
-
-/* 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,226},
-
-
-/* 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,227},
-
-
-/* 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,228},
-
-
-/* 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,229},
-
-
-/* 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,230},
-
-
-/* 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,231},
-
-
-/* 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,232},
-
-
-/* 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,233},
-
-
-/* 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,234},
-
-
-/* 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,235},
-
-
-/* 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,236},
-
-
-/* 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,237},
-
-
-/* 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,238},
-
-
-/* 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,239},
-
-
-/* 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,240},
-
-
-/* 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,241},
-
-
-/* 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,242},
-
-
-/* 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,243},
-
-
-/* 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,244},
-
-
-/* 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,245},
-
-
-/* 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,246},
-
-
-/* 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,247},
-
-
-/* 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,248},
-
-
-/* 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,249},
-
-
-/* 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,250},
-
-
-/* 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,251},
-
-
-/* 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,252},
-
-
-/* 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,253},
-
-
-/* 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,254},
-
-
-/* 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,255},
-
-
-/* 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,256},
-
-
-/* 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,257},
-
-
-/* 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,258},
-
-
-/* 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,259},
-
-
-/* 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,260},
-
-
-/* 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,261},
-
-
-/* 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,262},
-
-
-/* 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,263},
-
-
-/* 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,264},
-
-
-/* 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,265},
-
-
-/* 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,266},
-
-
-/* 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,267},
-
-
-/* 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,268},
-
-
-/* 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,269},
-
-
-/* 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,270},
-
-
-/* 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,271},
-
-
-/* 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,272},
-
-
-/* 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,273},
-
-
-/* 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,274},
-
-
-/* 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,275},
-
-
-/* 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,276},
-
-
-/* 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,277},
-
-
-/* 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,278},
-
-
-/* 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,279},
-
-
-/* 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,280},
-
-
-/* 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,281},
-
-
-/* 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,282},
-
-
-/* 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,283},
-
-
-/* 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,284},
-
-
-/* 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,285},
-
-
-/* 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,286},
-
-
-/* 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,287},
-
-
-/* 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,288},
-
-
-/* 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,289},
-
-
-/* 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,290},
-
-
-/* 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,291},
-
-
-/* 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,292},
-
-
-/* 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,293},
-
-
-/* 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,294},
-
-
-/* 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,295},
-
-
-/* 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,296},
-
-
-/* 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,297},
-
-
-/* 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,298},
-
-
-/* 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,299},
-
-
-/* 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,300},
-
-
-/* 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,301},
-
-
-/* 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,302},
-
-
-/* 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,303},
-
-
-/* 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,304},
-
-
-/* 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,305},
-
-
-/* 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,306},
-
-
-/* 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,307},
-
-
-/* 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,308},
-
-
-/* 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,309},
-
-
-/* 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,310},
-
-
-/* 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,311},
-
-
-/* 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,312},
-
-
-/* 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,313},
-
-
-/* 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,314},
-
-
-/* 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,315},
-
-
-/* 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,316},
-
-
-/* 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,317},
-
-
-/* 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,318},
-
-
-/* 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,319},
-
-
-/* 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,320},
-
-
-/* 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,321},
-
-
-/* 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,322},
-
-
-/* 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,323},
-
-
-/* 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,324},
-
-
-/* 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,325},
-
-
-/* 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,326},
-
-
-/* 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,327},
-
-
-/* 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,328},
-
-
-/* 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,329},
-
-
-/* 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,330},
-
-
-/* 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,331},
-
-
-/* 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,332},
-
-
-/* 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,333},
-
-
-/* 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,334},
-
-
-/* 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,335},
-
-
-/* 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,336},
-
-
-/* 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,337},
-
-
-/* 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,338},
-
-
-/* 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,339},
-
-
-/* 0011 1011 dddd 0101 imm16 *** sin rd,imm16 */
-{
-#ifdef NICENAMES
-"sin rd,imm16",8,0,
-0x00,
-#endif
-"sin",OPC_sin,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,340},
-
-
-/* 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,341},
-
-
-/* 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,342},
-
-
-/* 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,343},
-
-
-/* 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,344},
-
-
-/* 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,345},
-
-
-/* 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,346},
-
-
-/* 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,347},
-
-
-/* 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,348},
-
-
-/* 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,349},
-
-
-/* 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,350},
-
-
-/* 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,351},
-
-
-/* 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,352},
-
-
-/* 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,353},
-
-
-/* 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,354},
-
-
-/* 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,355},
-
-
-/* 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,356},
-
-
-/* 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,357},
-
-
-/* 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,358},
-
-
-/* 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,359},
-
-
-/* 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,360},
-
-
-/* 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,361},
-
-
-/* 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,362},
-
-
-/* 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,363},
-
-
-/* 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,364},
-
-
-/* 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,365},
-
-
-/* 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,366},
-
-
-/* 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,367},
-
-
-/* 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,368},
-
-
-/* 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,369},
-
-
-/* 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,370},
-
-
-/* 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,371},
-
-
-/* 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,372},
-
-
-/* 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,373},
-
-
-/* 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,374},
-
-
-/* 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,375},
-
-
-/* 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,376},
-
-
-/* 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,377},
-
-
-/* 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,378},
-
-
-/* 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,379},
-
-
-/* 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,380},
-
-
-/* 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,381},
-
-
-/* 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,382},
-
-
-/* 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,383},
-
-
-/* 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,384},
-
-
-/* 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,385},
-
-
-/* 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,386},
-
-
-/* 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,387},
-
-
-/* 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,388},
-
-
-/* 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,389},
-
-
-/* 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,390},
-
-
-/* 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,391},
-
-
-/* 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,392},
-
-
-/* 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,393},
-
-
-/* 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,394},
-
-
-/* 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,395},
-
-
-/* 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,396},
-
-
-/* 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,397},
-
-
-/* 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,398},
-
-
-/* 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,399},
-
-
-/* 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,400},
-
-
-/* 1011 1000 aaN0 1010 0000 rrrr bbN0 0000 *** trtrb @ra,@rb,rbr */
-{
-#ifdef NICENAMES
-"trtrb @ra,@rb,rbr",8,25,
-0x1c,
-#endif
-"trtrb",OPC_trtrb,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,401},
-
-
-/* 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,402},
-
-
-/* 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,403},
-
-
-/* 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,404},
-
-
-/* 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,405},
-
-
-/* 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,406},
-
-
-/* 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,407},
-
-
-/* 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,408},
-
-
-/* 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,409},
-
-
-/* 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,410},
-
-
-/* 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,411},
-
-
-/* 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,412},
-
-
-/* 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,413},
-
-
-/* 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,414},
-
-
-/* 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,415},
-
-
-/* 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,416},
-
-
-/* 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,417},
-
-
-/* 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,418},
-
-
-/* 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,419},
-
-
-/* 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,420},
-
-/* end marker */
-{
-#ifdef NICENAMES
-NULL,0,0,
-0,
-#endif
-NULL,0,0,{0,0,0,0},{0,0,0,0,0,0,0,0,0,0},0,0,0}
-};
-#endif
diff --git a/contrib/binutils/opcodes/z8kgen.c b/contrib/binutils/opcodes/z8kgen.c
deleted file mode 100644
index f171724..0000000
--- a/contrib/binutils/opcodes/z8kgen.c
+++ /dev/null
@@ -1,1325 +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 <stdio.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 @rd,@rs,rr", 0,
- "---V--", 11, 16, "1011 1011 ssN0 1001 0000 rrrr ddN0 0000", "lddr @rd,@rs,rr", 0,
- "---V--", 11, 8, "1011 1010 ssN0 1001 0000 rrrr ddN0 0000", "lddrb @rd,@rs,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 @rd,@rs,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 flags 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 0disp7", "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 1disp7", "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 1010 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 1010 ssN0 0000 0000 aaaa ddN0 1000", "inib @rd,@rs,ra", 0,
- "---V--", 21, 16, "0011 1010 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, "0110 1110 ddN0 ssss 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 ssss 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, 16, "0011 1010 ssN0 1010 0000 aaaa ddN0 1000", "outdb @rd,@rs,rba", 0,
- "---V--", 0, 16, "0011 1011 ssN0 0010 0000 aaaa ddN0 1000", "outi @rd,@rs,ra", 0,
- "---V--", 0, 16, "0011 1010 ssN0 0010 0000 aaaa ddN0 1000", "outib @rd,@rs,ra", 0,
- "---V--", 0, 16, "0011 1010 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 flags 0011", "resflg flags", 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 flags 0001", "setflg flags", 0,
-
- "------", 0, 8, "0011 1010 dddd 0101 imm16", "sinb rbd,imm16", 0,
- "------", 0, 8, "0011 1011 dddd 0101 imm16", "sin 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 1010 ssN0 0001 0000 aaaa ddN0 1000", "sinib @rd,@rs,ra", 0,
- "------", 0, 16, "0011 1010 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 1010 ssN0 0011 0000 aaaa ddN0 1000", "soutib @rd,@rs,ra", 0,
- "------", 0, 16, "0011 1010 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 0000 0000 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 0000 0000 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 0011 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 1010 0000 rrrr bbN0 0000", "trtdb @ra,@rb,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,rbr", 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,
-
- "------", 7, 32, "1000 1100 dddd 0001", "ldctlb rbd,ctrl", 0,
- "CZSVDH", 7, 32, "1000 1100 ssss 1001", "ldctlb ctrl,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 = (struct op *) 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 = (struct op *) 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");
- printf ("#define OPC_outi 173\n");
- printf ("#define OPC_ldctlb 174\n");
- printf ("#define OPC_sin 175\n");
- printf ("#define OPC_trtdb 176\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) PARAMS ((void));\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 ("\n/* end marker */\n");
- printf ("{\n#ifdef NICENAMES\nNULL,0,0,\n0,\n#endif\n");
- printf ("NULL,0,0,{0,0,0,0},{0,0,0,0,0,0,0,0,0,0},0,0,0}\n};\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;
-}
OpenPOWER on IntegriCloud