Fix gcc-7 REQUIRED_PACKAGES
[unleashed-userland.git] / components / developer / gcc-7 / patches / 001-illumos-gcc.patch
blob0bbb35166f8296436c11f533d94070239ac73211
1 --- gcc-7.1.0.orig/contrib/compare_tests 2016-09-20 22:14:14.000000000 +0200
2 +++ gcc-7.1.0/contrib/compare_tests 2017-05-04 16:11:23.573298162 +0200
3 @@ -107,8 +107,15 @@
4 usage "Must specify either two directories or two files"
5 fi
7 -sed 's/^XFAIL/FAIL/; s/^ERROR/FAIL/; s/^XPASS/PASS/' < "$1" | awk '/^Running target / {target = $3} { if (target != "unix") { sub(/: /, "&"target": " ); }; print $0; }' | cut -c1-2000 >$tmp1
8 -sed 's/^XFAIL/FAIL/; s/^ERROR/FAIL/; s/^XPASS/PASS/' < "$2" | awk '/^Running target / {target = $3} { if (target != "unix") { sub(/: /, "&"target": " ); }; print $0; }' | cut -c1-2000 >$tmp2
9 +osrev=`uname -sr`
10 +if [ `expr "$osrev" : "SunOS 5."` -eq "8" ]; then
11 + AWK=/usr/bin/nawk
12 +else
13 + AWK=awk
14 +fi
16 +sed 's/^XFAIL/FAIL/; s/^XPASS/PASS/' < "$1" | $AWK '/^Running target / {target = $3} { if (target != "unix") { sub(/: /, "&"target": " ); }; print $0; }' | cut -c1-2000 >$tmp1
17 +sed 's/^XFAIL/FAIL/; s/^XPASS/PASS/' < "$2" | $AWK '/^Running target / {target = $3} { if (target != "unix") { sub(/: /, "&"target": " ); }; print $0; }' | cut -c1-2000 >$tmp2
19 before=$tmp1
20 now=$tmp2
21 diff -ru gcc-7.1.0.orig/gcc/common.opt gcc-7.1.0/gcc/common.opt
22 --- gcc-7.1.0.orig/gcc/common.opt 2017-02-28 23:02:58.000000000 +0100
23 +++ gcc-7.1.0/gcc/common.opt 2017-05-04 16:10:05.882253399 +0200
24 @@ -1076,6 +1076,11 @@
25 Common Report Var(flag_code_hoisting) Optimization
26 Enable code hoisting.
28 +fclone-functions
29 +Common Report Var(flag_clone_functions) Init(1)
30 +Allow the compiler to clone functions to facilitate certain optimizations.
31 +Enabled by default.
33 fcombine-stack-adjustments
34 Common Report Var(flag_combine_stack_adjustments) Optimization
35 Looks for opportunities to reduce stack adjustments and stack references.
36 @@ -2341,6 +2346,10 @@
37 Common Report Var(flag_strict_aliasing) Optimization
38 Assume strict aliasing rules apply.
40 +fstrict-calling-conventions
41 +Common Report Var(flag_strict_calling_conventions) Init(1)
42 +Use strict ABI calling conventions even for static functions
44 fstrict-overflow
45 Common Report Var(flag_strict_overflow) Optimization
46 Treat signed overflow as undefined.
47 diff -ru gcc-7.1.0.orig/gcc/config/i386/i386.c gcc-7.1.0/gcc/config/i386/i386.c
48 --- gcc-7.1.0.orig/gcc/config/i386/i386.c 2017-04-11 22:36:58.000000000 +0200
49 +++ gcc-7.1.0/gcc/config/i386/i386.c 2017-05-04 16:11:34.364657711 +0200
50 @@ -2452,6 +2452,10 @@
52 saved frame pointer if frame_pointer_needed
53 <- HARD_FRAME_POINTER
54 + [-msave-args] <- arg_save_offset
56 + [saveargs padding]
58 [saved regs]
59 <- regs_save_offset
60 [padding0]
61 @@ -2469,6 +2473,7 @@
63 struct ix86_frame
65 + int nmsave_args;
66 int nsseregs;
67 int nregs;
68 int va_arg_size;
69 @@ -2480,6 +2485,7 @@
70 HOST_WIDE_INT hard_frame_pointer_offset;
71 HOST_WIDE_INT stack_pointer_offset;
72 HOST_WIDE_INT hfp_save_offset;
73 + HOST_WIDE_INT arg_save_offset;
74 HOST_WIDE_INT reg_save_offset;
75 HOST_WIDE_INT sse_reg_save_offset;
77 @@ -2616,6 +2622,8 @@
79 static enum calling_abi ix86_function_abi (const_tree);
81 +static int ix86_nsaved_args (void);
82 +static void pro_epilogue_adjust_stack (rtx, rtx, rtx, int, bool);
84 #ifndef SUBTARGET32_DEFAULT_CPU
85 #define SUBTARGET32_DEFAULT_CPU "i386"
86 @@ -5923,6 +5931,9 @@
87 opts->x_ix86_isa_flags
88 |= OPTION_MASK_ISA_LZCNT & ~opts->x_ix86_isa_flags_explicit;
90 + if (!TARGET_64BIT_P (opts->x_ix86_isa_flags) && TARGET_SAVE_ARGS)
91 + error ("-msave-args makes no sense in the 32-bit mode");
93 /* Validate -mpreferred-stack-boundary= value or default it to
94 PREFERRED_STACK_BOUNDARY_DEFAULT. */
95 ix86_preferred_stack_boundary = PREFERRED_STACK_BOUNDARY_DEFAULT;
96 @@ -7948,6 +7959,7 @@
97 and callee not, or vice versa. Instead look at whether the callee
98 is optimized or not. */
99 if (target && opt_for_fn (target->decl, optimize)
100 + && !flag_strict_calling_conventions
101 && !(profile_flag && !flag_fentry))
103 cgraph_local_info *i = &target->local;
104 @@ -8045,6 +8057,7 @@
105 /* TARGET_SSE_MATH */
106 && (target_opts_for_fn (target->decl)->x_ix86_fpmath & FPMATH_SSE)
107 && opt_for_fn (target->decl, optimize)
108 + && !flag_strict_calling_conventions
109 && !(profile_flag && !flag_fentry))
111 cgraph_local_info *i = &target->local;
112 @@ -11888,7 +11901,7 @@
114 ix86_compute_frame_layout (&frame);
115 return (frame.stack_pointer_offset == UNITS_PER_WORD
116 - && (frame.nregs + frame.nsseregs) == 0);
117 + && (frame.nmsave_args + frame.nregs + frame.nsseregs) == 0);
120 /* Value should be nonzero if functions must have frame pointers.
121 @@ -11912,6 +11925,9 @@
122 if (TARGET_32BIT_MS_ABI && cfun->calls_setjmp)
123 return true;
125 + if (TARGET_SAVE_ARGS)
126 + return true;
128 /* Win64 SEH, very large frames need a frame-pointer as maximum stack
129 allocation is 4GB. */
130 if (TARGET_64BIT_MS_ABI && get_frame_size () > SEH_MAX_FRAME_SIZE)
131 @@ -12422,6 +12438,7 @@
133 frame->nregs = ix86_nsaved_regs ();
134 frame->nsseregs = ix86_nsaved_sseregs ();
135 + frame->nmsave_args = ix86_nsaved_args ();
137 /* 64-bit MS ABI seem to require stack alignment to be always 16,
138 except for function prologues, leaf functions and when the defult
139 @@ -12484,7 +12501,8 @@
142 frame->save_regs_using_mov
143 - = (TARGET_PROLOGUE_USING_MOVE && cfun->machine->use_fast_prologue_epilogue
144 + = ((TARGET_FORCE_SAVE_REGS_USING_MOV ||
145 + (TARGET_PROLOGUE_USING_MOVE && cfun->machine->use_fast_prologue_epilogue))
146 /* If static stack checking is enabled and done with probes,
147 the registers need to be saved before allocating the frame. */
148 && flag_stack_check != STATIC_BUILTIN_STACK_CHECK);
149 @@ -12504,6 +12522,13 @@
150 /* The traditional frame pointer location is at the top of the frame. */
151 frame->hard_frame_pointer_offset = offset;
153 + if (TARGET_SAVE_ARGS)
155 + offset += frame->nmsave_args * UNITS_PER_WORD;
156 + offset += (frame->nmsave_args % 2) * UNITS_PER_WORD;
158 + frame->arg_save_offset = offset;
160 /* Register save area */
161 offset += frame->nregs * UNITS_PER_WORD;
162 frame->reg_save_offset = offset;
163 @@ -12581,8 +12606,9 @@
164 /* Size prologue needs to allocate. */
165 to_allocate = offset - frame->sse_reg_save_offset;
167 - if ((!to_allocate && frame->nregs <= 1)
168 - || (TARGET_64BIT && to_allocate >= HOST_WIDE_INT_C (0x80000000)))
169 + if (!TARGET_SAVE_ARGS &&
170 + ((!to_allocate && frame->nregs <= 1)
171 + || (TARGET_64BIT && to_allocate >= HOST_WIDE_INT_C (0x80000000))))
172 frame->save_regs_using_mov = false;
174 if (ix86_using_red_zone ()
175 @@ -12593,7 +12619,11 @@
177 frame->red_zone_size = to_allocate;
178 if (frame->save_regs_using_mov)
180 frame->red_zone_size += frame->nregs * UNITS_PER_WORD;
181 + frame->red_zone_size += frame->nmsave_args * UNITS_PER_WORD;
182 + frame->red_zone_size += (frame->nmsave_args % 2) * UNITS_PER_WORD;
184 if (frame->red_zone_size > RED_ZONE_SIZE - RED_ZONE_RESERVE)
185 frame->red_zone_size = RED_ZONE_SIZE - RED_ZONE_RESERVE;
187 @@ -12624,6 +12654,23 @@
188 frame->hard_frame_pointer_offset = frame->stack_pointer_offset - 128;
193 + if (getenv("DEBUG_FRAME_STUFF") != NULL)
195 + printf("nmsave_args: %d\n", frame->nmsave_args);
196 + printf("nsseregs: %d\n", frame->nsseregs);
197 + printf("nregs: %d\n", frame->nregs);
199 + printf("frame_pointer_offset: %llx\n", frame->frame_pointer_offset);
200 + printf("hard_frame_pointer_offset: %llx\n", frame->hard_frame_pointer_offset);
201 + printf("stack_pointer_offset: %llx\n", frame->stack_pointer_offset);
202 + printf("hfp_save_offset: %llx\n", frame->hfp_save_offset);
203 + printf("arg_save_offset: %llx\n", frame->arg_save_offset);
204 + printf("reg_save_offset: %llx\n", frame->reg_save_offset);
205 + printf("sse_reg_save_offset: %llx\n", frame->sse_reg_save_offset);
210 /* This is semi-inlined memory_address_length, but simplified
211 @@ -12732,6 +12779,24 @@
212 unsigned int regno;
213 rtx_insn *insn;
215 + if (TARGET_SAVE_ARGS)
217 + int i;
218 + int nsaved = ix86_nsaved_args ();
219 + int start = cfun->returns_struct;
221 + for (i = start; i < start + nsaved; i++)
223 + regno = x86_64_int_parameter_registers[i];
224 + insn = emit_insn (gen_push (gen_rtx_REG (word_mode, regno)));
225 + RTX_FRAME_RELATED_P (insn) = 1;
227 + if (nsaved % 2 != 0)
228 + pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
229 + GEN_INT (-UNITS_PER_WORD), -1, false);
233 for (regno = FIRST_PSEUDO_REGISTER - 1; regno-- > 0; )
234 if (GENERAL_REGNO_P (regno) && ix86_save_reg (regno, true))
236 @@ -12810,9 +12875,30 @@
237 /* Emit code to save registers using MOV insns.
238 First register is stored at CFA - CFA_OFFSET. */
239 static void
240 -ix86_emit_save_regs_using_mov (HOST_WIDE_INT cfa_offset)
241 +ix86_emit_save_regs_using_mov (struct ix86_frame *frame)
243 unsigned int regno;
244 + HOST_WIDE_INT cfa_offset = frame->arg_save_offset;
246 + if (TARGET_SAVE_ARGS)
248 + int i;
249 + int nsaved = ix86_nsaved_args ();
250 + int start = cfun->returns_struct;
252 + /* We deal with this twice? */
253 + if (nsaved % 2 != 0)
254 + cfa_offset -= UNITS_PER_WORD;
256 + for (i = start + nsaved - 1; i >= start; i--)
258 + regno = x86_64_int_parameter_registers[i];
259 + ix86_emit_save_reg_using_mov(word_mode, regno, cfa_offset);
260 + cfa_offset -= UNITS_PER_WORD;
264 + cfa_offset = frame->reg_save_offset;
266 for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
267 if (GENERAL_REGNO_P (regno) && ix86_save_reg (regno, true))
268 @@ -13870,7 +13956,7 @@
272 - int_registers_saved = (frame.nregs == 0);
273 + int_registers_saved = (frame.nregs == 0 && frame.nmsave_args == 0);
274 sse_registers_saved = (frame.nsseregs == 0);
276 if (frame_pointer_needed && !m->fs.fp_valid)
277 @@ -13910,6 +13996,7 @@
279 ix86_emit_save_regs ();
280 int_registers_saved = true;
282 gcc_assert (m->fs.sp_offset == frame.reg_save_offset);
285 @@ -13921,7 +14008,7 @@
286 && (! TARGET_STACK_PROBE
287 || frame.stack_pointer_offset < CHECK_STACK_LIMIT))
289 - ix86_emit_save_regs_using_mov (frame.reg_save_offset);
290 + ix86_emit_save_regs_using_mov (&frame);
291 int_registers_saved = true;
294 @@ -14164,7 +14251,7 @@
297 if (!int_registers_saved)
298 - ix86_emit_save_regs_using_mov (frame.reg_save_offset);
299 + ix86_emit_save_regs_using_mov (&frame);
300 if (!sse_registers_saved)
301 ix86_emit_save_sse_regs_using_mov (frame.sse_reg_save_offset);
303 @@ -14197,6 +14284,7 @@
304 relative to the value of the stack pointer at the end of the function
305 prologue, and moving instructions that access redzone area via frame
306 pointer inside push sequence violates this assumption. */
307 + /* XXX: We may wish to do this when SAVE_ARGS in general */
308 if (frame_pointer_needed && frame.red_zone_size)
309 emit_insn (gen_memory_blockage ());
311 @@ -14409,6 +14497,7 @@
313 /* See the comment about red zone and frame
314 pointer usage in ix86_expand_prologue. */
315 + /* XXX: We may want to do this when SAVE_ARGS in general */
316 if (frame_pointer_needed && frame.red_zone_size)
317 emit_insn (gen_memory_blockage ());
319 @@ -14602,6 +14691,36 @@
320 ix86_emit_restore_regs_using_pop ();
323 + if (TARGET_SAVE_ARGS) {
324 + /*
325 + * For each saved argument, emit a restore note, to make sure it happens
326 + * correctly within the shrink wrapping (I think).
328 + * Note that 'restore' in this case merely means the rule is the same as
329 + * it was on function entry, not that we have actually done a register
330 + * restore (which of course, we haven't).
332 + * If we do not do this, the DWARF code will emit sufficient restores to
333 + * provide balance on its own initiative, which in the presence of
334 + * -fshrink-wrap may actually _introduce_ unbalance (whereby we only
335 + * .cfi_offset a register sometimes, but will always .cfi_restore it.
336 + * This will trip an assert.)
337 + */
338 + int start = cfun->returns_struct;
339 + int nsaved = ix86_nsaved_args();
340 + int i;
342 + for (i = start + nsaved - 1; i >= start; i--)
343 + queued_cfa_restores
344 + = alloc_reg_note (REG_CFA_RESTORE,
345 + gen_rtx_REG(Pmode,
346 + x86_64_int_parameter_registers[i]),
347 + queued_cfa_restores);
349 + gcc_assert(m->fs.fp_valid);
353 /* If we used a stack pointer and haven't already got rid of it,
354 then do so now. */
355 if (m->fs.fp_valid)
356 @@ -15613,6 +15732,19 @@
357 return !ix86_legitimate_constant_p (mode, x);
360 +/* Return number of arguments to be saved on the stack with
361 + -msave-args. */
363 +static int
364 +ix86_nsaved_args (void)
366 + if (TARGET_SAVE_ARGS)
367 + return crtl->args.info.regno - cfun->returns_struct;
368 + else
369 + return 0;
373 /* Nonzero if the symbol is marked as dllimport, or as stub-variable,
374 otherwise zero. */
376 diff -ru gcc-7.1.0.orig/gcc/config/i386/i386.opt gcc-7.1.0/gcc/config/i386/i386.opt
377 --- gcc-7.1.0.orig/gcc/config/i386/i386.opt 2017-02-28 23:02:58.000000000 +0100
378 +++ gcc-7.1.0/gcc/config/i386/i386.opt 2017-05-04 16:10:05.896077308 +0200
379 @@ -505,6 +505,16 @@
380 Target Report Mask(TLS_DIRECT_SEG_REFS)
381 Use direct references against %gs when accessing tls data.
383 +msave-args
384 +Target Report Var(TARGET_SAVE_ARGS)
385 +Save integer arguments on the stack at function entry
387 +mforce-save-regs-using-mov
388 +Target Report Var(TARGET_FORCE_SAVE_REGS_USING_MOV)
389 +Save registers using push in function prologues. This is intentionally
390 +undocumented and used for msave-args testing.
393 mtune=
394 Target RejectNegative Joined Var(ix86_tune_string)
395 Schedule code for given CPU.
396 diff -ru gcc-7.1.0.orig/gcc/config/sol2-c.c gcc-7.1.0/gcc/config/sol2-c.c
397 --- gcc-7.1.0.orig/gcc/config/sol2-c.c 2017-01-01 13:07:43.000000000 +0100
398 +++ gcc-7.1.0/gcc/config/sol2-c.c 2017-05-04 16:10:05.922372733 +0200
399 @@ -40,7 +40,10 @@
401 static const format_flag_spec cmn_err_flag_specs[] =
403 + { '0', 0, 0, N_("'0' flag"), N_("the '0' flag"), STD_C89 },
404 + { '-', 0, 0, N_("'-' flag"), N_("the '-' flag"), STD_C89 },
405 { 'w', 0, 0, N_("field width"), N_("field width in printf format"), STD_C89 },
406 + { 'p', 0, 0, N_("precision"), N_("precision in printf format"), STD_C89 },
407 { 'L', 0, 0, N_("length modifier"), N_("length modifier in printf format"), STD_C89 },
408 { 0, 0, 0, NULL, NULL, STD_C89 }
410 @@ -48,6 +51,7 @@
412 static const format_flag_pair cmn_err_flag_pairs[] =
414 + { '0', '-', 1, 0 },
415 { 0, 0, 0, 0 }
418 @@ -57,21 +61,21 @@
419 static const format_char_info cmn_err_char_table[] =
421 /* C89 conversion specifiers. */
422 - { "dD", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, T9L_LL, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "", NULL },
423 - { "oOxX",0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "", NULL },
424 - { "u", 0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "", NULL },
425 - { "c", 0, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "", NULL },
426 - { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "c", NULL },
427 - { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "cR", NULL },
428 - { "b", 0, STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "", &bitfield_string_type },
429 + { "dD", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, T9L_LL, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0", "", NULL },
430 + { "oOxX",0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0", "", NULL },
431 + { "u", 0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0", "", NULL },
432 + { "c", 0, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL },
433 + { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "c", NULL },
434 + { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR", NULL },
435 + { "b", 0, STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", &bitfield_string_type },
436 { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL }
439 EXPORTED_CONST format_kind_info solaris_format_types[] = {
440 - { "cmn_err", cmn_err_length_specs, cmn_err_char_table, "", NULL,
441 + { "cmn_err", cmn_err_length_specs, cmn_err_char_table, "0-", NULL,
442 cmn_err_flag_specs, cmn_err_flag_pairs,
443 FMT_FLAG_ARG_CONVERT|FMT_FLAG_EMPTY_PREC_OK,
444 - 'w', 0, 0, 0, 'L', 0,
445 + 'w', 0, 'p', 0, 'L', 0,
446 &integer_type_node, &integer_type_node
449 diff -ru gcc-7.1.0.orig/gcc/config/sol2.h gcc-7.1.0/gcc/config/sol2.h
450 --- gcc-7.1.0.orig/gcc/config/sol2.h 2017-01-13 13:11:00.000000000 +0100
451 +++ gcc-7.1.0/gcc/config/sol2.h 2017-05-04 16:10:05.896540777 +0200
452 @@ -170,15 +170,22 @@
453 #define SUPPORTS_INIT_PRIORITY HAVE_INITFINI_ARRAY_SUPPORT
455 #undef STARTFILE_ARCH_SPEC
456 -#define STARTFILE_ARCH_SPEC "%{ansi:values-Xc.o%s} \
457 - %{!ansi:values-Xa.o%s}"
458 +#define STARTFILE_ARCH_SPEC "%{std=c1x|std=gnu1x:values-Xc.o%s values-xpg6.o%s; \
459 + std=c11|std=gnu11:values-Xc.o%s values-xpg6.o%s; \
460 + std=c99|std=gnu99:values-Xc.o%s values-xpg6.o%s; \
461 + std=c9x|std=gnu9x:values-Xc.o%s values-xpg6.o%s; \
462 + std=c++0x|std=gnu++0x:values-Xc.o%s; \
463 + std=c++11|std=gnu++11:values-Xc.o%s; \
464 + std=c++03|std=gnu++03:values-Xc.o%s; \
465 + :values-Xa.o%s}"
468 #if defined(HAVE_LD_PIE) && defined(HAVE_SOLARIS_CRTS)
469 #define STARTFILE_CRTBEGIN_SPEC "%{shared:crtbeginS.o%s} \
470 %{" PIE_SPEC ":crtbeginS.o%s} \
471 %{" NO_PIE_SPEC ":crtbegin.o%s}"
472 #else
473 -#define STARTFILE_CRTBEGIN_SPEC "crtbegin.o%s"
474 +#define STARTFILE_CRTBEGIN_SPEC "%{shared:crtbeginS.o%s;:crtbegin.o%s}"
475 #endif
477 #if ENABLE_VTABLE_VERIFY
478 @@ -228,7 +235,7 @@
479 %{" PIE_SPEC ":crtendS.o%s} \
480 %{" NO_PIE_SPEC ":crtend.o%s}}"
481 #else
482 -#define ENDFILE_CRTEND_SPEC "crtend.o%s"
483 +#define ENDFILE_CRTEND_SPEC "%{shared:crtendS.o%s;:crtend.o%s}"
484 #endif
486 #undef ENDFILE_SPEC
487 diff -ru gcc-7.1.0.orig/gcc/configure gcc-7.1.0/gcc/configure
488 --- gcc-7.1.0.orig/gcc/configure 2017-02-13 09:54:02.000000000 +0100
489 +++ gcc-7.1.0/gcc/configure 2017-05-04 16:10:05.900767853 +0200
490 @@ -22787,6 +22787,7 @@
491 -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'`
492 ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
493 ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
494 + ld_vers_isillumos=`echo "$ld_ver" | grep '(illumos)'`
497 esac
498 @@ -28005,6 +28006,8 @@
499 # Sun ld has various bugs in .eh_frame_hdr support before version 1.2251.
500 if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2251; then
501 gcc_cv_ld_eh_frame_hdr=yes
502 + elif test "$ld_vers_minor" -ge 1735 && test -n "$ld_vers_isillumos"; then
503 + gcc_cv_ld_eh_frame_hdr=yes
506 esac
507 diff -ru gcc-7.1.0.orig/gcc/configure.ac gcc-7.1.0/gcc/configure.ac
508 --- gcc-7.1.0.orig/gcc/configure.ac 2017-02-13 09:54:02.000000000 +0100
509 +++ gcc-7.1.0/gcc/configure.ac 2017-05-04 16:10:05.902310379 +0200
510 @@ -2600,6 +2600,7 @@
511 -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'`
512 ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
513 ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
514 + ld_vers_isillumos=`echo "$ld_ver" | grep '(illumos)'`
517 esac
518 @@ -4960,6 +4961,8 @@
519 # Sun ld has various bugs in .eh_frame_hdr support before version 1.2251.
520 if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2251; then
521 gcc_cv_ld_eh_frame_hdr=yes
522 + elif test "$ld_vers_minor" -ge 1735 && test -n "$ld_vers_isillumos"; then
523 + gcc_cv_ld_eh_frame_hdr=yes
526 esac
527 diff -ru gcc-7.1.0.orig/gcc/doc/invoke.texi gcc-7.1.0/gcc/doc/invoke.texi
528 --- gcc-7.1.0.orig/gcc/doc/invoke.texi 2017-04-10 15:44:39.000000000 +0200
529 +++ gcc-7.1.0/gcc/doc/invoke.texi 2017-05-04 16:11:12.726610227 +0200
530 @@ -358,7 +358,7 @@
531 -fauto-inc-dec -fbranch-probabilities @gol
532 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
533 -fbtr-bb-exclusive -fcaller-saves @gol
534 --fcombine-stack-adjustments -fconserve-stack @gol
535 +-fclone-functions -fcombine-stack-adjustments -fconserve-stack @gol
536 -fcompare-elim -fcprop-registers -fcrossjumping @gol
537 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
538 -fcx-limited-range @gol
539 @@ -8635,6 +8635,12 @@
540 The @option{-fstrict-aliasing} option is enabled at levels
541 @option{-O2}, @option{-O3}, @option{-Os}.
543 +@item -fstrict-calling-conventions
544 +@opindex fstrict-calling-conventions
545 +Use strict ABI calling conventions even with local functions.
546 +This disable certain optimizations that may cause GCC to call local
547 +functions in a manner other than that described by the ABI.
549 @item -fstrict-overflow
550 @opindex fstrict-overflow
551 Allow the compiler to assume strict signed overflow rules, depending
552 @@ -9059,6 +9065,15 @@
553 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
554 support.
556 +@item -fno-clone-functions
557 +@opindex fno-clone-functions
558 +Forbid the implicit cloning of functions implicit in certain
559 +optimizations. This also effectively will disable any optimization
560 +which wishes to clone functions, equivalent to each function having
561 +the ``noclone'' attribute. This allows the prevention of the
562 +dissociation of a piece of text from an intelligible and expected
563 +symbol name, which may hamper debugging and tracing.
565 @item -fcompare-elim
566 @opindex fcompare-elim
567 After register allocation and post-register allocation instruction splitting,
568 @@ -13868,6 +13883,10 @@
569 Generate code for the large code model. This makes no assumptions about
570 addresses and sizes of sections. Programs can be statically linked only.
572 +@item -msave-args
573 +@opindex msave-args
574 +Save integer-sized arguments on the stack on function entry.
576 @item -mstrict-align
577 @opindex mstrict-align
578 Avoid generating memory accesses that may not be aligned on a natural object
579 diff -ru gcc-7.1.0.orig/gcc/dwarf2out.c gcc-7.1.0/gcc/dwarf2out.c
580 --- gcc-7.1.0.orig/gcc/dwarf2out.c 2017-04-19 18:32:02.000000000 +0200
581 +++ gcc-7.1.0/gcc/dwarf2out.c 2017-05-04 16:10:05.916348711 +0200
582 @@ -22419,6 +22419,11 @@
583 /* Add the calling convention attribute if requested. */
584 add_calling_convention_attribute (subr_die, decl);
586 +#ifdef TARGET_SAVE_ARGS
587 + if (TARGET_SAVE_ARGS)
588 + add_AT_flag (subr_die, DW_AT_SUN_amd64_parmdump, 1);
589 +#endif
591 /* Output Dwarf info for all of the stuff within the body of the function
592 (if it has one - it may be just a declaration).
594 diff -ru gcc-7.1.0.orig/gcc/intl.c gcc-7.1.0/gcc/intl.c
595 --- gcc-7.1.0.orig/gcc/intl.c 2017-01-01 13:07:43.000000000 +0100
596 +++ gcc-7.1.0/gcc/intl.c 2017-05-04 16:10:05.916866749 +0200
597 @@ -74,17 +74,11 @@
599 if (!strcmp (open_quote, "`") && !strcmp (close_quote, "'"))
601 - /* Untranslated quotes that it may be possible to replace with
602 - U+2018 and U+2019; but otherwise use "'" instead of "`" as
603 - opening quote. */
604 + /*
605 + * open_quote is ` purely for ease of translation. If they aren't
606 + * translated, use ' for both
607 + */
608 open_quote = "'";
609 -#if defined HAVE_LANGINFO_CODESET
610 - if (locale_utf8)
612 - open_quote = "\xe2\x80\x98";
613 - close_quote = "\xe2\x80\x99";
615 -#endif
619 @@ -145,6 +139,3 @@
620 spaces[len] = '\0';
621 return spaces;
626 diff -ru gcc-7.1.0.orig/gcc/symtab.c gcc-7.1.0/gcc/symtab.c
627 --- gcc-7.1.0.orig/gcc/symtab.c 2017-04-28 13:42:14.000000000 +0200
628 +++ gcc-7.1.0/gcc/symtab.c 2017-05-04 16:10:05.917594338 +0200
629 @@ -1744,6 +1744,10 @@
630 tree new_decl;
631 symtab_node *new_node = NULL;
633 + /* Do not allow a clone to be created if function-cloning is disabled */
634 + if (!flag_clone_functions)
635 + return NULL;
637 /* First try to look up existing alias or base object
638 (if that is already non-overwritable). */
639 symtab_node *node = ultimate_alias_target ();
640 diff -ru gcc-7.1.0.orig/gcc/testsuite/gcc.target/i386/local.c gcc-7.1.0/gcc/testsuite/gcc.target/i386/local.c
641 --- gcc-7.1.0.orig/gcc/testsuite/gcc.target/i386/local.c 2015-12-29 11:32:21.000000000 +0100
642 +++ gcc-7.1.0/gcc/testsuite/gcc.target/i386/local.c 2017-05-04 16:10:05.918123867 +0200
643 @@ -1,5 +1,6 @@
644 /* { dg-do compile } */
645 -/* { dg-options "-O2 -funit-at-a-time" } */
646 +/* { dg-options "-O2 -funit-at-a-time -fno-strict-calling-conventions" { target ia32 } } */
647 +/* { dg-options "-O2 -funit-at-a-time" { target lp64 } } */
648 /* { dg-final { scan-assembler "magic\[^\\n\]*eax" { target ia32 } } } */
649 /* { dg-final { scan-assembler "magic\[^\\n\]*(edi|ecx)" { target { ! ia32 } } } } */
651 diff -ru gcc-7.1.0.orig/gcc/tree-inline.c gcc-7.1.0/gcc/tree-inline.c
652 --- gcc-7.1.0.orig/gcc/tree-inline.c 2017-03-28 19:24:57.000000000 +0200
653 +++ gcc-7.1.0/gcc/tree-inline.c 2017-05-04 16:10:05.921005664 +0200
654 @@ -5659,7 +5659,8 @@
655 tree_versionable_function_p (tree fndecl)
657 return (!lookup_attribute ("noclone", DECL_ATTRIBUTES (fndecl))
658 - && copy_forbidden (DECL_STRUCT_FUNCTION (fndecl)) == NULL);
659 + && (copy_forbidden (DECL_STRUCT_FUNCTION (fndecl)) == NULL)
660 + && flag_clone_functions);
663 /* Delete all unreachable basic blocks and update callgraph.
664 diff -ru gcc-7.1.0.orig/include/dwarf2.def gcc-7.1.0/include/dwarf2.def
665 --- gcc-7.1.0.orig/include/dwarf2.def 2017-02-25 09:18:24.000000000 +0100
666 +++ gcc-7.1.0/include/dwarf2.def 2017-05-04 16:10:05.921594433 +0200
667 @@ -445,6 +445,8 @@
668 DW_AT (DW_AT_GNU_discriminator, 0x2136)
669 /* VMS extensions. */
670 DW_AT (DW_AT_VMS_rtnbeg_pd_address, 0x2201)
671 +/* Sun extension. */
672 +DW_AT (DW_AT_SUN_amd64_parmdump, 0x2224)
673 /* GNAT extensions. */
674 /* GNAT descriptive type.
675 See http://gcc.gnu.org/wiki/DW_AT_GNAT_descriptive_type . */
676 diff -ru gcc-7.1.0.orig/libgcc/config.host gcc-7.1.0/libgcc/config.host
677 --- gcc-7.1.0.orig/libgcc/config.host 2017-03-10 20:33:27.000000000 +0100
678 +++ gcc-7.1.0/libgcc/config.host 2017-05-04 16:10:05.922076037 +0200
679 @@ -269,7 +269,7 @@
680 *-*-solaris2*)
681 # Unless linker support and dl_iterate_phdr are present,
682 # unwind-dw2-fde-dip.c automatically falls back to unwind-dw2-fde.c.
683 - tmake_file="$tmake_file sol2/t-sol2 t-eh-dw2-dip t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-elf-ver"
684 + tmake_file="$tmake_file sol2/t-sol2 t-eh-dw2-dip t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-elf-ver t-crtstuff-pic"
685 if test $with_gnu_ld = yes; then
686 tmake_file="$tmake_file t-slibgcc-gld"
687 else
688 @@ -289,6 +289,7 @@
689 i?86-*-solaris2.1[0-9]* | x86_64-*-solaris2.1[0-9]*)
690 # Solaris 10+/x86 provides crt1.o, crti.o, crtn.o, and gcrt1.o as
691 # part of the base system.
692 + extra_parts="$extra_parts crtbeginS.o crtendS.o"
694 sparc*-*-solaris2.1[0-9]*)
695 # Solaris 10+/SPARC lacks crt1.o and gcrt1.o.