public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: "Y.D." <qcloud1014@gmail.com>
To: libc-help@sourceware.org
Subject: Add a new function to dlfcn.h?
Date: Sun, 16 Aug 2020 20:52:00 +0800	[thread overview]
Message-ID: <CAF6YOcM5NJmrjDvcaps7d6g8QkbBzL0jPK3Nsb6TeTu0LP8FdQ@mail.gmail.com> (raw)

Hi all,
I'm trying to add a new function to glibc-2.32, and I'm working on getting
the memory size allocated to a shared object.
To achieve this, I want to use the private fields(l_map_start and
l_map_end) in struct link_map, which is said to be internal to dynamic
linker, so I want to add a function to dlfcn.h, just like dlopen() and
dlclose().

The question is, when I want to imitate the way dlopen works, I find that
the dlopen first calls functions in dlfcn/dlopen.c, and then functions in
elf/dl-open.c, which makes me very confused.
If I want to add a new function in dlfcn.h, what should I do? Do I have to
write a new file under dlfcn/ called dlusage.c, and another called
dl-usage.c under elf/? If this is the case, how should I modify the
Makefile in both directories?
Or can I just append one function in a few existing c files and headers?

Any help will be highly appreciated.

Best,
Fengkai

             reply	other threads:[~2020-08-16 12:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-16 12:52 Y.D. [this message]
2020-08-16 12:59 ` Florian Weimer
2020-08-17  2:15   ` Y.D.
2020-08-25 12:46     ` Florian Weimer

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=CAF6YOcM5NJmrjDvcaps7d6g8QkbBzL0jPK3Nsb6TeTu0LP8FdQ@mail.gmail.com \
    --to=qcloud1014@gmail.com \
    --cc=libc-help@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).