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

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 18:01:50 PDT 2015


>> 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).

Cheers,
Rafael


More information about the llvm-commits mailing list