public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Powerpc: Use and override SETUP_GOT_ACCESS for ppc476
@ 2011-11-21 21:25 Will Schmidt
  2012-01-05 15:57 ` [PATCH v2] " Will Schmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Will Schmidt @ 2011-11-21 21:25 UTC (permalink / raw)
  To: libc-ports; +Cc: willschm

Hi, 
   This follows changes made in glibc (Subject "simplify code for
accessing the powerpc GOT"), which provides a simplified method
for accessing the powerpc GOT, and a way to override that access for
sub architectures.  This code provides a version of SETUP_GOT_ACCESS
that is suitable for the ppc476 architecture, and overrides the
ppc_got() function to match that instruction sequence.

2011-11-21  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..5470bae
--- /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
+	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..2240207
--- /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
+	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)				\
+	bl	$+8		;				\
+1:				;				\
+	b	$+8		;				\
+	blr			;				\
+	mflr	(regname)
+
+#endif /* ACCESS_GOT_476 */
+
+#endif /* __ELF__ */
+
+#endif	/* __ASSEMBLER__ */


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Powerpc: Use and override SETUP_GOT_ACCESS for ppc476
  2011-11-21 21:25 [PATCH] Powerpc: Use and override SETUP_GOT_ACCESS for ppc476 Will Schmidt
@ 2012-01-05 15:57 ` Will Schmidt
  2012-06-13 21:41   ` Will Schmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Will Schmidt @ 2012-01-05 15:57 UTC (permalink / raw)
  To: libc-ports; +Cc: willschm


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__ */


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Powerpc: Use and override SETUP_GOT_ACCESS for ppc476
  2012-01-05 15:57 ` [PATCH v2] " Will Schmidt
@ 2012-06-13 21:41   ` Will Schmidt
  2012-06-15 13:46     ` Ryan S. Arnold
  0 siblings, 1 reply; 4+ messages in thread
From: Will Schmidt @ 2012-06-13 21:41 UTC (permalink / raw)
  To: libc-ports; +Cc: willschm, ryan.arnold, bergner


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__ */
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Powerpc: Use and override SETUP_GOT_ACCESS for ppc476
  2012-06-13 21:41   ` Will Schmidt
@ 2012-06-15 13:46     ` Ryan S. Arnold
  0 siblings, 0 replies; 4+ messages in thread
From: Ryan S. Arnold @ 2012-06-15 13:46 UTC (permalink / raw)
  To: will_schmidt; +Cc: libc-ports, willschm, bergner

On Wed, Jun 13, 2012 at 4:40 PM, Will Schmidt <will_schmidt@vnet.ibm.com> wrote:
>
> 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

Hi Will,

Yeah, this one totally slipped through.  I'll fold the copyright years
myself and check it in.

Ryan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-15 13:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-21 21:25 [PATCH] Powerpc: Use and override SETUP_GOT_ACCESS for ppc476 Will Schmidt
2012-01-05 15:57 ` [PATCH v2] " Will Schmidt
2012-06-13 21:41   ` Will Schmidt
2012-06-15 13:46     ` Ryan S. Arnold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).