Skip to content

Commit

Permalink
Upgrade NDK version to r20 (frida#969)
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammed Ziad authored and oleavr committed Jul 30, 2019
1 parent 5f0e701 commit b32fd6a
Show file tree
Hide file tree
Showing 7 changed files with 2,853 additions and 124 deletions.
1 change: 1 addition & 0 deletions Makefile.linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ build/$2-%/frida-$$(PYTHON_NAME)/.frida-stamp: build/.frida-python-submodule-sta
--libdir $$(FRIDA)/build/$1-$$*/lib \
$$$$cross_args \
-Dpython=$$(PYTHON) \
-Dpython_incdir=$$(PYTHON_INCDIR) \
frida-python $$$$builddir || exit 1; \
fi; \
$$(NINJA) -C $$$$builddir install || exit 1
Expand Down
9 changes: 5 additions & 4 deletions Makefile.sdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repo_base_url = https://github.com/frida
repo_suffix := .git

libiconv_version := 1.15
elfutils_version := 34ff3ca2e86f8a4915500b92a8e00d6f52aa546c
elfutils_version := 1b1433d5670b75c4bd5c9b598e0b00fba6e82d90
libdwarf_version := 20190110
openssl_version := 1.1.1b
v8_api_version := 7.0
Expand Down Expand Up @@ -166,6 +166,7 @@ build/.elfutils-stamp: build/fs-env-$(build_platform_arch).rc
. $< \
&& cd elfutils \
&& git checkout $(elfutils_version) \
&& patch -p1 < ../releng/patches/elfutils-clang.patch \
&& patch -p1 < ../releng/patches/elfutils-android.patch \
&& autoreconf -ifv
@mkdir -p $(@D)
Expand Down Expand Up @@ -548,11 +549,11 @@ ifeq ($(host_platform), android)
use_xcode_clang=true \
use_custom_libcxx=false \
android_ndk_root="$(ANDROID_NDK_ROOT)" \
android_ndk_version="r17b" \
android_ndk_major_version=17 \
android_ndk_version="r20" \
android_ndk_major_version=20 \
android32_ndk_api_level=18 \
android64_ndk_api_level=21 \
clang_base_path="$(abspath ./build/fs-ndk-android-$(host_arch))"
clang_base_path="$(abspath $(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(build_platform_arch))"
v8_libs_private := "-llog -lm"
endif

Expand Down
1 change: 1 addition & 0 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ FRIDA_SDK_DEBUG_FLAGS ?= -g1
PYTHON ?= $(shell which python)
PYTHON_VERSION := $(shell $(PYTHON) -c 'import sys; v = sys.version_info; print("{0}.{1}".format(v[0], v[1]))')
PYTHON_NAME ?= python$(PYTHON_VERSION)
PYTHON_INCDIR ?=

PYTHON3 ?= python3

Expand Down
105 changes: 32 additions & 73 deletions releng/patches/elfutils-android.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
diff -Nur elfutils-orig/lib/system.h elfutils/lib/system.h
--- elfutils-orig/lib/system.h 2019-02-15 16:46:47.000000000 +0100
+++ elfutils/lib/system.h 2019-04-05 11:54:14.000000000 +0200
diff --git a/configure.ac b/configure.ac
index 8274ec79..f00877a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -485,7 +485,7 @@ if test "$libc_has_argp" = "false" ; then
AC_CHECK_LIB([argp], [argp_parse], [have_argp="true"], [have_argp="false"])

if test "$have_argp" = "false"; then
- AC_MSG_ERROR("no libargp found")
+ AC_MSG_WARN("no libargp found")
else
argp_LDADD="-largp"
fi
diff --git a/lib/system.h b/lib/system.h
index 292082bd..172456d2 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -33,6 +33,7 @@
#include <error.h>
#include <stddef.h>
Expand All @@ -9,73 +23,30 @@ diff -Nur elfutils-orig/lib/system.h elfutils/lib/system.h
#include <sys/param.h>
#include <endian.h>
#include <byteswap.h>
diff -Nur elfutils-orig/libelf/elf_getaroff.c elfutils/libelf/elf_getaroff.c
--- elfutils-orig/libelf/elf_getaroff.c 2019-02-15 16:46:47.000000000 +0100
+++ elfutils/libelf/elf_getaroff.c 2019-04-05 11:54:14.000000000 +0200
@@ -38,7 +38,7 @@
#include "libelfP.h"


-off_t
+int64_t
elf_getaroff (Elf *elf)
{
/* Be gratious, the specs demand it. */
diff -Nur elfutils-orig/libelf/elf_getbase.c elfutils/libelf/elf_getbase.c
--- elfutils-orig/libelf/elf_getbase.c 2019-02-15 16:46:47.000000000 +0100
+++ elfutils/libelf/elf_getbase.c 2019-04-05 11:54:14.000000000 +0200
@@ -37,7 +37,7 @@
#include "libelfP.h"


-off_t
+int64_t
elf_getbase (Elf *elf)
{
return elf == NULL ? (off_t) -1 : elf->start_offset;
diff -Nur elfutils-orig/libelf/elf_getdata_rawchunk.c elfutils/libelf/elf_getdata_rawchunk.c
--- elfutils-orig/libelf/elf_getdata_rawchunk.c 2019-02-15 16:46:47.000000000 +0100
+++ elfutils/libelf/elf_getdata_rawchunk.c 2019-04-05 11:54:14.000000000 +0200
@@ -41,7 +41,7 @@
#include "common.h"

Elf_Data *
-elf_getdata_rawchunk (Elf *elf, off_t offset, size_t size, Elf_Type type)
+elf_getdata_rawchunk (Elf *elf, int64_t offset, size_t size, Elf_Type type)
{
if (unlikely (elf == NULL))
return NULL;
diff -Nur elfutils-orig/libelf/elf_update.c elfutils/libelf/elf_update.c
--- elfutils-orig/libelf/elf_update.c 2019-02-15 16:46:47.000000000 +0100
+++ elfutils/libelf/elf_update.c 2019-04-05 11:55:52.000000000 +0200
@@ -91,6 +91,7 @@
diff --git a/libelf/elf_update.c b/libelf/elf_update.c
index 9b8867ce..afb3aa82 100644
--- a/libelf/elf_update.c
+++ b/libelf/elf_update.c
@@ -91,6 +91,7 @@ write_file (Elf *elf, int64_t size, int change_bo, size_t shnum)
fallback case might fail (with unexpected errnos) in some cases.
So we only report an error when the call fails and errno is
ENOSPC. Otherwise we ignore the error and treat it as just hint. */
+#if 0
if (elf->parent == NULL
&& (elf->maximum_size == ~((size_t) 0)
|| (size_t) size > elf->maximum_size))
@@ -116,6 +117,7 @@
@@ -116,6 +117,7 @@ write_file (Elf *elf, int64_t size, int change_bo, size_t shnum)
}

}
+#endif

/* The file is mmaped. */
if ((class == ELFCLASS32
@@ -164,7 +166,7 @@
}


-off_t
+int64_t
elf_update (Elf *elf, Elf_Cmd cmd)
{
size_t shnum;
diff -Nur elfutils-orig/libelf/libelfP.h elfutils/libelf/libelfP.h
--- elfutils-orig/libelf/libelfP.h 2019-02-15 16:46:47.000000000 +0100
+++ elfutils/libelf/libelfP.h 2019-04-05 11:54:14.000000000 +0200
diff --git a/libelf/libelfP.h b/libelf/libelfP.h
index b55d5c48..5f13d947 100644
--- a/libelf/libelfP.h
+++ b/libelf/libelfP.h
@@ -40,7 +40,7 @@
#include <string.h>

Expand All @@ -85,21 +56,9 @@ diff -Nur elfutils-orig/libelf/libelfP.h elfutils/libelf/libelfP.h


/* Helper Macros to write 32 bit and 64 bit functions. */
diff -Nur elfutils-orig/libelf/libintl.h elfutils/libelf/libintl.h
--- elfutils-orig/libelf/libintl.h 1970-01-01 01:00:00.000000000 +0100
+++ elfutils/libelf/libintl.h 2019-04-05 11:54:14.000000000 +0200
diff --git a/libelf/libintl.h b/libelf/libintl.h
index e69de29b..0a2b2b66 100644
--- a/libelf/libintl.h
+++ b/libelf/libintl.h
@@ -0,0 +1 @@
+/* Empty stub for Android. */
diff --git a/configure.ac b/configure.ac
index b4e012de..28d4c2b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -485,7 +485,7 @@ if test "$libc_has_argp" = "false" ; then
AC_CHECK_LIB([argp], [argp_parse], [have_argp="true"], [have_argp="false"])

if test "$have_argp" = "false"; then
- AC_MSG_ERROR("no libargp found")
+ AC_MSG_WARN("no libargp found")
else
argp_LDADD="-largp"
fi
+/* Empty stub for Android. */
Loading

0 comments on commit b32fd6a

Please sign in to comment.