Linker and Libraries Guide

Section Merging

The SHF_MERGE section flag can be used to mark SHT_PROGBITS sections within relocatable objects. See Table 7–8. This flag indicates that the section can be merged with compatible sections from other objects. Such merging has the potential to reduce the size of any executable or shared object that is built from these relocatable objects. This size reduction can also have a positive effect on the runtime performance of the resulting object.

A SHF_MERGE flagged section indicates that the section adheres to the following characteristics.

SHF_MERGE is an optional flag indicating a possible optimization. The link-editor is allowed to perform the optimization, or to ignore the optimization. The link-editor creates a valid output object in either case. The link-editor presently implements section merging only for sections containing string data marked with the SHF_STRINGS flag.

When the SHF_STRINGS section flag is set in conjunction with the SHF_MERGE flag, the strings in the section are available to be merged with strings from other compatible sections. The link-editor merges such sections using the same string compression algorithm as used to compress the SHT_STRTAB string tables, .strtab and .dynstr.

The link-editor currently implements string merging only for strings that consist of byte sized characters that do not have special alignment constraints. Specifically, the following section characteristics are required.


Note –

Any string table compression can be suppressed with the link-editors -z nocompstrtab option.