ghc-lib-8.8.1.20191204: The GHC API, decoupled from GHC versions

Safe HaskellNone
LanguageHaskell2010

Elf

Synopsis

Documentation

readElfSectionByName :: DynFlags -> ByteString -> String -> IO (Maybe ByteString) Source #

Given a section name, read its contents as a ByteString.

If the section isn't found or if there is any parsing error, we return Nothing

readElfNoteAsString :: DynFlags -> FilePath -> String -> String -> IO (Maybe String) Source #

read a Note as a String

If you try to read a note from a section which does not support the Note format, the parsing is likely to fail and Nothing will be returned

makeElfNote :: String -> String -> Word32 -> String -> SDoc Source #

Generate the GAS code to create a Note section

Header fields for notes are 32-bit long (see Note [ELF specification]).

It seems there is no easy way to force GNU AS to generate a 32-bit word in every case. Hence we use .int directive to create them: however "The byte order and bit size of the number depends on what kind of target the assembly is for." (https:/sourceware.orgbinutilsdocsas/Int.html#Int)

If we add new target platforms, we need to check that the generated words are 32-bit long, otherwise we need to use platform specific directives to force 32-bit .int in asWord32.