On SH, there are many new warnings like

  note: non-delegitimized UNSPEC 46 found in variable location

which are reported by dwarf2out.c:const_ok_for_output_1.
The attached patch is a minimal fix.  It's tested with
the top level "make -k check" on cross sh4-unknown-linux-gnu.
Currently, it's hard to test with the native bootstrap on
this target for the periodic long power outage here.
Applied on trunk.

Regards,
        kaz
--
2011-03-18  Kaz Kojima  <kkoj...@gcc.gnu.org>

        * config/sh/sh.c (sh_delegitimize_address): Handle UNSPEC_SYMOFF
        and UNSPEC_PCREL_SYMOFF.

diff -uprN ORIG/trunk/gcc/config/sh/sh.c LOCAL/trunk/gcc/config/sh/sh.c
--- ORIG/trunk/gcc/config/sh/sh.c       2010-12-24 09:56:26.000000000 +0900
+++ LOCAL/trunk/gcc/config/sh/sh.c      2011-03-18 08:05:03.000000000 +0900
@@ -1,6 +1,6 @@
 /* Output routines for GCC for Renesas / SuperH SH.
    Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
    Contributed by Steve Chamberlain (s...@cygnus.com).
    Improved by Jim Wilson (wil...@cygnus.com).
@@ -10019,8 +10019,20 @@ sh_delegitimize_address (rtx orig_x)
       if (GET_CODE (y) == UNSPEC)
        {
          if (XINT (y, 1) == UNSPEC_GOT
-             || XINT (y, 1) == UNSPEC_GOTOFF)
+             || XINT (y, 1) == UNSPEC_GOTOFF
+             || XINT (y, 1) == UNSPEC_SYMOFF)
            return XVECEXP (y, 0, 0);
+         else if (XINT (y, 1) == UNSPEC_PCREL_SYMOFF)
+           {
+             if (GET_CODE (XVECEXP (y, 0, 0)) == CONST)
+               {
+                 rtx symplt = XEXP (XVECEXP (y, 0, 0), 0);
+
+                 if (GET_CODE (symplt) == UNSPEC
+                     && XINT (symplt, 1) == UNSPEC_PLT)
+                   return XVECEXP (symplt, 0, 0);
+               }
+           }
          else if (TARGET_SHMEDIA
                   && (XINT (y, 1) == UNSPEC_EXTRACT_S16
                       || XINT (y, 1) == UNSPEC_EXTRACT_U16))

Reply via email to