aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMichael Meissner <meissner@gcc.gnu.org>1996-06-25 18:51:50 +0000
committerMichael Meissner <meissner@gcc.gnu.org>1996-06-25 18:51:50 +0000
commitd266da75aef5134e076ab4716d793807a3d8457a (patch)
treeed9ab079e43263e635b309192aa7af70116a4583 /gcc
parent24f30767292e7e61f33f7337afc1c9ff55cb0bcb (diff)
downloadgcc-d266da75aef5134e076ab4716d793807a3d8457a.zip
gcc-d266da75aef5134e076ab4716d793807a3d8457a.tar.gz
gcc-d266da75aef5134e076ab4716d793807a3d8457a.tar.bz2
V.4 PIC changes
From-SVN: r12331
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/rs6000/eabi-ci.asm3
-rw-r--r--gcc/config/rs6000/rs6000.c36
-rw-r--r--gcc/config/rs6000/rs6000.h4
-rw-r--r--gcc/config/rs6000/rs6000.md9
4 files changed, 41 insertions, 11 deletions
diff --git a/gcc/config/rs6000/eabi-ci.asm b/gcc/config/rs6000/eabi-ci.asm
index 872a9e6..6b753ca 100644
--- a/gcc/config/rs6000/eabi-ci.asm
+++ b/gcc/config/rs6000/eabi-ci.asm
@@ -44,10 +44,7 @@
.section ".got","aw"
.globl __GOT_START__
.type __GOT_START__,@object
- .weak _GLOBAL_OFFSET_TABLE_
- .type _GLOBAL_OFFSET_TABLE_,@object
__GOT_START__:
-_GLOBAL_OFFSET_TABLE_:
.section ".got1","aw"
.globl __GOT1_START__
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index cbbf1cb..5a097d6 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -2048,6 +2048,42 @@ ccr_bit (op, scc_p)
}
}
+/* By generating position-independent code, when two different
+ programs (A and B) share a common library (libC.a), the text of
+ the library can be shared whether or not the library is linked at
+ the same address for both programs. In some of these
+ environments, position-independent code requires not only the use
+ of different addressing modes, but also special code to enable the
+ use of these addressing modes.
+
+ The `FINALIZE_PIC' macro serves as a hook to emit these special
+ codes once the function is being compiled into assembly code, but
+ not before. (It is not done before, because in the case of
+ compiling an inline function, it would lead to multiple PIC
+ prologues being included in functions which used inline functions
+ and were compiled to assembly language.) */
+
+void
+rs6000_finalize_pic ()
+{
+ if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
+ {
+ /* If a PIC register has been created, insert the pic initialization
+ at the function beginning. */
+ if (pic_offset_table_rtx)
+ {
+ rtx insn = get_insns ();
+ rtx init = gen_init_v4_pic (pic_offset_table_rtx);
+
+ if (GET_CODE (insn) == NOTE)
+ insn = next_nonnote_insn (insn);
+
+ emit_insn_before (init, insn);
+ }
+ }
+}
+
+
/* Print an operand. Recognize special options, documented below. */
#ifdef TARGET_SDATA
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 2cea3e7..f157f0e 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -1934,7 +1934,7 @@ typedef struct rs6000_args
prologues being included in functions which used inline functions
and were compiled to assembly language.) */
-/* #define FINALIZE_PIC */
+#define FINALIZE_PIC rs6000_finalize_pic ()
/* A C expression that is nonzero if X is a legitimate immediate
operand on the target machine when generating position independent
@@ -3070,13 +3070,13 @@ extern int registers_ok_for_quad_peep ();
extern int addrs_ok_for_quad_peep ();
extern enum reg_class secondary_reload_class ();
extern int ccr_bit ();
+extern void rs6000_finalize_pic ();
extern void print_operand ();
extern void print_operand_address ();
extern int first_reg_to_save ();
extern int first_fp_reg_to_save ();
extern int rs6000_makes_calls ();
extern rs6000_stack_t *rs6000_stack_info ();
-extern void svr4_traceback ();
extern void output_prolog ();
extern void output_epilog ();
extern void output_toc ();
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 2c3f4ed..be5c4f3 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -4953,10 +4953,7 @@
"
{
if (!pic_offset_table_rtx)
- {
- pic_offset_table_rtx = gen_reg_rtx (SImode);
- emit_insn (gen_init_v4_pic (pic_offset_table_rtx));
- }
+ pic_offset_table_rtx = gen_reg_rtx (SImode);
operands[2] = pic_offset_table_rtx;
if (flag_pic > 1)
@@ -7179,7 +7176,7 @@
else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
output_asm_insn (\"creqv 6,6,6\", operands);
- return (flag_pic) ? \"bl %z0@plt\" : \"bl %z0\";
+ return \"bl %z0\";
}"
[(set_attr "type" "branch")
(set_attr "length" "4,8")])
@@ -7249,7 +7246,7 @@
else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
output_asm_insn (\"creqv 6,6,6\", operands);
- return (flag_pic) ? \"bl %z1@plt\" : \"bl %z1\";
+ return \"bl %z1\";
}"
[(set_attr "type" "branch")
(set_attr "length" "4,8")])