This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[m68k]



This patch fixes a longstanding bug with -mid-shared-library.


The prologue of a non-leaf function could have omitted saving A5 before
reloading it with the new value for the current shared library.

Tested by building uClinux's userland (the change doesn't affect
non-uClinux m68k targets).

Andrea Tarani does not have FSF papers, but the original patch
he sent me was a one-liner, thus not legally relevant.  I've
just splitted the if-condition for readability.

OK for mainline?

This fix would also be needed on 3.4, although technically it's
not a regression because we didn't support -mid-shared-library
back in 3.3.


2004-12-04 Andrea Tarani <andrea.tarani@gilbarco.com>


	* config/m68k/m68k.c (m68k_save_reg): Also save A5 for non-leaf
	functions when -mid-shared-library is being used.

--- gcc.orig/gcc/config/m68k/m68k.c.orig	2004-12-04 07:23:50.393339686 +0100
+++ gcc/gcc/config/m68k/m68k.c	2004-12-04 07:27:06.126583710 +0100
@@ -428,9 +428,13 @@ m68k_initial_elimination_offset (int fro
static bool
m68k_save_reg (unsigned int regno, bool interrupt_handler)
{
-  if (flag_pic && current_function_uses_pic_offset_table
-      && regno == PIC_OFFSET_TABLE_REGNUM)
-    return true;
+  if (flag_pic && regno == PIC_OFFSET_TABLE_REGNUM)
+    {
+      if (current_function_uses_pic_offset_table)
+	return true;
+      if (!current_function_is_leaf && TARGET_ID_SHARED_LIBRARY)
+	return true;
+    }

  if (current_function_calls_eh_return)
    {

--
 // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]