From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: deuling@de.ibm.com (Markus Deuling)
Cc: drow@false.org (Daniel Jacobowitz),
gdb-patches@sourceware.org (GDB Patches)
Subject: Re: [PING] [rfc]: Framework for looking up multiply defined global symbols in shared libraries
Date: Thu, 31 May 2007 21:40:00 -0000 [thread overview]
Message-ID: <200705312124.l4VLO1qU019395@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <464D2784.20808@de.ibm.com> from "Markus Deuling" at May 18, 2007 06:11:48 AM
Markus Deuling wrote:
> +/* Handler for library-specific lookup of global symbol
> + NAME in BLOCK. Detect objfile corresponding to BLOCK
> + and call the library-specific handler if it is installed
> + for the current target. */
Comment no longer matches the prototype ...
> +struct symbol *
> +solib_global_lookup (const struct objfile *objfile,
> + const char *name,
> + const char *linkage_name,
> + const domain_enum domain,
> + struct symtab **symtab)
> +has_SYMBOLIC (bfd *obfd)
> +{
> + CORE_ADDR dyn_ptr = 0;
> + int sect_size, arch_size;
> + gdb_byte *buf, *bufstart, *bufend, *p;
> + asection *sect;
> +
> + if (obfd == NULL)
> + return -1;
> + arch_size = bfd_get_arch_size (obfd);
> + if (arch_size == -1)
> + return -1;
> +
> + /* Retrieve information about .dynamic section. */
> + sect = bfd_get_section_by_name (obfd, ".dynamic");
> + if (!sect)
> + return -1;
> +
> + /* Read the .dynamic section. */
> + sect_size = bfd_section_size (obfd, sect);
> + buf = alloca (sect_size);
> + if (!bfd_get_section_contents (obfd, sect,
> + buf, 0, sect_size))
> + return -1;
> +
> + if (arch_size == 32)
> + { /* 32-bit elf */
> + for (bufend = buf + sect_size;
> + buf < bufend;
> + buf += sizeof (Elf32_External_Dyn))
> + {
> + Elf32_External_Dyn *x_dynp = (Elf32_External_Dyn *) buf;
> + long dyn_tag;
> + dyn_tag = extract_unsigned_integer ((gdb_byte *) x_dynp->d_tag, 4);
> + if (dyn_tag == DT_NULL)
> + break;
> + else if (dyn_tag == DT_SYMBOLIC)
> + return 1;
> + }
> + }
> + else
> + { /* 64-bit elf */
> + for (bufend = buf + sect_size;
> + buf < bufend;
> + buf += sizeof (Elf64_External_Dyn))
> + {
> + Elf64_External_Dyn *x_dynp = (Elf64_External_Dyn *) buf;
> + long dyn_tag;
> +
> + dyn_tag = extract_unsigned_integer ((gdb_byte *) x_dynp->d_tag, 8);
> + if (dyn_tag == DT_NULL)
> + break;
> + else if (dyn_tag == DT_SYMBOLIC)
> + return 1;
> + }
> + }
It looks like this duplicates a whole bunch of code from elf_locate_base.
Maybe we should extract a helper routine that retrieves a given DT_ tag
from the .dynamic section?
> +/* Look up OBJFILE to BLOCK. */
> +
> +struct objfile *
> +lookup_objfile_from_block (const struct block *block)
I guess this could be static now.
> +/* Lookup objfile to a block. */
> +extern struct objfile *
> +lookup_objfile_from_block (const struct block *block);
If we make it static, this should go away. Otherwise, the function name
should again not start in the first column for the prototype.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
next prev parent reply other threads:[~2007-05-31 21:24 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-10 12:33 Markus Deuling
2007-05-10 13:00 ` Daniel Jacobowitz
2007-05-10 14:52 ` Markus Deuling
2007-05-14 17:53 ` Daniel Jacobowitz
2007-05-14 18:25 ` Daniel Jacobowitz
2007-05-15 5:49 ` Markus Deuling
2007-05-18 4:13 ` Markus Deuling
2007-05-31 21:40 ` Ulrich Weigand [this message]
2007-06-05 3:46 ` Markus Deuling
2007-06-20 6:58 ` [PING 2] " Markus Deuling
2007-06-26 18:31 ` Joel Brobecker
2007-06-26 18:35 ` Joel Brobecker
2007-06-26 20:34 ` Markus Deuling
2007-06-28 15:32 ` Ulrich Weigand
2007-06-28 15:33 ` Joel Brobecker
2007-06-28 18:20 ` Markus Deuling
2007-06-29 17:03 ` Eli Zaretskii
2007-07-02 18:24 ` Ulrich Weigand
2007-07-03 4:04 ` Markus Deuling
2007-07-03 12:17 ` Ulrich Weigand
2007-07-03 12:28 ` Daniel Jacobowitz
2007-07-04 3:50 ` Markus Deuling
2007-06-29 17:15 ` Eli Zaretskii
2007-06-25 21:48 ` [PING] " Kevin Buettner
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=200705312124.l4VLO1qU019395@d12av02.megacenter.de.ibm.com \
--to=uweigand@de.ibm.com \
--cc=deuling@de.ibm.com \
--cc=drow@false.org \
--cc=gdb-patches@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