[llvm-commits] PATCH: lld ReaderELF.cpp update

Sid Manning sidneym at codeaurora.org
Fri Jul 20 09:52:41 PDT 2012


The updated patch is attached and I detailed the changes below.

If this patch is ok then it seems to me that the next logical thing to 
work on would be the ELFWriter.  Along those lines I've started looking 
at the Mach-O writer as my guide.  The writer portion is more complex 
than the reader and I think that making interim drops will be helpful so 
that you guys and others keep tabs on the direction and coding decisions 
being made.

In looking at, WriterMachO.cpp the first thing I noticed was it depended 
on FileOutputBuffer but there is a patch out there for it so I will pull 
that in and see how it works.

A range of different processors will use ELF each with their own set of 
relocation types.  Is my reading of the code correct that 
SectionChunk::write's applyFixup call where the target specific relocs 
will be handled?  That will be nice if that works that way.


On 07/19/12 16:46, Michael Spencer wrote:

>> +  virtual uint64_t size() const {
>> +
>> +    // Common symbols are not allocated in object files so
>> +    // their size is zero.
>> +    if ((Symbol->getType() == llvm::ELF::STT_COMMON)
>> +        || Symbol->st_shndx == llvm::ELF::SHN_COMMON)
>> +      return (uint64_t)0;
>> +
>> +    return (uint64_t) Symbol->st_size;
>> +  }
>
> This is still wrong. It should return the data size.
>
The attached patch fixes this: return Data.size();

>> +
>> +  virtual Alignment alignment() const {
>> +
>> +    // Unallocated common symbols specify their alignment
>> +    // constraints in st_value.
>> +    if ((Symbol->getType() == llvm::ELF::STT_COMMON)
>> +        || Symbol->st_shndx == llvm::ELF::SHN_COMMON) {
>> +      return (Alignment (Symbol->st_value));
>
> Space between Alignment and (. This occurs a few other places.
>
This also changed: return (Alignment(Symbol->st_value));


>>
>
> Other than those few comments it looks good.
>
> - Michael Spencer

Thanks



-- 
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-ElfReader-and-tests-update3.diff
Type: text/x-patch
Size: 27123 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120720/08a97267/attachment.bin>


More information about the llvm-commits mailing list