[all-commits] [llvm/llvm-project] 740ac4: Reland "[ObjectYAML][ELF] Take alignment into acco...

Igor Kudrin via All-commits all-commits at lists.llvm.org
Wed Dec 4 18:56:20 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 740ac4f0ffbab304e3f74ce8d1d0505479d0f800
      https://github.com/llvm/llvm-project/commit/740ac4f0ffbab304e3f74ce8d1d0505479d0f800
  Author: Igor Kudrin <ikudrin at accesssoftek.com>
  Date:   2024-12-04 (Wed, 04 Dec 2024)

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

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

This relands #118157 with a fix for the use of an uninitialized
variable and additional tests.

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
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