Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: base/android/java/src/org/chromium/base/library_loader/Linker.java

Issue 2406083002: Crazylinker: remove the code to load component build library (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.base.library_loader; 5 package org.chromium.base.library_loader;
6 6
7 import android.os.Build; 7 import android.os.Build;
8 import android.os.Bundle; 8 import android.os.Bundle;
9 import android.os.Parcel; 9 import android.os.Parcel;
10 import android.os.ParcelFileDescriptor; 10 import android.os.ParcelFileDescriptor;
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 public boolean isChromiumLinkerLibrary(String library) { 512 public boolean isChromiumLinkerLibrary(String library) {
513 return library.equals(LINKER_JNI_LIBRARY) || library.equals(LINKER_JNI_L IBRARY + ".cr"); 513 return library.equals(LINKER_JNI_LIBRARY) || library.equals(LINKER_JNI_L IBRARY + ".cr");
514 } 514 }
515 515
516 /** 516 /**
517 * Load the Linker JNI library. Throws UnsatisfiedLinkError on error. 517 * Load the Linker JNI library. Throws UnsatisfiedLinkError on error.
518 * In a component build, the suffix ".cr" is added to each library name, so 518 * In a component build, the suffix ".cr" is added to each library name, so
519 * if the initial load fails we retry with a suffix. 519 * if the initial load fails we retry with a suffix.
520 */ 520 */
521 protected static void loadLinkerJniLibrary() { 521 protected static void loadLinkerJniLibrary() {
522 // Fallback on component build doesn't work for the most devices which
523 // have chrome preinstalled because libchromium_android_linker.so could
524 // already be in system lib path, and you will never get exception,
525 // instead, load wrong library.
522 String libName = "lib" + LINKER_JNI_LIBRARY + ".so"; 526 String libName = "lib" + LINKER_JNI_LIBRARY + ".so";
523 if (DEBUG) { 527 if (DEBUG) {
524 Log.i(TAG, "Loading " + libName); 528 Log.i(TAG, "Loading " + libName);
525 } 529 }
526 try { 530 try {
527 System.loadLibrary(LINKER_JNI_LIBRARY); 531 System.loadLibrary(LINKER_JNI_LIBRARY);
528 } catch (UnsatisfiedLinkError e) { 532 } catch (UnsatisfiedLinkError e) {
529 Log.w(TAG, "Couldn't load " + libName + ", trying " + libName + ".cr "); 533 Log.w(TAG, "Couldn't load " + libName + ", trying " + libName + ".cr ");
530 System.loadLibrary(LINKER_JNI_LIBRARY + ".cr"); 534 System.loadLibrary(LINKER_JNI_LIBRARY + ".cr");
michaelbai 2016/10/11 18:26:37 If you don't think crazy linker will support compo
531 } 535 }
532 } 536 }
533 537
534 /** 538 /**
535 * Obtain a random base load address at which to place loaded libraries. 539 * Obtain a random base load address at which to place loaded libraries.
536 * 540 *
537 * @return new base load address 541 * @return new base load address
538 */ 542 */
539 protected long getRandomBaseLoadAddress() { 543 protected long getRandomBaseLoadAddress() {
540 // nativeGetRandomBaseLoadAddress() returns an address at which it has p reviously 544 // nativeGetRandomBaseLoadAddress() returns an address at which it has p reviously
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 * Return a random address that should be free to be mapped with the given s ize. 828 * Return a random address that should be free to be mapped with the given s ize.
825 * Maps an area large enough for the largest library we might attempt to loa d, 829 * Maps an area large enough for the largest library we might attempt to loa d,
826 * and if successful then unmaps it and returns the address of the area allo cated 830 * and if successful then unmaps it and returns the address of the area allo cated
827 * by the system (with ASLR). The idea is that this area should remain free of 831 * by the system (with ASLR). The idea is that this area should remain free of
828 * other mappings until we map our library into it. 832 * other mappings until we map our library into it.
829 * 833 *
830 * @return address to pass to future mmap, or 0 on error. 834 * @return address to pass to future mmap, or 0 on error.
831 */ 835 */
832 private static native long nativeGetRandomBaseLoadAddress(); 836 private static native long nativeGetRandomBaseLoadAddress();
833 } 837 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698