From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17162 invoked by alias); 5 Jan 2012 15:57:37 -0000 Received: (qmail 17151 invoked by uid 22791); 5 Jan 2012 15:57:33 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e4.ny.us.ibm.com (HELO e4.ny.us.ibm.com) (32.97.182.144) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 05 Jan 2012 15:57:13 +0000 Received: from /spool/local by e4.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 5 Jan 2012 10:57:12 -0500 Received: from d01relay06.pok.ibm.com (9.56.227.116) by e4.ny.us.ibm.com (192.168.1.104) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 5 Jan 2012 10:57:09 -0500 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay06.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q05Fv80L3457244 for ; Thu, 5 Jan 2012 10:57:08 -0500 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q05Fv8Og004669 for ; Thu, 5 Jan 2012 10:57:08 -0500 Received: from [9.10.86.208] (brimstone.rchland.ibm.com [9.10.86.208]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q05Fv7VI004636; Thu, 5 Jan 2012 10:57:07 -0500 Subject: Re: [PATCH v2] Powerpc: Use and override SETUP_GOT_ACCESS for ppc476 From: Will Schmidt Reply-To: will_schmidt@vnet.ibm.com To: libc-ports@sourceware.org Cc: willschm@us.ibm.com In-Reply-To: <1321910448.3416.27.camel@brimstone> References: <1321910448.3416.27.camel@brimstone> Content-Type: text/plain; charset="UTF-8" Date: Thu, 05 Jan 2012 15:57:00 -0000 Message-ID: <1325779034.18291.105.camel@brimstone> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit x-cbid: 12010515-3534-0000-0000-000004420A3A X-IsSubscribed: yes Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2012-01/txt/msg00016.txt.bz2 Hi, This follows glibc changes (subject:"simplify code for accessing powerpc GOT", commit 91d2a845) and provides an override for SETUP_GOT_ACCESS that is suitable for the ppc476 sub-architecture. 2012-01-05 Will Schmidt * sysdeps/powerpc/powerpc32/476/dl-machine.h: New file. Add a ppc_got_476 function. * sysdeps/powerpc/powerpc32/476/sysdep.h: New file. Define the SETUP_GOT_ACCESS macro for the 476 architecture. diff --git a/sysdeps/powerpc/powerpc32/476/dl-machine.h b/sysdeps/powerpc/powerpc32/476/dl-machine.h new file mode 100644 index 0000000..826b205 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/476/dl-machine.h @@ -0,0 +1,45 @@ +/* Machine-dependent ELF dynamic relocation inline functions. PowerPC version. + Copyright (C) 1995-2002, 2003, 2005, 2006, 2011, 2012 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#ifndef PPC_GOT_476_OVERRIDE +#define PPC_GOT_476_OVERRIDE + +/* Return the value of the GOT pointer. */ +static inline Elf32_Addr * __attribute__ ((const)) +ppc_got_476 (void) +{ + Elf32_Addr *got; + + asm (" bl $+8 \n" + "1: \n" + " b $+8 \n" + " blr \n" + " mflr %0 \n" + " addis %0,%0,_GLOBAL_OFFSET_TABLE_-1b@ha\n" + " addi %0,%0,_GLOBAL_OFFSET_TABLE_-1b@l\n" + : "=b" (got) : : "lr"); + + return got; +} +#define ppc_got() ppc_got_476() + +#endif /* PPC_GOT_476_OVERRIDE */ diff --git a/sysdeps/powerpc/powerpc32/476/sysdep.h b/sysdeps/powerpc/powerpc32/476/sysdep.h new file mode 100644 index 0000000..6f9f2e0 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/476/sysdep.h @@ -0,0 +1,45 @@ +/* Assembly macros for 32-bit PowerPC. + Copyright (C) 1999, 2001, 2002, 2003, 2006, 2011, 2012 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ + +#include +#include + +#ifdef __ASSEMBLER__ + +#ifdef __ELF__ + +/* helper macro for accessing the 32-bit powerpc GOT. */ +#ifndef ACCESS_GOT_476 +#define ACCESS_GOT_476 + +#undef SETUP_GOT_ACCESS + +#define SETUP_GOT_ACCESS(regname,GOT_LABEL) \ + bl $+8 ; \ +GOT_LABEL: ; \ + b $+8 ; \ + blr ; \ + mflr (regname) + +#endif /* ACCESS_GOT_476 */ + +#endif /* __ELF__ */ + +#endif /* __ASSEMBLER__ */