[PATCH] D68983: [yaml2obj, obj2yaml] - Add support for SHT_NOTE sections.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 01:57:05 PDT 2019


grimar added a comment.

In D68983#1710544 <https://reviews.llvm.org/D68983#1710544>, @MaskRay wrote:

> There is an official reference: http://www.sco.com/developers/gabi/latest/ch5.pheader.html#note_section


Thanks!

> When operating systems implemented the 64-bit ELF ABI, many (including Linux, FreeBSD, and NetBSD) interpreted the gABI wording incorrectly and chose 32-bit struct members for Elf64_Nhdr. A few (including Solaris) are correct and use 64-bit members. This inconsistency should not affect this patch, but I just want to mention the problem.

Interesting. I guess if we wanted to support it, we would probably be able to check OSABI:

  --- !ELF
  FileHeader:
  ...
  OSABI = Solaris

For now I'd not do anything with that. I think LLVM tools like llvm-readobj implement only 32-bit case anyways:

  template <class ELFT>
  struct Elf_Nhdr_Impl {
    LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
    Elf_Word n_namesz;
    Elf_Word n_descsz;
    Elf_Word n_type;
  
    /// The alignment of the name and descriptor.
    ///
    /// Implementations differ from the specification here: in practice all
    /// variants align both the name and descriptor to 4-bytes.
    static const unsigned int Align = 4;
  
    /// Get the size of the note, including name, descriptor, and padding.
    size_t getSize() const {
      return sizeof(*this) + alignTo<Align>(n_namesz) + alignTo<Align>(n_descsz);
    }
  };


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68983/new/

https://reviews.llvm.org/D68983





More information about the llvm-commits mailing list