[llvm-commits] ELFReader.cpp update - Add support for References.
Clow, Marshall
mclow at qualcomm.com
Tue Sep 11 11:49:15 PDT 2012
On Sep 11, 2012, at 11:21 AM, Sid Manning <sidneym at codeaurora.org> wrote:
> On 09/07/12 16:45, Michael Spencer wrote:
>> On Fri, Sep 7, 2012 at 8:41 AM, Sid Manning<sidneym at codeaurora.org> wrote:
>>>
> ....
>>
>>> + (reinterpret_cast<const Elf_Rela *>(contents.data()));
>>> +
>>> + // Get rid of the leading .rela so Atoms can use their own section
>>> + // name to find the relocs.
>>> + sectionName = sectionName.drop_front(5);
>>> +
>>> + auto&ref = RelocationAddendReferences[sectionName];
>>
>> Ref.
>>
>>> + for (unsigned int i=0; i<section->getEntityCount(); i++) {
>>> + ref.push_back(relocs+i);
>>
>> This is still wrong. The offset to use for each relocation entry is based on
>> sh_entsize. See the getRel and getEntry templates in Object/ELF.h. We can expose
>> these, or better yet, proper iterators to them. I dislike duplicating the work
>> of file format parsing.
>>
>
> OK I can push this up to ELF.h by adding a new interface, getELFRelaVector(Elf_Shdr *) that returns relocations in a vector.
While I like the
I don't like embedding the return type in the name of the function.
How about (something like):
std::vector <const Elf_Rel *> getSectionRelocations ( section );
> The above for loop would be replaced by an assignment like this:
>
> RelocationAddendReferences[SectionName] = Obj->getELFRelaVector(Section);
>
> If this seems reasonable then I will clean things up and post the whole patch.
>
> Thanks.
>
>
>>
>> - Michael Spencer
>
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
More information about the llvm-commits
mailing list