OSDN Git Service

Fix -fpic problems
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 23 Jul 1996 16:44:34 +0000 (16:44 +0000)
committermeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 23 Jul 1996 16:44:34 +0000 (16:44 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@12547 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.md
gcc/config/rs6000/sysv4.h
gcc/config/rs6000/t-ppcgas

index 38a8064..d1920a0 100644 (file)
@@ -2118,7 +2118,7 @@ rs6000_replace_regno (x, from, reg)
       if (REGNO (x) == from)
        {
          if (! *reg)
       if (REGNO (x) == from)
        {
          if (! *reg)
-           *reg = gen_reg_rtx (Pmode);
+           *reg = pic_offset_table_rtx = gen_reg_rtx (Pmode);
 
          return *reg;
        }
 
          return *reg;
        }
index 80135d3..7f9d6a9 100644 (file)
   "
 {
   operands[2] = rs6000_got_register (operands[1]);
   "
 {
   operands[2] = rs6000_got_register (operands[1]);
-  if (flag_pic > 1)
-    {
-      emit_insn (gen_movsi_got_large (operands[0], operands[1], operands[2]));
-      DONE;
-    }
 }")
 
 }")
 
-(define_insn "*movsi_got_internal1"
+(define_insn "*movsi_got_internal"
   [(set (match_operand:SI 0 "register_operand" "=r")
        (unspec [(match_operand:SI 1 "got_operand" "")
                 (match_operand:SI 2 "register_operand" "b")] 8))]
   [(set (match_operand:SI 0 "register_operand" "=r")
        (unspec [(match_operand:SI 1 "got_operand" "")
                 (match_operand:SI 2 "register_operand" "b")] 8))]
   "{l|lwz} %0,%a1@got(%2)"
   [(set_attr "type" "load")])
 
   "{l|lwz} %0,%a1@got(%2)"
   [(set_attr "type" "load")])
 
-(define_expand "movsi_got_large"
-  [(set (match_dup 3)
-       (unspec [(match_operand:SI 1 "got_operand" "")] 9))
-   (set (match_dup 3)
-       (unspec [(match_dup 1)
-                (match_dup 3)] 10))
-   (set (match_operand:SI 0 "register_operand" "")
-       (mem:SI (plus:SI (match_dup 3)
-                        (match_operand:SI 2 "register_operand" ""))))]
-  "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic > 1"
-  "
-{
-  if (reload_completed || reload_in_progress)
-    abort ();
-
-  operands[3] = gen_reg_rtx (SImode);
-}")
-
-(define_insn "*movsi_got_internal2_high"
-  [(set (match_operand:SI 0 "register_operand" "=b")
-       (unspec [(match_operand:SI 1 "got_operand" "")] 9))]
-  "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic > 1"
-  "{cau|addis} %0,0,%1@got@ha")
-
-(define_insn "*movsi_got_internal2_losum"
-  [(set (match_operand:SI 0 "register_operand" "=r")
-       (unspec [(match_operand:SI 1 "got_operand" "")
-                (match_operand:SI 2 "register_operand" "b")] 10))]
-  "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic > 1"
-  "{cal %0,%a1@got@l(%2)|addi %0,%2,%a1@got@l}")
-
 ;; For SI, we special-case integers that can't be loaded in one insn.  We
 ;; do the load 16-bits at a time.  We could do this by loading from memory,
 ;; and this is even supposed to be faster, but it is simpler not to get
 ;; For SI, we special-case integers that can't be loaded in one insn.  We
 ;; do the load 16-bits at a time.  We could do this by loading from memory,
 ;; and this is even supposed to be faster, but it is simpler not to get
     }
 
   if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
     }
 
   if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
-      && flag_pic && got_operand (operands[1], SImode))
+      && flag_pic == 1 && got_operand (operands[1], SImode))
     {
       emit_insn (gen_movsi_got (operands[0], operands[1]));
       DONE;
     {
       emit_insn (gen_movsi_got (operands[0], operands[1]));
       DONE;
index a5aa5b2..2c4fb70 100644 (file)
@@ -185,25 +185,46 @@ do {                                                                      \
       else                                                             \
        error ("Bad value for -msdata=%s", rs6000_sdata_name);          \
     }                                                                  \
       else                                                             \
        error ("Bad value for -msdata=%s", rs6000_sdata_name);          \
     }                                                                  \
+  else if (TARGET_SDATA && TARGET_EABI)                                        \
+    {                                                                  \
+      rs6000_sdata = SDATA_EABI;                                       \
+      rs6000_sdata_name = "eabi";                                      \
+    }                                                                  \
   else if (TARGET_SDATA)                                               \
   else if (TARGET_SDATA)                                               \
-    rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV;            \
+    {                                                                  \
+      rs6000_sdata = SDATA_SYSV;                                       \
+      rs6000_sdata_name = "sysv";                                      \
+    }                                                                  \
   else if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)                \
     {                                                                  \
       rs6000_sdata = SDATA_DATA;                                       \
   else if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)                \
     {                                                                  \
       rs6000_sdata = SDATA_DATA;                                       \
+      rs6000_sdata_name = "data";                                      \
       target_flags |= MASK_SDATA;                                      \
     }                                                                  \
   else                                                                 \
       target_flags |= MASK_SDATA;                                      \
     }                                                                  \
   else                                                                 \
-    rs6000_sdata = SDATA_NONE;                                         \
+    {                                                                  \
+      rs6000_sdata = SDATA_NONE;                                       \
+      rs6000_sdata_name = "none";                                      \
+    }                                                                  \
                                                                        \
   if (TARGET_RELOCATABLE &&                                            \
       (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV))      \
     {                                                                  \
       rs6000_sdata = SDATA_DATA;                                       \
                                                                        \
   if (TARGET_RELOCATABLE &&                                            \
       (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV))      \
     {                                                                  \
       rs6000_sdata = SDATA_DATA;                                       \
-      error ("-mrelocatable and -msdata are incompatible.");           \
+      error ("-mrelocatable and -msdata=%s are incompatible.",         \
+            rs6000_sdata_name);                                        \
     }                                                                  \
                                                                        \
     }                                                                  \
                                                                        \
-  if (TARGET_SDATA && DEFAULT_ABI != ABI_V4                            \
-      && DEFAULT_ABI != ABI_SOLARIS)                                   \
+  else if (flag_pic &&                                                 \
+          (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV))  \
+    {                                                                  \
+      rs6000_sdata = SDATA_DATA;                                       \
+      error ("-f%s and -msdata=%s are incompatible.",                  \
+            (flag_pic > 1) ? "PIC" : "pic",                            \
+            rs6000_sdata_name);                                        \
+    }                                                                  \
+                                                                       \
+  if (TARGET_SDATA && DEFAULT_ABI != ABI_V4 && DEFAULT_ABI != ABI_SOLARIS) \
     {                                                                  \
       target_flags &= ~MASK_SDATA;                                     \
       error ("-msdata and -mcall-%s are incompatible.", rs6000_abi_name); \
     {                                                                  \
       target_flags &= ~MASK_SDATA;                                     \
       error ("-msdata and -mcall-%s are incompatible.", rs6000_abi_name); \
@@ -234,6 +255,14 @@ do {                                                                       \
       target_flags |= MASK_LITTLE_ENDIAN;                              \
       error ("-mcall-nt must be little endian");                       \
     }                                                                  \
       target_flags |= MASK_LITTLE_ENDIAN;                              \
       error ("-mcall-nt must be little endian");                       \
     }                                                                  \
+                                                                       \
+  /* Treat -fPIC the same as -mrelocatable */                          \
+  if (flag_pic > 1)                                                    \
+    target_flags |= MASK_RELOCATABLE;                                  \
+                                                                       \
+  else if (TARGET_RELOCATABLE)                                         \
+    flag_pic = 2;                                                      \
+                                                                       \
 } while (0)
 
 /* Default ABI to compile code for */
 } while (0)
 
 /* Default ABI to compile code for */
index 115323d..cea52c0 100644 (file)
@@ -24,16 +24,17 @@ eabi-ctors.c: $(srcdir)/config/rs6000/eabi-ctors.c
 # Build libgcc.a with different options.
 
 MULTILIB_OPTIONS       = msoft-float \
 # Build libgcc.a with different options.
 
 MULTILIB_OPTIONS       = msoft-float \
-                         mrelocatable \
+                         mrelocatable-lib \
                          mlittle/mbig \
                          mlittle/mbig \
-                         mcall-sysv-noeabi/mcall-sysv-eabi/mcall-aix/mcall-solaris
+                         mcall-sysv-noeabi/mcall-sysv-eabi/mcall-aix
 
 MULTILIB_DIRNAMES      = nof \
                          rel \
                          le be \
 
 MULTILIB_DIRNAMES      = nof \
                          rel \
                          le be \
-                         cs ce ca sol
+                         cs ce ca
 
 MULTILIB_MATCHES       = mlittle=mlittle-endian \
 
 MULTILIB_MATCHES       = mlittle=mlittle-endian \
+                         mlittle=mcall-solaris \
                          mbig=mbig-endian \
                          mbig=mcall-linux \
                          msoft-float=mcpu?403 \
                          mbig=mbig-endian \
                          mbig=mcall-linux \
                          msoft-float=mcpu?403 \
@@ -41,12 +42,12 @@ MULTILIB_MATCHES    = mlittle=mlittle-endian \
                          msoft-float=mcpu?860 \
                          mcall-sysv-noeabi=mcall-linux \
                          mcall-sysv-eabi=meabi \
                          msoft-float=mcpu?860 \
                          mcall-sysv-noeabi=mcall-linux \
                          mcall-sysv-eabi=meabi \
-                         mcall-sysv-noeabi=mno-eabi
-
-MULTILIB_EXCEPTIONS    = *mrelocatable*/*mcall-sysv-noeabi* \
-                         *mrelocatable*/*mcall-solaris* \
-                         *mbig*/*mcall-solaris* \
-                         *mlittle*/*mcall-solaris*
+                         mcall-sysv-noeabi=mno-eabi \
+                         mcall-sysv-noeabi=mcall-solaris \
+                         mrelocatable-lib=mrelocatable \
+                         mrelocatable-lib=fpic \
+                         mrelocatable-lib=fPIC \
+                         mrelocatable-lib=shared
 
 LIBGCC = stmp-multilib stmp-crt
 INSTALL_LIBGCC = install-multilib install-crt
 
 LIBGCC = stmp-multilib stmp-crt
 INSTALL_LIBGCC = install-multilib install-crt