From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7958 invoked by alias); 31 May 2007 21:24:07 -0000 Received: (qmail 7950 invoked by uid 22791); 31 May 2007 21:24:06 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate4.de.ibm.com (HELO mtagate4.de.ibm.com) (195.212.29.153) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 31 May 2007 21:24:04 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate4.de.ibm.com (8.13.8/8.13.8) with ESMTP id l4VLO1Pp056820 for ; Thu, 31 May 2007 21:24:01 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.3) with ESMTP id l4VLO1Vu3497994 for ; Thu, 31 May 2007 23:24:01 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l4VLO17r019398 for ; Thu, 31 May 2007 23:24:01 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id l4VLO1qU019395; Thu, 31 May 2007 23:24:01 +0200 Message-Id: <200705312124.l4VLO1qU019395@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Thu, 31 May 2007 23:24:01 +0200 Subject: Re: [PING] [rfc]: Framework for looking up multiply defined global symbols in shared libraries To: deuling@de.ibm.com (Markus Deuling) Date: Thu, 31 May 2007 21:40:00 -0000 From: "Ulrich Weigand" Cc: drow@false.org (Daniel Jacobowitz), gdb-patches@sourceware.org (GDB Patches) In-Reply-To: <464D2784.20808@de.ibm.com> from "Markus Deuling" at May 18, 2007 06:11:48 AM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-05/txt/msg00446.txt.bz2 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