ghc-9.15: The GHC API
Safe HaskellNone
LanguageGHC2024

GHC.CmmToAsm.Ppr

Synopsis

Documentation

doubleToBytes :: Double -> [Word8] Source #

Get bytes of a Double representation

floatToBytes :: Float -> [Word8] Source #

Get bytes of a Float representation

pprASCII :: IsLine doc => ByteString -> doc Source #

pprString :: IsLine doc => ByteString -> doc Source #

Emit a ".string" directive

pprFileEmbed :: IsLine doc => FilePath -> doc Source #

Emit a ".incbin" directive

A NULL byte is added after the binary data.

pprCOFFComdatKey :: IsLine doc => Platform -> CLabel -> doc Source #

Note [Split sections on COFF objects] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Windows/COFF, LLD's gc-sections only works on COMDAT sections, so we mark split sections as COMDAT and need to provide a unique "key" symbol.

Important: We must not use a dot-prefixed local label (e.g. .L...) as the COMDAT key symbol, because LLVM's COFF assembler treats dot-prefixed COMDAT key symbols specially and forces them to have value 0 (the beginning of the section). That breaks tablesNextToCode, where the info label is intentionally placed after the info table data (at a non-zero offset).

Therefore we generate a non-dot-prefixed key symbol derived from the section suffix, and (see arch-specific pprSectionAlign) we emit a label definition for it at the beginning of the section.

ctor/dtor sections are specially treated; they must be emitted as regular data sections, otherwise LLD will drop them.

Note that we must not emit .equiv directives for COMDAT sections in COFF objects, they seriously confuse LLD and we end up with access violations at runtimes.