This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patching raw section data with non-partial_inplace relocations

Hi Alexandro,

>> 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:

  .word 0x12345678

(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:

  .word 0x12345678@ha


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]