New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update NDK 25 LTS (r25b) #7240
Update NDK 25 LTS (r25b) #7240
Changes from 19 commits
fc9b93c
e807c5c
9c5dfe3
b2d2095
5ae8c24
e790b25
3573dbe
6202862
8310ba7
ecd3d20
0c82dce
78346b9
bf486a5
751a15e
74f9dd7
a9ddabb
dfe6d9c
c068d8c
4ceef84
6b1c49c
467a6fc
9ab11f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,20 +13,15 @@ | |
# CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations under the License. | ||
|
||
|
||
|
||
import os | ||
import glob | ||
import run | ||
import Constants | ||
import Environment | ||
import Node | ||
import Utils | ||
from waflib import ConfigSet | ||
from waflib import Build | ||
|
||
def load_build_context(directory): | ||
cachedir = os.path.join(directory,Constants.CACHE_DIR) | ||
return Environment.Environment(os.path.join(cachedir,'default.cache.py')) | ||
|
||
cachedir = os.path.join(directory,Build.CACHE_DIR) | ||
return ConfigSet.ConfigSet(os.path.join(cachedir,'_cache.py')) | ||
|
||
def glob_files(patterns, cwd=None): | ||
oldcwd=os.getcwd() | ||
|
@@ -41,51 +36,6 @@ def glob_files(patterns, cwd=None): | |
os.chdir(oldcwd) | ||
return out | ||
|
||
# Original from wafadmin/Build.py install_files: | ||
# I couldn't get the original code to work as I needed, so I made a small change to it. | ||
def package_install_files(self, path, files, env=None, chmod=Constants.O644, relative_trick=False, cwd=None): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. new waf doesn't have this function |
||
if env: | ||
assert isinstance(env,Environment.Environment),"invalid parameter" | ||
else: | ||
env=self.env | ||
if not path:return[] | ||
if not cwd: | ||
cwd=self.path | ||
if isinstance(files,str)and'*'in files: | ||
gl=cwd.abspath()+os.sep+files | ||
lst=glob.glob(gl) | ||
else: | ||
lst=Utils.to_list(files) | ||
destpath=self.get_install_path(path,env) | ||
Utils.check_dir(destpath) | ||
installed_files=[] | ||
for filename in lst: | ||
if isinstance(filename,str)and os.path.isabs(filename): | ||
alst=Utils.split_path(filename) | ||
destfile=os.path.join(destpath,alst[-1]) | ||
else: | ||
if isinstance(filename,Node.Node): | ||
nd=filename | ||
else: | ||
# DEFOLD: This is the fix to make the relative paths work our way | ||
fullpath=os.path.join(self.path.abspath(),filename) | ||
filename=os.path.relpath(fullpath,cwd.abspath()) | ||
# DEFOLD: <- end fix | ||
nd=cwd.find_resource(filename) | ||
if not nd: | ||
raise Utils.WafError("Unable to install the file %r (not found in %s)"%(filename,cwd)) | ||
if relative_trick: | ||
destfile=os.path.join(destpath,filename) | ||
Utils.check_dir(os.path.dirname(destfile)) | ||
else: | ||
destfile=os.path.join(destpath,nd.name) | ||
filename=nd.abspath(env) | ||
if self.do_install(filename,destfile,chmod): | ||
installed_files.append(destfile) | ||
return installed_files | ||
|
||
|
||
def create_tar(files, cwd, target): | ||
cmd = 'tar zcf %s %s' % (target, ' '.join(files)) | ||
run.command(cmd.split(), cwd=cwd) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -642,7 +642,7 @@ | |
:path ["android" "version_code"]} | ||
{:type :integer, | ||
:help "minimum API Level required for the application to run (android:minSdkVersion)", | ||
:default 16, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minimum android version increased to 19 |
||
:default 19, | ||
:path ["android" "minimum_sdk_version"]} | ||
{:type :integer, | ||
:help "the API Level that the application targets (android:targetSdkVersion)", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
// Copyright 2020-2022 The Defold Foundation | ||
// Copyright 2014-2020 King | ||
// Copyright 2009-2014 Ragnar Svensson, Christian Murray | ||
// Licensed under the Defold License version 1.0 (the "License"); you may not use | ||
// this file except in compliance with the License. | ||
// | ||
// You may obtain a copy of the License, together with FAQs at | ||
// https://www.defold.com/license | ||
// | ||
// Unless required by applicable law or agreed to in writing, software distributed | ||
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
// CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations under the License. | ||
|
||
#include <assert.h> | ||
#include <dlib/log.h> | ||
#include <dlib/dlib.h> | ||
#include <signal.h> | ||
#include <stdio.h> | ||
#include <unwind.h> | ||
#include <dlfcn.h> | ||
#include "crash.h" | ||
#include "crash_private.h" | ||
|
||
namespace dmCrash | ||
{ | ||
static const int SIGNAL_MAX = 64; | ||
|
||
static bool g_CrashDumpEnabled = true; | ||
static FCallstackExtraInfoCallback g_CrashExtraInfoCallback = 0; | ||
static void* g_CrashExtraInfoCallbackCtx = 0; | ||
|
||
struct unwind_data { | ||
uint32_t offset_extra; | ||
uint32_t stack_index; | ||
}; | ||
|
||
void EnableHandler(bool enable) | ||
{ | ||
g_CrashDumpEnabled = enable; | ||
} | ||
|
||
void HandlerSetExtraInfoCallback(FCallstackExtraInfoCallback cbk, void* ctx) | ||
{ | ||
g_CrashExtraInfoCallback = cbk; | ||
g_CrashExtraInfoCallbackCtx = ctx; | ||
} | ||
|
||
_Unwind_Reason_Code OnFrameEnter(struct _Unwind_Context *context, void *data) | ||
{ | ||
unwind_data * unwindData = (unwind_data *) data; | ||
const uintptr_t pc = _Unwind_GetIP(context); | ||
if (pc) | ||
{ | ||
g_AppState.m_Ptr[g_AppState.m_PtrCount] = (void*)(uintptr_t)pc; | ||
g_AppState.m_PtrCount++; | ||
Dl_info dl_info; | ||
int result = dladdr((void *) pc, &dl_info); | ||
if (result) { | ||
const char* proc_path = dl_info.dli_fname; | ||
bool proc_path_truncated = false; | ||
if (proc_path) { | ||
int proc_path_len = strlen(proc_path); | ||
if (proc_path_len > 32) { | ||
proc_path = proc_path + (proc_path_len-32); | ||
proc_path_truncated = true; | ||
} | ||
} | ||
char extra[256]; | ||
snprintf(extra, sizeof(extra), | ||
"#%02d pc %012p %s%s %s+%u", | ||
unwindData->stack_index++, | ||
(void*)((uintptr_t)pc - (intptr_t) dl_info.dli_fbase), | ||
proc_path_truncated ? "..." : "", | ||
proc_path ? proc_path : "", | ||
dl_info.dli_sname ? dl_info.dli_sname : "<unknown>", | ||
dl_info.dli_saddr != NULL ? (void*)((intptr_t) pc - (intptr_t) dl_info.dli_saddr) : 0); | ||
|
||
int extra_len = strlen(extra); | ||
if ((unwindData->offset_extra + extra_len) < (dmCrash::AppState::EXTRA_MAX - 1)) | ||
{ | ||
memcpy(g_AppState.m_Extra + unwindData->offset_extra, extra, extra_len); | ||
g_AppState.m_Extra[unwindData->offset_extra + extra_len] = '\n'; | ||
unwindData->offset_extra += extra_len + 1; | ||
} | ||
else | ||
{ | ||
dmLogWarning("Not enough space to write entire stacktrace!"); | ||
} | ||
} | ||
} | ||
return g_AppState.m_PtrCount >= AppState::PTRS_MAX ? _URC_END_OF_STACK : _URC_NO_REASON; | ||
} | ||
|
||
static void ResetToDefaultHandler(const int signum) | ||
{ | ||
struct sigaction sa; | ||
memset(&sa, 0, sizeof(sa)); | ||
sigemptyset(&sa.sa_mask); | ||
sa.sa_handler = SIG_DFL; | ||
sa.sa_flags = 0; | ||
sigaction(signum, &sa, NULL); | ||
} | ||
|
||
static void Handler(const int signo, siginfo_t* const si, void *const sc) | ||
{ | ||
if (!g_CrashDumpEnabled) | ||
return; | ||
|
||
g_AppState.m_Signum = signo; | ||
g_AppState.m_PtrCount = 0; | ||
|
||
// The default behavior is restored for the signal. | ||
// Unless this is done first thing in the signal handler we'll | ||
// be stuck in a signal-handler loop forever. | ||
ResetToDefaultHandler(signo); | ||
|
||
unwind_data unwindData; | ||
unwindData.offset_extra = 0; | ||
unwindData.stack_index = 0; | ||
_Unwind_Backtrace(OnFrameEnter, &unwindData); | ||
|
||
if (g_CrashExtraInfoCallback) | ||
{ | ||
int extra_len = strlen(g_AppState.m_Extra); | ||
g_CrashExtraInfoCallback(g_CrashExtraInfoCallbackCtx, g_AppState.m_Extra + extra_len, dmCrash::AppState::EXTRA_MAX - extra_len - 1); | ||
} | ||
|
||
WriteCrash(g_FilePath, &g_AppState); | ||
|
||
bool is_debug_mode = dLib::IsDebugMode(); | ||
dLib::SetDebugMode(true); | ||
dmLogError("CALL STACK:\n\n%s\n", g_AppState.m_Extra); | ||
dLib::SetDebugMode(is_debug_mode); | ||
} | ||
|
||
void WriteDump() | ||
{ | ||
siginfo_t empty; | ||
Handler(0xDEAD, &empty, 0); | ||
} | ||
|
||
void InstallOnSignal(int signum) | ||
{ | ||
assert(signum >= 0 && signum < SIGNAL_MAX); | ||
|
||
struct sigaction sa; | ||
memset(&sa, 0, sizeof(sa)); | ||
sigemptyset(&sa.sa_mask); | ||
sa.sa_sigaction = Handler; | ||
sa.sa_flags = SA_SIGINFO; | ||
|
||
sigaction(signum, &sa, NULL); | ||
} | ||
|
||
void SetCrashFilename(const char*) | ||
{ | ||
} | ||
|
||
void PlatformPurge() | ||
{ | ||
} | ||
|
||
void InstallHandler() | ||
{ | ||
InstallOnSignal(SIGSEGV); | ||
InstallOnSignal(SIGBUS); | ||
InstallOnSignal(SIGTRAP); | ||
InstallOnSignal(SIGILL); | ||
InstallOnSignal(SIGABRT); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ def build(bld): | |
target = 'crashext_null') | ||
|
||
if 'android' in bld.env['PLATFORM']: | ||
sig_handler = 'backtrace_libunwind.cpp' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New backtrace unwinder implemented for Android. It uses clang libunwind There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ANd, now we have two files using the libunwind library. Note that "lib" is implicit for library names. I.e. "libunwind" == "the unwind library" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we use libunwind from NDK on Android and modified libunwind from Google for macos (because it's a bit better and can get symbols from DWARF). |
||
sig_handler = 'backtrace_libunwind_ndk.cpp' | ||
load_addrs = 'load_addrs_proc_smap.cpp' | ||
file_handler = 'file_posix.cpp' | ||
elif 'linux' in bld.env['PLATFORM']: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the 64 bit
strip
nowwork on
armv7` executables?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find docs for it (it's always isn't so easy) but I tested it and it works