public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: Will Schmidt <will_schmidt@vnet.ibm.com>
To: libc-ports@sourceware.org
Cc: willschm@us.ibm.com, ryan.arnold@gmail.com, bergner@vnet.ibm.com
Subject: Re: [PATCH v2] Powerpc: Use and override SETUP_GOT_ACCESS for ppc476
Date: Wed, 13 Jun 2012 21:41:00 -0000	[thread overview]
Message-ID: <1339623618.3211.6.camel@brimstone> (raw)
In-Reply-To: <1325779034.18291.105.camel@brimstone>


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


  reply	other threads:[~2012-06-13 21:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-21 21:25 [PATCH] " Will Schmidt
2012-01-05 15:57 ` [PATCH v2] " Will Schmidt
2012-06-13 21:41   ` Will Schmidt [this message]
2012-06-15 13:46     ` Ryan S. Arnold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339623618.3211.6.camel@brimstone \
    --to=will_schmidt@vnet.ibm.com \
    --cc=bergner@vnet.ibm.com \
    --cc=libc-ports@sourceware.org \
    --cc=ryan.arnold@gmail.com \
    --cc=willschm@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).