Sun Studio 12: C++ User's Guide

A.2.53.1 Interactions

When using #pragma pack on a SPARC platform to pack denser than the type’s default alignment, the -misalign option must be specified for both the compilation and the linking of the application.

Misaligned data is handled by a trap mechanism that is provided by ld at runtime. If an optimization flag (-xO{1|2|3|4|5} or an equivalent flag) is used with the -misalign option, the additional instructions required for alignment of misaligned data are inserted into the resulting object file and will not generate runtime misalignment traps.

Warnings

If possible, do not link aligned and misaligned parts of the program.

If compilation and linking are performed in separate steps, the –misalign option must appear in both the compile and link commands.