summaryrefslogtreecommitdiff
path: root/gnu/gcc
diff options
context:
space:
mode:
authorChristian Weisgerber <naddy@cvs.openbsd.org>2010-05-04 18:34:33 +0000
committerChristian Weisgerber <naddy@cvs.openbsd.org>2010-05-04 18:34:33 +0000
commitc63836ae0978aff66479afba149e6cd7a1b860f9 (patch)
treea7805e08849d0d9426cecaba7344d544d4b8d336 /gnu/gcc
parent370f14b7b0df79cb0604cf8a10612fbb2d7811ef (diff)
Merge from gcc3 our configuration for alpha, including these local
changes: * Do not force -msmall-data if -fpic and -mlarge-data if -fPIC. Instead, have both -fpic and -fPIC only select pic code generation, and use whatever memory mode is specified (with -mlarge-data being the implicit default). * -Wstack-larger-than support. * Disable stack frame checking in the prologue under OpenBSD, unless you compile with -fstack-check, for consistency with other platforms. * -mno-ieee option to disable IEEE mode. ok kettenis@
Diffstat (limited to 'gnu/gcc')
-rw-r--r--gnu/gcc/gcc/config/alpha/alpha.c197
-rw-r--r--gnu/gcc/gcc/config/alpha/alpha.md3
-rw-r--r--gnu/gcc/gcc/config/alpha/alpha.opt5
-rw-r--r--gnu/gcc/gcc/config/alpha/openbsd.h84
-rw-r--r--gnu/gcc/gcc/config/alpha/openbsd1.h23
5 files changed, 188 insertions, 124 deletions
diff --git a/gnu/gcc/gcc/config/alpha/alpha.c b/gnu/gcc/gcc/config/alpha/alpha.c
index a9ae7e53275..5fcd5d66d9a 100644
--- a/gnu/gcc/gcc/config/alpha/alpha.c
+++ b/gnu/gcc/gcc/config/alpha/alpha.c
@@ -226,6 +226,10 @@ alpha_handle_option (size_t code, const char *arg, int value)
target_flags |= MASK_IEEE_CONFORMANT;
break;
+ case OPT_mno_ieee:
+ target_flags &= ~(MASK_IEEE_WITH_INEXACT|MASK_IEEE_CONFORMANT);
+ break;
+
case OPT_mtls_size_:
if (value != 16 && value != 32 && value != 64)
error ("bad value %qs for -mtls-size switch", arg);
@@ -482,11 +486,17 @@ override_options (void)
if (!g_switch_set)
g_switch_value = 8;
+#ifdef OPENBSD_NATIVE
+ /* Make -fpic behave as -fPIC unless -msmall-data is specified. */
+ if (flag_pic == 2 && TARGET_SMALL_DATA)
+ warning (0, "-fPIC used with -msmall-data");
+#else
/* Infer TARGET_SMALL_DATA from -fpic/-fPIC. */
if (flag_pic == 1)
target_flags |= MASK_SMALL_DATA;
else if (flag_pic == 2)
target_flags &= ~MASK_SMALL_DATA;
+#endif
/* Align labels and loops for optimal branching. */
/* ??? Kludge these by not doing anything if we don't optimize and also if
@@ -7564,6 +7574,9 @@ alpha_expand_prologue (void)
+ ALPHA_ROUND (frame_size
+ current_function_pretend_args_size));
+ if (warn_stack_larger_than && frame_size > stack_larger_than_size)
+ warning (0, "stack usage is %d bytes", frame_size);
+
if (TARGET_ABI_OPEN_VMS)
reg_offset = 8;
else
@@ -7598,94 +7611,134 @@ alpha_expand_prologue (void)
Note that we are only allowed to adjust sp once in the prologue. */
- if (frame_size <= 32768)
+ if (flag_stack_check || STACK_CHECK_BUILTIN)
{
- if (frame_size > 4096)
+ if (frame_size <= 32768)
{
- int probed;
+ if (frame_size > 4096)
+ {
+ int probed;
- for (probed = 4096; probed < frame_size; probed += 8192)
- emit_insn (gen_probe_stack (GEN_INT (TARGET_ABI_UNICOSMK
- ? -probed + 64
- : -probed)));
+ for (probed = 4096; probed < frame_size; probed += 8192)
+ emit_insn (gen_probe_stack (GEN_INT (TARGET_ABI_UNICOSMK
+ ? -probed + 64
+ : -probed)));
+
+ /* We only have to do this probe if we aren't saving
+ registers. */
+ if (sa_size == 0 && frame_size > probed - 4096)
+ emit_insn (gen_probe_stack (GEN_INT (-frame_size)));
+ }
- /* We only have to do this probe if we aren't saving registers. */
- if (sa_size == 0 && frame_size > probed - 4096)
- emit_insn (gen_probe_stack (GEN_INT (-frame_size)));
+ if (frame_size != 0)
+ FRP (emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx,
+ GEN_INT (TARGET_ABI_UNICOSMK
+ ? -frame_size + 64
+ : -frame_size))));
}
+ else
+ {
+ /* Here we generate code to set R22 to SP + 4096 and set R23 to the
+ number of 8192 byte blocks to probe. We then probe each block
+ in the loop and then set SP to the proper location. If the
+ amount remaining is > 4096, we have to do one more probe if we
+ are not saving any registers. */
- if (frame_size != 0)
- FRP (emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx,
- GEN_INT (TARGET_ABI_UNICOSMK
- ? -frame_size + 64
- : -frame_size))));
- }
- else
- {
- /* Here we generate code to set R22 to SP + 4096 and set R23 to the
- number of 8192 byte blocks to probe. We then probe each block
- in the loop and then set SP to the proper location. If the
- amount remaining is > 4096, we have to do one more probe if we
- are not saving any registers. */
+ HOST_WIDE_INT blocks = (frame_size + 4096) / 8192;
+ HOST_WIDE_INT leftover = frame_size + 4096 - blocks * 8192;
+ rtx ptr = gen_rtx_REG (DImode, 22);
+ rtx count = gen_rtx_REG (DImode, 23);
+ rtx seq;
- HOST_WIDE_INT blocks = (frame_size + 4096) / 8192;
- HOST_WIDE_INT leftover = frame_size + 4096 - blocks * 8192;
- rtx ptr = gen_rtx_REG (DImode, 22);
- rtx count = gen_rtx_REG (DImode, 23);
- rtx seq;
+ emit_move_insn (count, GEN_INT (blocks));
+ emit_insn (gen_adddi3 (ptr, stack_pointer_rtx,
+ GEN_INT (TARGET_ABI_UNICOSMK
+ ? 4096 - 64 : 4096)));
- emit_move_insn (count, GEN_INT (blocks));
- emit_insn (gen_adddi3 (ptr, stack_pointer_rtx,
- GEN_INT (TARGET_ABI_UNICOSMK ? 4096 - 64 : 4096)));
+ /* Because of the difficulty in emitting a new basic block this
+ late in the compilation, generate the loop as a single insn. */
+ emit_insn (gen_prologue_stack_probe_loop (count, ptr));
- /* Because of the difficulty in emitting a new basic block this
- late in the compilation, generate the loop as a single insn. */
- emit_insn (gen_prologue_stack_probe_loop (count, ptr));
+ if (leftover > 4096 && sa_size == 0)
+ {
+ rtx last = gen_rtx_MEM (DImode, plus_constant (ptr, -leftover));
+ MEM_VOLATILE_P (last) = 1;
+ emit_move_insn (last, const0_rtx);
+ }
- if (leftover > 4096 && sa_size == 0)
- {
- rtx last = gen_rtx_MEM (DImode, plus_constant (ptr, -leftover));
- MEM_VOLATILE_P (last) = 1;
- emit_move_insn (last, const0_rtx);
- }
+ if (TARGET_ABI_WINDOWS_NT)
+ {
+ /* For NT stack unwind (done by 'reverse execution'), it's
+ not OK to take the result of a loop, even though the value
+ is already in ptr, so we reload it via a single operation
+ and subtract it to sp.
+
+ Yes, that's correct -- we have to reload the whole constant
+ into a temporary via ldah+lda then subtract from sp. */
+
+ HOST_WIDE_INT lo, hi;
+ lo = ((frame_size & 0xffff) ^ 0x8000) - 0x8000;
+ hi = frame_size - lo;
+
+ emit_move_insn (ptr, GEN_INT (hi));
+ emit_insn (gen_adddi3 (ptr, ptr, GEN_INT (lo)));
+ seq = emit_insn (gen_subdi3 (stack_pointer_rtx, stack_pointer_rtx,
+ ptr));
+ }
+ else
+ {
+ seq = emit_insn (gen_adddi3 (stack_pointer_rtx, ptr,
+ GEN_INT (-leftover)));
+ }
- if (TARGET_ABI_WINDOWS_NT)
+ /* This alternative is special, because the DWARF code cannot
+ possibly intuit through the loop above. So we invent this
+ note it looks at instead. */
+ RTX_FRAME_RELATED_P (seq) = 1;
+ REG_NOTES (seq)
+ = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
+ gen_rtx_SET (VOIDmode, stack_pointer_rtx,
+ gen_rtx_PLUS (Pmode, stack_pointer_rtx,
+ GEN_INT (TARGET_ABI_UNICOSMK
+ ? -frame_size + 64
+ : -frame_size))),
+ REG_NOTES (seq));
+ }
+ }
+ else
+ {
+ if (frame_size <= 32768)
{
- /* For NT stack unwind (done by 'reverse execution'), it's
- not OK to take the result of a loop, even though the value
- is already in ptr, so we reload it via a single operation
- and subtract it to sp.
-
- Yes, that's correct -- we have to reload the whole constant
- into a temporary via ldah+lda then subtract from sp. */
-
- HOST_WIDE_INT lo, hi;
- lo = ((frame_size & 0xffff) ^ 0x8000) - 0x8000;
- hi = frame_size - lo;
-
- emit_move_insn (ptr, GEN_INT (hi));
- emit_insn (gen_adddi3 (ptr, ptr, GEN_INT (lo)));
- seq = emit_insn (gen_subdi3 (stack_pointer_rtx, stack_pointer_rtx,
- ptr));
+ if (frame_size != 0)
+ FRP (emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx,
+ GEN_INT (TARGET_ABI_UNICOSMK
+ ? -frame_size + 64
+ : -frame_size))));
}
else
{
- seq = emit_insn (gen_adddi3 (stack_pointer_rtx, ptr,
- GEN_INT (-leftover)));
+ rtx count = gen_rtx_REG (DImode, 23);
+ rtx seq;
+
+ emit_move_insn (count, GEN_INT (TARGET_ABI_UNICOSMK
+ ? -frame_size + 64
+ : -frame_size));
+ seq = emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx,
+ count));
+
+ /* This alternative is special, because the DWARF code cannot
+ possibly intuit through the loop above. So we invent this
+ note it looks at instead. */
+ RTX_FRAME_RELATED_P (seq) = 1;
+ REG_NOTES (seq)
+ = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
+ gen_rtx_SET (VOIDmode, stack_pointer_rtx,
+ gen_rtx_PLUS (Pmode, stack_pointer_rtx,
+ GEN_INT (TARGET_ABI_UNICOSMK
+ ? -frame_size + 64
+ : -frame_size))),
+ REG_NOTES (seq));
}
-
- /* This alternative is special, because the DWARF code cannot
- possibly intuit through the loop above. So we invent this
- note it looks at instead. */
- RTX_FRAME_RELATED_P (seq) = 1;
- REG_NOTES (seq)
- = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
- gen_rtx_SET (VOIDmode, stack_pointer_rtx,
- gen_rtx_PLUS (Pmode, stack_pointer_rtx,
- GEN_INT (TARGET_ABI_UNICOSMK
- ? -frame_size + 64
- : -frame_size))),
- REG_NOTES (seq));
}
if (!TARGET_ABI_UNICOSMK)
diff --git a/gnu/gcc/gcc/config/alpha/alpha.md b/gnu/gcc/gcc/config/alpha/alpha.md
index 1f33c58fcc5..17d4c77e69d 100644
--- a/gnu/gcc/gcc/config/alpha/alpha.md
+++ b/gnu/gcc/gcc/config/alpha/alpha.md
@@ -6718,7 +6718,8 @@
if (GET_CODE (operands[1]) == CONST_INT
&& INTVAL (operands[1]) < 32768)
{
- if (INTVAL (operands[1]) >= 4096)
+ if (INTVAL (operands[1]) >= 4096
+ && (flag_stack_check || STACK_CHECK_BUILTIN))
{
/* We do this the same way as in the prologue and generate explicit
probes. Then we update the stack by the constant. */
diff --git a/gnu/gcc/gcc/config/alpha/alpha.opt b/gnu/gcc/gcc/config/alpha/alpha.opt
index a29f58eccb7..a8b898355e2 100644
--- a/gnu/gcc/gcc/config/alpha/alpha.opt
+++ b/gnu/gcc/gcc/config/alpha/alpha.opt
@@ -43,8 +43,13 @@ mieee
Target Report RejectNegative Mask(IEEE)
Emit IEEE-conformant code, without inexact exceptions
+mno-ieee
+Target Report RejectNegative InverseMask(IEEE)
+Emit non-IEEE-conformant code
+
mieee-with-inexact
Target Report RejectNegative Mask(IEEE_WITH_INEXACT)
+Emit IEEE-conformant code, with inexact exceptions
mbuild-constants
Target Report Mask(BUILD_CONSTANTS)
diff --git a/gnu/gcc/gcc/config/alpha/openbsd.h b/gnu/gcc/gcc/config/alpha/openbsd.h
index f31467d6af0..4398700e188 100644
--- a/gnu/gcc/gcc/config/alpha/openbsd.h
+++ b/gnu/gcc/gcc/config/alpha/openbsd.h
@@ -18,82 +18,64 @@ along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
-/* We settle for little endian for now. */
-#define TARGET_ENDIAN_DEFAULT 0
-
/* Controlling the compilation driver. */
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT \
+ (MASK_FPREGS | MASK_IEEE | MASK_IEEE_CONFORMANT | MASK_GAS)
+
/* alpha needs __start. */
#undef LINK_SPEC
#define LINK_SPEC \
- "%{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp %{assert*}"
+ "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \
+ %{shared:-shared} %{R*} \
+ %{static:-Bstatic} \
+ %{!static:-Bdynamic} \
+ %{assert*} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}"
+
+/* As an elf system, we need crtbegin/crtend stuff. */
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+ %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
+ crtbegin%O%s} %{shared:crtbeginS%O%s}"
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
/* run-time target specifications */
#define TARGET_OS_CPP_BUILTINS() \
do { \
- builtin_define ("__OpenBSD__"); \
- builtin_define ("__ANSI_COMPAT"); \
- builtin_define ("__unix__"); \
- builtin_assert ("system=unix"); \
+ OPENBSD_OS_CPP_BUILTINS_ELF(); \
+ OPENBSD_OS_CPP_BUILTINS_LP64(); \
} while (0)
/* Layout of source language data types. */
-/* This must agree with <machine/ansi.h> */
+/* This must agree with <machine/_types.h> */
#undef SIZE_TYPE
#define SIZE_TYPE "long unsigned int"
#undef PTRDIFF_TYPE
#define PTRDIFF_TYPE "long int"
+#undef INTMAX_TYPE
+#define INTMAX_TYPE "long long int"
+
+#undef UINTMAX_TYPE
+#define UINTMAX_TYPE "long long unsigned int"
+
#undef WCHAR_TYPE
#define WCHAR_TYPE "int"
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32
-
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
+/* Output and generation of labels. */
#define LOCAL_LABEL_PREFIX "."
-/* We don't have an init section yet. */
-#undef HAS_INIT_SECTION
-
-/* collect2 support (assembler format: macros for initialization). */
-
-/* Don't tell collect2 we use COFF as we don't have (yet ?) a dynamic ld
- library with the proper functions to handle this -> collect2 will
- default to using nm. */
-#undef OBJECT_FORMAT_COFF
-#undef EXTENDED_COFF
-
-/* Assembler format: exception region output. */
-
-/* All configurations that don't use elf must be explicit about not using
- dwarf unwind information. */
-#ifdef INCOMING_RETURN_ADDR_RTX
-#undef DWARF2_UNWIND_INFO
-#define DWARF2_UNWIND_INFO 0
-#endif
-
-/* Assembler format: label output. */
-
-/* alpha ecoff supports only weak aliases. */
-#undef ASM_WEAKEN_LABEL
-#define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS (FILE,NAME,0)
-
-#define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \
- do { \
- fputs ("\t.weakext\t", FILE); \
- assemble_name (FILE, NAME); \
- if (VALUE) \
- { \
- fputs (" , ", FILE); \
- assemble_name (FILE, VALUE); \
- } \
- fputc ('\n', FILE); \
- } while (0)
-
+/* .set on alpha is not used to output labels. */
+#undef SET_ASM_OP
+/* don't want no friggin' stack checks. */
+#undef STACK_CHECK_BUILTIN
+#define STACK_CHECK_BUILTIN 0
diff --git a/gnu/gcc/gcc/config/alpha/openbsd1.h b/gnu/gcc/gcc/config/alpha/openbsd1.h
new file mode 100644
index 00000000000..1e1a2f62784
--- /dev/null
+++ b/gnu/gcc/gcc/config/alpha/openbsd1.h
@@ -0,0 +1,23 @@
+/* Configuration fragment for an alpha OpenBSD target.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#define OBSD_HAS_DECLARE_FUNCTION_NAME
+#define OBSD_HAS_DECLARE_FUNCTION_SIZE
+#define OBSD_HAS_DECLARE_OBJECT