public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Tristan Gingold <gingold@adacore.com>
To: "binutils@sourceware.org Development" <binutils@sourceware.org>
Subject: [Patch]: Fix bfd_get_arch_size for non-ELF targets
Date: Thu, 03 Apr 2014 10:09:00 -0000	[thread overview]
Message-ID: <DD667986-BF49-448D-B70E-B9548BC540B0@adacore.com> (raw)

Hello,

currently bfd_get_arch_size always returns -1 on non-ELF targets. One visible consequence is
the output of objdump -h: the headline is printed for 64 bit vma, even if the vma are 32 bit wide
(and printed using 8 chars).

With this patch, bfd_get_arch_size returns bfd_arch_bits_per_address on non-ELF targets.

I don't know if it is necessary to handle ELF differently here.  It's already the case for
is32bit.

Ok for trunk ?

Tristan.

bfd/
	* bfd.c (bfd_get_arch_size): Default is taken from arch.


diff --git a/bfd/bfd.c b/bfd/bfd.c
index 6b00592..512abc4 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1087,7 +1087,7 @@ bfd_get_arch_size (bfd *abfd)
   if (abfd->xvec->flavour == bfd_target_elf_flavour)
     return get_elf_backend_data (abfd)->s->arch_size;
 
-  return -1;
+  return bfd_arch_bits_per_address (abfd);
 }
 
 /*

             reply	other threads:[~2014-04-03 10:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-03 10:09 Tristan Gingold [this message]
2014-04-03 12:35 ` Alan Modra
2014-04-03 12:48   ` Tristan Gingold
2014-04-03 23:17     ` Alan Modra
2014-04-04 12:20       ` Tristan Gingold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DD667986-BF49-448D-B70E-B9548BC540B0@adacore.com \
    --to=gingold@adacore.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).