Contribute sh64-elf.

2002-02-08  Alexandre Oliva  <aoliva@redhat.com>
	    Stephen Clarke <Stephen.Clarke@st.com>
* doc/c-sh64.texi: Fix citation of SH64 architecture manual.
2002-01-31  Alexandre Oliva  <aoliva@redhat.com>
* config/tc-sh.c (md_relax_table): Added default sizes for
non-PC-relative UNDEF_MOVI, and relaxation sequences for
MOVI_16, MOVI_32 and MOVI_48.
* config/tc-sh64.c (shmedia_md_apply_fix3): Fix warning.
(shmedia_md_convert_frag): Handle non-PC-relative UNDEF_MOVI
and MOVI_16.
(shmedia_md_estimate_size_before_relax): Remove redundant
blocks.	 Set fragP->fr_var even if relaxation type unchanged.
Retain UNDEF_MOVI until expression decays to number.
2002-01-24  Alexandre Oliva  <aoliva@redhat.com>
* config/tc-sh64.c (shmedia_init_reloc): Handle new SHmedia PIC
relocation types.  Take fixP->fx_addnumber into account too.
(shmedia_md_apply_fix): Likewise.
(shmedia_md_convert_frag): Likewise.
(shmedia_build_Mytes): Likewise.
(sh64_consume_datalabel): Complain about nested datalabel.
Support PIC relocs.  Call sh_parse_name.
* config/tc-sh64.h (TC_RELOC_RTSYM_LOC_FIXUP): Extend definition
in tc-sh.h to SHmedia reloc types.
* config/tc-sh.c (SH64PCRELPLT, MOVI_PLT, MOVI_GOTOFF,
MOVI_GOTPC): New relaxation constants.
(md_relax_table): Introduce relaxation directives for PIC-related
constants.
(sh_PIC_related_p): Handle datalabel.
(sh_check_fixup): Choose SH5 PIC relocations.
(sh_cons_fix_new): Added BDF_RELOC_64.
(md_apply_fix3, sh_parse_name): Handle GOTPLT.
2002-01-18  Alexandre Oliva  <aoliva@redhat.com>
* config/tc-sh64.c (sh64_max_mem_for_rs_align_code): If the
current ISA is SHmedia, get 7 bytes.
2001-11-28  Nick Clifton  <nickc@cambridge.redhat.com>
* config/tc-sh.c (md_apply_fix3): Treat shmedia_md_apply_fix3 as a
void function.
* config/tc-sh64.c (shmedia_apply_fix): Rename to
shmedia_apply_fix3 and make void.
2001-05-17  Alexandre Oliva  <aoliva@redhat.com>
* config/tc-sh64.c (s_sh64_abi): Remove unused arguments passed to
as_bad.
2001-04-12  Alexandre Oliva  <aoliva@redhat.com>
* config/tc-sh64.h (md_parse_name): Take &c as argument.
2001-03-14  DJ Delorie	<dj@redhat.com>
* doc/Makefile.am (CPU_DOCS): Added c-sh64.texi
* doc/Makefile.in(CPU_DOCS): Ditto.
* doc/c-sh64.texi: New file.
* doc/as.texinfo: Add SH64 support.
2001-03-13  DJ Delorie	<dj@redhat.com>
* config/tc-sh64.c (shmedia_get_operands): Rename A_RESV_Fx to
A_REUSE_PREV so that its purpose is more obvious.
(shmedia_build_Mytes): Ditto.
2001-03-07  DJ Delorie	<dj@redhat.com>
* config/tc-sh64.c (sh64_vtable_entry): New, strip datalabels
before processing.
(sh64_vtable_inherit): Ditto.
(strip_datalabels): New, strip "datalabel" from given line.
* config/tc-sh.c (md_pseudo_table): Add sh64-specific vtable
pseudos.
2001-03-06  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.c (shmedia_md_assemble): Move dwarf2_emit_insn
call ...
(shmedia_build_Mytes): ... to here.
2001-03-06  DJ Delorie	<dj@redhat.com>
* config/tc-sh.c: Remove sh64-specific uaquad now that there
is a generic one.
2001-01-21  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.h (DWARF2_LINE_MIN_INSN_LENGTH): Override.
* config/tc-sh64.c (shmedia_md_assemble): Offset recorded insn
address by one in call to dwarf2_emit_insn.
2001-01-13  Hans-Peter Nilsson	<hpn@cygnus.com>
Implement ".abi" pseudo and correct .cranges descriptors.  Correct
alignment handling broken by imported changes.
* config/tc-sh64.h (HANDLE_ALIGN): Override definition in tc-sh.h.
(sh64_handle_align): Declare.
(MAX_MEM_FOR_RS_ALIGN_CODE): Override definition in tc-sh.h.
(sh64_max_mem_for_rs_align_code): Declare.
(enum sh64_isa_values): Moved here from tc-sh64.c.
(md_do_align): Define.
(sh64_do_align): Declare.
(struct sh64_tc_frag_data): New.
(TC_FRAG_TYPE): Change to struct sh64_tc_frag_data.  Users
changed.
(TC_FRAG_INIT): Change to set new datatype.
(struct sh64_segment_info_type): Rename member
last_flushed_location to last_contents_mark.  All users changed.
(md_elf_section_change_hook, TC_CONS_FIX_NEW): Do not define.
(shmedia_elf_new_section, sh64_tc_cons_fix_new): Do not prototype.
* config/tc-sh.c (md_pseudo_table): Add ".abi".
(sh_elf_cons) [HAVE_SH64]: Call sh64_update_contents_mark instead
of unsetting seen_insn.
(md_assemble) [HAVE_SH64] <before new SHcompact sequence>: Also
call sh64_update_contents_mark.
(sh_handle_align): Remove HAVE_SH64-conditioned code.
* config/tc-sh64.c (sh64_isa_mode): Correct type from boolean to
enum sh64_isa_values.
(sh64_set_contents_type): Drop segT parameter.	All callers changed.
(emitting_crange): Boolean guard moved to file scope from function
scope in sh64_set_contents_type.
(s_sh64_abi): New.
(sh64_update_contents_mark): New; most split out from
sh64_flush_pending_output.
(shmedia_md_end): Call sh64_update_contents_mark.  Set
sh64_isa_mode to sh64_isa_sh5_guard unless sh64_isa_unspecified.
(sh64_do_align): New function.
(sh64_max_mem_for_rs_align_code): New function.
(sh64_handle_align): Rename from shmedia_do_align.  Make
non-static.  Add head comment.	Emit zero bytes for n bytes modulo
four.  Change return-type to void.
(shmedia_elf_new_section): Remove.
(shmedia_md_assemble): Call sh64_update_contents_mark.
(s_sh64_mode): Ditto.  Do not call md_flush_pending_output.  Make
new frag.  Call sh64_update_contents_mark after making the new
frag.
(sh64_flush_pending_output): Just call sh64_update_contents_mark
and sh_flush_pending_output.
(sh64_flag_output): Also call md_flush_pending_output, but add
condition on not emitting_crange.
(sh64_tc_cons_fix_new): Remove.
2001-01-12  Nick Clifton  <nickc@redhat.com>
* config/tc-sh64.c (shmedia_do_align): Fix to work with new
alignment handling scheme imported from sourceware.
2001-01-12  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.h (TARGET_FORMAT): Define.
(sh64_target_format): Prototype.
* config/tc-sh64.c (sh64_target_mach): New function.
2001-01-07  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.c (shmedia_md_end): When equating a symbol, use
zero_address_frag instead of copying the frag of the symbol.
(shmedia_frob_file_before_adjust): Ditto.
(shmedia_md_apply_fix) <case BFD_RELOC_SH_IMM_MEDLOW16>: Cast mask
to valueT to remove signedness.
(shmedia_md_convert_frag): Add parameter final.	 Rename parameter
headers to output_bfd.	Do not evaluate symbols if final is false;
do emit fixups.
(shmedia_md_estimate_size_before_relax) <case C (MOVI_IMM_32,
UNDEF_MOVI) et al>: If symbol cannot be modified to be PC-relative
to the current frag, call shmedia_md_convert_frag to emit fixups
and make frag_wane neutralize the frag.	 Update comments.
* config/tc-sh.c (md_convert_frag): Change caller of
shmedia_md_convert_frag.
2001-01-06  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.h: Tweak comments and correct formatting.
* config/tc-sh64.c: Ditto.
(shmedia_md_convert_frag) <PT/PTA/PTB 32, 48 and 64 bit
expansion, MOVI pcrel expansion>: Fix thinko calculating offset
for the no-relocation case.
(shmedia_check_limits): Fix range check being off-by-one for PTA.
* config/tc-sh.c: Ditto.  Add proper comments to #ifdef/#ifndef
wrappers.
(SH64PCREL16_F): Increment for proper max-PTA handling.	 Update
comment.
(SH64PCREL16_M, MOVI_16_M): Correct range thinko.
(SH64PCREL48_M, MOVI_48_M): Similar; don't count in length of
expansion.
(SH64PCREL32_M, MOVI_32_M): Ditto; handle overflowing expression.
Correct comment.
2001-01-05  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.c (shmedia_md_apply_fix) <second switch, case
BFD_RELOC_SH_PT_16>: Set lowest bit in field to be relocated to 1.
(shmedia_md_convert_frag) <case C (SH64PCREL16_32, SH64PCREL16) et
al>: Set lowest bit of field to relocate to 1 and rest to empty,
if reloc is emitted.
2000-12-31  Hans-Peter Nilsson	<hpn@cygnus.com>
New options plus bugfixes.
* config/tc-sh.c (md_longopts): New options "-no-expand" and
"-expand-pt32".
(md_parse_option): Handle new options.
(md_show_usage): Add blurb for new options.
* config/tc-sh64.c (SHMEDIA_BFD_RELOC_PT): New macro.
(sh64_expand, sh64_pt32): New variables.
(shmedia_init_reloc): Handle BFD_RELOC_SH_PT_16.
(shmedia_md_apply_fix): Hold original fixP->fx_r_type in
orig_fx_r_type.	 Change SHMEDIA_BFD_RELOC_PT into
BFD_RELOC_SH_PT_16.  Handle BFD_RELOC_SH_PT_16 as pc-relative.
<resolved previously-pc-relative relocs>: Handle
SHMEDIA_BFD_RELOC_PT and BFD_RELOC_SH_PT_16.
(shmedia_md_convert_frag) <case C (SH64PCREL16PT_64, SH64PCREL16),
case C (SH64PCREL16PT_32, SH64PCREL16)>: Modify to PTB if operand
points to SHcompact code.
<case C (SH64PCREL16_32, SH64PCREL16), case C (SH64PCREL16_64,
SH64PCREL16)>: Check that ISA of what operand points at and
PTA/PTB matches, or emit error.
(shmedia_check_limits): Handle BFD_RELOC_SH_PT_16 and
SHMEDIA_BFD_RELOC_PT.
(shmedia_immediate_op): If pcrel, emit fixup also for constant
operand.
(shmedia_build_Mytes) <case A_IMMS16>: Also check sh64_expand in
condition for MOVI expansion.
<case A_PCIMMS16BY4>: Handle expansion to 32 bits only, if
sh64_pt32.  Emit only a BFD_RELOC_SH_PT_16 fixup if not
sh64_expand.
<case A_PCIMMS16BY4_PT>: Likewise, but emit a SHMEDIA_BFD_RELOC_PT
fixup.
(sh64_target_format): Error-check setting of sh64_pt32 and
sh64_expand.  Fix typo in check for sh64_shcompact_const_crange.
(shmedia_md_pcrel_from_section): Handle BFD_RELOC_SH_PT_16 and
SHMEDIA_BFD_RELOC_PT as coming from SHmedia code.
2000-12-31  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.c: Improve comments.
(shmedia_md_convert_frag): Remove inactive is_pt_variant code.	Do
not say the linker will check correctness of PTA/PTB expansion.
(shmedia_md_end): Make non-static.
* config/tc-sh64.h (md_end): Define to shmedia_md_end.	Add
prototype.
* config/tc-sh.c (sh_finalize): Remove.
* config/tc-sh.h (md_end): Do not define.
Remove prototype for sh_finalize.
2000-12-30  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.c (shmedia_frob_section_type): Use a struct
sh64_section_data container when storing section type in tdata
field in elf_section_data.
* config/tc-sh.c (sh_elf_final_processing): Change from EF_SH64 to
EF_SH5.
* Makefile.am: Update dependencies.
* Makefile.in: Regenerate.
2000-12-22  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.c (shmedia_md_assemble): Don't protect
dwarf2_emit_insn call with test on debug_type.
2000-12-19  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.c (sh64_set_contents_type): Make contents-type
CRT_SH5_ISA32 sticky for 64-bit.
2000-12-18  Hans-Peter Nilsson	<hpn@cygnus.com>
Generate .crange sections when switching ISA mode or emitting
constants in same section as code.
* config/tc-sh64.c: Reformat structure definitions.
(sh64_end_of_assembly, sh64_mix, sh64_shcompact_const_crange): New
variables.
(sh64_set_contents_type): Rename from sh64_init_section.  Rewrite
to emit a .cranges descriptor when contents type changes.  Only
emit error if changing contents type and -no-mix is in effect.
(sh64_emit_crange, sh64_flush_last_crange, sh64_flag_output,
sh64_flush_pending_output, sh64_tc_cons_fix_new): New functions.
(shmedia_md_end): Set sh64_end_of_assembly.  Pass
sh64_flush_last_crange over sections.
When checking main symbol of datalabel symbol, check for
STO_SH5_ISA32, not ISA type of section in definition.
(shmedia_frob_file_before_adjust): Check main symbol for
STO_SH5_ISA32; don't check ISA type of section in definition.
(shmedia_frob_section_type): Adjust for .cranges; set section flag
to SHF_SH5_ISA32_MIXED or SHF_SH5_ISA32 according to whether
.cranges entries have been output.
(shmedia_elf_new_section): Just call md_flush_pending_output.
(shmedia_md_assemble): Do not emit a BFD_RELOC_SH_SHMEDIA_CODE
fix.  Do not set tc_segment_info_data.in_code for section.  Call
sh64_set_contents_type for SHmedia code.
(s_sh64_mode): Do not call sh64_init_section or set seen_insn to
false.	Call md_flush_pending_output.
(sh64_target_format): Check that -no-mix and
-shcompact-const-crange are used in sane combination with other
options.
(shmedia_md_pcrel_from_section): Check type of fix for how to
adjust pc-relative.
(sh64_consume_datalabel): Check symbol for having STO_SH5_ISA32,
not ISA type of section in definition.
* config/tc-sh64.h (struct sh64_segment_info_type): Rewrite to
hold contents-type state.
(md_flush_pending_output): Redefine to sh64_flush_pending_output.
(sh64_flush_pending_output): Declare.
(TC_CONS_FIX_NEW): Define to sh64_tc_cons_fix_new.
(sh64_tc_cons_fix_new): Declare.
* config/tc-sh.c (sh_elf_cons) [HAVE_SH64]: Unset seen_insn and
call sh64_flag_output.
(md_assemble) [HAVE_SH64]: Do not emit BFD_RELOC_SH_CODE.  Just
call sh64_set_contents_type to mark SHcompact code and set
seen_insn.
(md_longopts): New options "-no-mix" and
"-shcompact-const-crange".
(md_parse_option): Handle new options.
(md_show_usage): Add blurb for new options.
(md_number_to_chars) [HAVE_SH64]: Call sh64_flag_output.
2000-12-15  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.c: Delete investigated and obsolete fixme:s.
(sh64_last_insn_frag): New.
(shmedia_md_convert_frag): Use tc_frag_data field of incoming frag
to get frag for insn opcode for generating fixups; do not assume it
is the same frag.
(shmedia_build_Mytes): Set sh64_last_insn_frag after growing frag
for new insn.
* config/tc-sh64.h (ELF_TC_SPECIAL_SECTIONS): Define for .cranges
section.
(TC_FRAG_TYPE): Define as fragS *.
(TC_FRAG_INIT): Define to set tc_frag_data to sh64_last_insn_frag.
(sh64_last_insn_frag): Declare.
(sh64_consume_datalabel): Fix typo; check for seginfo != NULL,
not == NULL before dereferencing.
2000-12-12  Hans-Peter Nilsson	<hpn@cygnus.com>
Get rid of BFD section flag and EF_SH64_ABI64.
* config/tc-sh64.c (shmedia_frob_section_type): Use
elf_section_data (sec)->tdata, not a specific BFD section flag, to
communicate the section as containing SHmedia code.  Describe why.
* config/tc-sh.c (sh_elf_final_processing): Tweak comment.  Set
EF_SH64 regardless of ABI.
* config/tc-sh64.c (shmedia_md_apply_fix): Decapitalize "invalid"
in error message.  Handle resolved expressions for
BFD_RELOC_SH_IMMS10, BFD_RELOC_SH_IMMS10BY2,
BFD_RELOC_SH_IMMS10BY4 and BFD_RELOC_64.
(shmedia_check_limits): Handle BFD_RELOC_64.
(sh64_adjust_symtab): Do not decrement the GAS symbol value for
a STO_SH5_ISA32 symbol, only the BFD value.
2000-12-11  Ben Elliston  <bje@redhat.com>
* config/tc-sh64.c: Call dwarf2_emit_insn, not the defunct
dwarf2_generate_asm_lineno.
2000-12-11  Hans-Peter Nilsson	<hpn@cygnus.com>
Handle PC-relative MOVI expansions with assembler relaxation.
Generate PC-relative relocs from 16-bit PC-relative expressions.
* config/tc-sh64.c (SHMEDIA_MD_PCREL_FROM_FIX): Break out from...
(shmedia_md_pcrel_from_section): ...here.
(shmedia_md_apply_fix): Handle fixups for 16-bit operands that has
turned completely resolved.  Adjust relocation type for 16-bit
immediate operands that has turned PC-relative.	 Adjust back for
MD_PCREL_FROM_SECTION being applied twice.
(shmedia_md_convert_frag): Always emit reloc for expression with
global or weak symbol.	Handle relaxation result for PC-relative
expressions.
(shmedia_md_estimate_size_before_relax): An expression with a weak
or global symbol can not be relaxed.  Break out tests for
relaxable symbol into variable sym_relaxable.
<cases C (MOVI_IMM_64, UNDEF_MOVI) and C (MOVI_IMM_32,
UNDEF_MOVI)>: Break out any PC-relative expression and change
relaxation type.
(shmedia_build_Mytes): CSE &operands->operands[j] into variable
opjp.
<case A_IMMS16>: Fix typo for initial minor relaxation type of
MOVI expansion.	 If X_op_symbol of the immediate expression is
set, make an expression symbol for the argument to frag_var.
* config/tc-sh.c (MOVI_IMM_32_PCREL, MOVI_IMM_64_PCREL): New
relaxations.
(END): Adjust for new relaxations.
(md_relax_table): Add entries for new relaxations.
2000-12-07  Ben Elliston  <bje@redhat.com>
* config/tc-sh64.c (shmedia_parse_reg): Initialize variable len.
2000-12-07  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.c (shmedia_md_convert_frag): Correct all MOVI and
SHORI operand offsets in PT/PTA/PTB expansions.
2000-12-05  Hans-Peter Nilsson	<hpn@cygnus.com>
Implement DataLabel semantics.
* config/tc-sh.c (sh_frob_file) [HAVE_SH64]: Call
shmedia_frob_file_before_adjust.
* config/tc-sh64.c [! OBJ_ELF]: Emit #error.
(DATALABEL_SUFFIX): Define.
(shmedia_md_end) <before adjusting STO_SH5_ISA32 symbols>: Walk
symbol list to update "datalabel" symbols to their main symbol
counterparts.
(shmedia_frob_file_before_adjust): New.
(sh64_adjust_symtab): For remaining datalabel symbols, set to
undefined and set STT_DATALABEL.
(sh64_frob_label): Initialize TC symbol field.
(sh64_consume_datalabel): Actually implement semantics.	 New
parameter operandf, call it instead of expression.
(sh64_exclude_symbol): New.
* config/tc-sh64.h (md_parse_name): Pass on the function operand
to sh64_consume_datalabel.
(tc_symbol_new_hook): Define to tc_frob_symbol.
(TC_SYMFIELD_TYPE): Define to symbolS *.
(tc_frob_symbol): Define to call sh64_exclude_symbol.
2000-12-01  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.c (shmedia_init_reloc): Tweak comment for default
case.
(shmedia_md_assemble): Call dwarf2_generate_asm_lineno if
generating dwarf2 debug information.
2000-11-30  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.c (sh64_target_format): Use elf64-sh64l and
elf64-sh64 for the 64-bit ABI.
* config/tc-sh.c (md_show_usage): Tweak usage output for -abi=*
option.
2000-11-29  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh.c: Remove conditionalizing on HAVE_SH64 for
case-insensitivity.
2000-11-27  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.c: Tweak comments, formatting and error messages.
(enum sh64_abi_values): New type.
(enum sh64_isa_values): New type.
(sh64_isa_mode): Replace shmedia_mode.	All referers changed.
(seen_shcompact_mode, seen_shmedia_mode): Delete.
(sh64_abi): Replace shmedia_64.
(shmedia_md_convert_frag) <C (MOVI_IMM_64, MOVI_64),
C (MOVI_IMM_32, MOVI_32)>: Correct register number handling.
(s_sh64_mode): Check validity for this target.
(sh64_target_format): Initialize defaults for ISA and ABI.
Fallback to old object format if no SH64 ISA or ABI has been
specified.
* config/tc-sh.c (md_parse_option): Check combinations for errors.
(sh_elf_final_processing): Change to have EF_SH64_ABI64 for 64-bit
ABI and EF_SH64 for 32-bit ABI, if SH64 options are specified.
* config/tc-sh64.h: Fix typo in comment.
2000-11-25  Hans-Peter Nilsson	<hpn@cygnus.com>
* config/tc-sh64.c (shmedia_md_estimate_size_before_relax)
<PT fixups for absolute values>: Size will be longest, not
shortest.
(shmedia_md_convert_frag): Disable PTB-warning machinery.  Correct
all MOVI and SHORI operand offsets in PT/PTA/PTB expansions.
* config/tc-sh.c (parse_reg) [HAVE_SH64]: Add local variables l0
and l1 to hold lowercase of two first characters.  Change all
remaining TO_LOWER to tolower.
* config/tc-sh64.c (TO_LOWER): Delete.
(shmedia_find_cooked_opcode): Use tolower, not TO_LOWER.
(md_parse_name): Define.
(sh64_consume_datalabel): Declare.
(DOLLAR_DOT): Define.
* config/tc-sh64.c (shmedia_parse_exp): New.
(sh64_consume_datalabel): New; just ignoring datalabel semantics.
(shmedia_parse_reg): Remove const from src
parameter.
(shmedia_get_operands): Ditto for args parameter and ptr variable.
(shmedia_md_assemble): Ditto for op_end variable.
(shmedia_get_operand): Ditto for ptr parameter and src variable.
Use shmedia_parse_exp, not parse_exp.
* config/tc-sh64.c (shmedia_parse_reg): Add shmedia_arg_type
parameter.  All callers changed.
(shmedia_get_operand): Add shmedia_arg_type parameter.	All
callers changed.
(shmedia_parse_reg): Put first two character in local variables.
Use tolower, not TO_LOWER.  If no register is found and argtype
indicates a control register, scan shmedia_creg_table
case-insensitive.
2000-11-24  Hans-Peter Nilsson	<hpn@cygnus.com>
* Makefile.am (CPU_TYPES): Add sh64.
(TARGET_CPU_CFILES): Add config/tc-sh64.c.
(TARGET_CPU_HFILES): Add config/tc-sh64.h.
Regenerate dependencies.
* Makefile.in: Regenerate.
* configure.in: Add support for sh64-*-elf*.
* configure: Regenerate.
* config/tc-sh64.h: New.
* config/tc-sh64.c: New.
* config/tc-sh.c (md_pseudo_table) [HAVE_SH64]: New pseudos
.mode, .isa and .uaquad.
[HAVE_SH64] (SH64PCREL16_32, SH64PCREL16_64, SH64PCREL16PT_32,
SH64PCREL16PT_64, MOVI_IMM_32, MOVI_IMM_64): Define.
[HAVE_SH64] (END): Define as 10.
[HAVE_SH64] (UNDEF_SH64PCREL, SH64PCREL16, SH64PCREL32,
SH64PCREL48, SH64PCREL64, UNDEF_MOVI, MOVI_16, MOVI_32, MOVI_48,
MOVI_64): Define.
[HAVE_SH64] (SH64PCREL16_F, SH64PCREL16_M, SH64PCREL16_LENGTH,
SH64PCREL32_F, SH64PCREL32_M, SH64PCREL32_LENGTH, SH64PCREL48_F,
SH64PCREL48_M, SH64PCREL48_LENGTH, SH64PCREL64_LENGTH,
MOVI_16_LENGTH, MOVI_32_LENGTH, MOVI_48_LENGTH, MOVI_64_LENGTH):
Define.
(md_relax_table) [HAVE_SH64]: Provide relaxations for SHmedia.
(md_begin) [HAVE_SH64]: Call shmedia_md_begin.
(parse_reg) [HAVE_SH64]: Parse register names case-insensitive.
(md_assemble) [HAVE_SH64]: Call shmedia_md_assemble if assembling
SHmedia instructions.  Handle state-change after switching to
SHcompact.
(md_longopts) [HAVE_SH64]: New options --isa=* and --abi=*.
(md_parse_option) [HAVE_SH64]: Parse new options.
(md_show_usage) [HAVE_SH64]: Show usage of new options.
(md_convert_frag) [HAVE_SH64] <default>: Call
shmedia_md_convert_frag instead of abort.
(sh_force_relocation) [HAVE_SH64]: Also force relocation for
BFD_RELOC_SH_SHMEDIA_CODE.
(sh_elf_final_processing) [HAVE_SH64]: Set flags identifying
SHcompact or SHmedia code.
(md_apply_fix) [HAVE_SH64] <default>: Return result from calling
shmedia_md_apply_fix instead of abort.
(md_estimate_size_before_relax) [HAVE_SH64] <default>: Return
result from calling shmedia_md_estimate_size_before_relax instead
of calling abort.
(sh_do_align) [HAVE_SH64]: If shmedia_mode, let shmedia_do_align
do the work.
(tc_gen_reloc) [HAVE_SH64]: For unrecognized relocs, call
shmedia_init_reloc and do nothing more if it returns non-zero.
(sh_finalize) [HAVE_SH64]: Call shmedia_md_end.
* po/POTFILES.in: Regenerate.
* po/gas.pot: Regenerate.
This commit is contained in:
Alexandre Oliva 2002-02-08 06:32:23 +00:00
parent d28847ce8e
commit 324bfcf3bb
15 changed files with 5670 additions and 413 deletions

View file

@ -1,3 +1,474 @@
2002-02-08 Alexandre Oliva <aoliva@redhat.com>
Contribute sh64-elf.
2002-02-08 Alexandre Oliva <aoliva@redhat.com>
Stephen Clarke <Stephen.Clarke@st.com>
* doc/c-sh64.texi: Fix citation of SH64 architecture manual.
2002-01-31 Alexandre Oliva <aoliva@redhat.com>
* config/tc-sh.c (md_relax_table): Added default sizes for
non-PC-relative UNDEF_MOVI, and relaxation sequences for
MOVI_16, MOVI_32 and MOVI_48.
* config/tc-sh64.c (shmedia_md_apply_fix3): Fix warning.
(shmedia_md_convert_frag): Handle non-PC-relative UNDEF_MOVI
and MOVI_16.
(shmedia_md_estimate_size_before_relax): Remove redundant
blocks. Set fragP->fr_var even if relaxation type unchanged.
Retain UNDEF_MOVI until expression decays to number.
2002-01-24 Alexandre Oliva <aoliva@redhat.com>
* config/tc-sh64.c (shmedia_init_reloc): Handle new SHmedia PIC
relocation types. Take fixP->fx_addnumber into account too.
(shmedia_md_apply_fix): Likewise.
(shmedia_md_convert_frag): Likewise.
(shmedia_build_Mytes): Likewise.
(sh64_consume_datalabel): Complain about nested datalabel.
Support PIC relocs. Call sh_parse_name.
* config/tc-sh64.h (TC_RELOC_RTSYM_LOC_FIXUP): Extend definition
in tc-sh.h to SHmedia reloc types.
* config/tc-sh.c (SH64PCRELPLT, MOVI_PLT, MOVI_GOTOFF,
MOVI_GOTPC): New relaxation constants.
(md_relax_table): Introduce relaxation directives for PIC-related
constants.
(sh_PIC_related_p): Handle datalabel.
(sh_check_fixup): Choose SH5 PIC relocations.
(sh_cons_fix_new): Added BDF_RELOC_64.
(md_apply_fix3, sh_parse_name): Handle GOTPLT.
2002-01-18 Alexandre Oliva <aoliva@redhat.com>
* config/tc-sh64.c (sh64_max_mem_for_rs_align_code): If the
current ISA is SHmedia, get 7 bytes.
2001-11-28 Nick Clifton <nickc@cambridge.redhat.com>
* config/tc-sh.c (md_apply_fix3): Treat shmedia_md_apply_fix3 as a
void function.
* config/tc-sh64.c (shmedia_apply_fix): Rename to
shmedia_apply_fix3 and make void.
2001-05-17 Alexandre Oliva <aoliva@redhat.com>
* config/tc-sh64.c (s_sh64_abi): Remove unused arguments passed to
as_bad.
2001-04-12 Alexandre Oliva <aoliva@redhat.com>
* config/tc-sh64.h (md_parse_name): Take &c as argument.
2001-03-14 DJ Delorie <dj@redhat.com>
* doc/Makefile.am (CPU_DOCS): Added c-sh64.texi
* doc/Makefile.in(CPU_DOCS): Ditto.
* doc/c-sh64.texi: New file.
* doc/as.texinfo: Add SH64 support.
2001-03-13 DJ Delorie <dj@redhat.com>
* config/tc-sh64.c (shmedia_get_operands): Rename A_RESV_Fx to
A_REUSE_PREV so that its purpose is more obvious.
(shmedia_build_Mytes): Ditto.
2001-03-07 DJ Delorie <dj@redhat.com>
* config/tc-sh64.c (sh64_vtable_entry): New, strip datalabels
before processing.
(sh64_vtable_inherit): Ditto.
(strip_datalabels): New, strip "datalabel" from given line.
* config/tc-sh.c (md_pseudo_table): Add sh64-specific vtable
pseudos.
2001-03-06 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.c (shmedia_md_assemble): Move dwarf2_emit_insn
call ...
(shmedia_build_Mytes): ... to here.
2001-03-06 DJ Delorie <dj@redhat.com>
* config/tc-sh.c: Remove sh64-specific uaquad now that there
is a generic one.
2001-01-21 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.h (DWARF2_LINE_MIN_INSN_LENGTH): Override.
* config/tc-sh64.c (shmedia_md_assemble): Offset recorded insn
address by one in call to dwarf2_emit_insn.
2001-01-13 Hans-Peter Nilsson <hpn@cygnus.com>
Implement ".abi" pseudo and correct .cranges descriptors. Correct
alignment handling broken by imported changes.
* config/tc-sh64.h (HANDLE_ALIGN): Override definition in tc-sh.h.
(sh64_handle_align): Declare.
(MAX_MEM_FOR_RS_ALIGN_CODE): Override definition in tc-sh.h.
(sh64_max_mem_for_rs_align_code): Declare.
(enum sh64_isa_values): Moved here from tc-sh64.c.
(md_do_align): Define.
(sh64_do_align): Declare.
(struct sh64_tc_frag_data): New.
(TC_FRAG_TYPE): Change to struct sh64_tc_frag_data. Users
changed.
(TC_FRAG_INIT): Change to set new datatype.
(struct sh64_segment_info_type): Rename member
last_flushed_location to last_contents_mark. All users changed.
(md_elf_section_change_hook, TC_CONS_FIX_NEW): Do not define.
(shmedia_elf_new_section, sh64_tc_cons_fix_new): Do not prototype.
* config/tc-sh.c (md_pseudo_table): Add ".abi".
(sh_elf_cons) [HAVE_SH64]: Call sh64_update_contents_mark instead
of unsetting seen_insn.
(md_assemble) [HAVE_SH64] <before new SHcompact sequence>: Also
call sh64_update_contents_mark.
(sh_handle_align): Remove HAVE_SH64-conditioned code.
* config/tc-sh64.c (sh64_isa_mode): Correct type from boolean to
enum sh64_isa_values.
(sh64_set_contents_type): Drop segT parameter. All callers changed.
(emitting_crange): Boolean guard moved to file scope from function
scope in sh64_set_contents_type.
(s_sh64_abi): New.
(sh64_update_contents_mark): New; most split out from
sh64_flush_pending_output.
(shmedia_md_end): Call sh64_update_contents_mark. Set
sh64_isa_mode to sh64_isa_sh5_guard unless sh64_isa_unspecified.
(sh64_do_align): New function.
(sh64_max_mem_for_rs_align_code): New function.
(sh64_handle_align): Rename from shmedia_do_align. Make
non-static. Add head comment. Emit zero bytes for n bytes modulo
four. Change return-type to void.
(shmedia_elf_new_section): Remove.
(shmedia_md_assemble): Call sh64_update_contents_mark.
(s_sh64_mode): Ditto. Do not call md_flush_pending_output. Make
new frag. Call sh64_update_contents_mark after making the new
frag.
(sh64_flush_pending_output): Just call sh64_update_contents_mark
and sh_flush_pending_output.
(sh64_flag_output): Also call md_flush_pending_output, but add
condition on not emitting_crange.
(sh64_tc_cons_fix_new): Remove.
2001-01-12 Nick Clifton <nickc@redhat.com>
* config/tc-sh64.c (shmedia_do_align): Fix to work with new
alignment handling scheme imported from sourceware.
2001-01-12 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.h (TARGET_FORMAT): Define.
(sh64_target_format): Prototype.
* config/tc-sh64.c (sh64_target_mach): New function.
2001-01-07 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.c (shmedia_md_end): When equating a symbol, use
zero_address_frag instead of copying the frag of the symbol.
(shmedia_frob_file_before_adjust): Ditto.
(shmedia_md_apply_fix) <case BFD_RELOC_SH_IMM_MEDLOW16>: Cast mask
to valueT to remove signedness.
(shmedia_md_convert_frag): Add parameter final. Rename parameter
headers to output_bfd. Do not evaluate symbols if final is false;
do emit fixups.
(shmedia_md_estimate_size_before_relax) <case C (MOVI_IMM_32,
UNDEF_MOVI) et al>: If symbol cannot be modified to be PC-relative
to the current frag, call shmedia_md_convert_frag to emit fixups
and make frag_wane neutralize the frag. Update comments.
* config/tc-sh.c (md_convert_frag): Change caller of
shmedia_md_convert_frag.
2001-01-06 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.h: Tweak comments and correct formatting.
* config/tc-sh64.c: Ditto.
(shmedia_md_convert_frag) <PT/PTA/PTB 32, 48 and 64 bit
expansion, MOVI pcrel expansion>: Fix thinko calculating offset
for the no-relocation case.
(shmedia_check_limits): Fix range check being off-by-one for PTA.
* config/tc-sh.c: Ditto. Add proper comments to #ifdef/#ifndef
wrappers.
(SH64PCREL16_F): Increment for proper max-PTA handling. Update
comment.
(SH64PCREL16_M, MOVI_16_M): Correct range thinko.
(SH64PCREL48_M, MOVI_48_M): Similar; don't count in length of
expansion.
(SH64PCREL32_M, MOVI_32_M): Ditto; handle overflowing expression.
Correct comment.
2001-01-05 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.c (shmedia_md_apply_fix) <second switch, case
BFD_RELOC_SH_PT_16>: Set lowest bit in field to be relocated to 1.
(shmedia_md_convert_frag) <case C (SH64PCREL16_32, SH64PCREL16) et
al>: Set lowest bit of field to relocate to 1 and rest to empty,
if reloc is emitted.
2000-12-31 Hans-Peter Nilsson <hpn@cygnus.com>
New options plus bugfixes.
* config/tc-sh.c (md_longopts): New options "-no-expand" and
"-expand-pt32".
(md_parse_option): Handle new options.
(md_show_usage): Add blurb for new options.
* config/tc-sh64.c (SHMEDIA_BFD_RELOC_PT): New macro.
(sh64_expand, sh64_pt32): New variables.
(shmedia_init_reloc): Handle BFD_RELOC_SH_PT_16.
(shmedia_md_apply_fix): Hold original fixP->fx_r_type in
orig_fx_r_type. Change SHMEDIA_BFD_RELOC_PT into
BFD_RELOC_SH_PT_16. Handle BFD_RELOC_SH_PT_16 as pc-relative.
<resolved previously-pc-relative relocs>: Handle
SHMEDIA_BFD_RELOC_PT and BFD_RELOC_SH_PT_16.
(shmedia_md_convert_frag) <case C (SH64PCREL16PT_64, SH64PCREL16),
case C (SH64PCREL16PT_32, SH64PCREL16)>: Modify to PTB if operand
points to SHcompact code.
<case C (SH64PCREL16_32, SH64PCREL16), case C (SH64PCREL16_64,
SH64PCREL16)>: Check that ISA of what operand points at and
PTA/PTB matches, or emit error.
(shmedia_check_limits): Handle BFD_RELOC_SH_PT_16 and
SHMEDIA_BFD_RELOC_PT.
(shmedia_immediate_op): If pcrel, emit fixup also for constant
operand.
(shmedia_build_Mytes) <case A_IMMS16>: Also check sh64_expand in
condition for MOVI expansion.
<case A_PCIMMS16BY4>: Handle expansion to 32 bits only, if
sh64_pt32. Emit only a BFD_RELOC_SH_PT_16 fixup if not
sh64_expand.
<case A_PCIMMS16BY4_PT>: Likewise, but emit a SHMEDIA_BFD_RELOC_PT
fixup.
(sh64_target_format): Error-check setting of sh64_pt32 and
sh64_expand. Fix typo in check for sh64_shcompact_const_crange.
(shmedia_md_pcrel_from_section): Handle BFD_RELOC_SH_PT_16 and
SHMEDIA_BFD_RELOC_PT as coming from SHmedia code.
2000-12-31 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.c: Improve comments.
(shmedia_md_convert_frag): Remove inactive is_pt_variant code. Do
not say the linker will check correctness of PTA/PTB expansion.
(shmedia_md_end): Make non-static.
* config/tc-sh64.h (md_end): Define to shmedia_md_end. Add
prototype.
* config/tc-sh.c (sh_finalize): Remove.
* config/tc-sh.h (md_end): Do not define.
Remove prototype for sh_finalize.
2000-12-30 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.c (shmedia_frob_section_type): Use a struct
sh64_section_data container when storing section type in tdata
field in elf_section_data.
* config/tc-sh.c (sh_elf_final_processing): Change from EF_SH64 to
EF_SH5.
* Makefile.am: Update dependencies.
* Makefile.in: Regenerate.
2000-12-22 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.c (shmedia_md_assemble): Don't protect
dwarf2_emit_insn call with test on debug_type.
2000-12-19 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.c (sh64_set_contents_type): Make contents-type
CRT_SH5_ISA32 sticky for 64-bit.
2000-12-18 Hans-Peter Nilsson <hpn@cygnus.com>
Generate .crange sections when switching ISA mode or emitting
constants in same section as code.
* config/tc-sh64.c: Reformat structure definitions.
(sh64_end_of_assembly, sh64_mix, sh64_shcompact_const_crange): New
variables.
(sh64_set_contents_type): Rename from sh64_init_section. Rewrite
to emit a .cranges descriptor when contents type changes. Only
emit error if changing contents type and -no-mix is in effect.
(sh64_emit_crange, sh64_flush_last_crange, sh64_flag_output,
sh64_flush_pending_output, sh64_tc_cons_fix_new): New functions.
(shmedia_md_end): Set sh64_end_of_assembly. Pass
sh64_flush_last_crange over sections.
When checking main symbol of datalabel symbol, check for
STO_SH5_ISA32, not ISA type of section in definition.
(shmedia_frob_file_before_adjust): Check main symbol for
STO_SH5_ISA32; don't check ISA type of section in definition.
(shmedia_frob_section_type): Adjust for .cranges; set section flag
to SHF_SH5_ISA32_MIXED or SHF_SH5_ISA32 according to whether
.cranges entries have been output.
(shmedia_elf_new_section): Just call md_flush_pending_output.
(shmedia_md_assemble): Do not emit a BFD_RELOC_SH_SHMEDIA_CODE
fix. Do not set tc_segment_info_data.in_code for section. Call
sh64_set_contents_type for SHmedia code.
(s_sh64_mode): Do not call sh64_init_section or set seen_insn to
false. Call md_flush_pending_output.
(sh64_target_format): Check that -no-mix and
-shcompact-const-crange are used in sane combination with other
options.
(shmedia_md_pcrel_from_section): Check type of fix for how to
adjust pc-relative.
(sh64_consume_datalabel): Check symbol for having STO_SH5_ISA32,
not ISA type of section in definition.
* config/tc-sh64.h (struct sh64_segment_info_type): Rewrite to
hold contents-type state.
(md_flush_pending_output): Redefine to sh64_flush_pending_output.
(sh64_flush_pending_output): Declare.
(TC_CONS_FIX_NEW): Define to sh64_tc_cons_fix_new.
(sh64_tc_cons_fix_new): Declare.
* config/tc-sh.c (sh_elf_cons) [HAVE_SH64]: Unset seen_insn and
call sh64_flag_output.
(md_assemble) [HAVE_SH64]: Do not emit BFD_RELOC_SH_CODE. Just
call sh64_set_contents_type to mark SHcompact code and set
seen_insn.
(md_longopts): New options "-no-mix" and
"-shcompact-const-crange".
(md_parse_option): Handle new options.
(md_show_usage): Add blurb for new options.
(md_number_to_chars) [HAVE_SH64]: Call sh64_flag_output.
2000-12-15 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.c: Delete investigated and obsolete fixme:s.
(sh64_last_insn_frag): New.
(shmedia_md_convert_frag): Use tc_frag_data field of incoming frag
to get frag for insn opcode for generating fixups; do not assume it
is the same frag.
(shmedia_build_Mytes): Set sh64_last_insn_frag after growing frag
for new insn.
* config/tc-sh64.h (ELF_TC_SPECIAL_SECTIONS): Define for .cranges
section.
(TC_FRAG_TYPE): Define as fragS *.
(TC_FRAG_INIT): Define to set tc_frag_data to sh64_last_insn_frag.
(sh64_last_insn_frag): Declare.
(sh64_consume_datalabel): Fix typo; check for seginfo != NULL,
not == NULL before dereferencing.
2000-12-12 Hans-Peter Nilsson <hpn@cygnus.com>
Get rid of BFD section flag and EF_SH64_ABI64.
* config/tc-sh64.c (shmedia_frob_section_type): Use
elf_section_data (sec)->tdata, not a specific BFD section flag, to
communicate the section as containing SHmedia code. Describe why.
* config/tc-sh.c (sh_elf_final_processing): Tweak comment. Set
EF_SH64 regardless of ABI.
* config/tc-sh64.c (shmedia_md_apply_fix): Decapitalize "invalid"
in error message. Handle resolved expressions for
BFD_RELOC_SH_IMMS10, BFD_RELOC_SH_IMMS10BY2,
BFD_RELOC_SH_IMMS10BY4 and BFD_RELOC_64.
(shmedia_check_limits): Handle BFD_RELOC_64.
(sh64_adjust_symtab): Do not decrement the GAS symbol value for
a STO_SH5_ISA32 symbol, only the BFD value.
2000-12-11 Ben Elliston <bje@redhat.com>
* config/tc-sh64.c: Call dwarf2_emit_insn, not the defunct
dwarf2_generate_asm_lineno.
2000-12-11 Hans-Peter Nilsson <hpn@cygnus.com>
Handle PC-relative MOVI expansions with assembler relaxation.
Generate PC-relative relocs from 16-bit PC-relative expressions.
* config/tc-sh64.c (SHMEDIA_MD_PCREL_FROM_FIX): Break out from...
(shmedia_md_pcrel_from_section): ...here.
(shmedia_md_apply_fix): Handle fixups for 16-bit operands that has
turned completely resolved. Adjust relocation type for 16-bit
immediate operands that has turned PC-relative. Adjust back for
MD_PCREL_FROM_SECTION being applied twice.
(shmedia_md_convert_frag): Always emit reloc for expression with
global or weak symbol. Handle relaxation result for PC-relative
expressions.
(shmedia_md_estimate_size_before_relax): An expression with a weak
or global symbol can not be relaxed. Break out tests for
relaxable symbol into variable sym_relaxable.
<cases C (MOVI_IMM_64, UNDEF_MOVI) and C (MOVI_IMM_32,
UNDEF_MOVI)>: Break out any PC-relative expression and change
relaxation type.
(shmedia_build_Mytes): CSE &operands->operands[j] into variable
opjp.
<case A_IMMS16>: Fix typo for initial minor relaxation type of
MOVI expansion. If X_op_symbol of the immediate expression is
set, make an expression symbol for the argument to frag_var.
* config/tc-sh.c (MOVI_IMM_32_PCREL, MOVI_IMM_64_PCREL): New
relaxations.
(END): Adjust for new relaxations.
(md_relax_table): Add entries for new relaxations.
2000-12-07 Ben Elliston <bje@redhat.com>
* config/tc-sh64.c (shmedia_parse_reg): Initialize variable len.
2000-12-07 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.c (shmedia_md_convert_frag): Correct all MOVI and
SHORI operand offsets in PT/PTA/PTB expansions.
2000-12-05 Hans-Peter Nilsson <hpn@cygnus.com>
Implement DataLabel semantics.
* config/tc-sh.c (sh_frob_file) [HAVE_SH64]: Call
shmedia_frob_file_before_adjust.
* config/tc-sh64.c [! OBJ_ELF]: Emit #error.
(DATALABEL_SUFFIX): Define.
(shmedia_md_end) <before adjusting STO_SH5_ISA32 symbols>: Walk
symbol list to update "datalabel" symbols to their main symbol
counterparts.
(shmedia_frob_file_before_adjust): New.
(sh64_adjust_symtab): For remaining datalabel symbols, set to
undefined and set STT_DATALABEL.
(sh64_frob_label): Initialize TC symbol field.
(sh64_consume_datalabel): Actually implement semantics. New
parameter operandf, call it instead of expression.
(sh64_exclude_symbol): New.
* config/tc-sh64.h (md_parse_name): Pass on the function operand
to sh64_consume_datalabel.
(tc_symbol_new_hook): Define to tc_frob_symbol.
(TC_SYMFIELD_TYPE): Define to symbolS *.
(tc_frob_symbol): Define to call sh64_exclude_symbol.
2000-12-01 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.c (shmedia_init_reloc): Tweak comment for default
case.
(shmedia_md_assemble): Call dwarf2_generate_asm_lineno if
generating dwarf2 debug information.
2000-11-30 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.c (sh64_target_format): Use elf64-sh64l and
elf64-sh64 for the 64-bit ABI.
* config/tc-sh.c (md_show_usage): Tweak usage output for -abi=*
option.
2000-11-29 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh.c: Remove conditionalizing on HAVE_SH64 for
case-insensitivity.
2000-11-27 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.c: Tweak comments, formatting and error messages.
(enum sh64_abi_values): New type.
(enum sh64_isa_values): New type.
(sh64_isa_mode): Replace shmedia_mode. All referers changed.
(seen_shcompact_mode, seen_shmedia_mode): Delete.
(sh64_abi): Replace shmedia_64.
(shmedia_md_convert_frag) <C (MOVI_IMM_64, MOVI_64),
C (MOVI_IMM_32, MOVI_32)>: Correct register number handling.
(s_sh64_mode): Check validity for this target.
(sh64_target_format): Initialize defaults for ISA and ABI.
Fallback to old object format if no SH64 ISA or ABI has been
specified.
* config/tc-sh.c (md_parse_option): Check combinations for errors.
(sh_elf_final_processing): Change to have EF_SH64_ABI64 for 64-bit
ABI and EF_SH64 for 32-bit ABI, if SH64 options are specified.
* config/tc-sh64.h: Fix typo in comment.
2000-11-25 Hans-Peter Nilsson <hpn@cygnus.com>
* config/tc-sh64.c (shmedia_md_estimate_size_before_relax)
<PT fixups for absolute values>: Size will be longest, not
shortest.
(shmedia_md_convert_frag): Disable PTB-warning machinery. Correct
all MOVI and SHORI operand offsets in PT/PTA/PTB expansions.
* config/tc-sh.c (parse_reg) [HAVE_SH64]: Add local variables l0
and l1 to hold lowercase of two first characters. Change all
remaining TO_LOWER to tolower.
* config/tc-sh64.c (TO_LOWER): Delete.
(shmedia_find_cooked_opcode): Use tolower, not TO_LOWER.
(md_parse_name): Define.
(sh64_consume_datalabel): Declare.
(DOLLAR_DOT): Define.
* config/tc-sh64.c (shmedia_parse_exp): New.
(sh64_consume_datalabel): New; just ignoring datalabel semantics.
(shmedia_parse_reg): Remove const from src
parameter.
(shmedia_get_operands): Ditto for args parameter and ptr variable.
(shmedia_md_assemble): Ditto for op_end variable.
(shmedia_get_operand): Ditto for ptr parameter and src variable.
Use shmedia_parse_exp, not parse_exp.
* config/tc-sh64.c (shmedia_parse_reg): Add shmedia_arg_type
parameter. All callers changed.
(shmedia_get_operand): Add shmedia_arg_type parameter. All
callers changed.
(shmedia_parse_reg): Put first two character in local variables.
Use tolower, not TO_LOWER. If no register is found and argtype
indicates a control register, scan shmedia_creg_table
case-insensitive.
2000-11-24 Hans-Peter Nilsson <hpn@cygnus.com>
* Makefile.am (CPU_TYPES): Add sh64.
(TARGET_CPU_CFILES): Add config/tc-sh64.c.
(TARGET_CPU_HFILES): Add config/tc-sh64.h.
Regenerate dependencies.
* Makefile.in: Regenerate.
* configure.in: Add support for sh64-*-elf*.
* configure: Regenerate.
* config/tc-sh64.h: New.
* config/tc-sh64.c: New.
* config/tc-sh.c (md_pseudo_table) [HAVE_SH64]: New pseudos
.mode, .isa and .uaquad.
[HAVE_SH64] (SH64PCREL16_32, SH64PCREL16_64, SH64PCREL16PT_32,
SH64PCREL16PT_64, MOVI_IMM_32, MOVI_IMM_64): Define.
[HAVE_SH64] (END): Define as 10.
[HAVE_SH64] (UNDEF_SH64PCREL, SH64PCREL16, SH64PCREL32,
SH64PCREL48, SH64PCREL64, UNDEF_MOVI, MOVI_16, MOVI_32, MOVI_48,
MOVI_64): Define.
[HAVE_SH64] (SH64PCREL16_F, SH64PCREL16_M, SH64PCREL16_LENGTH,
SH64PCREL32_F, SH64PCREL32_M, SH64PCREL32_LENGTH, SH64PCREL48_F,
SH64PCREL48_M, SH64PCREL48_LENGTH, SH64PCREL64_LENGTH,
MOVI_16_LENGTH, MOVI_32_LENGTH, MOVI_48_LENGTH, MOVI_64_LENGTH):
Define.
(md_relax_table) [HAVE_SH64]: Provide relaxations for SHmedia.
(md_begin) [HAVE_SH64]: Call shmedia_md_begin.
(parse_reg) [HAVE_SH64]: Parse register names case-insensitive.
(md_assemble) [HAVE_SH64]: Call shmedia_md_assemble if assembling
SHmedia instructions. Handle state-change after switching to
SHcompact.
(md_longopts) [HAVE_SH64]: New options --isa=* and --abi=*.
(md_parse_option) [HAVE_SH64]: Parse new options.
(md_show_usage) [HAVE_SH64]: Show usage of new options.
(md_convert_frag) [HAVE_SH64] <default>: Call
shmedia_md_convert_frag instead of abort.
(sh_force_relocation) [HAVE_SH64]: Also force relocation for
BFD_RELOC_SH_SHMEDIA_CODE.
(sh_elf_final_processing) [HAVE_SH64]: Set flags identifying
SHcompact or SHmedia code.
(md_apply_fix) [HAVE_SH64] <default>: Return result from calling
shmedia_md_apply_fix instead of abort.
(md_estimate_size_before_relax) [HAVE_SH64] <default>: Return
result from calling shmedia_md_estimate_size_before_relax instead
of calling abort.
(sh_do_align) [HAVE_SH64]: If shmedia_mode, let shmedia_do_align
do the work.
(tc_gen_reloc) [HAVE_SH64]: For unrecognized relocs, call
shmedia_init_reloc and do nothing more if it returns non-zero.
(sh_finalize) [HAVE_SH64]: Call shmedia_md_end.
* po/POTFILES.in: Regenerate.
* po/gas.pot: Regenerate.
2002-02-06 Alexandre Oliva <aoliva@redhat.com>
* config/tc-sh.c (parse_at): Install the correct version of

View file

@ -79,6 +79,7 @@ CPU_TYPES = \
vax \
w65 \
v850 \
sh64 \
xstormy16 \
z8k
@ -258,6 +259,7 @@ TARGET_CPU_CFILES = \
config/tc-ppc.c \
config/tc-s390.c \
config/tc-sh.c \
config/tc-sh64.c \
config/tc-sparc.c \
config/tc-tahoe.c \
config/tc-tic30.c \
@ -304,6 +306,7 @@ TARGET_CPU_HFILES = \
config/tc-ppc.h \
config/tc-s390.h \
config/tc-sh.h \
config/tc-sh64.h \
config/tc-sparc.h \
config/tc-tahoe.h \
config/tc-tic30.h \
@ -1784,6 +1787,20 @@ DEPOBJ_sh_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h \
$(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \
$(INCDIR)/aout/aout64.h
DEPTC_sh64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h \
$(srcdir)/../opcodes/sh64-opc.h $(srcdir)/config/tc-sh.c \
subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \
struc-symbol.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
dwarf2dbg.h $(INCDIR)/symcat.h
DEPOBJ_sh64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h \
subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h $(INCDIR)/elf/sh.h
DEP_sh64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h
DEPOBJ_sparc_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-sparc.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h

View file

@ -1,6 +1,6 @@
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -190,6 +190,7 @@ CPU_TYPES = \
vax \
w65 \
v850 \
sh64 \
xstormy16 \
z8k
@ -375,6 +376,7 @@ TARGET_CPU_CFILES = \
config/tc-ppc.c \
config/tc-s390.c \
config/tc-sh.c \
config/tc-sh64.c \
config/tc-sparc.c \
config/tc-tahoe.c \
config/tc-tic30.c \
@ -422,6 +424,7 @@ TARGET_CPU_HFILES = \
config/tc-ppc.h \
config/tc-s390.h \
config/tc-sh.h \
config/tc-sh64.h \
config/tc-sparc.h \
config/tc-tahoe.h \
config/tc-tic30.h \
@ -1674,6 +1677,23 @@ DEPOBJ_sh_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \
$(INCDIR)/aout/aout64.h
DEPTC_sh64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h \
$(srcdir)/../opcodes/sh64-opc.h $(srcdir)/config/tc-sh.c \
subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \
struc-symbol.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
dwarf2dbg.h $(INCDIR)/symcat.h
DEPOBJ_sh64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h \
subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h $(INCDIR)/elf/sh.h
DEP_sh64_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h $(srcdir)/config/tc-sh.h
DEPOBJ_sparc_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-sparc.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h
@ -2262,7 +2282,7 @@ configure configure.in gdbinit.in itbl-lex.c itbl-parse.c
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
TAR = gtar
GZIP_ENV = --best
SOURCES = $(itbl_test_SOURCES) $(as_new_SOURCES) $(EXTRA_as_new_SOURCES) $(gasp_new_SOURCES)
OBJECTS = $(itbl_test_OBJECTS) $(as_new_OBJECTS) $(gasp_new_OBJECTS)
@ -2423,7 +2443,7 @@ maintainer-clean-recursive:
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
rev="$$subdir $$rev"; \
test "$$subdir" != "." || dot_seen=yes; \
test "$$subdir" = "." && dot_seen=yes; \
done; \
test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \

2
gas/aclocal.m4 vendored
View file

@ -203,7 +203,7 @@ dnl AM_PROG_LEX
dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
AC_DEFUN(AM_PROG_LEX,
[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
AC_CHECK_PROGS(LEX, flex lex, $missing_dir/missing flex)
AC_PROG_LEX
AC_DECL_YYTEXT])

View file

@ -140,6 +140,18 @@ const pseudo_typeS md_pseudo_table[] =
{"file", dwarf2_directive_file, 0 },
{"loc", dwarf2_directive_loc, 0 },
#endif
#ifdef HAVE_SH64
{"mode", s_sh64_mode, 0 },
/* Have the old name too. */
{"isa", s_sh64_mode, 0 },
/* Assert that the right ABI is used. */
{"abi", s_sh64_abi, 0 },
{ "vtable_inherit", sh64_vtable_inherit, 0 },
{ "vtable_entry", sh64_vtable_entry, 0 },
#endif /* HAVE_SH64 */
{0, 0, 0}
};
@ -172,11 +184,37 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
#define GET_WHAT(x) ((x>>4))
/* These are the three types of relaxable instrction. */
/* These are the types of relaxable instructions; except for END which is
a marker. */
#define COND_JUMP 1
#define COND_JUMP_DELAY 2
#define UNCOND_JUMP 3
#ifdef HAVE_SH64
/* A 16-bit (times four) pc-relative operand, at most expanded to 32 bits. */
#define SH64PCREL16_32 4
/* A 16-bit (times four) pc-relative operand, at most expanded to 64 bits. */
#define SH64PCREL16_64 5
/* Variants of the above for adjusting the insn to PTA or PTB according to
the label. */
#define SH64PCREL16PT_32 6
#define SH64PCREL16PT_64 7
/* A MOVI expansion, expanding to at most 32 or 64 bits. */
#define MOVI_IMM_32 8
#define MOVI_IMM_32_PCREL 9
#define MOVI_IMM_64 10
#define MOVI_IMM_64_PCREL 11
#define END 12
#else /* HAVE_SH64 */
#define END 4
#endif /* HAVE_SH64 */
#define UNDEF_DISP 0
#define COND8 1
#define COND12 2
@ -186,6 +224,24 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
#define UNCOND12 1
#define UNCOND32 2
#ifdef HAVE_SH64
#define UNDEF_SH64PCREL 0
#define SH64PCREL16 1
#define SH64PCREL32 2
#define SH64PCREL48 3
#define SH64PCREL64 4
#define SH64PCRELPLT 5
#define UNDEF_MOVI 0
#define MOVI_16 1
#define MOVI_32 2
#define MOVI_48 3
#define MOVI_64 4
#define MOVI_PLT 5
#define MOVI_GOTOFF 6
#define MOVI_GOTPC 7
#endif /* HAVE_SH64 */
/* Branch displacements are from the address of the branch plus
four, thus all minimum and maximum values have 4 added to them. */
#define COND8_F 258
@ -216,6 +272,85 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
#define UNCOND32_M -(1<<30)
#define UNCOND32_LENGTH 14
#ifdef HAVE_SH64
/* The trivial expansion of a SH64PCREL16 relaxation is just a "PT label,
TRd" as is the current insn, so no extra length. Note that the "reach"
is calculated from the address *after* that insn, but the offset in the
insn is calculated from the beginning of the insn. We also need to
take into account the implicit 1 coded as the "A" in PTA when counting
forward. If PTB reaches an odd address, we trap that as an error
elsewhere, so we don't have to have different relaxation entries. We
don't add a one to the negative range, since PTB would then have the
farthest backward-reaching value skipped, not generated at relaxation. */
#define SH64PCREL16_F (32767 * 4 - 4 + 1)
#define SH64PCREL16_M (-32768 * 4 - 4)
#define SH64PCREL16_LENGTH 0
/* The next step is to change that PT insn into
MOVI ((label - datalabel Ln) >> 16) & 65535, R25
SHORI (label - datalabel Ln) & 65535, R25
Ln:
PTREL R25,TRd
which means two extra insns, 8 extra bytes. This is the limit for the
32-bit ABI.
The expressions look a bit bad since we have to adjust this to avoid overflow on a
32-bit host. */
#define SH64PCREL32_F ((((long) 1 << 30) - 1) * 2 + 1 - 4)
#define SH64PCREL32_LENGTH (2 * 4)
/* Similarly, we just change the MOVI and add a SHORI for the 48-bit
expansion. */
#if BFD_HOST_64BIT_LONG
/* The "reach" type is long, so we can only do this for a 64-bit-long
host. */
#define SH64PCREL32_M (((long) -1 << 30) * 2 - 4)
#define SH64PCREL48_F ((((long) 1 << 47) - 1) - 4)
#define SH64PCREL48_M (((long) -1 << 47) - 4)
#define SH64PCREL48_LENGTH (3 * 4)
#else
/* If the host does not have 64-bit longs, just make this state identical
in reach to the 32-bit state. Note that we have a slightly incorrect
reach, but the correct one above will overflow a 32-bit number. */
#define SH64PCREL32_M (((long) -1 << 30) * 2)
#define SH64PCREL48_F SH64PCREL32_F
#define SH64PCREL48_M SH64PCREL32_M
#define SH64PCREL48_LENGTH (3 * 4)
#endif /* BFD_HOST_64BIT_LONG */
/* And similarly for the 64-bit expansion; a MOVI + SHORI + SHORI + SHORI
+ PTREL sequence. */
#define SH64PCREL64_LENGTH (4 * 4)
/* For MOVI, we make the MOVI + SHORI... expansion you can see in the
SH64PCREL expansions. The PCREL one is similar, but the other has no
pc-relative reach; it must be fully expanded in
shmedia_md_estimate_size_before_relax. */
#define MOVI_16_LENGTH 0
#define MOVI_16_F (32767 - 4)
#define MOVI_16_M (-32768 - 4)
#define MOVI_32_LENGTH 4
#define MOVI_32_F ((((long) 1 << 30) - 1) * 2 + 1 - 4)
#define MOVI_48_LENGTH 8
#if BFD_HOST_64BIT_LONG
/* The "reach" type is long, so we can only do this for a 64-bit-long
host. */
#define MOVI_32_M (((long) -1 << 30) * 2 - 4)
#define MOVI_48_F ((((long) 1 << 47) - 1) - 4)
#define MOVI_48_M (((long) -1 << 47) - 4)
#else
/* If the host does not have 64-bit longs, just make this state identical
in reach to the 32-bit state. Note that we have a slightly incorrect
reach, but the correct one above will overflow a 32-bit number. */
#define MOVI_32_M (((long) -1 << 30) * 2)
#define MOVI_48_F MOVI_32_F
#define MOVI_48_M MOVI_32_M
#endif /* BFD_HOST_64BIT_LONG */
#define MOVI_64_LENGTH 12
#endif /* HAVE_SH64 */
#define EMPTY { 0, 0, 0, 0 }
const relax_typeS md_relax_table[C (END, 0)] = {
@ -256,6 +391,118 @@ const relax_typeS md_relax_table[C (END, 0)] = {
{ 0, 0, UNCOND32_LENGTH, 0, },
EMPTY, EMPTY, EMPTY,
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
#ifdef HAVE_SH64
/* C (SH64PCREL16_32, SH64PCREL16) */
EMPTY,
{ SH64PCREL16_F, SH64PCREL16_M, SH64PCREL16_LENGTH, C (SH64PCREL16_32, SH64PCREL32) },
/* C (SH64PCREL16_32, SH64PCREL32) */
{ 0, 0, SH64PCREL32_LENGTH, 0 },
EMPTY, EMPTY,
/* C (SH64PCREL16_32, SH64PCRELPLT) */
{ 0, 0, SH64PCREL32_LENGTH, 0 },
EMPTY, EMPTY,
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
/* C (SH64PCREL16_64, SH64PCREL16) */
EMPTY,
{ SH64PCREL16_F, SH64PCREL16_M, SH64PCREL16_LENGTH, C (SH64PCREL16_64, SH64PCREL32) },
/* C (SH64PCREL16_64, SH64PCREL32) */
{ SH64PCREL32_F, SH64PCREL32_M, SH64PCREL32_LENGTH, C (SH64PCREL16_64, SH64PCREL48) },
/* C (SH64PCREL16_64, SH64PCREL48) */
{ SH64PCREL48_F, SH64PCREL48_M, SH64PCREL48_LENGTH, C (SH64PCREL16_64, SH64PCREL64) },
/* C (SH64PCREL16_64, SH64PCREL64) */
{ 0, 0, SH64PCREL64_LENGTH, 0 },
/* C (SH64PCREL16_64, SH64PCRELPLT) */
{ 0, 0, SH64PCREL64_LENGTH, 0 },
EMPTY, EMPTY,
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
/* C (SH64PCREL16PT_32, SH64PCREL16) */
EMPTY,
{ SH64PCREL16_F, SH64PCREL16_M, SH64PCREL16_LENGTH, C (SH64PCREL16PT_32, SH64PCREL32) },
/* C (SH64PCREL16PT_32, SH64PCREL32) */
{ 0, 0, SH64PCREL32_LENGTH, 0 },
EMPTY, EMPTY,
/* C (SH64PCREL16PT_32, SH64PCRELPLT) */
{ 0, 0, SH64PCREL32_LENGTH, 0 },
EMPTY, EMPTY,
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
/* C (SH64PCREL16PT_64, SH64PCREL16) */
EMPTY,
{ SH64PCREL16_F, SH64PCREL16_M, SH64PCREL16_LENGTH, C (SH64PCREL16PT_64, SH64PCREL32) },
/* C (SH64PCREL16PT_64, SH64PCREL32) */
{ SH64PCREL32_F,
SH64PCREL32_M,
SH64PCREL32_LENGTH,
C (SH64PCREL16PT_64, SH64PCREL48) },
/* C (SH64PCREL16PT_64, SH64PCREL48) */
{ SH64PCREL48_F, SH64PCREL48_M, SH64PCREL48_LENGTH, C (SH64PCREL16PT_64, SH64PCREL64) },
/* C (SH64PCREL16PT_64, SH64PCREL64) */
{ 0, 0, SH64PCREL64_LENGTH, 0 },
/* C (SH64PCREL16PT_64, SH64PCRELPLT) */
{ 0, 0, SH64PCREL64_LENGTH, 0},
EMPTY, EMPTY,
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
/* C (MOVI_IMM_32, UNDEF_MOVI) */
{ 0, 0, MOVI_32_LENGTH, 0 },
/* C (MOVI_IMM_32, MOVI_16) */
{ MOVI_16_F, MOVI_16_M, MOVI_16_LENGTH, C (MOVI_IMM_32, MOVI_32) },
/* C (MOVI_IMM_32, MOVI_32) */
{ MOVI_32_F, MOVI_32_M, MOVI_32_LENGTH, 0 },
EMPTY, EMPTY, EMPTY,
/* C (MOVI_IMM_32, MOVI_GOTOFF) */
{ 0, 0, MOVI_32_LENGTH, 0 },
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
/* C (MOVI_IMM_32_PCREL, MOVI_16) */
EMPTY,
{ MOVI_16_F, MOVI_16_M, MOVI_16_LENGTH, C (MOVI_IMM_32_PCREL, MOVI_32) },
/* C (MOVI_IMM_32_PCREL, MOVI_32) */
{ 0, 0, MOVI_32_LENGTH, 0 },
EMPTY, EMPTY,
/* C (MOVI_IMM_32_PCREL, MOVI_PLT) */
{ 0, 0, MOVI_32_LENGTH, 0 },
EMPTY,
/* C (MOVI_IMM_32_PCREL, MOVI_GOTPC) */
{ 0, 0, MOVI_32_LENGTH, 0 },
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
/* C (MOVI_IMM_64, UNDEF_MOVI) */
{ 0, 0, MOVI_64_LENGTH, 0 },
/* C (MOVI_IMM_64, MOVI_16) */
{ MOVI_16_F, MOVI_16_M, MOVI_16_LENGTH, C (MOVI_IMM_64, MOVI_32) },
/* C (MOVI_IMM_64, MOVI_32) */
{ MOVI_32_F, MOVI_32_M, MOVI_32_LENGTH, C (MOVI_IMM_64, MOVI_48) },
/* C (MOVI_IMM_64, MOVI_48) */
{ MOVI_48_F, MOVI_48_M, MOVI_48_LENGTH, C (MOVI_IMM_64, MOVI_64) },
/* C (MOVI_IMM_64, MOVI_64) */
{ 0, 0, MOVI_64_LENGTH, 0 },
EMPTY,
/* C (MOVI_IMM_64, MOVI_GOTOFF) */
{ 0, 0, MOVI_64_LENGTH, 0 },
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
/* C (MOVI_IMM_64_PCREL, MOVI_16) */
EMPTY,
{ MOVI_16_F, MOVI_16_M, MOVI_16_LENGTH, C (MOVI_IMM_64_PCREL, MOVI_32) },
/* C (MOVI_IMM_64_PCREL, MOVI_32) */
{ MOVI_32_F, MOVI_32_M, MOVI_32_LENGTH, C (MOVI_IMM_64_PCREL, MOVI_48) },
/* C (MOVI_IMM_64_PCREL, MOVI_48) */
{ MOVI_48_F, MOVI_48_M, MOVI_48_LENGTH, C (MOVI_IMM_64_PCREL, MOVI_64) },
/* C (MOVI_IMM_64_PCREL, MOVI_64) */
{ 0, 0, MOVI_64_LENGTH, 0 },
/* C (MOVI_IMM_64_PCREL, MOVI_PLT) */
{ 0, 0, MOVI_64_LENGTH, 0 },
EMPTY,
/* C (MOVI_IMM_64_PCREL, MOVI_GOTPC) */
{ 0, 0, MOVI_64_LENGTH, 0 },
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
#endif /* HAVE_SH64 */
};
#undef EMPTY
@ -278,6 +525,11 @@ sh_PIC_related_p (sym)
if (sym == GOT_symbol)
return 1;
#ifdef HAVE_SH64
if (sh_PIC_related_p (*symbol_get_tc (sym)))
return 1;
#endif
exp = symbol_get_value_expression (sym);
return (exp->X_op == O_PIC_reloc
@ -341,11 +593,47 @@ sh_check_fixup (main_exp, r_type_p)
if (exp->X_op == O_symbol || exp->X_op == O_add || exp->X_op == O_subtract)
{
#ifdef HAVE_SH64
if (exp->X_add_symbol
&& (exp->X_add_symbol == GOT_symbol
|| (GOT_symbol
&& *symbol_get_tc (exp->X_add_symbol) == GOT_symbol)))
{
switch (*r_type_p)
{
case BFD_RELOC_SH_IMM_LOW16:
*r_type_p = BFD_RELOC_SH_GOTPC_LOW16;
break;
case BFD_RELOC_SH_IMM_MEDLOW16:
*r_type_p = BFD_RELOC_SH_GOTPC_MEDLOW16;
break;
case BFD_RELOC_SH_IMM_MEDHI16:
*r_type_p = BFD_RELOC_SH_GOTPC_MEDHI16;
break;
case BFD_RELOC_SH_IMM_HI16:
*r_type_p = BFD_RELOC_SH_GOTPC_HI16;
break;
case BFD_RELOC_NONE:
case BFD_RELOC_UNUSED:
*r_type_p = BFD_RELOC_SH_GOTPC;
break;
default:
abort ();
}
return 0;
}
#else
if (exp->X_add_symbol && exp->X_add_symbol == GOT_symbol)
{
*r_type_p = BFD_RELOC_SH_GOTPC;
return 0;
}
#endif
exp = symbol_get_value_expression (exp->X_add_symbol);
if (! exp)
return 0;
@ -353,7 +641,116 @@ sh_check_fixup (main_exp, r_type_p)
if (exp->X_op == O_PIC_reloc)
{
#ifdef HAVE_SH64
switch (*r_type_p)
{
case BFD_RELOC_NONE:
case BFD_RELOC_UNUSED:
*r_type_p = exp->X_md;
break;
case BFD_RELOC_SH_IMM_LOW16:
switch (exp->X_md)
{
case BFD_RELOC_32_GOTOFF:
*r_type_p = BFD_RELOC_SH_GOTOFF_LOW16;
break;
case BFD_RELOC_SH_GOTPLT32:
*r_type_p = BFD_RELOC_SH_GOTPLT_LOW16;
break;
case BFD_RELOC_32_GOT_PCREL:
*r_type_p = BFD_RELOC_SH_GOT_LOW16;
break;
case BFD_RELOC_32_PLT_PCREL:
*r_type_p = BFD_RELOC_SH_PLT_LOW16;
break;
default:
abort ();
}
break;
case BFD_RELOC_SH_IMM_MEDLOW16:
switch (exp->X_md)
{
case BFD_RELOC_32_GOTOFF:
*r_type_p = BFD_RELOC_SH_GOTOFF_MEDLOW16;
break;
case BFD_RELOC_SH_GOTPLT32:
*r_type_p = BFD_RELOC_SH_GOTPLT_MEDLOW16;
break;
case BFD_RELOC_32_GOT_PCREL:
*r_type_p = BFD_RELOC_SH_GOT_MEDLOW16;
break;
case BFD_RELOC_32_PLT_PCREL:
*r_type_p = BFD_RELOC_SH_PLT_MEDLOW16;
break;
default:
abort ();
}
break;
case BFD_RELOC_SH_IMM_MEDHI16:
switch (exp->X_md)
{
case BFD_RELOC_32_GOTOFF:
*r_type_p = BFD_RELOC_SH_GOTOFF_MEDHI16;
break;
case BFD_RELOC_SH_GOTPLT32:
*r_type_p = BFD_RELOC_SH_GOTPLT_MEDHI16;
break;
case BFD_RELOC_32_GOT_PCREL:
*r_type_p = BFD_RELOC_SH_GOT_MEDHI16;
break;
case BFD_RELOC_32_PLT_PCREL:
*r_type_p = BFD_RELOC_SH_PLT_MEDHI16;
break;
default:
abort ();
}
break;
case BFD_RELOC_SH_IMM_HI16:
switch (exp->X_md)
{
case BFD_RELOC_32_GOTOFF:
*r_type_p = BFD_RELOC_SH_GOTOFF_HI16;
break;
case BFD_RELOC_SH_GOTPLT32:
*r_type_p = BFD_RELOC_SH_GOTPLT_HI16;
break;
case BFD_RELOC_32_GOT_PCREL:
*r_type_p = BFD_RELOC_SH_GOT_HI16;
break;
case BFD_RELOC_32_PLT_PCREL:
*r_type_p = BFD_RELOC_SH_PLT_HI16;
break;
default:
abort ();
}
break;
default:
abort ();
}
#else
*r_type_p = exp->X_md;
#endif
if (exp == main_exp)
exp->X_op = O_symbol;
else
@ -397,6 +794,12 @@ sh_cons_fix_new (frag, off, size, exp)
r_type = BFD_RELOC_32;
break;
#ifdef HAVE_SH64
case 8:
r_type = BFD_RELOC_64;
break;
#endif
default:
goto error;
}
@ -420,6 +823,16 @@ sh_elf_cons (nbytes)
{
expressionS exp;
#ifdef HAVE_SH64
/* Update existing range to include a previous insn, if there was one. */
sh64_update_contents_mark (true);
/* We need to make sure the contents type is set to data. */
sh64_flag_output ();
#endif /* HAVE_SH64 */
if (is_it_end_of_statement ())
{
demand_empty_rest_of_line ();
@ -457,6 +870,10 @@ md_begin ()
target_arch = arch_sh1_up & ~(sh_dsp ? arch_sh3e_up : arch_sh_dsp_up);
valid_arch = target_arch;
#ifdef HAVE_SH64
shmedia_md_begin ();
#endif
opcode_hash_control = hash_new ();
/* Insert unique names into hash table. */
@ -1908,6 +2325,26 @@ md_assemble (str)
sh_opcode_info *opcode;
unsigned int size = 0;
#ifdef HAVE_SH64
if (sh64_isa_mode == sh64_isa_shmedia)
{
shmedia_md_assemble (str);
return;
}
else
{
/* If we've seen pseudo-directives, make sure any emitted data or
frags are marked as data. */
if (seen_insn == false)
{
sh64_update_contents_mark (true);
sh64_set_contents_type (CRT_SH5_ISA16);
}
seen_insn = true;
}
#endif /* HAVE_SH64 */
opcode = find_cooked_opcode (&str);
op_end = str;
@ -2149,6 +2586,21 @@ struct option md_longopts[] =
{"little", no_argument, NULL, OPTION_LITTLE},
{"small", no_argument, NULL, OPTION_SMALL},
{"dsp", no_argument, NULL, OPTION_DSP},
#ifdef HAVE_SH64
#define OPTION_ISA (OPTION_DSP + 1)
#define OPTION_ABI (OPTION_ISA + 1)
#define OPTION_NO_MIX (OPTION_ABI + 1)
#define OPTION_SHCOMPACT_CONST_CRANGE (OPTION_NO_MIX + 1)
#define OPTION_NO_EXPAND (OPTION_SHCOMPACT_CONST_CRANGE + 1)
#define OPTION_PT32 (OPTION_NO_EXPAND + 1)
{"isa", required_argument, NULL, OPTION_ISA},
{"abi", required_argument, NULL, OPTION_ABI},
{"no-mix", no_argument, NULL, OPTION_NO_MIX},
{"shcompact-const-crange", no_argument, NULL, OPTION_SHCOMPACT_CONST_CRANGE},
{"no-expand", no_argument, NULL, OPTION_NO_EXPAND},
{"expand-pt32", no_argument, NULL, OPTION_PT32},
#endif /* HAVE_SH64 */
{NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof (md_longopts);
@ -2180,6 +2632,62 @@ md_parse_option (c, arg)
sh_dsp = 1;
break;
#ifdef HAVE_SH64
case OPTION_ISA:
if (strcasecmp (arg, "shmedia") == 0)
{
if (sh64_isa_mode == sh64_isa_shcompact)
as_bad (_("Invalid combination: --isa=SHcompact with --isa=SHmedia"));
sh64_isa_mode = sh64_isa_shmedia;
}
else if (strcasecmp (arg, "shcompact") == 0)
{
if (sh64_isa_mode == sh64_isa_shmedia)
as_bad (_("Invalid combination: --isa=SHmedia with --isa=SHcompact"));
if (sh64_abi == sh64_abi_64)
as_bad (_("Invalid combination: --abi=64 with --isa=SHcompact"));
sh64_isa_mode = sh64_isa_shcompact;
}
else
as_bad ("Invalid argument to --isa option: %s", arg);
break;
case OPTION_ABI:
if (strcmp (arg, "32") == 0)
{
if (sh64_abi == sh64_abi_64)
as_bad (_("Invalid combination: --abi=32 with --abi=64"));
sh64_abi = sh64_abi_32;
}
else if (strcmp (arg, "64") == 0)
{
if (sh64_abi == sh64_abi_32)
as_bad (_("Invalid combination: --abi=64 with --abi=32"));
if (sh64_isa_mode == sh64_isa_shcompact)
as_bad (_("Invalid combination: --isa=SHcompact with --abi=64"));
sh64_abi = sh64_abi_64;
}
else
as_bad ("Invalid argument to --abi option: %s", arg);
break;
case OPTION_NO_MIX:
sh64_mix = false;
break;
case OPTION_SHCOMPACT_CONST_CRANGE:
sh64_shcompact_const_crange = true;
break;
case OPTION_NO_EXPAND:
sh64_expand = false;
break;
case OPTION_PT32:
sh64_pt32 = true;
break;
#endif /* HAVE_SH64 */
default:
return 0;
}
@ -2198,6 +2706,22 @@ SH options:\n\
-relax alter jump instructions for long displacements\n\
-small align sections to 4 byte boundaries, not 16\n\
-dsp enable sh-dsp insns, and disable sh3e / sh4 insns.\n"));
#ifdef HAVE_SH64
fprintf (stream, _("\
-isa=[shmedia set default instruction set for SH64\n\
| SHmedia\n\
| shcompact\n\
| SHcompact]\n\
-abi=[32|64] set size of expanded SHmedia operands and object\n\
file type\n\
-shcompact-const-crange emit code-range descriptors for constants in\n\
SHcompact code sections\n\
-no-mix disallow SHmedia code in the same section as\n\
constants and SHcompact code\n\
-no-expand do not expand MOVI, PT, PTA or PTB instructions\n\
-expand-pt32 with -abi=64, expand PT, PTA and PTB instructions\n\
to 32 bits only"));
#endif /* HAVE_SH64 */
}
/* This struct is used to pass arguments to sh_count_relocs through
@ -2367,6 +2891,10 @@ sh_frob_section (abfd, sec, ignore)
void
sh_frob_file ()
{
#ifdef HAVE_SH64
shmedia_frob_file_before_adjust ();
#endif
if (! sh_relax)
return;
@ -2520,7 +3048,11 @@ md_convert_frag (headers, seg, fragP)
break;
default:
#ifdef HAVE_SH64
shmedia_md_convert_frag (headers, seg, fragP, true);
#else
abort ();
#endif
}
if (donerelax && !sh_relax)
@ -2710,6 +3242,9 @@ sh_force_relocation (fix)
|| fix->fx_r_type == BFD_RELOC_SH_ALIGN
|| fix->fx_r_type == BFD_RELOC_SH_CODE
|| fix->fx_r_type == BFD_RELOC_SH_DATA
#ifdef HAVE_SH64
|| fix->fx_r_type == BFD_RELOC_SH_SHMEDIA_CODE
#endif
|| fix->fx_r_type == BFD_RELOC_SH_LABEL);
}
@ -2750,6 +3285,13 @@ sh_elf_final_processing ()
/* Set file-specific flags to indicate if this code needs
a processor with the sh-dsp / sh3e ISA to execute. */
#ifdef HAVE_SH64
/* SH5 and above don't know about the valid_arch arch_sh* bits defined
in sh-opc.h, so check SH64 mode before checking valid_arch. */
if (sh64_isa_mode != sh64_isa_unspecified)
val = EF_SH5;
else
#endif /* HAVE_SH64 */
if (valid_arch & arch_sh1)
val = EF_SH1;
else if (valid_arch & arch_sh2)
@ -2998,6 +3540,7 @@ md_apply_fix3 (fixP, valP, seg)
break;
case BFD_RELOC_32_GOT_PCREL:
case BFD_RELOC_SH_GOTPLT32:
* valP = 0; /* Fully resolved at runtime. No addend. */
md_number_to_chars (buf, 0, 4);
break;
@ -3008,7 +3551,12 @@ md_apply_fix3 (fixP, valP, seg)
#endif
default:
#ifdef HAVE_SH64
shmedia_md_apply_fix3 (fixP, valP);
return;
#else
abort ();
#endif
}
if (shift != 0)
@ -3041,7 +3589,12 @@ md_estimate_size_before_relax (fragP, segment_type)
switch (fragP->fr_subtype)
{
default:
#ifdef HAVE_SH64
return shmedia_md_estimate_size_before_relax (fragP, segment_type);
#else
abort ();
#endif
case C (UNCOND_JUMP, UNDEF_DISP):
/* Used to be a branch to somewhere which was unknown. */
@ -3110,6 +3663,11 @@ md_number_to_chars (ptr, use, nbytes)
valueT use;
int nbytes;
{
#ifdef HAVE_SH64
/* We might need to set the contents type to data. */
sh64_flag_output ();
#endif
if (! target_big_endian)
number_to_chars_littleendian (ptr, use, nbytes);
else
@ -3355,6 +3913,10 @@ tc_gen_reloc (section, fixp)
rel->addend = 0;
rel->address = rel->addend = fixp->fx_offset;
}
#ifdef HAVE_SH64
else if (shmedia_init_reloc (rel, fixp))
;
#endif
else if (fixp->fx_pcrel)
rel->addend = fixp->fx_addnumber;
else if (r_type == BFD_RELOC_32 || r_type == BFD_RELOC_32_GOTOFF)
@ -3440,6 +4002,8 @@ sh_parse_name (name, exprP, nextcharP)
goto no_suffix;
else if ((next_end = sh_end_of_match (next + 1, "GOTOFF")))
reloc_type = BFD_RELOC_32_GOTOFF;
else if ((next_end = sh_end_of_match (next + 1, "GOTPLT")))
reloc_type = BFD_RELOC_SH_GOTPLT32;
else if ((next_end = sh_end_of_match (next + 1, "GOT")))
reloc_type = BFD_RELOC_32_GOT_PCREL;
else if ((next_end = sh_end_of_match (next + 1, "PLT")))

3513
gas/config/tc-sh64.c Normal file

File diff suppressed because it is too large Load diff

212
gas/config/tc-sh64.h Normal file
View file

@ -0,0 +1,212 @@
/* This file is tc-sh64.h
Copyright (C) 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. */
#define TC_SH64
#include "config/tc-sh.h"
#include "elf/sh.h"
/* We need to override the tc-sh.h settings of HANDLE_ALIGN and
MAX_MEM_FOR_RS_ALIGN_CODE; we might need to put in SHmedia NOP:s, not
SHcompact NOP:s. */
#undef HANDLE_ALIGN
#define HANDLE_ALIGN(frag) sh64_handle_align (frag)
extern void sh64_handle_align PARAMS ((fragS *));
#undef MAX_MEM_FOR_RS_ALIGN_CODE
#define MAX_MEM_FOR_RS_ALIGN_CODE sh64_max_mem_for_rs_align_code ()
extern int sh64_max_mem_for_rs_align_code PARAMS ((void));
#undef LISTING_HEADER
#define LISTING_HEADER \
(target_big_endian ? \
"Hitachi SHcompact/SHmedia Big Endian GAS" \
: "Hitachi SHcompact/SHmedia Little Endian GAS")
/* We need to record the new frag position after an .align. */
extern void sh64_do_align PARAMS ((int, const char *, int, int));
#define md_do_align(n, fill, len, max, l) \
do { sh64_do_align (n, fill, len, max); goto l; } while (0)
struct sh64_segment_info_type
{
/* The type of the section is initialized when the range_start_symbol
member is non-NULL. */
symbolS *mode_start_symbol;
subsegT mode_start_subseg;
/* A stored symbol indicating location of last call of
"md_flush_pending_output". It is NULLed when we actually use it;
otherwise the contents is just filled in with segment, frag and
offset within frag. */
symbolS *last_contents_mark;
unsigned int emitted_ranges;
enum sh64_elf_cr_type contents_type;
/* This is used by the SH1-4 parts; we set it to 0 for SHmedia code and
data. */
unsigned int in_code : 1;
};
#undef TC_SEGMENT_INFO_TYPE
#define TC_SEGMENT_INFO_TYPE struct sh64_segment_info_type
#undef TARGET_FORMAT
#define TARGET_FORMAT sh64_target_format ()
extern const char *sh64_target_format PARAMS ((void));
#define TARGET_MACH sh64_target_mach ()
extern int sh64_target_mach PARAMS ((void));
#undef TC_RELOC_RTSYM_LOC_FIXUP
#define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
((FIX)->fx_r_type != BFD_RELOC_32_PLT_PCREL \
&& (FIX)->fx_r_type != BFD_RELOC_SH_PLT_LOW16 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_PLT_MEDLOW16 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_PLT_MEDHI16 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_PLT_HI16 \
&& (FIX)->fx_r_type != BFD_RELOC_32_GOT_PCREL \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOT_LOW16 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOT_MEDLOW16 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOT_MEDHI16 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOT_HI16 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOT10BY4 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOT10BY8 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT32 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_LOW16 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_MEDLOW16 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_MEDHI16 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_HI16 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT10BY4 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT10BY8 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_LOW16 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_MEDLOW16 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_MEDHI16 \
&& (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_HI16 \
&& ((FIX)->fx_addsy == NULL \
|| (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
&& ! S_IS_WEAK ((FIX)->fx_addsy) \
&& S_IS_DEFINED ((FIX)->fx_addsy) \
&& ! S_IS_COMMON ((FIX)->fx_addsy))))
/* Note the kludge: we want to put back C, and we also want to consume the
expression, since we have handled it ourselves. FIXME: What we really
need is a new GAS infrastructure feature: md_qualifier. */
#undef md_parse_name
#define md_parse_name(NAME, EXP, CP) \
sh64_consume_datalabel (NAME, EXP, CP, operand)
extern int sh64_consume_datalabel
PARAMS ((const char *, expressionS *, char *, segT (*) (expressionS *)));
/* Saying "$" is the same as saying ".". */
#define DOLLAR_DOT
#define MD_PCREL_FROM_SECTION(FIXP, SEC) \
shmedia_md_pcrel_from_section (FIXP, SEC)
extern valueT shmedia_md_pcrel_from_section PARAMS ((struct fix *, segT));
/* We need to mark this symbol as a BranchTarget; setting st_other for it
and adding 1 to its value (temporarily). */
extern void sh64_frob_label PARAMS ((symbolS *));
#undef tc_frob_label
#define tc_frob_label(sym) \
do { sh_frob_label (); sh64_frob_label (sym); } while (0)
#define tc_symbol_new_hook(s) sh64_frob_label (s)
/* We use this to mark our "datalabel" symbol copies. The "mark" is NULL
for an ordinary symbol, and the pointer to the "ordinary" symbol for a
datalabel symbol. */
#define TC_SYMFIELD_TYPE symbolS *
#define tc_frob_symbol(symp, punt) \
do \
{ \
punt = sh64_exclude_symbol (symp); \
} \
while (0)
extern int sh64_exclude_symbol PARAMS ((symbolS *));
extern void sh64_adjust_symtab PARAMS ((void));
#define tc_adjust_symtab sh64_adjust_symtab
#undef md_flush_pending_output
#define md_flush_pending_output() sh64_flush_pending_output ()
extern void sh64_flush_pending_output PARAMS ((void));
/* Note that tc-sh.c has a sh_frob_section, but it's called from
tc_frob_file_before_adjust. */
#define tc_frob_section(sec) shmedia_frob_section_type (sec)
extern void shmedia_frob_section_type PARAMS ((asection *));
#define ELF_TC_SPECIAL_SECTIONS \
{ ".cranges", SHT_PROGBITS, 0 },
/* We need to emit fixups relative to the frag in which the instruction
resides. Safest way without calculating max fragment growth or making
it a fixed number is to provide a pointer to the opcode frag.
We also need to emit the right NOP pattern in .align frags. This is
done after the text-to-bits assembly pass, so we need to mark it with
the ISA setting at the time the .align was assembled. */
#define TC_FRAG_TYPE struct sh64_tc_frag_data
enum sh64_isa_values
{
sh64_isa_unspecified,
sh64_isa_shcompact,
sh64_isa_shmedia,
/* Special guard value used in contexts when we don't know which ISA it
is, just that it's specified (not sh64_isa_unspecified). */
sh64_isa_sh5_guard
};
struct sh64_tc_frag_data
{
fragS *opc_frag;
enum sh64_isa_values isa;
};
extern enum sh64_isa_values sh64_isa_mode;
#define TC_FRAG_INIT(FRAGP) \
do \
{ \
(FRAGP)->tc_frag_data.opc_frag = sh64_last_insn_frag; \
(FRAGP)->tc_frag_data.isa = sh64_isa_mode; \
} \
while (0)
/* This variable is set whenever we generate (or grow) a new opcode frag
in shmedia_build_Mytes. */
extern fragS *sh64_last_insn_frag;
#define md_end() shmedia_md_end ()
void shmedia_md_end PARAMS ((void));
/* Because we make .debug_line hold the SHmedia instruction address | 1,
we have to say we only have minimum byte-size insns. */
#undef DWARF2_LINE_MIN_INSN_LENGTH
#define DWARF2_LINE_MIN_INSN_LENGTH 1

471
gas/configure vendored

File diff suppressed because it is too large Load diff

View file

@ -145,6 +145,7 @@ changequote([,])dnl
rs6000*) cpu_type=ppc ;;
s390x*) cpu_type=s390 arch=s390x ;;
s390*) cpu_type=s390 arch=s390 ;;
sh64*) cpu_type=sh64 endian=big;;
sh*le) cpu_type=sh endian=little ;;
sh*) cpu_type=sh endian=big ;;
sparclite*) cpu_type=sparc arch=sparclite ;;
@ -425,6 +426,7 @@ changequote([,])dnl
sh-*-rtemself*) fmt=elf ;;
sh-*-rtems*) fmt=coff bfd_gas=yes;;
sh64-*-elf*) fmt=elf ;;
ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;;
ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;;
ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;

View file

@ -46,6 +46,7 @@ CPU_DOCS = \
c-pj.texi \
c-ppc.texi \
c-sh.texi \
c-sh64.texi \
c-sparc.texi \
c-tic54x.texi \
c-vax.texi \

View file

@ -1,6 +1,6 @@
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -157,6 +157,7 @@ CPU_DOCS = \
c-pj.texi \
c-ppc.texi \
c-sh.texi \
c-sh64.texi \
c-sparc.texi \
c-tic54x.texi \
c-vax.texi \
@ -278,7 +279,7 @@ uninstall-info:
else ii=; fi; \
list='$(INFO_DEPS)'; \
for file in $$list; do \
test -z "$$ii" \
test -z "$ii" \
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
done
@$(NORMAL_UNINSTALL)

View file

@ -5625,6 +5625,7 @@ subject, see the hardware manufacturer's manual.
@end ifset
@ifset SH
* SH-Dependent:: Hitachi SH Dependent Features
* SH64-Dependent:: Hitachi SH64 Dependent Features
@end ifset
@ifset PDP11
* PDP-11-Dependent:: PDP-11 Dependent Features
@ -5772,6 +5773,7 @@ family.
@ifset SH
@include c-sh.texi
@include c-sh64.texi
@end ifset
@ifset SPARC

207
gas/doc/c-sh64.texi Normal file
View file

@ -0,0 +1,207 @@
@c Copyright (C) 2001, 2002 Free Software Foundation, Inc.
@c This is part of the GAS manual.
@c For copying conditions, see the file as.texinfo.
@page
@node SH64-Dependent
@chapter Hitachi SH64 Dependent Features
@cindex SH64 support
@menu
* SH64 Options:: Options
* SH64 Syntax:: Syntax
* SH64 Directives:: SH64 Machine Directives
* SH64 Opcodes:: Opcodes
@end menu
@node SH64 Options
@section Options
@cindex SH64 options
@cindex options, SH64
@table @code
@cindex SH64 ISA options
@cindex ISA options, SH64
@item -isa=shmedia | -isa=shcompact
Specify the default instruction set. @code{SHmedia} specifies the
32-bit opcodes, and @code{SHcompact} specifies the 16-bit opcodes
compatible with previous SH families. The default depends on the ABI
selected; the default for the 64-bit ABI is SHmedia, and the default for
the 32-bit ABI is SHcompact. If neither the ABI nor the ISA is
specified, the default is 32-bit SHcompact.
Note that the @code{.mode} pseudo-op is not permitted if the ISA is not
specified on the command line.
@cindex SH64 ABI options
@cindex ABI options, SH64
@item -abi=32 | -abi=64
Specify the default ABI. If the ISA is specified and the ABI is not,
the default ABI depends on the ISA, with SHmedia defaulting to 64-bit
and SHcompact defaulting to 32-bit.
Note that the @code{.abi} pseudo-op is not permitted if the ABI is not
specified on the command line. When the ABI is specified on the command
line, any @code{.abi} pseudo-ops in the source must match it.
@item -shcompact-const-crange
Emit code-range descriptors for constants in SHcompact code sections.
@item -no-mix
Disallow SHmedia code in the same section as constants and SHcompact
code.
@item -no-expand
Do not expand MOVI, PT, PTA or PTB instructions.
@item -expand-pt32
With -abi=64, expand PT, PTA and PTB instructions to 32 bits only.
@end table
@node SH64 Syntax
@section Syntax
@menu
* SH64-Chars:: Special Characters
* SH64-Regs:: Register Names
* SH64-Addressing:: Addressing Modes
@end menu
@node SH64-Chars
@subsection Special Characters
@cindex line comment character, SH64
@cindex SH64 line comment character
@samp{!} is the line comment character.
@cindex line separator, SH64
@cindex statement separator, SH64
@cindex SH64 line separator
You can use @samp{;} instead of a newline to separate statements.
@cindex symbol names, @samp{$} in
@cindex @code{$} in symbol names
Since @samp{$} has no special meaning, you may use it in symbol names.
@node SH64-Regs
@subsection Register Names
@cindex SH64 registers
@cindex registers, SH64
You can use the predefined symbols @samp{r0} through @samp{r63} to refer
to the SH64 general registers, @samp{cr0} through @code{cr63} for
control registers, @samp{tr0} through @samp{tr7} for target address
registers, @samp{fr0} through @samp{fr63} for single-precision floating
point registers, @samp{dr0} through @samp{dr62} (even numbered registers
only) for double-precision floating point registers, @samp{fv0} through
@samp{fv60} (multiples of four only) for single-precision floating point
vectors, @samp{fp0} through @samp{fp62} (even numbered registers only)
for single-precision floating point pairs, @samp{mtrx0} through
@samp{mtrx48} (multiples of 16 only) for 4x4 matrices of
single-precision floating point registers, @samp{pc} for the program
counter, and @samp{fpscr} for the floating point status and control
register.
You can also refer to the control registers by the mnemonics @samp{sr},
@samp{ssr}, @samp{pssr}, @samp{intevt}, @samp{expevt}, @samp{pexpevt},
@samp{tra}, @samp{spc}, @samp{pspc}, @samp{resvec}, @samp{vbr},
@samp{tea}, @samp{dcr}, @samp{kcr0}, @samp{kcr1}, @samp{ctc}, and
@samp{usr}.
@node SH64-Addressing
@subsection Addressing Modes
@cindex addressing modes, SH64
@cindex SH64 addressing modes
SH64 operands consist of either a register or immediate value. The
immediate value can be a constant or label reference (or portion of a
label reference), as in this example:
@example
movi 4,r2
pt function, tr4
movi (function >> 16) & 65535,r0
shori function & 65535, r0
ld.l r0,4,r0
@end example
@cindex datalabel, SH64
Instruction label references can reference labels in either SHmedia or
SHcompact. To differentiate between the two, labels in SHmedia sections
will always have the least significant bit set (i.e. they will be odd),
which SHcompact labels will have the least significant bit reset
(i.e. they will be even). If you need to reference the actual address
of a label, you can use the @code{datalabel} modifier, as in this
example:
@example
.long function
.long datalabel function
@end example
In that example, the first longword may or may not have the least
significant bit set depending on whether the label is an SHmedia label
or an SHcompact label. The second longword will be the actual address
of the label, regardless of what type of lable it is.
@node SH64 Directives
@section SH64 Machine Directives
In addition to the SH directives, the SH64 provides the following
directives:
@cindex SH64 machine directives
@cindex machine directives, SH64
@table @code
@item .mode [shmedia|shcompact]
@itemx .isa [shmedia|shcompact]
Specify the ISA for the following instructions (the two directives are
equivalent). Note that programs such as @code{objdump} rely on symbolic
labels to determine when such mode switches occur (by checking the least
significant bit of the label's address), so such mode/isa changes should
always be followed by a label (in practice, this is true anyway). Note
that you cannot use these directives if you didn't specify an ISA on the
command line.
@item .abi [32|64]
Specify the ABI for the following instructions. Note that you cannot use
this directive unless you specified an ABI on the command line, and the
ABIs specified must match.
@item .uaquad
Like .uaword and .ualong, this allows you to specify an intenionally
unaligned quadword (64 bit word).
@end table
@node SH64 Opcodes
@section Opcodes
@cindex SH64 opcode summary
@cindex opcode summary, SH64
@cindex mnemonics, SH64
@cindex instruction summary, SH64
For detailed information on the SH64 machine instruction set, see
@cite{SuperH 64 bit RISC Series Architecture Manual} (SuperH, Inc.).
@code{@value{AS}} implements all the standard SH64 opcodes. In
addition, the following pseudo-opcodes may be expanded into one or more
alternate opcodes:
@table @code
@item movi
If the value doesn't fit into a standard @code{movi} opcode,
@code{@value{AS}} will replace the @code{movi} with a sequence of
@code{movi} and @code{shori} opcodes.
@item pt
This expands to a sequence of @code{movi} and @code{shori} opcode,
followed by a @code{ptrel} opcode, or to a @code{pta} or @code{ptb}
opcode, depending on the label referenced.
@end table

View file

@ -108,6 +108,8 @@ config/tc-s390.c
config/tc-s390.h
config/tc-sh.c
config/tc-sh.h
config/tc-sh64.c
config/tc-sh64.h
config/tc-sparc.c
config/tc-sparc.h
config/tc-tahoe.c

File diff suppressed because it is too large Load diff