From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1202 invoked by alias); 14 May 2005 04:59:52 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 1144 invoked from network); 14 May 2005 04:59:45 -0000 Received: from unknown (HELO omta01ps.mx.bigpond.com) (144.140.82.153) by sourceware.org with SMTP; 14 May 2005 04:59:45 -0000 Received: from grove.modra.org ([144.136.167.90]) by omta01ps.mx.bigpond.com with ESMTP id <20050514045943.UZNF12463.omta01ps.mx.bigpond.com@grove.modra.org> for ; Sat, 14 May 2005 04:59:43 +0000 Received: by bubble.grove.modra.org (Postfix, from userid 500) id CB43019ED61; Sat, 14 May 2005 14:29:43 +0930 (CST) Date: Sat, 14 May 2005 05:57:00 -0000 From: Alan Modra To: binutils@sources.redhat.com Subject: Re: powerpc new PLT and GOT Message-ID: <20050514045943.GD27573@bubble.grove.modra.org> Mail-Followup-To: binutils@sources.redhat.com References: <20050511141249.GA29302@bubble.grove.modra.org> <20050512053747.GA5254@redhat.com> <20050512060814.GG29302@bubble.grove.modra.org> <20050512063729.GA5299@redhat.com> <20050512083650.GH29302@bubble.grove.modra.org> <20050512171412.GA6429@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050512171412.GA6429@redhat.com> User-Agent: Mutt/1.4i X-SW-Source: 2005-05/txt/msg00469.txt.bz2 It turns out that it's useful to have the value of _GLOBAL_OFFSET_TABLE_ available easily in ld.so, and since ld.so doesn't need a pointer to .glink I've renamed the tag that indicates a new PLT/GOT accordingly. include/elf/ * ppc.h (DT_PPC_GOT): Rename from DT_PPC_GLINK. bfd/ * elf32-ppc.c (ppc_elf_size_dynamic_sections): Set DT_PPC_GOT, not DT_PPC_GLINK. (ppc_elf_finish_dynamic_sections): Likewise. binutils/ * readelf.c (get_ppc_dynamic_type): Display DT_PPC_GOT, not DT_PPC_GLINK. Index: include/elf/ppc.h =================================================================== RCS file: /cvs/src/src/include/elf/ppc.h,v retrieving revision 1.17 diff -u -p -r1.17 ppc.h --- include/elf/ppc.h 11 May 2005 14:08:45 -0000 1.17 +++ include/elf/ppc.h 14 May 2005 04:28:53 -0000 @@ -145,8 +145,8 @@ END_RELOC_NUMBERS (R_PPC_max) #define IS_PPC_TLS_RELOC(R) \ ((R) >= R_PPC_TLS && (R) <= R_PPC_GOT_DTPREL16_HA) -/* Specify the start of the .glink section. */ -#define DT_PPC_GLINK DT_LOPROC +/* Specify the value of _GLOBAL_OFFSET_TABLE_. */ +#define DT_PPC_GOT DT_LOPROC /* Processor specific flags for the ELF header e_flags field. */ Index: bfd/elf32-ppc.c =================================================================== RCS file: /cvs/src/src/bfd/elf32-ppc.c,v retrieving revision 1.157 diff -u -p -r1.157 elf32-ppc.c --- bfd/elf32-ppc.c 12 May 2005 15:24:51 -0000 1.157 +++ bfd/elf32-ppc.c 14 May 2005 04:28:57 -0000 @@ -4406,7 +4406,7 @@ ppc_elf_size_dynamic_sections (bfd *outp if (htab->glink != NULL && htab->glink->size != 0) { - if (!add_dynamic_entry (DT_PPC_GLINK, 0)) + if (!add_dynamic_entry (DT_PPC_GOT, 0)) return FALSE; } @@ -6313,6 +6313,7 @@ ppc_elf_finish_dynamic_sections (bfd *ou { asection *sdyn; struct ppc_elf_link_hash_table *htab; + bfd_vma got; #ifdef DEBUG fprintf (stderr, "ppc_elf_finish_dynamic_sections called\n"); @@ -6321,6 +6322,12 @@ ppc_elf_finish_dynamic_sections (bfd *ou htab = ppc_elf_hash_table (info); sdyn = bfd_get_section_by_name (htab->elf.dynobj, ".dynamic"); + got = 0; + if (htab->elf.hgot != NULL) + got = (htab->elf.hgot->root.u.def.value + + htab->elf.hgot->root.u.def.section->output_section->vma + + htab->elf.hgot->root.u.def.section->output_offset); + if (htab->elf.dynamic_sections_created) { Elf32_External_Dyn *dyncon, *dynconend; @@ -6352,10 +6359,8 @@ ppc_elf_finish_dynamic_sections (bfd *ou dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; break; - case DT_PPC_GLINK: - s = htab->glink; - dyn.d_un.d_ptr = (s->size - GLINK_PLTRESOLVE - + s->output_section->vma + s->output_offset); + case DT_PPC_GOT: + dyn.d_un.d_ptr = got; break; default: @@ -6389,7 +6394,7 @@ ppc_elf_finish_dynamic_sections (bfd *ou { unsigned char *p; unsigned char *endp; - bfd_vma got, pltgot; + bfd_vma pltgot; unsigned int i; static const unsigned int plt_resolve[] = { @@ -6409,10 +6414,6 @@ ppc_elf_finish_dynamic_sections (bfd *ou #define PPC_HI(v) (((v) >> 16) & 0xffff) #define PPC_HA(v) PPC_HI ((v) + 0x8000) - got = (htab->elf.hgot->root.u.def.value - + htab->elf.hgot->root.u.def.section->output_section->vma - + htab->elf.hgot->root.u.def.section->output_offset); - pltgot = (htab->plt->output_section->vma + htab->plt->output_offset - got); Index: binutils/readelf.c =================================================================== RCS file: /cvs/src/src/binutils/readelf.c,v retrieving revision 1.293 diff -u -p -r1.293 readelf.c --- binutils/readelf.c 14 May 2005 01:38:14 -0000 1.293 +++ binutils/readelf.c 14 May 2005 04:29:06 -0000 @@ -1417,7 +1417,7 @@ get_ppc_dynamic_type (unsigned long type { switch (type) { - case DT_PPC_GLINK: return "PPC_GLINK"; + case DT_PPC_GOT: return "PPC_GOT"; default: return NULL; } -- Alan Modra IBM OzLabs - Linux Technology Centre