-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from jblazquez/master
Add support for ordering object files during merge
- Loading branch information
Showing
8 changed files
with
88 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,9 +31,10 @@ FLAGS: | |
-v, --verbose Print verbose information | ||
OPTIONS: | ||
-k, --keep-symbols <keep-symbols>... Accepts regexes of the symbol names to keep global, and localizes the rest | ||
-r, --remove-symbols <remove-symbols>... Accepts regexes of the symbol names to hide, and keep the rest global | ||
-o, --output <output> Output static library | ||
-k, --keep-symbols <keep-symbols>... Accepts regexes of the symbol names to keep global, and localizes the rest | ||
--order-file <order-file> Order file to control the sorting of merged objects | ||
-o, --output <output> Output static library | ||
-r, --remove-symbols <remove-symbols>... Accepts regexes of the symbol names to hide, and keep the rest global | ||
ARGS: | ||
<INPUTS>... Static libraries to merge | ||
|
@@ -54,6 +55,24 @@ You may specify a different objcopy implementation with the `OBJCOPY` env var, a | |
You can use armerge to handle Linux/Android archives on a macOS host if the right toolchain is installed. | ||
(i.e. you may need to set `LD`, `OBJCOPY`, and `RANLIB` to point to the Android NDK, or to some other toolchain). | ||
|
||
## Object merge order | ||
|
||
By default, objects are passed to the linker in an unspecified order. Linkers typically lay out the output file's sections in the order the inputs are specified. | ||
|
||
If you want to control the order in which some of the object files are merged, you can use the `--order-file` option. With this option, you can specify an order file that controls the relative order in which armerge passes the listed object files to the linker, so you can precisely control the order in which certain sections will be laid out in the output. | ||
|
||
The order file is a plain text file with one entry per line, in the format `{INPUT_LIB}@{OBJNAME}`, where `INPUT_LIB` is the name of the input library and `OBJNAME` is the name of the object file to select from that library. Blank lines or lines starting with the `#` sign are ignored. Any object files not listed are placed after all of the listed objects in an unspecified order. For example: | ||
|
||
``` | ||
# Place the custom malloc object file first | ||
[email protected] | ||
# Place the app's entry point next | ||
[email protected] | ||
# All other object files are placed after this in an unspecified order. | ||
``` | ||
|
||
## Principle of operation | ||
|
||
### Merging static libraries | ||
|
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
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