Bug 1568410 - Build with support for Mach-O
Summary: Build with support for Mach-O
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: cross-binutils
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: David Howells
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-17 12:50 UTC by Cristian Morales Vega
Modified: 2018-07-06 09:23 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-07-02 10:21:26 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Cristian Morales Vega 2018-04-17 12:50:05 UTC
I found myself having to look at a Mach-O binary and found out the Fedora binutils package is built without support for it. Sure, I'm mainly going to find ELF binaries in a Linux systems, but it would be nice to have the capacity of looking into Mach-O (and others?) files, without having to build binutils, nevertheless.

Comment 1 Nick Clifton 2018-04-17 15:26:35 UTC
Hi Cristian,

  Fedora has a separate cross-binutils package that provides builds for
  various different, not normally supported, architectures.  (But not
  currently Mach-o).  So I have reset the component to this package which
  should assign the BZ to David Howells.  Who doubtless thank me profusely
  for giving this problem to him...

Cheers
  Nick

Comment 2 David Howells 2018-06-29 10:16:33 UTC
I have to admit, I've never heard of it.  I don't see a kernel arch for it upstream, which is the normal criterion.  What's the --target tuple I should use to try this?

Comment 3 Cristian Morales Vega 2018-06-29 12:03:19 UTC
https://en.wikipedia.org/wiki/Mach-O

AFAIK Mach-O is only used by Macs/iPhones. It's well possible the kernel doesn't know anything about it.

But binutils has the support -> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=bfd/mach-o.c;h=d58e62d94e81d6d043d073d951581d8973299fb6;hb=HEAD


In any case, without knowing the details, I'm not sure why "cross-" needs to be involved here. The bfd configure script takes "--enable-targets=all" and "--enable-plugins". So, couldn't the main binutils package be built with support for all the binary formats? Potentially even splitting it in subpackages, using "--enable-plugins", to avoid the extra space overhead for whoever is not interested in the support?
Has been over two months since I looked at this, but AFAICR it did work.

Comment 4 Jakub Jelinek 2018-06-29 14:08:22 UTC
--enable-targets=all still doesn't support all the targets, you don't get assemblers etc. that way for all the targets.  And, enabling too many targets is a security risk for tools like strings etc., where specially crafted Mach-O and other objects could trigger bugs in that support.

Comment 5 Nick Clifton 2018-07-02 10:21:26 UTC
Hi Cristian,

>  So, couldn't the main binutils package be built with
> support for all the binary formats?

I just want to second Jakub's point here.  Enabling all targets in the default
binutils is just asking for trouble.  In particular almost all of the CVE bug reports against the binutils in the last few years have been against obscure and/or old formats like IEEE, and AOUT.
 
So whilst I appreciate that it might be more convenient to enable support
for all targets, I am not going to do it.

Cheers
  Nick

Comment 6 David Howells 2018-07-06 09:21:20 UTC
Also, I've experimented with this in the past, and I seem to recall that enabling all targets makes the binutils binaries huge.  I seem to remember an aggregate size on the order of a gigabyte, but I may be misremembering.

Comment 7 David Howells 2018-07-06 09:23:15 UTC
I can enable it, but you need to tell me what --target=xxx thing or things I need to add.


Note You need to log in before you can comment on or make changes to this bug.