SHA256
1
0
forked from pool/mono-core

Accepting request 348376 from Mono:Factory

- retrieve from upstream all ppc patches not yet in 4.2.1 tarball
  ppc_instruction_length_of_atomic_add_i4_is_28.patch
  fix_atomic_add_i4_support_for_32bit_ppc.patch
  basic_changes_powerpc_be.patch (already done yesterday)
  ppc_add_monocontext_and_async_callback.patch
  fix_passing_struct_parms_per_elf_abiv2.patch
  update_elf_abiv2_testcases.patch
  partial_sharing_false_4_powerpc.patch
  fix_exception_when_reading_from_timezone_file.patch

- new basic_changes_powerpc_be.patch to build ppc64 archi
  and disable ppc build that still segfault.

OBS-URL: https://build.opensuse.org/request/show/348376
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mono-core?expand=0&rev=96
This commit is contained in:
Dominique Leuenberger 2015-12-17 14:54:37 +00:00 committed by Git OBS Bridge
commit 9ba91dd4b5
10 changed files with 8191 additions and 0 deletions

View File

@ -0,0 +1,94 @@
commit 8332185abf23e2f27a536e6b7a08310aba8564fb
Author: Bill Seurer <seurer@linux.vnet.ibm.com>
Date: Tue Aug 18 09:36:23 2015 -0500
[ppc] Basic changes to allow mono to build and run on power BE
patch adapted to current mono 4.2.1.102
The patch of tramp-ppc.c was not from above commit
but is also required to avoid ppc64 build segfault.
Signed-off-by: Michel Normand <normand@linux.vnet.ibm.com>
---
mono/mini/mini-ppc.c | 10 ++++++++--
mono/mini/mini-trampolines.c | 5 ++++-
mono/mini/tramp-ppc.c | 4 ++++
mono/sgen/sgen-archdep.h | 4 ++--
4 files changed, 18 insertions(+), 5 deletions(-)
Index: mono-4.2.1/mono/mini/mini-ppc.c
===================================================================
--- mono-4.2.1.orig/mono/mini/mini-ppc.c
+++ mono-4.2.1/mono/mini/mini-ppc.c
@@ -1086,7 +1086,10 @@ get_call_info (MonoGenericSharingContext
cinfo->args [n].size = size;
/* It was 7, now it is 8 in LinuxPPC */
- if (fr <= PPC_LAST_FPARG_REG) {
+ if (fr <= PPC_LAST_FPARG_REG
+ // For non-native vararg calls the parms must go in storage
+ && !(!sig->pinvoke && (sig->call_convention == MONO_CALL_VARARG))
+ ) {
cinfo->args [n].regtype = RegTypeFP;
cinfo->args [n].reg = fr;
fr ++;
@@ -1177,7 +1180,10 @@ get_call_info (MonoGenericSharingContext
case MONO_TYPE_R8:
cinfo->args [n].size = 8;
/* It was 7, now it is 8 in LinuxPPC */
- if (fr <= PPC_LAST_FPARG_REG) {
+ if (fr <= PPC_LAST_FPARG_REG
+ // For non-native vararg calls the parms must go in storage
+ && !(!sig->pinvoke && (sig->call_convention == MONO_CALL_VARARG))
+ ) {
cinfo->args [n].regtype = RegTypeFP;
cinfo->args [n].reg = fr;
fr ++;
Index: mono-4.2.1/mono/mini/mini-trampolines.c
===================================================================
--- mono-4.2.1.orig/mono/mini/mini-trampolines.c
+++ mono-4.2.1/mono/mini/mini-trampolines.c
@@ -1066,7 +1066,10 @@ mono_delegate_trampoline (mgreg_t *regs,
}
}
}
- } else {
+ // If "delegate->method_ptr" is null mono_get_addr_from_ftnptr will fail if
+ // ftnptrs are being used. "method" would end up null on archtitectures without
+ // ftnptrs so we can just skip this.
+ } else if (delegate->method_ptr) {
ji = mono_jit_info_table_find (domain, mono_get_addr_from_ftnptr (delegate->method_ptr));
if (ji)
method = jinfo_get_method (ji);
Index: mono-4.2.1/mono/sgen/sgen-archdep.h
===================================================================
--- mono-4.2.1.orig/mono/sgen/sgen-archdep.h
+++ mono-4.2.1/mono/sgen/sgen-archdep.h
@@ -88,8 +88,8 @@
} while (0)
/* MS_BLOCK_SIZE must be a multiple of the system pagesize, which for some
- archs is 64k. */
-#if defined(TARGET_POWERPC64) && _CALL_ELF == 2
+ architectures is 64k. */
+#if defined(TARGET_POWERPC64)
#define ARCH_MIN_MS_BLOCK_SIZE (64*1024)
#define ARCH_MIN_MS_BLOCK_SIZE_SHIFT 16
#endif
Index: mono-4.2.1/mono/mini/tramp-ppc.c
===================================================================
--- mono-4.2.1.orig/mono/mini/tramp-ppc.c
+++ mono-4.2.1/mono/mini/tramp-ppc.c
@@ -625,8 +625,12 @@ mono_arch_get_nullified_class_init_tramp
g_assert (code - buf <= tramp_size);
+ if (info)
*info = mono_tramp_info_create ("nullified_class_init_trampoline", buf, code - buf, NULL, NULL);
+ /* It is expected to be a function descriptor on power pre-v2 ABI */
+ buf = mono_create_ftnptr (mono_domain_get (), buf);
+
return buf;
}

View File

@ -0,0 +1,59 @@
From 8f379f0c8f98493180b508b9e68b9aa76c0c5bdf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= <alexrp@xamarin.com>
Date: Mon, 3 Aug 2015 17:32:31 +0200
Subject: [PATCH] [ppc] Fix atomic_add_i4 support for 32-bit PPC.
---
mono/mini/mini-ppc.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
Index: mono-4.2.1/mono/mini/mini-ppc.c
===================================================================
--- mono-4.2.1.orig/mono/mini/mini-ppc.c
+++ mono-4.2.1/mono/mini/mini-ppc.c
@@ -4417,6 +4417,22 @@ mono_arch_output_basic_block (MonoCompil
else
ppc_mr (code, ins->dreg, ins->sreg1);
break;
+#else
+ case OP_ICONV_TO_R4:
+ case OP_ICONV_TO_R8: {
+ if (cpu_hw_caps & PPC_ISA_64) {
+ ppc_srawi(code, ppc_r0, ins->sreg1, 31);
+ ppc_stw (code, ppc_r0, -8, ppc_r1);
+ ppc_stw (code, ins->sreg1, -4, ppc_r1);
+ ppc_lfd (code, ins->dreg, -8, ppc_r1);
+ ppc_fcfid (code, ins->dreg, ins->dreg);
+ if (ins->opcode == OP_ICONV_TO_R4)
+ ppc_frsp (code, ins->dreg, ins->dreg);
+ }
+ break;
+ }
+#endif
+
case OP_ATOMIC_ADD_I4:
CASE_PPC64 (OP_ATOMIC_ADD_I8) {
int location = ins->inst_basereg;
@@ -4450,21 +4466,6 @@ mono_arch_output_basic_block (MonoCompil
ppc_mr (code, ins->dreg, ppc_r0);
break;
}
-#else
- case OP_ICONV_TO_R4:
- case OP_ICONV_TO_R8: {
- if (cpu_hw_caps & PPC_ISA_64) {
- ppc_srawi(code, ppc_r0, ins->sreg1, 31);
- ppc_stw (code, ppc_r0, -8, ppc_r1);
- ppc_stw (code, ins->sreg1, -4, ppc_r1);
- ppc_lfd (code, ins->dreg, -8, ppc_r1);
- ppc_fcfid (code, ins->dreg, ins->dreg);
- if (ins->opcode == OP_ICONV_TO_R4)
- ppc_frsp (code, ins->dreg, ins->dreg);
- }
- break;
- }
-#endif
case OP_ATOMIC_CAS_I4:
CASE_PPC64 (OP_ATOMIC_CAS_I8) {
int location = ins->sreg1;

View File

@ -0,0 +1,24 @@
From 45c3685e3b360ecc8c5a78ee10c298d6b584a302 Mon Sep 17 00:00:00 2001
From: Bill Seurer <seurer@linux.vnet.ibm.com>
Date: Thu, 10 Sep 2015 13:34:27 -0500
Subject: [PATCH] [ppc] Fix exception when reading from timezone file. See
https://bugzilla.xamarin.com/show_bug.cgi?id=30360
---
mcs/class/corlib/System/TimeZoneInfo.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: mono-4.2.1/mcs/class/corlib/System/TimeZoneInfo.cs
===================================================================
--- mono-4.2.1.orig/mcs/class/corlib/System/TimeZoneInfo.cs
+++ mono-4.2.1/mcs/class/corlib/System/TimeZoneInfo.cs
@@ -1175,7 +1175,7 @@ namespace System
return (((i >> 24) & 0xff)
| ((i >> 8) & 0xff00)
| ((i << 8) & 0xff0000)
- | ((i << 24)));
+ | (((i & 0xff) << 24)));
}
static int ReadBigEndianInt32 (byte [] buffer, int start)

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Fri Dec 11 08:32:06 UTC 2015 - normand@linux.vnet.ibm.com
- retrieve from upstream all ppc patches not yet in 4.2.1 tarball
ppc_instruction_length_of_atomic_add_i4_is_28.patch
fix_atomic_add_i4_support_for_32bit_ppc.patch
basic_changes_powerpc_be.patch (already done yesterday)
ppc_add_monocontext_and_async_callback.patch
fix_passing_struct_parms_per_elf_abiv2.patch
update_elf_abiv2_testcases.patch
partial_sharing_false_4_powerpc.patch
fix_exception_when_reading_from_timezone_file.patch
-------------------------------------------------------------------
Thu Dec 10 15:08:07 UTC 2015 - normand@linux.vnet.ibm.com
- new basic_changes_powerpc_be.patch to build ppc64 archi
and disable ppc build that still segfault.
-------------------------------------------------------------------
Tue Nov 17 00:00:00 UTC 2015 - fwdsbs.to.11df@xoxy.net, martin.liska@suse.com

View File

@ -30,6 +30,8 @@ Url: http://www.mono-project.com
Source0: http://download.mono-project.com/sources/mono/mono-%{version}.102.tar.bz2
Source1: mono-core.rpmlintrc
Source2: gmcs
# ppc build segfault so exclude it
ExcludeArch: ppc
# PATCH-FIX-OPENSUSE Use runtime 4.5 as default for nunit
Patch0: mono-nunit-default-runtime-4.5.patch
# PATCH-FIX-OPENSUSE authors file is missing
@ -37,6 +39,17 @@ Patch2: authors.patch
# PATCH-FIX-OPENSUSE fix insecure use of strncat at process.c:383 to fix build process
Patch3: strncat-process-c.patch
Patch4: mono-un-revoke-fix-in-BNC-144655.patch
##################
## set of ppc patches from git upstream not yet in tarball 4.2.1
Patch5: ppc_instruction_length_of_atomic_add_i4_is_28.patch
Patch6: fix_atomic_add_i4_support_for_32bit_ppc.patch
Patch7: basic_changes_powerpc_be.patch
Patch8: ppc_add_monocontext_and_async_callback.patch
Patch9: fix_passing_struct_parms_per_elf_abiv2.patch
Patch10: update_elf_abiv2_testcases.patch
Patch11: partial_sharing_false_4_powerpc.patch
Patch12: fix_exception_when_reading_from_timezone_file.patch
##################
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bison
@ -113,6 +126,14 @@ technologies that have been submitted to the ECMA for standardization.
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%build
NOCONFIGURE="yes" ./autogen.sh

View File

@ -0,0 +1,24 @@
From 35b511524a4d15b75cfbba982d82b7abef3a29dc Mon Sep 17 00:00:00 2001
From: Bill Seurer <seurer@linux.vnet.ibm.com>
Date: Tue, 8 Dec 2015 12:52:01 -0600
Subject: [PATCH] [ppc] Temporary fix for power to get builds working.
---
mono/mini/mini-ppc.c | 3 +++
1 file changed, 3 insertions(+)
Index: mono-4.2.1/mono/mini/mini-ppc.c
===================================================================
--- mono-4.2.1.orig/mono/mini/mini-ppc.c
+++ mono-4.2.1/mono/mini/mini-ppc.c
@@ -627,6 +627,9 @@ mono_arch_init (void)
mono_mprotect (bp_trigger_page, mono_pagesize (), 0);
mono_aot_register_jit_icall ("mono_ppc_throw_exception", mono_ppc_throw_exception);
+
+ // FIXME: Fix partial sharing for power and remove this
+ mono_set_partial_sharing_supported (FALSE);
}
/*

View File

@ -0,0 +1,168 @@
From f05362d9a16317c65cf46506b7557dfb0176a678 Mon Sep 17 00:00:00 2001
From: Bill Seurer <seurer@linux.vnet.ibm.com>
Date: Mon, 24 Aug 2015 17:10:36 -0500
Subject: [PATCH] [ppc] Add MonoContext and asynch callback support
---
mono/mini/exceptions-ppc.c | 13 ++++++
mono/mini/mini-ppc.h | 11 ++++-
mono/utils/mono-context.h | 95 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 117 insertions(+), 2 deletions(-)
Index: mono-4.2.1/mono/mini/exceptions-ppc.c
===================================================================
--- mono-4.2.1.orig/mono/mini/exceptions-ppc.c
+++ mono-4.2.1/mono/mini/exceptions-ppc.c
@@ -783,3 +783,16 @@ mono_arch_handle_exception (void *ctx, g
return result;
#endif
}
+
+
+// FIX ME: This is not complete
+void
+mono_arch_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data)
+{
+ uintptr_t sp = (uintptr_t) MONO_CONTEXT_GET_SP(ctx);
+ sp -= PPC_MINIMAL_STACK_SIZE;
+ *(unsigned long *)sp = MONO_CONTEXT_GET_SP(ctx);
+ MONO_CONTEXT_SET_BP(ctx, sp);
+ MONO_CONTEXT_SET_IP(ctx, (unsigned long) async_cb);
+}
+
Index: mono-4.2.1/mono/mini/mini-ppc.h
===================================================================
--- mono-4.2.1.orig/mono/mini/mini-ppc.h
+++ mono-4.2.1/mono/mini/mini-ppc.h
@@ -139,8 +139,15 @@ typedef struct MonoCompileArch {
/* Linux */
#ifdef __mono_ppc64__
#define PPC_RET_ADDR_OFFSET 16
-#define PPC_STACK_PARAM_OFFSET 48
-#define PPC_MINIMAL_STACK_SIZE 48
+ // Power LE abvi2
+ #if (_CALL_ELF == 2)
+ #define PPC_STACK_PARAM_OFFSET 32
+ #define PPC_MINIMAL_STACK_SIZE 32
+ #else
+ #define PPC_STACK_PARAM_OFFSET 48
+ #define PPC_MINIMAL_STACK_SIZE 48
+ #endif
+#define MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK 1
#define PPC_MINIMAL_PARAM_AREA_SIZE 64
#define PPC_LAST_FPARG_REG ppc_f13
#define PPC_PASS_STRUCTS_BY_VALUE 1
Index: mono-4.2.1/mono/utils/mono-context.h
===================================================================
--- mono-4.2.1.orig/mono/utils/mono-context.h
+++ mono-4.2.1/mono/utils/mono-context.h
@@ -359,6 +359,100 @@ typedef struct {
* We might also want to add an additional field to propagate
* the original context from the signal handler.
*/
+#ifdef __mono_ppc64__
+
+typedef struct {
+ gulong sc_ir; // pc
+ gulong sc_sp; // r1
+ mgreg_t regs [32];
+ double fregs [32];
+} MonoContext;
+
+/* we have the stack pointer, not the base pointer in sigcontext */
+#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->sc_ir = (gulong)ip; } while (0);
+#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->sc_sp = (gulong)bp; } while (0);
+#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->sc_sp = (gulong)sp; } while (0);
+
+#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->sc_ir))
+#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->regs [ppc_r31-13]))
+#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->sc_sp))
+
+#define MONO_CONTEXT_GET_CURRENT(ctx) \
+ __asm__ __volatile__( \
+ "std 0, 0(%0)\n" \
+ "std 1, 8(%0)\n" \
+ "std 0, 8*0+16(%0)\n" \
+ "std 1, 8*1+16(%0)\n" \
+ "std 2, 8*2+16(%0)\n" \
+ "std 3, 8*3+16(%0)\n" \
+ "std 4, 8*4+16(%0)\n" \
+ "std 5, 8*5+16(%0)\n" \
+ "std 6, 8*6+16(%0)\n" \
+ "std 7, 8*7+16(%0)\n" \
+ "std 8, 8*8+16(%0)\n" \
+ "std 9, 8*9+16(%0)\n" \
+ "std 10, 8*10+16(%0)\n" \
+ "std 11, 8*11+16(%0)\n" \
+ "std 12, 8*12+16(%0)\n" \
+ "std 13, 8*13+16(%0)\n" \
+ "std 14, 8*14+16(%0)\n" \
+ "std 15, 8*15+16(%0)\n" \
+ "std 16, 8*16+16(%0)\n" \
+ "std 17, 8*17+16(%0)\n" \
+ "std 18, 8*18+16(%0)\n" \
+ "std 19, 8*19+16(%0)\n" \
+ "std 20, 8*20+16(%0)\n" \
+ "std 21, 8*21+16(%0)\n" \
+ "std 22, 8*22+16(%0)\n" \
+ "std 23, 8*23+16(%0)\n" \
+ "std 24, 8*24+16(%0)\n" \
+ "std 25, 8*25+16(%0)\n" \
+ "std 26, 8*26+16(%0)\n" \
+ "std 27, 8*27+16(%0)\n" \
+ "std 28, 8*28+16(%0)\n" \
+ "std 29, 8*29+16(%0)\n" \
+ "std 30, 8*30+16(%0)\n" \
+ "std 31, 8*31+16(%0)\n" \
+ "stfd 0, 8*0+8*32+16(%0)\n" \
+ "stfd 1, 8*1+8*32+16(%0)\n" \
+ "stfd 2, 8*2+8*32+16(%0)\n" \
+ "stfd 3, 8*3+8*32+16(%0)\n" \
+ "stfd 4, 8*4+8*32+16(%0)\n" \
+ "stfd 5, 8*5+8*32+16(%0)\n" \
+ "stfd 6, 8*6+8*32+16(%0)\n" \
+ "stfd 7, 8*7+8*32+16(%0)\n" \
+ "stfd 8, 8*8+8*32+16(%0)\n" \
+ "stfd 9, 8*9+8*32+16(%0)\n" \
+ "stfd 10, 8*10+8*32+16(%0)\n" \
+ "stfd 11, 8*11+8*32+16(%0)\n" \
+ "stfd 12, 8*12+8*32+16(%0)\n" \
+ "stfd 13, 8*13+8*32+16(%0)\n" \
+ "stfd 14, 8*14+8*32+16(%0)\n" \
+ "stfd 15, 8*15+8*32+16(%0)\n" \
+ "stfd 16, 8*16+8*32+16(%0)\n" \
+ "stfd 17, 8*17+8*32+16(%0)\n" \
+ "stfd 18, 8*18+8*32+16(%0)\n" \
+ "stfd 19, 8*19+8*32+16(%0)\n" \
+ "stfd 20, 8*20+8*32+16(%0)\n" \
+ "stfd 21, 8*21+8*32+16(%0)\n" \
+ "stfd 22, 8*22+8*32+16(%0)\n" \
+ "stfd 23, 8*23+8*32+16(%0)\n" \
+ "stfd 24, 8*24+8*32+16(%0)\n" \
+ "stfd 25, 8*25+8*32+16(%0)\n" \
+ "stfd 26, 8*26+8*32+16(%0)\n" \
+ "stfd 27, 8*27+8*32+16(%0)\n" \
+ "stfd 28, 8*28+8*32+16(%0)\n" \
+ "stfd 29, 8*29+8*32+16(%0)\n" \
+ "stfd 30, 8*30+8*32+16(%0)\n" \
+ "stfd 31, 8*31+8*32+16(%0)\n" \
+ : : "r" (&(ctx)) \
+ : "memory" \
+ )
+
+#define MONO_ARCH_HAS_MONO_CONTEXT 1
+
+#else
+
typedef struct {
gulong sc_ir; // pc
gulong sc_sp; // r1
@@ -375,6 +469,7 @@ typedef struct {
#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->sc_ir))
#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->regs [ppc_r31-13]))
#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->sc_sp))
+#endif
#elif defined(__sparc__) || defined(sparc) /* defined(__mono_ppc__) */

View File

@ -0,0 +1,21 @@
From f967c79926900343f399c75624deedaba460e544 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= <alexrp@xamarin.com>
Date: Mon, 3 Aug 2015 17:32:07 +0200
Subject: [PATCH] [ppc] Instruction length of atomic_add_i4 is 28.
---
mono/mini/cpu-ppc.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: mono-4.2.1/mono/mini/cpu-ppc.md
===================================================================
--- mono-4.2.1.orig/mono/mini/cpu-ppc.md
+++ mono-4.2.1/mono/mini/cpu-ppc.md
@@ -314,5 +314,5 @@ vcall2_membase: src1:b len:16 clob:c
jump_table: dest:i len:8
-atomic_add_i4: src1:b src2:i dest:i len:20
+atomic_add_i4: src1:b src2:i dest:i len:28
atomic_cas_i4: src1:b src2:i src3:i dest:i len:38

File diff suppressed because it is too large Load Diff