This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bugzilla bug 493 - libbfd seg fault


On Wed, Dec 12, 2001 at 09:04:37PM -0500, Niels Christiansen wrote:
> Alan,
> 
> This code works just fine on Linux IA32 and AIX PPC.  Adding bfd_init()
> makes no difference.  set_default_bfd_target() seems to be a function used
> only by binutils when you want to look at binaries from a different
> platform and is unresolved if I try to use it, so obviously not in the
> library.

Um, OK, set_default_bfd_target is a wrapper in bucomm.c.  Applying this
patch:

--- bfdtest.c~  Thu Dec 13 09:55:33 2001
+++ bfdtest.c   Thu Dec 13 11:50:07 2001
@@ -22,6 +22,14 @@
       printf("Usage: %s kernel-image\n", argv[0]);
       exit(1);
    }
+
+   bfd_init ();
+   if (! bfd_set_default_target ("powerpc-unknown-linux-gnu"))
+   {
+      perror("bfd_set_default_target");
+      exit(1);
+   }
+
    if ((ibfd = (bfd_openr(argv[1], NULL))) == NULL)
    {
       perror("bfd_openr");

gives me the following

alan@pepper:~/bfdtest$ ./bfdtest bfdtest | tail
_bfd_generic_get_section_contents_in_window
_bfd_elf_reloc_type_class
coff_find_nearest_line
bfd_get_section_by_name
_bfd_elf_link_hash_table_create
bfd_set_arch_info
bfd_elf32_big_generic_vec
__gmon_start__
strcpy@@GLIBC_2.0
bfd_link_hash_lookup



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]