* config/sh/sh.c (nonpic_symbol_mentioned_p): Check LABEL_REFs.
* config/sh/sh.md (sym_label2reg, symPLT_label2reg): Protect
LABEL_REFs with a PIC-safe unspec.
From-SVN: r36495
+2000-09-18 Alexandre Oliva <aoliva@redhat.com>
+
+ * config/sh/sh.c (nonpic_symbol_mentioned_p): Check LABEL_REFs.
+ * config/sh/sh.md (sym_label2reg, symPLT_label2reg): Protect
+ LABEL_REFs with a PIC-safe unspec.
+
2000-09-18 Will Cohen <wcohen@redhat.com>
* extend.texi (Zero Length): State that static initializers for
return 0;
}
\f
-/* Return TRUE if X references a SYMBOL_REF whose symbol doesn't have
- @GOT or @GOTOFF. */
+/* Return TRUE if X references a SYMBOL_REF or LABEL_REF whose symbol
+ isn't protected by a PIC unspec. */
int
nonpic_symbol_mentioned_p (x)
rtx x;
register const char *fmt;
register int i;
- if (GET_CODE (x) == SYMBOL_REF)
+ if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
return 1;
if (GET_CODE (x) == UNSPEC
[(set (match_operand:SI 0 "" "")
(const (minus:SI
(unspec [(match_operand:SI 1 "" "")] 6)
- (const (plus:SI (label_ref (match_operand:SI 2 "" ""))
- (const_int 2))))))]
+ (const (plus:SI
+ (unspec [(label_ref (match_operand:SI 2 "" ""))] 6)
+ (const_int 2))))))]
"" "")
(define_expand "symGOT2reg"
(const (minus:SI
(plus:SI (pc)
(unspec [(match_operand:SI 1 "" "")] 9))
- (const (plus:SI (label_ref (match_operand:SI 2 "" ""))
- (const_int 2))))))
+ (const
+ (plus:SI
+ (unspec [(label_ref (match_operand:SI 2 "" ""))] 6)
+ (const_int 2))))))
(use (match_dup 3))]
;; Even though the PIC register is not really used by the call
;; sequence in which this is expanded, the PLT code assumes the PIC