changeset 438:e9f3011ec40d

Teach wrapper about libgcc_eh.a for static linking.
author Rob Landley <rob@landley.net>
date Fri, 31 Oct 2008 17:52:42 -0500
parents 2daf5639a022
children f257bd255545
files sources/toys/gcc-uClibc.c
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/sources/toys/gcc-uClibc.c	Fri Oct 31 05:24:38 2008 -0500
+++ b/sources/toys/gcc-uClibc.c	Fri Oct 31 17:52:42 2008 -0500
@@ -29,15 +29,19 @@
 // For C++
 static char nostdinc_plus[] = "-nostdinc++";
 
+// #define GIMME_AN_S for wrapper to support --enable-shared toolchain.
+
 #ifdef GIMME_AN_S
-#define ADD_GCC_S() gcc_argv[argcnt++] = "-Wl,--as-needed,-lgcc_s,--no-as-needed"
+#define ADD_GCC_S() \
+	do { \
+		if (!use_static_linking) \
+			gcc_argv[argcnt++] = "-Wl,--as-needed,-lgcc_s,--no-as-needed"; \
+		else gcc_argv[argcnt++] = "-lgcc_eh"; \
+	} while (0);
 #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)
 {
@@ -452,8 +456,7 @@
 		if (use_stdlib) {
 			//gcc_argv[argcnt++] = "-Wl,--start-group";
 			gcc_argv[argcnt++] = "-lgcc";
-			if (!use_static_linking) ADD_GCC_S();
-//			gcc_argv[argcnt++] = "-lgcc_eh";
+			ADD_GCC_S();
 		}
 		for (i = 0 ; i < liblen ; i++)
 			if (libraries[i]) gcc_argv[argcnt++] = libraries[i];
@@ -464,8 +467,7 @@
 			}
 			gcc_argv[argcnt++] = "-lc";
 			gcc_argv[argcnt++] = "-lgcc";
-			if (!use_static_linking) ADD_GCC_S();
-//			gcc_argv[argcnt++] = "-lgcc_eh";
+			ADD_GCC_S();
 			//gcc_argv[argcnt++] = "-Wl,--end-group";
 		}
 		if (ctor_dtor) {