[Bug 236057] head/contrib/elftoolchain/common/elfdefinitions.h Elf64_Phdr contains invalid documentation

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Feb 26 15:26:29 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236057

            Bug ID: 236057
           Summary: head/contrib/elftoolchain/common/elfdefinitions.h
                    Elf64_Phdr contains invalid documentation
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: misc
          Assignee: bugs at FreeBSD.org
          Reporter: devel at romanr.info

/* 32 bit PHDR entry. */
typedef struct {
        Elf32_Word      p_type;      /* Type of segment. */
        Elf32_Off       p_offset;    /* File offset to segment. */
        Elf32_Addr      p_vaddr;     /* Virtual address in memory. */
        Elf32_Addr      p_paddr;     /* Physical address (if relevant). */
        Elf32_Word      p_filesz;    /* Size of segment in file. */
        Elf32_Word      p_memsz;     /* Size of segment in memory. */
        Elf32_Word      p_flags;     /* Segment flags. */
        Elf32_Word      p_align;     /* Alignment constraints. */
} Elf32_Phdr;

This definition seems to me correct.


/* 64 bit PHDR entry. */
typedef struct {
        Elf64_Word      p_type;      /* Type of segment. */
        Elf64_Word      p_flags;     /* File offset to segment. */
        Elf64_Off       p_offset;    /* Virtual address in memory. */
        Elf64_Addr      p_vaddr;     /* Physical address (if relevant). */
        Elf64_Addr      p_paddr;     /* Size of segment in file. */
        Elf64_Xword     p_filesz;    /* Size of segment in memory. */
        Elf64_Xword     p_memsz;     /* Segment flags. */
        Elf64_Xword     p_align;     /* Alignment constraints. */
} Elf64_Phdr;

Well, why p_flags contains a "File offset to segment" ?
Seems to me either comments or fields got shifted.

The correct definitions should be:

/* 64 bit PHDR entry. */
typedef struct {
        Elf64_Word      p_type;      /* Type of segment. */
        Elf64_Word      p_flags;     /* Segment flags. */
        Elf64_Off       p_offset;    /* File offset to segment. */
        Elf64_Addr      p_vaddr;     /* Virtual address in memory. */
        Elf64_Addr      p_paddr;     /* Physical address (if relevant). */
        Elf64_Xword     p_filesz;    /* Size of segment in file. */
        Elf64_Xword     p_memsz;     /* Size of segment in memory. */
        Elf64_Xword     p_align;     /* Alignment constraints. */
} Elf64_Phdr;

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list