[PATCH] D12867: ELF2: Simplify by removing temporary variables

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 18:04:03 PDT 2015


On Mon, Sep 14, 2015 at 6:01 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> >> The object we are building is aligned, but the type doesn't know that.
> >
> >
> > What do you mean? Are you suggesting that we should use
> aligned_ulittle32_t
> > instead of ulittle32_t to avoid byte swapping overhead in cross-linking
> use
> > case?
>
> No, we have to use the final endian in here since we are writing
> directly to the output file.
>
> But Elf_Wold is defined as
>
>  typedef support::detail::packed_endian_specific_integral<
>       uint32_t, target_endianness, 2> Elf_Word;
>
> So the type only knows that it is aligned to 2. It is not important
> for X86_64 since the generated instructions are the same and at
> runtime the pointer will be aligned anyway. For architectures with
> strict alignment we will be generating less efficient code, but then
> again we will have to benchmark a few alternatives in here in the
> future. For now it is OK to just keep the simpler code (i.e.: your
> patch).


Ah, got it. I somehow thought that Elf_Word was a simple typedef to
uint32_t, which is not true.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150914/423decd1/attachment.html>


More information about the llvm-commits mailing list