Skip to content

Commit 21b1ca4

Browse files
committed
Tracking why System.Private.CoreLib.dll load fails
1 parent 170e595 commit 21b1ca4

File tree

4 files changed

+30
-16
lines changed

4 files changed

+30
-16
lines changed

eng/native/build-commons.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,20 @@ build_native()
6363
# All set to commence the build
6464
echo "Commencing build of \"$target\" target in \"$message\" for $__TargetOS.$__TargetArch.$__BuildType in $intermediatesDir"
6565

66+
SAVED_CFLAGS="${CFLAGS}"
67+
SAVED_CXXFLAGS="${CXXFLAGS}"
68+
SAVED_LDFLAGS="${LDFLAGS}"
69+
70+
# Let users provide additional compiler/linker flags via EXTRA_CFLAGS/EXTRA_CXXFLAGS/EXTRA_LDFLAGS.
71+
# If users directly override CFLAG/CXXFLAGS/LDFLAGS, that may lead to some configure tests working incorrectly.
72+
# See https://github.com/dotnet/runtime/issues/35727 for more information.
73+
#
74+
# These flags MUST be exported before gen-buildsys.sh runs or cmake will ignore them
75+
#
76+
export CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}"
77+
export CXXFLAGS="${CXXFLAGS} ${EXTRA_CXXFLAGS}"
78+
export LDFLAGS="${LDFLAGS} ${EXTRA_LDFLAGS}"
79+
6680
if [[ "$targetOS" == osx || "$targetOS" == maccatalyst ]]; then
6781
if [[ "$hostArch" == x64 ]]; then
6882
cmakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"x86_64\" $cmakeArgs"
@@ -197,17 +211,6 @@ build_native()
197211
return
198212
fi
199213

200-
SAVED_CFLAGS="${CFLAGS}"
201-
SAVED_CXXFLAGS="${CXXFLAGS}"
202-
SAVED_LDFLAGS="${LDFLAGS}"
203-
204-
# Let users provide additional compiler/linker flags via EXTRA_CFLAGS/EXTRA_CXXFLAGS/EXTRA_LDFLAGS.
205-
# If users directly override CFLAG/CXXFLAGS/LDFLAGS, that may lead to some configure tests working incorrectly.
206-
# See https://github.com/dotnet/runtime/issues/35727 for more information.
207-
export CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}"
208-
export CXXFLAGS="${CXXFLAGS} ${EXTRA_CXXFLAGS}"
209-
export LDFLAGS="${LDFLAGS} ${EXTRA_LDFLAGS}"
210-
211214
local exit_code
212215
if [[ "$__StaticAnalyzer" == 1 ]]; then
213216
pushd "$intermediatesDir"

src/coreclr/dlls/mscoree/exports.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,3 +652,13 @@ void LogErrorToHost(const char* format, ...)
652652
va_end(args);
653653
}
654654
}
655+
656+
#if defined(TARGET_ANDROID)
657+
void LogDebugToHost(const char* format, ...)
658+
{
659+
va_list args;
660+
va_start(args, format);
661+
__android_log_vprint(ANDROID_LOG_DEBUG, ANDROID_LOGCAT_TAG, format, args);
662+
va_end(args);
663+
}
664+
#endif

src/coreclr/vm/appdomain.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,12 +1017,13 @@ void SystemDomain::LoadBaseSystemClasses()
10171017

10181018
EX_TRY
10191019
{
1020+
LogDebugToHost ("Here #00.01");
10201021
m_pSystemPEAssembly = PEAssembly::OpenSystem();
1021-
1022+
LogDebugToHost ("Here #00.02");
10221023
// Only partially load the system assembly. Other parts of the code will want to access
10231024
// the globals in this function before finishing the load.
10241025
m_pSystemAssembly = DefaultDomain()->LoadAssembly(NULL, m_pSystemPEAssembly, FILE_LOAD_BEFORE_TYPE_LOAD);
1025-
1026+
LogDebugToHost ("Here #00.03");
10261027
// Set up binder for CoreLib
10271028
CoreLibBinder::AttachModule(m_pSystemAssembly->GetModule());
10281029

src/coreclr/vm/common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ extern DummyGlobalContract ___contract;
397397
#endif
398398

399399
void LogErrorToHost(const char* format, ...);
400-
400+
#if defined(TARGET_ANDROID)
401+
void LogDebugToHost(const char* format, ...);
402+
#endif
401403
#endif // !_common_h_
402-
403-

0 commit comments

Comments
 (0)