Skip to content

Commit

Permalink
Bump NDK to r26 (#8213)
Browse files Browse the repository at this point in the history
Changes: https://github.com/android/ndk/wiki/Changelog-r26#announcements

NDK r26 has the following changes which are interesting to us:

  * libc++ has been updated. The NDK's libc++ now comes directly from
    our LLVM toolchain, so every future LLVM update is also a libc++
    update.
  * Updated LLVM to clang-r487747c, based on LLVM 17 development

The `libc++` update brings internal implementation changes, and as a
result we no longer need to partially instantiate a couple of classes
previously underlying the `vector<T>` and `basic_string<T>`
implementations.
  • Loading branch information
grendello authored Sep 21, 2023
1 parent eb6397d commit 8ef7a6e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ namespace Xamarin.Android.Prepare
{
class BuildAndroidPlatforms
{
public const string AndroidNdkVersion = "25c";
public const string AndroidNdkPkgRevision = "25.2.9519653";
public const string AndroidNdkVersion = "26";
public const string AndroidNdkPkgRevision = "26.0.10792818";
public const int NdkMinimumAPI = 21;
public const int NdkMinimumAPILegacy32 = 19;
public const int NdkMinimumAPILegacy32 = 21;

public static readonly List<AndroidPlatform> AllPlatforms = new List<AndroidPlatform> {
new AndroidPlatform (apiName: "", apiLevel: 1, platformID: "1"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void TestNdkUtil ()
Assert.IsTrue (ndk.ValidateNdkPlatform (arch, enableLLVM: false));
Assert.AreEqual (0, errors.Count, "NdkTools.ValidateNdkPlatform should not have returned false.");
int level = ndk.GetMinimumApiLevelFor (arch);
int expected = 19;
int expected = 21;
Assert.AreEqual (expected, level, $"Min Api Level for {arch} should be {expected}.");
var compilerNoQuotes = ndk.GetToolPath (NdkToolKind.CompilerC, arch, level);
Assert.AreEqual (0, errors.Count, "NdkTools.GetToolPath should not have errored.");
Expand Down
1 change: 0 additions & 1 deletion src/monodroid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,6 @@ if(ANDROID)
${BIONIC_SOURCES_DIR}/cxa_guard.cc
${SOURCES_DIR}/cxx-abi/string.cc
${SOURCES_DIR}/cxx-abi/terminate.cc
${SOURCES_DIR}/cxx-abi/vector.cc
)
endif()
else()
Expand Down
1 change: 0 additions & 1 deletion src/monodroid/jni/cxx-abi/string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

_LIBCPP_BEGIN_NAMESPACE_STD

template class __attribute__ ((__visibility__("hidden"))) __basic_string_common<true>;
template class __attribute__ ((__visibility__("hidden"))) basic_string<char>;

_LIBCPP_END_NAMESPACE_STD
12 changes: 0 additions & 12 deletions src/monodroid/jni/cxx-abi/vector.cc

This file was deleted.

15 changes: 9 additions & 6 deletions tests/Mono.Android-Tests/jni/reuse-threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>
Expand Down Expand Up @@ -206,15 +207,17 @@ rt_invoke_callback_on_new_thread (CB cb)
return 0;
}

static int _register_retval = 0;

/* We return -2 for errors, because -1 is reserved for the pthreads PTHREAD_CANCELED special value, indicating that the
* thread was canceled. */
static int
static void*
_register_type_from_new_thread (void *data)
{
RegisterFromThreadContext *context = (RegisterFromThreadContext*)data;

if (context == NULL) {
return -100;
return (void*)(intptr_t)-100;
}

JNIEnv *env = _get_env ("_register_type_from_new_thread");
Expand All @@ -227,7 +230,7 @@ _register_type_from_new_thread (void *data)
(*env)->ExceptionClear (env);
}

return -101;
return (void*)(intptr_t)-101;
}

int ret = 0;
Expand Down Expand Up @@ -286,7 +289,7 @@ _register_type_from_new_thread (void *data)
cleanup:
(*env)->PopLocalFrame (env, NULL);

return ret;
return (void*)(intptr_t)ret;
}

JNIEXPORT int JNICALL
Expand All @@ -312,10 +315,10 @@ rt_register_type_on_new_thread (const char *java_type_name, jobject class_loader
return -201;
}

if ((int)tr == -1 /* PTHREAD_CANCELED - not defined in bionic */) {
if ((int)(intptr_t)tr == -1 /* PTHREAD_CANCELED - not defined in bionic */) {
__android_log_print (ANDROID_LOG_INFO, "XA/RuntimeTest", "RegisterOnNewThread: worker thread was canceled");
return -202;
}

return (int)tr;
return (int)(intptr_t)tr;
}

0 comments on commit 8ef7a6e

Please sign in to comment.