About the armlink behavior when the linked object is not explicitly used by the main executable
Emily Wong
I want to link the example with liba.so, even though the example is NOT using anything inside the liba.so:
armlink --userlibpath /mylib/lib liba.so --fpic --shared -o example main.o demo.oI get nothing from readelf -d example | grep NEEDED, it seems that armlink does some optimization to remove the linked library which is referenced by the "example".
If I want the liba.so be always linked into example, what need I do with armlink options?
Any information is very appreciated ;)
21 Answer
7 years ago, well, anyway. You need --keep armlink option
--keep This option specifies input sections that must not be removed by unused section elimination.