[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/31571] strip mangles 64-bit mach-o binaries
From: |
nickc at redhat dot com |
Subject: |
[Bug binutils/31571] strip mangles 64-bit mach-o binaries |
Date: |
Tue, 09 Apr 2024 10:54:30 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=31571
Nick Clifton <nickc at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nickc at redhat dot com
--- Comment #1 from Nick Clifton <nickc at redhat dot com> ---
(In reply to Jubilee Young from comment #0)
Hi Jubilee,
> This issue may be constrained to aarch64 macOS.
This is going to be a very hard problem (for me) to diagnose. Mainly because I
do not have access to an AArch64 MacOS system. Are you willing to run some
tests to help track down the cause ?
> Part of the issue appears to be mangling the header. The green diff on the
> right is what happens after a binary is mangled by strip.
Generally speaking strip should not be mangling the header in this way,
especially not the magic number. (I am not a MacOS expert, but I assume that
the magic number is important and should not be changed).
Judging by the change in magic number however it appears that strip has changed
the output from a 64-bit format (BFD_MACH_O_MH_MAGIC_64) to 32-bit format
(BFD_MACH_O_MH_MAGIC). Which is obviously wrong.
Hmm, looking in the code, I think that I might see the problem. It appears
that the BFD library does not support generating version 2 (0xFEEDFACF) format
output. Take a look at the bfd_mach_o_arm64_mkobject() function in
bfd/mach-o-aarch64.c (around line 57). I have no idea why this is the case.
Nor how easy it would be to generate the version 2 format output.
Do you fancy doing some binutils hacking of your own and seeing if you can
either a) add support for the version 2 format or b) have version 2 format
input rejected so that strip will not silently corrupt binaries ?
Cheers
Nick
Assuming that this is correct
--
You are receiving this mail because:
You are on the CC list for the bug.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug binutils/31571] strip mangles 64-bit mach-o binaries,
nickc at redhat dot com <=