bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/23299] New: macOS: objcopy renders object files unusable


From: mephi42 at gmail dot com
Subject: [Bug binutils/23299] New: macOS: objcopy renders object files unusable
Date: Sun, 17 Jun 2018 00:59:55 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=23299

            Bug ID: 23299
           Summary: macOS: objcopy renders object files unusable
           Product: binutils
           Version: 2.31 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: mephi42 at gmail dot com
  Target Milestone: ---

$ cat main.c
int main() {}

$ gcc -c main.c

$ gcc main.o -o main

$ binutils-gdb/binutils/objcopy main.o main1.o

$ gcc main1.o -o main1
ld: object file main1.o was built for different x86_64 sub-type (-2147483645)
than link command line (3) file 'main1.o' for architecture x86_64

Culprit:

--- a/bfd/mach-o-x86-64.c
+++ b/bfd/mach-o-x86-64.c
@@ -54,7 +54,7 @@ bfd_mach_o_x86_64_mkobject (bfd *abfd)
   mdata->header.magic = BFD_MACH_O_MH_MAGIC_64;
   mdata->header.cputype = BFD_MACH_O_CPU_TYPE_X86_64;
   mdata->header.cpusubtype =
-    BFD_MACH_O_CPU_SUBTYPE_X86_ALL | BFD_MACH_O_CPU_SUBTYPE_LIB64;
+    BFD_MACH_O_CPU_SUBTYPE_X86_ALL;
   mdata->header.byteorder = BFD_ENDIAN_LITTLE;
   mdata->header.version = 2;

I'm not proposing to commit this, since I don't know what this flag is for -
the following patch just demonstrates that removing it makes things work in
this particular case. The proper fix might be to copy cpusubtype from ibfd to
obfd, but I'm not sure what would be the right place for this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]