This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Powerpc: Use and override SETUP_GOT_ACCESS for ppc476


Looks like this one fell off everyones radar.   Ryan, can you commit
this as-is, or do you want a re-spin to fold in the copyright years,
etc? 

Thanks, 
-Will


On Thu, 2012-01-05 at 09:57 -0600, Will Schmidt wrote:
> 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  <will_schmidt@vnet.ibm.com>
> 
> 	* 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 <sysdeps/powerpc/powerpc32/dl-machine.h>
> +
> +#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 <sysdeps/powerpc/powerpc32/sysdep.h>
> +#include <sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h>
> +
> +#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__ */
> 
> 



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]