From: Michael Meissner Date: Tue, 23 Jul 1996 16:44:34 +0000 (+0000) Subject: Fix -fpic problems X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=84f414bc1f23881578336f4758a00538711f1bbc;p=gcc.git Fix -fpic problems From-SVN: r12547 --- diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 38a806496ae..d1920a0e364 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -2118,7 +2118,7 @@ rs6000_replace_regno (x, from, reg) if (REGNO (x) == from) { if (! *reg) - *reg = gen_reg_rtx (Pmode); + *reg = pic_offset_table_rtx = gen_reg_rtx (Pmode); return *reg; } diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 80135d3da06..7f9d6a90e21 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -5037,14 +5037,9 @@ " { 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))] @@ -5052,37 +5047,6 @@ "{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 @@ -5111,7 +5075,7 @@ } 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; diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index a5aa5b209cf..2c4fb7082d0 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -185,25 +185,46 @@ do { \ 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) \ - 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; \ + rs6000_sdata_name = "data"; \ 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; \ - 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); \ @@ -234,6 +255,14 @@ do { \ 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 */ diff --git a/gcc/config/rs6000/t-ppcgas b/gcc/config/rs6000/t-ppcgas index 115323d96bb..cea52c06d9a 100644 --- a/gcc/config/rs6000/t-ppcgas +++ b/gcc/config/rs6000/t-ppcgas @@ -24,16 +24,17 @@ eabi-ctors.c: $(srcdir)/config/rs6000/eabi-ctors.c # Build libgcc.a with different options. MULTILIB_OPTIONS = msoft-float \ - mrelocatable \ + mrelocatable-lib \ 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 \ - cs ce ca sol + cs ce ca MULTILIB_MATCHES = mlittle=mlittle-endian \ + mlittle=mcall-solaris \ 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 \ - 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