[all-commits] [llvm/llvm-project] 172418: [ObjectYAML][ELF] Take alignment into account when...

Igor Kudrin via All-commits all-commits at lists.llvm.org
Mon Dec 2 17:59:09 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1724188c19f363c877fcf1bca86d92af3864b338
      https://github.com/llvm/llvm-project/commit/1724188c19f363c877fcf1bca86d92af3864b338
  Author: Igor Kudrin <ikudrin at accesssoftek.com>
  Date:   2024-12-02 (Mon, 02 Dec 2024)

  Changed paths:
    M llvm/lib/ObjectYAML/ELFEmitter.cpp
    M llvm/test/tools/yaml2obj/ELF/note-section.yaml

  Log Message:
  -----------
  [ObjectYAML][ELF] Take alignment into account when generating notes (#118157)

The [System V ABI](https://www.sco.com/developers/gabi/latest/ch5.pheader.html#note_section)
states that the note entries and their descriptor fields must be aligned
to 4 or 8 bytes for 32-bit or 64-bit objects respectively. In practice,
64-bit systems can use both alignments, with the actual format being
determined by the alignment of the segment. For example, the
[Linux gABI extension](https://github.com/hjl-tools/linux-abi/wiki/linux-abi-draft.pdf)
contains a special note on this, see 2.1.7 "Alignment of Note Sections".

This patch adjusts the format of the generated notes to the specified
section alignment. Since `llvm-readobj` was fixed in a similar way in
[D150022](https://reviews.llvm.org/D150022), "[Object] Fix handling of
Elf_Nhdr with sh_addralign=8", the generated notes can now be parsed
successfully by the tool.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list