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

            Bug ID: 24968
           Summary: objcopy: -B is not useful
           Product: binutils
           Version: 2.33 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: maskray at google dot com
  Target Milestone: ---

objcopy -I binary -O elf64-x86-64 a.txt b                 # e_machine is
EM_NONE
objcopy -I binary -B i386:x86-64 -O elf64-x86-64 a.txt c  # e_machine is
EM_X86_64
cmp -l b c                                                # one byte
difference: 19 0 76

objcopy -I ihex -O elf64-x86-64 a.hex b.o                 # e_machine is
EM_NONE
objcopy -I ihex -B i386:x86-64 -O elf64-x86-64 a.hex b.o  # e_machine is
EM_X86_64
cmp -l b c                                                # one byte
difference: 19 0 76

aarch64/binutils/objcopy -I binary -O elf64-littleaarch64 a.txt b; file b
a.o: ELF 64-bit LSB relocatable, no machine, version 1 (SYSV), not stripped



This means when -I binary is used, both -O and -B have to be specified.
The e_machine information "i386:x86-64" can be inferred from elf64-x86-64.

So is it possible to ignore -B and let `objcopy -I binary -O elf*` create an
object file with e_machine set? This will not break existing use cases.


There is a precedent that ignores -B, elftoolchain elfcopy

case 'B':
  /* ignored */
  break;
  ...
case 'I':
case 's':
  set_input_target(ecp, optarg);
  break;
  ...
case 'O':
  set_output_target(ecp, optarg);
  break;

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to