public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Patch bfd/mach-o] implement bfd_get_arch_size for mach-o.
@ 2012-02-17 21:10 Iain Sandoe
  2012-02-20 16:41 ` Tristan Gingold
  0 siblings, 1 reply; 3+ messages in thread
From: Iain Sandoe @ 2012-02-17 21:10 UTC (permalink / raw)
  To: binutils Development; +Cc: Tristan Gingold

without this we (eventually, several patches away) end up with  
nonsense when processing cfi directives.

OK?
Iain

bfd:

	* bfd.c (bfd_get_arch_size): Implement for mach-o.

bfd/bfd.c |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/bfd/bfd.c b/bfd/bfd.c
index 7c14c7a..1a9cc79 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -985,6 +985,8 @@ bfd_get_arch_size (bfd *abfd)
  {
    if (abfd->xvec->flavour == bfd_target_elf_flavour)
      return get_elf_backend_data (abfd)->s->arch_size;
+  else if (abfd->xvec->flavour == bfd_target_mach_o_flavour)
+    return (abfd)->arch_info->bits_per_address;

    return -1;
  }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch bfd/mach-o] implement bfd_get_arch_size for mach-o.
  2012-02-17 21:10 [Patch bfd/mach-o] implement bfd_get_arch_size for mach-o Iain Sandoe
@ 2012-02-20 16:41 ` Tristan Gingold
  2012-02-21  1:02   ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Tristan Gingold @ 2012-02-20 16:41 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: binutils Development


On Feb 17, 2012, at 10:09 PM, Iain Sandoe wrote:

> without this we (eventually, several patches away) end up with nonsense when processing cfi directives.

Ok from a Mach-O point of view.  I wonder why we cannot use this generic code for all flavors.
Just remove the parenthesis around abfd.

Tristan.

> 
> OK?
> Iain
> 
> bfd:
> 
> 	* bfd.c (bfd_get_arch_size): Implement for mach-o.
> 
> bfd/bfd.c |    2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/bfd/bfd.c b/bfd/bfd.c
> index 7c14c7a..1a9cc79 100644
> --- a/bfd/bfd.c
> +++ b/bfd/bfd.c
> @@ -985,6 +985,8 @@ bfd_get_arch_size (bfd *abfd)
> {
>   if (abfd->xvec->flavour == bfd_target_elf_flavour)
>     return get_elf_backend_data (abfd)->s->arch_size;
> +  else if (abfd->xvec->flavour == bfd_target_mach_o_flavour)
> +    return (abfd)->arch_info->bits_per_address;
> 
>   return -1;
> }
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch bfd/mach-o] implement bfd_get_arch_size for mach-o.
  2012-02-20 16:41 ` Tristan Gingold
@ 2012-02-21  1:02   ` Alan Modra
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Modra @ 2012-02-21  1:02 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: Iain Sandoe, binutils Development

On Mon, Feb 20, 2012 at 05:41:23PM +0100, Tristan Gingold wrote:
> 
> On Feb 17, 2012, at 10:09 PM, Iain Sandoe wrote:
> 
> > without this we (eventually, several patches away) end up with nonsense when processing cfi directives.
> 
> Ok from a Mach-O point of view.  I wonder why we cannot use this generic code for all flavors.
> Just remove the parenthesis around abfd.

You could do that if you check all uses of bfd_get_arch_size.  I think
there is only one that might matter, in nm.c, and that could be fixed
to use:

static void
set_print_width (bfd *file)
{
  print_width = bfd_get_arch_size (file);
  if (print_width < 32)
    print_width = 32;
}

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-21  1:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-17 21:10 [Patch bfd/mach-o] implement bfd_get_arch_size for mach-o Iain Sandoe
2012-02-20 16:41 ` Tristan Gingold
2012-02-21  1:02   ` Alan Modra

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).