This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[PATCH v2] SH FDPIC backend support


On Fri, Oct 02, 2015 at 07:36:27AM +0900, Oleg Endo wrote:
> On Thu, 2015-10-01 at 17:35 -0400, Rich Felker wrote:
> > This is a forward-port of the abandoned SH FDPIC patch from 2010:
> > 
> > https://gcc.gnu.org/ml/gcc-patches/2010-08/msg01536.html
> > 
> > I'm submitting it at this point for initial review, not to be applied
> > right away; I would not be surprised if some changes are needed. It
> > applies on top of gcc 5.2.0 with the patch for pr 66609 applied. With
> > one trivial change it also applies to the current development version
> > of gcc, but I have not tested that setup.
> 
> Thanks for working on this.  Please submit a patch against trunk.

Attached is the initial version of the patch against trunk. I've fixed
the functional issues I'm aware of from the previous version: ICE in
generating the plain-SH2 libgcc-based shifts, missing
sh_legitimate_constant_p changes, and bad asm spec that broke
non-FDPIC. Cosmetic/style changes have not been made yet.

A couple specific questions I have:

- Is the use of self specs (see DRIVER_SELF_SPECS in sh.h) an
  acceptable way to set the default? I brought this up before but
  don't think anyone answered. I find this method more clear and less
  invasive (doesn't require #ifdef FDPIC_DEFAULT all over the place)
  but if there's a policy reason this can't be done I can rework it.

- For the udiv_qrnnd inline asm, the current patch duplicates the asm
  with a minor change to dereference the function descriptor and get a
  code address. This could be done outside the asm (via type punning
  the function pointer) to slightly improve the resulting code and
  avoid duplicating the asm (a macro would be used to load the code
  address from the function pointer; this is identity macro on
  non-FDPIC and would do the type punning on FDPIC) but if this
  approach would be preferable I need some advice on the form of type
  punning that would be acceptable in GCC.

- For the Changelog, should I just edit the one from the original
  patch (https://gcc.gnu.org/ml/gcc-patches/2010-08/txt00148.txt)
  submitted against 4.5 and add myself to the list of patch authors?

If there are no other functional issues to address I'll go ahead and
switch to the cosmetics and try to make a version that's closer to
ready for commit.

Rich

Attachment: sh-fdpic.diff
Description: Text document


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