Bug 10076 - Cross compiling fails for target PowerPC
Summary: Cross compiling fails for target PowerPC
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: unspecified
Hardware: Other Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2013-02-06 05:00 UTC by tobias.tretter
Modified: 2013-02-15 02:28 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description tobias.tretter 2013-02-06 05:00:38 UTC
There are two problems when cross-compiling mono3.0.2 for the target PowerPC

The used tool chain is WindRiver4.1, which finally is a gcc cross toolchain:
> powerpc-wrs-linux-gnu-gcc --version
  powerpc-wrs-linux-gnu-gcc (Wind River Linux Sourcery G++ 4.4a-323) 4.4.1

First thing is that there are compiler errors when compiling mono/metadata, the preprocessor constant ARCH_NUM_REGS is undefined. The problem is located in /mono/metadata/sgen-archdep.h, line 92. The statement there is
#elif defined(TARGET_PPC)
but the configure script uses the constant "TARGET_POWERPC", so the line there should read:
#elif defined(TARGET_POWERPC)

Second problem is when compiling mono/mini, the final link for executable fails with the following unresolved symbol: 
./.libs/libmini-static.a(libmini_static_la-aot-compiler.o): In function `mono_aot_parse_options':
...mono-3.0.2/mono/mini/aot-compiler.c:5287: undefined reference to `mini_gc_enable_gc_maps_for_aot'
...ld: mono: hidden symbol `mini_gc_enable_gc_maps_for_aot' isn't defined
...ld: final link failed: Nonrepresentable section on output

The source of the problem is within mono/mini/mini-gc.c: if MONO_ARCH_GC_MAPS_SUPPORTED is not defined (line 16), then the empty definition for mini_gc_enable_gc_maps_for_aot(void) is missing, it should be added in the #else part corresponding to line 16 "#if defined(MONO_ARCH_GC_MAPS_SUPPORTED)" starting at line 2508, for example:

diff ./mono/mini/mini-gc.c ../mono-3.0.2.linux-working/mono/mini/mini-gc.c
> void
> mini_gc_enable_gc_maps_for_aot(void)
> {
> }
Comment 1 Zoltan Varga 2013-02-15 02:28:30 UTC
Fixed those in cf0bc265c48a03d37c01e6f1fb118626a1faa234. PPC is not a very strongly supported mono platform, so you might run into more problems.