This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
(Patch) fixups for mn10300
- To: binutils at sources dot redhat dot com
- Subject: (Patch) fixups for mn10300
- From: Eric Christopher <echristo at cygnus dot com>
- Date: Thu, 17 Aug 2000 02:56:49 -0700
Here's a patch that will do some fixups for the mn10300 even though the
linker relaxes (this basically has the end effect of making the symbol
table smaller in obj files).
Ok to install?
2000-08-17 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: Define TC_LINKRELAX_FIXUP if not previously
defined.
(fixup_segment): Use TC_LINKRELAX_FIXUP.
-eric
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gas/ChangeLog,v
retrieving revision 1.520
diff -u -p -w -r1.520 ChangeLog
--- ChangeLog 2000/08/16 23:20:14 1.520
+++ ChangeLog 2000/08/17 09:40:44
@@ -1,3 +1,17 @@
+2000-08-17 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: Define TC_LINKRELAX_FIXUP if not previously
+ defined.
+ (fixup_segment): Use TC_LINKRELAX_FIXUP.
+
2000-08-16 Jim Wilson <wilson@cygnus.com>
* config/tc-ia64.c (specify_resource, case IA64_RS_GR): Handle
Index: write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.15
diff -u -p -w -r1.15 write.c
--- write.c 2000/07/20 20:07:09 1.15
+++ write.c 2000/08/17 09:40:53
@@ -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
@@ -2461,7 +2465,8 @@ 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++;
Index: config/tc-mn10300.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mn10300.c,v
retrieving revision 1.9
diff -u -p -w -r1.9 tc-mn10300.c
--- tc-mn10300.c 2000/07/28 03:33:32 1.9
+++ tc-mn10300.c 2000/08/17 09:40:57
@@ -1915,15 +1915,89 @@ md_pcrel_from (fixp)
}
int
-md_apply_fix3 (fixp, valuep, seg)
- fixS *fixp;
+md_apply_fix3 (fix, valuep, seg)
+ fixS *fix;
valueT *valuep;
segT seg;
{
- /* We shouldn't ever get here because linkrelax is nonzero. */
+
+ valueT value = *valuep;
+ char * fixpos = fix->fx_where + fix->fx_frag->fr_literal;
+ int size = 0;
+
+ assert (fix->fx_r_type < BFD_RELOC_UNUSED);
+
+ /* This should never happen. */
+
+ if (seg->flags & SEC_ALLOC)
abort ();
- fixp->fx_done = 1;
+
+ fix->fx_addnumber = value; /* Remember value for emit_reloc. */
+
+ switch (fix->fx_r_type)
+ {
+ case BFD_RELOC_8:
+ size = 1;
+ value = fix->fx_offset;
+ md_number_to_chars (fixpos, value, size);
+ break;
+
+ case BFD_RELOC_16:
+ size = 2;
+ value = fix->fx_offset;
+ md_number_to_chars (fixpos, value, size);
+ break;
+
+
+ case BFD_RELOC_32:
+ size = 4;
+ value = fix->fx_offset;
+ md_number_to_chars (fixpos, value, size);
+ break;
+
+ case BFD_RELOC_VTABLE_INHERIT:
+ case BFD_RELOC_VTABLE_ENTRY:
+ fix->fx_done = 0;
+ return 1;
+
+ case BFD_RELOC_NONE:
+ default:
+ as_bad_where (fix->fx_file, fix->fx_line,
+ _("Bad relocation fixup type (%d)"), fix->fx_r_type);
+ }
+
+ fix->fx_done = 1;
+ return 0;
+
+}
+
+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;
+}
+
+
+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. */
Index: config/tc-mn10300.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mn10300.h,v
retrieving revision 1.3
diff -u -p -w -r1.3 tc-mn10300.h
--- tc-mn10300.h 2000/08/14 17:49:55 1.3
+++ tc-mn10300.h 2000/08/17 09:40:57
@@ -31,7 +31,16 @@
#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
+#define TC_LINKRELAX_FIXUP(seg) (seg->flags & SEC_ALLOC)
+
+
#define md_operand(x)
/* Permit temporary numeric labels. */