diff --git a/Makefile.in b/Makefile.in index db4fa6c62605c..fab91f13000f7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -655,7 +655,7 @@ STAGEautofeedback_TFLAGS = $(STAGE3_TFLAGS) # may result in additional warnings. STAGEautofeedback_CONFIGURE_FLAGS = $(filter-out --enable-werror-always,$(STAGE_CONFIGURE_FLAGS)) -do-compare = @do_compare@ +do-compare = $(srcdir)/contrib/compare-debug $$f1 $$f2 do-compare3 = $(do-compare) # ----------------------------------------------- diff --git a/README.md b/README.md new file mode 100644 index 0000000000000..fcb3d7f9570b2 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +This is the GCC used for compiling illumos. + +The `il-*` branches contain the the patches used for building illumos, which +are rebased versions of those used for Solaris/OpenSolaris, and then +additional changes. The versions actually in use are tagged with +`il-VERSION-ilN` where _N_ version the illumos changes over the GCC version in +question. + +The `wip/*` branches are works in progress and _should never be used_ + +The `codesourcery/*` and `sun/*` branches contain the original GCCs as patched by +CodeSourcery and Sun Microsystems for use compiling Solaris and OpenSolaris as +was, and the GCCFSS patches of Sun's + +When building the compilers for illumos use the flags generally used are: + +i386 +~~~sh +../../configure --prefix=/opt/gcc/$VER --with-as=/usr/bin/gas --with-gnu-as \ + --with-ld=/usr/bin/ld --without-gnu-ld --enable-languages="c,c++,objc" \ + --enable-shared --with-mpfr-include=/usr/include/mpfr \ + --with-gmp-include=/usr/include/gmp \ + --with-pkgversion="Illumos $(git describe --all)" \ + --with-bugurl="http://github.com/richlowe/gcc/issues" +~~~ + +sparc +~~~sh +../../configure --prefix=/opt/gcc/$VER --without-gnu-as --with-as=/usr/ccs/bin/as" \ + --with-ld=/usr/bin/ld --without-gnu-ld --enable-languages="c,c++,objc" \ + --enable-shared --with-mpfr-include=/usr/include/mpfr \ + --with-gmp-include=/usr/include/gmp \ + --with-pkgversion="Illumos $(git describe --all)" \ + --with-bugurl="http://github.com/richlowe/gcc/issues" +~~~ + +Please use the correct `--with-bugurl` and `--with-pkgversion` flags as +appropriate for any modifications you make, but please also be sure that they +accurately describe what is in use (ie, are not left at the defaults) either. diff --git a/contrib/make_sunver.pl b/contrib/make_sunver.pl index 32e639ed8732a..8c9ff74a8f0ea 100644 --- a/contrib/make_sunver.pl +++ b/contrib/make_sunver.pl @@ -55,7 +55,7 @@ # columns. # The path to elfdump. -my $elfdump = "/usr/ccs/bin/elfdump"; +my $elfdump = "/usr/bin/elfdump"; if (-f $elfdump) { open ELFDUMP,$elfdump.' -s '.(join ' ',@OBJECTS).'|' or die $!; diff --git a/fixincludes/fixinc.in b/fixincludes/fixinc.in index 0bd8027a55492..0ca234fcb9947 100755 --- a/fixincludes/fixinc.in +++ b/fixincludes/fixinc.in @@ -212,7 +212,7 @@ search_dirs="" while [ -n "$dirs" ] && [ $levels -gt 0 ] do - levels=`expr $levels - 1` + levels=`expr $levels - 1; true` newdirs= for d in $dirs do @@ -340,7 +340,7 @@ if $LINKS; then cd $LIB while [ x$dirname != x ]; do component=`echo $dirname | sed -e 's|/.*$||'` - mkdir $component >/dev/null 2>&1 + mkdir -p $component >/dev/null 2>&1 cd $component dirmade=$dirmade/$component dirname=`echo $dirname | sed -e 's|[^/]*//*||'` diff --git a/gcc/attribs.cc b/gcc/attribs.cc index 3ab0b0fd87a44..e2d005cb8b088 100644 --- a/gcc/attribs.cc +++ b/gcc/attribs.cc @@ -709,6 +709,15 @@ decl_attributes (tree *node, tree attributes, int flags, attributes = tree_cons (get_identifier ("no_icf"), NULL, attributes); } + /* If the user passed -fno-clone-functions, all functions should be treated + as "noclone" */ + if (TREE_CODE (*node) == FUNCTION_DECL + && !flag_clone_functions) + { + if (lookup_attribute ("noclone", attributes) == NULL) + attributes = tree_cons (get_identifier ("noclone"), NULL, attributes); + } + targetm.insert_attributes (*node, &attributes); /* Note that attributes on the same declaration are not necessarily diff --git a/gcc/common.opt b/gcc/common.opt index ad3488447752b..d32318862a817 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1231,6 +1231,11 @@ fcode-hoisting Common Var(flag_code_hoisting) Optimization Enable code hoisting. +fclone-functions +Common Var(flag_clone_functions) Init(1) +Allow the compiler to clone functions to facilitate certain optimizations. +Enabled by default. + fcombine-stack-adjustments Common Var(flag_combine_stack_adjustments) Optimization Looks for opportunities to reduce stack adjustments and stack references. @@ -2343,6 +2348,10 @@ fomit-frame-pointer Common Var(flag_omit_frame_pointer) Optimization When possible do not generate stack frames. +fforce-omit-frame-pointer +Common Var(flag_force_omit_frame_pointer) Optimization +When possible, do not generate stack frames. Hinders debugging with mdb and dtrace. + fopenmp-target-simd-clone Common Alias(fopenmp-target-simd-clone=,any,none) @@ -2931,6 +2940,10 @@ fstrict-aliasing Common Var(flag_strict_aliasing) Optimization Assume strict aliasing rules apply. +fstrict-calling-conventions +Common Var(flag_strict_calling_conventions) Init(1) +Use strict ABI calling conventions even for static functions + fstrict-overflow Common Treat signed overflow as undefined. Negated as -fwrapv -fwrapv-pointer. diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc index cd459878b83e4..bc0b26e328263 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -2796,6 +2796,11 @@ ix86_option_override_internal (bool main_args_p, &= ~(OPTION_MASK_ISA2_AVX5124FMAPS | OPTION_MASK_ISA2_AVX5124VNNIW); } + if (!TARGET_64BIT_P (opts->x_ix86_isa_flags) && TARGET_SAVE_ARGS) { + warning (0, "-msave-args only works in x32 or 64-bit mode; ignoring"); + opts->x_ix86_target_flags &= ~OPTION_MASK_SAVE_ARGS; + } + /* Validate -mpreferred-stack-boundary= value or default it to PREFERRED_STACK_BOUNDARY_DEFAULT. */ ix86_preferred_stack_boundary = PREFERRED_STACK_BOUNDARY_DEFAULT; @@ -3261,6 +3266,18 @@ ix86_option_override_internal (bool main_args_p, free (str); } + /* + * We never want to omit the frame pointer, regardless of the optimisation + * level or options to gcc - we like stack traces too much and it is of + * questionable benefit anyway, even on i386. + */ + + if (flag_force_omit_frame_pointer == 0) + { + flag_omit_frame_pointer = 0; + opts->x_flag_omit_frame_pointer = 0; + } + /* Save the initial options in case the user does function specific options. */ if (main_args_p) diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 2e1a31d05403d..becf8da05146c 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -433,6 +433,9 @@ static bool i386_asm_output_addr_const_extra (FILE *, rtx); static bool ix86_can_inline_p (tree, tree); static unsigned int ix86_minimum_incoming_stack_boundary (bool); +static int ix86_nsaved_args (void); +static rtx_def* pro_epilogue_adjust_stack (rtx, rtx, rtx, int, bool); + /* Whether -mtune= or -march= were specified */ int ix86_tune_defaulted; @@ -1213,6 +1216,7 @@ ix86_function_regparm (const_tree type, const_tree decl) and callee not, or vice versa. Instead look at whether the callee is optimized or not. */ if (target && opt_for_fn (target->decl, optimize) + && !flag_strict_calling_conventions && !(profile_flag && !flag_fentry)) { if (target->local && target->can_change_signature) @@ -1309,6 +1313,7 @@ ix86_function_sseregparm (const_tree type, const_tree decl, bool warn) /* TARGET_SSE_MATH */ && (target_opts_for_fn (target->decl)->x_ix86_fpmath & FPMATH_SSE) && opt_for_fn (target->decl, optimize) + && !flag_strict_calling_conventions && !(profile_flag && !flag_fentry)) { if (target->local && target->can_change_signature) @@ -5930,7 +5935,7 @@ ix86_can_use_return_insn_p (void) struct ix86_frame &frame = cfun->machine->frame; return (frame.stack_pointer_offset == UNITS_PER_WORD - && (frame.nregs + frame.nsseregs) == 0); + && (frame.nmsave_args + frame.nregs + frame.nsseregs) == 0); } /* Return stack frame size. get_frame_size () returns used stack slots @@ -5967,6 +5972,9 @@ ix86_frame_pointer_required (void) if (TARGET_32BIT_MS_ABI && cfun->calls_setjmp) return true; + if (TARGET_SAVE_ARGS) + return true; + /* Win64 SEH, very large frames need a frame-pointer as maximum stack allocation is 4GB. */ if (TARGET_64BIT_MS_ABI && ix86_get_frame_size () > SEH_MAX_FRAME_SIZE) @@ -6065,7 +6073,9 @@ indirect_thunk_name (char name[32], unsigned int regno, if (regno != INVALID_REGNUM && regno != CX_REG && ret_p) gcc_unreachable (); - if (USE_HIDDEN_LINKONCE) + if (USE_HIDDEN_LINKONCE || + (cfun && cfun->machine->indirect_branch_type == + indirect_branch_thunk_extern)) { const char *prefix; @@ -6910,6 +6920,7 @@ ix86_compute_frame_layout (void) frame->nregs = ix86_nsaved_regs (); frame->nsseregs = ix86_nsaved_sseregs (); + frame->nmsave_args = ix86_nsaved_args (); /* 64-bit MS ABI seem to require stack alignment to be always 16, except for function prologues, leaf functions and when the defult @@ -6995,7 +7006,8 @@ ix86_compute_frame_layout (void) } frame->save_regs_using_mov - = TARGET_PROLOGUE_USING_MOVE && m->use_fast_prologue_epilogue; + = TARGET_FORCE_SAVE_REGS_USING_MOV || + (TARGET_PROLOGUE_USING_MOVE && m->use_fast_prologue_epilogue); /* Skip return address and error code in exception handler. */ offset = INCOMING_FRAME_SP_OFFSET; @@ -7012,6 +7024,13 @@ ix86_compute_frame_layout (void) /* The traditional frame pointer location is at the top of the frame. */ frame->hard_frame_pointer_offset = offset; + if (TARGET_SAVE_ARGS) + { + offset += frame->nmsave_args * UNITS_PER_WORD; + offset += (frame->nmsave_args % 2) * UNITS_PER_WORD; + } + frame->arg_save_offset = offset; + /* Register save area */ offset += frame->nregs * UNITS_PER_WORD; frame->reg_save_offset = offset; @@ -7145,7 +7164,7 @@ ix86_compute_frame_layout (void) /* Size prologue needs to allocate. */ to_allocate = offset - frame->sse_reg_save_offset; - if ((!to_allocate && frame->nregs <= 1) + if ((!TARGET_SAVE_ARGS && !to_allocate && frame->nregs <= 1) || (TARGET_64BIT && to_allocate >= HOST_WIDE_INT_C (0x80000000)) /* If static stack checking is enabled and done with probes, the registers need to be saved before allocating the frame. */ @@ -7169,7 +7188,11 @@ ix86_compute_frame_layout (void) { frame->red_zone_size = to_allocate; if (frame->save_regs_using_mov) + { frame->red_zone_size += frame->nregs * UNITS_PER_WORD; + frame->red_zone_size += frame->nmsave_args * UNITS_PER_WORD; + frame->red_zone_size += (frame->nmsave_args % 2) * UNITS_PER_WORD; + } if (frame->red_zone_size > RED_ZONE_SIZE - RED_ZONE_RESERVE) frame->red_zone_size = RED_ZONE_SIZE - RED_ZONE_RESERVE; } @@ -7227,6 +7250,22 @@ ix86_compute_frame_layout (void) else frame->hard_frame_pointer_offset = frame->hfp_save_offset; } + + if (getenv("DEBUG_FRAME_STUFF") != NULL) + { + printf("nmsave_args: %d\n", frame->nmsave_args); + printf("nsseregs: %d\n", frame->nsseregs); + printf("nregs: %d\n", frame->nregs); + + printf("frame_pointer_offset: %llx\n", frame->frame_pointer_offset); + printf("hard_frame_pointer_offset: %llx\n", frame->hard_frame_pointer_offset); + printf("stack_pointer_offset: %llx\n", frame->stack_pointer_offset); + printf("hfp_save_offset: %llx\n", frame->hfp_save_offset); + printf("arg_save_offset: %llx\n", frame->arg_save_offset); + printf("reg_save_offset: %llx\n", frame->reg_save_offset); + printf("sse_reg_save_offset: %llx\n", frame->sse_reg_save_offset); + + } } /* This is semi-inlined memory_address_length, but simplified @@ -7440,9 +7479,26 @@ static void ix86_emit_save_regs (void) { int regno; + struct ix86_frame &frame = cfun->machine->frame; rtx_insn *insn; bool use_ppx = TARGET_APX_PPX && !crtl->calls_eh_return; + if (TARGET_SAVE_ARGS) + { + int i; + int start = cfun->returns_struct; + + for (i = start; i < start + frame.nmsave_args; i++) + { + regno = x86_64_int_parameter_registers[i]; + insn = emit_insn (gen_push (gen_rtx_REG (word_mode, regno))); + RTX_FRAME_RELATED_P (insn) = 1; + } + if (frame.nmsave_args % 2 != 0) + pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx, + GEN_INT (-UNITS_PER_WORD), -1, false); + } + if (!TARGET_APX_PUSH2POP2 || !ix86_can_use_push2pop2 () || cfun->machine->func_type != TYPE_NORMAL) @@ -7608,9 +7664,29 @@ ix86_emit_save_reg_using_mov (machine_mode mode, unsigned int regno, /* Emit code to save registers using MOV insns. First register is stored at CFA - CFA_OFFSET. */ static void -ix86_emit_save_regs_using_mov (HOST_WIDE_INT cfa_offset) +ix86_emit_save_regs_using_mov (const struct ix86_frame &frame) { unsigned int regno; + HOST_WIDE_INT cfa_offset = frame.arg_save_offset; + + if (TARGET_SAVE_ARGS) + { + int i; + int start = cfun->returns_struct; + + /* We deal with this twice? */ + if (frame.nmsave_args % 2 != 0) + cfa_offset -= UNITS_PER_WORD; + + for (i = start + frame.nmsave_args - 1; i >= start; i--) + { + regno = x86_64_int_parameter_registers[i]; + ix86_emit_save_reg_using_mov(word_mode, regno, cfa_offset); + cfa_offset -= UNITS_PER_WORD; + } + } + + cfa_offset = frame.reg_save_offset; for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (GENERAL_REGNO_P (regno) && ix86_save_reg (regno, true, true)) @@ -8968,7 +9044,7 @@ ix86_expand_prologue (void) } } - int_registers_saved = (frame.nregs == 0); + int_registers_saved = (frame.nregs == 0 && frame.nmsave_args == 0); sse_registers_saved = (frame.nsseregs == 0); save_stub_call_needed = (m->call_ms2sysv); gcc_assert (sse_registers_saved || !save_stub_call_needed); @@ -9011,7 +9087,7 @@ ix86_expand_prologue (void) && (! TARGET_STACK_PROBE || frame.stack_pointer_offset < CHECK_STACK_LIMIT)) { - ix86_emit_save_regs_using_mov (frame.reg_save_offset); + ix86_emit_save_regs_using_mov (frame); cfun->machine->red_zone_used = true; int_registers_saved = true; } @@ -9311,7 +9387,7 @@ ix86_expand_prologue (void) } if (!int_registers_saved) - ix86_emit_save_regs_using_mov (frame.reg_save_offset); + ix86_emit_save_regs_using_mov (frame); if (!sse_registers_saved) ix86_emit_save_sse_regs_using_mov (frame.sse_reg_save_offset); else if (save_stub_call_needed) @@ -9346,6 +9422,7 @@ ix86_expand_prologue (void) relative to the value of the stack pointer at the end of the function prologue, and moving instructions that access redzone area via frame pointer inside push sequence violates this assumption. */ + /* XXX: We may wish to do this when SAVE_ARGS in general */ if (frame_pointer_needed && frame.red_zone_size) emit_insn (gen_memory_blockage ()); @@ -9848,6 +9925,7 @@ ix86_expand_epilogue (int style) /* See the comment about red zone and frame pointer usage in ix86_expand_prologue. */ + /* XXX: We may wish to do this when SAVE_ARGS in general */ if (frame_pointer_needed && frame.red_zone_size) emit_insn (gen_memory_blockage ()); @@ -10095,6 +10173,32 @@ ix86_expand_epilogue (int style) ix86_emit_restore_regs_using_pop (TARGET_APX_PPX); } + /* + * For each saved argument, emit a restore note, to make sure it happens + * correctly within the shrink wrapping (I think). + * + * Note that 'restore' in this case merely means the rule is the same as + * it was on function entry, not that we have actually done a register + * restore (which of course, we haven't). + * + * If we do not do this, the DWARF code will emit sufficient restores to + * provide balance on its own initiative, which in the presence of + * -fshrink-wrap may actually _introduce_ unbalance (whereby we only + * .cfi_offset a register sometimes, but will always .cfi_restore it. + * This will trip an assert.) + */ + if (TARGET_SAVE_ARGS && frame.nmsave_args > 0) { + int start = cfun->returns_struct; + int i; + + for (i = start + frame.nmsave_args - 1; i >= start; i--) + queued_cfa_restores + = alloc_reg_note (REG_CFA_RESTORE, + gen_rtx_REG(Pmode, + x86_64_int_parameter_registers[i]), + queued_cfa_restores); + } + /* If we used a stack pointer and haven't already got rid of it, then do so now. */ if (m->fs.fp_valid) @@ -11259,6 +11363,18 @@ ix86_cannot_force_const_mem (machine_mode mode, rtx x) return !ix86_legitimate_constant_p (mode, x); } +/* Return number of arguments to be saved on the stack with + -msave-args. */ + +static int +ix86_nsaved_args (void) +{ + if (TARGET_SAVE_ARGS) + return crtl->args.info.regno - cfun->returns_struct; + else + return 0; +} + /* Nonzero if the symbol is marked as dllimport, or as stub-variable, otherwise zero. */ diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 2fc82b175e6d2..2ddd5b6b0f3c5 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2623,6 +2623,11 @@ enum avx_u128_state saved frame pointer if frame_pointer_needed <- HARD_FRAME_POINTER + + [-msave-args] <- arg_save_offset + + [saveargs padding] + [saved regs] <- reg_save_offset [padding0] @@ -2656,6 +2661,7 @@ enum avx_u128_state */ struct GTY(()) ix86_frame { + int nmsave_args; int nsseregs; int nregs; int va_arg_size; @@ -2667,6 +2673,7 @@ struct GTY(()) ix86_frame HOST_WIDE_INT hard_frame_pointer_offset; HOST_WIDE_INT stack_pointer_offset; HOST_WIDE_INT hfp_save_offset; + HOST_WIDE_INT arg_save_offset; HOST_WIDE_INT reg_save_offset; HOST_WIDE_INT stack_realign_allocate; HOST_WIDE_INT stack_realign_offset; diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt index df95963dd9f05..4f98c1e9e185e 100644 --- a/gcc/config/i386/i386.opt +++ b/gcc/config/i386/i386.opt @@ -537,6 +537,16 @@ mtls-direct-seg-refs Target Mask(TLS_DIRECT_SEG_REFS) Use direct references against %gs when accessing tls data. +msave-args +Target Mask(SAVE_ARGS) Var(ix86_target_flags) +Save integer arguments on the stack at function entry. + +mforce-save-regs-using-mov +Target Mask(FORCE_SAVE_REGS_USING_MOV) Var(ix86_target_flags) +Save registers using push in function prologues. This is intentionally +undocumented and used for msave-args testing. + + mtune= Target RejectNegative Negative(mtune=) Joined Var(ix86_tune_string) Schedule code for given CPU. diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h index b93bc4c9d303b..6bbcd5d7afe53 100644 --- a/gcc/config/i386/sol2.h +++ b/gcc/config/i386/sol2.h @@ -252,3 +252,20 @@ along with GCC; see the file COPYING3. If not see /* We do not need NT_VERSION notes. */ #undef X86_FILE_START_VERSION_DIRECTIVE #define X86_FILE_START_VERSION_DIRECTIVE false + +/* + * As of 5788, the illumos libc includes support for the stack protector + * __stack_chk_fail() function and for the __stack_chk_guard variable. + * That means that, for most cases, no extra objects need to be linked in + * when compiling with one of the -fstack-protector options. + * However, for 32-bit PIC/PIE objects, the gcc stack protector emits a + * function call to __stack_chk_fail_local(); this symbol is provided in + * illumos via the libssp_ns.a object. The spec below includes this in the + * link when appropriate. + */ +#if defined(TARGET_LIBC_PROVIDES_SSP) +#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all|" \ + "fstack-protector-strong|fstack-protector-explicit:" \ + DEF_ARCH32_SPEC("-lssp_ns") \ + "}" +#endif diff --git a/gcc/config/sol2-c.cc b/gcc/config/sol2-c.cc index 26ec7d3d783ff..9fa31b96ddc88 100644 --- a/gcc/config/sol2-c.cc +++ b/gcc/config/sol2-c.cc @@ -31,16 +31,23 @@ along with GCC; see the file COPYING3. If not see #include "c-family/c-pragma.h" -/* cmn_err only accepts "l" and "ll". */ +#define NO_FMT NULL, FMT_LEN_none, STD_C89 + static const format_length_info cmn_err_length_specs[] = { + { "h", FMT_LEN_h, STD_C89, "hh", FMT_LEN_hh, STD_C99, 0 }, { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C89, 0 }, - { NULL, FMT_LEN_none, STD_C89, NULL, FMT_LEN_none, STD_C89, 0 } + { "j", FMT_LEN_j, STD_C99, NO_FMT, 0 }, + { "z", FMT_LEN_z, STD_C99, NO_FMT, 0 }, + { NO_FMT, NO_FMT, 0 } }; static const format_flag_spec cmn_err_flag_specs[] = { + { '0', 0, 0, 0, N_("'0' flag"), N_("the '0' flag"), STD_C89 }, + { '-', 0, 0, 0, N_("'-' flag"), N_("the '-' flag"), STD_C89 }, { 'w', 0, 0, 0, N_("field width"), N_("field width in printf format"), STD_C89 }, + { 'p', 0, 0, 0, N_("precision"), N_("precision in printf format"), STD_C89 }, { 'L', 0, 0, 0, N_("length modifier"), N_("length modifier in printf format"), STD_C89 }, { 0, 0, 0, 0, NULL, NULL, STD_C89 } }; @@ -48,6 +55,7 @@ static const format_flag_spec cmn_err_flag_specs[] = static const format_flag_pair cmn_err_flag_pairs[] = { + { '0', '-', 1, 0 }, { 0, 0, 0, 0 } }; @@ -56,22 +64,22 @@ static const format_char_info bitfield_string_type = static const format_char_info cmn_err_char_table[] = { - /* C89 conversion specifiers. */ - { "dD", 0, STD_C89, { T89_I, BADLEN, BADLEN, T89_L, T9L_LL, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "", NULL }, - { "oOxX",0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "", NULL }, - { "u", 0, STD_C89, { T89_UI, BADLEN, BADLEN, T89_UL, T9L_ULL, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "", NULL }, - { "c", 0, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "", NULL }, - { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "c", NULL }, - { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "cR", NULL }, - { "b", 0, STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "", &bitfield_string_type }, + /* none hh h l ll L z t j H D DD */ + { "dD", 0, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, BADLEN, T99_SST, BADLEN, T99_IM , BADLEN, BADLEN, BADLEN }, "-wp0", "", NULL }, + { "oOxX",0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, BADLEN, T99_ST, BADLEN, T99_UIM, BADLEN, BADLEN, BADLEN }, "-wp0", "", NULL }, + { "u", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, BADLEN, T99_ST, BADLEN, T99_UIM, BADLEN, BADLEN, BADLEN }, "-wp0", "", NULL }, + { "c", 0, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN , BADLEN, BADLEN, BADLEN }, "-w", "", NULL }, + { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN , BADLEN, BADLEN, BADLEN }, "-w", "c", NULL }, + { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN , BADLEN, BADLEN, BADLEN }, "-wp", "cR", NULL }, + { "b", 0, STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN , BADLEN, BADLEN, BADLEN }, "-w0", "", &bitfield_string_type }, { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL } }; EXPORTED_CONST format_kind_info solaris_format_types[] = { - { "cmn_err", cmn_err_length_specs, cmn_err_char_table, "", NULL, + { "cmn_err", cmn_err_length_specs, cmn_err_char_table, "0-", NULL, cmn_err_flag_specs, cmn_err_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_EMPTY_PREC_OK, - 'w', 0, 0, 0, 'L', 0, + 'w', 0, 'p', 0, 'L', 0, &integer_type_node, &integer_type_node } }; diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h index 85c1f9daf6a9f..0e1fbaeaf8635 100644 --- a/gcc/config/sol2.h +++ b/gcc/config/sol2.h @@ -85,6 +85,7 @@ along with GCC; see the file COPYING3. If not see do { \ builtin_define_std ("unix"); \ builtin_define_std ("sun"); \ + builtin_define ("__illumos__"); \ builtin_define ("__svr4__"); \ builtin_define ("__SVR4"); \ builtin_assert ("system=unix"); \ @@ -200,16 +201,22 @@ along with GCC; see the file COPYING3. If not see executable programs. */ #undef STARTFILE_ARCH_SPEC #define STARTFILE_ARCH_SPEC \ - "%{!shared:%{!symbolic: \ - %{ansi|std=c*|std=iso9899\\:199409:values-Xc.o%s; :values-Xa.o%s} \ - %{std=c90|std=gnu90:values-xpg4.o%s; :values-xpg6.o%s}}}" + "%{!shared:%{!symbolic:%{!G: \ + %{ \ + std=c89|std=c90|std=gnu89|std=gnu90:values-Xa.o%s; \ + ansi|std=c*|std=iso9899\\:199409:values-Xc.o%s; \ + :values-Xa.o%s} \ + %{ \ + std=c89|std=c90|std=gnu89|std=gnu90:; \ + :values-xpg6.o%s \ + }}}}" #if defined(HAVE_LD_PIE) && defined(HAVE_SOLARIS_CRTS) #define STARTFILE_CRTBEGIN_SPEC "%{static:crtbegin.o%s; \ - shared|" PIE_SPEC ":crtbeginS.o%s; \ + shared|G|" PIE_SPEC ":crtbeginS.o%s; \ :crtbegin.o%s}" #else -#define STARTFILE_CRTBEGIN_SPEC "crtbegin.o%s" +#define STARTFILE_CRTBEGIN_SPEC "%{shared|G:crtbeginS.o%s;:crtbegin.o%s}" #endif #if ENABLE_VTABLE_VERIFY @@ -252,10 +259,10 @@ along with GCC; see the file COPYING3. If not see #endif #define LIBASAN_EARLY_SPEC ASAN_REJECT_SPEC \ - " %{!shared:libasan_preinit%O%s} \ - %{static-libasan:%{!shared: -Bstatic "\ + " %{!shared:%{!G:libasan_preinit%O%s}} \ + %{static-libasan:%{!shared:%{!G: -Bstatic "\ LD_WHOLE_ARCHIVE_OPTION " -lasan " LD_NO_WHOLE_ARCHIVE_OPTION \ - " -Bdynamic}}%{!static-libasan:-z now -lasan}" + " -Bdynamic}}}%{!static-libasan:-z now -lasan}" /* Error out on -fsanitize=thread|leak. */ #define LIBTSAN_EARLY_SPEC "\ @@ -268,28 +275,28 @@ along with GCC; see the file COPYING3. If not see #ifdef HAVE_SOLARIS_CRTS /* Since Solaris 11.4, the OS delivers crt1.o, crti.o, and crtn.o, with a hook for compiler-dependent stuff like profile handling. */ -#define STARTFILE_SPEC "%{!shared:%{!symbolic: \ +#define STARTFILE_SPEC "%{!shared:%{!symbolic:%{!G: \ crt1.o%s \ %{p:%e-p is not supported; \ pg:crtpg.o%s gmon.o%s; \ - :crtp.o%s}}} \ + :crtp.o%s}}}} \ crti.o%s %(startfile_arch) %(startfile_crtbegin) \ %(startfile_vtv)" #else -#define STARTFILE_SPEC "%{!shared:%{!symbolic: \ +#define STARTFILE_SPEC "%{!shared:%{!symbolic:%{!G: \ %{p:mcrt1.o%s; \ pg:gcrt1.o%s gmon.o%s; \ - :crt1.o%s}}} \ + :crt1.o%s}}}} \ crti.o%s %(startfile_arch) %(startfile_crtbegin) \ %(startfile_vtv)" #endif #if defined(HAVE_LD_PIE) && defined(HAVE_SOLARIS_CRTS) #define ENDFILE_CRTEND_SPEC "%{static:crtend.o%s; \ - shared|" PIE_SPEC ":crtendS.o%s; \ + shared|G|" PIE_SPEC ":crtendS.o%s; \ :crtend.o%s}" #else -#define ENDFILE_CRTEND_SPEC "crtend.o%s" +#define ENDFILE_CRTEND_SPEC "%{shared|G:crtendS.o%s;:crtend.o%s}" #endif #undef ENDFILE_SPEC @@ -299,8 +306,7 @@ along with GCC; see the file COPYING3. If not see #undef LINK_ARCH32_SPEC_BASE #define LINK_ARCH32_SPEC_BASE \ - "%{G:-G} \ - %{YP,*} \ + "%{YP,*} \ %{R*} \ %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp%R/lib:%R/usr/lib} \ %{!p:%{!pg:-Y P,%R/lib:%R/usr/lib}}}" @@ -312,8 +318,7 @@ along with GCC; see the file COPYING3. If not see ARCH64_SUBDIR appended to the paths. */ #undef LINK_ARCH64_SPEC_BASE #define LINK_ARCH64_SPEC_BASE \ - "%{G:-G} \ - %{YP,*} \ + "%{YP,*} \ %{R*} \ %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/" ARCH64_SUBDIR ":%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "} \ %{!p:%{!pg:-Y P,%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "}}}" @@ -396,7 +401,7 @@ along with GCC; see the file COPYING3. If not see #if !defined(USE_GLD) && defined(ENABLE_SHARED_LIBGCC) /* With Sun ld, use mapfile to enforce direct binding to libgcc_s unwinder. */ #define LINK_LIBGCC_MAPFILE_SPEC \ - "%{shared|shared-libgcc:-M %slibgcc-unwind.map}" + "%{shared|shared-libgcc|G:-M %slibgcc-unwind.map}" #else /* GNU ld doesn't support direct binding. */ #define LINK_LIBGCC_MAPFILE_SPEC "" @@ -413,9 +418,9 @@ along with GCC; see the file COPYING3. If not see #undef LINK_SPEC #define LINK_SPEC \ "%{h*} %{v:-V} \ - %{!shared:%{!static:%{rdynamic: " RDYNAMIC_SPEC "}}} \ + %{!shared:%{!static:%{!G:%{rdynamic: " RDYNAMIC_SPEC "}}}} \ %{static:-dn -Bstatic} \ - %{shared:-G -dy %{!mimpure-text:-z text}} " \ + %{shared|G:-G -dy %{!mimpure-text:-z text}} " \ LINK_LIBGCC_MAPFILE_SPEC LINK_CLEARCAP_SPEC " \ %{symbolic:-Bsymbolic -G -dy -z text} \ %(link_arch) \ diff --git a/gcc/configure b/gcc/configure index a4dcd1317834a..6e91335379e2c 100755 --- a/gcc/configure +++ b/gcc/configure @@ -26158,11 +26158,12 @@ if test $in_tree_ld != yes ; then # numbers can be used in ld.so.1 feature checks even if a different # linker is configured. ld_ver=`$gcc_cv_ld -V 2>&1` - if echo "$ld_ver" | grep 'Solaris Link Editors' > /dev/null; then - ld_vers=`echo $ld_ver | sed -n \ - -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'` + if echo "$ld_ver" | $EGREP 'Solaris Link Editors|Solaris ELF Utilities' > /dev/null; then + ld_vers=`echo $ld_ver | /bin/sed -n \ + -E 's,^.*: (5|1[0-9])\.[0-9][0-9]*-([0-9]\.[0-9][0-9]*).*$,\2,p'` ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` + ld_vers_isillumos=`echo "$ld_ver" | grep '(illumos)'` fi ;; esac @@ -32415,6 +32416,8 @@ elif test x$gcc_cv_ld != x; then # Sun ld has various bugs in .eh_frame_hdr support before version 1.2251. if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2251; then gcc_cv_ld_eh_frame_hdr=yes + elif test "$ld_vers_minor" -ge 1735 && test -n "$ld_vers_isillumos"; then + gcc_cv_ld_eh_frame_hdr=yes fi ;; esac @@ -33488,7 +33491,7 @@ fi # realistically usable GNU/Hurd configurations. # All supported versions of musl provide it as well gcc_cv_libc_provides_ssp=yes;; - *-*-darwin* | *-*-freebsd* | *-*-netbsd*) + *-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-solaris2*) ac_fn_cxx_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail" if test "x$ac_cv_func___stack_chk_fail" = xyes; then : gcc_cv_libc_provides_ssp=yes diff --git a/gcc/configure.ac b/gcc/configure.ac index cb743b5a875af..cf034d43cc778 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3170,11 +3170,12 @@ if test $in_tree_ld != yes ; then # numbers can be used in ld.so.1 feature checks even if a different # linker is configured. ld_ver=`$gcc_cv_ld -V 2>&1` - if echo "$ld_ver" | grep 'Solaris Link Editors' > /dev/null; then - ld_vers=`echo $ld_ver | sed -n \ - -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'` + if echo "$ld_ver" | $EGREP 'Solaris Link Editors|Solaris ELF Utilities' > /dev/null; then + ld_vers=`echo $ld_ver | /bin/sed -n \ + -E 's,^.*: (5|1[0-9])\.[0-9][0-9]*-([0-9]\.[0-9][0-9]*).*$,\2,p'` ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` + ld_vers_isillumos=`echo "$ld_ver" | grep '(illumos)'` fi ;; esac @@ -6127,6 +6128,8 @@ elif test x$gcc_cv_ld != x; then # Sun ld has various bugs in .eh_frame_hdr support before version 1.2251. if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2251; then gcc_cv_ld_eh_frame_hdr=yes + elif test "$ld_vers_minor" -ge 1735 && test -n "$ld_vers_isillumos"; then + gcc_cv_ld_eh_frame_hdr=yes fi ;; esac @@ -7032,7 +7035,7 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library, # realistically usable GNU/Hurd configurations. # All supported versions of musl provide it as well gcc_cv_libc_provides_ssp=yes;; - *-*-darwin* | *-*-freebsd* | *-*-netbsd*) + *-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-solaris2*) AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes], [echo "no __stack_chk_fail on this target"]) ;; diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 64728fead5127..36c607df30995 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -552,6 +552,7 @@ Objective-C and Objective-C++ Dialects}. -fassociative-math -fauto-profile -fauto-profile[=@var{path}] -fauto-inc-dec -fbranch-probabilities -fcaller-saves +-fclone-functions -fcombine-stack-adjustments -fconserve-stack -ffold-mem-offsets -fcompare-elim -fcprop-registers -fcrossjumping @@ -8036,6 +8037,12 @@ with multiple statement cases using flow-sensitive points-to information. Only warns when the converted pointer is dereferenced. Does not warn about incomplete types. +@opindex fstrict-calling-conventions +@item -fstrict-calling-conventions +Use strict ABI calling conventions even with local functions. +This disable certain optimizations that may cause GCC to call local +functions in a manner other than that described by the ABI. + @opindex Wstrict-overflow @opindex Wno-strict-overflow @item -Wstrict-overflow @@ -13415,6 +13422,15 @@ and then tries to find ways to combine them. Enabled by default at @option{-O1} and higher. +@opindex fno-clone-functions +@item -fno-clone-functions +Forbid the implicit cloning of functions implicit in certain +optimizations. This also effectively will disable any optimization +which wishes to clone functions, equivalent to each function having +the ``noclone'' attribute. This allows the prevention of the +dissociation of a piece of text from an intelligible and expected +symbol name, which may hamper debugging and tracing. + @opindex fipa-ra @item -fipa-ra Use caller save registers for allocation if those registers are not used by @@ -21241,6 +21257,10 @@ The default setting is @samp{tpidr_el0}. It is recommended to compile all code intended to interoperate with the same value of this option to avoid accessing a different thread pointer from the wrong exception level. +@opindex msave-args +@item -msave-args +Save integer-sized arguments on the stack on function entry. + @opindex mstrict-align @opindex mno-strict-align @item -mstrict-align diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index c91eb74683b15..947b44f94d366 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -24152,6 +24152,11 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) /* Add the calling convention attribute if requested. */ add_calling_convention_attribute (subr_die, decl); +#ifdef TARGET_SAVE_ARGS + if (declaration && TARGET_SAVE_ARGS) + add_AT_flag (subr_die, DW_AT_SUN_amd64_parmdump, 1); +#endif + /* Output Dwarf info for all of the stuff within the body of the function (if it has one - it may be just a declaration). diff --git a/gcc/gcc-ar.cc b/gcc/gcc-ar.cc index 479939fb0bf1f..e3aab73855b59 100644 --- a/gcc/gcc-ar.cc +++ b/gcc/gcc-ar.cc @@ -197,12 +197,12 @@ main (int ac, char **av) #endif /* Find the wrapped binutils program. */ - exe_name = find_a_file (&target_path, PERSONALITY, X_OK); + exe_name = find_a_file (&target_path, "g" PERSONALITY, X_OK); if (!exe_name) { - const char *real_exe_name = PERSONALITY; + const char *real_exe_name = "g" PERSONALITY; #ifdef CROSS_DIRECTORY_STRUCTURE - real_exe_name = concat (target_machine, "-", PERSONALITY, NULL); + real_exe_name = concat (target_machine, "-", "g" PERSONALITY, NULL); #endif exe_name = find_a_file (&path, real_exe_name, X_OK); if (!exe_name) diff --git a/gcc/gcc.cc b/gcc/gcc.cc index fc9f1f545dc87..297e121cab124 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc @@ -8067,15 +8067,34 @@ is_directory (const char *path1, bool linker) *cp = '\0'; /* Exclude directories that the linker is known to search. */ - if (linker - && IS_DIR_SEPARATOR (path[0]) - && ((cp - path == 6 - && filename_ncmp (path + 1, "lib", 3) == 0) - || (cp - path == 10 + if (linker && IS_DIR_SEPARATOR (path[0])) { + size_t len = cp - path; + + if (len >= 6 && filename_ncmp (path + 1, "lib", 3) == 0) { + if (len == 6) + return 0; + if (multilib_os_dir != NULL + && len == 6 + strlen(multilib_os_dir) + 1 + && filename_ncmp(path + 5, multilib_os_dir, + strlen(multilib_os_dir)) == 0) { + return 0; + } + } + + if (len >= 10 && filename_ncmp (path + 1, "usr", 3) == 0 && IS_DIR_SEPARATOR (path[4]) - && filename_ncmp (path + 5, "lib", 3) == 0))) - return 0; + && filename_ncmp (path + 5, "lib", 3) == 0) { + if (len == 10) + return 0; + if (multilib_os_dir != NULL + && len == 10 + strlen(multilib_os_dir) + 1 + && filename_ncmp(path + 9, multilib_os_dir, + strlen(multilib_os_dir)) == 0) { + return 0; + } + } + } return (stat (path, &st) >= 0 && S_ISDIR (st.st_mode)); } diff --git a/gcc/intl.cc b/gcc/intl.cc index 6f653bff9b802..175b882515fd0 100644 --- a/gcc/intl.cc +++ b/gcc/intl.cc @@ -74,17 +74,11 @@ gcc_init_libintl (void) if (!strcmp (open_quote, "`") && !strcmp (close_quote, "'")) { - /* Untranslated quotes that it may be possible to replace with - U+2018 and U+2019; but otherwise use "'" instead of "`" as - opening quote. */ + /* + * open_quote is ` purely for ease of translation. If they aren't + * translated, use ' for both + */ open_quote = "'"; -#if defined HAVE_LANGINFO_CODESET - if (locale_utf8) - { - open_quote = "\xe2\x80\x98"; - close_quote = "\xe2\x80\x99"; - } -#endif } } @@ -145,6 +139,3 @@ get_spaces (const char *str) spaces[len] = '\0'; return spaces; } - - - diff --git a/gcc/opts.cc b/gcc/opts.cc index 3333600e0ea24..e2eea988a936c 100644 --- a/gcc/opts.cc +++ b/gcc/opts.cc @@ -581,7 +581,7 @@ static const struct default_options default_options_table[] = { OPT_LEVELS_1_PLUS, OPT_fipa_reference, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fipa_reference_addressable, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fmerge_constants, NULL, 1 }, - { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 0 }, { OPT_LEVELS_1_PLUS, OPT_freorder_blocks, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fshrink_wrap, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fsplit_wide_types, NULL, 1 }, @@ -617,6 +617,7 @@ static const struct default_options default_options_table[] = { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_ftree_pta, NULL, 1 }, { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_ftree_sra, NULL, 1 }, + /* -O2 and -Os optimizations. */ { OPT_LEVELS_2_PLUS, OPT_fcaller_saves, NULL, 1 }, { OPT_LEVELS_2_PLUS, OPT_fcode_hoisting, NULL, 1 }, diff --git a/gcc/testsuite/gcc.dg/fno-clone-preserves-unused-args.c b/gcc/testsuite/gcc.dg/fno-clone-preserves-unused-args.c new file mode 100644 index 0000000000000..0955381c84807 --- /dev/null +++ b/gcc/testsuite/gcc.dg/fno-clone-preserves-unused-args.c @@ -0,0 +1,28 @@ +/* { dg-do compile { target { ilp32 } } } */ +/* { dg-options "-O2 -funit-at-a-time -fipa-sra -fno-clone-functions" } */ +/* { dg-final { scan-assembler "pushl.*\\\$1" } } */ +/* { dg-final { scan-assembler "pushl.*\\\$2" } } */ +/* { dg-final { scan-assembler "pushl.*\\\$3" } } */ +/* { dg-final { scan-assembler "pushl.*\\\$4" } } */ +/* { dg-final { scan-assembler "pushl.*\\\$5" } } */ + +#include + +/* + * Verify that preventing function cloning prevents constant prop/scalar + * reduction removing parameters + */ +static void +t(int, int, int, int, int) __attribute__ ((noinline)); + +int foo() +{ + t(1, 2, 3, 4, 5); +} + +/* Only use 3 params, bait constprop/sra into deleting the other two */ +static void +t(int a, int b, int c, int d, int e) +{ + printf("%d %d\n", a, b, c); +} diff --git a/gcc/testsuite/gcc.dg/format/cmn-err-1.c b/gcc/testsuite/gcc.dg/format/cmn-err-1.c index aea7779a2c3b4..cbb4a1f927c32 100644 --- a/gcc/testsuite/gcc.dg/format/cmn-err-1.c +++ b/gcc/testsuite/gcc.dg/format/cmn-err-1.c @@ -17,12 +17,21 @@ int main() int i = 1; long l = 2; llong ll = 3; + char hh = 4; + short h = 5; + size_t z = 6; + uintmax_t j = 7; cmn_err_func (0, "%s", string); cmn_err_func (0, "%d %D %o %O %x %X %u", i, i, i, i, i, i, i); cmn_err_func (0, "%ld %lD %lo %lO %lx %lX %lu", l, l, l, l, l, l, l); cmn_err_func (0, "%lld %llD %llo %llO %llx %llX %llu", ll, ll, ll, ll, ll, ll, ll); + cmn_err_func (0, "%hd %hD %ho %hO %hx %hX %hu", h, h, h, h, h, h, h); + cmn_err_func (0, "%hhd %hhD %hho %hhO %hhx %hhX %hhu", + hh, hh, hh, hh, hh, hh, hh); + cmn_err_func (0, "%jd %jD %jo %jO %jx %jX %ju", j, j, j, j, j, j, j); + cmn_err_func (0, "%zd %zD %zo %zO %zx %zX %zu", z, z, z, z, z, z, z); cmn_err_func (0, "%b %s", i, "\01Foo", string); cmn_err_func (0, "%p", string); cmn_err_func (0, "%16b", i, "\01Foo"); diff --git a/gcc/testsuite/gcc.dg/rtl/x86_64/pro_and_epilogue.c b/gcc/testsuite/gcc.dg/rtl/x86_64/pro_and_epilogue.c index b6f723a6e6020..ed5db9cace3b7 100644 --- a/gcc/testsuite/gcc.dg/rtl/x86_64/pro_and_epilogue.c +++ b/gcc/testsuite/gcc.dg/rtl/x86_64/pro_and_epilogue.c @@ -1,5 +1,6 @@ /* { dg-do compile { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ /* { dg-options "-fdump-rtl-pro_and_epilogue" } */ +/* { dg-skip-if "RTL in test doesn't save arguments" { *-*-* } "-msave-args" "" } */ /* Lightly-modified dump of test.c.274r.split2 for x86_64. */ @@ -95,7 +96,7 @@ int __RTL (startwith ("pro_and_epilogue")) test_1 (int i, int j, int k) (cnote 31 NOTE_INSN_DELETED) ) ;; insn-chain (crtl - (return_rtx + (return_rtx (reg/i:SI ax) ) ;; return_rtx ) ;; crtl @@ -107,4 +108,3 @@ int __RTL (startwith ("pro_and_epilogue")) test_1 (int i, int j, int k) /* We expect a jump_insn to "simple_return". */ /* { dg-final { scan-rtl-dump-times "simple_return" 2 "pro_and_epilogue" } } */ - diff --git a/gcc/testsuite/gcc.target/i386/local.c b/gcc/testsuite/gcc.target/i386/local.c index f4444951e123e..3a487583d81f7 100644 --- a/gcc/testsuite/gcc.target/i386/local.c +++ b/gcc/testsuite/gcc.target/i386/local.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -funit-at-a-time" } */ +/* { dg-options "-O2 -funit-at-a-time -fno-strict-calling-conventions" { target ia32 } } */ +/* { dg-options "-O2 -funit-at-a-time" { target lp64 } } */ /* { dg-final { scan-assembler "magic\[^\\n\]*eax" { target ia32 } } } */ /* { dg-final { scan-assembler "magic\[^\\n\]*(edi|ecx)" { target { ! ia32 } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/msave-args-mov.c b/gcc/testsuite/gcc.target/i386/msave-args-mov.c new file mode 100644 index 0000000000000..a2ca76752a96e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/msave-args-mov.c @@ -0,0 +1,26 @@ +/* { dg-do run { target { { i?86-*-solaris2.* } && lp64 } } } */ +/* { dg-options "-msave-args -mforce-save-regs-using-mov -save-temps" } */ + +#include + +void t(int, int, int, int, int) __attribute__ ((noinline)); + +int +main(int argc, char **argv) +{ + t(1, 2, 3, 4, 5); + return (0); +} + +void +t(int a, int b, int c, int d, int e) +{ + printf("%d %d %d %d %d", a, b, c, d, e); +} + +/* { dg-final { scan-assembler "movq\t%rdi, -8\\(%rbp\\)" } } */ +/* { dg-final { scan-assembler "movq\t%rsi, -16\\(%rbp\\)" } } */ +/* { dg-final { scan-assembler "movq\t%rdx, -24\\(%rbp\\)" } } */ +/* { dg-final { scan-assembler "movq\t%rcx, -32\\(%rbp\\)" } } */ +/* { dg-final { scan-assembler "movq\t%r8, -40\\(%rbp\\)" } } */ +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.target/i386/msave-args-push.c b/gcc/testsuite/gcc.target/i386/msave-args-push.c new file mode 100644 index 0000000000000..fbe053dadc8b9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/msave-args-push.c @@ -0,0 +1,26 @@ +/* { dg-do run { target { { i?86-*-solaris2.* } && lp64 } } } */ +/* { dg-options "-msave-args -save-temps " } */ + +#include + +void t(int, int, int, int, int) __attribute__ ((noinline)); + +int +main(int argc, char **argv) +{ + t(1, 2, 3, 4, 5); + return (0); +} + +void +t(int a, int b, int c, int d, int e) +{ + printf("%d %d %d %d %d", a, b, c, d, e); +} + +/* { dg-final { scan-assembler "pushq\t%rdi" } } */ +/* { dg-final { scan-assembler "pushq\t%rsi" } } */ +/* { dg-final { scan-assembler "pushq\t%rdx" } } */ +/* { dg-final { scan-assembler "pushq\t%rcx" } } */ +/* { dg-final { scan-assembler "pushq\t%r8" } } */ +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr78691-i386.c b/gcc/testsuite/gcc.target/i386/pr78691-i386.c index f4b88559bc3e9..5f8c91bc370b4 100644 --- a/gcc/testsuite/gcc.target/i386/pr78691-i386.c +++ b/gcc/testsuite/gcc.target/i386/pr78691-i386.c @@ -1,5 +1,6 @@ /* PR tree-optimization/78691 */ /* { dg-options "-Os -m16" } */ +/* { dg-skip-if "" { *-*-* } "-msave-args" "" } */ int fn1(char *p1, char *p2) { int a; diff --git a/gcc/testsuite/gcc.target/i386/pr80569.c b/gcc/testsuite/gcc.target/i386/pr80569.c index 8314bc128ec58..92a86380f781c 100644 --- a/gcc/testsuite/gcc.target/i386/pr80569.c +++ b/gcc/testsuite/gcc.target/i386/pr80569.c @@ -1,8 +1,7 @@ /* PR target/80569 */ /* { dg-do assemble } */ /* { dg-options "-O2 -m16 -march=haswell" } */ -/* Non-gas assemblers choke on .code16gcc. */ -/* { dg-require-effective-target gas } */ +/* { dg-skip-if "" { *-*-* } "-msave-args" "" } */ void load_kernel(void *setup_addr) { diff --git a/gcc/testsuite/gcc.target/i386/retarg.c b/gcc/testsuite/gcc.target/i386/retarg.c index a69b60feaf4ec..3967ef76b1f2d 100644 --- a/gcc/testsuite/gcc.target/i386/retarg.c +++ b/gcc/testsuite/gcc.target/i386/retarg.c @@ -1,5 +1,6 @@ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-options "-O2" } */ +/* { dg-skip-if "" { *-*-* } "-msave-args" "" } */ #include diff --git a/gcc/testsuite/gcc.target/i386/strict-cc.c b/gcc/testsuite/gcc.target/i386/strict-cc.c new file mode 100644 index 0000000000000..fa0543e52ff69 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/strict-cc.c @@ -0,0 +1,24 @@ +/* { dg-do compile { target { ilp32 } } } */ +/* { dg-options "-O2 -funit-at-a-time -fstrict-calling-conventions" } */ +/* { dg-final { scan-assembler "pushl.*\\\$1" } } */ +/* { dg-final { scan-assembler "pushl.*\\\$2" } } */ +/* { dg-final { scan-assembler "pushl.*\\\$3" } } */ +/* { dg-final { scan-assembler "pushl.*\\\$4" } } */ +/* { dg-final { scan-assembler "pushl.*\\\$5" } } */ + +#include + +/* Verify that local calling convention is not used if strict conventions. */ +static int t(int, int, int, int, int) __attribute__ ((noinline)); + +int +m() +{ + t(1, 2, 3, 4, 5); +} + +static int +t(int a, int b, int c, int d, int e) +{ + printf("%d\n", a, b, c, d, e); +} diff --git a/include/dwarf2.def b/include/dwarf2.def index 66c7fa1220f82..9284f3d59c54e 100644 --- a/include/dwarf2.def +++ b/include/dwarf2.def @@ -467,6 +467,8 @@ DW_TAG (DW_AT_GNU_denominator, 0x2304) /* Biased integer extension. See https://gcc.gnu.org/wiki/DW_AT_GNU_bias . */ DW_TAG (DW_AT_GNU_bias, 0x2305) +/* Sun extension. */ +DW_AT (DW_AT_SUN_amd64_parmdump, 0x2224) /* UPC extension. */ DW_AT (DW_AT_upc_threads_scaled, 0x3210) /* PGI (STMicroelectronics) extensions. */ diff --git a/libgcc/config.host b/libgcc/config.host index ee10e99b0a662..5e9d66d0c12fd 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -342,7 +342,7 @@ case ${host} in *-*-solaris2*) # Unless linker support and dl_iterate_phdr are present, # unwind-dw2-fde-dip.c automatically falls back to unwind-dw2-fde.c. - tmake_file="$tmake_file sol2/t-sol2 t-eh-dw2-dip t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-elf-ver" + 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" if test $with_gnu_ld = yes; then tmake_file="$tmake_file t-slibgcc-gld" else @@ -362,6 +362,7 @@ case ${host} in i?86-*-solaris2* | x86_64-*-solaris2*) # Solaris 10+/x86 provides crt1.o, crti.o, crtn.o, and gcrt1.o as # part of the base system. + extra_parts="$extra_parts crtbeginS.o crtendS.o" ;; sparc*-*-solaris2*) # Solaris 10+/SPARC lacks crt1.o and gcrt1.o. diff --git a/libgo/go/cmd/go/internal/work/gccgo.go b/libgo/go/cmd/go/internal/work/gccgo.go index 3e07f8791ebc4..23954e0a3def1 100644 --- a/libgo/go/cmd/go/internal/work/gccgo.go +++ b/libgo/go/cmd/go/internal/work/gccgo.go @@ -46,7 +46,7 @@ func (gccgoToolchain) linker() string { } func (gccgoToolchain) ar() []string { - return envList("AR", "ar") + return envList("AR", "/usr/bin/gar") } func checkGccgoBin() { diff --git a/libgo/go/go/internal/gccgoimporter/importer_test.go b/libgo/go/go/internal/gccgoimporter/importer_test.go index 8a7ee1aa4ffa9..fecf181117092 100644 --- a/libgo/go/go/internal/gccgoimporter/importer_test.go +++ b/libgo/go/go/internal/gccgoimporter/importer_test.go @@ -180,7 +180,7 @@ func TestObjImporter(t *testing.T) { runImporterTest(t, imp, initmap, &test) - cmd = exec.Command("ar", "cr", afile, ofile) + cmd = exec.Command("/usr/bin/gar", "cr", afile, ofile) out, err = cmd.CombinedOutput() if err != nil { t.Logf("%s", out) diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c index 3a30748d3291f..29efc3e26c9f0 100644 --- a/libgo/runtime/proc.c +++ b/libgo/runtime/proc.c @@ -12,6 +12,10 @@ #include "config.h" #ifdef HAVE_DL_ITERATE_PHDR +#ifdef __sun +#undef _FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 32 +#endif #include #endif diff --git a/libobjc/Makefile.in b/libobjc/Makefile.in index 58d0638f72e4c..a79c8c0d913ef 100644 --- a/libobjc/Makefile.in +++ b/libobjc/Makefile.in @@ -308,14 +308,16 @@ $(srcdir)/configure: @MAINT@ configure.ac $(srcdir)/aclocal.m4 $(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -install: install-libs install-headers +install-strip: INSTALL_STRIP_FLAG = -s +install install-strip: install-libs install-headers install-libs: installdirs $(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(toolexeclibdir) - $(LIBTOOL_INSTALL) $(INSTALL) libobjc$(libsuffix).la $(DESTDIR)$(toolexeclibdir); + $(LIBTOOL_INSTALL) $(INSTALL) $(INSTALL_STRIP_FLAG) \ + libobjc$(libsuffix).la $(DESTDIR)$(toolexeclibdir); if [ "$(OBJC_BOEHM_GC)" ]; then \ - $(LIBTOOL_INSTALL) $(INSTALL) libobjc_gc$(libsuffix).la \ - $(DESTDIR)$(toolexeclibdir);\ + $(LIBTOOL_INSTALL) $(INSTALL) $(INSTALL_STRIP_FLAG) \ + libobjc_gc$(libsuffix).la $(DESTDIR)$(toolexeclibdir);\ fi $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@" @-$(LIBTOOL) --mode=finish $(DESTDIR)$(toolexeclibdir) @@ -328,7 +330,7 @@ install-headers: $(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/objc; \ done -check uninstall install-strip dist installcheck installdirs: +check uninstall dist installcheck installdirs: mostlyclean: -$(LIBTOOL_CLEAN) rm -f libobjc$(libsuffix).la libobjc_gc$(libsuffix).la *.lo diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_solaris.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_solaris.h index 84a81265162c6..f9c9b84dcadda 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_solaris.h +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_solaris.h @@ -19,6 +19,9 @@ #include "sanitizer_internal_defs.h" #include "sanitizer_platform.h" +struct stat; +struct dirent; + namespace __sanitizer { extern unsigned struct_utsname_sz; extern unsigned struct_stat_sz; @@ -337,6 +340,14 @@ struct __sanitizer_glob_t { uptr gl_offs; char **gl_pathp; int gl_pathn; + int gl_matchc; + int gl_flags; + struct stat **gl_statv; + void (*gl_closedir)(void *); + struct dirent *(*gl_readdir)(void *); + void *(*gl_opendir)(const char *); + int (*gl_lstat)(const char *, struct stat *); + int (*gl_stat)(const char *, struct stat *); }; extern int glob_nomatch; diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 51a08bcc8b1d0..580832cdf7c36 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -2774,7 +2774,7 @@ dnl AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [ GLIBCXX_ENABLE(clocale,auto,[[[=MODEL]]], [use MODEL for target locale package], - [permit generic|gnu|ieee_1003.1-2001|newlib|yes|no|auto]) + [permit generic|gnu|ieee_1003.1-2001|newlib|dragonfly|yes|no|auto]) # Deal with gettext issues. Default to not using it (=no) until we detect # support for it later. Let the user turn it off via --e/d, but let that diff --git a/libstdc++-v3/config/locale/dragonfly/ctype_members.cc b/libstdc++-v3/config/locale/dragonfly/ctype_members.cc index 92b0e437ad337..8e20f74e6355a 100644 --- a/libstdc++-v3/config/locale/dragonfly/ctype_members.cc +++ b/libstdc++-v3/config/locale/dragonfly/ctype_members.cc @@ -135,6 +135,66 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __hi; } +/* + * Taken verbatim from config/locale/generic/ctype_members.cc. DragonFly + * implements these in config/os/bsd/dragonfly/ctype_inline.h. + */ +#if defined(__illumos__) + bool + ctype:: + do_is(mask __m, char_type __c) const + { + bool __ret = false; + // Generically, 15 (instead of 11) since we don't know the numerical + // encoding of the various categories in /usr/include/ctype.h. + const size_t __bitmasksize = 15; + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) + if (__m & _M_bit[__bitcur] + && iswctype(__c, _M_wmask[__bitcur])) + { + __ret = true; + break; + } + return __ret; + } + + const wchar_t* + ctype:: + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const + { + for (;__lo < __hi; ++__vec, ++__lo) + { + // Generically, 15 (instead of 11) since we don't know the numerical + // encoding of the various categories in /usr/include/ctype.h. + const size_t __bitmasksize = 15; + mask __m = 0; + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) + if (iswctype(*__lo, _M_wmask[__bitcur])) + __m |= _M_bit[__bitcur]; + *__vec = __m; + } + return __hi; + } + + const wchar_t* + ctype:: + do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const + { + while (__lo < __hi && !this->do_is(__m, *__lo)) + ++__lo; + return __lo; + } + + const wchar_t* + ctype:: + do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const + { + while (__lo < __hi && this->do_is(__m, *__lo) != 0) + ++__lo; + return __lo; + } +#endif + wchar_t ctype:: do_widen(char __c) const diff --git a/libstdc++-v3/config/locale/dragonfly/monetary_members.cc b/libstdc++-v3/config/locale/dragonfly/monetary_members.cc index 6e48e45b3e749..0aeb395c3a8b5 100644 --- a/libstdc++-v3/config/locale/dragonfly/monetary_members.cc +++ b/libstdc++-v3/config/locale/dragonfly/monetary_members.cc @@ -37,10 +37,36 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION + extern wchar_t lconv2wchar(char *conv, wchar_t def, locale_t __cloc); + extern char lconv2char(char *conv, char def); + // This file might be compiled twice, but we only want to define the members // of money_base once. #if ! _GLIBCXX_USE_CXX11_ABI + wchar_t lconv2wchar(char *conv, wchar_t def, locale_t __cloc) + { + wchar_t w = def; + const size_t tlen = strlen(conv); + if (tlen == 1) + w = (wchar_t) conv[0]; + + int clen = mbtowc_l(&w, conv, tlen, __cloc); + if (clen <= 0) + return def; + else + return w; + } + + char lconv2char(char *conv, char def) + { + wchar_t w = def; + const size_t tlen = strlen(conv); + if (tlen == 1) + w = (wchar_t) conv[0]; + return w; + } + // Construct and return valid pattern consisting of some combination of: // space none symbol sign value money_base::pattern @@ -283,7 +309,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } else { - _M_data->_M_thousands_sep = lc->mon_thousands_sep[0]; + _M_data->_M_thousands_sep = lconv2char(lc->mon_thousands_sep, ','); __len = strlen(__cgroup); if (__len) @@ -437,7 +463,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } else { - _M_data->_M_thousands_sep = lc->mon_thousands_sep[0]; + _M_data->_M_thousands_sep = lconv2char(lc->mon_thousands_sep, ','); __len = strlen(__cgroup); if (__len) @@ -624,8 +650,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } else { - _M_data->_M_thousands_sep = - (wchar_t)lc->mon_thousands_sep[0]; + _M_data->_M_thousands_sep = lconv2wchar(lc->mon_thousands_sep, L',', (locale_t)__cloc); __len = strlen(__cgroup); if (__len) { @@ -784,8 +809,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } else { - _M_data->_M_thousands_sep = - (wchar_t)lc->mon_thousands_sep[0]; + _M_data->_M_thousands_sep = lconv2wchar(lc->mon_thousands_sep, L',', (locale_t)__cloc); __len = strlen(__cgroup); if (__len) { diff --git a/libstdc++-v3/config/locale/dragonfly/numeric_members.cc b/libstdc++-v3/config/locale/dragonfly/numeric_members.cc index dc71ef4ed701f..06e6f044f8467 100644 --- a/libstdc++-v3/config/locale/dragonfly/numeric_members.cc +++ b/libstdc++-v3/config/locale/dragonfly/numeric_members.cc @@ -37,6 +37,9 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION + extern wchar_t lconv2wchar(char *conv, wchar_t def, locale_t __cloc); + extern char lconv2char(char *conv, char def); + template<> void numpunct::_M_initialize_numpunct(__c_locale __cloc) @@ -86,7 +89,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } else { - _M_data->_M_thousands_sep = lc->thousands_sep[0]; + _M_data->_M_thousands_sep = lconv2char(lc->thousands_sep, ','); const char* __src = lc->grouping; const size_t __len = strlen(__src); @@ -185,7 +188,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } else { - _M_data->_M_thousands_sep = (wchar_t)lc->thousands_sep[0]; + _M_data->_M_thousands_sep = lconv2wchar(lc->thousands_sep, L',', (locale_t)__cloc); const char* __src = lc->grouping; const size_t __len = strlen(__src); diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 18053ab7eae6c..cec55c324bb90 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -16635,7 +16635,7 @@ $as_echo "stdio (with POSIX read/write)" >&6; } if test "${enable_clocale+set}" = set; then : enableval=$enable_clocale; case "$enableval" in - generic|gnu|ieee_1003.1-2001|newlib|yes|no|auto) ;; + generic|gnu|ieee_1003.1-2001|newlib|dragonfly|yes|no|auto) ;; *) as_fn_error $? "Unknown argument to enable/disable clocale" "$LINENO" 5 ;; esac @@ -55105,6 +55105,12 @@ done tmake_file="${tmake_file_}" +case "${target}" in *-*-solaris2*) + EXTRA_CFLAGS="$EXTRA_CFLAGS -D_TS_ERRNO" + EXTRA_CXX_FLAGS="$EXTRA_CXX_FLAGS -D_TS_ERRNO" +esac + + # Add CET specific flags if Intel CET is enabled. # Check whether --enable-cet was given. if test "${enable_cet+set}" = set; then : diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index a6525a9d3e464..f9cb5d7ff4242 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -658,6 +658,11 @@ done tmake_file="${tmake_file_}" AC_SUBST(tmake_file) +case "${target}" in *-*-solaris2*) + EXTRA_CFLAGS="$EXTRA_CFLAGS -D_TS_ERRNO" + EXTRA_CXX_FLAGS="$EXTRA_CXX_FLAGS -D_TS_ERRNO" +esac + # Add CET specific flags if Intel CET is enabled. GCC_CET_FLAGS(CET_FLAGS) EXTRA_CXX_FLAGS="$EXTRA_CXX_FLAGS $CET_FLAGS"