From f964b01d903959abb9ccf666a111bb80b6f2da01 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Wed, 16 Oct 1996 06:21:23 +0000 Subject: [PATCH] * config/tc-v850.c (md_pcrel_from): Delete unused function. (md_pcrel_from_section): New function. * config/tc-v850.h (MD_PCREL_FROM_SECTION): Define. So we don't screw up pc-relative jumps/calls from one section into another section within the same .o file. Fixes global ctors/dtors to work with DECL_ONE_ONLY stuff. --- gas/ChangeLog | 8 ++++++ gas/config/tc-v850.c | 64 +++++++++++++++----------------------------- gas/config/tc-v850.h | 3 +++ 3 files changed, 33 insertions(+), 42 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 1c36544a212..eb429124482 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +start-sanitize-v850 +Wed Oct 16 00:19:00 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-v850.c (md_pcrel_from): Delete unused function. + (md_pcrel_from_section): New function. + * config/tc-v850.h (MD_PCREL_FROM_SECTION): Define. + +end-sanitize-v850 Mon Oct 14 13:59:12 1996 Ian Lance Taylor * config/tc-mips.c (load_register): Add cast to offsetT when using diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index 1471f3c7e9c..e2c3f56f663 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -52,6 +52,7 @@ const char EXP_CHARS[] = "eE"; as in 0d1.0. */ const char FLT_CHARS[] = "dD"; + /* local functions */ static unsigned long v850_insert_operand PARAMS ((unsigned long insn, const struct v850_operand *operand, @@ -60,9 +61,7 @@ static int reg_name_search PARAMS ((const struct reg_name *, int, const char *)) static boolean register_name PARAMS ((expressionS *expressionP)); static boolean system_register_name PARAMS ((expressionS *expressionP)); static boolean cc_name PARAMS ((expressionS *expressionP)); -static int postfix PARAMS ((char *p)); -static bfd_reloc_code_real_type get_reloc PARAMS ((struct v850_operand *op)); -static unsigned long build_insn PARAMS ((struct v850_opcode *opcode, expressionS *opers)); +static bfd_reloc_code_real_type v850_reloc_prefix PARAMS ((void)); /* fixups */ @@ -85,15 +84,6 @@ size_t md_longopts_size = sizeof(md_longopts); /* The target specific pseudo-ops which we support. */ const pseudo_typeS md_pseudo_table[] = { - /* - { "byte", ppc_byte, 0 }, - { "long", ppc_elf_cons, 4 }, - { "word", ppc_elf_cons, 2 }, - { "short", ppc_elf_cons, 2 }, - { "rdata", ppc_elf_rdata, 0 }, - { "rodata", ppc_elf_rdata, 0 }, - { "lcomm", ppc_elf_lcomm, 0 }, - */ { NULL, NULL, 0 } }; @@ -440,7 +430,6 @@ md_begin () { char *prev_name = ""; register const struct v850_opcode *op; - const struct v850_opcode *op_end; v850_hash = hash_new(); @@ -461,7 +450,6 @@ md_begin () } } - static bfd_reloc_code_real_type v850_reloc_prefix() { @@ -495,16 +483,12 @@ md_assemble (str) struct v850_opcode *next_opcode; const unsigned char *opindex_ptr; int next_opindex; - unsigned long insn; + unsigned long insn, size; char *f; int i; - int numops; int match; bfd_reloc_code_real_type reloc; - int numopts; - expressionS myops[5]; - /* Get the opcode. */ for (s = str; *s != '\0' && ! isspace (*s); s++) ; @@ -538,7 +522,6 @@ md_assemble (str) const struct v850_operand *operand; char *hold; expressionS ex; - char endc; if (next_opindex == 0) { @@ -587,6 +570,9 @@ md_assemble (str) ex.X_add_number = ((ex.X_add_number >> 16) & 0xffff) + ((ex.X_add_number >> 15) & 1); break; + + default: + break; } insn = v850_insert_operand (insn, operand, ex.X_add_number, @@ -741,12 +727,15 @@ md_assemble (str) input_line_pointer = str; - /* Write out the instruction - FIXME: we can determine the size of the opcode by the instruction - pattern, it does not have to be stored in the opcode table. */ - f = frag_more (opcode->size); - md_number_to_chars (f, insn, opcode->size); + /* Write out the instruction. + Four byte insns have an opcode with the two high bits on. */ + if ((insn & 0x0600) == 0x0600) + size = 4; + else + size = 2; + f = frag_more (size); + md_number_to_chars (f, insn, size); /* Create any fixups. At this point we do not use a bfd_reloc_code_real_type, but instead just use the @@ -825,10 +814,14 @@ md_estimate_size_before_relax (fragp, seg) } long -md_pcrel_from (fixp) +md_pcrel_from_section (fixp, sec) fixS *fixp; + segT sec; { - if (fixp->fx_addsy != (symbolS *) NULL && ! S_IS_DEFINED (fixp->fx_addsy)) + /* If the symbol is undefined, or in a section other than our own, + then let the linker figure it out. */ + if ((fixp->fx_addsy != (symbolS *) NULL && ! S_IS_DEFINED (fixp->fx_addsy)) + || (fixp->fx_addsy && S_GET_SEGMENT (fixp->fx_addsy) != sec)) { /* The symbol is undefined. Let the linker figure it out. */ return 0; @@ -844,8 +837,6 @@ md_apply_fix3 (fixp, valuep, seg) { valueT value; char *where; - unsigned long insn; - int op_type; if (fixp->fx_addsy == (symbolS *) NULL) { @@ -949,12 +940,6 @@ v850_insert_operand (insn, operand, val, file, line) if ((operand->flags & V850_OPERAND_SIGNED) != 0) { -#if 0 - if ((operand->flags & PPC_OPERAND_SIGNOPT) != 0 - && ppc_size == PPC_OPCODE_32) - max = (1 << operand->bits) - 1; - else -#endif max = (1 << (operand->bits - 1)) - 1; min = - (1 << (operand->bits - 1)); } @@ -964,12 +949,7 @@ v850_insert_operand (insn, operand, val, file, line) min = 0; } -#if 0 - if ((operand->flags & PPC_OPERAND_NEGATIVE) != 0) - test = - val; - else -#endif - test = val; + test = val; if (test < (offsetT) min || test > (offsetT) max) @@ -989,7 +969,7 @@ v850_insert_operand (insn, operand, val, file, line) if (operand->insert) { const char *message = NULL; - insn = (operand->insert) (insn, val, &message); + insn = (*operand->insert) (insn, val, &message); if (message != NULL) { if (file == (char *) NULL) diff --git a/gas/config/tc-v850.h b/gas/config/tc-v850.h index 4cb2bbea78f..dac6f25a3ad 100644 --- a/gas/config/tc-v850.h +++ b/gas/config/tc-v850.h @@ -46,3 +46,6 @@ #define WORKING_DOT_WORD #define md_number_to_chars number_to_chars_littleendian + +/* call md_pcrel_from_section, not md_pcrel_from */ +#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC) -- 2.30.2