bfd_set_error and new error names.
+Thu Feb 17 09:32:14 1994 David J. Mackenzie (djm@thepub.cygnus.com)
+
+ * ldlang.c, ldmain.c, ldmisc.c: Use bfd_get_error and
+ bfd_set_error and new error names.
+
Tue Feb 15 20:14:53 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
* ldwrite.c (build_link_order): If the cooked size of the section
if (output == (bfd *) NULL)
{
- if (bfd_error == invalid_target)
+ if (bfd_get_error () == bfd_error_invalid_target)
{
einfo ("%P%F: target %s not found\n", output_target);
}
i->owner->symcount = is->ifile->symbol_count;
}
- bfd_error = no_error;
+ bfd_set_error (bfd_error_no_error);
if (bfd_relax_section (i->owner, i, &link_info, is->ifile->asymbols))
had_relax = true;
- else if (bfd_error != no_error)
+ else if (bfd_get_error () != bfd_error_no_error)
einfo ("%P%F: can't relax section: %E");
}
else {
long start_time = get_run_time ();
program_name = argv[0];
+ xmalloc_set_program_name (program_name);
bfd_init ();
- atexit (remove_output);
+ xatexit (remove_output);
/* Initialize the data about options. */
trace_files = trace_file_tries = version_printed = false;
char *lim = (char *) sbrk (0);
long run_time = get_run_time () - start_time;
- fprintf (stderr, "%s: total time in link: %d.%06d\n",
+ fprintf (stderr, "%s: total time in link: %ld.%06ld\n",
program_name, run_time / 1000000, run_time % 1000000);
fprintf (stderr, "%s: data size %ld\n", program_name,
(long) (lim - (char *) &environ));
file = fopen (filename, "r");
if (file == (FILE *) NULL)
{
- bfd_error = system_call_error;
+ bfd_set_error (bfd_error_system_call);
einfo ("%X%P: %s: %E", filename);
return;
}
/* ldmisc.c
- Copyright (C) 1991, 1993 Free Software Foundation, Inc.
+ Copyright (C) 1991, 92, 93, 94 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
case 'E':
/* current bfd error or errno */
- fprintf(fp, bfd_errmsg(bfd_error));
+ fprintf(fp, bfd_errmsg(bfd_get_error ()));
break;
case 'I':
unsigned int symbol_count;
symsize = get_symtab_upper_bound (abfd);
- asymbols = (asymbol **) ldmalloc (symsize);
+ asymbols = (asymbol **) xmalloc (symsize);
symbol_count = bfd_canonicalize_symtab (abfd, asymbols);
if (entry != (lang_input_statement_type *) NULL)
{
}
if (fatal == true)
- {
- if (output_filename)
- {
- if (output_bfd && output_bfd->iostream)
- fclose((FILE *)(output_bfd->iostream));
- if (delete_output_file_on_failure)
- unlink (output_filename);
- }
- exit(1);
- }
+ xexit(1);
}
/* Format info message and print on stdout. */
size_t len1 = strlen (s1);
size_t len2 = strlen (s2);
size_t len3 = strlen (s3);
- char *result = ldmalloc (len1 + len2 + len3 + 1);
+ char *result = xmalloc (len1 + len2 + len3 + 1);
if (len1 != 0)
memcpy(result, s1, len1);
return result;
}
-
-PTR
-ldmalloc (size)
- size_t size;
-{
- PTR result = malloc ((int)size);
-
- if (result == (char *)NULL && size != 0)
- einfo("%F%P: virtual memory exhausted\n");
-
- return result;
-}
-
-PTR
-xmalloc (size)
- int size;
-{
- return ldmalloc ((size_t) size);
-}
-
-
-PTR
-ldrealloc (ptr, size)
- PTR ptr;
- size_t size;
-{
- PTR result = realloc (ptr, (int)size);
-
- if (result == (char *)NULL && size != 0)
- einfo("%F%P: virtual memory exhausted\n");
-
- return result;
-}
-
-PTR
-xrealloc (ptr, size)
- PTR ptr;
- int size;
-{
- return ldrealloc (ptr, (size_t) size);
-}
-
-
char *
buystring (x)
CONST char *CONST x;
{
size_t l = strlen(x)+1;
- char *r = ldmalloc(l);
+ char *r = xmalloc(l);
memcpy(r, x,l);
return r;
}