This is the mail archive of the
mailing list for the binutils project.
Re: Patching raw section data with non-partial_inplace relocations
- From: Nick Clifton <nickc at redhat dot com>
- To: Alexandro Sanchez Bach <alexaltea123 at gmail dot com>, binutils at sourceware dot org
- Date: Fri, 30 Jun 2017 16:45:42 +0100
- Subject: Re: Patching raw section data with non-partial_inplace relocations
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=nickc at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A906B63E23
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A906B63E23
- References: <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org>
>> But ... have you tried using the assembler to generate the raw data with reloc directives attached ?
> Not sure if I understand this correctly, is this part of BFD? The binaries I'm processing are given as-is and I cannot assume that C/C++/ASM sources are available to compile them with other flags if that's what you mean.
Sorry - I was not very clear. What I was suggesting was that you write a script that
converts the raw binaries into a series of assembler directives that would reproduce
the data. So for example suppose that your input binary contains the bytes 0x12 0x34
0x56 0x78 in that order then the script would produce:
.byte 0x12, 0x34, 0x56, 0x78
or more likely, since I assume that you are working on 32-bit words:
(or similar, depending upon endianness, and the architecture you are targeting).
Once you have done this, you can then annotate the assembler source, adding in
the necessary relocation hints, and then assemble the result. Eg: