aboutsummaryrefslogtreecommitdiff
path: root/gas/write.c
AgeCommit message (Collapse)AuthorFilesLines
1996-02-12Mon Feb 12 15:16:29 1996 Andreas Schwab ↵Ian Lance Taylor1-1/+48
<schwab@issan.informatik.uni-dortmund.de> Support for OBJ_ELF on m68k, mostly inside #ifdef OBJ_ELF: * config/m68k-parse.h (enum pic_relocation): Define. (struct m68k_exp): Add pic_reloc field. * config/tc-m68k.h (TC_RELOC_RTSYM_LOC_FIXUP): Define. (tc_fix_adjustable): Define to call tc_m68k_fix_adjustable. (NO_RELOC): Define to BFD_RELOC_NONE if BFD_ASSEMBLER, to zero otherwise. * config/tc-m68k.c: Delete definition of NO_RELOC. (struct m68k_it): Add pic_reloc field. (add_fix): Copy over pic_reloc field. (md_pseudo_table): Interpret .align parameter as byte count. (mote_pseudo_table): Likewise. (tc_m68k_fix_adjustable): New function. (get_reloc_code): New function. (md_assemble): Use it as last argument to fix_new_exp. (md_apply_fix_2): For a relocation against a symbol don't put the addend into the data. (tc_gen_reloc): Different addend computation for OBJ_ELF. (m68k_ip): Don't relax an operand that requires pic relocation. (md_begin): Align .text, .data and .bss on 4 byte boundary by default. * write.c (fixup_segment): Don't add symbol value to addend if TC_M68K and OBJ_ELF. * config/m68k-parse.y (yylex): Handle @PLTPC, etc. (motorola_operand): Add rule for `(zapc, EXPR)'.
1995-10-24Fix PR 8255Michael Meissner1-11/+44
1995-09-13 * write.c (relax_and_size_seg): Change to the segment we areIan Lance Taylor1-4/+11
relaxing, in case md_convert_frag, called by cvt_frag_to_fill, wants to call fix_new. * config/tc-m68k.c (m68k_ip): Permit PC relative code if the segment of the symbol is the current segment, not just in text_section. (md_convert_frag_1): Don't call subseg_change. (md_estimate_size_before_relax): Likewise.
1995-08-31Thu Aug 31 16:41:06 1995 steve chamberlain <sac@slash.cygnus.com>Steve Chamberlain1-58/+49
* write.c (fixup_segment): Remove change of 29th. * config/tc-{i386,arm}.h (TC_FORCE_RELOCATION): Keep RVA relocs.
1995-08-13 * frags.c (frag_align): Handle absolute_section.Ian Lance Taylor1-0/+2
* write.c (record_alignment): Likewise.
1995-08-11Allow large addends for BFD_RELOC_{LO16,HI16,HI16_S} relocs.Michael Meissner1-1/+1
1995-08-09 * write.c (adjust_reloc_syms): Check that symbol is not NULLIan Lance Taylor1-2/+3
before checking sy_mri_common. (fixup_segment): Likewise. * config/obj-coff.c (fixup_segment): Likewise.
1995-08-08 * struc-symbol.h (struct symbol): Add sy_mri_common bit.Ian Lance Taylor1-0/+23
* read.h (mri_comon_symbol): Declare. (s_mri_common): Declare. * read.c (mri_line_label): New static variable. (mri_common_symbol): New global variable. (potable): Add "common" and "common.s". (read_a_source_file): In MRI mode, set mri_line_label for a label at the start of a line. (s_mri_common): New function. (s_space): Handle mri_common_symbol. * symbols.c (colon): Change return value from void to symbolS *, and return new symbol. If mri_common_symbol is set, attach the new symbol to it. (resolve_symbol_value): Handle an sy_mri_common symbol. * symbols.h (colon): Change return value in declaration. * subsegs.c (subseg_set_rest): Clear mri_common_symbol. (subseg_set (both versions)): Likewise. * frags.c (frag_more): Warn if mri_common_symbol is not NULL. * write.c (adjust_reloc_syms): Skip sy_mri_common symbols. (write_object_file): Discard sy_mri_common symbols. (fixup_segment): Change relocations against sy_mri_common symbols to be against the common symbol itself. * config/obj-coff.c (yank_symbols): Discard sy_mri_common symbols. (fixup_segment): Change relocations against sy_mri_common symbols to be against the common symbol itself. * config/obj-aout.c (obj_crawl_symbol_chain): Discard sy_mri_common symbols.
1995-08-08* write.c (relax_align): Add extra padding for linkrelax only ifKen Raeburn1-3/+22
LINKER_RELAXING_SHRINKS_ONLY is defined. * config/tc-i960.h (LINKER_RELAXING_SHRINKS_ONLY): Define it. * doc/internals.texi (Relaxation): Write up some stuff on linker relaxing and LINKER_RELAXING_SHRINKS_ONLY.
1995-07-12fix more compilation bugsKen Raeburn1-2/+3
1995-07-07 Add SPARC ELF PIC support.Ian Lance Taylor1-2/+3
* write.c (fixup_segment): Pass fixP to TC_RELOC_RTSYM_LOC_FIXUP, not fixP->fx_r_type. * config/tc-sparc.c (sparc_pic_code): New global variable. (md_apply_fix): If generating PIC, adjust fx_addnumber for any non PC relative reloc. (tc_gen_reloc): If generating PIC, adjust various reloc types. Remove fx_pcrel assert, since it is no longer true. (md_parse_option): Handle -K PIC. * config/tc-sparc.h (sparc_pic_code): Declare if OBJ_ELF. (TC_RELOC_RTSYM_LOC_FIXUP): Define if OBJ_ELF. (tc_fix_adjustable): Don't adjust PC relative relocs if PIC. * config/tc-i386.h (TC_RELOC_RTSYM_LOC_FIXUP): Take a fixp, not a reloc type. PR 7131.
1995-07-06fsf address updateKen Raeburn1-2/+2
1995-06-21m68k fixes from Andreas Schwab, with minor changesKen Raeburn1-10/+42
1995-03-03If -mrelocatable, warn about relocs that are incompatible.Michael Meissner1-12/+16
1995-01-21tipoIan Lance Taylor1-3/+7
1995-01-19Cleanup of VAX and VMS code, from Pat Rankin:Ken Raeburn1-2/+2
* config/obj-vms.c: Changed exported function names to lower case. (Changed call sites in write.c.) Declare VMS system function names used, conditional on actually being on VMS. Changed many functions that returned no useful value to now be declared to return void. Removed many unused variables. Supply missing return statements or values. Supply `default' case in switch statements. Ensure local variables get initialized. * config/tc-vax.c: Minor changes to silence "gcc -Wall". * config/obj-vms.h, config/tc-vax.h: Added some missing declarations.
1995-01-19 * write.c (fix_new_internal): Clear fx_bsr on those targets whichIan Lance Taylor1-1/+1
use it.
1994-12-31Handle .space directive with non-constant operand:Ken Raeburn1-3/+26
* read.c (s_space): Rewrite to handle general expressions. Generate rs_space frags for non-constant values. * write.c (cvt_frag_to_fill): Treat rs_align_code and rs_space like rs_align and rs_org. Verify that fr_offset is non-negative, and force frag type to rs_fill only after assertion checks. (relax_segment): Treat rs_align_code like rs_align. Treat rs_space like rs_org in the first switch; in the second, force the operand to a constant, and use it for the growth size.
1994-12-10* write.c (write_relocs) [RELOC_EXPANSION_POSSIBLE]: Use bfd_install_relocation.Ken Raeburn1-22/+75
1994-09-29* write.c (print_fixup): Print source location on first line. Show fx_r_typeKen Raeburn1-2/+14
and fx_addsy fields.
1994-09-28(fix_new_exp): Handle O_add by creating an expression-valued symbol, andKen Raeburn1-20/+98
calling fix_new_exp recursively. (adjust_reloc_syms): If a fixup's symbol value is a sum of an undefined symbol and a constant, fold the constant into the fixup, and refer to the undefined symbol directly. Then process the fixup again from scratch. (write_object_file): Before calling adjust_reloc_syms, make a pass through the symbol list trying to resolve values. (print_fixup): New routine, for debugging. (write_relocs): Call bfd_install_relocation. Deleted various hacks for working around problems with bfd_perform_relocation.
1994-09-13* write.c (fixup_segment): Test TC_RELOC_RTSYM_LOC_FIXUP on fixup beforeKen Raeburn1-12/+76
processing same-section pcrel relocations. (TC_RELOC_RTSYM_LOC_FIXUP): Default to 1.
1994-06-03 * as.h: Replace flagseen with separate variables.David MacKenzie1-8/+14
* as.c (parse_args): Set them. Don't accept -1 option, or -v explicitly (it's a synonym for --version). * as.c, input-scrub.c, messages.c, read.c, symbols.c, write.c, config/obj-aout.c, config/obj-aout.h, config/obj-bout.c, config/obj-bout.h, config/obj-coff.c, config/obj-coff.h, config/obj-vms.c, config/tc-hppa.c, config/tc-i386.c, config/tc-i960.c, config/tc-m68k.c, config/tc-mips.c, config/tc-vax.c: Use the new flag variables instead of flagseen. * config/tc-vax.c [OBJ_VMS]: Recognize -+, -1, -v, and document in usage.
1994-05-02 * subsegs.h (segment_info_type): Use fix_tail field even ifIan Lance Taylor1-2/+21
BFD_ASSEMBLER. * subsegs.c (subseg_change): Initialize fix_tail field. (subseg_get): Likewise. * write.c (frags_chained): New static variable. (fix_new_internal): If frags_chained is set, use fix_root and fix_tail from seg_info (now_seg), rather than frchain_now. (chain_frchains_together_1): Set fix_tail field. (chain_frchains_together): Set frags_chained.
1994-03-19* write.c (symbol_table_frozen): New variable, to be set after bfd_set_symtabKen Raeburn1-72/+110
is called. (dump_section_relocs): Note whether a symbol is a section symbol or not. (adjust_reloc_syms): For now, always supply an absolute symbol for fixups without symbols but not yet `done'. Use section_symbol to get the symbol, instead of going directly for abs_symbol. (write_relocs) [DEBUG4]: Abort if any symbol referred to by a reloc is not a section symbol and is not in the symbol table. (set_symtab): New function, broken out from write_object_file. Counts symbol table instead of relying on an earlier count. (write_object_file): Call set_symtab, but do it after potentially invoking the *_frob_file macros. Don't bother counting symbols. Call symbol_remove, instead of expanding it in place. Moved the conditionalized `object_file_size' declaration down to conditionalized block where it's used. When using the absolute symbol for a fixup without a symbol, set sy_used_in_reloc. (write_object_file) [BFD_ASSEMBLER]: Call section_symbol to get the correct symbol for the absolute section.
1994-02-18write.c (write_object_file): Removed register declarations.Ken Raeburn1-9/+13
1994-02-09(adjust_reloc_syms): Use abs_symbol instead of calling section_symbol.Ken Raeburn1-7/+3
1994-02-08 * write.c (write_relocs): Print some sensible error message ifKen Raeburn1-21/+27
bfd_perform_relocation returns bfd_reloc_overflow.
1994-02-05Don't refer to new fields unless BFD_ASSEMBLER (from sac).Ian Lance Taylor1-0/+2
1994-02-05 Changed relocs to be based on subsegments (when BFD_ASSEMBLER).Ian Lance Taylor1-51/+49
* subsegs.h (struct frchain): If BFD_ASSEMBLER, added new fields fix_root and fix_tail. (segment_info_type): If BFD_ASSEMBLER, don't define fix_tail field. * write.c (fix_new_internal): If BFD_ASSEMBLER, set fix_rootP and fix_tailP based on frchain_now, not seg_info (now_seg). (chain_frchains_together_1): Chain the subsegment relocs together. * subsegs.c (subseg_change): Don't clear fix_tail field. (subseg_get): Likewise. * literal.c (add_to_literal_pool): Look through the relocs via frchain_now, not seginfo. * write.c (write_object_file): Simplified usage of obj_frob_symbol and tc_frob_symbol. Always call both if the symbol is going to be output. * write.c (relax_segment): Use %ld rather than %d when printing fragP->fr_var, and cast it to long.
1994-01-30* write.c (write_object_file): If tc_frob_file is defined, call itKen Raeburn1-0/+4
just before calling obj_frob_file. * config/tc-alpha.c (alpha_gp_value): Renamed from gp_value (refs changed), made non-static. (getExpression): Return void. (select_gp_value): Abort if gp_value is non-zero. Delete call to non-existent bfd_set_gp_value. (alpha_validate_fix): Function deleted. (alpha_frob_symbol): Function deleted. (alpha_local_label): Function deleted. (alpha_frob_file): Renamed from alpha_end. * config/tc-alpha.h (alpha_frob_symbol, alpha_validate_fix, alpha_local_label, alpha_end): Declarations deleted. (alpha_gp_value, alpha_frob_file): Declare. (tc_frob_symbol, TC_VALIDATE_FIX, md_end): Macros deleted. (LOCAL_LABEL): Move code here from tc-alpha.c:alpha_local_label. (md_convert_frag): Simplified slightly. (tc_frob_file): New macro.
1994-01-28* as.h: If __GNUC__ and inline are both undefined, define inline away.Ken Raeburn1-44/+82
* write.c (cvt_frag_to_fill): Don't assume that fr_var for rs_align or rs_org frags will be 1. (relax_segment): For rs_align, if fr_var is not 1, complain if required padding is not a multiple of the size of the pad pattern. (fixup_segment): Leave gp-relative relocations alone. For pcrel relocations referring to the same segment, clear fx_pcrel when clearing fx_addsy. * as.h: Adjust comments on rs_align. * write.c, config/obj-{aout,bout,coff*}.c, config/tc-sparc.c: Query the fx_done field instead of fx_addsy to see if the fixup still needs to be applied. Set fx_done and clear fx_addsy both, for now. If TC_HANDLES_FX_DONE isn't defined, assume md_apply_fix will only clear fx_addsy, and set fx_done accordingly after returning. * config/tc-sparc.h (TC_HANDLES_FX_DONE): Define. * config/obj-coff.c (dot_text_symbol, dot_data_symbol, dot_bss_symbol): Defined here, static. * config/obj-aout.c [BFD_ASSEMBLER]: Undef NO_RELOC before including aout/aout64.h. * write.c (write_object_file): If EMIT_SECTION_SYMBOLS is false, don't write out a section symbol even if it's used in a relocation; assume relocations will handle section numbers somehow. Rename "punt_it" label to "punt_it_if_unused" to reflect it's true use. (EMIT_SECTION_SYMBOLS): Default to 1. (adjust_reloc_syms): Don't create a new symbol for an absolute reference; just use the absolute section symbol. (write_relocs): Make printout of reloc values dependent on flag DEBUG3, not DEBUG2. * config/obj-aout.h (EMIT_SECTION_SYMBOLS): Define as 0. * config/obj-ecoff.h (EMIT_SECTION_SYMBOLS): Ditto.
1993-12-20* write.c (adjust_reloc_syms) [RELOC_REQUIRES_SYMBOL]: If no symbol is presentKen Raeburn1-2/+21
(i.e., relocation against absolute), create a phony local symbol, and use it in the reloc. (fixup_segment): When adjusting a reloc with an absolute symbol, have TC_FORCE_RELOCATION control clearing add_symbolP too. * config/tc-sparc.h (RELOC_REQUIRES_SYMBOL): Define.
1993-12-20* as.c (main): Only invoke md_end if it's defined as a macro.Ken Raeburn1-16/+1
* tc.h (md_end): Don't declare it. * config/tc-*.[ch] (md_end): Deleted, in cases where it doesn't do anything. * config/tc-vax.c (vip_end): Deleted null function. * config/tc-mips.c (md_mips_end): Renamed from md_end. * config/tc-mips.h (md_mips_end): Declare. (md_end): New macro, calls md_mips_end. * write.c (write_object_file): Don't close output file. * as.c (main): Close output file (if needed) after calling listing_print, which should be after calling write_object_file, which sets the frag addresses.
1993-12-09(number_to_chars_*): Delete bogus range checks.Ken Raeburn1-249/+269
1993-11-30 * write.c (TC_FORCE_RELOCATION): Provide a default definition.Jeff Law1-54/+71
(fixup_segment): Allow the target machine to specify that a relocation must be generated for a particular fixup. Remove #ifndef TC_HPPA hack. * config/tc-hppa.h (TC_FORCE_RELOCATION): Define. * config/tc-hppa.c (md_apply_fix_1): Never change fx_addsy to be NULL. Only fixup_segment is supposed to do that. (hppa_force_relocation): New function.
1993-11-18Get ECOFF gas to work again after this morning's checkins.Ian Lance Taylor1-1/+1
1993-11-17 * write.c (is_dnrange): Do not define if md_relax_frag is defined.Ian Lance Taylor1-34/+38
(relax_segment): If md_relax_frag is defined, use it to handle a frag of type rs_machine_dependent rather than looking through md_relax_table. * write.c (relax_and_size_seg): Don't set SEC_HAS_CONTENTS for a bss section. Set SEC_RELOC if there are any relocations, even for a zero size section. * write.c (write_relocs): In RELOC_EXPANSION_POSSIBLE case, based data offset on reloc[0]->address rather than reloc[j]->address, so that multiple relocs can affect different memory locations. * write.c (chain_frchains_together, relax_and_size_seg, adjust_reloc_syms, write_relocs): Make third argument PTR, not char *, to match definition of bfd_map_over_sections.
1993-11-05 * write.c (chain_frchains_together): Update pointer to lastJeff Law1-3/+11
frag for a segment in the seginfo structure.
1993-11-02 * Add support for marker type relocations. These mark areasJeff Law1-4/+3
of interest to the linker. ENTRY/EXIT relocations for SOM are an example of marker relocations. * write.c (write_relocs): Instead of assuming size of a relocation is 4 bytes, pick up the size from relocation itself. (fixup_segment): Do not complain that a value is too small for marker relocations.
1993-10-31 * write.c (relax_and_size_seg): Correct test to determineJeff Law1-11/+14
if the section's size was rounded up.
1993-10-25 * write.c (write_relocs): For relocs that are pc_relative andKen Raeburn1-8/+19
pcrel_offset and not partial_inplace, adjust reloc->addend to compensate for a bfd_perform_relocation bug.
1993-10-21Various arious PA changes from Utah.Ken Raeburn1-5/+28
V9 bugfix. See changelog...
1993-10-11 * write.c (write_contents): Don't crash if seginfo is NULL.Ian Lance Taylor1-1/+2
* config/obj-ecoff.c (ecoff_frob_file): Write out register masks by modifying .reginfo section, not by directly modifying BFD backend data.
1993-10-06 Changes to let cons handle bignums like general expressions.Ian Lance Taylor1-49/+96
* expr.h (expressionS): New field X_unsigned. * expr.c (operand): Initialize X_unsigned to 1. Set it to 0 for unary minus case. (expr) Fix typo resultP to right if missing operand. Set X_unsigned to 1 when building new expression. * read.c (potable): Make "octa" and "quad" call cons, not big_cons. (cons): Handle bignums. If given an O_constant (small integer) to fill a big space, turn it into a bignum. (parse_bitfield_cons): Set X_unsigned field. (bignum_low, bignum_limit, bignum_high, grow_bignum, big_cons): Removed. * read.h (big_cons): Remove prototype. * symbols.c (resolve_symbol_value): Don't give a warning if a symbol in expr_section can not be resolved. (S_SET_VALUE): Clear X_unsigned. * write.c (write_object_file): If resolve_symbol_value failed on a symbol we are writing out, give a warning. * config/tc-h8500.c (parse_reglist): Set X_unsigned. * config/tc-hppa.c (md_pseudo_table): Change "octa" and "quad" to call pa_cons, not pa_big_cons. (pa_big_cons): Remove. * config/tc-hppa.h (pa_big_cons): Remove declaration. * config/tc-i960.c (md_pseudo_table): Change "quad" to call cons, not big_cons.
1993-09-10gcc lint. See ChangeLog for details. Also:Ian Lance Taylor1-27/+26
* config/obj-elf.h (S_SET_SIZE): Actually set the size.
1993-09-07Changes to support stabs-in-coffStan Shebs1-1/+1
1993-09-01(write_relocs) [RELOC_EXPANSION_POSSIBLE]: Declare tc_gen_reloc correctly.Ken Raeburn1-69/+70
1993-08-05(write_object_file): Test DEBUG_SYMS instead of DEBUG for verifying sym chain.Ken Raeburn1-121/+131
(merge_data_into_text, relax_and_size_all_segments): New fns, split out from write_object_file.
1993-07-22Don't use #ifdef inside macro arguments.Ian Lance Taylor1-4/+6