diff options
author | David MacKenzie <djm@cygnus> | 1994-02-17 18:12:17 +0000 |
---|---|---|
committer | David MacKenzie <djm@cygnus> | 1994-02-17 18:12:17 +0000 |
commit | 5bcb7f28e189de403b9efaffe57fec3221f9d16e (patch) | |
tree | ea8d833210cf45dde1f377c32ffaad66ac236683 | |
parent | 7681bc7b30b1ec5006484d892121ce6c0059442a (diff) | |
download | gdb-5bcb7f28e189de403b9efaffe57fec3221f9d16e.zip gdb-5bcb7f28e189de403b9efaffe57fec3221f9d16e.tar.gz gdb-5bcb7f28e189de403b9efaffe57fec3221f9d16e.tar.bz2 |
* ldlang.c, ldmain.c, ldmisc.c: Use bfd_get_error and
bfd_set_error and new error names.
-rw-r--r-- | ld/ChangeLog | 5 | ||||
-rw-r--r-- | ld/ldlang.c | 6 | ||||
-rw-r--r-- | ld/ldmain.c | 7 | ||||
-rw-r--r-- | ld/ldmisc.c | 64 |
4 files changed, 18 insertions, 64 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index a6f829a..82ec5dd 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -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 diff --git a/ld/ldlang.c b/ld/ldlang.c index 52f371a..e8be015 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -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 { diff --git a/ld/ldmain.c b/ld/ldmain.c index f153ceb..23e2d37 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -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; } diff --git a/ld/ldmisc.c b/ld/ldmisc.c index 94d87f0..4239600 100644 --- a/ld/ldmisc.c +++ b/ld/ldmisc.c @@ -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; } |