https://sourceware.org/bugzilla/show_bug.cgi?id=29695

            Bug ID: 29695
           Summary: In libelf.h struct Elf, struct Elf_Scn is defined
                    using typedef and not using #include <libelfP.h> is
                    not the way to comply with the specification?
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libdw
          Assignee: unassigned at sourceware dot org
          Reporter: zhuorong.lin at outlook dot com
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

In the source code, libelf.h in the libelf directory is just typedef struct
Elf, struct ElfScn, and the real definition is in libelfP.h, and there is no
#include <libelfP.h> in libelf.h.
Is directly typedef an undefined struct not in compliance with the
specification.

libelf.h
```
/* Archive symbol table entry.  */
typedef struct
{
  char *as_name;                /* Symbol name.  */
  size_t as_off;                /* Offset for this file in the archive.  */
  unsigned long int as_hash;    /* Hash value of the name.  */
} Elf_Arsym;


/* Descriptor for the ELF file.  */
typedef struct Elf Elf;

/* Descriptor for ELF file section.  */
typedef struct Elf_Scn Elf_Scn;


#ifdef __cplusplus
extern "C" {
#endif

/* Return descriptor for ELF file to work according to CMD.  */
extern Elf *elf_begin (int __fildes, Elf_Cmd __cmd, Elf *__ref);

/* Create a clone of an existing ELF descriptor.  */
  extern Elf *elf_clone (Elf *__elf, Elf_Cmd __cmd);

/* Create descriptor for memory region.  */
extern Elf *elf_memory (char *__image, size_t __size);

/* Advance archive descriptor to next element.  */
extern Elf_Cmd elf_next (Elf *__elf);
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
  • [Bug libdw/29695] New: ... zhuorong.lin at outlook dot com via Elfutils-devel

Reply via email to