unsupported , ˆl—Ðz¾”ªe¶…6 ¸Ë7mLZ7ÿÀ ƒ}±;_‡I|¥ŠèªÅÄ%7 # copyright : Copyright (c) 2017-2024 Red Hat # license : GNU GFDL v1.3; see accompanying LICENSE file. Storing Build Time Information In ELF Binary Files In a Format Suitable for Static Analysis A specification by Nick Clifton. Version 3.0. Dec 20, 2017. ChangeLog: For v3.0: Add end-of-range addresses to description field, to allow for gaps in the coverage. For v2.0: Added an "owner" string at the start of the name field so that naive processors of Elf Notes are less likely to complain. ---------------------------------------------------------------------- * The information is stored in a new section in the file using the ELF NOTE format. This format is already well defined, and supported by binary tools. Creator tools (compilers, assemblers) place the notes into the binary files. Consumer tools (readelf, built-by) read the notes and answer questions about the binaries concerned. Processing tools (linker, objcopy) combine and merge the notes as needed. Note - this specification could have used the gnu_attributes format instead, but this has a few drawbacks: - Support for section and symbol tagged gnu_attributes is not currently implemented anywhere, and these features are needed. Adding support for them to the binutils would mean that the specification is not backwards compatible with older tools. * The gnu attributes specification requires that when merging attributes from multiple input files the tool performing the merge must create new, section-relative attributes where conflicts occur. Similarly conflicts between section-relative attributes must be resolved by the creation of new symbol-relative attributes. Adding support for this requirement would have again introduced a barrier to backwards compatiblity, and would also result in the attribute section being larger than an equivalent section using this proposal. * The information is stored in a new section called .gnu.build.attributes. (The name can be changed - it is basically irrelevant anyway, it is the new section flag (defined below) that matters). The section has the type SHT_NOTE. The section has a new flag set: SHF_GNU_BUILD_ATTRIBUTES (suggested value: 0x00100000). The sh_link and sh_info fields of this section should be set to 0. The sh_align field should be set to 4, even on 64-bit systems. This does mean that 8-byte values inside the notes might have to be relocated using unaligned relocs, and that they might have to be read and written using unaligned loads and stores. * The type field of a note is used to distinguish the range of memory over which an attribute applies. The name field identifies the attribute and gives it a value. The description field specifies the starting and ending addresses for where the attribute is applied. Two new note types are defined: NT_GNU_BUILD_ATTRIBUTE_OPEN (0x100) and NT_GNU_BUILD_ATTRIBUTE_FUNC (0x101). These are used by the description field (see below). The description field of the note is either 0-bytes long, or else a pair of 4-byte wide (for 32-bit targets) or 8-byte wide (for 64-bit targets) addresses which indicate the starting and ending location for the attribute. If the description field is empty, the note should be treated as if it applies to the same region as the nearest preceeding note of the same type (ie either OPEN or FUNC). In unrelocated files the addresses should instead be zero, with a relocation present to set the actual value once the file is linked. The numbers are stored in the same endian format as that specified in the EI_DATA field of the ELF header of the file containing the note. The size of the numbers is dictated by the EI_CLASS field of the ELF header. The name field identifies the type and value of the attribute. The name starts with the string "GA", which is an abbreviation for GNU Attribute. The abbreviati