Commit 84f414bc by Michael Meissner

Fix -fpic problems

From-SVN: r12547
parent b6d1177a
...@@ -2118,7 +2118,7 @@ rs6000_replace_regno (x, from, reg) ...@@ -2118,7 +2118,7 @@ rs6000_replace_regno (x, from, reg)
if (REGNO (x) == from) if (REGNO (x) == from)
{ {
if (! *reg) if (! *reg)
*reg = gen_reg_rtx (Pmode); *reg = pic_offset_table_rtx = gen_reg_rtx (Pmode);
return *reg; return *reg;
} }
......
...@@ -5037,14 +5037,9 @@ ...@@ -5037,14 +5037,9 @@
" "
{ {
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") [(set (match_operand:SI 0 "register_operand" "=r")
(unspec [(match_operand:SI 1 "got_operand" "") (unspec [(match_operand:SI 1 "got_operand" "")
(match_operand:SI 2 "register_operand" "b")] 8))] (match_operand:SI 2 "register_operand" "b")] 8))]
...@@ -5052,37 +5047,6 @@ ...@@ -5052,37 +5047,6 @@
"{l|lwz} %0,%a1@got(%2)" "{l|lwz} %0,%a1@got(%2)"
[(set_attr "type" "load")]) [(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 ;; 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, ;; 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 ;; and this is even supposed to be faster, but it is simpler not to get
...@@ -5111,7 +5075,7 @@ ...@@ -5111,7 +5075,7 @@
} }
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])); emit_insn (gen_movsi_got (operands[0], operands[1]));
DONE; DONE;
......
...@@ -185,25 +185,46 @@ do { \ ...@@ -185,25 +185,46 @@ do { \
else \ else \
error ("Bad value for -msdata=%s", rs6000_sdata_name); \ 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) \ else if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) \
{ \ { \
rs6000_sdata = SDATA_DATA; \ rs6000_sdata = SDATA_DATA; \
rs6000_sdata_name = "data"; \
target_flags |= MASK_SDATA; \ target_flags |= MASK_SDATA; \
} \ } \
else \ else \
rs6000_sdata = SDATA_NONE; \ { \
rs6000_sdata = SDATA_NONE; \
rs6000_sdata_name = "none"; \
} \
\ \
if (TARGET_RELOCATABLE && \ if (TARGET_RELOCATABLE && \
(rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \ (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
{ \ { \
rs6000_sdata = SDATA_DATA; \ 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 \ else if (flag_pic && \
&& DEFAULT_ABI != ABI_SOLARIS) \ (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; \ target_flags &= ~MASK_SDATA; \
error ("-msdata and -mcall-%s are incompatible.", rs6000_abi_name); \ error ("-msdata and -mcall-%s are incompatible.", rs6000_abi_name); \
...@@ -234,6 +255,14 @@ do { \ ...@@ -234,6 +255,14 @@ do { \
target_flags |= MASK_LITTLE_ENDIAN; \ target_flags |= MASK_LITTLE_ENDIAN; \
error ("-mcall-nt must be 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) } while (0)
/* Default ABI to compile code for */ /* Default ABI to compile code for */
......
...@@ -24,16 +24,17 @@ eabi-ctors.c: $(srcdir)/config/rs6000/eabi-ctors.c ...@@ -24,16 +24,17 @@ eabi-ctors.c: $(srcdir)/config/rs6000/eabi-ctors.c
# Build libgcc.a with different options. # Build libgcc.a with different options.
MULTILIB_OPTIONS = msoft-float \ 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 \ MULTILIB_DIRNAMES = nof \
rel \ rel \
le be \ 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=mbig-endian \
mbig=mcall-linux \ mbig=mcall-linux \
msoft-float=mcpu?403 \ msoft-float=mcpu?403 \
...@@ -41,12 +42,12 @@ MULTILIB_MATCHES = mlittle=mlittle-endian \ ...@@ -41,12 +42,12 @@ MULTILIB_MATCHES = mlittle=mlittle-endian \
msoft-float=mcpu?860 \ msoft-float=mcpu?860 \
mcall-sysv-noeabi=mcall-linux \ mcall-sysv-noeabi=mcall-linux \
mcall-sysv-eabi=meabi \ mcall-sysv-eabi=meabi \
mcall-sysv-noeabi=mno-eabi mcall-sysv-noeabi=mno-eabi \
mcall-sysv-noeabi=mcall-solaris \
MULTILIB_EXCEPTIONS = *mrelocatable*/*mcall-sysv-noeabi* \ mrelocatable-lib=mrelocatable \
*mrelocatable*/*mcall-solaris* \ mrelocatable-lib=fpic \
*mbig*/*mcall-solaris* \ mrelocatable-lib=fPIC \
*mlittle*/*mcall-solaris* mrelocatable-lib=shared
LIBGCC = stmp-multilib stmp-crt LIBGCC = stmp-multilib stmp-crt
INSTALL_LIBGCC = install-multilib install-crt INSTALL_LIBGCC = install-multilib install-crt
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment