import android.view.Surface;
import org.chromium.base.CalledByNative;
+import org.chromium.base.CommandLine;
import org.chromium.base.JNINamespace;
import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.library_loader.Linker;
public void run() {
try {
boolean useLinker = Linker.isUsed();
-
+ boolean requestedSharedRelro = false;
if (useLinker) {
synchronized (mMainThread) {
while (!mIsBound) {
}
}
if (mLinkerParams != null) {
- if (mLinkerParams.mWaitForSharedRelro)
+ if (mLinkerParams.mWaitForSharedRelro) {
+ requestedSharedRelro = true;
Linker.initServiceProcess(mLinkerParams.mBaseLoadAddress);
- else
+ } else {
Linker.disableSharedRelros();
-
+ }
Linker.setTestRunnerClassName(mLinkerParams.mTestRunnerClassName);
}
}
+ boolean isLoaded = false;
+ synchronized (mMainThread) {
+ while (mCommandLineParams == null) {
+ mMainThread.wait();
+ }
+ }
+ CommandLine.init(mCommandLineParams);
try {
LibraryLoader.loadNow(getApplicationContext(), false);
+ isLoaded = true;
} catch (ProcessInitException e) {
- Log.e(TAG, "Failed to load native library, exiting child process", e);
- System.exit(-1);
+ if (requestedSharedRelro) {
+ Log.w(TAG, "Failed to load native library with shared RELRO, " +
+ "retrying without");
+ } else {
+ Log.e(TAG, "Failed to load native library", e);
+ }
}
- synchronized (mMainThread) {
- while (mCommandLineParams == null) {
- mMainThread.wait();
+ if (!isLoaded && requestedSharedRelro) {
+ Linker.disableSharedRelros();
+ try {
+ LibraryLoader.loadNow(getApplicationContext(), false);
+ isLoaded = true;
+ } catch (ProcessInitException e) {
+ Log.e(TAG, "Failed to load native library on retry", e);
}
}
- LibraryLoader.initialize(mCommandLineParams);
+ if (!isLoaded) {
+ System.exit(-1);
+ }
+ LibraryLoader.initialize();
synchronized (mMainThread) {
mLibraryInitialized = true;
mMainThread.notifyAll();