arbitrary ELF machine-code

Nick Clifton nickc@redhat.com
Mon Feb 20 02:10:00 GMT 2006


Hi Alexander,

> $/opt/bin/mips-linux-uclibc-objcopy --alt-machine-code 0x1e hello.elf 
> hello.bin
> /opt/bin/mips-linux-uclibc-objcopy: alternate machine code index must be 
> positive

Ah, OK, now I understand.  There are two problems here.  The first is 
that the code to parse the value provided with the --alt-machine-code 
switch was not very sophisticated.  The second was that this switch was 
intended to allow the user to switch between alternative machine code 
values that are known to refer to the same target architecture and not 
to set the machine code to some arbitrary value.

The attached patch should resolve both of these problems.  Please could 
you try it out and let me know how you get on.

Cheers
   Nick

binutils/ChangeLog

2006-02-19  Nick Clifton  <nickc@redhat.com>

	* objcopy.c (use_alt_mach_code): Change type to unsigned long.
	(copy_object):  If bfd_alt_mach_code fails emit a more helpful
	message and if the target architecture is ELF use the alternative
	as replacement value for the e_machine number.
	(copy_main): Use strtoul to parse the number provided with the
	--alt-mach-code switch.
	* doc/binutils.texi (--alt-mach-code): Document that this switch
	can now set the absolute e_machine value.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: objcopy.c.patch
Type: text/x-patch
Size: 5894 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20060220/7f82b295/attachment.bin>


More information about the Binutils mailing list