*** ld/Makefile.in.orig Fri Jun 2 13:12:54 2000 --- ld/Makefile.in Fri Jun 2 23:53:24 2000 *************** *** 527,535 **** $(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@ .y.c: $(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c if test -f y.tab.h; then \ if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \ ! else :; fi ldgram.h: ldgram.c --- 527,543 ---- $(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@ .y.c: $(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c + if test -f y.tab.c; then \ + mv y.tab.c $*.c ; \ + fi ; \ + if test -f y_tab.c; then \ + mv y_tab.c $*.c ; \ + fi ; \ if test -f y.tab.h; then \ if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \ ! elif test -f y_tab.h; then \ ! if cmp -s y_yab.h $*.h; then rm -f y_tab.h; else mv y_tab.h $*.h; fi; \ ! fi ldgram.h: ldgram.c *** binutils/ar.c.orig Sun May 28 06:57:50 2000 --- binutils/ar.c Thu Jun 22 10:31:40 2000 *************** normalize (file, abfd) *** 307,316 **** { /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ char *bslash = strrchr (file, '\\'); ! if (bslash > filename) filename = bslash; if (filename == NULL && file[0] != '\0' && file[1] == ':') ! filename = file + 1; } #endif if (filename != (char *) NULL) --- 307,316 ---- { /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ char *bslash = strrchr (file, '\\'); ! if (filename == NULL || (bslash != NULL && bslash > filename)) filename = bslash; if (filename == NULL && file[0] != '\0' && file[1] == ':') ! filename = file + 1; } #endif if (filename != (char *) NULL) *** binutils/bucomm.c.orig Sun May 28 06:57:50 2000 --- binutils/bucomm.c Thu Jun 22 10:34:12 2000 *************** make_tempname (filename) *** 219,225 **** { /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ char *bslash = strrchr (filename, '\\'); ! if (bslash > slash) slash = bslash; if (slash == NULL && filename[0] != '\0' && filename[1] == ':') slash = filename + 1; --- 219,225 ---- { /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ char *bslash = strrchr (filename, '\\'); ! if (slash == NULL || (bslash != NULL && bslash > slash)) slash = bslash; if (slash == NULL && filename[0] != '\0' && filename[1] == ':') slash = filename + 1; *** binutils/ieee.c.orig Sun May 28 06:57:50 2000 --- binutils/ieee.c Thu Jun 22 10:35:36 2000 *************** ieee_start_compilation_unit (p, filename *** 4940,4947 **** info->filename = filename; modname = strrchr (filename, '/'); /* We could have a mixed forward/back slash case. */ ! backslash = strrchr (modname, '\\'); ! if (backslash > modname) modname = backslash; if (modname != NULL) --- 4940,4947 ---- info->filename = filename; modname = strrchr (filename, '/'); /* We could have a mixed forward/back slash case. */ ! backslash = strrchr (filename, '\\'); ! if (modname == NULL || (backslash != NULL && backslash > modname)) modname = backslash; if (modname != NULL) *** gas/config/tc-i386.c.orig Tue May 23 01:04:30 2000 --- gas/config/tc-i386.c Thu Jun 22 13:46:18 2000 *************** md_assemble (line) *** 1362,1367 **** --- 1362,1392 ---- } } + if (i.disp_operands) + { + /* Try to use the smallest displacement type too. */ + int op; + + for (op = i.operands; --op >= 0; ) + if ((i.types[op] & Disp) + && i.op[op].imms->X_op == O_constant) + { + offsetT disp = i.op[op].disps->X_add_number; + + if (i.types[op] & Disp16) + { + /* We know this operand is at most 16 bits, so + convert to a signed 16 bit number before trying + to see whether it will fit in an even smaller + size. */ + + disp = (((disp & 0xffff) ^ 0x8000) - 0x8000); + } + if (fits_in_signed_byte (disp)) + i.types[op] |= Disp8; + } + } + overlap0 = 0; overlap1 = 0; overlap2 = 0; *************** i386_displacement (disp_start, disp_end) *** 2826,2853 **** exp->X_op_symbol = (symbolS *) 0; } - if (exp->X_op == O_constant) - { - if (i.types[this_operand] & Disp16) - { - /* We know this operand is at most 16 bits, so convert to a - signed 16 bit number before trying to see whether it will - fit in an even smaller size. */ - exp->X_add_number = - (((exp->X_add_number & 0xffff) ^ 0x8000) - 0x8000); - } - if (fits_in_signed_byte (exp->X_add_number)) - i.types[this_operand] |= Disp8; - } #if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT)) ! else if ( #ifdef BFD_ASSEMBLER ! OUTPUT_FLAVOR == bfd_target_aout_flavour && #endif ! exp_seg != text_section ! && exp_seg != data_section ! && exp_seg != bss_section ! && exp_seg != undefined_section) { #ifdef BFD_ASSEMBLER as_bad (_("unimplemented segment %s in operand"), exp_seg->name); --- 2851,2865 ---- exp->X_op_symbol = (symbolS *) 0; } #if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT)) ! if (exp->X_op != O_constant #ifdef BFD_ASSEMBLER ! && OUTPUT_FLAVOR == bfd_target_aout_flavour #endif ! && exp_seg != text_section ! && exp_seg != data_section ! && exp_seg != bss_section ! && exp_seg != undefined_section) { #ifdef BFD_ASSEMBLER as_bad (_("unimplemented segment %s in operand"), exp_seg->name); *** bfd/cofflink.c.orig Wed Mar 1 14:40:54 2000 --- bfd/cofflink.c Mon Jul 3 19:57:42 2000 *************** static int process_embedded_commands *** 40,45 **** --- 40,54 ---- PARAMS ((bfd *, struct bfd_link_info *, bfd *)); static void mark_relocs PARAMS ((struct coff_final_link_info *, bfd *)); + /* Return true if SYM is a weak, external symbol. */ + #define IS_WEAK_EXTERNAL(abfd, sym) \ + ((sym).n_sclass == C_WEAKEXT \ + || (obj_pe (abfd) && (sym).n_sclass == C_NT_WEAK)) + + /* Return true if SYM is an external symbol. */ + #define IS_EXTERNAL(abfd, sym) \ + ((sym).n_sclass == C_EXT || IS_WEAK_EXTERNAL (abfd, sym)) + /* Define macros so that the ISFCN, et. al., macros work correctly. These macros are defined in include/coff/internal.h in terms of N_TMASK, etc. These definitions require a user to define local *************** coff_link_add_symbols (abfd, info) *** 395,402 **** break; } ! if (sym.n_sclass == C_WEAKEXT ! || (obj_pe (abfd) && sym.n_sclass == C_NT_WEAK)) flags = BSF_WEAK; addit = true; --- 404,410 ---- break; } ! if (IS_WEAK_EXTERNAL (abfd, sym)) flags = BSF_WEAK; addit = true; *************** _bfd_coff_link_input_bfd (finfo, input_b *** 1834,1845 **** } /* If doing task linking, convert normal global function symbols to ! static functions. */ ! ! if (finfo->info->task_link ! && (isym.n_sclass == C_EXT ! || isym.n_sclass == C_WEAKEXT ! || (obj_pe (input_bfd) && isym.n_sclass == C_NT_WEAK))) isym.n_sclass = C_STAT; /* Output the symbol. */ --- 1842,1849 ---- } /* If doing task linking, convert normal global function symbols to ! static functions. */ ! if (finfo->info->task_link && IS_EXTERNAL (input_bfd, isym)) isym.n_sclass = C_STAT; /* Output the symbol. */ *************** _bfd_coff_link_input_bfd (finfo, input_b *** 2202,2208 **** is.n_numaux, auxptr); } ! skipping = false; } iline.l_addr.l_symndx = indx; --- 2206,2212 ---- is.n_numaux, auxptr); } ! skipping = false; } iline.l_addr.l_symndx = indx; *************** _bfd_coff_write_global_sym (h, data) *** 2549,2566 **** /* If doing task linking and this is the pass where we convert defined globals to statics, then do that conversion now. If the symbol is not being converted, just ignore it and it will be ! output during a later pass. */ if (finfo->global_to_static) { ! if (isym.n_sclass != C_EXT ! && isym.n_sclass != C_WEAKEXT ! && (! obj_pe (output_bfd) || isym.n_sclass != C_NT_WEAK)) ! { ! return true; ! } isym.n_sclass = C_STAT; } isym.n_numaux = h->numaux; bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) finfo->outsyms); --- 2553,2575 ---- /* If doing task linking and this is the pass where we convert defined globals to statics, then do that conversion now. If the symbol is not being converted, just ignore it and it will be ! output during a later pass. */ if (finfo->global_to_static) { ! if (! IS_EXTERNAL (output_bfd, isym)) ! return true; ! isym.n_sclass = C_STAT; } + /* When a weak symbol is not overriden by a strong one, + turn it into an external symbol when not building a + shared or relocateable object. */ + if (! finfo->info->shared + && ! finfo->info->relocateable + && IS_WEAK_EXTERNAL (finfo->output_bfd, isym)) + isym.n_sclass = C_EXT; + isym.n_numaux = h->numaux; bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) finfo->outsyms); *** bfd/coffcode.h.orig Wed Mar 1 15:39:08 2000 --- bfd/coffcode.h Wed Jul 5 18:19:04 2000 *************** coff_add_missing_symbols (abfd) *** 3022,3027 **** --- 3022,3031 ---- #endif /* 0 */ + #if defined (__MSDOS__) + #define COFF_PAD_SECTION_HEADERS + #endif + /* SUPPRESS 558 */ /* SUPPRESS 529 */ static boolean *************** coff_write_object_contents (abfd) *** 3381,3386 **** --- 3385,3402 ---- } #endif + #ifdef COFF_PAD_SECTION_HEADERS + if ((abfd->flags & EXEC_P) != 0) + { + file_ptr cur_ptr = scn_base + + abfd->section_count * bfd_coff_scnhsz (abfd); + long fill_size = (abfd->sections->filepos - cur_ptr); + bfd_byte *b = bfd_zmalloc (fill_size); + bfd_write ((PTR)b, 1, fill_size, abfd); + free (b); + } + #endif + /* OK, now set up the filehdr... */ /* Don't include the internal abs section in the section count */ *** ld/ldmain.c.orig Sun May 28 06:57:52 2000 --- ld/ldmain.c Thu Jul 6 00:30:34 2000 *************** set_scripts_dir () *** 572,578 **** { /* We could have \foo\bar, or /foo\bar. */ char *bslash = strrchr (program_name, '\\'); ! if (bslash > end) end = bslash; } #endif --- 572,578 ---- { /* We could have \foo\bar, or /foo\bar. */ char *bslash = strrchr (program_name, '\\'); ! if (end == NULL || (bslash != NULL && bslash > end)) end = bslash; } #endif *** ld/scripttempl/i386go32.sc.orig Sun Feb 27 22:55:16 2000 --- ld/scripttempl/i386go32.sc Thu Jul 6 14:49:18 2000 *************** *** 5,12 **** # These are substituted in as variables in order to get '}' in a shell # conditional expansion. ! CTOR='.ctor : { *(.ctor) }' ! DTOR='.dtor : { *(.dtor) }' cat <frchainP->frch_root; ! last = seg_info (sec)->frchainP->frch_last; ! while (fragp->fr_next != last) ! fragp = fragp->fr_next; ! last->fr_address = size; ! fragp->fr_offset += new_size - size; } #endif