From: Ken Raeburn Date: Thu, 3 Dec 1992 23:54:54 +0000 (+0000) Subject: Some cleanup. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7f2cb2702a7e2451b7096bfef416dfab61cf79d9;p=binutils-gdb.git Some cleanup. Deleted some unused code. Fixed some declarations to use PARAMS macro. Fixed up configure.in for new targets. Some whitespace/comment fixes. Merged config/ChangeLog. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 9695b1e2f70..57cc19f0661 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,10 +1,113 @@ +Thu Dec 3 01:24:07 1992 Ken Raeburn (raeburn@kr-pc.cygnus.com) + + * config/ho-generic.h (malloc, realloc): Declare. + + * Lots of comment/whitespace changes. + + * write.h (struct fix): Some fields reordered, narrowed. + + * read.c (MASK_CHAR): Define using C types, not magic number. + + * as.c, input-file.c: Deleted some unused code. + + * app.c, as.h: Doc fix. + + * flonum-konst.c, flonum-mult.c: Include ansidecl.h. + + * as.h (xmalloc): Argument is long. + + * xmalloc.c (error): Remove declaration; as.h takes care of it. + +Mon Nov 30 11:42:11 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) + + * configure.in: Accept target OS "vms". + + * symbols.c: Merged ANSI and non-ANSI function decls, using + PARAMS macro. + + * xmalloc.c: Just include as.h, don't bother trying to figure out + other header files. + + * strstr.c, strerror.c: Deleted. + * Makefile.in: Deleted references. + + * config/tc-ns32k.c: Don't include header file for string + declarations; leave that to ho-*.h. + +Fri Nov 27 04:11:36 1992 Ken Raeburn (raeburn at cambridge-laptop.cygnus.com) + + * config/coff_gnu.h [TC_I860]: Guesses for reloc type values, + imported from FSF sources. + + * messages.c (strerror): Declare unconditionally. + + * as.h: Delete alloca and register definitions. + + * config/atof-ieee.c (mask): Now const. + + * obstack.c, obstack.h: Deleted. + + * as.h (flag_readonly_data_in_text): New flag. + * as.c (main): Set it for -R. + + * as.h (flag_suppress_warnings): New flag. + * as.c (main): Set it for -W. + * messages.c (as_warn): Check it instead of flagseen['W']. + + * as.h (flag_always_generate_output): New flag. + * as.c (main): Set it for -Z. + + * config/tc-sparc.h: Define NEED_FX_R_TYPE. + * config/tc-a29k.h: Ditto. + * write.h (struct fix): Don't conditionalize fx_r_type field on TC + macros. + + * as.h: Merged ANSI and non-ANSI function decls, using PARAMS + macro. + * bignum.h, expr.h, flonum.h, frags.h, input-file.h, listing.h, + obj.h, output-file.h, read.h, struc-symbol.h, symbols.h, tc.h, + write.h: Likewise. + * read.c: Likewise. + + * xmalloc.c: Conditionalize on HAVE_MALLOC_H, not USG. Fold in + xrealloc from xrealloc.c. + * xrealloc.c: Deleted. + * Makefile.in (REAL_SOURCES, OBJS): Adjusted. + + * configure.in: For host CPU a29k, rs6000, vax, consider using bsd + or vms ho- files. + + * config/ho-sysv.h (setbuffer, HO_USG): Deleted. + + * config/atof-ieee.c (atof_ieee): Exponent field isn't a pointer; + don't initialize it with NULL. + + * config/ho-vax.h (M_VAX): Deleted; was unused. + + * README-vms, config/ho-vms.h, config/obj-vms.c, config/obj-vms.h: + New files imported from FSF version, contributed by Eric Youngdale. + * README-vms-dbg, config/vms: Deleted. + + * ChangeLog, config/ChangeLog: Merged. + + * config/*tahoe*, configure.in: Tahoe support brought in from FSF + version. + + * input-file.c (input_file_open): Eliminate call to setvbuf. + [USG] (setbuffer): Deleted macro. + Mon Nov 23 11:00:16 1992 Ken Raeburn (raeburn@cygnus.com) * all files: Whitespace changes for GNU indentation style, done by - GNU `indent'. Some cleanup still needed. + GNU `indent'. Some cleanup still needed, especially of comments. * configure.in: No te-386bsd.h file exists; don't try to use it. + * obj-coff.c (obj_coff_endef): Use as_warn, not fprintf. + + * tc-m68k.c (md_assemble): Don't complain about 68000 with 68881; + could be doing emulation. + Tue Nov 10 09:49:24 1992 Ian Lance Taylor (ian@cygnus.com) * Makefile.in (as.o, obj-format.o): added dependency on subsegs.h. @@ -16,6 +119,47 @@ Tue Nov 10 09:49:24 1992 Ian Lance Taylor (ian@cygnus.com) read.c, app.c: removed definitions of comment_chars, line_comment_chars, and line_separator_chars. + * tc-m68k.c (m68k_reg_parse): If REGISTER_PREFIX isn't defined, + still accept (but don't require) OPTIONAL_REGISTER_PREFIX before + the register name. + (insert_reg): put REGISTER_PREFIX before register names before + putting them in the symbol table. + * tc-m68k.h (OPTIONAL_REGISTER_PREFIX): Define to be "%", if not + M68KCOFF. + + * obj-coffbfd.c (fill_section): set STYP_NOLOAD bit for .bss + section. + + * atof-ieee.c, atof-ns32k.c, tc-*.c: made EXP_CHARS, FLT_CHARS, + comment_chars, line_comment_chars and line_seperator_chars + consistently const, and always initialized them. Included read.h. + +Thu Nov 5 17:55:41 1992 Jim Wilson (wilson@sphagnum.cygnus.com) + + * tc-sparc.c (sparc_ip): Add code to flag error if an absolute + constant will not fit in an immediate field. + (md_apply_fix, RELOC_BASE13 case): Check for relocation overflow. + +Wed Nov 4 07:50:46 1992 Ken Raeburn (raeburn@cygnus.com) + + * obj-coff.c (callj_table): Delete global variable. + (obj_emit_relocations): Define it locally here, and only if + TC_I960 is defined. + + * tc-m68k.c (m68k_reg_parse): Underscore is part of a symbol name. + (m68k_ip): Don't warn about bignum used as float bit-pattern. + + * obj-coff.c: Replaced ANSI and non-ANSI function declarations + with a single set using PARAMS macro. + + * tc-i960.c (tc_bout_fix_to_chars): Bit-field fixups want a length + of 2. + + * tc-i960.c: Missed a couple of 0->NO_RELOC conversions. + + * tc-i960.h (N_BALNAME, N_CALLNAME): Define as char-type values, + so widening works consistently. + Wed Oct 28 08:52:34 1992 Ken Raeburn (raeburn@cygnus.com) * version.c: Put conditional "const" before version_string, not @@ -24,8 +168,22 @@ Wed Oct 28 08:52:34 1992 Ken Raeburn (raeburn@cygnus.com) * app.c (do_scrub_next_char): Need double-\ before `000' to show printed rep of null character. +Fri Oct 23 14:40:38 1992 Ian Lance Taylor (ian@cygnus.com) + + * obj-coffbfd.c (write_object_file): check return value of + bfd_close_all_done. + Tue Oct 20 12:18:08 1992 Ian Lance Taylor (ian@cygnus.com) + * Support for i386-sysv. + obj-coffbfd.c (do_relocs_for, write_object_file): set segment + addresses to reasonable sizes. New define ZERO_BASED_SEGMENTS can + be used to set them all to zero as was done before. + (fill_section): segment addresses now set in write_object_file. + (fill_section): Don't set STYP_NOLOAD for .bss section. + (fixup_segment): 386 uses strange common symbol format. + tc-i386.c (tc_coff_fix2rtype): use R_DIR32, not R_RELLONG, for + compatibility with SVR3.2 linker. * configure.in: i386-sysv and i386-sco use coffbfd. * app.c (do_scrub_next_char): discard whitespace after a label. @@ -35,6 +193,16 @@ Sat Oct 10 12:33:45 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) * configure.in: differentiate between SunOS 4 and Solaris2 for Sun4 hosts, use the sysv configuration for solaris2 +Mon Oct 5 09:28:57 1992 Steve Chamberlain (sac@thepub.cygnus.com) + + fix i960+non-bfd coff bit rot. + * obj-coff.c (c_dot_file_symbol, obj_coff_ln, obj_coff_line): + support for C source listings. (obj_coff_endef): look in the right + part of the symbol for the symbol name + + * tc-m68k.c (get_num): make it work for all segments, not just the + first three. + Mon Oct 5 03:30:36 1992 Mark Eichin (eichin at tweedledumber.cygnus.com) * configure.in: recognize i386-*-bsd emulation. @@ -43,10 +211,30 @@ Thu Oct 1 23:05:12 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) * configure.in: use the cpu-vendor-os triple for host and target +Tue Sep 29 12:22:52 1992 Steve Chamberlain (sac@thepub.cygnus.com) + + * obj-coffbfd.c (write_object_file): don't fixup for the z8k + * tc-z8k.c: lots of bug fixes + +Tue Sep 29 10:51:55 1992 Ian Lance Taylor (ian@cygnus.com) + + * tc-i960.h, tc-i960.c: avoid the ANSI preprocessor addition + #elif, since it is not supported by old compilers. + ho-rs6000.h, tc-m68k.c: the native RS/6000 compiler miscompiles a + couple of expressions in tc-m68k.c. + Mon Sep 28 21:18:24 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) * read.c (cons): If NO_RELOC is defined, use it. + * tc-i960.c (get_cdisp): Use NO_RELOC, not 0, in call to fix_new. + +Fri Sep 25 18:18:52 1992 Ian Lance Taylor (ian@cygnus.com) + + * tc-m68k.h: if M68KCOFF, define DOT_LABEL_PREFIX (to require + local labels to start with a .) and set REGISTER_PREFIX to %. + tc-m68k.c (m68k_reg_parse): accept REGISTER_PREFIX if defined. + Fri Sep 25 17:53:43 1992 John Gilmore (gnu@cygnus.com) * messages.c: Comment changes. @@ -61,6 +249,29 @@ Thu Sep 24 12:42:32 1992 Brendan Kehoe (brendan@rtl.cygnus.com) * listing.c (debugging_pseudo): Add stabs and stabn as things to ignore. +Tue Sep 22 13:02:07 1992 Sean Eric Fagan (sef@cygnus.com) + + * obj-coffbfd.c (do_relocs_for,fill_section): now allocate all + sections starting from zero, rather than making them consecutive. + This makes subsequent reloc calculations easier, esp if the object + format doesn't understand addends. (obj_coff_lcomm): (maybe temporarily) + allocate lcomm in .data rather than in .bss. It seems that some + tools can't cope with a non-zero sized bss before linkage. + +Tue Sep 22 15:10:51 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) + + * tc-m68k.c: Replace "enum m68k_architecture" with "int" + throughout. That enum no longer means what we thought it meant. + + * tc-m68k.c (md_assemble, md_parse_option): Handle new + "-mno-688[58]1" options. + + * tc-m68k.c: Added CPU32 support. + +Fri Sep 18 08:02:18 1992 Steve Chamberlain (sac@thepub.cygnus.com) + + * tc-m68k.c (m68k_ip): An(disp) is not pc relative. + Tue Sep 15 17:25:05 1992 Jim Wilson (wilson@sphagnum.cygnus.com) * Makefile.in (as.new): Remove dependence on LOCAL_LOADLIBES. @@ -84,6 +295,20 @@ Sun Sep 13 20:30:10 1992 Ian Lance Taylor (ian@cygnus.com) * write.c (fixup_segment): fixed missing parens in expression checking for byte or word overflow. + * obj-coffbfd.h: define WARN_SIGNED_OVERFLOW_WORD. + obj-coffbfd.c (fixup_segment): check for signed .word overflow if + WARN_SIGNED_OVERFLOW_WORD. + + * obj-coffbfd.c (fixup_segment): fixed missing parens in + expression checking for byte or word overflow. + +Fri Sep 11 10:21:04 1992 Steve Chamberlain (sac@thepub.cygnus.com) + + Support for i386 coff + * obj-coffbfd.h : added stuff + * tc-i386.c (tc_coff_fix2rtype): new function + * tc-i386.h : new coff defines + Thu Sep 10 09:23:15 1992 Ian Lance Taylor (ian@cygnus.com) * input-scrub.c (input_scrub_push): call input_file_begin, not @@ -98,6 +323,22 @@ Wed Sep 9 11:06:25 1992 Ian Lance Taylor (ian@cygnus.com) Makefile.in: Handle m68*-*-coff*. read.c, read.h: add mult argument to s_space + * tc-m68k.c (m68k_ip, m68k_ip_op, get_num, try_moto_index): merge + Motorola and MIT syntax; gas can now assemble either type of + file. + tc-m68kmote.c, tc-m68kmote.h: removed now superfluous files. + From Steve Chamberlain: + m68kcoff.mt: for m68k COFF. + obj-coffbfd.c: (fixup_mdeps) added + (size_section) removed bad sanity check + (fill_section) added rs_machine_dependent case + (write_object_file) call fixup_mdeps + (fixup_segment) set fx_subsy to 0. + obj-coffbfd.h: define WORKING_DOT_WORD (too hard to support) and + handle m68k. + tc-m68k.c, config/tc-m68k.h: added m68k COFF support and Motorala + pseudo ops. + Tue Sep 8 17:10:58 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) * Makefile.in (LIBS): Include opcode library. @@ -116,6 +357,12 @@ Sat Aug 29 12:11:12 1992 Jim Wilson (wilson@sphagnum.cygnus.com) * Makefile.in (as.new): Depend on LOCAL_LOADLIBES. +Fri Aug 28 16:25:22 1992 Ian Lance Taylor (ian@cygnus.com) + + * obj-bout.h, obj-bout.c (obj_header_append, obj_symbol_to_chars), + tc-i960.c (md_ri_to_chars): Always output bout object file in + little endian byte order (used to use endianness of host). + Tue Aug 25 15:50:48 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) * config/tc-m68k.c (init_table): Now const. Always include 68851 @@ -136,17 +383,32 @@ Tue Aug 25 15:13:48 1992 Steve Chamberlain (sac@thepub.cygnus.com) * listing.c (buffer_line): rewind to the start of include files, they might be included twice. + * z8k.c, z8k.h, z8k.mt: z8000 support stuff + Mon Aug 24 12:45:43 1992 Ian Lance Taylor (ian@cygnus.com) * Makefile.in: defined TARGET_CPU for C code so that it can choose one element of a family. + * tc-m68k.c: use TARGET_CPU to choose default cpu type. + + * te-generic.h: default to LOCAL_LABELS_DOLLAR and LOCAL_LABELS_FB + so that we can assemble hand-written libgcc code. + Fri Aug 21 14:38:44 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) * messages.c (as_warn): Use fputs, not fprintf, with a buffer that has already been formatted (but may still contain %-characters). (as_bad): Likewise. +Wed Aug 19 11:20:59 1992 Ian Lance Taylor (ian@cygnus.com) + + * tc-m68k.c, tc-m68kmote.c: the cas2 instruction is supposed to be + written with indirection on the last two operands, which can be + either data or address registers. Added a new operand type 'r' + which accepts either register type. Added '(' to notend stuff in + tc-m68kmote.c to accept (a0):(a2) in cas2 instruction. + Wed Aug 19 09:25:09 1992 Ken Raeburn (raeburn@cygnus.com) * as.h (enum _relax_state): Start off at one, not zero, to better @@ -213,16 +475,33 @@ Thu Aug 13 13:53:19 1992 Ken Raeburn (raeburn@cygnus.com) (free): Declare it. (BROKEN_ASSERT): Define it if not __STDC__. +Tue Aug 11 12:58:14 1992 Ken Raeburn (raeburn@cygnus.com) + + * sparc.mt: New file. + +Mon Aug 10 14:37:08 1992 Per Bothner (bothner@cygnus.com) + + * tc-m68k.c: ".align N" means align to N-byte boundary *only* + if TN_SUN3; otherwise align to 2**N-byte bounary. + Thu Aug 6 12:10:39 1992 Steve Chamberlain (sac@thepub.cygnus.com) * read.c (s_fill): make the .fill size clamped error a warn and fix bug where 0's were always placed. + * config/tc-h8300.c: if a :8 is seen after an operand, fill top + two bytes of any constant with 0xff: + Wed Aug 5 12:02:40 1992 Steve Chamberlain (sac@thepub.cygnus.com) * config/tc-m68k.c (md_pseudo_table): fix the .align thing the right way; for just the 68k. Sun 3 .align is nbytes, not ptwo. +Wed Aug 5 01:54:34 1992 John Gilmore (gnu at cygnus.com) + + * tc-m68k.c (try_index): Error if index scaling specified and + assembling for an older CPU than a 68020. + Sat Aug 1 19:10:13 1992 Ken Raeburn (raeburn@cygnus.com) * config/tc-sparc.c (tc_aout_fix_to_chars): If pc-relative, take @@ -269,6 +548,10 @@ Mon Jul 13 14:11:36 1992 Steve Chamberlain (sac@thepub.cygnus.com) (relax_segment): SEG_BSS is ok now * config/tc-m68k.c (m68k_ip_op): can now parse more @( modes +Mon Jul 6 17:09:32 1992 Steve Chamberlain (sac@cygnus.com) + + * obj-coffbfd.c (fill_section): mark .lit sections as STYP_LIT + Mon Jun 1 16:20:22 1992 Michael Tiemann (tiemann@cygnus.com) * configure.in: recognize m680x0 as having sun3 emulation mode for @@ -296,6 +579,11 @@ Tue Jun 9 07:54:54 1992 Steve Chamberlain (sac@thepub.cygnus.com) * write.c (write_object_file): various changes to handle data in the BSS segment in much the same was as stuff in the DATA segment. + * tc-m68k.c (m68kip): Fix typo so that only arch's >=68020 do + pcrel data stuff. (md_estimate_size_before_relax): when relaxing a + 68010 bxx into a bra+6 jmpxx, put the bytes of the jmp opcode into + the right place. (s_bss): Don't put .bss stuff into SEG_DATA, put + it into SEG_BSS Thu Jun 4 11:59:13 1992 Steve Chamberlain (sac@thepub.cygnus.com) @@ -350,11 +638,20 @@ Thu May 28 11:22:02 1992 Jim Wilson (wilson@sphagnum.cygnus.com) * configure.in: Recognize sparclite as a sparc variant. + * tc-sparc.c: Use new ARCHITECTURES_CONFLICT_P macro. Mention new + -Asparclite flag. + Tue May 26 16:47:56 1992 Steve Chamberlain (sac@thepub.cygnus.com) * config/tc-a29k.c: lint * listing.c, expr.c: patches from Andrew Smith +Mon May 4 18:56:19 1992 Steve Chamberlain (sac@thepub.cygnus.com) + + * obj-coffbfd.c: use is a synonym for section, (do_relocs_for): + calc the base of relocs correctly. + * tc-a29k.c (parse_operand): allow expressions to be in any section. + Mon Apr 27 13:13:31 1992 K. Richard Pixley (rich@cygnus.com) * as.c, write.c: use -K rather than -k for the broken word warning @@ -403,6 +700,11 @@ Fri Mar 13 08:03:03 1992 Steve Chamberlain (sac@thepub.cygnus.com) * flonum-const.c: renamed flonum-konst.c to stop dos name conflict. +Thu Mar 12 04:42:38 1992 K. Richard Pixley (rich@cygnus.com) + + * tc-m68k.h, te-sun3.h: moved LOCAL_LABELS_FB definition from + tc-m68k.h to te-sun3.h. + Wed Mar 11 23:32:42 1992 K. Richard Pixley (rich@cygnus.com) * configure.in: vxworks68 gets te-sun3.h. @@ -413,6 +715,8 @@ Wed Mar 11 23:32:42 1992 K. Richard Pixley (rich@cygnus.com) * symbols.c: remove local_labels_dollar, replace with a function interface for a sparse array. All users adjusted. + * te-sun3.h: add LOCAL_LABELS_DOLLAR. + Fri Mar 6 21:57:18 1992 K. Richard Pixley (rich@cygnus.com) * Makefile.in: added check target. @@ -488,6 +792,12 @@ Fri Feb 21 06:21:07 1992 K. Richard Pixley (rich@rtl.cygnus.com) * read.c, write.c subsegs.c: back out the .bss changes. + * obj-aout.c: do not include stab.gnu.h if NO_LISTING. + + * tc-i860.c, a.out.gnu.h: move i860 relocs to a proper place. + + * a.out.h: removed. + Fri Feb 21 01:08:48 1992 Minh Tran-Le (TRANLE@INTELLICORP.COM) * symbols.c (local_label_name): symbols now start with ^A. @@ -503,6 +813,33 @@ Fri Feb 21 01:08:48 1992 Minh Tran-Le (TRANLE@INTELLICORP.COM) * as.c (perform_an_assembly_pass): zero bss_fix_root, too. + * tc-i386.c: tc-i386.c: added handling of the following opcodes: + i/o opcodes - inb, inw, outb and outw. string manipulation with + att syntax - scmp, slod, smov, ssca, ssto. + + * obj-coff.c: (for aix386) Moved the symbols .text, .data and .bss + to just after .file . + + In obj_crawl_symbol_chain() where it tries to put the external + symbols apart, with the condition: + (!S_IS_DEFINED(symbolP) && + !S_IS_DEBUG(symbolP) && + !SF_GET_STATICS(symbolP)) + it was moving too many symbols out. So I switch it back to the + condition: + (S_GET_STORAGE_CLASS(symbolP) == C_EXT && !SF_GET_FUNCTION(symbolP)) + + In obj_emit_relocations() added the conditional on KEEP_RELOC_INFO + so that we don't use the F_RELFLG which make the linker complain + that somebody has stripped the relocation info. + + Also, the AIX ld program require that the relocation table + is sorted by r_vaddr like the standard ATT assembler does. + + [he also changed the sizeof(struct ...)'s into the coff + style FOOSZ macros. I'm not sure this is right, but I can't + remember why. xoxorich.] + Fri Feb 21 01:08:48 1992 K. Richard Pixley (rich@cygnus.com) * Makefile.in, configure.in, doc: use the doc. Build it, install @@ -516,6 +853,21 @@ Tue Feb 18 02:21:25 1992 K. Richard Pixley (rich at cygnus.com) * write.c: comment change only. + * tc-m88k.[hc]: pulled in from hack's unfinished work. These + aren't yet integrated. + + * tc-i860.[hc]: blew off the dust. Something must still be done + about conflicting relocation types. + + * tc-ns32k.c: Replaced previous tc_aout_fix_to_chars stub with the + real thing. + + * tc-i960.c, tc-sparc.c: white space and comments only. + + * tc-a29k.h: delete duplicate macro definition. + + * new file atof-ns32k.c copied from hack's last unreleased gas. + Mon Feb 17 07:51:06 1992 K. Richard Pixley (rich at cygnus.com) * config/tc-ns32k.c: actually make tc_aout_fix_to_chars work diff --git a/gas/Makefile.in b/gas/Makefile.in index 04042b3211e..9c9c63cac6e 100644 --- a/gas/Makefile.in +++ b/gas/Makefile.in @@ -98,18 +98,14 @@ REAL_SOURCES = \ $(srcdir)/input-file.c \ $(srcdir)/input-scrub.c \ $(srcdir)/messages.c \ - $(srcdir)/obstack.c \ $(srcdir)/output-file.c \ $(srcdir)/read.c \ - $(srcdir)/strerror.c \ - $(srcdir)/strstr.c \ $(srcdir)/subsegs.c \ $(srcdir)/symbols.c \ $(srcdir)/version.c \ $(srcdir)/write.c \ $(srcdir)/listing.c \ - $(srcdir)/xmalloc.c \ - $(srcdir)/xrealloc.c + $(srcdir)/xmalloc.c # in an expedient order LINKED_SOURCES = \ @@ -130,7 +126,6 @@ REAL_HEADERS = \ $(srcdir)/listing.h \ $(srcdir)/tc.h \ $(srcdir)/obj.h \ - $(srcdir)/obstack.h \ $(srcdir)/read.h \ $(srcdir)/struc-symbol.h \ $(srcdir)/subsegs.h \ @@ -167,18 +162,14 @@ OBJS = \ input-file.o \ input-scrub.o \ messages.o \ - obstack.o \ output-file.o \ read.o \ - strerror.o \ - strstr.o \ subsegs.o \ symbols.o \ version.o \ write.o \ listing.o \ - xmalloc.o \ - xrealloc.o + xmalloc.o #### host, target, and site specific Makefile frags come in here. @@ -222,7 +213,7 @@ SUBDIR_INCLUDES = -I.. -I$(srcdir) -I$(srcdir)/config # Files to be copied away after each stage in building. STAGESTUFF = *.o as.new -as.new: $(OBJS) $(LIBDEPS) $(LOCAL_LOADLIBES) +as.new: $(OBJS) $(LIBS) [ ! -f as.new ] || mv as.new as.old $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o as.new $(OBJS) $(LIBS) $(LOADLIBES) @@ -239,7 +230,8 @@ app.o : app.c as.h host.h targ-env.h obj-format.h \ write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h as.o : as.c as.h host.h targ-env.h obj-format.h \ targ-cpu.h struc-symbol.h \ - write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h + write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h subsegs.h \ + tc.h obj.h atof-generic.o : atof-generic.c as.h host.h targ-env.h obj-format.h \ targ-cpu.h struc-symbol.h \ write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h @@ -287,7 +279,6 @@ listing.o : listing.c as.h host.h targ-env.h flonum.h bignum.h \ messages.o : messages.c as.h host.h targ-env.h obj-format.h \ targ-cpu.h struc-symbol.h \ write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h -obstack.o : obstack.c output-file.o : output-file.c as.h host.h targ-env.h obj-format.h \ targ-cpu.h struc-symbol.h \ write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ @@ -295,9 +286,6 @@ output-file.o : output-file.c as.h host.h targ-env.h obj-format.h \ read.o : read.c as.h host.h targ-env.h obj-format.h \ targ-cpu.h struc-symbol.h \ write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h - -strerror.o : strerror.c -strstr.o : strstr.c subsegs.o : subsegs.c as.h host.h targ-env.h obj-format.h \ targ-cpu.h struc-symbol.h \ write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ @@ -312,7 +300,6 @@ write.o : write.c as.h host.h targ-env.h obj-format.h \ write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ subsegs.h output-file.h xmalloc.o : xmalloc.c -xrealloc.o : xrealloc.c atof-targ.o : atof-targ.c as.h host.h targ-env.h obj-format.h \ targ-cpu.h struc-symbol.h \ write.h flonum.h bignum.h expr.h frags.h hash.h read.h \ @@ -320,7 +307,7 @@ atof-targ.o : atof-targ.c as.h host.h targ-env.h obj-format.h \ obj-format.o : obj-format.c as.h host.h targ-env.h obj-format.h \ targ-cpu.h struc-symbol.h \ write.h flonum.h bignum.h expr.h frags.h hash.h read.h \ - symbols.h tc.h obj.h + subsegs.h symbols.h tc.h obj.h targ-cpu.o : targ-cpu.c targ-env.h obj-format.h \ targ-cpu.h struc-symbol.h \ write.h flonum.h bignum.h expr.h frags.h hash.h read.h \ diff --git a/gas/as.h b/gas/as.h index bfcdfabf34c..fe2fa7a8816 100644 --- a/gas/as.h +++ b/gas/as.h @@ -29,11 +29,6 @@ #endif /* const */ #endif /* __STDC__ */ -#ifdef __GNUC__ -#define alloca __builtin_alloca -#define register -#endif /* __GNUC__ */ - #ifndef __LINE__ #define __LINE__ "unknown" #endif /* __LINE__ */ @@ -92,7 +87,10 @@ #define DEBUG /* temporary */ #ifdef BROKEN_ASSERT -/* turn off all assertion checks */ +/* Turn off all assertion checks, on machines where the assert macro + is buggy. (For example, on the RS/6000, Reiser-cpp substitution is + done to put the condition into a string, so if the condition contains + a string, parse errors result.) */ #undef DEBUG #define NDEBUG #endif @@ -182,14 +180,12 @@ typedef enum _segT typedef int subsegT; -COMMON subsegT now_subseg; /* What subseg we are accreting now? */ +COMMON subsegT now_subseg; - -COMMON segT now_seg; /* Segment our instructions emit to. */ /* Only OK values are SEG_TEXT or SEG_DATA. */ - +COMMON segT now_seg; extern char *const seg_name[]; extern int section_alignment[]; @@ -199,20 +195,23 @@ extern int section_alignment[]; typedef enum _relax_state { - rs_fill = 1, /* Variable chars to be repeated fr_offset times. - Fr_symbol unused. Used with fr_offset == 0 for a - constant length frag. */ + /* Variable chars to be repeated fr_offset times. + Fr_symbol unused. Used with fr_offset == 0 for a + constant length frag. */ + rs_fill = 1, - rs_align, /* Align: Fr_offset: power of 2. 1 variable char: fill - character. */ + /* Align: Fr_offset: power of 2. 1 variable char: fill character. */ + rs_align, - rs_org, /* Org: Fr_offset, fr_symbol: address. 1 variable char: fill - character. */ + /* Org: Fr_offset, fr_symbol: address. 1 variable char: fill + character. */ + rs_org, rs_machine_dependent, #ifndef WORKING_DOT_WORD - rs_broken_word, /* JF: gunpoint */ + /* JF: gunpoint */ + rs_broken_word, #endif } relax_stateT; @@ -221,8 +220,9 @@ typedef enum _relax_state boundry. Be very careful with this. */ typedef unsigned long relax_substateT; -typedef unsigned long relax_addressT; /* Enough bits for address. */ -/* Still an integer type. */ +/* Enough bits for address, but still an integer type. + Could be a problem, cross-assembling for 64-bit machines. */ +typedef unsigned long relax_addressT; /* frags.c */ @@ -244,27 +244,37 @@ typedef unsigned long relax_addressT; /* Enough bits for address. */ */ struct frag /* a code fragment */ { - unsigned long fr_address; /* Object file address. */ - struct frag *fr_next; /* Chain forward; ascending address order. */ + /* Object file address. */ + unsigned long fr_address; + /* Chain forward; ascending address order. */ /* Rooted in frch_root. */ + struct frag *fr_next; - long fr_fix; /* (Fixed) number of chars we know we have. */ + /* (Fixed) number of chars we know we have. */ /* May be 0. */ - long fr_var; /* (Variable) number of chars after above. */ + long fr_fix; + /* (Variable) number of chars after above. */ /* May be 0. */ - struct symbol *fr_symbol; /* For variable-length tail. */ - long fr_offset; /* For variable-length tail. */ - char *fr_opcode; /*->opcode low addr byte,for relax()ation*/ - relax_stateT fr_type; /* What state is my tail in? */ + long fr_var; + /* For variable-length tail. */ + struct symbol *fr_symbol; + /* For variable-length tail. */ + long fr_offset; + /*->opcode low addr byte,for relax()ation*/ + char *fr_opcode; + /* What state is my tail in? */ + relax_stateT fr_type; relax_substateT fr_subtype; + /* These are needed only on the NS32K machines */ char fr_pcrel_adjust; char fr_bsr; #ifndef NO_LISTING struct list_info_struct *line; #endif - char fr_literal[1]; /* Chars begin here. */ - /* One day we will compile fr_literal[0]. */ + /* Chars begin here. + One day we will compile fr_literal[0]. */ + char fr_literal[1]; }; #define SIZEOF_STRUCT_FRAG \ @@ -273,43 +283,54 @@ struct frag /* a code fragment */ typedef struct frag fragS; -COMMON fragS *frag_now; /* -> current frag we are building. */ -/* This frag is incomplete. */ -/* It is, however, included in frchain_now. */ -/* Frag_now->fr_fix is bogus. Use: */ -/* Virtual frag_now->fr_fix==obstack_next_free(&frags)-frag_now->fr_literal.*/ +/* Current frag we are building. This frag is incomplete. It is, however, + included in frchain_now. The fr_fix field is bogus; instead, use: + obstack_next_free(&frags)-frag_now->fr_literal. */ +COMMON fragS *frag_now; -COMMON fragS zero_address_frag; /* For foreign-segment symbol fixups. */ -COMMON fragS bss_address_frag; /* For local common (N_BSS segment) fixups. */ +/* For foreign-segment symbol fixups. */ +COMMON fragS zero_address_frag; +/* For local common (N_BSS segment) fixups. */ +COMMON fragS bss_address_frag; /* main program "as.c" (command arguments etc) */ -COMMON char flagseen[128]; /* ['x'] TRUE if "-x" seen. */ +/* ['x'] TRUE if "-x" seen. */ +COMMON char flagseen[128]; +COMMON unsigned char flag_readonly_data_in_text; +COMMON unsigned char flag_suppress_warnings; +COMMON unsigned char flag_always_generate_output; -COMMON char *out_file_name; /* name of emitted object file */ +/* name of emitted object file */ +COMMON char *out_file_name; -COMMON int need_pass_2; /* TRUE if we need a second pass. */ +/* TRUE if we need a second pass. */ +COMMON int need_pass_2; -COMMON int linkrelax; /* TRUE if we should do no relaxing, and - leave lots of padding. */ +/* TRUE if we should do no relaxing, and + leave lots of padding. */ +COMMON int linkrelax; -typedef struct +struct _pseudo_type { - char *poc_name; /* assembler mnemonic, lower case, no '.' */ - void (*poc_handler) (); /* Do the work */ - int poc_val; /* Value to pass to handler */ - } + /* assembler mnemonic, lower case, no '.' */ + char *poc_name; + /* Do the work */ + void (*poc_handler) (); + /* Value to pass to handler */ + int poc_val; + }; -pseudo_typeS; +typedef struct _pseudo_type pseudo_typeS; -#ifdef __STDC__ +#ifndef NO_STDARG -int had_errors (void); -int had_warnings (void); -void as_bad (const char *Format,...); -void as_fatal (const char *Format,...); -void as_tsktsk (const char *Format,...); -void as_warn (const char *Format,...); +int had_errors PARAMS ((void)); +int had_warnings PARAMS ((void)); +void as_bad PARAMS ((const char *Format,...)); +void as_fatal PARAMS ((const char *Format,...)); +void as_tsktsk PARAMS ((const char *Format,...)); +void as_warn PARAMS ((const char *Format,...)); #else @@ -322,88 +343,47 @@ void as_warn (); #endif /* __STDC__ & !NO_STDARG */ -#ifdef __STDC__ - -char *app_push (void); -char *atof_ieee (char *str, int what_kind, LITTLENUM_TYPE * words); -char *input_scrub_include_file (char *filename, char *position); -char *input_scrub_new_file (char *filename); -char *input_scrub_next_buffer (char **bufp); -char *strstr (const char *s, const char *wanted); -char *xmalloc (int size); -char *xrealloc (char *ptr, long n); -int do_scrub_next_char (int (*get) (), void (*unget) ()); -int gen_to_words (LITTLENUM_TYPE * words, int precision, long exponent_bits); -int had_err (void); -int had_errors (void); -int had_warnings (void); -int ignore_input (void); -int scrub_from_file (void); -int scrub_from_file (void); -int scrub_from_string (void); -int seen_at_least_1_file (void); -void app_pop (char *arg); -void as_howmuch (FILE * stream); -void as_perror (char *gripe, char *filename); -void as_where (void); -void bump_line_counters (void); -void do_scrub_begin (void); -void input_scrub_begin (void); -void input_scrub_close (void); -void input_scrub_end (void); -void int_to_gen (long x); -void new_logical_line (char *fname, int line_number); -void scrub_to_file (int ch); -void scrub_to_string (int ch); -void subseg_change (segT seg, int subseg); -void subseg_new (segT seg, subsegT subseg); -void subsegs_begin (void); - -#else /* not __STDC__ */ - -char *app_push (); -char *atof_ieee (); -char *input_scrub_include_file (); -char *input_scrub_new_file (); -char *input_scrub_next_buffer (); -char *strstr (); -char *xmalloc (); -char *xrealloc (); -int do_scrub_next_char (); -int gen_to_words (); -int had_err (); -int had_errors (); -int had_warnings (); -int ignore_input (); -int scrub_from_file (); -int scrub_from_file (); -int scrub_from_string (); -int seen_at_least_1_file (); -void app_pop (); -void as_howmuch (); -void as_perror (); -void as_where (); -void bump_line_counters (); -void do_scrub_begin (); -void input_scrub_begin (); -void input_scrub_close (); -void input_scrub_end (); -void int_to_gen (); -void new_logical_line (); -void scrub_to_file (); -void scrub_to_string (); -void subseg_change (); -void subseg_new (); -void subsegs_begin (); - -#endif /* not __STDC__ */ +char *app_push PARAMS ((void)); +char *atof_ieee PARAMS ((char *str, int what_kind, LITTLENUM_TYPE * words)); +char *input_scrub_include_file PARAMS ((char *filename, char *position)); +char *input_scrub_new_file PARAMS ((char *filename)); +char *input_scrub_next_buffer PARAMS ((char **bufp)); +char *strstr PARAMS ((const char *s, const char *wanted)); +char *xmalloc PARAMS ((long size)); +char *xrealloc PARAMS ((char *ptr, long n)); +int do_scrub_next_char PARAMS ((int (*get) (), void (*unget) ())); +int gen_to_words PARAMS ((LITTLENUM_TYPE * words, int precision, + long exponent_bits)); +int had_err PARAMS ((void)); +int had_errors PARAMS ((void)); +int had_warnings PARAMS ((void)); +int ignore_input PARAMS ((void)); +int scrub_from_file PARAMS ((void)); +int scrub_from_file PARAMS ((void)); +int scrub_from_string PARAMS ((void)); +int seen_at_least_1_file PARAMS ((void)); +void app_pop PARAMS ((char *arg)); +void as_howmuch PARAMS ((FILE * stream)); +void as_perror PARAMS ((char *gripe, char *filename)); +void as_where PARAMS ((void)); +void bump_line_counters PARAMS ((void)); +void do_scrub_begin PARAMS ((void)); +void input_scrub_begin PARAMS ((void)); +void input_scrub_close PARAMS ((void)); +void input_scrub_end PARAMS ((void)); +void int_to_gen PARAMS ((long x)); +void new_logical_line PARAMS ((char *fname, int line_number)); +void scrub_to_file PARAMS ((int ch)); +void scrub_to_string PARAMS ((int ch)); +void subseg_change PARAMS ((segT seg, int subseg)); +void subseg_new PARAMS ((segT seg, subsegT subseg)); +void subsegs_begin PARAMS ((void)); /* this one starts the chain of target dependant headers */ #include "targ-env.h" /* these define types needed by the interfaces */ #include "struc-symbol.h" -/*#include "aout/reloc.h"*/ #include "write.h" #include "expr.h" @@ -417,11 +397,4 @@ void subsegs_begin (); #include "listing.h" -/* - * Local Variables: - * comment-column: 0 - * fill-column: 131 - * End: - */ - /* end of as.h */ diff --git a/gas/write.c b/gas/write.c index 4a754f41ca2..4ee88c22ffa 100644 --- a/gas/write.c +++ b/gas/write.c @@ -175,11 +175,11 @@ write_object_file () { #ifdef VMS /* - * Under VAX/VMS, the linker (and PSECT specifications) - * take care of correctly aligning the segments. - * Doing the alignment here (on initialized data) can - * mess up the calculation of global data PSECT sizes. - */ + * Under VAX/VMS, the linker (and PSECT specifications) + * take care of correctly aligning the segments. + * Doing the alignment here (on initialized data) can + * mess up the calculation of global data PSECT sizes. + */ #undef SUB_SEGMENT_ALIGN #define SUB_SEGMENT_ALIGN ((frchainP->frch_seg != SEG_DATA) ? 2 : 0) #endif /* VMS */ @@ -188,9 +188,9 @@ write_object_file () /* frag_align will have left a new frag. */ /* Use this last frag for an empty ".fill". */ /* - * For this segment ... - * Create a last frag. Do not leave a "being filled in frag". - */ + * For this segment ... + * Create a last frag. Do not leave a "being filled in frag". + */ frag_wane (frag_now); frag_now->fr_fix = 0; know (frag_now->fr_next == NULL); @@ -199,21 +199,21 @@ write_object_file () } /* walk the frag chain */ /* - * From now on, we don't care about sub-segments. - * Build one frag chain for each segment. Linked thru fr_next. - * We know that there is at least 1 text frchain & at least 1 data - * frchain. - */ + * From now on, we don't care about sub-segments. + * Build one frag chain for each segment. Linked thru fr_next. + * We know that there is at least 1 text frchain & at least 1 data + * frchain. + */ remove_subsegs (frchain_root, SEG_TEXT, &text_frag_root, &text_last_frag); remove_subsegs (data0_frchainP, SEG_DATA, &data_frag_root, &data_last_frag); remove_subsegs (bss0_frchainP, SEG_BSS, &bss_frag_root, &bss_last_frag); /* - * We have two segments. If user gave -R flag, then we must put the - * data frags into the text segment. Do this before relaxing so - * we know to take advantage of -R and make shorter addresses. - */ + * We have two segments. If user gave -R flag, then we must put the + * data frags into the text segment. Do this before relaxing so + * we know to take advantage of -R and make shorter addresses. + */ #ifndef OBJ_AOUT if (flagseen['R']) { @@ -238,20 +238,20 @@ write_object_file () relax_segment (data_frag_root, SEG_DATA); relax_segment (bss_frag_root, SEG_BSS); /* - * Now the addresses of frags are correct within the segment. - */ + * Now the addresses of frags are correct within the segment. + */ know (text_last_frag->fr_type == rs_fill && text_last_frag->fr_offset == 0); H_SET_TEXT_SIZE (&headers, text_last_frag->fr_address); text_last_frag->fr_address = H_GET_TEXT_SIZE (&headers); /* - * Join the 2 segments into 1 huge segment. - * To do this, re-compute every rn_address in the SEG_DATA frags. - * Then join the data frags after the text frags. - * - * Determine a_data [length of data segment]. - */ + * Join the 2 segments into 1 huge segment. + * To do this, re-compute every rn_address in the SEG_DATA frags. + * Then join the data frags after the text frags. + * + * Determine a_data [length of data segment]. + */ if (data_frag_root) { register relax_addressT slide; @@ -264,10 +264,10 @@ write_object_file () #ifdef OBJ_BOUT #define RoundUp(N,S) (((N)+(S)-1)&-(S)) /* For b.out: If the data section has a strict alignment - requirement, its load address in the .o file will be - rounded up from the size of the text section. These - two values are *not* the same! Similarly for the bss - section.... */ + requirement, its load address in the .o file will be + rounded up from the size of the text section. These + two values are *not* the same! Similarly for the bss + section.... */ slide = RoundUp (slide, 1 << section_alignment[SEG_DATA]); #endif @@ -320,26 +320,26 @@ write_object_file () H_SET_BSS_SIZE (&headers, local_bss_counter); /* - * - * Crawl the symbol chain. - * - * For each symbol whose value depends on a frag, take the address of - * that frag and subsume it into the value of the symbol. - * After this, there is just one way to lookup a symbol value. - * Values are left in their final state for object file emission. - * We adjust the values of 'L' local symbols, even if we do - * not intend to emit them to the object file, because their values - * are needed for fix-ups. - * - * Unless we saw a -L flag, remove all symbols that begin with 'L' - * from the symbol chain. (They are still pointed to by the fixes.) - * - * Count the remaining symbols. - * Assign a symbol number to each symbol. - * Count the number of string-table chars we will emit. - * Put this info into the headers as appropriate. - * - */ + * + * Crawl the symbol chain. + * + * For each symbol whose value depends on a frag, take the address of + * that frag and subsume it into the value of the symbol. + * After this, there is just one way to lookup a symbol value. + * Values are left in their final state for object file emission. + * We adjust the values of 'L' local symbols, even if we do + * not intend to emit them to the object file, because their values + * are needed for fix-ups. + * + * Unless we saw a -L flag, remove all symbols that begin with 'L' + * from the symbol chain. (They are still pointed to by the fixes.) + * + * Count the remaining symbols. + * Assign a symbol number to each symbol. + * Count the number of string-table chars we will emit. + * Put this info into the headers as appropriate. + * + */ know (zero_address_frag.fr_address == 0); string_byte_count = sizeof (string_byte_count); @@ -353,11 +353,11 @@ write_object_file () H_SET_STRING_SIZE (&headers, string_byte_count); /* - * Addresses of frags now reflect addresses we use in the object file. - * Symbol values are correct. - * Scan the frags, converting any ".org"s and ".align"s to ".fill"s. - * Also converting any machine-dependent frags using md_convert_frag(); - */ + * Addresses of frags now reflect addresses we use in the object file. + * Symbol values are correct. + * Scan the frags, converting any ".org"s and ".align"s to ".fill"s. + * Also converting any machine-dependent frags using md_convert_frag(); + */ subseg_change (SEG_TEXT, 0); for (fragP = text_frag_root; fragP; fragP = fragP->fr_next) @@ -387,10 +387,10 @@ write_object_file () know ((fragP->fr_next == NULL) || ((fragP->fr_next->fr_address - fragP->fr_address) == fragP->fr_fix)); /* - * After md_convert_frag, we make the frag into a ".space 0". - * Md_convert_frag() should set up any fixSs and constants - * required. - */ + * After md_convert_frag, we make the frag into a ".space 0". + * Md_convert_frag() should set up any fixSs and constants + * required. + */ frag_wane (fragP); break; @@ -691,10 +691,8 @@ relax_segment (segment_frag_root, segment) /* In case md_estimate_size_before_relax() wants to make fixSs. */ subseg_change (segment, 0); - /* - * For each frag in segment: count and store (a 1st guess of) - * fr_address. - */ + /* For each frag in segment: count and store (a 1st guess of) + fr_address. */ address = 0; for (fragP = segment_frag_root; fragP; fragP = fragP->fr_next) { @@ -712,10 +710,7 @@ relax_segment (segment_frag_root, segment) break; case rs_org: - /* - * Assume .org is nugatory. It will grow with 1st - * relax. - */ + /* Assume .org is nugatory. It will grow with 1st relax. */ break; case rs_machine_dependent: @@ -734,39 +729,34 @@ relax_segment (segment_frag_root, segment) } /* switch(fr_type) */ } /* for each frag in the segment */ - /* - * Do relax(). - */ + /* Do relax(). */ { - register long stretch; /* May be any size, 0 or negative. */ + long stretch; /* May be any size, 0 or negative. */ /* Cumulative number of addresses we have */ /* relaxed this pass. */ /* We may have relaxed more than one address. */ - register long stretched; /* Have we stretched on this pass? */ - /* This is 'cuz stretch may be zero, when, - in fact some piece of code grew, and - another shrank. If a branch instruction - doesn't fit anymore, we could be scrod */ + long stretched; /* Have we stretched on this pass? */ + /* This is 'cuz stretch may be zero, when, in fact some piece of code + grew, and another shrank. If a branch instruction doesn't fit anymore, + we could be scrod. */ do { stretch = stretched = 0; for (fragP = segment_frag_root; fragP; fragP = fragP->fr_next) { - register long growth = 0; - register unsigned long was_address; - /* register long var; */ - register long offset; - register symbolS *symbolP; - register long target; - register long after; - register long aim; + long growth = 0; + unsigned long was_address; + long offset; + symbolS *symbolP; + long target; + long after; + long aim; was_address = fragP->fr_address; address = fragP->fr_address += stretch; symbolP = fragP->fr_symbol; offset = fragP->fr_offset; - /* var = fragP->fr_var; */ switch (fragP->fr_type) { @@ -776,9 +766,9 @@ relax_segment (segment_frag_root, segment) #ifndef WORKING_DOT_WORD /* JF: This is RMS's idea. I do *NOT* want to be blamed - for it I do not want to write it. I do not want to have - anything to do with it. This is not the proper way to - implement this misfeature. */ + for it I do not want to write it. I do not want to have + anything to do with it. This is not the proper way to + implement this misfeature. */ case rs_broken_word: { struct broken_word *lie; @@ -787,9 +777,9 @@ relax_segment (segment_frag_root, segment) extern int md_long_jump_size; /* Yes this is ugly (storing the broken_word pointer - in the symbol slot). Still, this whole chunk of - code is ugly, and I don't feel like doing anything - about it. Think of it as stubbornness in action */ + in the symbol slot). Still, this whole chunk of + code is ugly, and I don't feel like doing anything + about it. Think of it as stubbornness in action. */ growth = 0; for (lie = (struct broken_word *) (fragP->fr_symbol); lie && lie->dispfrag == fragP; @@ -799,8 +789,11 @@ relax_segment (segment_frag_root, segment) if (lie->added) continue; - offset = lie->add->sy_frag->fr_address + S_GET_VALUE (lie->add) + lie->addnum - - (lie->sub->sy_frag->fr_address + S_GET_VALUE (lie->sub)); + offset = (lie->add->sy_frag->fr_address + + S_GET_VALUE (lie->add) + + lie->addnum + - (lie->sub->sy_frag->fr_address + + S_GET_VALUE (lie->sub))); if (offset <= -32768 || offset >= 32767) { if (flagseen['K']) @@ -814,7 +807,9 @@ relax_segment (segment_frag_root, segment) fragP->fr_subtype++; growth += md_short_jump_size; } - for (untruth = lie->next_broken_word; untruth && untruth->dispfrag == lie->dispfrag; untruth = untruth->next_broken_word) + for (untruth = lie->next_broken_word; + untruth && untruth->dispfrag == lie->dispfrag; + untruth = untruth->next_broken_word) if ((untruth->add->sy_frag == lie->add->sy_frag) && S_GET_VALUE (untruth->add) == S_GET_VALUE (lie->add)) { @@ -829,8 +824,8 @@ relax_segment (segment_frag_root, segment) } /* case rs_broken_word */ #endif case rs_align: - growth = relax_align ((relax_addressT) (address + fragP->fr_fix), offset) - - relax_align ((relax_addressT) (was_address + fragP->fr_fix), offset); + growth = (relax_align ((relax_addressT) (address + fragP->fr_fix), offset) + - relax_align ((relax_addressT) (was_address + fragP->fr_fix), offset)); break; case rs_org: @@ -851,21 +846,21 @@ relax_segment (segment_frag_root, segment) know (fragP->fr_next); after = fragP->fr_next->fr_address; growth = ((target - after) > 0) ? (target - after) : 0; - /* Growth may be -ve, but variable part */ - /* of frag cannot have < 0 chars. */ - /* That is, we can't .org backwards. */ + /* Growth may be -ve, but variable part of frag cannot have + fewer than 0 chars. That is, we can't .org backwards. */ growth -= stretch; /* This is an absolute growth factor */ break; case rs_machine_dependent: { - register const relax_typeS *this_type; - register const relax_typeS *start_type; - register relax_substateT next_state; - register relax_substateT this_state; + const relax_typeS *this_type; + const relax_typeS *start_type; + relax_substateT next_state; + relax_substateT this_state; - start_type = this_type = md_relax_table + (this_state = fragP->fr_subtype); + this_state = fragP->fr_subtype; + start_type = this_type = md_relax_table + this_state; target = offset; if (symbolP) @@ -880,47 +875,45 @@ relax_segment (segment_frag_root, segment) + symbolP->sy_frag->fr_address; /* If frag has yet to be reached on this pass, - assume it will move by STRETCH just as we did. - If this is not so, it will be because some frag - between grows, and that will force another pass. */ + assume it will move by STRETCH just as we did. + If this is not so, it will be because some frag + between grows, and that will force another pass. */ /* JF was just address */ /* JF also added is_dnrange hack */ /* There's gotta be a better/faster/etc way - to do this. . . */ + to do this. . . */ /* gnu@cygnus.com: I changed this from > to >= - because I ran into a zero-length frag (fr_fix=0) - which was created when the obstack needed a new - chunk JUST AFTER the opcode of a branch. Since - fr_fix is zero, fr_address of this frag is the same - as fr_address of the next frag. This - zero-length frag was variable and jumped to .+2 - (in the next frag), but since the > comparison - below failed (the two were =, not >), "stretch" - was not added to the target. Stretch was 178, so - the offset appeared to be .-176 instead, which did - not fit into a byte branch, so the assembler - relaxed the branch to a word. This didn't compare - with what happened when the same source file was - assembled on other machines, which is how I found it. - You might want to think about what other places have - trouble with zero length frags... */ + because I ran into a zero-length frag (fr_fix=0) + which was created when the obstack needed a new + chunk JUST AFTER the opcode of a branch. Since + fr_fix is zero, fr_address of this frag is the same + as fr_address of the next frag. This + zero-length frag was variable and jumped to .+2 + (in the next frag), but since the > comparison + below failed (the two were =, not >), "stretch" + was not added to the target. Stretch was 178, so + the offset appeared to be .-176 instead, which did + not fit into a byte branch, so the assembler + relaxed the branch to a word. This didn't compare + with what happened when the same source file was + assembled on other machines, which is how I found it. + You might want to think about what other places have + trouble with zero length frags... */ if (symbolP->sy_frag->fr_address >= was_address && is_dnrange (fragP, symbolP->sy_frag)) { target += stretch; - } /* */ - + } } /* if there's a symbol attached */ aim = target - address - fragP->fr_fix; /* The displacement is affected by the instruction size - * for the 32k architecture. I think we ought to be able - * to add fragP->fr_pcrel_adjust in all cases (it should be - * zero if not used), but just in case it breaks something - * else we'll put this inside #ifdef NS32K ... #endif - */ + for the 32k architecture. I think we ought to be able + to add fragP->fr_pcrel_adjust in all cases (it should be + zero if not used), but just in case it breaks something + else we'll put this inside #ifdef NS32K ... #endif */ #ifdef TC_NS32K aim += fragP->fr_pcrel_adjust; #endif /* TC_NS32K */ @@ -929,52 +922,39 @@ relax_segment (segment_frag_root, segment) { /* Look backwards. */ for (next_state = this_type->rlx_more; next_state;) - { - if (aim >= this_type->rlx_backward) - { - next_state = 0; - } - else - { /* Grow to next state. */ - this_type = md_relax_table + (this_state = next_state); - next_state = this_type->rlx_more; - } - } + if (aim >= this_type->rlx_backward) + next_state = 0; + else + { + /* Grow to next state. */ + this_state = next_state; + this_type = md_relax_table + this_state; + next_state = this_type->rlx_more; + } } else { -#ifdef DONTDEF - /* JF these next few lines of code are for the mc68020 which can't handle short - offsets of zero in branch instructions. What a kludge! */ - if (aim == 0 && this_state == (1 << 2 + 0)) - { /* FOO hard encoded from m.c */ - aim = this_type->rlx_forward + 1; /* Force relaxation into word mode */ - } -#endif #ifdef M68K_AIM_KLUDGE M68K_AIM_KLUDGE (aim, this_state, this_type); #endif - /* JF end of 68020 code */ /* Look forwards. */ for (next_state = this_type->rlx_more; next_state;) - { - if (aim <= this_type->rlx_forward) - { - next_state = 0; - } - else - { /* Grow to next state. */ - this_type = md_relax_table + (this_state = next_state); - next_state = this_type->rlx_more; - } - } + if (aim <= this_type->rlx_forward) + next_state = 0; + else + { + /* Grow to next state. */ + this_state = next_state; + this_type = md_relax_table + this_state; + next_state = this_type->rlx_more; + } } - if ((growth = this_type->rlx_length - start_type->rlx_length) != 0) + growth = this_type->rlx_length - start_type->rlx_length; + if (growth != 0) fragP->fr_subtype = this_state; - - break; - } /* case rs_machine_dependent */ + } + break; default: BAD_CASE (fragP->fr_type); @@ -991,13 +971,13 @@ relax_segment (segment_frag_root, segment) } /* do_relax */ /* - * We now have valid fr_address'es for each frag. - */ + * We now have valid fr_address'es for each frag. + */ /* - * All fr_address's are correct, relative to their own segment. - * We have made all the fixS we will ever make. - */ + * All fr_address's are correct, relative to their own segment. + * We have made all the fixS we will ever make. + */ } /* relax_segment() */ /* diff --git a/gas/xmalloc.c b/gas/xmalloc.c index d5378d530d2..5a03d0dddc5 100644 --- a/gas/xmalloc.c +++ b/gas/xmalloc.c @@ -40,17 +40,8 @@ malloc() */ -#include - -#if __STDC__ == 1 -#include -#else -#ifdef USG -#include -#else -char *malloc (); -#endif /* USG */ -#endif /* not __STDC__ */ + +#include "as.h" #define error as_fatal @@ -59,13 +50,21 @@ xmalloc (n) long n; { char *retval; - void error (); - if ((retval = malloc ((unsigned) n)) == NULL) - { - error ("virtual memory exceeded"); - } + retval = malloc ((unsigned) n); + if (retval == NULL) + error ("virtual memory exceeded"); return (retval); } +char * +xrealloc (ptr, n) + register char *ptr; + long n; +{ + ptr = realloc (ptr, (unsigned) n); + if (ptr == 0) + error ("virtual memory exceeded"); + return (ptr); +} /* end of xmalloc.c */