[llvm-commits] ELFReader.cpp update - Add support for References.

Sean Silva silvas at purdue.edu
Tue Sep 11 14:17:38 PDT 2012


LLD is using C++11 :)

--Sean Silva

On Tue, Sep 11, 2012 at 3:50 PM, Bill Wendling <wendling at apple.com> wrote:
> On Sep 11, 2012, at 11:49 AM, "Clow, Marshall" <mclow at qualcomm.com> wrote:
>
>> 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 );
>>
> Instead of returning a std::vector, please pass in a reference and fill that.
>
> -bw
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list