summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.mk4
-rw-r--r--build/Android.bp9
-rw-r--r--build/art.go5
-rw-r--r--libartbase/Android.bp5
-rw-r--r--libartbase/base/memfd.cc6
-rw-r--r--libartbase/base/memfd.h3
6 files changed, 18 insertions, 14 deletions
diff --git a/Android.mk b/Android.mk
index d4de2e5a18..c31d598fd4 100644
--- a/Android.mk
+++ b/Android.mk
@@ -293,7 +293,7 @@ include $(CLEAR_VARS)
#
# The ART APEX module (`com.android.art`) is an "alias" for either the
# release or the debug module. By default, "user" build variants contain
-# the release module, while "userdebug" and "eng" build variants contain
+# the release module, while "eng" build variants contain
# the debug module. However, if `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD`
# is defined, it overrides the previous logic:
# - if `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD` is set to `false`, the
@@ -304,7 +304,7 @@ include $(CLEAR_VARS)
art_target_include_debug_build := $(PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD)
ifneq (false,$(art_target_include_debug_build))
- ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
+ ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT)))
art_target_include_debug_build := true
endif
endif
diff --git a/build/Android.bp b/build/Android.bp
index 946e5a60e9..6329785818 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -178,15 +178,6 @@ art_global_defaults {
// Bug: 15446488. We don't omit the frame pointer to work around
// clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress.
"-fno-omit-frame-pointer",
- // The build assumes that all our x86/x86_64 hosts (such as buildbots and developer
- // desktops) support at least sse4.2/popcount. This firstly implies that the ART
- // runtime binary itself may exploit these features. Secondly, this implies that
- // the ART runtime passes these feature flags to dex2oat and JIT by calling the
- // method InstructionSetFeatures::FromCppDefines(). Since invoking dex2oat directly
- // does not pick up these flags, cross-compiling from a x86/x86_64 host to a
- // x86/x86_64 target should not be affected.
- "-msse4.2",
- "-mpopcnt",
],
},
},
diff --git a/build/art.go b/build/art.go
index 5a09be0283..bf3e48847b 100644
--- a/build/art.go
+++ b/build/art.go
@@ -169,6 +169,11 @@ func hostFlags(ctx android.LoadHookContext) []string {
cflags = append(cflags, "-DART_ENABLE_ADDRESS_SANITIZER=1")
}
+ if !ctx.Config().IsEnvFalse("CPU_SSE42") {
+ cflags = append(cflags, "-msse4.2")
+ cflags = append(cflags, "-mpopcnt")
+ }
+
return cflags
}
diff --git a/libartbase/Android.bp b/libartbase/Android.bp
index a9d5db27d5..cb2ff6af0e 100644
--- a/libartbase/Android.bp
+++ b/libartbase/Android.bp
@@ -16,7 +16,10 @@
cc_defaults {
name: "libartbase_defaults",
- defaults: ["art_defaults"],
+ defaults: [
+ "art_defaults",
+ "has_memfd_backport_defaults",
+ ],
host_supported: true,
srcs: [
"arch/instruction_set.cc",
diff --git a/libartbase/base/memfd.cc b/libartbase/base/memfd.cc
index 8512a3ae13..84cc66d5f2 100644
--- a/libartbase/base/memfd.cc
+++ b/libartbase/base/memfd.cc
@@ -17,11 +17,15 @@
#include "memfd.h"
#include <errno.h>
+#if !defined(HAS_MEMFD_BACKPORT)
#include <stdio.h>
+#endif
#if !defined(_WIN32)
#include <fcntl.h>
#include <sys/syscall.h>
+#if !defined(HAS_MEMFD_BACKPORT)
#include <sys/utsname.h>
+#endif
#include <unistd.h>
#endif
#if defined(__BIONIC__)
@@ -49,6 +53,7 @@ namespace art {
#if defined(__NR_memfd_create)
int memfd_create(const char* name, unsigned int flags) {
+#if !defined(HAS_MEMFD_BACKPORT)
// Check kernel version supports memfd_create(). Some older kernels segfault executing
// memfd_create() rather than returning ENOSYS (b/116769556).
static constexpr int kRequiredMajor = 3;
@@ -62,6 +67,7 @@ int memfd_create(const char* name, unsigned int flags) {
errno = ENOSYS;
return -1;
}
+#endif
return syscall(__NR_memfd_create, name, flags);
}
diff --git a/libartbase/base/memfd.h b/libartbase/base/memfd.h
index 0bb336d45a..17019ba264 100644
--- a/libartbase/base/memfd.h
+++ b/libartbase/base/memfd.h
@@ -61,8 +61,7 @@
namespace art {
-// Call memfd(2) if available on platform and return result. This call also makes a kernel version
-// check for safety on older kernels (b/116769556)..
+ // Call memfd(2) if available on platform and return result.
int memfd_create(const char* name, unsigned int flags);
// Call memfd(2) if available on platform and return result. Try to give us an unlinked FD in some