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]

Don't use darwin-crt2 on non-ppc Darwins


darwin-crt2.o exists for backwards binary compatibility (that is, new
excecutables running on old OS revisions).  On non-ppc Darwin, that
doesn't exist anyway, so there's no benefit to the file, and I want to
take _init_keymgr() out on those platforms as a cleanup, so this
patch.

Plus, we should be using %s for crt2.o since it is part of GCC and so
should be found using the GCC search path.

Bootstrapped & tested on powerpc-darwin, plus some more extensive
testing with a similar patch on the Apple branch.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-darwin-crt2ppc-3.patch================
2004-04-27  Geoffrey Keating  <geoffk@apple.com>

	* config/darwin.h (STARTFILE_SPEC): Use %s to find crt2.o.
	* config/darwin-crt2.c: Only have contents on __ppc__.

Index: config/darwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.h,v
retrieving revision 1.30.2.28.2.4
diff -u -p -u -p -r1.30.2.28.2.4 darwin.h
--- config/darwin.h	22 Apr 2004 18:12:48 -0000	1.30.2.28.2.4
+++ config/darwin.h	27 Apr 2004 20:00:59 -0000
@@ -320,11 +320,11 @@ Boston, MA 02111-1307, USA.  */
      %{!Zbundle:%{pg:%{static:-lgcrt0.o} \
                      %{!static:%{object:-lgcrt0.o} \
                                %{!object:%{preload:-lgcrt0.o} \
-                                 %{!preload:-lgcrt1.o -lcrt2.o}}}} \
+                                 %{!preload:-lgcrt1.o crt2.o%s}}}} \
                 %{!pg:%{static:-lcrt0.o} \
                       %{!static:%{object:-lcrt0.o} \
                                 %{!object:%{preload:-lcrt0.o} \
-                                  %{!preload:-lcrt1.o -lcrt2.o}}}}}}"
+                                  %{!preload:-lcrt1.o crt2.o%s}}}}}}"
 
 /* The native Darwin linker doesn't necessarily place files in the order
    that they're specified on the link line.  Thus, it is pointless
Index: config/darwin-crt2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin-crt2.c,v
retrieving revision 1.1.12.1
diff -u -p -u -p -r1.1.12.1 darwin-crt2.c
--- config/darwin-crt2.c	25 Nov 2002 04:25:02 -0000	1.1.12.1
+++ config/darwin-crt2.c	27 Apr 2004 20:00:59 -0000
@@ -1,5 +1,5 @@
 /* KeyMgr backwards-compatibility support for Darwin.
-   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -34,6 +34,11 @@ Software Foundation, 59 Temple Place - S
 #include "tconfig.h"
 #include "tsystem.h"
 
+/* This file doesn't do anything useful on non-powerpc targets, since they
+   don't have backwards compatibility anyway.  */
+
+#ifdef __ppc__
+
 /* Homemade decls substituting for getsect.h and dyld.h, so cross
    compilation works.  */
 struct mach_header;
@@ -149,3 +154,5 @@ __darwin_gcc3_preregister_frame_info (vo
   _dyld_register_func_for_add_image (darwin_unwind_dyld_add_image_hook);
   _dyld_register_func_for_remove_image (darwin_unwind_dyld_remove_image_hook);
 }
+
+#endif  /* __ppc__ */
============================================================


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