diff options
Diffstat (limited to 'meta/packages/gcc/gcc-4.5.0/fedora/gcc43-ppc32-retaddr.patch')
| -rw-r--r-- | meta/packages/gcc/gcc-4.5.0/fedora/gcc43-ppc32-retaddr.patch | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/meta/packages/gcc/gcc-4.5.0/fedora/gcc43-ppc32-retaddr.patch b/meta/packages/gcc/gcc-4.5.0/fedora/gcc43-ppc32-retaddr.patch new file mode 100644 index 0000000000..3de4158eb0 --- /dev/null +++ b/meta/packages/gcc/gcc-4.5.0/fedora/gcc43-ppc32-retaddr.patch | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | 2005-11-28 Jakub Jelinek <jakub@redhat.com> | ||
| 2 | |||
| 3 | * config/rs6000/rs6000.c (rs6000_return_addr): If COUNT == 0, | ||
| 4 | read word RETURN_ADDRESS_OFFSET bytes above arg_pointer_rtx | ||
| 5 | instead of doing an extran indirection from frame_pointer_rtx. | ||
| 6 | |||
| 7 | * gcc.dg/20051128-1.c: New test. | ||
| 8 | |||
| 9 | Index: gcc/config/rs6000/rs6000.c | ||
| 10 | =================================================================== | ||
| 11 | --- gcc/config/rs6000/rs6000.c.orig 2010-03-27 03:27:39.000000000 -0700 | ||
| 12 | +++ gcc/config/rs6000/rs6000.c 2010-06-25 10:18:04.053381930 -0700 | ||
| 13 | @@ -17646,17 +17646,22 @@ | ||
| 14 | don't try to be too clever here. */ | ||
| 15 | if (count != 0 || (DEFAULT_ABI != ABI_AIX && flag_pic)) | ||
| 16 | { | ||
| 17 | + rtx x; | ||
| 18 | cfun->machine->ra_needs_full_frame = 1; | ||
| 19 | |||
| 20 | - return | ||
| 21 | - gen_rtx_MEM | ||
| 22 | - (Pmode, | ||
| 23 | - memory_address | ||
| 24 | - (Pmode, | ||
| 25 | - plus_constant (copy_to_reg | ||
| 26 | - (gen_rtx_MEM (Pmode, | ||
| 27 | - memory_address (Pmode, frame))), | ||
| 28 | - RETURN_ADDRESS_OFFSET))); | ||
| 29 | + if (count == 0) | ||
| 30 | + { | ||
| 31 | + gcc_assert (frame == frame_pointer_rtx); | ||
| 32 | + x = arg_pointer_rtx; | ||
| 33 | + } | ||
| 34 | + else | ||
| 35 | + { | ||
| 36 | + x = memory_address (Pmode, frame); | ||
| 37 | + x = copy_to_reg (gen_rtx_MEM (Pmode, x)); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + x = plus_constant (x, RETURN_ADDRESS_OFFSET); | ||
| 41 | + return gen_rtx_MEM (Pmode, memory_address (Pmode, x)); | ||
| 42 | } | ||
| 43 | |||
| 44 | cfun->machine->ra_need_lr = 1; | ||
| 45 | Index: gcc/testsuite/gcc.dg/20051128-1.c | ||
| 46 | =================================================================== | ||
| 47 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 48 | +++ gcc/testsuite/gcc.dg/20051128-1.c 2010-06-25 10:18:04.061382856 -0700 | ||
| 49 | @@ -0,0 +1,41 @@ | ||
| 50 | +/* { dg-do run } */ | ||
| 51 | +/* { dg-options "-O2 -fpic" } */ | ||
| 52 | + | ||
| 53 | +extern void exit (int); | ||
| 54 | +extern void abort (void); | ||
| 55 | + | ||
| 56 | +int b; | ||
| 57 | + | ||
| 58 | +struct A | ||
| 59 | +{ | ||
| 60 | + void *pad[147]; | ||
| 61 | + void *ra, *h; | ||
| 62 | + long o; | ||
| 63 | +}; | ||
| 64 | + | ||
| 65 | +void | ||
| 66 | +__attribute__((noinline)) | ||
| 67 | +foo (struct A *a, void *x) | ||
| 68 | +{ | ||
| 69 | + __builtin_memset (a, 0, sizeof (a)); | ||
| 70 | + if (!b) | ||
| 71 | + exit (0); | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +void | ||
| 75 | +__attribute__((noinline)) | ||
| 76 | +bar (void) | ||
| 77 | +{ | ||
| 78 | + struct A a; | ||
| 79 | + | ||
| 80 | + __builtin_unwind_init (); | ||
| 81 | + foo (&a, __builtin_return_address (0)); | ||
| 82 | +} | ||
| 83 | + | ||
| 84 | +int | ||
| 85 | +main (void) | ||
| 86 | +{ | ||
| 87 | + bar (); | ||
| 88 | + abort (); | ||
| 89 | + return 0; | ||
| 90 | +} | ||
