In addition to the types allowed with .linkonce, .section also accepts
associative. The meaning is that the section is linked if a certain other
COMDAT section is linked. This other section is indicated by the comdat symbol
in this directive. It can be any symbol defined in the associated section, but
is usually the associated section’s comdat.

The following restrictions apply to the associated section:

It must be a COMDAT section.

It cannot be another associative COMDAT section.

In the following example the symobl sym is the comdat symbol of .foo
and .bar is associated to .foo.

.section.foo,"bw",discard,"sym".section.bar,"rd",associative,"sym"

MC supports these flags in the COFF .section directive:

b: BSS section (IMAGE_SCN_CNT_INITIALIZED_DATA)

d: Data section (IMAGE_SCN_CNT_UNINITIALIZED_DATA)

n: Section is not loaded (IMAGE_SCN_LNK_REMOVE)

r: Read-only

s: Shared section

w: Writable

x: Executable section

y: Not readable

D: Discardable (IMAGE_SCN_MEM_DISCARDABLE)

These flags are all compatible with gas, with the exception of the D flag,
which gnu as does not support. For gas compatibility, sections with a name
starting with ”.debug” are implicitly discardable.

In order to support creating multiple sections with the same name and comdat,
it is possible to add an unique number at the end of the .seciton directive.
For example, the following code creates two sections named .text.

However, this has the limitation of 32 MiB (±16MiB). In order to accommodate
larger binaries, LLVM supports the use of -mcode-model=large to allow a 4GiB
range via a slight deviation. It will generate an indirect jump as follows:

The Windows ARM Itanium ABI extends the base ABI by adding support for emitting
a dynamic stack allocation. When emitting a variable stack allocation, a call
to __chkstk is emitted unconditionally to ensure that guard pages are setup
properly. The emission of this stack probe emission is handled similar to the
standard stack probe emission.