aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMichael Meissner <meissner@gcc.gnu.org>1995-04-14 17:06:46 +0000
committerMichael Meissner <meissner@gcc.gnu.org>1995-04-14 17:06:46 +0000
commitd1d27b4cdfd9461e65f9fbb97c0f911e454409f8 (patch)
tree0ef0ea0d22f0b171f3b76a1b4766ea0277632751 /gcc
parent9973f4a2949b6de3b35752399aea27842e79efdd (diff)
downloadgcc-d1d27b4cdfd9461e65f9fbb97c0f911e454409f8.zip
gcc-d1d27b4cdfd9461e65f9fbb97c0f911e454409f8.tar.gz
gcc-d1d27b4cdfd9461e65f9fbb97c0f911e454409f8.tar.bz2
Emit eabi's main call to __eabi before setting up the minimal TOC, rather than after.
From-SVN: r9382
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/rs6000/eabi.h1
-rw-r--r--gcc/config/rs6000/rs6000.c19
2 files changed, 19 insertions, 1 deletions
diff --git a/gcc/config/rs6000/eabi.h b/gcc/config/rs6000/eabi.h
index 7e4d4f0..9d19ea0 100644
--- a/gcc/config/rs6000/eabi.h
+++ b/gcc/config/rs6000/eabi.h
@@ -50,7 +50,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
((TARGET_RELOCATABLE) ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
/* Invoke an initializer function to set up the GOT */
-#define INVOKE__main 1
#define NAME__MAIN "__eabi"
#undef TARGET_VERSION
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index a905a33d..ce2463d 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -1612,6 +1612,19 @@ output_prolog (file, size)
int total_size = (basic_size + size + current_function_outgoing_args_size);
char buf[256];
+ /* If this is eabi, call __eabi with main, but do so before the minimal TOC
+ is setup, so we can't use the normal mechanism. */
+#if defined(USING_SVR4_H) && defined(NAME__MAIN) && !defined(INVOKE__main)
+ int main_p = 0;
+
+ if (IDENTIFIER_LENGTH (DECL_NAME (current_function_decl)) == 4
+ && !strcmp (IDENTIFIER_POINTER (DECL_NAME (current_function_decl)), "main"))
+ {
+ main_p = 1;
+ regs_ever_live[65] = 1;
+ }
+#endif
+
/* Round size to multiple of 8 bytes. */
total_size = (total_size + 7) & ~7;
@@ -1715,6 +1728,12 @@ output_prolog (file, size)
if (frame_pointer_needed)
asm_fprintf (file, "\tmr 31,1\n");
+ /* If this is eabi, call __eabi before loading up the minimal TOC */
+#if defined(USING_SVR4_H) && defined(NAME__MAIN) && !defined(INVOKE__main)
+ if (main_p)
+ fprintf (file, "\tbl %s\n", NAME__MAIN);
+#endif
+
/* If TARGET_MINIMAL_TOC, and the constant pool is needed, then load the
TOC_TABLE address into register 30. */
if (TARGET_MINIMAL_TOC && get_pool_size () != 0)