When generating a shared library, ld will by default generate import stubs suitable for use with a single sub-space application. The ‘ --multi-subspace ’ switch causes ld to generate export stubs, and different (larger) import stubs suitable for use with multiple sub-spaces.
Long branch stubs and import/export stubs are placed by ld in stub sections located between groups of input sections. ‘ --stub-group-size ’ specifies the maximum size of a group of input sections handled by one stub section. Since branch offsets are signed, a stub section may serve two groups of input sections, one group before the stub section, and one group after it. However, when using conditional branches that require stubs, it may be better (for branch prediction) that stub sections only serve one group of input sections. A negative value for ‘ N ’ chooses this scheme, ensuring that branches to stubs always use a negative offset. Two special values of ‘ N ’ are recognized, ‘ 1 ’ and ‘ -1 ’. These both instruct ld to automatically size input section groups for the branch types detected, with the same behaviour regarding stub placement as other positive or negative values of ‘ N ’ respectively.
Note that ‘ --stub-group-size ’ does not split input sections. A single input section larger than the group size specified will of course create a larger group (of one section). If input sections are too large, it may not be possible for a branch to reach its stub.