* dlltool.c (bfd_get_errmsg): New macro.
        (scan_obj_file): Use it.
        (make_one_lib_file): Use it.
        (make_head): Use it.
        (make_delay_head): Use it.
        (make_tail): Use it.
        (gen_lib_file): Use it.
        (identify_dll_for_implib): Use it.
        (identify_search_archive):  Use it.
This commit is contained in:
Nick Clifton 2009-10-16 14:02:55 +00:00
parent ed94852035
commit dec872897c
2 changed files with 97 additions and 52 deletions

View File

@ -1,3 +1,16 @@
2009-10-16 Yann Droneaud <yann@droneaud.fr>
PR 10768
* dlltool.c (bfd_get_errmsg): New macro.
(scan_obj_file): Use it.
(make_one_lib_file): Use it.
(make_head): Use it.
(make_delay_head): Use it.
(make_tail): Use it.
(gen_lib_file): Use it.
(identify_dll_for_implib): Use it.
(identify_search_archive): Use it.
2009-10-16 Nick Clifton <nickc@redhat.com>
* readelf.c (usage): Add mention of --debug-dump=frames-interp.

View File

@ -243,6 +243,7 @@
#define PAGE_SIZE ((bfd_vma) 4096)
#define PAGE_MASK ((bfd_vma) (-4096))
#include "sysdep.h"
#include "bfd.h"
#include "libiberty.h"
@ -266,6 +267,9 @@
#include "coff/x86_64.h"
#endif
/* get current BFD error message */
#define bfd_get_errmsg() (bfd_errmsg (bfd_get_error ()))
/* Forward references. */
static char *look_for_prog (const char *, const char *, int);
static char *deduce_name (const char *);
@ -342,12 +346,9 @@ typedef struct iheadt
(qv "ihead structure"). */
static iheadtype *import_list = NULL;
static char *as_name = NULL;
static char * as_flags = "";
static char *tmp_prefix;
static int no_idata4;
static int no_idata5;
static char *exp_name;
@ -365,6 +366,7 @@ typedef struct dll_name_list_node_t
char * dllname;
struct dll_name_list_node_t * next;
} dll_name_list_node_type;
typedef struct dll_name_list_t
{
dll_name_list_node_type * head;
@ -377,6 +379,7 @@ typedef struct symname_search_data_t
const char * symname;
bfd_boolean found;
} symname_search_data_type;
typedef struct identify_data_t
{
dll_name_list_type * list;
@ -387,7 +390,6 @@ typedef struct identify_data_t
static char *head_label;
static char *imp_name_lab;
static char *dll_name;
static int add_indirect = 0;
static int add_underscore = 0;
static int add_stdcall_underscore = 0;
@ -1620,7 +1622,7 @@ scan_obj_file (const char *filename)
if (!f)
/* xgettext:c-format */
fatal (_("Unable to open object file: %s"), filename);
fatal (_("Unable to open object file: %s: %s"), filename, bfd_get_errmsg ());
/* xgettext:c-format */
inform (_("Scanning object file %s"), filename);
@ -1654,7 +1656,7 @@ scan_obj_file (const char *filename)
bfd_close (f);
}
/**********************************************************************/
static void
dump_def_info (FILE *f)
@ -2367,7 +2369,8 @@ make_one_lib_file (export_type *exp, int i, int delay)
if (!abfd)
/* xgettext:c-format */
fatal (_("bfd_open failed open stub file: %s"), outname);
fatal (_("bfd_open failed open stub file: %s: %s"),
outname, bfd_get_errmsg ());
/* xgettext:c-format */
inform (_("Creating stub file: %s"), outname);
@ -2824,6 +2827,11 @@ make_one_lib_file (export_type *exp, int i, int delay)
bfd_set_symtab (abfd, ptrs, oidx);
bfd_close (abfd);
abfd = bfd_openr (outname, HOW_BFD_READ_TARGET);
if (!abfd)
/* xgettext:c-format */
fatal (_("bfd_open failed reopen stub file: %s: %s"),
outname, bfd_get_errmsg ());
return abfd;
}
@ -2831,6 +2839,7 @@ static bfd *
make_head (void)
{
FILE *f = fopen (TMP_HEAD_S, FOPEN_WT);
bfd *abfd;
if (f == NULL)
{
@ -2893,13 +2902,20 @@ make_head (void)
assemble_file (TMP_HEAD_S, TMP_HEAD_O);
return bfd_openr (TMP_HEAD_O, HOW_BFD_READ_TARGET);
abfd = bfd_openr (TMP_HEAD_O, HOW_BFD_READ_TARGET);
if (abfd == NULL)
/* xgettext:c-format */
fatal (_("failed to open temporary head file: %s: %s"),
TMP_HEAD_O, bfd_get_errmsg ());
return abfd;
}
bfd *
make_delay_head (void)
{
FILE *f = fopen (TMP_HEAD_S, FOPEN_WT);
bfd *abfd;
if (f == NULL)
{
@ -2966,13 +2982,20 @@ make_delay_head (void)
assemble_file (TMP_HEAD_S, TMP_HEAD_O);
return bfd_openr (TMP_HEAD_O, HOW_BFD_READ_TARGET);
abfd = bfd_openr (TMP_HEAD_O, HOW_BFD_READ_TARGET);
if (abfd == NULL)
/* xgettext:c-format */
fatal (_("failed to open temporary head file: %s: %s"),
TMP_HEAD_O, bfd_get_errmsg ());
return abfd;
}
static bfd *
make_tail (void)
{
FILE *f = fopen (TMP_TAIL_S, FOPEN_WT);
bfd *abfd;
if (f == NULL)
{
@ -3030,7 +3053,13 @@ make_tail (void)
assemble_file (TMP_TAIL_S, TMP_TAIL_O);
return bfd_openr (TMP_TAIL_O, HOW_BFD_READ_TARGET);
abfd = bfd_openr (TMP_TAIL_O, HOW_BFD_READ_TARGET);
if (abfd == NULL)
/* xgettext:c-format */
fatal (_("failed to open temporary tail file: %s: %s"),
TMP_TAIL_O, bfd_get_errmsg ());
return abfd;
}
static void
@ -3049,7 +3078,8 @@ gen_lib_file (int delay)
if (!outarch)
/* xgettext:c-format */
fatal (_("Can't open .lib file: %s"), imp_name);
fatal (_("Can't create .lib file: %s: %s"),
imp_name, bfd_get_errmsg ());
/* xgettext:c-format */
inform (_("Creating library file: %s"), imp_name);
@ -3359,7 +3389,9 @@ identify_dll_for_implib (void)
abfd = bfd_openr (identify_imp_name, 0);
if (abfd == NULL)
bfd_fatal (identify_imp_name);
/* xgettext:c-format */
fatal (_("Can't open .lib file: %s: %s"),
identify_imp_name, bfd_get_errmsg ());
if (! bfd_check_format (abfd, bfd_archive))
{