comparison sources/toys/gcc-uClibc.c @ 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 d8e531563e35
children f257bd255545
comparison
equal deleted inserted replaced
437:2daf5639a022 438:e9f3011ec40d
27 static char nostdlib[] = "-nostdlib"; 27 static char nostdlib[] = "-nostdlib";
28 28
29 // For C++ 29 // For C++
30 static char nostdinc_plus[] = "-nostdinc++"; 30 static char nostdinc_plus[] = "-nostdinc++";
31 31
32 // #define GIMME_AN_S for wrapper to support --enable-shared toolchain.
33
32 #ifdef GIMME_AN_S 34 #ifdef GIMME_AN_S
33 #define ADD_GCC_S() gcc_argv[argcnt++] = "-Wl,--as-needed,-lgcc_s,--no-as-needed" 35 #define ADD_GCC_S() \
36 do { \
37 if (!use_static_linking) \
38 gcc_argv[argcnt++] = "-Wl,--as-needed,-lgcc_s,--no-as-needed"; \
39 else gcc_argv[argcnt++] = "-lgcc_eh"; \
40 } while (0);
34 #else 41 #else
35 #define ADD_GCC_S() 42 #define ADD_GCC_S()
36 #endif 43 #endif
37
38
39
40 44
41 // Confirm that a regular file exists, and (optionally) has the executable bit. 45 // Confirm that a regular file exists, and (optionally) has the executable bit.
42 int is_file(char *filename, int has_exe) 46 int is_file(char *filename, int has_exe)
43 { 47 {
44 // Confirm it has the executable bit set, if necessary. 48 // Confirm it has the executable bit set, if necessary.
450 for (i=1; i<argc; i++) if (argv[i]) gcc_argv[argcnt++] = argv[i]; 454 for (i=1; i<argc; i++) if (argv[i]) gcc_argv[argcnt++] = argv[i];
451 455
452 if (use_stdlib) { 456 if (use_stdlib) {
453 //gcc_argv[argcnt++] = "-Wl,--start-group"; 457 //gcc_argv[argcnt++] = "-Wl,--start-group";
454 gcc_argv[argcnt++] = "-lgcc"; 458 gcc_argv[argcnt++] = "-lgcc";
455 if (!use_static_linking) ADD_GCC_S(); 459 ADD_GCC_S();
456 // gcc_argv[argcnt++] = "-lgcc_eh";
457 } 460 }
458 for (i = 0 ; i < liblen ; i++) 461 for (i = 0 ; i < liblen ; i++)
459 if (libraries[i]) gcc_argv[argcnt++] = libraries[i]; 462 if (libraries[i]) gcc_argv[argcnt++] = libraries[i];
460 if (use_stdlib) { 463 if (use_stdlib) {
461 if (cplusplus) { 464 if (cplusplus) {
462 gcc_argv[argcnt++] = "-lstdc++"; 465 gcc_argv[argcnt++] = "-lstdc++";
463 gcc_argv[argcnt++] = "-lm"; 466 gcc_argv[argcnt++] = "-lm";
464 } 467 }
465 gcc_argv[argcnt++] = "-lc"; 468 gcc_argv[argcnt++] = "-lc";
466 gcc_argv[argcnt++] = "-lgcc"; 469 gcc_argv[argcnt++] = "-lgcc";
467 if (!use_static_linking) ADD_GCC_S(); 470 ADD_GCC_S();
468 // gcc_argv[argcnt++] = "-lgcc_eh";
469 //gcc_argv[argcnt++] = "-Wl,--end-group"; 471 //gcc_argv[argcnt++] = "-Wl,--end-group";
470 } 472 }
471 if (ctor_dtor) { 473 if (ctor_dtor) {
472 gcc_argv[argcnt++] = crtend_path[use_pic ? 1 : 0]; 474 gcc_argv[argcnt++] = crtend_path[use_pic ? 1 : 0];
473 gcc_argv[argcnt++] = crtn_path; 475 gcc_argv[argcnt++] = crtn_path;