From mboxrd@z Thu Jan 1 00:00:00 1970 From: ralphc@pyramid.com (Ralph Campbell) To: gas2@cygnus.com Cc: glass@sun-lamp.cs.berkeley.edu Subject: bug fixes for gas-2.3/binutils-2.4 Date: Tue, 21 Jun 1994 22:23:00 -0000 Message-id: <9406220524.AA29248@pyrps5.eng.pyramid.com> X-SW-Source: 1994/msg00049.html I have made a few bug fixes for the gas-2.3/binutils-2.4 release for the "configure mips-dec-bsd" case. Some of these changes are common to all architectures and some just to mips. bfd/aoutx.h 1) minor optimization to ignore debug symbols 2) fix test for subsections for a.out format opcodes/mips-dis.c This is a major performance boost. Helps when disassembling whole programs. ld/scripttempl/mipsbsd.sc minor cleanup. ld/ldlang.c The following command will fail to produce the correct relocation table entries. "ld -x -r -Ttext 1000 -o t.o t1.o" This is because .text has an expression to set the section vma but at the end, the test for updating dot is wrong so if the next section doesn't have an explicit address expression (or the expression is '.') it gets its vma set to the vma of .text. *** bfd/aoutx.h.old Thu Apr 21 10:00:44 1994 --- bfd/aoutx.h Sun Jun 19 23:42:10 1994 *************** *** 3050,3056 **** struct bfd_link_hash_entry *h; /* Ignore symbols that are not externally visible. */ ! if ((type & N_EXT) == 0) { if (type == N_WARNING || type == N_INDR) --- 3050,3056 ---- struct bfd_link_hash_entry *h; /* Ignore symbols that are not externally visible. */ ! if ((type & N_STAB) || (type & N_EXT) == 0 || type == N_FN) { if (type == N_WARNING || type == N_INDR) *************** *** 3383,3389 **** drsize = 0; for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next) { ! if (bfd_get_flavour (abfd) == bfd_target_aout_flavour) { trsize += exec_hdr (sub)->a_trsize; drsize += exec_hdr (sub)->a_drsize; --- 3383,3389 ---- drsize = 0; for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next) { ! if (bfd_get_flavour (sub) == bfd_target_aout_flavour) { trsize += exec_hdr (sub)->a_trsize; drsize += exec_hdr (sub)->a_drsize; *** opcodes/mips-dis.c.old Mon Nov 8 09:40:03 1993 --- opcodes/mips-dis.c Sun Jun 19 17:02:40 1994 *************** *** 186,215 **** struct disassemble_info *info; unsigned long int word; { - register int i; register const char *d; ! for (i = 0; i < NUMOPCODES; i++) { ! if (mips_opcodes[i].pinfo != INSN_MACRO) { ! register unsigned int match = mips_opcodes[i].match; ! register unsigned int mask = mips_opcodes[i].mask; ! if ((word & mask) == match) ! break; ! } } ! ! /* Handle undefined instructions. */ ! if (i == NUMOPCODES) { ! (*info->fprintf_func) (info->stream, "0x%x", word); ! return 4; } ! (*info->fprintf_func) (info->stream, "%s", mips_opcodes[i].name); ! if (!(d = mips_opcodes[i].args)) return 4; (*info->fprintf_func) (info->stream, " "); --- 186,234 ---- struct disassemble_info *info; unsigned long int word; { register const char *d; + register const struct mips_opcode *op; + static int init; + static const struct mips_opcode *mips_hash[OP_MASK_OP + 1]; ! (*info->fprintf_func) (info->stream, "0x%08x ", word); ! ! /* Build a hash table to shorten the search time */ ! if (!init) { ! do { ! for (op = mips_opcodes; op < &mips_opcodes[NUMOPCODES]; op++) ! { ! if (op->pinfo == INSN_MACRO) ! continue; ! if ((init << OP_SH_OP) == (op->match & (OP_MASK_OP << OP_SH_OP))) ! { ! mips_hash[init] = op; ! break; ! } ! } ! } ! while (++init <= OP_MASK_OP); } ! op = mips_hash[(word >> OP_SH_OP) & OP_MASK_OP]; ! if (op) { ! do ! { ! if (op->pinfo != INSN_MACRO && (word & op->mask) == op->match) ! goto fnd; ! } ! while (++op < &mips_opcodes[NUMOPCODES]); } + /* Handle undefined instructions. */ + (*info->fprintf_func) (info->stream, "0x%x", word); + return 4; ! fnd: ! (*info->fprintf_func) (info->stream, "%s", op->name); ! if (!(d = op->args)) return 4; (*info->fprintf_func) (info->stream, " "); *** ld/scripttempl/mipsbsd.sc.old Thu May 5 17:40:45 1994 --- ld/scripttempl/mipsbsd.sc Tue Jun 21 22:39:27 1994 *************** *** 11,23 **** *(.text) ${RELOCATING+etext = ${DATA_ALIGNMENT};} } ! .data ${RELOCATING+${DATA_ALIGNMENT}} : { *(.data) ${CONSTRUCTING+CONSTRUCTORS} ${RELOCATING+edata = .;} } ! .bss ${RELOCATING+SIZEOF(.data) + ADDR(.data)} : { *(.bss) *(COMMON) --- 11,23 ---- *(.text) ${RELOCATING+etext = ${DATA_ALIGNMENT};} } ! .data ${RELOCATING+${DATA_ALIGNMENT}} : { *(.data) ${CONSTRUCTING+CONSTRUCTORS} ${RELOCATING+edata = .;} } ! .bss : { *(.bss) *(COMMON) *** ld/ldlang.c.old Wed May 4 09:13:46 1994 --- ld/ldlang.c Tue Jun 21 22:37:55 1994 *************** *** 1722,1729 **** os->processed = true; /* Replace into region ? */ ! if (os->addr_tree == (etree_type *) NULL ! && os->region != (lang_memory_region_type *) NULL) { os->region->current = dot; /* Make sure this isn't silly */ --- 1722,1728 ---- os->processed = true; /* Replace into region ? */ ! if (os->region != (lang_memory_region_type *) NULL) { os->region->current = dot; /* Make sure this isn't silly */