summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-07 04:10:27 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-07 04:10:27 +0000
commitfca3bd4ced6a9956099ed5b377744000fba2d535 (patch)
tree01a8989f1c27a088d82a8bcdcf3a8b6c682f8df8
parentf098ee0c1b96eaead298bc1074e47810bd654695 (diff)
downloadppe42-gcc-fca3bd4ced6a9956099ed5b377744000fba2d535.tar.gz
ppe42-gcc-fca3bd4ced6a9956099ed5b377744000fba2d535.zip
* config/sh/sh.md (symPLT_label2reg): Force the initialization of
the PIC register. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36225 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/sh/sh.md20
2 files changed, 23 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1b753811336..3f090881a40 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2000-09-07 Alexandre Oliva <aoliva@redhat.com>
+
+ * config/sh/sh.md (symPLT_label2reg): Force the initialization of
+ the PIC register.
+
2000-09-06 H.J. Lu (hjl@gnu.org)
* Makefile.in (clean_s1): Depend on stage_b.
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 9ac6436d189..88a774338b0 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -3531,8 +3531,24 @@ else
(plus:SI (pc)
(unspec [(match_operand:SI 1 "" "")] 9))
(const (plus:SI (label_ref (match_operand:SI 2 "" ""))
- (const_int 2))))))]
- "" "")
+ (const_int 2))))))
+ (use (match_dup 2))]
+ ;; Even though the PIC register is not really used by the call
+ ;; sequence in which this is expanded, the PLT code assumes the PIC
+ ;; register is set, so we must not skip its initialization. Since
+ ;; we only use this expand as part of calling sequences, and never
+ ;; to take the address of a function, this is the best point to
+ ;; insert the (use). Using the PLT to take the address of a
+ ;; function would be wrong, not only because the PLT entry could
+ ;; then be called from a function that doesn't initialize the PIC
+ ;; register to the proper GOT, but also because pointers to the same
+ ;; function might not compare equal, should they be set by different
+ ;; shared libraries.
+ "" "
+{
+ operands[2] = pic_offset_table_rtx;
+ current_function_uses_pic_offset_table = 1;
+}")
;; case instruction for switch statements.
OpenPOWER on IntegriCloud