[PATCH] D25082: [ELF] - Do not crash on invalid section alignment.

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 06:45:07 PDT 2016


evgeny777 added inline comments.


> grimar wrote in InputSection.cpp:48
> For ELF32 it does not, I see no problem here.
> About MaxPageSize - it seems there is no dependency in GNU linkers between section alignment and MaxPageSize,
> why do you think this would be correct ?

Just checked: both gas and llvm-mc require alignment to be 32-bit value which is a power of 2. So better check for alignment can be:

  bool NotPower2 = Header->sh_addralign & (Header->sh_addralign - 1);
  if (Header->sh_addralign > 0x80000000 || NotPower2)
    error("...");

https://reviews.llvm.org/D25082





More information about the llvm-commits mailing list