diff options
author | Alan Modra <amodra@gmail.com> | 2001-05-16 01:08:21 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2001-05-16 01:08:21 +0000 |
commit | 9fcc94b61152a17eb617087ed0d689d5f426883d (patch) | |
tree | 8f72671cdfc8c6dbb493b646523e73b5d545aa88 /gas/config | |
parent | 84fd0d38aef23f365fe9e1ef3dac9ed4f4ae3b4b (diff) | |
download | gdb-9fcc94b61152a17eb617087ed0d689d5f426883d.zip gdb-9fcc94b61152a17eb617087ed0d689d5f426883d.tar.gz gdb-9fcc94b61152a17eb617087ed0d689d5f426883d.tar.bz2 |
Fix dwarf2_emit_insn calls when frag_var breaks things.
Put back an old entry in ChangeLog-9899, deleted when ChangeLog split.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-arc.c | 4 | ||||
-rw-r--r-- | gas/config/tc-i386.c | 27 | ||||
-rw-r--r-- | gas/config/tc-v850.c | 13 |
3 files changed, 12 insertions, 32 deletions
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index 3cbd3c0..730cfc6 100644 --- a/gas/config/tc-arc.c +++ b/gas/config/tc-arc.c @@ -806,6 +806,7 @@ md_assemble (str) f = frag_more (8); md_number_to_chars (f, insn, 4); md_number_to_chars (f + 4, limm, 4); + dwarf2_emit_insn (8); } else if (limm_reloc_p) { @@ -816,6 +817,7 @@ md_assemble (str) { f = frag_more (4); md_number_to_chars (f, insn, 4); + dwarf2_emit_insn (4); } /* Create any fixups. */ @@ -870,8 +872,6 @@ md_assemble (str) (bfd_reloc_code_real_type) reloc_type); } - dwarf2_emit_insn (4); - /* All done. */ return; } diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 57b9b0f..a710532 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -1231,10 +1231,6 @@ md_assemble (line) /* Points to template once we've found it. */ const template *t; - /* Count the size of the instruction generated. Does not include - variable part of jump insns before relax. */ - int insn_size = 0; - int j; char mnemonic[MAX_MNEM_SIZE]; @@ -2702,6 +2698,11 @@ md_assemble (line) { register char *p; + /* 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); + /* Output jumps. */ if (i.tm.opcode_modifier & Jump) { @@ -2734,7 +2735,6 @@ md_assemble (line) bytes for the opcode and room for the prefix and largest displacement. */ frag_grow (prefix + 2 + 4); - insn_size += prefix + 1; /* Prefix and 1 opcode byte go in fr_fix. */ p = frag_more (prefix + 1); if (i.prefix[DATA_PREFIX]) @@ -2766,7 +2766,6 @@ md_assemble (line) size = 1; if (i.prefix[ADDR_PREFIX]) { - insn_size += 1; FRAG_APPEND_1_CHAR (ADDR_PREFIX_OPCODE); i.prefixes -= 1; } @@ -2781,7 +2780,6 @@ md_assemble (line) if (i.prefix[DATA_PREFIX]) { - insn_size += 1; FRAG_APPEND_1_CHAR (DATA_PREFIX_OPCODE); i.prefixes -= 1; code16 ^= CODE16; @@ -2795,7 +2793,6 @@ md_assemble (line) if (i.prefix[REX_PREFIX]) { FRAG_APPEND_1_CHAR (i.prefix[REX_PREFIX]); - insn_size++; i.prefixes -= 1; } @@ -2804,13 +2801,11 @@ md_assemble (line) if (fits_in_unsigned_byte (i.tm.base_opcode)) { - insn_size += 1 + size; p = frag_more (1 + size); } else { /* Opcode can be at most two bytes. */ - insn_size += 2 + size; p = frag_more (2 + size); *p++ = (i.tm.base_opcode >> 8) & 0xff; } @@ -2850,7 +2845,6 @@ md_assemble (line) as_warn (_("skipping prefixes on this instruction")); /* 1 opcode; 2 segment; offset */ - insn_size += prefix + 1 + 2 + size; p = frag_more (prefix + 1 + 2 + size); if (i.prefix[DATA_PREFIX]) @@ -2898,7 +2892,6 @@ md_assemble (line) { if (*q) { - insn_size += 1; p = frag_more (1); md_number_to_chars (p, (valueT) *q, 1); } @@ -2907,12 +2900,10 @@ md_assemble (line) /* Now the opcode; be careful about word order here! */ if (fits_in_unsigned_byte (i.tm.base_opcode)) { - insn_size += 1; FRAG_APPEND_1_CHAR (i.tm.base_opcode); } else { - insn_size += 2; p = frag_more (2); /* Put out high byte first: can't use md_number_to_chars! */ *p++ = (i.tm.base_opcode >> 8) & 0xff; @@ -2922,7 +2913,6 @@ md_assemble (line) /* Now the modrm byte and sib byte (if present). */ if (i.tm.opcode_modifier & Modrm) { - insn_size += 1; p = frag_more (1); md_number_to_chars (p, (valueT) (i.rm.regmem << 0 @@ -2937,7 +2927,6 @@ md_assemble (line) && i.rm.mode != 3 && !(i.base_reg && (i.base_reg->reg_type & Reg16) != 0)) { - insn_size += 1; p = frag_more (1); md_number_to_chars (p, (valueT) (i.sib.base << 0 @@ -2971,7 +2960,6 @@ md_assemble (line) } val = offset_in_range (i.op[n].disps->X_add_number, size); - insn_size += size; p = frag_more (size); md_number_to_chars (p, val, size); } @@ -3018,7 +3006,6 @@ md_assemble (line) size = 8; } - insn_size += size; p = frag_more (size); fix_new_exp (frag_now, p - frag_now->fr_literal, size, i.op[n].disps, pcrel, @@ -3053,7 +3040,6 @@ md_assemble (line) } val = offset_in_range (i.op[n].imms->X_add_number, size); - insn_size += size; p = frag_more (size); md_number_to_chars (p, val, size); } @@ -3079,7 +3065,6 @@ md_assemble (line) size = 8; } - insn_size += size; p = frag_more (size); reloc_type = reloc (size, 0, sign, i.reloc[n]); #ifdef BFD_ASSEMBLER @@ -3107,8 +3092,6 @@ md_assemble (line) } } - dwarf2_emit_insn (insn_size); - #ifdef DEBUG386 if (flag_debug) { diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index 89f4b98..ef22afe 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -1699,7 +1699,6 @@ md_assemble (str) int relaxable = 0; unsigned long insn; unsigned long insn_size; - unsigned long total_insn_size = 0; char *f; int i; int match; @@ -2150,6 +2149,11 @@ md_assemble (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) @@ -2175,7 +2179,6 @@ md_assemble (str) md_number_to_chars (f, insn, insn_size); md_number_to_chars (f + 2, 0, 4); } - total_insn_size = insn_size; } else { @@ -2190,15 +2193,11 @@ md_assemble (str) insn_size = 2; f = frag_more (insn_size); - total_insn_size = insn_size; - md_number_to_chars (f, insn, insn_size); if (extra_data_after_insn) { f = frag_more (extra_data_len); - total_insn_size += extra_data_len; - md_number_to_chars (f, extra_data, extra_data_len); extra_data_after_insn = false; @@ -2271,8 +2270,6 @@ md_assemble (str) } input_line_pointer = saved_input_line_pointer; - - dwarf2_emit_insn (total_insn_size); } /* If while processing a fixup, a reloc really needs to be created |