Bug 3689 - LLVM is broken in Mono 2.11 on OSX
Summary: LLVM is broken in Mono 2.11 on OSX
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-02-29 15:07 UTC by Alex Corrado [MSFT]
Modified: 2012-02-29 19:59 UTC (History)
3 users (show)

Tags:
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:
Status:
RESOLVED FIXED

Description Alex Corrado [MSFT] 2012-02-29 15:07:45 UTC
The current Mono 2.11 packages fail to run a simple exe with LLVM enabled:

$ cat fibber.cs
using System;
static class MainClass {
        public static void Main (string [] args) {
                Console.WriteLine (Fib (int.Parse (args [0])));
        }
        static int Fib (int f)  {
                if (f == 0 || f == 1) return f;
                return Fib (f - 1) + Fib (f - 2);
        }
}

$ mcs fibber.cs
$ DYLD_FALLBACK_LIBRARY_PATH=/Library/Frameworks/Mono.framework/Versions/2.11/lib mono --llvm fibber.exe

Assertion failed: (Is64Bit && "Large code model is only legal in 64-bit mode."), function LowerCall, file X86ISelLowering.cpp, line 2399.
Stacktrace:


Native stacktrace:

	0   mono                                0x0009689e mono_handle_native_sigsegv + 382
	1   mono                                0x000e9a0d sigabrt_signal_handler + 109
	2   libsystem_c.dylib                   0x9643659b _sigtramp + 43
	3   ???                                 0xffffffff 0x0 + 4294967295
	4   libmono-llvm.dylib                  0x0186ee0b abort + 27
	5   libmono-llvm.dylib                  0x0186ee84 __assert_rtn + 100
	6   libmono-llvm.dylib                  0x01065e4c _ZNK4llvm17X86TargetLowering9LowerCallENS_7SDValueES1_NS_11CallingConv2IDEbRbRKNS_15SmallVectorImplINS_3ISD9OutputArgEEERKNS5_IS1_EERKNS5_INS6_8InputArgEEENS_8DebugLocERNS_12SelectionDAGERSB_ + 11332
	7   libmono-llvm.dylib                  0x0124cc77 _ZNK4llvm14TargetLowering11LowerCallToENS_7SDValueEPNS_4TypeEbbbbjNS_11CallingConv2IDEbbS1_RSt6vectorINS0_12ArgListEntryESaIS7_EERNS_12SelectionDAGENS_8DebugLocE + 2541
	8   libmono-llvm.dylib                  0x01263ae5 _ZN4llvm19SelectionDAGBuilder11LowerCallToENS_17ImmutableCallSiteENS_7SDValueEbPNS_17MachineBasicBlockE + 2811
	9   libmono-llvm.dylib                  0x01258851 _ZN4llvm19SelectionDAGBuilder9visitCallERKNS_8CallInstE + 5525
	10  libmono-llvm.dylib                  0x01251b56 _ZN4llvm19SelectionDAGBuilder5visitEjRKNS_4UserE + 1172
	11  libmono-llvm.dylib                  0x0127d919 _ZN4llvm19SelectionDAGBuilder5visitERKNS_11InstructionE + 75
	12  libmono-llvm.dylib                  0x0128ed4c _ZN4llvm16SelectionDAGISel16SelectBasicBlockENS_14ilist_iteratorIKNS_11InstructionEEES4_Rb + 44
	13  libmono-llvm.dylib                  0x0129079b _ZN4llvm16SelectionDAGISel20SelectAllBasicBlocksERKNS_8FunctionE + 6513
	14  libmono-llvm.dylib                  0x0129147f _ZN4llvm16SelectionDAGISel20runOnMachineFunctionERNS_15MachineFunctionE + 1223
	15  libmono-llvm.dylib                  0x01360a35 _ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE + 69
	16  libmono-llvm.dylib                  0x01802d4a _ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE + 360
	17  libmono-llvm.dylib                  0x01803fe6 _ZN4llvm23FunctionPassManagerImpl3runERNS_8FunctionE + 362
	18  libmono-llvm.dylib                  0x01804123 _ZN4llvm19FunctionPassManager3runERNS_8FunctionE + 83
	19  libmono-llvm.dylib                  0x012b94ae _ZN4llvm3JIT24runJITOnFunctionUnlockedEPNS_8FunctionERKNS_10MutexGuardE + 62
	20  libmono-llvm.dylib                  0x012b965d _ZN4llvm3JIT20getPointerToFunctionEPNS_8FunctionE + 183
	21  libmono-llvm.dylib                  0x012d2881 _ZN4llvm15ExecutionEngine18getPointerToGlobalEPKNS_11GlobalValueE + 51
	22  libmono-llvm.dylib                  0x0100fbe3 mono_llvm_emit_method + 4595
	23  mono                                0x0000a89b mini_method_compile + 3851
	24  mono                                0x0000c74a mono_jit_compile_method_with_opt + 1274
	25  mono                                0x0000d33f mono_jit_runtime_invoke + 367
	26  mono                                0x001bb38a mono_runtime_invoke + 170
	27  mono                                0x0012fcef create_exception_two_strings + 303
	28  mono                                0x0012fd6b mono_exception_from_name_two_strings + 91
	29  mono                                0x000e9c8f create_domain_objects + 159
	30  mono                                0x000e9fa6 mono_runtime_init + 518
	31  mono                                0x0000f865 mini_init + 5333
	32  mono                                0x0006aeef mono_main + 5455
	33  mono                                0x00002159 main + 441
	34  mono                                0x00001f55 start + 53

Debug info from gdb:

Attaching to process 9592.
Reading symbols for shared libraries . done
Reading symbols for shared libraries ..................................... done
0x9155ffd5 in __wait4 ()
  2                         0x9155dc22 in mach_msg_trap ()
* 1 "com.apple.main-thread" 0x9155ffd5 in __wait4 ()

Thread 2 (process 9592):
#0  0x9155dc22 in mach_msg_trap ()
#1  0x9155d1f6 in mach_msg ()
#2  0x000e89fa in mach_exception_thread (arg=0x0) at mini-darwin.c:130
#3  0x0028de48 in GC_start_routine (arg=0x1bdcf60) at pthread_support.c:1473
#4  0x963deed9 in _pthread_start ()
#5  0x963e26de in thread_start ()

Thread 1 (process 9592):
#0  0x9155ffd5 in __wait4 ()
#1  0x963934ec in waitpid$UNIX2003 ()
#2  0x00096992 in mono_handle_native_sigsegv (signal=6, ctx=0xbfffdffc) at mini-exceptions.c:2266
#3  0x000e9a0d in sigabrt_signal_handler (_dummy=6, info=0xbfffdfbc, context=0xbfffdffc) at mini-posix.c:196
#4  <signal handler called>
#5  0x9155f9c6 in __pthread_kill ()
#6  0x963e0f78 in pthread_kill ()
#7  0x0186ee0b in abort ()
#8  0x0186ee84 in __assert_rtn ()
#9  0x01065e4c in llvm::X86TargetLowering::LowerCall ()
#10 0x0124cc77 in llvm::TargetLowering::LowerCallTo ()
#11 0x01263ae5 in llvm::SelectionDAGBuilder::LowerCallTo ()
#12 0x01258851 in llvm::SelectionDAGBuilder::visitCall ()
#13 0x01251b56 in llvm::SelectionDAGBuilder::visit ()
#14 0x0127d919 in llvm::SelectionDAGBuilder::visit ()
#15 0x0128ed4c in llvm::SelectionDAGISel::SelectBasicBlock ()
#16 0x0129079b in llvm::SelectionDAGISel::SelectAllBasicBlocks ()
#17 0x0129147f in llvm::SelectionDAGISel::runOnMachineFunction ()
#18 0x01360a35 in llvm::MachineFunctionPass::runOnFunction ()
#19 0x01802d4a in llvm::FPPassManager::runOnFunction ()
#20 0x01803fe6 in llvm::FunctionPassManagerImpl::run ()
#21 0x01804123 in llvm::FunctionPassManager::run ()
#22 0x012b94ae in llvm::JIT::runJITOnFunctionUnlocked ()
#23 0x012b965d in llvm::JIT::getPointerToFunction ()
#24 0x012d2881 in llvm::ExecutionEngine::getPointerToGlobal ()
#25 0x0100fbe3 in mono_llvm_emit_method (cfg=0x2988600) at mini-llvm.c:4501
#26 0x0000a89b in mono_llvm_emit_method [inlined] () at /Users/alex/OpenSource/bockbuild/profiles/mono-master-mac/build-root/mono-2.11/_build/mono-2.11.git/mono/mini/mini-llvm.h:4920
#27 0x0000a89b in mini_method_compile (method=0x29990ec, opts=59861503, domain=0x1be2e00, run_cctors=1, compile_aot=0, parts=0) at mini.c:4920
#28 0x0000c74a in mono_jit_compile_method_with_opt (method=0xbffff838, opt=3221223480, ex=0xbffff864) at mini.c:5223
#29 0x0000d33f in mono_jit_runtime_invoke (method=0x29990ec, obj=0x1e50fc0, params=0xbffff8f8, exc=0x0) at mini.c:5694
#30 0x001bb38a in mono_runtime_invoke (method=0x29990ec, obj=0x1e50fc0, params=0xbffff8f8, exc=0x0) at object.c:2785
#31 0x0012fcef in create_exception_two_strings (klass=0x2998a94, a1=0x1e47fa0, a2=0x0) at exception.c:134
#32 0x0012fd6b in mono_exception_from_name_two_strings (image=0x297ce00, name_space=0x2a4a74 "System", name=0x298369 "OutOfMemoryException", a1=0x1e47fa0, a2=0x0) at exception.c:157
#33 0x000e9c8f in create_domain_objects (domain=0x1be2e00) at appdomain.c:177
#34 0x000e9fa6 in mono_runtime_init (domain=0x1be2e00, start_cb=0x37e0 <mono_thread_start_cb>, attach_cb=0x38e0 <mono_thread_attach_cb>) at appdomain.c:261
#35 0x0000f865 in mini_init (filename=0xbffffc80 "fibber.exe", runtime_version=0x0) at mini.c:6690
#36 0x0006aeef in mono_main (argc=3, argv=0xbffffbe4) at driver.c:1812
#37 0x00002159 in main (argc=3, argv=0xbffffbe4) at main.c:70

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Abort trap: 6
Comment 1 Zoltan Varga 2012-02-29 19:59:16 UTC
Fixed in master.