[PATCH] D25324: [ELF] - Check that section alignment is a power of 2.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 6 11:25:11 PDT 2016


ruiu added inline comments.


> InputSection.cpp:48
>    // no alignment constraits.
> -  if (Header->sh_addralign > UINT32_MAX)
> -    fatal(getFilename(File) + ": section sh_addralign is too large");
> +  if (Header->sh_addralign > UINT32_MAX ||
> +      (Header->sh_addralign && !isPowerOf2_32(Header->sh_addralign)))

Also, please leave a comment here to say that we reject object files having insanely large alignment requirements and may want to relax this limitation in the future.

binutils-ish tools have incredible long lifetime -- GNU ld has been used for decades now for example. We want to leave a hint why we are doing this, so that people who look at this code 10 years later won't have to wonder why we reject 4GB-aligned sections when they are creating 10 terabyte executable.

https://reviews.llvm.org/D25324





More information about the llvm-commits mailing list