This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: dw2gencfi rewrite


On Sun, Jun 01, 2003 at 11:01:27PM -0700, Richard Henderson wrote:
> Blah.  So I get correct results on x86 and x86_64 if I
> change the "#if 1" to an "#if 0", but this breaks alpha.

x86 breaks in the one case because of md_pcrel_from, which on x86
calculates the offset from the end of the word rather than the
beginning.  md_pcrel_from makes the use of pcrel relocs from anywhere
but the backend rather interesting.

alpha breaks in the other case because you're being too clever, or
or perhaps it's more a case of my hack to fix (foo - .) expressions
in variable length insns wasn't clever enough.  The trouble is that
dot_value is only updated in expr, ie. when parsing input.  You delay
emitting eh_frame stuff, so get an old value of dot when converting
sym1-sym2 to sym1@pcrel.

This further hack to set dot_value in emit_expr cures your alpha
failures, but might break parse_repeat_cons in some cases.

	* read.c (emit_expr): Set dot_value.
	* dw2gencfi.c (output_fde): Remove pcrel reloc hack.

Index: gas/read.c
===================================================================
RCS file: /cvs/src/src/gas/read.c,v
retrieving revision 1.62
diff -u -p -r1.62 read.c
--- gas/read.c	20 May 2003 07:58:06 -0000	1.62
+++ gas/read.c	2 Jun 2003 22:22:37 -0000
@@ -3444,6 +3444,8 @@ emit_expr (exp, nbytes)
   if (need_pass_2)
     return;
 
+  dot_value = frag_now_fix ();
+
 #ifndef NO_LISTING
 #ifdef OBJ_ELF
   /* When gcc emits DWARF 1 debugging pseudo-ops, a line number will
Index: gas/dw2gencfi.c
===================================================================
RCS file: /cvs/src/src/gas/dw2gencfi.c,v
retrieving revision 1.6
diff -u -p -r1.6 dw2gencfi.c
--- gas/dw2gencfi.c	31 May 2003 19:36:44 -0000	1.6
+++ gas/dw2gencfi.c	2 Jun 2003 22:22:37 -0000
@@ -666,17 +666,9 @@ output_fde (struct fde_entry *fde, struc
   exp.X_op_symbol = cie->start_address;
   emit_expr (&exp, 4);				/* CIE offset */
   
-  /* ??? Unsure why this works and the following doesn't.  
-     Symptom was incorrect addends to the relocation.  */
-#if 1
-  memset (frag_more (4), 0, 4);			/* Code offset */
-  fix_new (frag_now, frag_now_fix () - 4, 4,
-	   fde->start_address, 0, 1, BFD_RELOC_32);
-#else
   exp.X_add_symbol = fde->start_address;
   exp.X_op_symbol = symbol_temp_new_now ();
-  emit_expr (&exp, 4);
-#endif
+  emit_expr (&exp, 4);				/* Code offset */
 
   exp.X_add_symbol = fde->end_address;
   exp.X_op_symbol = fde->start_address;		/* Code length */

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]