public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: "zhuorong.lin at outlook dot com" <sourceware-bugzilla@sourceware.org>
To: elfutils-devel@sourceware.org
Subject: [Bug libdw/29695] New: 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?
Date: Sun, 16 Oct 2022 13:12:31 +0000	[thread overview]
Message-ID: <bug-29695-10460@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2022-10-16 13:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16 13:12 zhuorong.lin at outlook dot com [this message]
2022-10-16 13:16 ` [Bug libelf/29695] " zhuorong.lin at outlook dot com
2022-10-27 20:55 ` mark at klomp dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29695-10460@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).