summaryrefslogtreecommitdiff
blob: af4de7908197e5937f63ef8e3c79f1badf9fd73b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
--- gcc-2.95.3-orig/gcc/c-common.c	Tue Sep  7 03:11:16 1999
+++ gcc-2.95.3/gcc/c-common.c	Tue Aug 14 11:15:53 2001
@@ -697,7 +697,23 @@
 	    if (exact_log2 (align) == -1)
 	      error ("requested alignment is not a power of 2");
 	    else if (is_type)
-	      TYPE_ALIGN (type) = align;
+	      {
+		/* If we have a TYPE_DECL, then copy the type, so that we
+		   don't accidentally modify a builtin type.  See pushdecl.  */
+		if (decl && TREE_TYPE (decl) != error_mark_node
+		    && DECL_ORIGINAL_TYPE (decl) == NULL_TREE)
+		  {
+		    tree tt = TREE_TYPE (decl);
+		    DECL_ORIGINAL_TYPE (decl) = tt;
+		    tt = build_type_copy (tt);
+		    TYPE_NAME (tt) = decl;
+		    TREE_USED (tt) = TREE_USED (decl);
+		    TREE_TYPE (decl) = tt;
+		    type = tt;
+		  }
+
+		TYPE_ALIGN (type) = align;
+	      }
 	    else if (TREE_CODE (decl) != VAR_DECL
 		     && TREE_CODE (decl) != FIELD_DECL)
 	      error_with_decl (decl,
--- gcc-2.95.3-orig/gcc/config/alpha/crtbegin.asm	Wed Dec 16 15:00:53 1998
+++ gcc-2.95.3/gcc/config/alpha/crtbegin.asm	Tue Aug 14 11:15:53 2001
@@ -97,6 +97,31 @@
  # Support recursive calls to exit.
 $ptr:	.quad	__DTOR_LIST__
 
+/* A globally unique widget for c++ local destructors to hang off.
+
+   This has a unique value in every dso; in the main program its
+   value is zero.  The object should be protected.  This means the
+   instance in any dso or the main program is not used in any other
+   dso.  The dynamic linker takes care of this.  */
+
+       .global __dso_handle
+       .type __dso_handle,@object
+       .size __dso_handle,8
+#ifdef SHARED
+.section .data
+       .align 3
+__dso_handle:
+       .quad   __dso_handle
+#else
+.section .bss
+       .align 3
+__dso_handle:
+       .zero 8
+#endif
+#ifdef HAVE_GAS_HIDDEN
+       .hidden __dso_handle
+#endif
+
 .text
 
 	.align 3
--- gcc-2.95.3-orig/gcc/config/i386/i386.c	Tue Sep  7 02:38:56 1999
+++ gcc-2.95.3/gcc/config/i386/i386.c	Tue Aug 14 11:17:15 2001
@@ -291,7 +291,7 @@
 
   if (ix86_arch_string == 0)
     {
-      ix86_arch_string = PROCESSOR_PENTIUM_STRING;
+      ix86_arch_string = PROCESSOR_DEFAULT_STRING;
       if (ix86_cpu_string == 0)
 	ix86_cpu_string = PROCESSOR_DEFAULT_STRING;
     }
@@ -308,7 +308,7 @@
   if (i == ptt_size)
     {
       error ("bad value (%s) for -march= switch", ix86_arch_string);
-      ix86_arch_string = PROCESSOR_PENTIUM_STRING;
+      ix86_arch_string = PROCESSOR_DEFAULT_STRING;
       ix86_arch = PROCESSOR_DEFAULT;
     }
 
--- gcc-2.95.3-orig/gcc/config/i386/linux.h	Wed Apr  7 19:32:13 1999
+++ gcc-2.95.3/gcc/config/i386/linux.h	Tue Aug 14 11:15:53 2001
@@ -234,3 +234,21 @@
     }									\
   } while (0)
 #endif
+
+#if defined(__PIC__) && defined (USE_GNULIBC_1)
+/* This is a kludge. The i386 GNU/Linux dynamic linker needs ___brk_addr,
+   __environ and atexit (). We have to make sure they are in the .dynsym
+   section. We accomplish it by making a dummy call here. This
+   code is never reached.  */
+
+#define CRT_END_INIT_DUMMY             \
+  do                                   \
+    {                                  \
+      extern void *___brk_addr;                \
+      extern char **__environ;         \
+                                       \
+      ___brk_addr = __environ;         \
+      atexit (0);                      \
+    }                                  \
+  while (0)
+#endif
--- gcc-2.95.3-orig/gcc/config/rs6000/rs6000.md	Thu Jan 25 08:03:35 2001
+++ gcc-2.95.3/gcc/config/rs6000/rs6000.md	Tue Aug 14 11:15:53 2001
@@ -6184,7 +6184,9 @@
      reg.  So expand it.  */
   if (GET_CODE (operands[0]) == SUBREG
       && GET_CODE (SUBREG_REG (operands[0])) == REG
-      && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
+      && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER
+      && (! REG_FUNCTION_VALUE_P (SUBREG_REG (operands[0]))
+	  || ! rtx_equal_function_value_matters))
     operands[0] = alter_subreg (operands[0]);
   if (GET_CODE (operands[1]) == SUBREG
       && GET_CODE (SUBREG_REG (operands[1])) == REG
--- gcc-2.95.3-orig/gcc/crtstuff.c	Mon Mar 22 18:43:51 1999
+++ gcc-2.95.3/gcc/crtstuff.c	Tue Aug 14 11:15:53 2001
@@ -55,6 +55,7 @@
 #include "defaults.h"
 #include <stddef.h>
 #include "frame.h"
+#include "auto-host.h"
 
 /* We do not want to add the weak attribute to the declarations of these
    routines in frame.h because that will cause the definition of these
@@ -134,6 +135,29 @@
 #ifdef INIT_SECTION_ASM_OP
 
 #ifdef OBJECT_FORMAT_ELF
+/* Declare the __dso_handle variable.  It should have a unique value
+   in every shared-object; in a main program its value is zero.  The
+   object should in any case be protected.  This means the instance
+   in one DSO or the main program is not used in another object.  The
+   dynamic linker takes care of this.  */
+
+/* XXX Ideally the following should be implemented using
+   __attribute__ ((__visibility__ ("hidden")))
+   but the __attribute__ support is not yet there.  */
+#define HAVE_GAS_HIDDEN 1
+#ifdef HAVE_GAS_HIDDEN
+asm (".hidden\t__dso_handle");
+#endif
+
+#ifdef CRTSTUFFS_O
+void *__dso_handle = &__dso_handle;
+#else
+void *__dso_handle = 0;
+#endif
+
+/* The __cxa_finalize function may not be available so we use only a
+   weak declaration.  */
+extern void __cxa_finalize (void *) TARGET_ATTRIBUTE_WEAK;
 
 /* Run all the global destructors on exit from the program.  */
  
@@ -165,6 +189,11 @@
   if (completed)
     return;
 
+#ifdef CRTSTUFFS_O
+  if (__cxa_finalize)
+    __cxa_finalize (__dso_handle);
+#endif
+
   while (*p)
     {
       p++;
@@ -379,20 +408,8 @@
   FORCE_INIT_SECTION_ALIGN;
 #endif
   asm (TEXT_SECTION_ASM_OP);
-
-/* This is a kludge. The i386 GNU/Linux dynamic linker needs ___brk_addr,
-   __environ and atexit (). We have to make sure they are in the .dynsym
-   section. We accomplish it by making a dummy call here. This
-   code is never reached.  */
- 
-#if defined(__linux__) && defined(__PIC__) && defined(__i386__)
-  {
-    extern void *___brk_addr;
-    extern char **__environ;
-
-    ___brk_addr = __environ;
-    atexit ();
-  }
+#ifdef CRT_END_INIT_DUMMY
+  CRT_END_INIT_DUMMY;
 #endif
 }
 
--- gcc-2.95.3-orig/gcc/cse.c	Thu Jan 25 08:03:03 2001
+++ gcc-2.95.3/gcc/cse.c	Tue Aug 14 11:15:53 2001
@@ -695,8 +695,6 @@
 static struct cse_reg_info* get_cse_reg_info PROTO((int));
 static void free_cse_reg_info   PROTO((splay_tree_value));
 static void flush_hash_table	PROTO((void));
-
-extern int rtx_equal_function_value_matters;
 
 /* Dump the expressions in the equivalence class indicated by CLASSP.
    This function is used only for debugging.  */
--- gcc-2.95.3-orig/gcc/function.c	Thu Jan 25 08:03:15 2001
+++ gcc-2.95.3/gcc/function.c	Tue Aug 14 11:15:53 2001
@@ -5292,7 +5292,18 @@
 				- offset_ptr->constant); 
     }
 #else /* !ARGS_GROW_DOWNWARD */
-  pad_to_arg_alignment (initial_offset_ptr, boundary);
+  if (!in_regs 
+#ifdef REG_PARM_STACK_SPACE
+      || REG_PARM_STACK_SPACE (fndecl) > 0
+#else
+      /* For the gcc-2_95-branch we want to make sure not to break something
+         on platforms which pass argument in registers but don't define
+         REG_PARM_STACK_SPACE. So we force the original behaviour here.  */
+      || 1
+#endif
+      )
+    pad_to_arg_alignment (initial_offset_ptr, boundary);
+
   *offset_ptr = *initial_offset_ptr;
 
 #ifdef PUSH_ROUNDING
--- gcc-2.95.3-orig/gcc/rtl.h	Thu Jan 25 08:03:22 2001
+++ gcc-2.95.3/gcc/rtl.h	Tue Aug 14 11:16:20 2001
@@ -168,7 +168,8 @@
      either changing how we compute the frame address or saving and
      restoring registers in the prologue and epilogue.  
      1 in a MEM if the MEM refers to a scalar, rather than a member of
-     an aggregate.  */
+     an aggregate.
+     1 in a SYMBOL_REF if the symbol is weak.  */
   unsigned frame_related : 1;
   /* The first element of the operands of this rtx.
      The number of operands and their types are controlled
@@ -661,6 +662,9 @@
 /* 1 means a SYMBOL_REF has been the library function in emit_library_call.  */
 #define SYMBOL_REF_USED(RTX) ((RTX)->used)
 
+/* 1 means a SYMBOL_REF is weak.  */
+#define SYMBOL_REF_WEAK(RTX) ((RTX)->frame_related)
+
 /* For an INLINE_HEADER rtx, FIRST_FUNCTION_INSN is the first insn
    of the function that is not involved in copying parameters to
    pseudo-registers.  FIRST_PARM_INSN is the very first insn of
@@ -888,6 +892,12 @@
 /* For a NOTE_INSN_LIVE note, the original basic block number.  */
 #define RANGE_LIVE_ORIG_BLOCK(INSN) (XINT (INSN, 1))
 
+/* Nonzero if we need to distinguish between the return value of this function
+   and the return value of a function called by this function.  This helps
+   integrate.c.
+   This is 1 until after the rtl generation pass.  */
+extern int rtx_equal_function_value_matters;
+
 /* Generally useful functions.  */
 
 /* The following functions accept a wide integer argument.  Rather than
--- gcc-2.95.3-orig/gcc/rtlanal.c	Thu Jan 25 08:03:22 2001
+++ gcc-2.95.3/gcc/rtlanal.c	Tue Aug 14 11:16:20 2001
@@ -136,11 +136,9 @@
   switch (code)
     {
     case SYMBOL_REF:
+      return SYMBOL_REF_WEAK (x);
+
     case LABEL_REF:
-      /* SYMBOL_REF is problematic due to the possible presence of
-	 a #pragma weak, but to say that loads from symbols can trap is
-	 *very* costly.  It's not at all clear what's best here.  For
-	 now, we ignore the impact of #pragma weak.  */
       return 0;
 
     case REG:
--- gcc-2.95.3-orig/gcc/stor-layout.c	Thu Mar 11 07:56:20 1999
+++ gcc-2.95.3/gcc/stor-layout.c	Tue Aug 14 11:15:53 2001
@@ -264,8 +264,8 @@
       if (spec_size == 0 && DECL_NAME (decl) != 0)
 	abort ();
 
-      /* Size is specified number of bits.  */
-      DECL_SIZE (decl) = size_int (spec_size);
+      /* Size is specified in number of bits.  */
+      DECL_SIZE (decl) = bitsize_int (spec_size, 0);
     }
   /* Force alignment required for the data type.
      But if the decl itself wants greater alignment, don't override that.
@@ -301,7 +301,7 @@
 	  DECL_ALIGN (decl) = MAX ((unsigned) GET_MODE_ALIGNMENT (xmode),
 				   DECL_ALIGN (decl));
 	  DECL_MODE (decl) = xmode;
-	  DECL_SIZE (decl) = size_int (GET_MODE_BITSIZE (xmode));
+	  DECL_SIZE (decl) = bitsize_int (GET_MODE_BITSIZE (xmode), 0);
 	  /* This no longer needs to be accessed as a bit field.  */
 	  DECL_BIT_FIELD (decl) = 0;
 	}
@@ -520,7 +520,7 @@
 	DECL_FIELD_BITPOS (field) = var_size;
       else
 	{
-	  DECL_FIELD_BITPOS (field) = size_int (const_size);
+	  DECL_FIELD_BITPOS (field) = bitsize_int (const_size, 0L);
 
 	  /* If this field ended up more aligned than we thought it
 	     would be (we approximate this by seeing if its position
@@ -562,7 +562,7 @@
 
   if (var_size == 0)
     {
-      TYPE_SIZE (rec) = size_int (const_size);
+      TYPE_SIZE (rec) = bitsize_int (const_size, 0L);
     }
   else
     {
@@ -610,7 +610,7 @@
   /* The size of the union, based on the fields scanned so far,
      is max (CONST_SIZE, VAR_SIZE).
      VAR_SIZE may be null; then CONST_SIZE by itself is the size.  */
-  register int const_size = 0;
+  register HOST_WIDE_INT const_size = 0;
   register tree var_size = 0;
 
 #ifdef STRUCTURE_SIZE_BOUNDARY
@@ -627,6 +627,8 @@
 
   for (field = TYPE_FIELDS (rec); field; field = TREE_CHAIN (field))
     {
+      tree dsize;
+      
       /* Enums which are local to this class need not be laid out.  */
       if (TREE_CODE (field) == CONST_DECL || TREE_CODE (field) == TYPE_DECL)
 	continue;
@@ -645,19 +647,22 @@
 	union_align = MAX (union_align, TYPE_ALIGN (TREE_TYPE (field)));
 #endif
 
+      dsize = DECL_SIZE (field);
       if (TREE_CODE (rec) == UNION_TYPE)
 	{
 	  /* Set union_size to max (decl_size, union_size).
 	     There are more and less general ways to do this.
 	     Use only CONST_SIZE unless forced to use VAR_SIZE.  */
 
-	  if (TREE_CODE (DECL_SIZE (field)) == INTEGER_CST)
+	  if (TREE_CODE (dsize) == INTEGER_CST
+              && ! TREE_CONSTANT_OVERFLOW (dsize)
+              && TREE_INT_CST_HIGH (dsize) == 0)
 	    const_size
-	      = MAX (const_size, TREE_INT_CST_LOW (DECL_SIZE (field)));
+	      = MAX (const_size, TREE_INT_CST_LOW (dsize));
 	  else if (var_size == 0)
-	    var_size = DECL_SIZE (field);
+	    var_size = dsize;
 	  else
-	    var_size = size_binop (MAX_EXPR, var_size, DECL_SIZE (field));
+	    var_size = size_binop (MAX_EXPR, var_size, dsize);
 	}
       else if (TREE_CODE (rec) == QUAL_UNION_TYPE)
 	var_size = fold (build (COND_EXPR, sizetype, DECL_QUALIFIER (field),
--- gcc-2.95.3-orig/gcc/toplev.c	Thu Jan 25 08:03:23 2001
+++ gcc-2.95.3/gcc/toplev.c	Tue Aug 14 11:15:53 2001
@@ -137,8 +137,6 @@
 #define DIR_SEPARATOR '/'
 #endif
 
-extern int rtx_equal_function_value_matters;
-
 #if ! (defined (VMS) || defined (OS2))
 extern char **environ;
 #endif
--- gcc-2.95.3-orig/gcc/varasm.c	Mon Feb 19 08:02:02 2001
+++ gcc-2.95.3/gcc/varasm.c	Tue Aug 14 11:16:20 2001
@@ -723,6 +723,8 @@
 	 Also handle vars declared register invalidly.  */
       if (DECL_RTL (decl) == 0)
 	{
+	  rtx x;
+
 	  /* Can't use just the variable's own name for a variable
 	     whose scope is less than the whole file.
 	     Concatenate a distinguishing number.  */
@@ -752,8 +754,10 @@
 	      			   new_name, strlen (new_name));
 	    }
 
-	  DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl),
-					 gen_rtx_SYMBOL_REF (Pmode, name));
+	  x = gen_rtx_SYMBOL_REF (Pmode, name);
+	  SYMBOL_REF_WEAK (x) = DECL_WEAK (decl);
+	  DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl), x);
+
 	  MEM_ALIAS_SET (DECL_RTL (decl)) = get_alias_set (decl);
 	    
 	  /* If this variable is to be treated as volatile, show its