| 1 | https://gcc.gnu.org/ml/gcc-testresults/2017-01/msg02971.html |
| 2 | |
| 3 | From e28e7068641a9ef7d1899b474fa3ddf898edc4c2 Mon Sep 17 00:00:00 2001 |
| 4 | From: Iain Sandoe <iain@codesourcery.com> |
| 5 | Date: Fri, 2 Dec 2016 12:29:23 +0000 |
| 6 | Subject: [PATCH 1/4] [Darwin, powerpc] Fix bootstrap (PR77359) by copying AIX |
| 7 | amendment. |
| 8 | |
| 9 | PowerPC Darwin also requires 128b stack alignment (for all versions I currently have access to). It's quite possible that it would be suitable to #define STACK_BOUNDARY 128, but for now I've left it as defined in rs6000.h. |
| 10 | --- |
| 11 | gcc/config/rs6000/darwin.h | 31 ++++++++++++++++++++++++++----- |
| 12 | 1 file changed, 26 insertions(+), 5 deletions(-) |
| 13 | |
| 14 | diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h |
| 15 | index 397ab1c..72c71f6 100644 |
| 16 | --- gcc/config/rs6000/darwin.h |
| 17 | +++ gcc/config/rs6000/darwin.h |
| 18 | @@ -146,19 +146,40 @@ extern int darwin_emit_branch_islands; |
| 19 | #undef RS6000_PIC_OFFSET_TABLE_REGNUM |
| 20 | #define RS6000_PIC_OFFSET_TABLE_REGNUM 31 |
| 21 | |
| 22 | -/* Pad the outgoing args area to 16 bytes instead of the usual 8. */ |
| 23 | +/* Offset within stack frame to start allocating local variables at. |
| 24 | + If FRAME_GROWS_DOWNWARD, this is the offset to the END of the |
| 25 | + first local allocated. Otherwise, it is the offset to the BEGINNING |
| 26 | + of the first local allocated. |
| 27 | + |
| 28 | + On the RS/6000, the frame pointer is the same as the stack pointer, |
| 29 | + except for dynamic allocations. So we start after the fixed area and |
| 30 | + outgoing parameter area. |
| 31 | + |
| 32 | + If the function uses dynamic stack space (CALLS_ALLOCA is set), that |
| 33 | + space needs to be aligned to STACK_BOUNDARY, i.e. the sum of the |
| 34 | + sizes of the fixed area and the parameter area must be a multiple of |
| 35 | + STACK_BOUNDARY. */ |
| 36 | |
| 37 | #undef STARTING_FRAME_OFFSET |
| 38 | #define STARTING_FRAME_OFFSET \ |
| 39 | (FRAME_GROWS_DOWNWARD \ |
| 40 | ? 0 \ |
| 41 | - : (RS6000_ALIGN (crtl->outgoing_args_size, 16) \ |
| 42 | - + RS6000_SAVE_AREA)) |
| 43 | + : (cfun->calls_alloca \ |
| 44 | + ? RS6000_ALIGN (crtl->outgoing_args_size + RS6000_SAVE_AREA, 16) \ |
| 45 | + : (RS6000_ALIGN (crtl->outgoing_args_size, 16) + RS6000_SAVE_AREA))) |
| 46 | + |
| 47 | +/* Offset from the stack pointer register to an item dynamically |
| 48 | + allocated on the stack, e.g., by `alloca'. |
| 49 | + |
| 50 | + The default value for this macro is `STACK_POINTER_OFFSET' plus the |
| 51 | + length of the outgoing arguments. The default is correct for most |
| 52 | + machines. See `function.c' for details. |
| 53 | |
| 54 | + This value must be a multiple of STACK_BOUNDARY (hard coded in |
| 55 | + `emit-rtl.c'). */ |
| 56 | #undef STACK_DYNAMIC_OFFSET |
| 57 | #define STACK_DYNAMIC_OFFSET(FUNDECL) \ |
| 58 | - (RS6000_ALIGN (crtl->outgoing_args_size, 16) \ |
| 59 | - + (STACK_POINTER_OFFSET)) |
| 60 | + RS6000_ALIGN (crtl->outgoing_args_size + STACK_POINTER_OFFSET, 16) |
| 61 | |
| 62 | /* Darwin uses a function call if everything needs to be saved/restored. */ |
| 63 | |
| 64 | -- |
| 65 | 2.8.1 |
| 66 | |
| 67 | From 8bcf01a06f997580088a8a7d69ce16b881187dfb Mon Sep 17 00:00:00 2001 |
| 68 | From: Iain Sandoe <iain@codesourcery.com> |
| 69 | Date: Wed, 31 Aug 2016 19:45:18 +0100 |
| 70 | Subject: [PATCH 2/4] [Darwin,PPC] Remove uses of LR in restore_world. |
| 71 | |
| 72 | r 239866 removed most of the uses of LR in returns and subclass |
| 73 | |
| 74 | Darwin had an additional use of LR in the restore_world machinery. This patch removes it from the pattern in altivec.md and the relevant predicate. |
| 75 | |
| 76 | 2016-12-11 Iain Sandoe <iain@codesourcery.com> |
| 77 | |
| 78 | * config/rs6000/altivec.md (*restore_world): Remove LR use. |
| 79 | * config/rs6000/predicates.md (restore_world_operation): Adjust op |
| 80 | count, remove one USE. |
| 81 | --- |
| 82 | gcc/config/rs6000/altivec.md | 1 - |
| 83 | gcc/config/rs6000/predicates.md | 3 +-- |
| 84 | 2 files changed, 1 insertion(+), 3 deletions(-) |
| 85 | |
| 86 | diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md |
| 87 | index 8af7ac5..60fc983 100644 |
| 88 | --- gcc/config/rs6000/altivec.md |
| 89 | +++ gcc/config/rs6000/altivec.md |
| 90 | @@ -414,7 +414,6 @@ |
| 91 | (define_insn "*restore_world" |
| 92 | [(match_parallel 0 "restore_world_operation" |
| 93 | [(return) |
| 94 | - (use (reg:SI LR_REGNO)) |
| 95 | (use (match_operand:SI 1 "call_operand" "s")) |
| 96 | (clobber (match_operand:SI 2 "gpc_reg_operand" "=r"))])] |
| 97 | "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT" |
| 98 | diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md |
| 99 | index 3d69fc8..8f568a7 100644 |
| 100 | --- gcc/config/rs6000/predicates.md |
| 101 | +++ gcc/config/rs6000/predicates.md |
| 102 | @@ -1468,13 +1468,12 @@ |
| 103 | rtx elt; |
| 104 | int count = XVECLEN (op, 0); |
| 105 | |
| 106 | - if (count != 59) |
| 107 | + if (count != 58) |
| 108 | return 0; |
| 109 | |
| 110 | index = 0; |
| 111 | if (GET_CODE (XVECEXP (op, 0, index++)) != RETURN |
| 112 | || GET_CODE (XVECEXP (op, 0, index++)) != USE |
| 113 | - || GET_CODE (XVECEXP (op, 0, index++)) != USE |
| 114 | || GET_CODE (XVECEXP (op, 0, index++)) != CLOBBER) |
| 115 | return 0; |
| 116 | |
| 117 | -- |
| 118 | 2.8.1 |
| 119 | |
| 120 | From 7abddda25c5d3ee568cd72477cfca89a1b3baceb Mon Sep 17 00:00:00 2001 |
| 121 | From: Iain Sandoe <iain@codesourcery.com> |
| 122 | Date: Sun, 27 Nov 2016 15:48:23 +0000 |
| 123 | Subject: [PATCH 3/4] [Darwin PPC] Fix Fortran bootstrap by fixing ppc/setjmp.h |
| 124 | |
| 125 | Earlier Darwin headers do not declare longjmp as noreturn, this was |
| 126 | already fixed for i386, but also affects the powerpc port. |
| 127 | |
| 128 | 2016-11-27 Iain Sandoe <iain@codesourcery.com> |
| 129 | |
| 130 | PR bootstrap/72833 |
| 131 | * inclhack.def (darwin_longjmp_noreturn): Amend to add ppc. |
| 132 | * fixincl.x: Regenerated. |
| 133 | --- |
| 134 | fixincludes/fixincl.x | 10 +++++----- |
| 135 | fixincludes/inclhack.def | 3 ++- |
| 136 | 2 files changed, 7 insertions(+), 6 deletions(-) |
| 137 | |
| 138 | diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x |
| 139 | index 6a010d6..8567828 100644 |
| 140 | --- fixincludes/fixincl.x |
| 141 | +++ fixincludes/fixincl.x |
| 142 | @@ -2753,7 +2753,7 @@ tSCC zDarwin_Longjmp_NoreturnName[] = |
| 143 | * File name selection pattern |
| 144 | */ |
| 145 | tSCC zDarwin_Longjmp_NoreturnList[] = |
| 146 | - "i386/setjmp.h\0"; |
| 147 | + "i386/setjmp.h\0ppc/setjmp.h\0"; |
| 148 | /* |
| 149 | * Machine/OS name selection pattern |
| 150 | */ |
| 151 | diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def |
| 152 | index 03a267b..6cf056c 100644 |
| 153 | --- fixincludes/inclhack.def |
| 154 | +++ fixincludes/inclhack.def |
| 155 | @@ -1421,12 +1421,13 @@ fix = { |
| 156 | }; |
| 157 | |
| 158 | /* |
| 159 | - * Before Mac OS X 10.8 <i386/setjmp.h> doesn't mark longjump noreturn. |
| 160 | + * Before Mac OS X 10.8 <{i386,ppc}/setjmp.h> don't mark longjump noreturn. |
| 161 | */ |
| 162 | fix = { |
| 163 | hackname = darwin_longjmp_noreturn; |
| 164 | mach = "*-*-darwin*"; |
| 165 | files = "i386/setjmp.h"; |
| 166 | + files = "ppc/setjmp.h"; |
| 167 | bypass = "__dead2"; |
| 168 | select = "(.*longjmp\\(.*jmp_buf.*[^)]+\\));"; |
| 169 | c_fix = format; |
| 170 | -- |
| 171 | 2.8.1 |
| 172 | |
| 173 | From de5187a1258e4ac036f5b787d921d5e69c4fc476 Mon Sep 17 00:00:00 2001 |
| 174 | From: Iain Sandoe <iain@codesourcery.com> |
| 175 | Date: Sat, 18 Jun 2016 14:39:50 +0100 |
| 176 | Subject: [PATCH 4/4] Update of __gnat_lwp_self(), with fixes for Darwin9. |
| 177 | |
| 178 | --- |
| 179 | gcc/ada/adaint.c | 14 +++++++++++--- |
| 180 | 1 file changed, 11 insertions(+), 3 deletions(-) |
| 181 | |
| 182 | diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c |
| 183 | index 54a1d6e..0af8ca4 100644 |
| 184 | --- gcc/ada/adaint.c |
| 185 | +++ gcc/ada/adaint.c |
| 186 | @@ -3174,9 +3174,13 @@ __gnat_lwp_self (void) |
| 187 | #endif |
| 188 | |
| 189 | #if defined (__APPLE__) |
| 190 | -#include <mach/thread_info.h> |
| 191 | -#include <mach/mach_init.h> |
| 192 | -#include <mach/thread_act.h> |
| 193 | +# if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060 |
| 194 | +# include <mach/thread_info.h> |
| 195 | +# include <mach/mach_init.h> |
| 196 | +# include <mach/thread_act.h> |
| 197 | +# else |
| 198 | +# include <pthread.h> |
| 199 | +# endif |
| 200 | |
| 201 | /* System-wide thread identifier. Note it could be truncated on 32 bit |
| 202 | hosts. |
| 203 | @@ -3184,6 +3188,7 @@ __gnat_lwp_self (void) |
| 204 | void * |
| 205 | __gnat_lwp_self (void) |
| 206 | { |
| 207 | +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060 |
| 208 | thread_identifier_info_data_t data; |
| 209 | mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT; |
| 210 | kern_return_t kret; |
| 211 | @@ -3194,6 +3199,9 @@ __gnat_lwp_self (void) |
| 212 | return (void *)(uintptr_t)data.thread_id; |
| 213 | else |
| 214 | return 0; |
| 215 | +#else |
| 216 | + return (void *)pthread_mach_thread_np (pthread_self ()); |
| 217 | +#endif |
| 218 | } |
| 219 | #endif |
| 220 | |
| 221 | -- |
| 222 | 2.8.1 |
| 223 | |