* ldlang.c, ldmain.c, ldmisc.c: Use bfd_get_error and

bfd_set_error and new error names.
This commit is contained in:
David MacKenzie 1994-02-17 18:12:17 +00:00
parent 7681bc7b30
commit 5bcb7f28e1
4 changed files with 18 additions and 64 deletions

View File

@ -1,3 +1,8 @@
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

View File

@ -867,7 +867,7 @@ open_output (name)
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);
}
@ -1792,10 +1792,10 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax)
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 {

View File

@ -153,10 +153,11 @@ main (argc, argv)
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;
@ -308,7 +309,7 @@ main (argc, argv)
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));
@ -483,7 +484,7 @@ add_keepsyms_file (filename)
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;
}

View File

@ -1,5 +1,5 @@
/* 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.
@ -170,7 +170,7 @@ vfinfo(fp, fmt, arg)
case 'E':
/* current bfd error or errno */
fprintf(fp, bfd_errmsg(bfd_error));
fprintf(fp, bfd_errmsg(bfd_get_error ()));
break;
case 'I':
@ -237,7 +237,7 @@ vfinfo(fp, fmt, arg)
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)
{
@ -280,16 +280,7 @@ vfinfo(fp, fmt, arg)
}
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. */
@ -370,7 +361,7 @@ concat (s1, s2, s3)
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);
@ -383,55 +374,12 @@ concat (s1, s2, s3)
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;
}