[llvm] r241674 - [yaml2obj] Align section content using AddressAlign field's value

Simon Atanasyan simon at atanasyan.com
Thu Jul 9 08:20:40 PDT 2015


Hi,

I think the problem is in the missed section alignment in the tests.
Default value for the AddressAlign filed is 0. But MIPS .rela.text
sections uses 8-byte alignment and X86-64 .text section uses 4-byte
alignment.

Could you try the attached patch? Does it fix the problem?

Simon

On Thu, Jul 9, 2015 at 6:05 PM, Kuba Brecka <jbrecka at apple.com> wrote:
> After this commit, one of our internal bots fails these two tests:
>
> Failing Tests (2):
>    LLVM :: Object/Mips/elf-mips64-rel.yaml
>    LLVM :: Object/yaml2obj-elf-symbol-basic.yaml
>
>
> It looks like this is due to some wrongly assumed alignment, and some
> optimization is turning this into a crash only on this machine, while other
> buildbots seem to run fine.  I was able to reproduce the issue on my machine
> by adding the following assert (that explicitly checks the assumed
> alignment) into Support/Endian.h:
>
> inline value_type read(const void *memory) {
>   assert(((long)memory & ((detail::PickAlignment<value_type,
> alignment>::value)-1)) == 0);
>   value_type ret;
>
>   memcpy(&ret,
>          LLVM_ASSUME_ALIGNED(memory,
>            (detail::PickAlignment<value_type, alignment>::value)),
>          sizeof(value_type));
>   return byte_swap<value_type, endian>(ret);
> }
>
> Do you think you could take a look into that?
>
> Thanks,
> Kuba
>
> On 08 Jul 2015, at 12:12, Simon Atanasyan <simon at atanasyan.com> wrote:
>
> Author: atanasyan
> Date: Wed Jul  8 05:12:40 2015
> New Revision: 241674
>
> URL: http://llvm.org/viewvc/llvm-project?rev=241674&view=rev
> Log:
> [yaml2obj] Align section content using AddressAlign field's value
>
> Use AddressAlign field's value to properly align sections content in the
> yaml2obj tool. Before this change the yaml2obj ignored AddressAlign and
> always aligned section on 16 bytes boundary.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alignment.patch
Type: application/octet-stream
Size: 949 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150709/5c888efd/attachment.obj>


More information about the llvm-commits mailing list