Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Feb 2019 15:26:26 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 236057] head/contrib/elftoolchain/common/elfdefinitions.h Elf64_Phdr contains invalid documentation
Message-ID:  <bug-236057-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236057

            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@FreeBSD.org
          Reporter: devel@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;

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-236057-227>