Joakim Tjernlund/Transmode wrote on 2010/10/14 15:54:32:
>
> Joakim Tjernlund/Transmode wrote on 2010/10/12 11:00:36:
> >
> > Alan Modra <amo...@gmail.com> wrote on 2010/10/11 14:58:45:
> > >
> > > On Sun, Oct 10, 2010 at 11:20:06AM +0200, Joakim Tjernlund wrote:
> > > > Now I have had a closer look at this and it looks much like -fpic
> > > > on ppc32, you still use the GOT/TOC to load the address where the data 
> > > > is.
> > >
> > > No, with ppc64 -mcmodel=medium you use the GOT/TOC pointer plus an
> > > offset to address local data.
> > >
> > > > I was looking for true %pc relative addressing of data. I guess this is 
> > > > really
> > > > hard on PowerPC?
> > >
> > > Yes, PowerPC lacks pc-relative instructions.
> > >
> > > > I am not sure this is all it takes to make -fpic to work with 
> > > > -mrelocatable,
> > > > any ideas?
> > >
> > > You might be lucky.  With -mrelocatable, .got2 only contains
> > > addresses.  No other constants.  So a simple run-time loader can
> > > relocate the entire .got2 section, plus those locations specified in
> > > .fixup.  You'll have to make sure gcc does the same for .got, and your
> > > run-time loader will need to be modified to handle .got (watch out for
> > > the .got header!).

> > Got it working now. It was just u-boot reloc routine I first failed
> > to extend properly to reloc *got too.
> >
> > I think this is safe as one can mix fpic with fPIC and
> > mrelocatable is the same as fPIC+fixups.
> >
> > Will you accept this patch into gcc?

Everything went dead quiet the minute I stated to send patches, what did
I do wrong?

 Jocke

>
> Ping?
>
> From d8ff0b3f0b44480542eab04d1659f4368b6b09cf Mon Sep 17 00:00:00 2001
> From: Joakim Tjernlund <joakim.tjernl...@transmode.se>
> Date: Sun, 10 Oct 2010 10:34:50 +0200
> Subject: [PATCH] powerpc: Support -fpic too with mrelocatable
>
> Signed-off-by: Joakim Tjernlund <joakim.tjernl...@transmode.se>
> ---
>  sysv4.h |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
> index 8da8410..e4b8280 100644
> --- a/gcc/config/rs6000/sysv4.h
> +++ b/gcc/config/rs6000/sysv4.h
> @@ -227,7 +227,8 @@ do {         \
>      }         \
>           \
>    else if (TARGET_RELOCATABLE)      \
> -    flag_pic = 2;       \
> +    if (!flag_pic)       \
> +      flag_pic = 2;       \
>  } while (0)
>
>  #ifndef RS6000_BI_ARCH
> --
> 1.7.2.2

Reply via email to