Closed xiangzhai closed 4 years ago
@AndyAyersMS in case you are familiar with this.
The master branch is able to enable Interpreter even without skipcrossgen by following https://github.com/dotnet/coreclr/issues/24824#issuecomment-497048982
Hi,
Because $__HostArch
is not x64
when porting CoreCLR to mips64el, System.Private.CoreLib.dll
build unsupported:
./build.sh cmakeargs "-DFEATURE_INTERPRETER=1" ignorewarnings
...
System.Private.CoreLib.dll build unsupported.
Nuget package generation unsupported.
Repo successfully built.
Product binaries are available at /home/loongson/zhaixiang/coreclr-mips64-dev/bin/Product/Linux.mips64.Debug
AArch64 is the same "story":
~/zhaixiang/coreclr-mips64-dev
System.Private.CoreLib.dll build unsupported.
Nuget package generation unsupported.
Repo successfully built.
Product binaries are available at /home/loongson/zhaixiang/coreclr-mips64-dev/bin/Product/Linux.arm64.Debug
Just scp
HelloWorld.dll
published by following the document from X86/Linux to MIPS/Linux. Then use corerun
:
export COMPlus_LogEnable=1
export COMPlus_LogToConsole=1
export COMPlus_LogLevel=10
export COMPlus_DumpInterpreterStubs=1
export COMPlus_Interpret=*
export COMPlus_InterpreterJITThreshold=999999
export COMPlus_InterpreterPrintPostMortem=1
export COMPlus_InterpreterDoLoopMethods=1
export COMPlus_TraceInterpreterEntries=0
export COMPlus_TieredCompilation=1
export COMPlus_JITMinOpts=1
export COMPlus_ZapDisable=1
export COMPlus_JitFunctionTrace=1
./bin/Product/Linux.mips64.Debug/corerun HelloWorld.dll
PEImage::Startup
and PEAssembly::DoOpenSystem
failed to work, because System.Private.CoreLib.dll
is not available:
TID 4570: ===================EEStartup Starting===================ConstructCrst with this:0xf77d15f8
TID 4570: CCoreCLRBinderHelper::Init() completedg_pConfig->sync() completedConstructCrst with this:0xf77d21f0
...
TID 4570: Standalone GC location not provided, using provided GC
TID 4570: GC load successful
TID 4570: ClrVirtualAlloc (0x0000000000000000, 0x020000, 0x002000, 0x04) = 0x000000FFF4328000
...
TID 4570: StubManager::AddStubManager - 0x000000012AF57000 (vptr
...
...
TID 4570: Created system domain at 000000FFF77D7190
...
TID 4570: Updating AD stage, ADID=0, stage=0
...
TID 4570: SetAppDomainId: index 1 id 1
...
TID 4570: Updating AD stage, ADID=1, stage=1
TID 4570: CreateHandle: 000000FFF43311F8, type=2
...
TID 4570: VirtualCallStubManagerManager::AddStubManager - 0x000000012AF5C010 (vptr 0x000000FFF7702868)
TID 4570: Updating AD stage, ADID=1, stage=3
TID 4570: Created default domain at 000000012AF580A0
...
TID 4570: Created shared domain at 000000FFF77D6030
...
TID 4570: Initializing left-side debugging services.
TID 4570: CorDBGetInterface: initializing debugger.
TID 4570: ConstructCrst with this:0x2af61228
TID 4570: D::Lock aquire attempt by 0x4570
TID 4570: D::Lock aquired by 0x4570
...
TID 4570: DebuggerRCThreadInit called
TID 4570: DRCT::I: version info: 30319.0.1 current protocol=2, min protocol=2
TID 4570: ConstructCrst with this:0x2af68ec8
TID 4570: DebuggerRCThread::Start called...
TID 4570: D::Lock aquire attempt by 0x4570
TID 4570: DebuggerRCThread start was successful, id=17781
TID 4570: Start was successful
TID 4575: Threadock released lled
TID 4575: Threadock released lled
TID 4575: Debugger Thread spinning up
TID 4570: Left-side debugging services setup.
TID 4575: DRCT::TP: helper thread spinning up...
TID 4575: D::Lock aquire attempt by 0x4575
TID 4570: **PROF: Profiling not enabled.
TID 4575: D::Lock aquired by 0x4575
TID 4570: InitializeExceptionHandling() 0x4575 helperThreadId
TID 4570: InitializeExceptionHandling(): ExceptionTracker size: 0x188 bytes
TID 4575: D::Unlock released by 0x4575
TID 4570: TrackerAllocator::Init() succeeded..
TID 4575: DRCT::ML:: running main loop
TID 4570: waiting for event.
TID 4570: StackTraceInfo::Init (000000012AF77780)
TID 4570: CreateHandle: 000000FFF43313F8, type=0
TID 4570: CreateHandle: 000000FFF43311F0, type=2
TID 4570: SetupThread managed Thread 000000012AF774D0 Thread Id = 1
TID 4570: AddThread obtain lock
TID 4570: Locking thread store
TID 4570: Locked thread store
TID 4570: Unlocking thread store
TID 4570: ThreadCreated() not called due to CORDebuggerAttached() being FALSE for thread 0x1
TID 4570: SetBackground obtain lock
TID 4570: Locking thread store
TID 4570: Locked thread store
TID 4570: Unlocking thread store
TID 4570: D::Lock aquire attempt by 0x4570
TID 4570: D::Lock aquired by 0x4570
TID 4570: D::Unlock released by 0x4570
TID 4570: StubManager::AddStubManager - 0x000000012AF78DA0 (vptr f77014686361747441676244)
...
TID 4570: StackTraceInfo::Init (000000012AF885E0)
TID 4570: CreateHandle: 000000FFF43313F0, type=0
TID 4570: CreateHandle: 000000FFF43311E8, type=2
TID 4570: AddThread obtain lock
TID 4570: Locking thread store
TID 4570: Locked thread store
TID 4570: Unlocking thread store
TID 4570: ConstructCrst with this:0xf77d39b0
TID 4570: EEStartup: adding default domain 0x2af580a0
TID 4570: SD::PADAID: Adding 0x2af580a0
TID 4570: D::AADTIPC: Executing AADTIPC for AppDomain 0x2af580a0 (0x1).
TID 4570: D::AADTIPC: AddAppDomainToIPC:0x2af580a0, 0x000001
TID 4570: D::UADEIIPC: Executing UpdateAppDomainEntryInIPC ad:0x2af580a0.
TID 4570: sizeof(EEClass) = 80
sizeof(MethodTable) = 72
sizeof(MethodDesc)= 48
sizeof(FieldDesc) = 32
sizeof(Module) = 2424
TID 4570: PEImage: Closing Image /home/loongson/zhaixiang/coreclr-mips64-dev/bin/Product/Linux.mips64.Debug/System.Private.CoreLib.dll
TID 4570: ThrowHR: HR = 80070002
TID 4570: EX_THROW Type = 0x48522020 HR = 0x80070002, /home/loongson/zhaixiang/coreclr-mips64-dev/src/utilcode/ex.cpp line 1622
TID 4570: EX_CATCH /home/loongson/zhaixiang/coreclr-mips64-dev/src/vm/pefile.cpp line 2159
TID 4570: EX_THROW_WITH_INNER Type = 0x45452020 HR = 0x80070002, /home/loongson/zhaixiang/coreclr-mips64-dev/src/vm/clrex.cpp line 2005
TID 4570: EX_CATCH /home/loongson/zhaixiang/coreclr-mips64-dev/src/vm/ceemain.cpp line 1131
TID 4570: EX_CATCH catch succeeded (CLRException::HandlerState)
coreclr_initialize failed - status: 0x80004005
TID 4570: Deleting 0xf77d22d8
TID 4570: Deleting 0xf77d21f0
But System.Private.CoreLib.dll
is available for X86/Linux:
$ file bin/Product/Linux.x64.Debug/System.Private.CoreLib.dll
bin/Product/Linux.x64.Debug/System.Private.CoreLib.dll: PE32+ executable (DLL) (console) x86-64 Mono/.Net assembly, for MS Windows
How to build System.Private.CoreLib for mips64el?
Thanks, Leslie Zhai
cross-compile work! I also try build.sh arm64 debug verbose
for AArch64:
$ ./build.sh mips64 debug verbose
...
$ file bin/Product/Linux.mips64.Debug/System.Private.CoreLib.dll
bin/Product/Linux.mips64.Debug/System.Private.CoreLib.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows
Then scp
System.Private.CoreLib.dll
to MIPS/Linux, and use corerun
to run HelloWorld.dll
:
export COMPlus_LogEnable=1
export COMPlus_LogToConsole=1
export COMPlus_LogLevel=10
export COMPlus_DumpInterpreterStubs=1
export COMPlus_Interpret=*
export COMPlus_InterpreterJITThreshold=999999
export COMPlus_InterpreterPrintPostMortem=1
export COMPlus_InterpreterDoLoopMethods=1
export COMPlus_TraceInterpreterEntries=0
export COMPlus_TieredCompilation=1
export COMPlus_JITMinOpts=1
export COMPlus_ZapDisable=1
export COMPlus_JitFunctionTrace=1
./bin/Product/Linux.mips64.Debug/corerun HelloWorld.dll
...
TID 48b4: PEImage: Opening OS mapped /home/loongson/zhaixiang/coreclr-mips64-dev/bin/Product/Linux.mips64.Debug/System.Private.CoreLib.dll (hFile 00000000000000B8)
TID 48b4: ThrowHR: HR = 80004005
TID 48b4: EX_THROW Type = 0x48522020 HR = 0x80004005, /home/loongson/zhaixiang/coreclr-mips64-dev/src/utilcode/ex.cpp line 1622
TID 48b4: EX_CATCH /home/loongson/zhaixiang/coreclr-mips64-dev/src/vm/coreassemblyspec.cpp line 287
TID 48b4: EX_CATCH catch succeeded (CLRException::HandlerState)
TID 48b4: PEImage: Closing Image /home/loongson/zhaixiang/coreclr-mips64-dev/bin/Product/Linux.mips64.Debug/System.Private.CoreLib.dll
TID 48b4: PEImage: Opening flat /home/loongson/zhaixiang/coreclr-mips64-dev/bin/Product/Linux.mips64.Debug/System.Private.CoreLib.dll
TID 48b4: Set forbid suspend [0] for thread 000000012B897620.
TID 48b4: Reset forbid suspend [0] for thread 000000012B897620.
TID 48b4: Assembly /home/loongson/zhaixiang/coreclr-mips64-dev/bin/Product/Linux.mips64.Debug/System.Private.CoreLib.dll: has DebuggableAttribute=7,1 bits = 0x24
TID 48b4: Assembly /home/loongson/zhaixiang/coreclr-mips64-dev/bin/Product/Linux.mips64.Debug/System.Private.CoreLib.dll: bits=0x24
...
TID 48b4: LOADER: 2b8781f0:***System.Private.CoreLib* >>>Load initiated, POST_LOADLIBRARY/POST_LOADLIBRARY
TID 48b4: LOADER: 000000012B8781F0:***System.Private.CoreLib* loading at level BEGIN
TID 48b4: Set forbid suspend [0] for thread 000000012B897620.
TID 48b4: Reset forbid suspend [0] for thread 000000012B897620.
TID 48b4: LOADER: 000000012B8781F0:***System.Private.CoreLib* loading at level FIND_NATIVE_IMAGE
TID 48b4: ClrVirtualAlloc (0x000000FF73F00000, 0x004000, 0x001000, 0x04) = 0x000000FF73F00000
TID 48b4: LOADER: 000000012B8781F0:***System.Private.CoreLib* loading at level VERIFY_NATIVE_IMAGE_DEPENDENCIES
TID 48b4: LOADER: 000000012B8781F0:***System.Private.CoreLib* loading at level ALLOCATE
...
TID 48b4: Loaded pModule: "/home/loongson/zhaixiang/coreclr-mips64-dev/bin/Product/Linux.mips64.Debug/System.Private.CoreLib.dll".
...
TID 48b4: Module System.Private.CoreLib: bits=0x24
TID 48b4: Successfully added shareable assembly "System.Private.CoreLib".
TID 48b4: Set forbid suspend [0] for thread 000000012B897620.
TID 48b4: Reset forbid suspend [0] for thread 000000012B897620.
TID 48b4: STATICS: Allocating 2120 bytes for precomputed statics in module /home/loongson/zhaixiang/coreclr-mips64-dev/bin/Product/Linux.mips64.Debug/System.Private.CoreLib.dll in LoaderAllocator 000000012B879450
TID 48b4: ClrVirtualAlloc (0x000000FF73F0C000, 0x004000, 0x001000, 0x04) = 0x000000FF73F0C000
TID 48b4: StoreFile (StoreAssembly): Add cached entry (000000FF73F0C890) with PEFile 000000012B8AC1A0Completed Load Level ALLOCATE for DomainFile 000000012B8AC620 in AD 1 - success = 1
TID 48b4: LOADER: 000000012B8781F0:***System.Private.CoreLib* loading at level ADD_DEPENDENCIES
TID 48b4: Completed Load Level ADD_DEPENDENCIES for DomainFile 000000012B8AC620 in AD 1 - success = 1
TID 48b4: LOADER: 000000012B8781F0:***System.Private.CoreLib* loading at level PRE_LOADLIBRARY
TID 48b4: LOADER: 000000012B8781F0:***System.Private.CoreLib* loading at level LOADLIBRARY
TID 48b4: LOADER: 000000012B8781F0:***System.Private.CoreLib* loading at level POST_LOADLIBRARY
TID 48b4: LOADER: 2b8781f0:***System.Private.CoreLib* <<<Load completed, POST_LOADLIBRARY
...
TID 0bdb: Successfully loaded class System.Object
TID 0bdb: Successfully loaded class System.__Canon
TID 0bdb: Successfully loaded class System.ValueType
TID 0bdb: Successfully loaded class System.Enum
TID 0bdb: Successfully loaded class System.IComparable
TID 0bdb: Successfully loaded class System.IFormattable
TID 0bdb: Successfully loaded class System.IConvertible
TID 0bdb: Successfully loaded class System.Reflection.MemberInfo
TID 0bdb: Successfully loaded class System.Type
TID 0bdb: Successfully loaded class System.Reflection.TypeInfo
TID 0bdb: Successfully loaded class System.RuntimeType
TID 0bdb: Successfully loaded class System.Reflection.ICustomAttributeProvider
TID 0bdb: Successfully loaded class System.Reflection.IReflect
TID 0bdb: Successfully loaded class System.Reflection.IReflectableType
TID 0bdb: Successfully loaded class System.ICloneable
TID 0bdb: Successfully loaded class System.Array
TID 0bdb: Successfully loaded class System.Collections.IList
TID 0bdb: Successfully loaded class System.Collections.ICollection
TID 0bdb: Successfully loaded class System.Collections.IEnumerable
TID 0bdb: Successfully loaded class System.Collections.IStructuralComparable
TID 0bdb: Successfully loaded class System.Collections.IStructuralEquatable
TID 0bdb: Successfully loaded class System.SZArrayHelper
TID 0bdb: Successfully loaded class System.ByReference`1[T]
TID 0bdb: Successfully loaded class System.Nullable`1[T]
Hi,
Update to https://github.com/dotnet/coreclr/commit/d4fadf03b9964ba9a1bf96f5a2136c2c8f4f38fe
Then build to skipcrossgen:
New console HelloWorld demo:
Change HelloWorld.csproj:
Run
dotnet publish -c Debug
and sort of things by following the document:It is about
initializeCoreCLR
in the src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp:425BTW: the patch https://github.com/jkotas/coreclr/commit/0b00027c6e90f5edd25f1acd5ea2ca00139ca282 works for release/2.1 branch.
Thanks, Leslie Zhai