diff options
author | Richard Guenther <rguenther@suse.de> | 2009-10-09 13:24:59 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-10-09 13:24:59 +0000 |
commit | b1b07c92e166e6c5d8f0fd95503e44b4ecfbd762 (patch) | |
tree | df79584a59c59cc699aebb0953c8a12388d08091 | |
parent | 9f3f7d131fd4200ed84aa44ec75b3c675b8273ae (diff) | |
download | gcc-b1b07c92e166e6c5d8f0fd95503e44b4ecfbd762.zip gcc-b1b07c92e166e6c5d8f0fd95503e44b4ecfbd762.tar.gz gcc-b1b07c92e166e6c5d8f0fd95503e44b4ecfbd762.tar.bz2 |
re PR driver/41637 (testsuite (-flto/-fwhopr) leaves does not clean up in /tmp)
2009-10-09 Richard Guenther <rguenther@suse.de>
PR driver/41637
* lto-wrapper.c (ltrans_output_file, flto_out, args_name): New
globals.
(lto_wrapper_exit): New function.
(fatal): Use it.
(fatal_perror): Likewise.
(fork_execute): Use global args_name, do not free it.
(run_gcc): Use global ltrans_output_file, flto_out, do not free them.
* lto-streamer.h: Remove duplicate prototypes.
PR lto/41635
PR lto/41636
lto/
* lto.c (read_cgraph_and_symbols): Do not assert we can open
a file.
* lto-elf.c (init_shdr##BITS): Fix i18n problems.
(init_ehdr##BITS): Likewise.
From-SVN: r152588
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/lto-streamer.h | 4 | ||||
-rw-r--r-- | gcc/lto-wrapper.c | 36 | ||||
-rw-r--r-- | gcc/lto/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/lto/lto-elf.c | 14 | ||||
-rw-r--r-- | gcc/lto/lto.c | 5 |
6 files changed, 64 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ed31c56..a214221 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,17 @@ 2009-10-09 Richard Guenther <rguenther@suse.de> + PR driver/41637 + * lto-wrapper.c (ltrans_output_file, flto_out, args_name): New + globals. + (lto_wrapper_exit): New function. + (fatal): Use it. + (fatal_perror): Likewise. + (fork_execute): Use global args_name, do not free it. + (run_gcc): Use global ltrans_output_file, flto_out, do not free them. + * lto-streamer.h: Remove duplicate prototypes. + +2009-10-09 Richard Guenther <rguenther@suse.de> + * cgraph.c (cgraph_create_edge): Check for NULL call_stmt before calling stmt_can_throw_external. diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index c4d66b7..4d90ecb 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -806,10 +806,6 @@ extern void lto_check_version (int, int); /* In lto-streamer-in.c */ -extern void lto_input_function_body (struct lto_file_decl_data *, tree, - const char *); -extern void lto_input_constructors_and_inits (struct lto_file_decl_data *, - const char *); extern void lto_input_cgraph (struct lto_file_decl_data *, const char *); extern void lto_init_reader (void); extern tree lto_input_tree (struct lto_input_block *, struct data_in *); diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index 228a0a4..cddd415 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -55,6 +55,26 @@ enum lto_mode_d { /* Current LTO mode. */ static enum lto_mode_d lto_mode = LTO_MODE_NONE; +static char *ltrans_output_file; +static char *flto_out; +static char *args_name; + +static void maybe_unlink_file (const char *); + +/* Delete tempfiles and exit function. */ + +static void +lto_wrapper_exit (int status) +{ + if (ltrans_output_file) + maybe_unlink_file (ltrans_output_file); + if (flto_out) + maybe_unlink_file (flto_out); + if (args_name) + maybe_unlink_file (args_name); + exit (status); +} + /* Just die. CMSGID is the error message. */ static void __attribute__ ((format (printf, 1, 2))) @@ -68,7 +88,7 @@ fatal (const char * cmsgid, ...) fprintf (stderr, "\n"); va_end (ap); - exit (FATAL_EXIT_CODE); + lto_wrapper_exit (FATAL_EXIT_CODE); } @@ -86,7 +106,7 @@ fatal_perror (const char *cmsgid, ...) fprintf (stderr, ": %s\n", xstrerror (e)); va_end (ap); - exit (FATAL_EXIT_CODE); + lto_wrapper_exit (FATAL_EXIT_CODE); } @@ -190,11 +210,13 @@ fork_execute (char **argv) { struct pex_obj *pex; char *new_argv[3]; - char *args_name = make_temp_file (".args"); - char *at_args = concat ("@", args_name, NULL); - FILE *args = fopen (args_name, "w"); + char *at_args; + FILE *args; int status; + args_name = make_temp_file (".args"); + at_args = concat ("@", args_name, NULL); + args = fopen (args_name, "w"); if (args == NULL) fatal ("failed to open %s", args_name); @@ -213,7 +235,6 @@ fork_execute (char **argv) collect_wait (new_argv[0], pex); maybe_unlink_file (args_name); - free (args_name); free (at_args); } @@ -227,8 +248,6 @@ run_gcc (unsigned argc, char *argv[]) unsigned new_argc = argc; const char **new_argv; const char **argv_ptr; - char *ltrans_output_file = NULL; - char *flto_out = NULL; char *list_option_full = NULL; new_argc += 8; @@ -320,7 +339,6 @@ run_gcc (unsigned argc, char *argv[]) putc (c, stdout); fclose (stream); maybe_unlink_file (ltrans_output_file); - free (ltrans_output_file); free (list_option_full); } else diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index f2eb1a2..82b8bec 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,12 @@ +2009-10-09 Richard Guenther <rguenther@suse.de> + + PR lto/41635 + PR lto/41636 + * lto.c (read_cgraph_and_symbols): Do not assert we can open + a file. + * lto-elf.c (init_shdr##BITS): Fix i18n problems. + (init_ehdr##BITS): Likewise. + 2009-10-08 Joseph Myers <joseph@codesourcery.com> * lto-elf.c (init_shdr##BITS, lto_elf_begin_section_with_type, diff --git a/gcc/lto/lto-elf.c b/gcc/lto/lto-elf.c index 28c26c7..190430b 100644 --- a/gcc/lto/lto-elf.c +++ b/gcc/lto/lto-elf.c @@ -235,7 +235,12 @@ init_shdr##BITS (Elf_Scn *scn, size_t sh_name, size_t sh_type) \ \ shdr = elf##BITS##_getshdr (scn); \ if (!shdr) \ - fatal_error ("elf"#BITS"_getshdr() failed: %s", elf_errmsg (-1));\ + { \ + if (BITS == 32) \ + fatal_error ("elf32_getshdr() failed: %s", elf_errmsg (-1)); \ + else \ + fatal_error ("elf64_getshdr() failed: %s", elf_errmsg (-1)); \ + } \ \ shdr->sh_name = sh_name; \ shdr->sh_type = sh_type; \ @@ -486,7 +491,12 @@ init_ehdr##BITS (lto_elf_file *elf_file) \ \ ehdr = elf##BITS##_newehdr (elf_file->elf); \ if (!ehdr) \ - fatal_error ("elf"#BITS"_newehdr() failed: %s", elf_errmsg (-1));\ + { \ + if (BITS == 32) \ + fatal_error ("elf32_newehdr() failed: %s", elf_errmsg (-1)); \ + else \ + fatal_error ("elf64_newehdr() failed: %s", elf_errmsg (-1)); \ + } \ \ memcpy (ehdr->e_ident, cached_file_attrs.elf_ident, \ sizeof cached_file_attrs.elf_ident); \ diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index cc40091..2b674c1 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -1779,7 +1779,10 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) unsigned num_objects; resolution = fopen (resolution_file_name, "r"); - gcc_assert (resolution != NULL); + if (resolution == NULL) + fatal_error ("could not open symbol resolution file: %s", + xstrerror (errno)); + t = fscanf (resolution, "%u", &num_objects); gcc_assert (t == 1); |