- works on amd64, so mark it in ONLY_FOR_ARCHS

- adapt 128-bit arithmetics fix
tested by Simon Kuhnle
tested by/ok sthen@, ok espie@
This commit is contained in:
martynas 2008-08-28 19:04:40 +00:00
parent dd34d332a7
commit 5f07a11194
6 changed files with 158 additions and 3 deletions

View File

@ -1,6 +1,6 @@
# $OpenBSD: Makefile,v 1.32 2008/08/20 09:56:17 espie Exp $
# $OpenBSD: Makefile,v 1.33 2008/08/28 19:04:40 martynas Exp $
ONLY_FOR_ARCHS= alpha i386 m68k sparc sparc64 powerpc vax
ONLY_FOR_ARCHS= alpha amd64 i386 m68k sparc sparc64 powerpc vax
V=3.3.6
FULL_VERSION=3.3.6
@ -8,7 +8,7 @@ FULL_PKGVERSION=3.3.6
BOOTSTRAP_GEN = 6
ADASTRAP = adastrap-i386-3.3.6-${BOOTSTRAP_GEN}.tgz
PKGNAME-main= gcc-${FULL_PKGVERSION}p10
PKGNAME-main= gcc-${FULL_PKGVERSION}p11
PKGNAME-c++ = g++-${FULL_PKGVERSION}p10
PKGNAME-estdc= libstdc++-${FULL_PKGVERSION}p3
PKGNAME-g77= g77-${FULL_PKGVERSION}p9

View File

@ -0,0 +1,49 @@
$OpenBSD: patch-gcc_calls_c,v 1.1 2008/08/28 19:04:40 martynas Exp $
--- gcc/calls.c.orig Sun Sep 7 00:26:46 2003
+++ gcc/calls.c Wed Aug 27 06:21:40 2008
@@ -4694,3 +4694,45 @@ store_one_arg (arg, argblock, flags, variable_size, re
return sibcall_failure;
}
+
+/* Nonzero if we do not know how to pass TYPE solely in registers.
+ We cannot do so in the following cases:
+
+ - if the type has variable size
+ - if the type is marked as addressable (it is required to be constructed
+ into the stack)
+ - if the padding and mode of the type is such that a copy into a register
+ would put it into the wrong part of the register.
+
+ Which padding can't be supported depends on the byte endianness.
+
+ A value in a register is implicitly padded at the most significant end.
+ On a big-endian machine, that is the lower end in memory.
+ So a value padded in memory at the upper end can't go in a register.
+ For a little-endian machine, the reverse is true. */
+
+bool
+default_must_pass_in_stack (enum machine_mode mode, tree type)
+{
+ if (!type)
+ return false;
+
+ /* If the type has variable size... */
+ if (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
+ return true;
+
+ /* If the type is marked as addressable (it is required
+ to be constructed into the stack)... */
+ if (TREE_ADDRESSABLE (type))
+ return true;
+
+ /* If the padding and mode of the type is such that a copy into
+ a register would put it into the wrong part of the register. */
+ if (mode == BLKmode
+ && int_size_in_bytes (type) % (PARM_BOUNDARY / BITS_PER_UNIT)
+ && (FUNCTION_ARG_PADDING (mode, type)
+ == (BYTES_BIG_ENDIAN ? upward : downward)))
+ return true;
+
+ return false;
+}

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-gcc_config_i386_i386-protos_h,v 1.1 2008/08/28 19:04:40 martynas Exp $
--- gcc/config/i386/i386-protos.h.orig Sun Dec 12 23:00:44 2004
+++ gcc/config/i386/i386-protos.h Wed Aug 27 06:21:40 2008
@@ -223,6 +223,7 @@ extern int x86_field_alignment PARAMS ((tree, int));
extern rtx ix86_tls_get_addr PARAMS ((void));
extern void x86_machine_dependent_reorg PARAMS ((rtx));
+extern bool ix86_must_pass_in_stack PARAMS ((enum machine_mode mode, tree));
/* In winnt.c */
extern int i386_pe_dllexport_name_p PARAMS ((const char *));

View File

@ -0,0 +1,32 @@
$OpenBSD: patch-gcc_config_i386_i386_c,v 1.1 2008/08/28 19:04:40 martynas Exp $
--- gcc/config/i386/i386.c.orig Sun Dec 12 23:00:44 2004
+++ gcc/config/i386/i386.c Wed Aug 27 06:21:41 2008
@@ -1725,6 +1725,10 @@ classify_argument (mode, type, classes, bit_offset)
if (bytes < 0)
return 0;
+ if (mode != VOIDmode
+ && MUST_PASS_IN_STACK (mode, type))
+ return 0;
+
if (type && AGGREGATE_TYPE_P (type))
{
int i;
@@ -14826,6 +14830,17 @@ x86_machine_dependent_reorg (first)
if (insert)
emit_insn_before (gen_nop (), ret);
}
+}
+
+/* Return if we do not know how to pass TYPE solely in registers. */
+bool
+ix86_must_pass_in_stack (mode, type)
+ enum machine_mode mode;
+ tree type;
+{
+ if (default_must_pass_in_stack (mode, type))
+ return true;
+ return (!TARGET_64BIT && type && mode == TImode);
}
#include "gt-i386.h"

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-gcc_config_i386_i386_h,v 1.1 2008/08/28 19:04:40 martynas Exp $
--- gcc/config/i386/i386.h.orig Sun Dec 12 23:00:47 2004
+++ gcc/config/i386/i386.h Wed Aug 27 06:21:41 2008
@@ -1638,18 +1638,7 @@ enum reg_class
definition that is usually appropriate, refer to expr.h for additional
documentation. If `REG_PARM_STACK_SPACE' is defined, the argument will be
computed in the stack and then loaded into a register. */
-#define MUST_PASS_IN_STACK(MODE, TYPE) \
- ((TYPE) != 0 \
- && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \
- || TREE_ADDRESSABLE (TYPE) \
- || ((MODE) == TImode) \
- || ((MODE) == BLKmode \
- && ! ((TYPE) != 0 \
- && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
- && 0 == (int_size_in_bytes (TYPE) \
- % (PARM_BOUNDARY / BITS_PER_UNIT))) \
- && (FUNCTION_ARG_PADDING (MODE, TYPE) \
- == (BYTES_BIG_ENDIAN ? upward : downward)))))
+#define MUST_PASS_IN_STACK(MODE, TYPE) ix86_must_pass_in_stack ((MODE), (TYPE))
/* Value is the number of bytes of arguments automatically
popped when returning from a subroutine call.

View File

@ -0,0 +1,40 @@
$OpenBSD: patch-gcc_expr_h,v 1.1 2008/08/28 19:04:40 martynas Exp $
--- gcc/expr.h.orig Mon Jun 9 06:28:24 2003
+++ gcc/expr.h Wed Aug 27 06:22:59 2008
@@ -159,33 +159,10 @@ enum direction {none, upward, downward}; /* Value has
#define PRETEND_OUTGOING_VARARGS_NAMED 0
#endif
-/* Nonzero if we do not know how to pass TYPE solely in registers.
- We cannot do so in the following cases:
-
- - if the type has variable size
- - if the type is marked as addressable (it is required to be constructed
- into the stack)
- - if the padding and mode of the type is such that a copy into a register
- would put it into the wrong part of the register.
-
- Which padding can't be supported depends on the byte endianness.
-
- A value in a register is implicitly padded at the most significant end.
- On a big-endian machine, that is the lower end in memory.
- So a value padded in memory at the upper end can't go in a register.
- For a little-endian machine, the reverse is true. */
-
+/* Nonzero if we do not know how to pass TYPE solely in registers. */
+extern bool default_must_pass_in_stack PARAMS((enum machine_mode, tree));
#ifndef MUST_PASS_IN_STACK
-#define MUST_PASS_IN_STACK(MODE,TYPE) \
- ((TYPE) != 0 \
- && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \
- || TREE_ADDRESSABLE (TYPE) \
- || ((MODE) == BLKmode \
- && ! ((TYPE) != 0 && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
- && 0 == (int_size_in_bytes (TYPE) \
- % (PARM_BOUNDARY / BITS_PER_UNIT))) \
- && (FUNCTION_ARG_PADDING (MODE, TYPE) \
- == (BYTES_BIG_ENDIAN ? upward : downward)))))
+#define MUST_PASS_IN_STACK(MODE,TYPE) default_must_pass_in_stack(MODE, TYPE)
#endif
/* Nonzero if type TYPE should be returned in memory.