[PATCH] LynxOS/PowerPC, work with text segment >32M

Adam Nemet anemet@lnxw.com
Thu Jul 7 01:37:00 GMT 2005


Hi,

The testcase below fails on PowerPC with LynxOS.

  int pad ()
  {
    asm (".space 0x02000000");
  }
  
  int main ()
  {
    puts ("ok");
  }

The problem is that the call to __do_global_ctors_aux and
__do_global_dtors_aux span through the whole text segment.  These are
direct calls ranging +/-32M and unnecessarily limiting the size of the
text segment.

Regression-tested on powerpc-lynx-lynxos.  There is a new regression
(gcc.dg/20010912-1.c) but it is an -fpic testcase and on LynxOS only
-fPIC works due to a kernel bug.

OK to commit?

2005-07-06  Adam Nemet  <anemet@lnxw.com> 
 
        * config/rs6000/lynx.h: Mark __do_global_ctors_aux and 
        __do_global_dtors_aux longcall. 

Index: lynx.h 
=================================================================== 
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/lynx.h,v 
retrieving revision 1.21 
diff -u -p -r1.21 lynx.h 
--- lynx.h      25 Jun 2005 01:22:07 -0000      1.21 
+++ lynx.h      7 Jul 2005 01:33:45 -0000 
@@ -106,3 +106,20 @@ 
  
 #undef HAVE_AS_TLS 
 #define HAVE_AS_TLS 0 
+ 
+#ifdef CRT_BEGIN 
+/* This function is part of crtbegin*.o which is at the beginning of 
+   the link and is called from .fini which is usually toward the end 
+   of the executable.  Make it longcall so that we don't limit the 
+   text size of the executables to 32M.  */ 
+ 
+static void __do_global_dtors_aux (void) __attribute__ ((longcall)); 
+#endif /* CRT_BEGIN */ 
+ 
+#ifdef CRT_END 
+/* Similarly here.  This function resides in crtend*.o which is toward 
+   to end of the link and is called from .init which is at the 
+   beginning.  */ 
+ 
+static void __do_global_ctors_aux (void) __attribute__ ((longcall)); 
+#endif /* CRT_END */ 



More information about the Gcc-patches mailing list