fix SSL stack and Android JAR resource loading

This commit is contained in:
Joel Dice 2014-08-22 07:05:58 -06:00
parent b96cc3c575
commit 7f4c0b3118
6 changed files with 45 additions and 5 deletions

View File

@ -396,6 +396,11 @@ the following, starting from the Avian directory:
(cd external/zlib && \
git checkout 15b6223aa57a347ce113729253802cb2fdeb4ad0)
git clone https://android.googlesource.com/platform/external/conscrypt \
external/conscrypt
(cd external/conscrypt && \
git checkout 076138ff29d805ec5a32d6ad96a18ef08c7f1b11)
git clone git://git.openssl.org/openssl.git openssl-upstream
(cd openssl-upstream && git checkout OpenSSL_1_0_1h)

View File

@ -529,7 +529,9 @@ public final class Class <T>
}
public URL getResource(String path) {
if (! path.startsWith("/")) {
if (path.startsWith("/")) {
path = path.substring(1);
} else {
String name = Classes.makeString
(vmClass.name, 0, vmClass.name.length - 1);
int index = name.lastIndexOf('/');

View File

@ -226,6 +226,7 @@ ifneq ($(android),)
-I$(android)/external/icu4c/common \
-I$(android)/external/expat \
-I$(android)/external/openssl/include \
-I$(android)/external/openssl \
-I$(android)/libcore/include \
-I$(build)/android-src/external/fdlibm \
-I$(build)/android-src \
@ -236,6 +237,7 @@ ifneq ($(android),)
-D__DARWIN_UNIX03=1 \
-D__PROVIDE_FIXMES \
-DHAVE_OFF64_T \
-DSTATIC_LIB \
-g3 \
-Werror
@ -251,6 +253,9 @@ ifneq ($(android),)
libnativehelper-cpps := $(libnativehelper-native)/JniConstants.cpp \
$(libnativehelper-native)/toStringArray.cpp
crypto-native := $(android)/external/conscrypt/src/main/native
crypto-cpps := $(crypto-native)/org_conscrypt_NativeCrypto.cpp
ifeq ($(platform),windows)
android-cflags += -D__STDC_CONSTANT_MACROS -DHAVE_WIN32_FILEMAP
blacklist = $(luni-native)/java_io_Console.cpp \
@ -274,8 +279,8 @@ ifneq ($(android),)
$(icu-libs) \
$(android)/external/fdlibm/libfdm.a \
$(android)/external/expat/.libs/libexpat.a \
$(android)/openssl-upstream/libcrypto.a \
$(android)/openssl-upstream/libssl.a \
$(android)/openssl-upstream/libcrypto.a \
$(platform-lflags) \
-lstdc++
@ -285,6 +290,7 @@ ifneq ($(android),)
classpath-objects = \
$(call cpp-objects,$(luni-cpps),$(luni-native),$(build)) \
$(call cpp-objects,$(crypto-cpps),$(crypto-native),$(build)) \
$(call cpp-objects,$(libnativehelper-cpps),$(libnativehelper-native),$(build)) \
$(call cc-objects,$(libziparchive-ccs),$(libziparchive-native),$(build)) \
$(call cpp-objects,$(libutils-cpps),$(libutils-native),$(build))
@ -299,6 +305,12 @@ ifneq ($(android),)
luni-nonjavas := $(shell find $(luni-java) -not -type d -not -name '*.java')
luni-copied-nonjavas = $(call noop-files,$(luni-nonjavas),$(luni-java),)
crypto-java = $(android)/external/conscrypt/src/main/java
crypto-javas := $(shell find $(crypto-java) -name '*.java')
crypto-platform-java = $(android)/external/conscrypt/src/platform/java
crypto-platform-javas := $(shell find $(crypto-platform-java) -name '*.java')
dalvik-java = $(android)/libcore/dalvik/src/main/java
dalvik-javas := \
$(dalvik-java)/dalvik/system/DalvikLogHandler.java \
@ -323,6 +335,8 @@ ifneq ($(android),)
xml-javas := $(shell find $(xml-java) -name '*.java')
android-classes = \
$(call java-classes,$(luni-javas),$(luni-java),$(build)/android) \
$(call java-classes,$(crypto-javas),$(crypto-java),$(build)/android) \
$(call java-classes,$(crypto-platform-javas),$(crypto-platform-java),$(build)/android) \
$(call java-classes,$(dalvik-javas),$(dalvik-java),$(build)/android) \
$(call java-classes,$(libart-javas),$(libart-java),$(build)/android) \
$(call java-classes,$(xml-javas),$(xml-java),$(build)/android)
@ -1624,6 +1638,9 @@ $(build)/android-src/%.cpp: $(luni-native)/%.cpp
$(build)/android-src/%.cpp: $(libnativehelper-native)/%.cpp
cp $(<) $(@)
$(build)/android-src/%.cpp: $(crypto-native)/%.cpp
cp $(<) $(@)
$(build)/android-src/%.cpp: $(libziparchive-native)/%.cc
cp $(<) $(@)
@ -1637,7 +1654,7 @@ $(build)/%.o: $(build)/android-src/%.cpp $(build)/android.dep
$$($(windows-path) $(<)) $(call output,$(@))
$(build)/android.dep: $(luni-javas) $(dalvik-javas) $(libart-javas) \
$(xml-javas) $(luni-nonjavas)
$(xml-javas) $(luni-nonjavas) $(crypto-javas) $(crypto-platform-javas)
@echo "compiling luni classes"
@mkdir -p $(classpath-build)
@mkdir -p $(build)/android
@ -1653,6 +1670,12 @@ $(build)/android.dep: $(luni-javas) $(dalvik-javas) $(libart-javas) \
(cd $(libart-java) && \
jar c $(call noop-files,$(libart-javas),$(libart-java),.)) \
| (cd $(build)/android-src && jar x)
(cd $(crypto-java) && \
jar c $(call noop-files,$(crypto-javas),$(crypto-java),.)) \
| (cd $(build)/android-src && jar x)
(cd $(crypto-platform-java) && \
jar c $(call noop-files,$(crypto-platform-javas),$(crypto-platform-java),.)) \
| (cd $(build)/android-src && jar x)
(cd $(classpath-src) && \
jar c $(call noop-files,$(classpath-sources),$(classpath-src),.)) \
| (cd $(build)/android-src && jar x)

View File

@ -15,3 +15,10 @@ void JniConstants::init(_JNIEnv*)
{
// ignore
}
struct _JavaVM;
int libconscrypt_JNI_OnLoad(_JavaVM*, void*)
{
return 0;
}

View File

@ -9,6 +9,7 @@
details. */
struct JavaVM;
struct _JavaVM;
struct _JNIEnv;
struct JniConstants {
@ -17,6 +18,8 @@ struct JniConstants {
extern "C" int JNI_OnLoad(JavaVM*, void*);
int libconscrypt_JNI_OnLoad(_JavaVM*, void*);
#define _POSIX_C_SOURCE 200112L
#undef _GNU_SOURCE
#include "avian/machine.h"
@ -393,6 +396,8 @@ class MyClasspath : public Classpath {
JNI_OnLoad(reinterpret_cast< ::JavaVM*>(t->m), 0);
libconscrypt_JNI_OnLoad(reinterpret_cast< ::_JavaVM*>(t->m), 0);
mayInitClasses_ = true;
}

View File

@ -5665,8 +5665,6 @@ void runFinalizeThread(Thread* t)
GcCleaner* cleanList = 0;
PROTECT(t, cleanList);
fprintf(stderr, "run finalize thread!\n");
while (true) {
{
ACQUIRE(t, t->m->stateLock);