Skip to content

Commit

Permalink
Fix build errors in mono-context.c on ppc64el
Browse files Browse the repository at this point in the history
Build error mono/mono#1:

	libtool: compile:  gcc <...> -c mono-context.c  -fPIC -DPIC -o .libs/mono-context.o
	mono-context.c: In function 'mono_sigctx_to_monoctx':
	mono-context.c:435:68: error: 'MONO_SAVED_GREGS' undeclared (first use in this function)
	  memcpy (&mctx->regs, &UCONTEXT_REG_Rn(uc, 13), sizeof (mgreg_t) * MONO_SAVED_GREGS);
		                                                            ^
	mono-context.c:435:68: note: each undeclared identifier is reported only once for each function it appears in
	mono-context.c:436:70: error: 'MONO_SAVED_FREGS' undeclared (first use in this function)
	  memcpy (&mctx->fregs, &UCONTEXT_REG_FPRn(uc, 14), sizeof (double) * MONO_SAVED_FREGS);
		                                                              ^
The MONO_SAVED_GREGS and MONO_SAVED_FREGS macros are defined in mini-ppc.h.
The problem happens because commit mono/mono@7e056cd
moved code using them from exceptions-ppc.h (which includes mini-ppc.h) to
mono-context.c (which doesn't), where they're not #included.

So, include mini-ppc.h in mono-context.c (in the existing powerpc ifdef block).

Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>

Build error mono/mono#2:

Now, it turns out mini-ppc.h doesn't know MonoMethod, MonoMethodSignature, and MonoObject.
So, include object.h (MonoObject), which includes metadata.h (MonoMethod and MonoMethodSignature),
in mini-ppc.h.

	libtool: compile: gcc <...>  -c mono-context.c  -fPIC -DPIC -o .libs/mono-context.o
	In file included from mono-context.c:427:0:
	../../mono/mini/mini-ppc.h:37:2: error: unknown type name 'MonoMethod'
	  MonoMethod *method;
	  ^
	../../mono/mini/mini-ppc.h:306:31: error: unknown type name 'MonoMethodSignature'
	 mono_ppc_tail_call_supported (MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig) MONO_INTERNAL;
		                       ^
	../../mono/mini/mini-ppc.h:306:64: error: unknown type name 'MonoMethodSignature'
	 mono_ppc_tail_call_supported (MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig) MONO_INTERNAL;
		                                                        ^
	../../mono/mini/mini-ppc.h:312:27: error: unknown type name 'MonoObject'
	 mono_ppc_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, mgreg_t *int_regs, gdouble *fp_regs, gboolean rethrow) MONO_INTERNAL;
		                   ^

Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>


Commit migrated from mono/mono@e36ef8b
  • Loading branch information
Mauricio Faria de Oliveira committed Dec 23, 2014
1 parent 312ba48 commit 7251aac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/mono/mono/mini/mini-ppc.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <mono/arch/ppc/ppc-codegen.h>
#include <mono/utils/mono-sigcontext.h>
#include <mono/utils/mono-context.h>
#include <mono/metadata/object.h>
#include <glib.h>

#ifdef __mono_ppc64__
Expand Down
1 change: 1 addition & 0 deletions src/mono/mono/utils/mono-context.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
#elif (((defined(__ppc__) || defined(__powerpc__) || defined(__ppc64__)) && !defined(MONO_CROSS_COMPILE))) || (defined(TARGET_POWERPC))

#include <mono/utils/mono-context.h>
#include <mono/mini/mini-ppc.h>

void
mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
Expand Down

0 comments on commit 7251aac

Please sign in to comment.