aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2020-03-07 02:02:43 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-03-07 02:02:43 +0000
commitd220fe922b5869c1b153167a78dc8f081b891dae (patch)
tree8e075ab7329f84bc2eede2b85c3980c1bdd1f39e
parent5d2277df00aa4c3b197f1121d3fd041f3273bcaf (diff)
parentcf1601f23199d6f257d6d99f5bf7bca57a1c38d7 (diff)
downloadndk-d220fe922b5869c1b153167a78dc8f081b891dae.tar.gz
Merge "Fix API 30+ in ndk-build for LP64 ABIs."
-rw-r--r--build/core/setup-abi.mk19
-rw-r--r--build/core/setup-app.mk3
-rw-r--r--build/core/setup-toolchain.mk4
-rw-r--r--docs/changelogs/Changelog-r21.md3
4 files changed, 13 insertions, 16 deletions
diff --git a/build/core/setup-abi.mk b/build/core/setup-abi.mk
index 0e278c5d8..bdb350119 100644
--- a/build/core/setup-abi.mk
+++ b/build/core/setup-abi.mk
@@ -26,17 +26,19 @@ endif
TARGET_OUT := $(NDK_APP_OUT)/$(_app)/$(TARGET_ARCH_ABI)
-# For x86 and mips: the minimal platform level is android-9
-TARGET_PLATFORM_SAVED := $(TARGET_PLATFORM)
+TARGET_PLATFORM_LEVEL := $(APP_PLATFORM_LEVEL)
-# For 64-bit ABIs: the minimal platform level is android-21
+# 64-bit ABIs were first supported in API 21. Pull up these ABIs if the app has
+# a lower minSdkVersion.
ifneq ($(filter $(NDK_KNOWN_DEVICE_ABI64S),$(TARGET_ARCH_ABI)),)
-$(foreach _plat,3 4 5 8 9 10 11 12 13 14 15 16 17 18 19 20,\
- $(eval TARGET_PLATFORM := $$(subst android-$(_plat),android-21,$$(TARGET_PLATFORM)))\
-)
+ ifneq ($(call lt,$(TARGET_PLATFORM_LEVEL),21),)
+ TARGET_PLATFORM_LEVEL := 21
+ endif
endif
-TARGET_PLATFORM_LEVEL := $(strip $(subst android-,,$(TARGET_PLATFORM)))
+# Not used by ndk-build, but are documented for use by Android.mk files.
+TARGET_PLATFORM := android-$(TARGET_PLATFORM_LEVEL)
+TARGET_ABI := $(TARGET_PLATFORM)-$(TARGET_ARCH_ABI)
# If we're targeting a new enough platform version, we don't actually need to
# cover any gaps in libc for libc++ support. In those cases, save size in the
@@ -82,6 +84,3 @@ ifeq ($(TARGET_ARCH_ABI),x86_64)
endif
include $(BUILD_SYSTEM)/setup-toolchain.mk
-
-# Restore TARGET_PLATFORM, see above.
-TARGET_PLATFORM := $(TARGET_PLATFORM_SAVED)
diff --git a/build/core/setup-app.mk b/build/core/setup-app.mk
index dbd25e142..f893c73a7 100644
--- a/build/core/setup-app.mk
+++ b/build/core/setup-app.mk
@@ -39,9 +39,6 @@ $(foreach __name,$(NDK_APP_VARS),\
ndk-app-$(_app): $(NDK_APP_MODULES)
all: ndk-app-$(_app)
-# which platform/abi/toolchain are we going to use?
-TARGET_PLATFORM := $(call get,$(_map),APP_PLATFORM)
-
# The ABI(s) to use
NDK_APP_ABI := $(subst $(comma),$(space),$(strip $(NDK_APP_ABI)))
ifndef NDK_APP_ABI
diff --git a/build/core/setup-toolchain.mk b/build/core/setup-toolchain.mk
index 7c058ba55..6973dd4d3 100644
--- a/build/core/setup-toolchain.mk
+++ b/build/core/setup-toolchain.mk
@@ -17,7 +17,7 @@
# to setup the target toolchain for a given platform/abi combination.
#
-$(call assert-defined,TARGET_PLATFORM TARGET_ARCH TARGET_ARCH_ABI)
+$(call assert-defined,TARGET_PLATFORM_LEVEL TARGET_ARCH TARGET_ARCH_ABI)
$(call assert-defined,NDK_APPS NDK_APP_STL)
# Check that we have a toolchain that supports the current ABI.
@@ -61,8 +61,6 @@ else # NDK_TOOLCHAIN is not empty
TARGET_TOOLCHAIN := $(NDK_TOOLCHAIN)
endif # NDK_TOOLCHAIN is not empty
-TARGET_ABI := $(TARGET_PLATFORM)-$(TARGET_ARCH_ABI)
-
TARGET_PREBUILT_SHARED_LIBRARIES :=
# Define default values for TOOLCHAIN_NAME, this can be overriden in
diff --git a/docs/changelogs/Changelog-r21.md b/docs/changelogs/Changelog-r21.md
index d41aced5b..69e6b2221 100644
--- a/docs/changelogs/Changelog-r21.md
+++ b/docs/changelogs/Changelog-r21.md
@@ -62,8 +62,11 @@ For Android Studio issues, follow the docs on the [Android Studio site].
debugging. The error from gdb that confirms you were affected by this was
`gdb-8.3/gdb/psymtab.c:316: internal-error: sect_index_text not initialized`.
* [Issue 1166]: Rehid unwinder symbols all architectures.
+ * [Issue 1201]: Fixed issue in ndk-build that was causing `APP_PLATFORM` to be
+ corrupted for API 30+ with LP64 ABIs.
[Issue 1166]: https://github.com/android/ndk/issues/1166
+[Issue 1201]: https://github.com/android/ndk/issues/1201
## Changes