[PATCH] SH FDPIC backend support
Rich Felker
dalias@libc.org
Sat Oct 3 04:50:00 GMT 2015
On Sat, Oct 03, 2015 at 06:57:56AM +0900, Kaz Kojima wrote:
> Rich Felker <dalias@libc.org> wrote:
> > I worked around it and opened an issue for it:
> >
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67812
> >
> > But trying the patch on vanilla GCC trunk without my usual J2 target
> > setup revealed some additional issues I need to address. I'm getting
> > ICE in the code that generates the libgcc bitshift calls, which
> > weren't used on J2. This is my fault for failing to extend the changes
> > made to other parts of sh.md to the patterns for the new shifts (the
> > same ones that broke the kernel) and perhaps also some other things.
> > I'm going to go back and review that code and get it done right before
> > resubmitting the patch against trunk.
> >
> > If you have any other general comments on the patch in the mean time
> > I'd be happy to hear them.
>
> FYI, the patch can be applied to trunk almost as is. I've tried
> to build/make -k check for cross sh4-unknown-linux-gnu.
Yes, there's just one trivial conflict.
> > #ifndef SUBTARGET_ASM_SPEC
> > -#define SUBTARGET_ASM_SPEC ""
> > +#define SUBTARGET_ASM_SPEC "%{!mno-fdpic:--fdpic}"
> > #endif
>
> With it, plain sh4-unknown-linux-gnu compiler adds --fdpic
> to the AS command unless -mno-fdpic is specified and the build
> fails during linking the target libgcc.so. I've changed it into
Oops.
> #ifndef SUBTARGET_ASM_SPEC
> -#define SUBTARGET_ASM_SPEC ""
> +#ifdef FDPIC_DEFAULT
> +#define SUBTARGET_ASM_SPEC "%{!mno-fdpic:--fdpic}"
> +#else
> +#define SUBTARGET_ASM_SPEC "%{mfdpic:--fdpic}"
> +#endif
> #endif
I have -mfdpic in the self-specs when FDPIC_DEFAULT is defined, so I
think only the positive form is needed. If having self specs is not
acceptable, several places need changing: at least the linker
emulation and (in the musl support patch; this is not yet upstream)
changing the logic for the dynamic linker name to have separate cases
for FDPIC_DEFAULT defined/undefined.
> There are no new failures with the top level "make -k check"
> on sh4-unknown-linux-gnu.
Thanks for checking this!
Rich
More information about the Gcc-patches
mailing list