]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Make fixup fx_where unsigned
authorAlan Modra <amodra@gmail.com>
Tue, 16 Apr 2019 01:40:44 +0000 (11:10 +0930)
committerAlan Modra <amodra@gmail.com>
Tue, 16 Apr 2019 07:43:04 +0000 (17:13 +0930)
Another field that only stores unsigned values.

* write.h (struct fix <fx_where>): Make unsigned.
(fix_new, fix_at_start, fix_new_exp): Adjust prototypes.
* write.c (fix_new, fix_new_exp, fix_at_start): Make "where" and
"size" parameters unsigned long.
(fix_new_internal): Likewise.  Adjust error format string to suit.
* config/tc-mips.c (md_convert_frag): Remove cast of fx_where.
* config/tc-sparc.c (md_apply_fix): Likewise.
* config/tc-score.c (s3_convert_frag): Adjust for unsigned fx_where.
* config/tc-score7.c (s7_convert_frag): Likewise.

gas/ChangeLog
gas/config/tc-mips.c
gas/config/tc-score.c
gas/config/tc-score7.c
gas/config/tc-sparc.c
gas/write.c
gas/write.h

index 2013c5deffeab1a403b98444efeb4effb959f104..4a08de155cd16bf97916646b3b9d4f6be1ea414c 100644 (file)
@@ -1,3 +1,15 @@
+2019-04-16  Alan Modra  <amodra@gmail.com>
+
+       * write.h (struct fix <fx_where>): Make unsigned.
+       (fix_new, fix_at_start, fix_new_exp): Adjust prototypes.
+       * write.c (fix_new, fix_new_exp, fix_at_start): Make "where" and
+       "size" parameters unsigned long.
+       (fix_new_internal): Likewise.  Adjust error format string to suit.
+       * config/tc-mips.c (md_convert_frag): Remove cast of fx_where.
+       * config/tc-sparc.c (md_apply_fix): Likewise.
+       * config/tc-score.c (s3_convert_frag): Adjust for unsigned fx_where.
+       * config/tc-score7.c (s7_convert_frag): Likewise.
+
 2019-04-16  Alan Modra  <amodra@gmail.com>
 
        * frags.h (struct frag <fr_fix>): Use unsigned type.
index 70c6548283e63941beb5b030b2bc46a2e953c3c4..94141e937ea5ff9c3f3430d4beed62000ac059c3 100644 (file)
@@ -19099,7 +19099,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp)
         sequence instead.  */
       while (fixp
             && fixp->fx_frag == fragp
-            && (valueT) fixp->fx_where + second < fragp->fr_fix)
+            && fixp->fx_where + second < fragp->fr_fix)
        {
          if (subtype & RELAX_USE_SECOND)
            fixp->fx_done = 1;
index 3101dc8f41f51029677dd13dd7c72dfab79e8430..4bbeeb025702b25adb5fbbc92ec70ae68bad36e6 100644 (file)
@@ -7011,8 +7011,8 @@ s3_relax_frag (asection * sec ATTRIBUTE_UNUSED, fragS * fragp, long stretch ATTR
 static void
 s3_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED, fragS * fragp)
 {
-  int r_old;
-  int r_new;
+  unsigned int r_old;
+  unsigned int r_new;
   char backup[20];
   fixS *fixp;
 
index 13dd530f602594975579d012a8f97f5312b4cfc6..f60ab494b882af6662bf191330ec1142cb6729b8 100644 (file)
@@ -6562,8 +6562,8 @@ s7_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
                 segT sec ATTRIBUTE_UNUSED,
                 fragS * fragp)
 {
-  int r_old;
-  int r_new;
+  unsigned int r_old;
+  unsigned int r_new;
   char backup[20];
   fixS *fixp;
 
index 677a13f1fea47f348dfa890956d8ecbd28230ef8..347db08173a8948ef1ecb970dbf36267ff8905ef 100644 (file)
@@ -3566,7 +3566,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment ATTRIBUTE_UNUSED)
              can be completely resolved here, i.e. if no undefined
              symbol is associated with it.  */
          if (sparc_relax && fixP->fx_addsy == NULL
-             && (valueT) fixP->fx_where + 8 <= fixP->fx_frag->fr_fix)
+             && fixP->fx_where + 8 <= fixP->fx_frag->fr_fix)
            {
 #define G0             0
 #define O7             15
index 2c4305e17dc8ab96e809e50bf7df09817457970f..91767fbb36d181b0cd8ea97170a9c0fbddff7014 100644 (file)
@@ -143,8 +143,8 @@ static int n_fixups;
 
 static fixS *
 fix_new_internal (fragS *frag,         /* Which frag?  */
-                 int where,            /* Where in that frag?  */
-                 int size,             /* 1, 2, or 4 usually.  */
+                 unsigned long where,  /* Where in that frag?  */
+                 unsigned long size,   /* 1, 2, or 4 usually.  */
                  symbolS *add_symbol,  /* X_add_symbol.  */
                  symbolS *sub_symbol,  /* X_op_symbol.  */
                  offsetT offset,       /* X_add_number.  */
@@ -164,7 +164,7 @@ fix_new_internal (fragS *frag,              /* Which frag?  */
   /* We've made fx_size a narrow field; check that it's wide enough.  */
   if (fixP->fx_size != size)
     {
-      as_bad (_("field fx_size too small to hold %d"), size);
+      as_bad (_("field fx_size too small to hold %lu"), size);
       abort ();
     }
   fixP->fx_addsy = add_symbol;
@@ -228,10 +228,10 @@ fix_new_internal (fragS *frag,            /* Which frag?  */
 /* Create a fixup relative to a symbol (plus a constant).  */
 
 fixS *
-fix_new (fragS *frag,          /* Which frag?  */
-        int where,                     /* Where in that frag?  */
-        int size,                      /* 1, 2, or 4 usually.  */
-        symbolS *add_symbol,   /* X_add_symbol.  */
+fix_new (fragS *frag,                  /* Which frag?  */
+        unsigned long where,           /* Where in that frag?  */
+        unsigned long size,            /* 1, 2, or 4 usually.  */
+        symbolS *add_symbol,           /* X_add_symbol.  */
         offsetT offset,                /* X_add_number.  */
         int pcrel,                     /* TRUE if PC-relative relocation.  */
         RELOC_ENUM r_type              /* Relocation type.  */)
@@ -246,8 +246,8 @@ fix_new (fragS *frag,               /* Which frag?  */
 
 fixS *
 fix_new_exp (fragS *frag,              /* Which frag?  */
-            int where,                 /* Where in that frag?  */
-            int size,                  /* 1, 2, or 4 usually.  */
+            unsigned long where,       /* Where in that frag?  */
+            unsigned long size,        /* 1, 2, or 4 usually.  */
             expressionS *exp,          /* Expression.  */
             int pcrel,                 /* TRUE if PC-relative relocation.  */
             RELOC_ENUM r_type          /* Relocation type.  */)
@@ -313,7 +313,7 @@ fix_new_exp (fragS *frag,           /* Which frag?  */
    as for fix_new, except that WHERE is implicitly 0.  */
 
 fixS *
-fix_at_start (fragS *frag, int size, symbolS *add_symbol,
+fix_at_start (fragS *frag, unsigned long size, symbolS *add_symbol,
              offsetT offset, int pcrel, RELOC_ENUM r_type)
 {
   return fix_new_internal (frag, 0, size, add_symbol,
index e67fba092cd426626bda3818d3fbd1caad39e657..a69ec3cd17c5dc90e4c3e977d34435b56dfc04a4 100644 (file)
@@ -84,8 +84,8 @@ struct fix
   /* Which frag does this fix apply to?  */
   fragS *fx_frag;
 
-  /* Where is the first byte to fix up?  */
-  long fx_where;
+  /* The location within the frag where the fixup occurs.  */
+  unsigned long fx_where;
 
   /* NULL or Symbol whose value we add in.  */
   symbolS *fx_addsy;
@@ -183,15 +183,12 @@ extern long relax_frag (segT, fragS *, long);
 extern int relax_segment (struct frag *, segT, int);
 extern void number_to_chars_littleendian (char *, valueT, int);
 extern void number_to_chars_bigendian (char *, valueT, int);
-extern fixS *fix_new
-  (fragS * frag, int where, int size, symbolS * add_symbol,
-   offsetT offset, int pcrel, bfd_reloc_code_real_type r_type);
-extern fixS *fix_at_start
-  (fragS * frag, int size, symbolS * add_symbol,
-   offsetT offset, int pcrel, bfd_reloc_code_real_type r_type);
-extern fixS *fix_new_exp
-  (fragS * frag, int where, int size, expressionS *exp, int pcrel,
-   bfd_reloc_code_real_type r_type);
+extern fixS *fix_new (fragS *, unsigned long, unsigned long, symbolS *,
+                     offsetT, int, bfd_reloc_code_real_type);
+extern fixS *fix_at_start (fragS *, unsigned long, symbolS *,
+                          offsetT, int, bfd_reloc_code_real_type);
+extern fixS *fix_new_exp (fragS *, unsigned long, unsigned long,
+                         expressionS *, int, bfd_reloc_code_real_type);
 extern void write_print_statistics (FILE *);
 
 #endif /* __write_h__ */