public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "srk31 at srcf dot ucam.org" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/16262] New: Semantics of dladdr don't quite match documentation Date: Wed, 27 Nov 2013 12:10:00 -0000 [thread overview] Message-ID: <bug-16262-131@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=16262 Bug ID: 16262 Summary: Semantics of dladdr don't quite match documentation Product: glibc Version: 2.17 Status: NEW Severity: normal Priority: P2 Component: dynamic-link Assignee: unassigned at sourceware dot org Reporter: srk31 at srcf dot ucam.org Created attachment 7307 --> https://sourceware.org/bugzilla/attachment.cgi?id=7307&action=edit Program illustrating the behaviour I'm querying The man page of dladdr(3) states that dladdr(addr, &info) populates info such that info.dli_sname is "the name of the nearest symbol with address lower than addr". In fact, on ELF platforms, it seems only to do so if a symbol *overlaps* addr, i.e. using the symbol's length information. I've attached a very small test case. If the documented semantics held, the decrement-by-one logic would never be hit (client.c:72). I'm not sure whether this is a bug with the documentation or with dladdr(), but I'd argue that the documented behaviour would be useful to have, perhaps as an alternative to the actual behaviour. Background: I was hoping to use dladdr() as a portable interface for walking (backwards) through all dynamic symbols defined in a text segment. Owing to this quirk, though, I get stuck the moment I hit an address that is not overlapped by a dynamic symbol. If it had the documented semantics, I'd always get the next lowest symbol. The documented semantics are also what any implementation for object formats *without* length information would give. So, this is perhaps a portability issue (I can do something on those platforms that then doesn't work on ELF). I realise the "right way" to do this is to use libelf or bfd, but it's frustrating to come so close to not needing the big hammer, especially when the documentation makes it look like I don't need it. -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2013-11-27 12:10 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-11-27 12:10 srk31 at srcf dot ucam.org [this message] 2013-12-05 23:17 ` [Bug manual/16262] " neleai at seznam dot cz 2013-12-09 16:32 ` srk31 at srcf dot ucam.org 2013-12-09 16:47 ` neleai at seznam dot cz 2014-01-08 1:08 ` mtk.manpages at gmail dot com 2014-01-08 1:26 ` Ondřej Bílka 2014-01-08 1:26 ` neleai at seznam dot cz 2014-05-06 18:09 ` srk31 at srcf dot ucam.org 2014-05-06 18:11 ` srk31 at srcf dot ucam.org 2014-06-13 11:51 ` fweimer at redhat dot com
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-16262-131@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@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: linkBe 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).