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]

[RFA:] unconstify md_short_jump_size, md_long_jump_size (was: Re: Gas: making md_long_jump_size mutable)


> From: Ian Lance Taylor <ian@wasabisystems.com>
> Date: 29 Oct 2004 11:45:48 -0400

> Hans-Peter Nilsson <hans-peter.nilsson@axis.com> writes:
> > I'd prefer to just remove the "const".
> 
> I agree.

The patch below is an implementation.

> > (No, I'm not interested in alternative 3: remove BROKEN_DOT_WORD
> > support.  At least not for the time being. ;-)
> 
> Ah, but take a look at CASE_VECTOR_SHORTEN_MODE in gcc.  I recently
> employed it to good effect in Thumb code (haven't contributed it back
> yet).  Now that gcc keeps good track of instruction lengths, there is
> much less need for BROKEN_DOT_WORD.

Oh, I know about CASE_VECTOR_SHORTEN_MODE and agree it would be
an improvement to get e.g. byte offsets most of the time, but
for the time being, my plate is full and the broken dot word
support works fine--at least when incentived to stay working
through a few test-cases.  BTW, beware of the length of asm:s
when using CASE_VECTOR_SHORTEN_MODE; they *really* should be set
to max (can be done through define_asm_attributes it seems), so
that a branch across them can never be "shortened", not set to
some max length of a normal insn.

Based on gas/configure.in and grepping on jump_size, I tested this patch
on cross from i686-pc-linux-gnu (FC2) to the following targets:
avr-unknown-elf
cris-axis-elf
i370-unknown-elf
m68k-unknown-elf
mcore-unknown-elf
msp430-unknown-elf
ns32k-unknown-netbsd
or32-unknown-elf
pdp11-unknown-aout
tic4x-unknown-coff
vax-unknown-linux-gnu
except I didn't run the ld-elf/sec64k.exp (on cris-axis-elf, the only arch
where that test is enabled anyway due to excessive test execution time).

There were no changes in compilation output (i.e. no changes in warnings)
and no test regressions.  I couldn't test tahoe-unknown-aout, because of
brokenness in bfd support for it, which I was unable to trivially work
around: adding a bfd_tahoe_arch declaration just moved failure to some
macro in aout-host.c IIRC.

I would consider this obvious if it wasn't that I was unable to simply
test-compile the tahoe changes (so presumably another path would be to
*not* perform this change for tc-tahoe.c).

Ok to commit?

	* symbols.c (colon) [!WORKING_DOT_WORD]: Don't declare
	md_short_jump_size, md_long_jump_size.
	* write.c [!WORKING_DOT_WORD]: Ditto.
	* tc.h [!WORKING_DOT_WORD]: Declare them here.  Drop const
	qualifier.
	* config/tc-cris.h (md_short_jump_size, md_long_jump_size): Don't
	declare.
	* config/tc-cris.c (md_short_jump_size, md_long_jump_size): Drop
	const qualifier in these definitions.
	* config/tc-i370.c, config/tc-m68k.c, config/tc-pdp11.c,
	config/tc-s390.c, config/tc-tahoe.c, config/tc-vax.c: Ditto.

Index: symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.50
diff -u -p -r1.50 symbols.c
--- symbols.c	21 Jun 2004 10:59:54 -0000	1.50
+++ symbols.c	2 Nov 2004 23:06:56 -0000
@@ -299,9 +299,6 @@ colon (/* Just seen "x:" - rattle symbol
       fragS *frag_tmp;
       char *frag_opcode;
 
-      extern const int md_short_jump_size;
-      extern const int md_long_jump_size;
-
       if (now_seg == absolute_section)
 	{
 	  as_bad (_("cannot define symbol `%s' in absolute section"), sym_name);
Index: tc.h
===================================================================
RCS file: /cvs/src/src/gas/tc.h,v
retrieving revision 1.7
diff -u -p -r1.7 tc.h
--- tc.h	17 Aug 2004 12:19:55 -0000	1.7
+++ tc.h	2 Nov 2004 23:06:56 -0000
@@ -54,6 +54,10 @@ void   md_begin (void);
 void   md_number_to_chars (char *, valueT, int);
 void   md_apply_fix3 (fixS *, valueT *, segT);
 
+#ifndef WORKING_DOT_WORD
+extern int md_short_jump_size;
+extern int md_long_jump_size;
+#endif
 
 #ifndef md_create_long_jump
 void    md_create_long_jump (char *, addressT, addressT, fragS *, symbolS *);
Index: write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.78
diff -u -p -r1.78 write.c
--- write.c	5 Aug 2004 16:55:00 -0000	1.78
+++ write.c	2 Nov 2004 23:07:01 -0000
@@ -97,11 +97,6 @@
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from (FIX)
 #endif
 
-#ifndef WORKING_DOT_WORD
-extern const int md_short_jump_size;
-extern const int md_long_jump_size;
-#endif
-
 /* Used to control final evaluation of expressions.  */
 int finalize_syms = 0;
 
Index: config/tc-cris.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-cris.c,v
retrieving revision 1.29
diff -u -p -r1.29 tc-cris.c
--- config/tc-cris.c	21 Mar 2004 23:50:38 -0000	1.29
+++ config/tc-cris.c	2 Nov 2004 23:07:08 -0000
@@ -341,8 +341,8 @@ const char *md_shortopts = "hHN";
    Note that we can't add relocs, because relaxation uses these fixed
    numbers, and md_create_short_jump is called after relaxation.  */
 
-const int md_short_jump_size = 6;
-const int md_long_jump_size = 6;
+int md_short_jump_size = 6;
+int md_long_jump_size = 6;
 
 /* Report output format.  Small changes in output format (like elf
    variants below) can happen until all options are parsed, but after
Index: config/tc-cris.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-cris.h,v
retrieving revision 1.9
diff -u -p -r1.9 tc-cris.h
--- config/tc-cris.h	16 Jun 2003 00:38:58 -0000	1.9
+++ config/tc-cris.h	2 Nov 2004 23:07:08 -0000
@@ -65,9 +65,6 @@ extern const char FLT_CHARS[];
 
 #define md_number_to_chars number_to_chars_littleendian
 
-extern const int md_short_jump_size;
-extern const int md_long_jump_size;
-
 /* There's no use having different functions for this; the sizes are the
    same.  Note that we can't #define md_short_jump_size here.  */
 #define md_create_short_jump md_create_long_jump
Index: config/tc-i370.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i370.c,v
retrieving revision 1.20
diff -u -p -r1.20 tc-i370.c
--- config/tc-i370.c	21 Nov 2003 14:38:06 -0000	1.20
+++ config/tc-i370.c	2 Nov 2004 23:07:14 -0000
@@ -425,8 +425,8 @@ static enum { SHLIB_NONE, SHLIB_PIC, SHI
 static flagword i370_flags = 0;
 
 #ifndef WORKING_DOT_WORD
-const int md_short_jump_size = 4;
-const int md_long_jump_size = 4;
+int md_short_jump_size = 4;
+int md_long_jump_size = 4;
 #endif
 
 #ifdef OBJ_ELF
Index: config/tc-m68k.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68k.c,v
retrieving revision 1.59
diff -u -p -r1.59 tc-m68k.c
--- config/tc-m68k.c	8 Oct 2004 08:45:54 -0000	1.59
+++ config/tc-m68k.c	2 Nov 2004 23:07:26 -0000
@@ -5128,8 +5128,8 @@ tc_aout_fix_to_chars (char *where, fixS 
 #endif /* OBJ_AOUT or OBJ_BOUT */
 
 #ifndef WORKING_DOT_WORD
-const int md_short_jump_size = 4;
-const int md_long_jump_size = 6;
+int md_short_jump_size = 4;
+int md_long_jump_size = 6;
 
 void
 md_create_short_jump (char *ptr, addressT from_addr, addressT to_addr,
Index: config/tc-pdp11.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-pdp11.c,v
retrieving revision 1.11
diff -u -p -r1.11 tc-pdp11.c
--- config/tc-pdp11.c	1 Oct 2004 11:19:37 -0000	1.11
+++ config/tc-pdp11.c	2 Nov 2004 23:07:28 -0000
@@ -1020,8 +1020,8 @@ md_convert_frag (headers, seg, fragP)
 {
 }
 
-const int md_short_jump_size = 2;
-const int md_long_jump_size = 4;
+int md_short_jump_size = 2;
+int md_long_jump_size = 4;
 
 void
 md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
Index: config/tc-s390.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-s390.c,v
retrieving revision 1.41
diff -u -p -r1.41 tc-s390.c
--- config/tc-s390.c	2 Oct 2004 00:18:31 -0000	1.41
+++ config/tc-s390.c	2 Nov 2004 23:07:32 -0000
@@ -312,8 +312,8 @@ static flagword s390_flags = 0;
 symbolS *GOT_symbol;		/* Pre-defined "_GLOBAL_OFFSET_TABLE_" */
 
 #ifndef WORKING_DOT_WORD
-const int md_short_jump_size = 4;
-const int md_long_jump_size = 4;
+int md_short_jump_size = 4;
+int md_long_jump_size = 4;
 #endif
 
 const char *md_shortopts = "A:m:kVQ:";
Index: config/tc-tahoe.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-tahoe.c,v
retrieving revision 1.13
diff -u -p -r1.13 tc-tahoe.c
--- config/tc-tahoe.c	22 Nov 2003 15:32:28 -0000	1.13
+++ config/tc-tahoe.c	2 Nov 2004 23:07:36 -0000
@@ -572,7 +572,7 @@ tc_aout_fix_to_chars (where, fixP, segme
 /* Relocate byte stuff */
 
 /* This is for broken word.  */
-const int md_short_jump_size = 3;
+int md_short_jump_size = 3;
 
 void
 md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
@@ -588,7 +588,7 @@ md_create_short_jump (ptr, from_addr, to
   md_number_to_chars (ptr, offset, 2);
 }
 
-const int md_long_jump_size = 6;
+int md_long_jump_size = 6;
 const int md_reloc_size = 8;	/* Size of relocation record */
 
 void
Index: config/tc-vax.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-vax.c,v
retrieving revision 1.19
diff -u -p -r1.19 tc-vax.c
--- config/tc-vax.c	3 Dec 2003 15:07:16 -0000	1.19
+++ config/tc-vax.c	2 Nov 2004 23:07:43 -0000
@@ -3214,8 +3214,8 @@ mumble (text, value)
 
 /* end: vip_op.c */
 
-const int md_short_jump_size = 3;
-const int md_long_jump_size = 6;
+int md_short_jump_size = 3;
+int md_long_jump_size = 6;
 const int md_reloc_size = 8;	/* Size of relocation record */
 
 void

brgds, H-P


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