diff options
-rw-r--r-- | gas/ChangeLog | 34 | ||||
-rw-r--r-- | gas/config/tc-mn10300.c | 84 | ||||
-rw-r--r-- | gas/config/tc-mn10300.h | 16 | ||||
-rw-r--r-- | gas/doc/internals.texi | 19 | ||||
-rw-r--r-- | gas/write.c | 24 |
5 files changed, 151 insertions, 26 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 2c7402f..d6117d6 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,21 @@ +2000-08-22 Eric Christopher <echristo@cygnus.com> + + * config/tc-mn10300.c: (md_apply_fix): New function. + (mn10300_force_relocation): New function. + (mn10300_fix_adjustable): New function. + + * config/tc-mn10300.h: (TC_FORCE_RELOCATION): Define. + (TC_HANDLES_FX_DONE): Define. + (obj_fix_adjustable): Define. + (MD_APPLY_FIX3): Define. + (TC_LINKRELAX_FIXUP): Define. + + * write.c: (TC_LINKRELAX_FIXUP): Define if not + previously defined. + (fixup_segment): Use TC_LINKRELAX_FIXUP. + + * doc/internals.texi: Document TC_LINKRELAX_FIXUP. + 2000-08-21 Jason Eckhardt <jle@cygnus.com> * config/tc-i860.c (md_apply_fix3): Do not insert the immediate @@ -186,7 +204,7 @@ Wed Aug 9 16:28:21 EDT 2000 Diego Novillo <dnovillo@cygnus.com> (find): Accept 68hc12 register indirect modes. * NEWS: Mention 68HC11 & 68HC12 support. - + 2000-08-07 Richard Henderson <rth@cygnus.com> * config/tc-ia64.c (unwind): Add prologue_mask member. @@ -251,7 +269,7 @@ Wed Aug 9 16:28:21 EDT 2000 Diego Novillo <dnovillo@cygnus.com> * doc/c-m68k.texi (section M680x0 Options): Turn into a table index by command line option. - + 2000-08-01 Michael Sokolov <msokolov@ivan.Harhan.ORG> * doc/c-m68k.texi (@cindex @samp{--pcrel}): Rewrite option description. @@ -277,7 +295,7 @@ Wed Aug 9 16:28:21 EDT 2000 Diego Novillo <dnovillo@cygnus.com> emit absolute jumps for anything with --pcrel. * doc/c-m68k.texi: Document new command line option. - + 2000-07-28 Jason Eckhardt <jle@cygnus.com> * configure.in: Add bits for i860-stardent-{sysv4, elf}*. @@ -362,7 +380,7 @@ Thu Jul 27 11:25:01 2000 Andrew Cagney <cagney@b1.cygnus.com> * po/POTFILES.in, po/gas.pot: Regenerate. 2000-07-20 Kazu Hirata <kazu@hxi.com> - + * read.c: Fix formatting. * write.c: Fix formatting. @@ -539,7 +557,7 @@ Thu Jul 27 11:25:01 2000 Andrew Cagney <cagney@b1.cygnus.com> 2000-07-08 Ulf Carlsson <ulfc@engr.sgi.com> * doc/internals.texi (Expressions): Fix typo. - + 2000-07-08 Kazu Hirata <kazu@hxi.com> * config/tc-sh.c: Fix formatting. @@ -628,7 +646,7 @@ Tue Jul 4 14:08:28 2000 Andrew Cagney <cagney@b1.cygnus.com> test for Link Once sections as in adjust_reloc_syms. * config/te-tmips.h: New file for traditional mips targets. Define TE_TMIPS. - + 2000-06-29 Mark Elbrecht <snowball3@bigfoot.com> * config/obj-coff.c (obj_coff_setcion) [BFD_ASSEMBLER]: If the @@ -657,7 +675,7 @@ Thu Jun 29 21:30:00 2000 Hans-Peter Nilsson <hp@axis.com> 2000-06-27 Nick Clifton <nickc@cygnus.com> * config/tc-d30v.c (write_2_short): Do not allow opcodes with - the EITHER_BUT_PREFER_MU attribute to be combined into a reverse + the EITHER_BUT_PREFER_MU attribute to be combined into a reverse sequential order, and emit warning messages if the input source code contains constructs like that, or parallel constructs containing such opcodes. @@ -693,7 +711,7 @@ Thu Jun 29 21:30:00 2000 Hans-Peter Nilsson <hp@axis.com> (md_apply_fix3): ditto 2000-06-24 Frank Ch. Eigler <fche@redhat.com> - + * cgen.c (expr_jmp_buf_p): New validity flag for expr_jmp_buf. (gas_cgen_parse_operand): Set it around expression() call. (gas_cgen_md_operand): Test for it before longjmp(). diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c index cc30591..18db9fd 100644 --- a/gas/config/tc-mn10300.c +++ b/gas/config/tc-mn10300.c @@ -1920,10 +1920,90 @@ md_apply_fix3 (fixp, valuep, seg) valueT *valuep; segT seg; { - /* We shouldn't ever get here because linkrelax is nonzero. */ - abort (); + + valueT value = *valuep; + char *fixpos = fixp->fx_where + fixp->fx_frag->fr_literal; + int size = 0; + + assert (fixp->fx_r_type < BFD_RELOC_UNUSED); + + /* This should never happen. */ + if (seg->flags & SEC_ALLOC) + abort (); + + /* If the fix is relative to a symbol which is not defined, or not + in the same segment as the fix, we cannot resolve it here. */ + if (fixp->fx_addsy != NULL + && (! S_IS_DEFINED (fixp->fx_addsy) + || (S_GET_SEGMENT (fixp->fx_addsy) != seg))) + { + fixp->fx_done = 0; + return 0; + } + + switch (fixp->fx_r_type) + { + case BFD_RELOC_8: + size = 1; + break; + + case BFD_RELOC_16: + size = 2; + break; + + case BFD_RELOC_32: + size = 4; + break; + + case BFD_RELOC_VTABLE_INHERIT: + case BFD_RELOC_VTABLE_ENTRY: + fixp->fx_done = 0; + return 1; + + case BFD_RELOC_NONE: + default: + as_bad_where (fixp->fx_file, fixp->fx_line, + _("Bad relocation fixup type (%d)"), fixp->fx_r_type); + } + + md_number_to_chars (fixpos, fixp->fx_offset, size); + fixp->fx_done = 1; return 0; + +} + +/* Return nonzero if the fixup in FIXP will require a relocation, + even it if appears that the fixup could be completely handled + within GAS. */ + +int +mn10300_force_relocation (fixp) + struct fix *fixp; +{ + if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT + || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY) + return 1; + + return 0; +} + +/* Return zero if the fixup in fixp should be left alone and not + adjusted. */ + +boolean +mn10300_fix_adjustable (fixp) + struct fix *fixp; +{ + /* Prevent all adjustments to global symbols. */ + if (S_IS_EXTERN (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy)) + return 0; + + if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT + || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY) + return 0; + + return 1; } /* Insert an operand value into an instruction. */ diff --git a/gas/config/tc-mn10300.h b/gas/config/tc-mn10300.h index f9c8826..bff92b0 100644 --- a/gas/config/tc-mn10300.h +++ b/gas/config/tc-mn10300.h @@ -31,7 +31,21 @@ #define TARGET_FORMAT "elf32-mn10300" -#define MD_APPLY_FIX3 +/* For fixup and relocation handling. */ +#define TC_FORCE_RELOCATION(fixp) mn10300_force_relocation (fixp) +extern int mn10300_force_relocation PARAMS ((struct fix *)); + +#define TC_HANDLES_FX_DONE + +#define obj_fix_adjustable(fixP) mn10300_fix_adjustable (fixP) +extern boolean mn10300_fix_adjustable PARAMS ((struct fix *)); + +#define MD_APPLY_FIX3 md_apply_fix3 + +/* Fixup debug sections since we will never relax them. */ +#define TC_LINKRELAX_FIXUP(seg) (seg->flags & SEC_ALLOC) + + #define md_operand(x) /* Permit temporary numeric labels. */ diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi index 34c974f..c9d2497 100644 --- a/gas/doc/internals.texi +++ b/gas/doc/internals.texi @@ -644,7 +644,7 @@ The variable characters are to be repeated @code{fr_offset} times. If have this type. @item rs_leb128 -This state is used to implement the DWARF ``little endian base 128'' +This state is used to implement the DWARF ``little endian base 128'' variable length number format. The @code{fr_symbol} is always an expression symbol, as constant expressions are emitted directly. The @code{fr_offset} field is used during relaxation to hold the previous size of the number so @@ -964,7 +964,7 @@ default value is @code{LEX_NAME | LEX_BEGIN_NAME}. @item NUMBERS_WITH_SUFFIX @cindex NUMBERS_WITH_SUFFIX When this macro is defined to be non-zero, the parser allows the radix of a -constant to be indicated with a suffix. Valid suffixes are binary (B), +constant to be indicated with a suffix. Valid suffixes are binary (B), octal (Q), and hexadecimal (H). Case is not significant. @item SINGLE_QUOTE_STRINGS @@ -999,7 +999,7 @@ default definition is to accept any name followed by a colon character. @item TC_START_LABEL_WITHOUT_COLON @cindex TC_START_LABEL_WITHOUT_COLON Same as TC_START_LABEL, but should be used instead of TC_START_LABEL when -LABELS_WITHOUT_COLONS is defined. +LABELS_WITHOUT_COLONS is defined. @item NO_PSEUDO_DOT @cindex NO_PSEUDO_DOT @@ -1183,6 +1183,15 @@ If you define this macro, and the global variable @samp{linkrelax} is set @samp{.align} directive will cause extra space to be allocated. The linker can then discard this space when relaxing the section. +@item TC_LINKRELAX_FIXUP ($var{segT}) +@cindex TC_LINKRELAX_FIXUP +If defined, this macro allows control over whether fixups for a +given section will be processed when the @var{linkrelax} variable is +set. The macro is given the N_TYPE bits for the section in its +@var{segT} argument. If the macro evaluates to a non-zero value +then the fixups will be converted into relocs, otherwise they will +be passed to @var{md_apply_fix3} as normal. + @item md_convert_frag @cindex md_convert_frag GAS will call this for each rs_machine_dependent fragment. @@ -1257,7 +1266,7 @@ size. @cindex md_macro_start If defined, GAS will call this macro when it starts to include a macro expansion. @code{macro_nest} indicates the current macro nesting level, which -includes the one being expanded. +includes the one being expanded. @item md_macro_info @cindex md_macro_info @@ -1269,7 +1278,7 @@ macro (macro_entry *), which includes expansion of the formal arguments. @item md_macro_end @cindex md_macro_end Complement to md_macro_start. If defined, it is called when finished -processing an inserted macro expansion, just before decrementing macro_nest. +processing an inserted macro expansion, just before decrementing macro_nest. @item DOUBLEBAR_PARALLEL @cindex DOUBLEBAR_PARALLEL diff --git a/gas/write.c b/gas/write.c index cb50709..67d39ab 100644 --- a/gas/write.c +++ b/gas/write.c @@ -48,6 +48,10 @@ #define TC_FORCE_RELOCATION_SECTION(FIXP,SEG) TC_FORCE_RELOCATION(FIXP) #endif +#ifndef TC_LINKRELAX_FIXUP +#define TC_LINKRELAX_FIXUP(SEG) 1 +#endif + #ifndef MD_PCREL_FROM_SECTION #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from(FIXP) #endif @@ -284,12 +288,12 @@ fix_new_exp (frag, where, size, exp, pcrel, r_type) the difference expression cannot immediately be reduced. */ { symbolS *stmp = make_expr_symbol (exp); - + exp->X_op = O_symbol; exp->X_op_symbol = 0; exp->X_add_symbol = stmp; exp->X_add_number = 0; - + return fix_new_exp (frag, where, size, exp, pcrel, r_type); } @@ -1235,7 +1239,7 @@ relax_and_size_all_segments () /* 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) { @@ -1497,7 +1501,7 @@ write_object_file () #ifndef BFD_ASSEMBLER /* 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. @@ -1505,10 +1509,10 @@ write_object_file () 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. @@ -2106,9 +2110,9 @@ relax_align (address, alignment) /* Now we have a segment, not a crowd of sub-segments, we can make fr_address values. - + Relax the frags. - + After this, all frags in this segment have addresses that are correct within the segment. Since segments live in different file addresses, these frag addresses may not be the same as final object-file @@ -2204,7 +2208,7 @@ relax_segment (segment_frag_root, segment) do { stretch = stretched = 0; - + for (fragP = segment_frag_root; fragP; fragP = fragP->fr_next) { long growth = 0; @@ -2461,7 +2465,7 @@ fixup_segment (fixP, this_segment_type) i960 (the only machine for which we've got a relaxing linker right now), we might be able to turn callx/callj into bal anyways in cases where we know the maximum displacement. */ - if (linkrelax) + if (linkrelax && TC_LINKRELAX_FIXUP (this_segment_type)) { for (; fixP; fixP = fixP->fx_next) seg_reloc_count++; |