This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Older versions of Android have a limit on how many DSOs they can load into one process. To work around this limit, it can be helpful to merge multiple libraries together based on a per-app configuration. This completes NativeLibraryMergeEnhancer to actually perform the merging. Test Plan: Added integration tests. Tested a few real merges with Facebook for Android. Reviewed By: andrewjcg fbshipit-source-id: 7511741
- Loading branch information
Showing
15 changed files
with
582 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
490 changes: 478 additions & 12 deletions
490
src/com/facebook/buck/android/NativeLibraryMergeEnhancer.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[ndk] | ||
#cpu_abis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
test/com/facebook/buck/android/testdata/android_project/native/merge/C.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
void D(); | ||
void static_func_C(); | ||
void prebuilt_func_C(); | ||
void C() { | ||
D(); | ||
static_func_C(); | ||
prebuilt_func_C(); | ||
} |
7 changes: 6 additions & 1 deletion
7
test/com/facebook/buck/android/testdata/android_project/native/merge/F.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
void F(){} | ||
void static_func_F(); | ||
void prebuilt_func_F(); | ||
void F() { | ||
static_func_F(); | ||
prebuilt_func_F(); | ||
} |
1 change: 1 addition & 0 deletions
1
test/com/facebook/buck/android/testdata/android_project/native/merge/prebuilt_for_C.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
void prebuilt_func_C(){} |
Binary file added
BIN
+5.01 KB
...oid/testdata/android_project/native/merge/prebuilt_for_C/android-x86/libprebuilt_for_C.so
Binary file not shown.
1 change: 1 addition & 0 deletions
1
test/com/facebook/buck/android/testdata/android_project/native/merge/prebuilt_for_F.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
void prebuilt_func_F(){} |
Binary file added
BIN
+5.01 KB
...oid/testdata/android_project/native/merge/prebuilt_for_F/android-x86/libprebuilt_for_F.so
Binary file not shown.
1 change: 1 addition & 0 deletions
1
test/com/facebook/buck/android/testdata/android_project/native/merge/static_for_C.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
void static_func_C(){} |
1 change: 1 addition & 0 deletions
1
test/com/facebook/buck/android/testdata/android_project/native/merge/static_for_F.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
void static_func_F(){} |
7b7bc87
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dreiss Did you observe any runtime performance improvements and net shared library size gains by merging together libraries?
Ideally, the combined library should load faster as compared to loading all the individual libraries separately, because of reduced load time overhead of resolving undefined symbols.
Also, doing this, the net count of defined and undefined symbols should reduce, thereby reducing the symbols table size and should reduce the net disk size of libraries.
7b7bc87
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Size was reduced. We were not able to measure any statistically significant change in performance.