From 11afe8e8c87cd525efbaab282b2c01d6a52e9d86 Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Wed, 8 Dec 2010 20:11:05 +0000 Subject: [PATCH] re PR debug/46749 (gcc.dg/debug/pr41893-1.c -gdwarf-2 testsuite failures on darwin) PR debug/46749 * config/darwin.h (COLLECT_RUN_DSYMUTIL): Add. (DSYMUTIL_SPEC): Use `linker' flags instead to handle lto better. * config/darwin9.h (COLLECT_RUN_DSYMUTIL): Add. (DSYMUTIL_SPEC): Use `linker' flags instead to handle lto better. * collect2.c (post_ld_pass): Add. (process_args): Add. (maybe_run_lto_and_relink): Call post_ld_pass after ld. (main): Likewise. Call process_args. From-SVN: r167603 --- gcc/ChangeLog | 12 +++++++ gcc/collect2.c | 81 ++++++++++++++++++++++++++++++++++++++++++-- gcc/config/darwin.h | 7 +++- gcc/config/darwin9.h | 7 +++- 4 files changed, 103 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3f99dc6f68b..90a7ff9922c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2010-12-08 Mike Stump + + PR debug/46749 + * config/darwin.h (COLLECT_RUN_DSYMUTIL): Add. + (DSYMUTIL_SPEC): Use `linker' flags instead to handle lto better. + * config/darwin9.h (COLLECT_RUN_DSYMUTIL): Add. + (DSYMUTIL_SPEC): Use `linker' flags instead to handle lto better. + * collect2.c (post_ld_pass): Add. + (process_args): Add. + (maybe_run_lto_and_relink): Call post_ld_pass after ld. + (main): Likewise. Call process_args. + 2010-12-08 Jakub Jelinek PR middle-end/46844 diff --git a/gcc/collect2.c b/gcc/collect2.c index 0b470271e4a..89b21d5eb50 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -333,6 +333,8 @@ static void write_aix_file (FILE *, struct id *); static char *resolve_lib_name (const char *); #endif static char *extract_string (const char **); +static void post_ld_pass (bool); +static void process_args (int *argcp, char **argv); /* Enumerations describing which pass this is for scanning the program file ... */ @@ -1054,6 +1056,7 @@ maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst, /* Run the linker again, this time replacing the object files optimized by the LTO with the temporary file generated by the LTO. */ fork_execute ("ld", out_lto_ld_argv); + post_ld_pass (true); free (lto_ld_argv); maybe_unlink_list (lto_o_files); @@ -1062,7 +1065,8 @@ maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst, { /* Our caller is relying on us to do the link even though there is no LTO back end work to be done. */ - fork_execute ("ld", lto_ld_argv); + fork_execute ("ld", lto_ld_argv); + post_ld_pass (false); } } @@ -1151,6 +1155,8 @@ main (int argc, char **argv) if (argv != old_argv) at_file_supplied = 1; + process_args (&argc, argv); + num_c_args = argc + 9; no_demangle = !! getenv ("COLLECT_NO_DEMANGLE"); @@ -1764,6 +1770,8 @@ main (int argc, char **argv) #endif if (lto_mode != LTO_MODE_NONE) maybe_run_lto_and_relink (ld1_argv, object_lst, object, false); + else + post_ld_pass (false); maybe_unlink (c_file); maybe_unlink (o_file); @@ -1835,6 +1843,8 @@ main (int argc, char **argv) #ifdef COLLECT_EXPORT_LIST maybe_unlink (export_file); #endif + post_ld_pass (false); + maybe_unlink (c_file); maybe_unlink (o_file); return 0; @@ -1920,7 +1930,10 @@ main (int argc, char **argv) if (lto_mode) maybe_run_lto_and_relink (ld2_argv, object_lst, object, true); else - fork_execute ("ld", ld2_argv); + { + fork_execute ("ld", ld2_argv); + post_ld_pass (false); + } /* Let scan_prog_file do any final mods (OSF/rose needs this for constructors/destructors in shared libraries. */ @@ -3203,3 +3216,67 @@ resolve_lib_name (const char *name) return (NULL); } #endif /* COLLECT_EXPORT_LIST */ + +#ifdef COLLECT_RUN_DSYMUTIL +static int flag_dsym = false; +static int flag_idsym = false; + +static void +process_args (int *argcp, char **argv) { + int i, j; + int argc = *argcp; + for (i=0; i