patches/gcc/2.95.3/100-arm-linux.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Aug 30 16:54:30 2009 +0200 (2009-08-30)
changeset 1502 472cfde636a1
permissions -rw-r--r--
config: move the "build shared libraries" option to the OS menu

The "Build shared libraries" config option is dependant on the type of
"Target OS".

Moving this options to the "Target OS" sub-menu is also better in the user
perspective: he/she no longer needs to go back and forth to see if he/she
missed any option.
yann@402
     1
--------- snip -------
yann@402
     2
Downloaded from ftp://ftp.linux.org.uk/pub/armlinux/toolchain/src-2.95.3/gcc-2.95.3.diff.bz2
yann@402
     3
Not sure what it fixes, but this appears to be The Patch used with gcc-2.95.3 on arm.
yann@402
     4
--------- snip -------
yann@402
     5
yann@402
     6
diff -urN gcc-2.95.3-orig/gcc/config/arm/arm.c gcc-2.95.3/gcc/config/arm/arm.c
yann@402
     7
--- gcc-2.95.3-orig/gcc/config/arm/arm.c	Thu Jan 25 15:03:24 2001
yann@402
     8
+++ gcc-2.95.3/gcc/config/arm/arm.c	Fri Jul 20 19:39:11 2001
yann@402
     9
@@ -1529,27 +1529,34 @@
yann@402
    10
       return gen_rtx_PLUS (Pmode, base, offset);
yann@402
    11
     }
yann@402
    12
   else if (GET_CODE (orig) == LABEL_REF)
yann@402
    13
-    current_function_uses_pic_offset_table = 1;
yann@402
    14
-
yann@402
    15
-  return orig;
yann@402
    16
-}
yann@402
    17
+    {
yann@402
    18
+      current_function_uses_pic_offset_table = 1;
yann@402
    19
 
yann@402
    20
-static rtx pic_rtx;
yann@402
    21
+      if (NEED_PLT_GOT)
yann@402
    22
+	{
yann@402
    23
+	  rtx pic_ref, address = gen_reg_rtx (Pmode);
yann@402
    24
+	  
yann@402
    25
+	  emit_insn (gen_pic_load_addr (address, orig));
yann@402
    26
+	  pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
yann@402
    27
+				  address);
yann@402
    28
+	  emit_move_insn (address, pic_ref);
yann@402
    29
+	  return address;
yann@402
    30
+	}
yann@402
    31
+    }
yann@402
    32
 
yann@402
    33
-int
yann@402
    34
-is_pic(x)
yann@402
    35
-     rtx x;
yann@402
    36
-{
yann@402
    37
-  if (x == pic_rtx)
yann@402
    38
-    return 1;
yann@402
    39
-  return 0;
yann@402
    40
+  return orig;
yann@402
    41
 }
yann@402
    42
 
yann@402
    43
+/* Generate code to load the PIC register.  PROLOGUE is true if
yann@402
    44
+   called from arm_expand_prologue (in which case we want the 
yann@402
    45
+   generated insns at the start of the function);  false if called
yann@402
    46
+   by an exception receiver that needs the PIC register reloaded
yann@402
    47
+   (in which case the insns are just dumped at the current location).  */
yann@402
    48
 void
yann@402
    49
-arm_finalize_pic ()
yann@402
    50
+arm_finalize_pic (int prologue)
yann@402
    51
 {
yann@402
    52
 #ifndef AOF_ASSEMBLER
yann@402
    53
-  rtx l1, pic_tmp, pic_tmp2, seq;
yann@402
    54
+  rtx l1, pic_tmp, pic_tmp2, seq, pic_rtx;
yann@402
    55
   rtx global_offset_table;
yann@402
    56
 
yann@402
    57
   if (current_function_uses_pic_offset_table == 0)
yann@402
    58
@@ -1578,7 +1585,10 @@
yann@402
    59
 
yann@402
    60
   seq = gen_sequence ();
yann@402
    61
   end_sequence ();
yann@402
    62
-  emit_insn_after (seq, get_insns ());
yann@402
    63
+  if (prologue)
yann@402
    64
+    emit_insn_after (seq, get_insns ());
yann@402
    65
+  else
yann@402
    66
+    emit_insn (seq);
yann@402
    67
 
yann@402
    68
   /* Need to emit this whether or not we obey regdecls,
yann@402
    69
      since setjmp/longjmp can cause life info to screw up.  */
yann@402
    70
@@ -5327,7 +5337,13 @@
yann@402
    71
   if (frame_pointer_needed)
yann@402
    72
     live_regs += 4;
yann@402
    73
 
yann@402
    74
-  if (live_regs)
yann@402
    75
+  if (live_regs == 1 && regs_ever_live[LR_REGNUM]
yann@402
    76
+      && ! lr_save_eliminated && ! really_return)
yann@402
    77
+    {
yann@402
    78
+      output_asm_insn (reverse ? "ldr%?%D0\t%|lr, [%|sp}, #4"
yann@402
    79
+      		       : "ldr%?%d0\t%|lr, [%|sp], #4", &operand);
yann@402
    80
+    }
yann@402
    81
+  else if (live_regs)
yann@402
    82
     {
yann@402
    83
       if (lr_save_eliminated || ! regs_ever_live[14])
yann@402
    84
         live_regs++;
yann@402
    85
@@ -5446,7 +5462,7 @@
yann@402
    86
   rtx           x;
yann@402
    87
 
yann@402
    88
   length = strlen (name);
yann@402
    89
-  alignlength = (length + 1) + 3 & ~3;
yann@402
    90
+  alignlength = ((length + 1) + 3) & ~3;
yann@402
    91
   
yann@402
    92
   ASM_OUTPUT_ASCII (stream, name, length + 1);
yann@402
    93
   ASM_OUTPUT_ALIGN (stream, 2);
yann@402
    94
@@ -5838,6 +5854,9 @@
yann@402
    95
   int store_arg_regs = 0;
yann@402
    96
   int volatile_func = (optimize > 0
yann@402
    97
 		       && TREE_THIS_VOLATILE (current_function_decl));
yann@402
    98
+  rtx ip_rtx;
yann@402
    99
+  int fp_offset = 0;
yann@402
   100
+  rtx insn;
yann@402
   101
 
yann@402
   102
   /* Naked functions don't have prologues.  */
yann@402
   103
   if (arm_naked_function_p (current_function_decl))
yann@402
   104
@@ -5859,11 +5878,59 @@
yann@402
   105
 	live_regs_mask |= 0x4000;
yann@402
   106
     }
yann@402
   107
 
yann@402
   108
+  ip_rtx = gen_rtx_REG (SImode, IP_REGNUM);
yann@402
   109
+
yann@402
   110
   if (frame_pointer_needed)
yann@402
   111
     {
yann@402
   112
+      if (current_function_needs_context)
yann@402
   113
+	{
yann@402
   114
+	  /* The Static chain register is the same as the IP register
yann@402
   115
+	     used as a scratch register during stack frame creation.
yann@402
   116
+	     To get around this need to find somewhere to store IP
yann@402
   117
+	     whilst the frame is being created.  We try the following
yann@402
   118
+	     places in order:
yann@402
   119
+	     
yann@402
   120
+	       1. An unused argument register.
yann@402
   121
+	       2. A slot on the stack above the frame.  (This only
yann@402
   122
+	          works if the function is not a varargs function).
yann@402
   123
+		  
yann@402
   124
+	     If neither of these places is available, we abort (for now).  */
yann@402
   125
+	  if (regs_ever_live[3] == 0)
yann@402
   126
+	    {
yann@402
   127
+	      insn = gen_rtx_REG (SImode, 3);
yann@402
   128
+	      insn = gen_rtx_SET (SImode, insn, ip_rtx);
yann@402
   129
+	      insn = emit_insn (insn);
yann@402
   130
+	      RTX_FRAME_RELATED_P (insn) = 1;	  
yann@402
   131
+	    }
yann@402
   132
+	  else if (current_function_pretend_args_size == 0)
yann@402
   133
+	    {
yann@402
   134
+	      insn = gen_rtx_PRE_DEC (SImode, stack_pointer_rtx);
yann@402
   135
+	      insn = gen_rtx_MEM (SImode, insn);
yann@402
   136
+	      insn = gen_rtx_SET (VOIDmode, insn, ip_rtx);
yann@402
   137
+	      insn = emit_insn (insn);
yann@402
   138
+	      RTX_FRAME_RELATED_P (insn) = 1;
yann@402
   139
+	      fp_offset = 4;
yann@402
   140
+	    }
yann@402
   141
+	  else
yann@402
   142
+	    /* FIXME - the way to handle this situation is to allow
yann@402
   143
+	       the pretend args to be dumped onto the stack, then
yann@402
   144
+	       reuse r3 to save IP.  This would involve moving the
yann@402
   145
+	       copying os SP into IP until after the pretend args
yann@402
   146
+	       have been dumped, but this is not too hard.  */
yann@402
   147
+	    error ("Unable to find a temporary location for static chanin register");
yann@402
   148
+	}
yann@402
   149
+
yann@402
   150
       live_regs_mask |= 0xD800;
yann@402
   151
-      emit_insn (gen_movsi (gen_rtx_REG (SImode, 12),
yann@402
   152
-			    stack_pointer_rtx));
yann@402
   153
+      if (fp_offset)
yann@402
   154
+	{
yann@402
   155
+	  insn = gen_rtx_PLUS (SImode, stack_pointer_rtx, GEN_INT (fp_offset));
yann@402
   156
+	  insn = gen_rtx_SET  (SImode, ip_rtx, insn);
yann@402
   157
+	}
yann@402
   158
+      else
yann@402
   159
+	insn = gen_movsi (ip_rtx, stack_pointer_rtx);
yann@402
   160
+      
yann@402
   161
+       insn = emit_insn (insn);
yann@402
   162
+       RTX_FRAME_RELATED_P (insn) = 1;
yann@402
   163
     }
yann@402
   164
 
yann@402
   165
   if (current_function_pretend_args_size)
yann@402
   166
@@ -5927,9 +5994,31 @@
yann@402
   167
     }
yann@402
   168
 
yann@402
   169
   if (frame_pointer_needed)
yann@402
   170
-    emit_insn (gen_addsi3 (hard_frame_pointer_rtx, gen_rtx_REG (SImode, 12),
yann@402
   171
-			   (GEN_INT
yann@402
   172
-			    (-(4 + current_function_pretend_args_size)))));
yann@402
   173
+    {
yann@402
   174
+      insn = GEN_INT (-(4 + current_function_pretend_args_size + fp_offset));
yann@402
   175
+      insn = emit_insn (gen_addsi3 (hard_frame_pointer_rtx, ip_rtx, insn));
yann@402
   176
+      RTX_FRAME_RELATED_P (insn) = 1;
yann@402
   177
+      
yann@402
   178
+      if (current_function_needs_context)
yann@402
   179
+	{
yann@402
   180
+	  /* Recover the static chain register.  */
yann@402
   181
+	  if (regs_ever_live [3] == 0)
yann@402
   182
+	    {
yann@402
   183
+	      insn = gen_rtx_REG (SImode, 3);
yann@402
   184
+	      insn = gen_rtx_SET (SImode, ip_rtx, insn);
yann@402
   185
+	      insn = emit_insn (insn);
yann@402
   186
+	      RTX_FRAME_RELATED_P (insn) = 1;	  
yann@402
   187
+	    }
yann@402
   188
+	  else /* if (current_function_pretend_args_size == 0) */
yann@402
   189
+	    {
yann@402
   190
+	      insn = gen_rtx_PLUS (SImode, hard_frame_pointer_rtx, GEN_INT (4));
yann@402
   191
+	      insn = gen_rtx_MEM (SImode, insn);
yann@402
   192
+	      insn = gen_rtx_SET (SImode, ip_rtx, insn);
yann@402
   193
+	      insn = emit_insn (insn);
yann@402
   194
+	      RTX_FRAME_RELATED_P (insn) = 1;	  
yann@402
   195
+	    }
yann@402
   196
+	}
yann@402
   197
+    }
yann@402
   198
 
yann@402
   199
   if (amount != const0_rtx)
yann@402
   200
     {
yann@402
   201
diff -urN gcc-2.95.3-orig/gcc/config/arm/arm.h gcc-2.95.3/gcc/config/arm/arm.h
yann@402
   202
--- gcc-2.95.3-orig/gcc/config/arm/arm.h	Thu Jan 25 15:03:26 2001
yann@402
   203
+++ gcc-2.95.3/gcc/config/arm/arm.h	Fri Jul 20 19:39:11 2001
yann@402
   204
@@ -601,14 +601,20 @@
yann@402
   205
   (TREE_CODE (EXP) == STRING_CST        \
yann@402
   206
    && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
yann@402
   207
 
yann@402
   208
+#ifndef STRUCTURE_SIZE_BOUNDARY
yann@402
   209
 /* Every structures size must be a multiple of 32 bits.  */
yann@402
   210
 /* This is for compatibility with ARMCC.  ARM SDT Reference Manual
yann@402
   211
    (ARM DUI 0020D) page 2-20 says "Structures are aligned on word
yann@402
   212
    boundaries".  */
yann@402
   213
-#ifndef STRUCTURE_SIZE_BOUNDARY
yann@402
   214
-#define STRUCTURE_SIZE_BOUNDARY 32
yann@402
   215
+/* Setting this to 32 produces more efficient code, but the value set in previous
yann@402
   216
+   versions of this toolchain was 8, which produces more compact structures. The
yann@402
   217
+   command line option -mstructure_size_boundary=<n> can be used to change this
yann@402
   218
+   value.  */
yann@402
   219
+#define STRUCTURE_SIZE_BOUNDARY arm_structure_size_boundary
yann@402
   220
 #endif
yann@402
   221
 
yann@402
   222
+extern int arm_structure_size_boundary;
yann@402
   223
+
yann@402
   224
 /* Used when parsing command line option -mstructure_size_boundary.  */
yann@402
   225
 extern const char * structure_size_string;
yann@402
   226
 
yann@402
   227
@@ -768,6 +774,9 @@
yann@402
   228
 /* Specify the registers used for certain standard purposes.
yann@402
   229
    The values of these macros are register numbers.  */
yann@402
   230
 
yann@402
   231
+/* Register which holds return address from a subroutine call.  */
yann@402
   232
+#define LR_REGNUM		14
yann@402
   233
+
yann@402
   234
 /* Define this if the program counter is overloaded on a register.  */
yann@402
   235
 #define PC_REGNUM		15
yann@402
   236
 
yann@402
   237
@@ -777,6 +786,9 @@
yann@402
   238
 /* Base register for access to local variables of the function.  */
yann@402
   239
 #define FRAME_POINTER_REGNUM	25
yann@402
   240
 
yann@402
   241
+/* Scratch register - used in all kinds of places, eg trampolines.  */
yann@402
   242
+#define IP_REGNUM		12
yann@402
   243
+
yann@402
   244
 /* Define this to be where the real frame pointer is if it is not possible to
yann@402
   245
    work out the offset between the frame pointer and the automatic variables
yann@402
   246
    until after register allocation has taken place.  FRAME_POINTER_REGNUM
yann@402
   247
@@ -798,7 +810,7 @@
yann@402
   248
 /* The native (Norcroft) Pascal compiler for the ARM passes the static chain
yann@402
   249
    as an invisible last argument (possible since varargs don't exist in
yann@402
   250
    Pascal), so the following is not true.  */
yann@402
   251
-#define STATIC_CHAIN_REGNUM	8
yann@402
   252
+#define STATIC_CHAIN_REGNUM	12
yann@402
   253
 
yann@402
   254
 /* Register in which address to store a structure value
yann@402
   255
    is passed to a function.  */
yann@402
   256
@@ -1248,7 +1260,12 @@
yann@402
   257
 {									\
yann@402
   258
   int volatile_func = arm_volatile_func ();				\
yann@402
   259
   if ((FROM) == ARG_POINTER_REGNUM && (TO) == HARD_FRAME_POINTER_REGNUM)\
yann@402
   260
-    (OFFSET) = 0;							\
yann@402
   261
+    {                                                                   \
yann@402
   262
+      if (! current_function_needs_context || ! frame_pointer_needed)   \
yann@402
   263
+        (OFFSET) = 0;                                                   \
yann@402
   264
+      else                                                              \
yann@402
   265
+        (OFFSET) = 4;                                                   \
yann@402
   266
+    }                                                                   \
yann@402
   267
   else if ((FROM) == FRAME_POINTER_REGNUM				\
yann@402
   268
 	   && (TO) == STACK_POINTER_REGNUM)				\
yann@402
   269
     (OFFSET) = (current_function_outgoing_args_size			\
yann@402
   270
@@ -1379,8 +1396,10 @@
yann@402
   271
 
yann@402
   272
    On the ARM, allow any integer (invalid ones are removed later by insn
yann@402
   273
    patterns), nice doubles and symbol_refs which refer to the function's
yann@402
   274
-   constant pool XXX.  */
yann@402
   275
-#define LEGITIMATE_CONSTANT_P(X)	(! label_mentioned_p (X))
yann@402
   276
+   constant pool XXX.
yann@402
   277
+
yann@402
   278
+   When generating PIC code, allow anything.  */
yann@402
   279
+#define LEGITIMATE_CONSTANT_P(X)	(flag_pic || ! label_mentioned_p (X))
yann@402
   280
 
yann@402
   281
 /* Symbols in the text segment can be accessed without indirecting via the
yann@402
   282
    constant pool; it may take an extra binary operation, but this is still
yann@402
   283
@@ -1496,9 +1515,8 @@
yann@402
   284
 	      && INTVAL (op) <= 31)					\
yann@402
   285
 	    goto LABEL;							\
yann@402
   286
         }								\
yann@402
   287
-      /* NASTY: Since this limits the addressing of unsigned byte loads */      \
yann@402
   288
       range = ((MODE) == HImode || (MODE) == QImode)                    \
yann@402
   289
-              ? (arm_arch4 ? 256 : 4095) : 4096;                        \
yann@402
   290
+              ? (((MODE) == HImode && arm_arch4) ? 256 : 4095) : 4096;  \
yann@402
   291
       if (code == CONST_INT && INTVAL (INDEX) < range			\
yann@402
   292
 	  && INTVAL (INDEX) > -range)  	      				\
yann@402
   293
         goto LABEL;							\
yann@402
   294
@@ -1812,14 +1830,15 @@
yann@402
   295
    data addresses in memory.  */
yann@402
   296
 #define PIC_OFFSET_TABLE_REGNUM arm_pic_register
yann@402
   297
 
yann@402
   298
-#define FINALIZE_PIC arm_finalize_pic ()
yann@402
   299
+#define FINALIZE_PIC arm_finalize_pic (1)
yann@402
   300
 
yann@402
   301
-/* We can't directly access anything that contains a symbol,
yann@402
   302
+/* We can't directly access anything that contains a symbol or label,
yann@402
   303
    nor can we indirect via the constant pool.  */
yann@402
   304
 #define LEGITIMATE_PIC_OPERAND_P(X)				\
yann@402
   305
-	(! symbol_mentioned_p (X)				\
yann@402
   306
+	(! symbol_mentioned_p (X) && ! label_mentioned_p (X)	\
yann@402
   307
 	 && (! CONSTANT_POOL_ADDRESS_P (X)			\
yann@402
   308
-	     || ! symbol_mentioned_p (get_pool_constant (X))))
yann@402
   309
+	     || (! symbol_mentioned_p (get_pool_constant (X)))  \
yann@402
   310
+		&& (! label_mentioned_p (get_pool_constant (X)))))
yann@402
   311
  
yann@402
   312
 /* We need to know when we are making a constant pool; this determines
yann@402
   313
    whether data needs to be in the GOT or can be referenced via a GOT
yann@402
   314
@@ -2046,17 +2065,9 @@
yann@402
   315
   else output_addr_const(STREAM, X);					\
yann@402
   316
 }
yann@402
   317
 
yann@402
   318
-/* Handles PIC addr specially */
yann@402
   319
 #define OUTPUT_INT_ADDR_CONST(STREAM,X) \
yann@402
   320
   {									\
yann@402
   321
-    if (flag_pic && GET_CODE(X) == CONST && is_pic(X))			\
yann@402
   322
-      {									\
yann@402
   323
-	output_addr_const(STREAM, XEXP (XEXP (XEXP (X, 0), 0), 0));	\
yann@402
   324
-	fputs(" - (", STREAM);						\
yann@402
   325
-	output_addr_const(STREAM, XEXP (XEXP (XEXP (X, 0), 1), 0));	\
yann@402
   326
-	fputs(")", STREAM);						\
yann@402
   327
-      }									\
yann@402
   328
-    else output_addr_const(STREAM, X);					\
yann@402
   329
+    output_addr_const(STREAM, X);					\
yann@402
   330
 									\
yann@402
   331
     /* Mark symbols as position independent.  We only do this in the	\
yann@402
   332
       .text segment, not in the .data segment. */			\
yann@402
   333
@@ -2170,8 +2181,7 @@
yann@402
   334
 int    arm_return_in_memory PROTO ((Tree));
yann@402
   335
 int    legitimate_pic_operand_p PROTO ((Rtx));
yann@402
   336
 Rtx    legitimize_pic_address PROTO ((Rtx, Mmode, Rtx));
yann@402
   337
-int    is_pic PROTO ((Rtx));
yann@402
   338
-void   arm_finalize_pic PROTO ((void));
yann@402
   339
+void   arm_finalize_pic PROTO ((int));
yann@402
   340
 int    arm_rtx_costs RTX_CODE_PROTO ((Rtx, Rcode));
yann@402
   341
 int    arm_adjust_cost PROTO ((Rtx, Rtx, Rtx, int));
yann@402
   342
 int    const_double_rtx_ok_for_fpu PROTO ((Rtx));
yann@402
   343
diff -urN gcc-2.95.3-orig/gcc/config/arm/arm.md gcc-2.95.3/gcc/config/arm/arm.md
yann@402
   344
--- gcc-2.95.3-orig/gcc/config/arm/arm.md	Thu Jan 25 15:03:27 2001
yann@402
   345
+++ gcc-2.95.3/gcc/config/arm/arm.md	Fri Jul 20 19:39:11 2001
yann@402
   346
@@ -2629,7 +2629,8 @@
yann@402
   347
 			   : preserve_subexpressions_p ()));
yann@402
   348
       DONE;
yann@402
   349
     }
yann@402
   350
-  if (CONSTANT_P (operands[1]) && flag_pic)
yann@402
   351
+  if ((CONSTANT_P (operands[1]) || symbol_mentioned_p (operands[1])
yann@402
   352
+        || label_mentioned_p (operands[1])) && flag_pic)
yann@402
   353
     operands[1] = legitimize_pic_address (operands[1], SImode,
yann@402
   354
 					  ((reload_in_progress
yann@402
   355
 					    || reload_completed)
yann@402
   356
@@ -2721,6 +2722,15 @@
yann@402
   357
   return \"add%?\\t%0, %|pc, %0\";
yann@402
   358
 ")
yann@402
   359
 
yann@402
   360
+(define_expand "builtin_setjmp_receiver"
yann@402
   361
+  [(label_ref (match_operand 0 "" ""))]
yann@402
   362
+  "flag_pic"
yann@402
   363
+  "
yann@402
   364
+{
yann@402
   365
+  arm_finalize_pic (0);
yann@402
   366
+  DONE;
yann@402
   367
+}")
yann@402
   368
+
yann@402
   369
 ;; If copying one reg to another we can set the condition codes according to
yann@402
   370
 ;; its value.  Such a move is common after a return from subroutine and the
yann@402
   371
 ;; result is being tested against zero.
yann@402
   372
@@ -6184,15 +6194,20 @@
yann@402
   373
 	abort ();
yann@402
   374
       return \"\";
yann@402
   375
     }
yann@402
   376
-  strcpy (pattern, \"stmfd\\t%m0!, {%1\");
yann@402
   377
-  for (i = 1; i < XVECLEN (operands[2], 0); i++)
yann@402
   378
+  if (XVECLEN (operands[2], 0) > 1)
yann@402
   379
     {
yann@402
   380
-      strcat (pattern, \", %|\");
yann@402
   381
-      strcat (pattern, reg_names[REGNO (XEXP (XVECEXP (operands[2], 0, i),
yann@402
   382
+      strcpy (pattern, \"stmfd\\t%m0!, {%1\");
yann@402
   383
+      for (i = 1; i < XVECLEN (operands[2], 0); i++)
yann@402
   384
+        {
yann@402
   385
+           strcat (pattern, \", %|\");
yann@402
   386
+           strcat (pattern, reg_names[REGNO (XEXP (XVECEXP (operands[2], 0, i),
yann@402
   387
 					      0))]);
yann@402
   388
+        }
yann@402
   389
+      strcat (pattern, \"}\");
yann@402
   390
+      output_asm_insn (pattern, operands);
yann@402
   391
     }
yann@402
   392
-  strcat (pattern, \"}\");
yann@402
   393
-  output_asm_insn (pattern, operands);
yann@402
   394
+  else
yann@402
   395
+    output_asm_insn (\"str\\t%1, [%m0, #-4]!\", operands);
yann@402
   396
   return \"\";
yann@402
   397
 }"
yann@402
   398
 [(set_attr "type" "store4")])
yann@402
   399
diff -urN gcc-2.95.3-orig/gcc/config/arm/elf.h gcc-2.95.3/gcc/config/arm/elf.h
yann@402
   400
--- gcc-2.95.3-orig/gcc/config/arm/elf.h	Mon May 31 10:21:53 1999
yann@402
   401
+++ gcc-2.95.3/gcc/config/arm/elf.h	Fri Jul 20 19:39:11 2001
yann@402
   402
@@ -167,15 +167,6 @@
yann@402
   403
 #define MULTILIB_DEFAULTS { "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" }
yann@402
   404
 #endif
yann@402
   405
 
yann@402
   406
-/* Setting this to 32 produces more efficient code, but the value set in previous
yann@402
   407
-   versions of this toolchain was 8, which produces more compact structures. The
yann@402
   408
-   command line option -mstructure_size_boundary=<n> can be used to change this
yann@402
   409
-   value.  */
yann@402
   410
-#undef  STRUCTURE_SIZE_BOUNDARY
yann@402
   411
-#define STRUCTURE_SIZE_BOUNDARY arm_structure_size_boundary
yann@402
   412
-
yann@402
   413
-extern int arm_structure_size_boundary;
yann@402
   414
-
yann@402
   415
 /* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
yann@402
   416
    is a valid machine specific attribute for DECL.
yann@402
   417
    The attributes in ATTRIBUTES have previously been assigned to DECL.  */
yann@402
   418
diff -urN gcc-2.95.3-orig/gcc/config/arm/linux-gas.h gcc-2.95.3/gcc/config/arm/linux-gas.h
yann@402
   419
--- gcc-2.95.3-orig/gcc/config/arm/linux-gas.h	Mon Feb 22 17:47:57 1999
yann@402
   420
+++ gcc-2.95.3/gcc/config/arm/linux-gas.h	Fri Jul 20 19:39:11 2001
yann@402
   421
@@ -1,6 +1,6 @@
yann@402
   422
 /* Definitions of target machine for GNU compiler.
yann@402
   423
    ARM Linux-based GNU systems version.
yann@402
   424
-   Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
yann@402
   425
+   Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
yann@402
   426
    Contributed by Russell King  <rmk92@ecs.soton.ac.uk>.
yann@402
   427
 
yann@402
   428
 This file is part of GNU CC.
yann@402
   429
@@ -79,5 +79,7 @@
yann@402
   430
   register unsigned long _beg __asm ("a1") = (unsigned long) (BEG);	\
yann@402
   431
   register unsigned long _end __asm ("a2") = (unsigned long) (END);	\
yann@402
   432
   register unsigned long _flg __asm ("a3") = 0;				\
yann@402
   433
-  __asm __volatile ("swi 0x9f0002");					\
yann@402
   434
+  __asm __volatile ("swi 0x9f0002		@ sys_cacheflush"	\
yann@402
   435
+		    : "=r" (_beg)					\
yann@402
   436
+		    : "0" (_beg), "r" (_end), "r" (_flg));		\
yann@402
   437
 }
yann@402
   438
diff -urN gcc-2.95.3-orig/gcc/config/arm/t-linux gcc-2.95.3/gcc/config/arm/t-linux
yann@402
   439
--- gcc-2.95.3-orig/gcc/config/arm/t-linux	Fri Mar 26 16:30:20 1999
yann@402
   440
+++ gcc-2.95.3/gcc/config/arm/t-linux	Fri Jul 20 20:46:19 2001
yann@402
   441
@@ -1,6 +1,6 @@
yann@402
   442
 # Just for these, we omit the frame pointer since it makes such a big
yann@402
   443
 # difference.  It is then pointless adding debugging.
yann@402
   444
-TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC
yann@402
   445
+TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC 
yann@402
   446
 LIBGCC2_DEBUG_CFLAGS = -g0
yann@402
   447
 
yann@402
   448
 # Don't build enquire
yann@402
   449
diff -urN gcc-2.95.3-orig/gcc/final.c gcc-2.95.3/gcc/final.c
yann@402
   450
--- gcc-2.95.3-orig/gcc/final.c	Mon Mar 12 13:07:59 2001
yann@402
   451
+++ gcc-2.95.3/gcc/final.c	Fri Jul 20 19:39:11 2001
yann@402
   452
@@ -3652,8 +3652,9 @@
yann@402
   453
 
yann@402
   454
       output_addr_const (file, XEXP (x, 0));
yann@402
   455
       fprintf (file, "-");
yann@402
   456
-      if (GET_CODE (XEXP (x, 1)) == CONST_INT
yann@402
   457
-	  && INTVAL (XEXP (x, 1)) < 0)
yann@402
   458
+      if ((GET_CODE (XEXP (x, 1)) == CONST_INT
yann@402
   459
+	   && INTVAL (XEXP (x, 1)) < 0)
yann@402
   460
+	  || GET_CODE (XEXP (x, 1)) != CONST_INT)
yann@402
   461
 	{
yann@402
   462
 	  fprintf (file, ASM_OPEN_PAREN);
yann@402
   463
 	  output_addr_const (file, XEXP (x, 1));
yann@402
   464
diff -urN gcc-2.95.3-orig/gcc/function.c gcc-2.95.3/gcc/function.c
yann@402
   465
--- gcc-2.95.3-orig/gcc/function.c	Thu Jan 25 15:03:15 2001
yann@402
   466
+++ gcc-2.95.3/gcc/function.c	Fri Jul 20 19:39:10 2001
yann@402
   467
@@ -3053,6 +3053,105 @@
yann@402
   468
    extracted by usage MEM with narrower mode. */
yann@402
   469
 static rtx purge_addressof_replacements;
yann@402
   470
 
yann@402
   471
+/* Return 1 if X and Y are identical-looking rtx's.
yann@402
   472
+   This is the Lisp function EQUAL for rtx arguments.  */
yann@402
   473
+
yann@402
   474
+int
yann@402
   475
+rtx_equal_for_addressof_p (x, y)
yann@402
   476
+     rtx x, y;
yann@402
   477
+{
yann@402
   478
+  register int i;
yann@402
   479
+  register int j;
yann@402
   480
+  register enum rtx_code code;
yann@402
   481
+  register char *fmt;
yann@402
   482
+
yann@402
   483
+  if (x == y)
yann@402
   484
+    return 1;
yann@402
   485
+  if (x == 0 || y == 0)
yann@402
   486
+    return 0;
yann@402
   487
+
yann@402
   488
+  code = GET_CODE (x);
yann@402
   489
+  /* Rtx's of different codes cannot be equal.  */
yann@402
   490
+  if (code != GET_CODE (y))
yann@402
   491
+    return 0;
yann@402
   492
+
yann@402
   493
+  /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
yann@402
   494
+     (REG:SI x) and (REG:HI x) are NOT equivalent. 
yann@402
   495
+     But (MEM:SI x) and (MEM:HI x) are equivalent for our purposes.  */
yann@402
   496
+
yann@402
   497
+  if (code != MEM && (GET_MODE (x) != GET_MODE (y)))
yann@402
   498
+    return 0;
yann@402
   499
+
yann@402
   500
+  /* REG, LABEL_REF, and SYMBOL_REF can be compared nonrecursively.  */
yann@402
   501
+
yann@402
   502
+  if (code == REG)
yann@402
   503
+    return REGNO (x) == REGNO (y);
yann@402
   504
+  else if (code == LABEL_REF)
yann@402
   505
+    return XEXP (x, 0) == XEXP (y, 0);
yann@402
   506
+  else if (code == SYMBOL_REF)
yann@402
   507
+    return XSTR (x, 0) == XSTR (y, 0);
yann@402
   508
+  else if (code == SCRATCH || code == CONST_DOUBLE)
yann@402
   509
+    return 0;
yann@402
   510
+
yann@402
   511
+  /* Compare the elements.  If any pair of corresponding elements
yann@402
   512
+     fail to match, return 0 for the whole things.  */
yann@402
   513
+
yann@402
   514
+  fmt = GET_RTX_FORMAT (code);
yann@402
   515
+  for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
yann@402
   516
+    {
yann@402
   517
+      switch (fmt[i])
yann@402
   518
+	{
yann@402
   519
+	case 'w':
yann@402
   520
+	  if (XWINT (x, i) != XWINT (y, i))
yann@402
   521
+	    return 0;
yann@402
   522
+	  break;
yann@402
   523
+
yann@402
   524
+	case 'n':
yann@402
   525
+	case 'i':
yann@402
   526
+	  if (XINT (x, i) != XINT (y, i))
yann@402
   527
+	    return 0;
yann@402
   528
+	  break;
yann@402
   529
+
yann@402
   530
+	case 'V':
yann@402
   531
+	case 'E':
yann@402
   532
+	  /* Two vectors must have the same length.  */
yann@402
   533
+	  if (XVECLEN (x, i) != XVECLEN (y, i))
yann@402
   534
+	    return 0;
yann@402
   535
+
yann@402
   536
+	  /* And the corresponding elements must match.  */
yann@402
   537
+	  for (j = 0; j < XVECLEN (x, i); j++)
yann@402
   538
+	    if (rtx_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j)) == 0)
yann@402
   539
+	      return 0;
yann@402
   540
+	  break;
yann@402
   541
+
yann@402
   542
+	case 'e':
yann@402
   543
+	  if (rtx_equal_p (XEXP (x, i), XEXP (y, i)) == 0)
yann@402
   544
+	    return 0;
yann@402
   545
+	  break;
yann@402
   546
+
yann@402
   547
+	case 'S':
yann@402
   548
+	case 's':
yann@402
   549
+	  if (strcmp (XSTR (x, i), XSTR (y, i)))
yann@402
   550
+	    return 0;
yann@402
   551
+	  break;
yann@402
   552
+
yann@402
   553
+	case 'u':
yann@402
   554
+	  /* These are just backpointers, so they don't matter.  */
yann@402
   555
+	  break;
yann@402
   556
+
yann@402
   557
+	case '0':
yann@402
   558
+	  break;
yann@402
   559
+
yann@402
   560
+	  /* It is believed that rtx's at this level will never
yann@402
   561
+	     contain anything but integers and other rtx's,
yann@402
   562
+	     except for within LABEL_REFs and SYMBOL_REFs.  */
yann@402
   563
+	default:
yann@402
   564
+	  abort ();
yann@402
   565
+	}
yann@402
   566
+    }
yann@402
   567
+  return 1;
yann@402
   568
+}
yann@402
   569
+
yann@402
   570
 /* Helper function for purge_addressof.  See if the rtx expression at *LOC
yann@402
   571
    in INSN needs to be changed.  If FORCE, always put any ADDRESSOFs into
yann@402
   572
    the stack.  */
yann@402
   573
@@ -3133,7 +3232,7 @@
yann@402
   574
 	      for (tem = purge_bitfield_addressof_replacements;
yann@402
   575
 		   tem != NULL_RTX;
yann@402
   576
 		   tem = XEXP (XEXP (tem, 1), 1))
yann@402
   577
-		if (rtx_equal_p (x, XEXP (tem, 0)))
yann@402
   578
+		if (rtx_equal_for_addressof_p (x, XEXP (tem, 0)))
yann@402
   579
 		  {
yann@402
   580
 		    *loc = XEXP (XEXP (tem, 1), 0);
yann@402
   581
 		    return;
yann@402
   582
@@ -3143,7 +3242,7 @@
yann@402
   583
 	      for (tem = purge_addressof_replacements;
yann@402
   584
 		   tem != NULL_RTX;
yann@402
   585
 		   tem = XEXP (XEXP (tem, 1), 1))
yann@402
   586
-		if (rtx_equal_p (XEXP (x, 0), XEXP (tem, 0)))
yann@402
   587
+		if (rtx_equal_for_addressof_p (XEXP (x, 0), XEXP (tem, 0)))
yann@402
   588
 		  {
yann@402
   589
 		    rtx z = XEXP (XEXP (tem, 1), 0);
yann@402
   590
 
yann@402
   591
diff -urN gcc-2.95.3-orig/gcc/jump.c gcc-2.95.3/gcc/jump.c
yann@402
   592
--- gcc-2.95.3-orig/gcc/jump.c	Thu Oct 21 08:24:03 1999
yann@402
   593
+++ gcc-2.95.3/gcc/jump.c	Fri Jul 20 19:39:10 2001
yann@402
   594
@@ -115,7 +115,7 @@
yann@402
   595
 static rtx delete_unreferenced_labels	PROTO((rtx));
yann@402
   596
 static void delete_noop_moves		PROTO((rtx));
yann@402
   597
 static int calculate_can_reach_end	PROTO((rtx, int, int));
yann@402
   598
-static int duplicate_loop_exit_test	PROTO((rtx));
yann@402
   599
+static int duplicate_loop_exit_test	PROTO((rtx, int));
yann@402
   600
 static void find_cross_jump		PROTO((rtx, rtx, int, rtx *, rtx *));
yann@402
   601
 static void do_cross_jump		PROTO((rtx, rtx, rtx));
yann@402
   602
 static int jump_back_p			PROTO((rtx, rtx));
yann@402
   603
@@ -338,7 +338,7 @@
yann@402
   604
 	      && simplejump_p (temp1))
yann@402
   605
 	    {
yann@402
   606
 	      temp = PREV_INSN (insn);
yann@402
   607
-	      if (duplicate_loop_exit_test (insn))
yann@402
   608
+	      if (duplicate_loop_exit_test (insn, after_regscan))
yann@402
   609
 		{
yann@402
   610
 		  changed = 1;
yann@402
   611
 		  next = NEXT_INSN (temp);
yann@402
   612
@@ -2548,8 +2548,9 @@
yann@402
   613
    values of regno_first_uid and regno_last_uid.  */
yann@402
   614
 
yann@402
   615
 static int
yann@402
   616
-duplicate_loop_exit_test (loop_start)
yann@402
   617
+duplicate_loop_exit_test (loop_start, after_regscan)
yann@402
   618
      rtx loop_start;
yann@402
   619
+     int after_regscan;
yann@402
   620
 {
yann@402
   621
   rtx insn, set, reg, p, link;
yann@402
   622
   rtx copy = 0, first_copy = 0;
yann@402
   623
@@ -2662,6 +2663,9 @@
yann@402
   624
 	    reg_map[REGNO (reg)] = gen_reg_rtx (GET_MODE (reg));
yann@402
   625
 	  }
yann@402
   626
       }
yann@402
   627
+
yann@402
   628
+  if (after_regscan)
yann@402
   629
+    reg_scan_update (exitcode, lastexit, max_reg);
yann@402
   630
 
yann@402
   631
   /* Now copy each insn.  */
yann@402
   632
   for (insn = exitcode; insn != lastexit; insn = NEXT_INSN (insn))
yann@402
   633
diff -urN gcc-2.95.3-orig/gcc/varasm.c gcc-2.95.3/gcc/varasm.c
yann@402
   634
--- gcc-2.95.3-orig/gcc/varasm.c	Mon Feb 19 15:02:02 2001
yann@402
   635
+++ gcc-2.95.3/gcc/varasm.c	Fri Jul 20 19:39:11 2001
yann@402
   636
@@ -3286,7 +3286,10 @@
yann@402
   637
 	  value->un.addr.offset = - INTVAL (XEXP (x, 1));
yann@402
   638
 	}
yann@402
   639
       else
yann@402
   640
-	abort ();
yann@402
   641
+	{
yann@402
   642
+	  value->un.addr.base = x;
yann@402
   643
+	  value->un.addr.offset = 0;
yann@402
   644
+	}
yann@402
   645
       break;
yann@402
   646
 
yann@402
   647
     default: