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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152588
138bc75d-0d04-0410-961f-
82ee72b054a4
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.
/* 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 *);
/* 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)))
fprintf (stderr, "\n");
va_end (ap);
- exit (FATAL_EXIT_CODE);
+ lto_wrapper_exit (FATAL_EXIT_CODE);
}
fprintf (stderr, ": %s\n", xstrerror (e));
va_end (ap);
- exit (FATAL_EXIT_CODE);
+ lto_wrapper_exit (FATAL_EXIT_CODE);
}
{
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);
collect_wait (new_argv[0], pex);
maybe_unlink_file (args_name);
- free (args_name);
free (at_args);
}
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;
putc (c, stdout);
fclose (stream);
maybe_unlink_file (ltrans_output_file);
- free (ltrans_output_file);
free (list_option_full);
}
else
+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,
\
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; \
\
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); \
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);