diff sources/toys/gcc-uClibc.c @ 390:a9a9eee9e620

Teach the wrapper script to do the libgcc_s --as-needed stuff when appropriate, and to use an arch-specific name for the unwrapped version so you can have more than one cross compiler in the $PATH.
author Rob Landley <rob@landley.net>
date Sun, 24 Aug 2008 19:29:20 -0500
parents d37e39370d39
children 34fed9a885f3
line wrap: on
line diff
--- a/sources/toys/gcc-uClibc.c	Fri Aug 15 14:29:14 2008 -0500
+++ b/sources/toys/gcc-uClibc.c	Sun Aug 24 19:29:20 2008 -0500
@@ -28,6 +28,14 @@
 // For C++
 static char nostdinc_plus[] = "-nostdinc++";
 
+#ifdef GIMME_AN_S
+#define ADD_GCC_S() gcc_argv[argcnt++] = "-Wl,--as-needed,-lgcc_s,--no-as-needed"
+#else
+#define ADD_GCC_S()
+#endif
+
+
+
 
 // Confirm that a regular file exists, and (optionally) has the executable bit.
 int is_file(char *filename, int has_exe)
@@ -134,7 +142,7 @@
 	// What's the name of the C compiler we're wrapping?  (It may have a
 	// cross-prefix.)
 	cc = getenv("UCLIBC_CC");
-	if (!cc) cc = "gcc-unwrapped";
+	if (!cc) cc = GCC_UNWRAPPED_NAME;
 
 	
 	// Check end of name, since there could be a cross-prefix on the thing
@@ -475,6 +483,7 @@
 		if (use_stdlib) {
 			//gcc_argv[argcnt++] = "-Wl,--start-group";
 			gcc_argv[argcnt++] = "-lgcc";
+			ADD_GCC_S();
 //			gcc_argv[argcnt++] = "-lgcc_eh";
 		}
 		for (i = 0 ; i < liblen ; i++)
@@ -486,6 +495,7 @@
 			}
 			gcc_argv[argcnt++] = "-lc";
 			gcc_argv[argcnt++] = "-lgcc";
+			ADD_GCC_S();
 //			gcc_argv[argcnt++] = "-lgcc_eh";
 			//gcc_argv[argcnt++] = "-Wl,--end-group";
 		}